[gthumb] Test gcc -W flags before using them, bug 581648



commit d0da32c84b66b02964cc5933016500363216c2d0
Author: Marc Pavot <marc pavot gmail com>
Date:   Mon Jun 8 15:28:03 2009 -0400

    Test gcc -W flags before using them, bug 581648
---
 configure.in |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index 36a4c67..d72cc8d 100644
--- a/configure.in
+++ b/configure.in
@@ -254,9 +254,26 @@ fi
 
 dnl ******************************
 
-WARNINGS="-Wall \ 
+WARN_CFLAGS="-Wall \ 
 -Wpointer-arith -Wcast-align -Wtype-limits \
 -Wclobbered -Wempty-body -Wignored-qualifiers"
+
+for option in $WARN_CFLAGS; do
+        SAVE_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $option"
+        AC_MSG_CHECKING([whether gcc understands $option])
+        AC_TRY_COMPILE([], [],
+                       has_option=yes,
+                       has_option=no,)
+        if test x$has_option = xyes; then
+                WARNINGS="$WARNINGS $option"
+        fi
+        AC_MSG_RESULT($has_option)
+        CFLAGS="$SAVE_CFLAGS"
+        unset has_option
+        unset SAVE_CFLAGS
+done
+unset option
 AC_SUBST(WARNINGS)
 
 dnl ******************************



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]