diff --git a/c/string.c b/c/string.c index b29ea5f..9d83e3e 100644 --- a/c/string.c +++ b/c/string.c @@ -2,8 +2,6 @@ string functions */ -#define _XOPEN_SOURCE - #include #include diff --git a/c/time_unix.c b/c/time_unix.c index 4cca98b..d48da3f 100644 --- a/c/time_unix.c +++ b/c/time_unix.c @@ -1,5 +1,3 @@ -#define _XOPEN_SOURCE - #include #include diff --git a/c/utf8.c b/c/utf8.c index fb94776..8e4ff59 100644 --- a/c/utf8.c +++ b/c/utf8.c @@ -13,8 +13,6 @@ A UTF-8 validation routine is included. */ -#define _XOPEN_SOURCE - #include #include #include diff --git a/scripts/build.sh b/scripts/build.sh index b12f00b..702586d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,11 +1,42 @@ #!/bin/sh set -eu -CC="${CC:-clang}" CFLAGS="-Wall -Wextra -Wno-strict-aliasing -std=gnu99" CFLAGS="$CFLAGS -O2" # -falign-functions CFLAGS="$CFLAGS -I ../c -D NDEBUG -D USE_COMPUTED_GOTO" LFLAGS="-lm" 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_)" cd "$(dirname "$0")"/.. 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/utf8.c $CC $LFLAGS -o flisp -lm \ - bitvector-ops.o bitvector.o builtins.o dump.o env_unix.o \ - equalhash.o flisp.o flmain.o fs_"$os".o fs_unix.o \ - hashing.o htable.o int2str.o \ - ios.o iostream.o lltinit.o ptrhash.o random.o socket.o \ - string.o table.o time_unix.o utf8.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 \ + hashing.o htable.o int2str.o \ + ios.o iostream.o lltinit.o ptrhash.o random.o socket.o \ + string.o table.o time_unix.o utf8.o { set +x; } 2>/dev/null cd ../scheme-core echo "Entering directory '$PWD'"