Code

configure.ac: Added --disable-strict-checks command line option.
authorSebastian Harl <sh@tokkee.org>
Thu, 15 Oct 2009 22:01:14 +0000 (00:01 +0200)
committerSebastian Harl <sh@tokkee.org>
Thu, 15 Oct 2009 22:01:14 +0000 (00:01 +0200)
This option may be used to disable strict compiler checks (enabled by
default).

configure.ac

index d3f05aa19de3257758a82d1e5d2a76f497069da9..47c9c092b62db4b33ab6ba39f9876f0b3d6a4609 100644 (file)
@@ -91,7 +91,15 @@ if test "x$enable_hardening" = "xyes"; then
        fi
 fi
 
-for flag in -Wall -Wextra -Werror; do
+dnl Strict checking for potential problems.
+AC_ARG_ENABLE([strict-checks],
+               AS_HELP_STRING([--disable-strict-checks],
+                               [Disable strict compiler checks]),
+               [enable_strict_checks="$enableval"],
+               [enable_strict_checks="yes"])
+
+STRICT_CFLAGS=""
+for flag in -Wall -Werror; do
        AC_MSG_CHECKING([whether $CC accepts $flag])
 
        if test_cc_flags $flag; then
@@ -101,6 +109,30 @@ for flag in -Wall -Wextra -Werror; do
                AC_MSG_RESULT([no])
        fi
 done
+
+if test "x$enable_strict_checks" = "xyes"; then
+       for flag in -Wextra \
+                       -Wbad-function-cast \
+                       -Wcast-align \
+                       -Wcast-qual \
+                       -Wconversion \
+                       -Wdeclaration-after-statement \
+                       -Wmissing-prototypes \
+                       -Wpointer-arith \
+                       -Wshadow \
+                       -Wstrict-prototypes \
+                       -Wunreachable-code \
+                       -Wvla; do
+               AC_MSG_CHECKING([whether $CC accepts $flag])
+
+               if test_cc_flags $flag; then
+                       STRICT_CFLAGS="$STRICT_CFLAGS $flag"
+                       AC_MSG_RESULT([yes])
+               else
+                       AC_MSG_RESULT([no])
+               fi
+       done
+fi
 AC_SUBST([STRICT_CFLAGS])
 
 build_date="`date --utc '+%F %T'` (UTC)"