diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-02-19 09:01:13 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-02-19 09:01:13 +0000 |
commit | e7050f97c49a451671165b6e63f926072d5d118b (patch) | |
tree | cecad4fea0db902d10cb2eb84c4d8e3f89016064 | |
parent | b28f3d43bfc0b60f00b04e2c9369e8b5936e4559 (diff) |
If --enable-debug is used and gcc, we figure out which version and then we
use as aggressive warning options as possible for the used compiler version.
-rw-r--r-- | configure.ac | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 866372f72..faca05c8e 100644 --- a/configure.ac +++ b/configure.ac @@ -1176,10 +1176,31 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]), CPPFLAGS="$CPPFLAGS -DCURLDEBUG" CFLAGS="$CFLAGS -g" if test "$GCC" = "yes"; then - CFLAGS="$CFLAGS -W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wno-format-nonliteral -Wundef -Wpointer-arith -Wnested-externs" - dnl here's a more aggressive set to use: - dnl CFLAGS="$CFLAGS -W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wundef -Wpointer-arith -Wnested-externs -Wcast-align -Winline -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wshadow -Wfloat-equal -Wsign-compare -Wunreachable-code" + dnl figure out gcc version! + AC_MSG_CHECKING([gcc version]) + gccver=`$CC -dumpversion` + num1=`echo $gccver | cut -d . -f1` + num2=`echo $gccver | cut -d . -f2` + gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null` + AC_MSG_RESULT($gccver) + + dnl here's the standard setup + WARN="-W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wno-format-nonliteral -Wundef -Wpointer-arith -Wnested-externs -Wcast-align -Winline -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wsign-compare" + if test "$gccnum" -ge "296"; then + dnl gcc 2.96 or later + WARN="$WARN -Wfloat-equal" + + dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on + dnl on i686-Linux as it gives us heaps with false positives + if test "$gccnum" -ge "303"; then + dnl gcc 3.3 and later + WARN="$WARN -Wendif-labels" + fi + + fi + + CFLAGS="$CFLAGS $WARN" fi dnl strip off optimizer flags NEWFLAGS="" |