1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

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.
This commit is contained in:
Lasse Collin 2014-09-25 18:38:48 +03:00
parent 76e75522ed
commit c4911f2db3

View file

@ -749,8 +749,9 @@ if test "$GCC" = yes ; then
do do
AC_MSG_CHECKING([if $CC accepts $NEW_FLAG]) AC_MSG_CHECKING([if $CC accepts $NEW_FLAG])
OLD_CFLAGS="$CFLAGS" OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $NEW_FLAG" CFLAGS="$CFLAGS $NEW_FLAG -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([void foo(void) { }])], [ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[void foo(void); void foo(void) { }])], [
AM_CFLAGS="$AM_CFLAGS $NEW_FLAG" AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
], [ ], [