]> granicus.if.org Git - gc/commitdiff
configure: Do not pass '-Wextra' option to GCC if unsupported
authorIvan Maidanski <ivmai@mail.ru>
Tue, 13 Dec 2011 11:37:59 +0000 (15:37 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 13 Dec 2011 11:38:38 +0000 (15:38 +0400)
* 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).

configure.ac

index 417a082885842a1e8be2c8a1c458796c66bcf294..c01c9b671758bd36fbf442639c27e79a6dd3e1fe 100644 (file)
@@ -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)