Set _X_OPEN_SOURCE and default compiler in build script
This commit is contained in:
parent
86ebfb7a12
commit
2950e6ae5b
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#define _XOPEN_SOURCE
|
|
||||||
|
|
||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
|
2
c/utf8.c
2
c/utf8.c
|
@ -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>
|
||||||
|
|
|
@ -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'"
|
||||||
|
|
Loading…
Reference in New Issue