From 1c6abaf1cfeec44a31a1799ffe45e2992ec83c32 Mon Sep 17 00:00:00 2001 From: Angel Ortega Date: Wed, 28 Dec 2011 12:08:21 +0100 Subject: [PATCH] Tweaked CFLAGS detection in config.sh. --- config.sh | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/config.sh b/config.sh index d590ab5..36cdb19 100755 --- a/config.sh +++ b/config.sh @@ -63,16 +63,6 @@ fi echo "CC=$CC" >> makefile.opts -# set cflags -if [ "$CFLAGS" = "" -a "$CC" = "gcc" ] ; then - CFLAGS="-g -Wall" -fi - -echo "CFLAGS=$CFLAGS" >> makefile.opts - -# Add CFLAGS to CC -CC="$CC $CFLAGS" - # set archiver if [ "$AR" = "" ] ; then AR=ar @@ -106,6 +96,28 @@ DRIVERS="wav" # configuration directives +# CFLAGS +if [ -z "$CFLAGS" ] ; then + CFLAGS="-g -Wall" +fi + +echo -n "Testing if C compiler supports ${CFLAGS}... " +echo "int main(int argc, char *argv[]) { return 0; }" > .tmp.c + +$CC .tmp.c -o .tmp.o 2>> .config.log + +if [ $? = 0 ] ; then + echo "OK" +else + echo "No; resetting to defaults" + CFLAGS="" +fi + +echo "CFLAGS=$CFLAGS" >> makefile.opts + +# Add CFLAGS to CC +CC="$CC $CFLAGS" + # Win32 echo -n "Testing for win32... " if [ "$WITHOUT_WIN32" = "1" ] ; then -- 2.11.4.GIT