From: Lasse Collin Date: Thu, 25 Sep 2014 15:38:48 +0000 (+0300) Subject: Build: Detect supported compiler warning flags better. X-Git-Tag: v5.0.8~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94a1a869ee1b8b854592327e04decd6f8441aaf5;p=xz Build: Detect supported compiler warning flags better. Clang and nowadays also GCC accept any -Wfoobar option but then may give a warning that an unknown warning option was specified. To avoid adding unsupported warning options, the options are now tested with -Werror. Thanks to Charles Diza. --- diff --git a/configure.ac b/configure.ac index 0fd8c1e4..2e7f97b2 100644 --- a/configure.ac +++ b/configure.ac @@ -588,8 +588,9 @@ if test "$GCC" = yes ; then do AC_MSG_CHECKING([if $CC accepts $NEW_FLAG]) OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $NEW_FLAG" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([void foo(void) { }])], [ + CFLAGS="$CFLAGS $NEW_FLAG -Werror" + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [void foo(void); void foo(void) { }])], [ AM_CFLAGS="$AM_CFLAGS $NEW_FLAG" AC_MSG_RESULT([yes]) ], [