From bcf29faf2e5cab7ab836ff5147d2fd3a73ffc426 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 13 Dec 2011 10:36:24 +0400 Subject: [PATCH] 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. --- configure.ac | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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*) -- 2.50.1