Set _X_OPEN_SOURCE and default compiler in build script

This commit is contained in:
Lassi Kortela 2019-08-10 01:43:47 +03:00
parent 86ebfb7a12
commit 2950e6ae5b
4 changed files with 37 additions and 12 deletions

View File

@ -2,8 +2,6 @@
string functions string functions
*/ */
#define _XOPEN_SOURCE
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>

View File

@ -1,5 +1,3 @@
#define _XOPEN_SOURCE
#include <sys/poll.h> #include <sys/poll.h>
#include <sys/time.h> #include <sys/time.h>

View File

@ -13,8 +13,6 @@
A UTF-8 validation routine is included. A UTF-8 validation routine is included.
*/ */
#define _XOPEN_SOURCE
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>

View File

@ -1,11 +1,42 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
CC="${CC:-clang}"
CFLAGS="-Wall -Wextra -Wno-strict-aliasing -std=gnu99" CFLAGS="-Wall -Wextra -Wno-strict-aliasing -std=gnu99"
CFLAGS="$CFLAGS -O2" # -falign-functions CFLAGS="$CFLAGS -O2" # -falign-functions
CFLAGS="$CFLAGS -I ../c -D NDEBUG -D USE_COMPUTED_GOTO" CFLAGS="$CFLAGS -I ../c -D NDEBUG -D USE_COMPUTED_GOTO"
LFLAGS="-lm" LFLAGS="-lm"
os="$(uname | tr A-Z- a-z_)" os="$(uname | tr A-Z- a-z_)"
case "$os" in
darwin)
default_cc="clang"
;;
dragonfly)
default_cc="gcc"
;;
freebsd)
default_cc="clang"
;;
haiku)
default_cc="gcc"
;;
linux)
default_cc="gcc"
CFLAGS="$CFLAGS -D _XOPEN_SOURCE"
;;
netbsd)
default_cc="gcc"
;;
openbsd)
default_cc="clang"
;;
sunos)
default_cc="gcc"
;;
*)
echo "Unknown operating system: $os" >&2
exit 1
;;
esac
CC="${CC:-$default_cc}"
builddir="build-$os-$(uname -m | tr A-Z- a-z_)" builddir="build-$os-$(uname -m | tr A-Z- a-z_)"
cd "$(dirname "$0")"/.. cd "$(dirname "$0")"/..
echo "Entering directory '$PWD'" echo "Entering directory '$PWD'"
@ -41,11 +72,11 @@ $CC $CFLAGS -c ../c/table.c
$CC $CFLAGS -c ../c/time_unix.c $CC $CFLAGS -c ../c/time_unix.c
$CC $CFLAGS -c ../c/utf8.c $CC $CFLAGS -c ../c/utf8.c
$CC $LFLAGS -o flisp -lm \ $CC $LFLAGS -o flisp -lm \
bitvector-ops.o bitvector.o builtins.o dump.o env_unix.o \ bitvector-ops.o bitvector.o builtins.o dump.o env_unix.o \
equalhash.o flisp.o flmain.o fs_"$os".o fs_unix.o \ equalhash.o flisp.o flmain.o fs_"$os".o fs_unix.o \
hashing.o htable.o int2str.o \ hashing.o htable.o int2str.o \
ios.o iostream.o lltinit.o ptrhash.o random.o socket.o \ ios.o iostream.o lltinit.o ptrhash.o random.o socket.o \
string.o table.o time_unix.o utf8.o string.o table.o time_unix.o utf8.o
{ set +x; } 2>/dev/null { set +x; } 2>/dev/null
cd ../scheme-core cd ../scheme-core
echo "Entering directory '$PWD'" echo "Entering directory '$PWD'"