diff --git a/configure b/configure index ad5325a..ea7fe2c 100755 --- a/configure +++ b/configure @@ -2,6 +2,7 @@ prefix=/usr/local OUR_CPPFLAGS= +C99_CFLAGS="-std=c99" # Get a temporary filename i=0 @@ -42,7 +43,7 @@ check_compile() { printf "checking %s ... " "$1" printf "$3" > "$tmpc" local res=0 - $CC $OUR_CPPFLAGS $CPPFLAGS $2 $CFLAGS -c "$tmpc" -o /dev/null >/dev/null 2>&1 \ + $CC $OUR_CPPFLAGS $CPPFLAGS $2 $C99_CFLAGS $CFLAGS -c "$tmpc" -o /dev/null >/dev/null 2>&1 \ || res=1 test x$res = x0 && \ { printf "yes\n" ; test x"$2" = x || OUR_CPPFLAGS="$OUR_CPPFLAGS $2" ; } \ @@ -53,7 +54,7 @@ check_compile() { check_define() { printf "checking whether \$CC defines %s ... " "$1" local res=1 - $CC $OUR_CPPFLAGS $CPPFLAGS $CFLAGS -dM -E - /dev/null && res=0 + $CC $OUR_CPPFLAGS $CPPFLAGS $C99_CFLAGS $CFLAGS -dM -E - /dev/null && res=0 test x$res = x0 && printf "yes\n" || printf "no\n" return $res } @@ -62,7 +63,7 @@ check_compile_run() { printf "checking %s ... " "$1" printf "$2" > "$tmpc" local res=0 - $CC $OUR_CPPFLAGS $CPPFLAGS $CFLAGS "$tmpc" -o "$tmpc".out >/dev/null 2>&1 \ + $CC $OUR_CPPFLAGS $CPPFLAGS $C99_CFLAGS $CFLAGS "$tmpc" -o "$tmpc".out >/dev/null 2>&1 \ || res=1 test x$res = x0 && { "$tmpc".out || res=1 ; } rm -f "$tmpc".out @@ -141,6 +142,10 @@ if [ -z "$CC" ] ; then CC=cc fi +for i in 700 600; do + check_compile "whether _XOPEN_SOURCE=$i is suitable for C99 mode" "-D_XOPEN_SOURCE=$i" "#include " && break +done + for i in 16 32; do check_compile "whether netinet/in.h defines s6_addr$i" "" \ '#include \nint main(int a, char**c){'"struct in6_addr x={.s6_addr$i[0]=a};return x.s6_addr$i[0];"' }' \ diff --git a/src/allocator_thread.c b/src/allocator_thread.c index 314f926..cb4e987 100644 --- a/src/allocator_thread.c +++ b/src/allocator_thread.c @@ -3,7 +3,6 @@ #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809L #define _DARWIN_C_SOURCE -#define _XOPEN_SOURCE 600 #include #include #include diff --git a/src/main.c b/src/main.c index eb7465f..1f33003 100644 --- a/src/main.c +++ b/src/main.c @@ -9,10 +9,7 @@ #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809L -#undef _XOPEN_SOURCE -#ifdef IS_SOLARIS /* Solaris doesn't recognize this macro greater than 600 */ -#define _XOPEN_SOURCE 600 -#else +#ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 700 #endif #include