Code

configure: When doing strict checks, treat Gtk headers as system headers.
authorSebastian Harl <sh@teamix.net>
Mon, 2 Jan 2012 09:44:53 +0000 (10:44 +0100)
committerSebastian Harl <sh@teamix.net>
Mon, 2 Jan 2012 09:44:53 +0000 (10:44 +0100)
This way, warnings generated by those headers will be suppressed. Some of the
strict check flags generate warnings which would otherwise result in
unnecessary compile errors.

configure.ac

index 3ef87037520f52fbe3f297fc50233231558b7783..db3ca4a65bb9715ff9a49c6dc0252bf433233728 100644 (file)
@@ -164,6 +164,7 @@ if test "x$enable_strict_checks" = "xyes"; then
                        -Wmissing-prototypes \
                        -Wpointer-arith \
                        -Wshadow \
+                       -Wstrict-prototypes \
                        -Wunreachable-code; do
                AC_MSG_CHECKING([whether $CC accepts $flag])
 
@@ -203,6 +204,24 @@ PKG_CHECK_MODULES([CAIRO], [cairo])
 PKG_CHECK_MODULES([GTK2], [gtk+-2.0])
 PKG_CHECK_MODULES([POPPLER_GLIB], [poppler-glib])
 
+if test "x$enable_strict_checks" = "xyes"; then
+       # Some Gtk headers generate warnings when doing strict checking, which
+       # would result in unnecessary compile errors
+       AC_MSG_NOTICE([Try to suppress warnings from Gtk headers...])
+       for flag in `$PKG_CONFIG --cflags-only-I gtk+-2.0`; do
+               I_dir=${flag#-I}
+
+               flag="-isystem $I_dir"
+               AC_MSG_CHECKING([whether $CC accepts $flag])
+               if test_cc_flags "$flag"; then
+                       STRICT_CFLAGS="$STRICT_CFLAGS $flag"
+                       AC_MSG_RESULT([yes])
+               else
+                       AC_MSG_RESULT([no])
+               fi
+       done
+fi
+
 AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile])
 AC_OUTPUT