From: Ivan Maidanski Date: Tue, 13 Dec 2011 11:37:59 +0000 (+0400) Subject: configure: Do not pass '-Wextra' option to GCC if unsupported X-Git-Tag: gc7_3alpha2~295 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=090753531f79d68c28a4cf8f63822a3dec8a8508;p=gc configure: Do not pass '-Wextra' option to GCC if unsupported * configure.ac (WEXTRA): New variable (set to "-Wextra" if the latter is supported by GCC, otherwise to "-W"). * configure.ac (CFLAGS): Use WEXTRA variable (only if GCC). --- diff --git a/configure.ac b/configure.ac index 417a0828..c01c9b67 100644 --- a/configure.ac +++ b/configure.ac @@ -361,7 +361,15 @@ case "$host" in esac if test "$GCC" == yes; then - CFLAGS="-Wall -Wextra $CFLAGS" + # Output all warnings. + AC_MSG_CHECKING(for gcc -Wextra) + old_CFLAGS="$CFLAGS" + CFLAGS="-Wextra $CFLAGS" + AC_TRY_COMPILE([],[], [ac_cv_cc_wextra=yes], [ac_cv_cc_wextra=no]) + CFLAGS="$old_CFLAGS" + AC_MSG_RESULT($ac_cv_cc_wextra) + AS_IF([test "$ac_cv_cc_wextra" = yes], [WEXTRA="-Wextra"], [WEXTRA="-W"]) + CFLAGS="-Wall $WEXTRA $CFLAGS" fi AC_MSG_CHECKING(for xlc)