From: Ivan Maidanski Date: Tue, 13 Dec 2011 06:36:24 +0000 (+0400) Subject: configure: Do not pass '-Wextra' option to GCC if unsupported X-Git-Tag: libatomic_ops-7_3alpha2~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bcf29faf2e5cab7ab836ff5147d2fd3a73ffc426;p=libatomic_ops 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. --- diff --git a/configure.ac b/configure.ac index 4a9fb7e..fe0fb20 100644 --- a/configure.ac +++ b/configure.ac @@ -38,8 +38,16 @@ if test "$GCC" = yes; then PICFLAG=-fPIC ;; esac + # Output all warnings. - CFLAGS="-Wall -Wextra $CFLAGS" + 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" else case "$host" in *-*-hpux*)