diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-10-05 20:37:51 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-10-05 20:37:51 +0000 |
commit | 8c341bbaca5e89a9620702bc0025641e815e4195 (patch) | |
tree | 1035f73b75037714d01f420a9c7e0b58b185f204 /configure | |
parent | 12496b9b720a0b218827307c46c196e648a3dc76 (diff) | |
download | s6-rc-8c341bbaca5e89a9620702bc0025641e815e4195.tar.xz |
Better *FLAGS management; prepare for 0.2.2.0
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 37 |
1 files changed, 23 insertions, 14 deletions
@@ -92,7 +92,7 @@ stripdir () { tryflag () { echo "checking whether compiler accepts $2 ..." echo "typedef int x;" > "$tmpc" - if $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO "$2" -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then + if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST "$2" -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then echo " ... yes" eval "$1=\"\${$1} \$2\"" eval "$1=\${$1# }" @@ -106,7 +106,7 @@ tryflag () { tryldflag () { echo "checking whether linker accepts $2 ..." echo "typedef int x;" > "$tmpc" - if $CC_AUTO $CFLAGS_AUTO $LDFLAGS_AUTO -nostdlib "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then + if $CC_AUTO $CFLAGS_AUTO $CFLAGS $CFLAGS_POST $LDFLAGS_AUTO $LDFLAGS $LDFLAGS_POST -nostdlib "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then echo " ... yes" eval "$1=\"\${$1} \$2\"" eval "$1=\${$1# }" @@ -121,11 +121,17 @@ tryldflag () { # Actual script CC_AUTO= -CFLAGS_AUTO="$CFLAGS" -CPPFLAGS_AUTO="-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -O2 $CPPFLAGS" -LDFLAGS_AUTO="$LDFLAGS" -LDFLAGS_SHARED=-shared +CPPFLAGS_AUTO="-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -iquote src/include-local -Isrc/include" +CPPFLAGS_POST="$CPPFLAGS" +CPPFLAGS= +CFLAGS_AUTO="-pipe -Wall" +CFLAGS_POST="$CFLAGS" +CFLAGS=-O2 +LDFLAGS_AUTO= +LDFLAGS_POST="$LDFLAGS" +LDFLAGS= LDFLAGS_NOSHARED= +LDFLAGS_SHARED=-shared prefix= exec_prefix='$prefix' dynlibdir='$prefix/lib' @@ -263,7 +269,7 @@ test -n "$CC_AUTO" || { echo "$0: cannot find a C compiler" ; exit 1 ; } echo " ... $CC_AUTO" echo "checking whether C compiler works... " echo "typedef int x;" > "$tmpc" -if $CC_AUTO $CPPFLAGS_AUTO $CFLAGS_AUTO -c -o /dev/null "$tmpc" 2>"$tmpe" ; then +if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -c -o /dev/null "$tmpc" 2>"$tmpe" ; then echo " ... yes" else echo " ... no. Compiler output follows:" @@ -297,12 +303,12 @@ timer_lib=$(cat $sysdeps/timer.lib) util_lib=$(cat $sysdeps/util.lib) tryflag CFLAGS_AUTO -std=c99 -tryflag CFLAGS_AUTO -fomit-frame-pointer +tryflag CFLAGS -fomit-frame-pointer tryflag CFLAGS_AUTO -fno-exceptions tryflag CFLAGS_AUTO -fno-unwind-tables tryflag CFLAGS_AUTO -fno-asynchronous-unwind-tables -tryflag CPPFLAGS_AUTO -Wa,--noexecstack -tryflag CFLAGS_AUTO -fno-stack-protector +tryflag CFLAGS_AUTO -Wa,--noexecstack +tryflag CFLAGS -fno-stack-protector tryflag CPPFLAGS_AUTO -Werror=implicit-function-declaration tryflag CPPFLAGS_AUTO -Werror=implicit-int tryflag CPPFLAGS_AUTO -Werror=pointer-sign @@ -320,7 +326,7 @@ if $evenmorestatic ; then fi if $shared ; then - tryldflag LDFLAGS_AUTO -Wl,--hash-style=both + tryldflag LDFLAGS -Wl,--hash-style=both fi LDFLAGS_SHARED="${LDFLAGS_SHARED}${addlibdpath}" @@ -372,9 +378,12 @@ TIMER_LIB := ${timer_lib} UTIL_LIB := ${util_lib} CC := ${CC_AUTO##${cross}} -CFLAGS := $CFLAGS_AUTO -CPPFLAGS := $CPPFLAGS_AUTO -LDFLAGS := $LDFLAGS_AUTO +CPPFLAGS_AUTO := $CPPFLAGS_AUTO +CPPFLAGS := $CPPFLAGS $CPPFLAGS_POST +CFLAGS_AUTO := $CFLAGS_AUTO +CFLAGS := $CFLAGS $CFLAGS_POST +LDFLAGS_AUTO := $LDFLAGS_AUTO +LDFLAGS := $LDFLAGS $LDFLAGS_POST LDFLAGS_SHARED := $LDFLAGS_SHARED LDFLAGS_NOSHARED := $LDFLAGS_NOSHARED CROSS_COMPILE := $cross |