From aad44d091f9d4e7f78a03ef643c26e7981c8991d Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Mon, 13 Apr 2009 17:14:35 +0300 Subject: [PATCH] configure.ac: Detect working gcc warning flags --- configure.ac | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac index 04fcd72c..2233ae44 100644 --- a/configure.ac +++ b/configure.ac @@ -75,6 +75,26 @@ fi AC_PROG_CC AC_PROG_CPP +dnl Additional gcc tuning +if test x"$GCC" = xyes; then + AC_MSG_CHECKING([for working warning switches]) + good_CFLAGS="$CFLAGS" + warnings="" + flags="-Wall -Wextra" + # turn off noise from Wextra + flags="$flags -Wno-unused-parameter -Wno-missing-field-initializers" + # Wextra does not turn those on? + flags="$flags -Wmissing-prototypes -Wpointer-arith -Wendif-labels" + flags="$flags -Wdeclaration-after-statement -Wold-style-definition" + flags="$flags -Wstrict-prototypes -Wundef -Wformat -Wnonnull -Wstrict-overflow" + for f in $flags; do + CFLAGS="$good_CFLAGS $warnings $f" + AC_COMPILE_IFELSE([void foo(void){}], [warnings="$warnings $f"]) + done + CFLAGS="$good_CFLAGS $warnings" + AC_MSG_RESULT([$warnings]) +fi + # autoconf does not want to find 'install', if not using automake... INSTALL=install -- 2.39.5