]> granicus.if.org Git - xz/commitdiff
Build: Detect supported compiler warning flags better.
authorLasse Collin <lasse.collin@tukaani.org>
Thu, 25 Sep 2014 15:38:48 +0000 (18:38 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 17 Dec 2014 19:13:42 +0000 (21:13 +0200)
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.

configure.ac

index 0fd8c1e4b2640e9f48c7a9929669904bcf40ffe4..2e7f97b2fc84f54510b54f6c268ea0ac564453a8 100644 (file)
@@ -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])
                ], [