From: Sebastian Harl Date: Thu, 15 Oct 2009 22:01:14 +0000 (+0200) Subject: configure.ac: Added --disable-strict-checks command line option. X-Git-Url: https://git.tokkee.org/?p=template.git;a=commitdiff_plain;h=4cc9331b04314dc33c38f20492e3867d753ceb5e configure.ac: Added --disable-strict-checks command line option. This option may be used to disable strict compiler checks (enabled by default). --- diff --git a/configure.ac b/configure.ac index d3f05aa..47c9c09 100644 --- a/configure.ac +++ b/configure.ac @@ -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)"