From 4cc9331b04314dc33c38f20492e3867d753ceb5e Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 16 Oct 2009 00:01:14 +0200 Subject: [PATCH] configure.ac: Added --disable-strict-checks command line option. This option may be used to disable strict compiler checks (enabled by default). --- configure.ac | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) 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)" -- 2.30.2