]> granicus.if.org Git - libatomic_ops/commitdiff
configure: Do not pass '-Wextra' option to GCC if unsupported
authorIvan Maidanski <ivmai@mail.ru>
Tue, 13 Dec 2011 06:36:24 +0000 (10:36 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 13 Dec 2011 10:40:39 +0000 (14:40 +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.

configure.ac

index 4a9fb7ef0d491a181497abe1e7e2f3325533372c..fe0fb20da84be83cbc9aea6aeb912bb359c3daba 100644 (file)
@@ -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*)