[gnumeric] Compilation: improve clang support.



commit a2c5e42bd15dd2d1a715591a314c65552fb1ee2e
Author: Morten Welinder <terra gnome org>
Date:   Sun Feb 17 16:24:41 2013 -0500

    Compilation: improve clang support.

 ChangeLog    |    4 ++++
 configure.ac |   31 +++++++++++++++++++++----------
 2 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4a63c82..ec4c192 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-02-17  Morten Welinder  <terra gnome org>
+
+       * configure.ac (set_more_warnings): Improve support for clang.
+
 2013-02-16  Morten Welinder  <terra gnome org>
 
        * *.c: Clear up confusion between GtkStateType and GtkStateFlags.
diff --git a/configure.ac b/configure.ac
index c8e7ae7..ec55d9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,30 +260,41 @@ ifdef([GNOME_COMPILE_WARNINGS],
 )
 set_more_warnings=yes
 if test "$GCC" = yes -a "x$set_more_warnings" != xno; then
-       warning_options="-Wsign-compare -Wpointer-arith -Wnested-externs \
+       dnl Clang needs to option, or else it will appear to support any
+       dnl warning option
+       uwoption="-Werror=unknown-warning-option"
+       SAVE_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS $uwoption"
+       AC_MSG_CHECKING([whether gcc understands $uwoption])
+       AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM([], [])],
+               [has_unknown_warning_option=yes],
+               [has_unknown_warning_option=no; uwoption=""])
+       AC_MSG_RESULT($has_unknown_warning_option)
+       CFLAGS="$SAVE_CFLAGS"
+
+       warning_options="-Wsign-compare -Wpointer-arith \
                         -Wchar-subscripts -Wwrite-strings \
                         -Wdeclaration-after-statement -Wnested-externs \
-                        -Wmissing-noreturn -Wmissing-prototypes \
+                        -Wmissing-noreturn \
                         -Werror=missing-prototypes -Werror=nested-externs \
                         -Werror=implicit-function-declaration \
                         -Wmissing-declarations -Wno-pointer-sign \
                         -Werror=format-security -Wbitwise -Wcast-to-as \
                         -Wdefault-bitfield-sign -Wdo-while -Wparen-string \
-                        -Wptr-subtraction-blows -Wreturn-void -Wtypesign"
-       if test $gnumeric_devel = yes; then
-               dnl Avoid triggering a warning in gtk+ headers for stable.
-               warning_options="$warning_options -Wstrict-prototypes"
-       fi
+                        -Wptr-subtraction-blows -Wreturn-void -Wtypesign \
+                        -Wstrict-prototypes"
        for option in $warning_options ; do
                SAVE_CFLAGS="$CFLAGS"
-               CFLAGS="$CFLAGS $option"
+               CFLAGS="$CFLAGS $uwoption $option"
                AC_MSG_CHECKING([whether gcc understands $option])
                AC_COMPILE_IFELSE(
                        [AC_LANG_PROGRAM([], [])],
                        [has_option=yes],
                        [has_option=no])
-               if test $has_option = no; then
-                 CFLAGS="$SAVE_CFLAGS"
+               CFLAGS="$SAVE_CFLAGS"
+               if test $has_option = yes; then
+                       CFLAGS="$CFLAGS $option"
                fi
                AC_MSG_RESULT($has_option)
                unset has_option


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