Code

configure: When doing strict checks, treat Gtk headers as system headers.
[tpdfview.git] / configure.ac
index f248564712969d8443f69b8f450cd0d6d5392e3f..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])
 
@@ -180,11 +181,48 @@ AC_SUBST([STRICT_CFLAGS])
 AC_CHECK_HEADERS(libgen.h)
 
 dnl Check for dependencies.
+build_documentation="yes"
+
+have_xsltproc="yes"
+AC_PATH_PROG([XSLTPROC], [xsltproc])
+if test "x$XSLTPROC" = "x"; then
+       have_xsltproc="no"
+       build_documentation="no (missing xsltproc)"
+fi
+
+have_a2x="yes"
+AC_PATH_PROG([A2X], [a2x])
+if test "x$A2X" = "x"; then
+       have_a2x="no"
+       build_documentation="no (missing a2x)"
+fi
+AC_SUBST([A2X])
+
+AM_CONDITIONAL([BUILD_DOCUMENTATION], test "x$build_documentation" = "xyes")
+
 PKG_CHECK_MODULES([CAIRO], [cairo])
 PKG_CHECK_MODULES([GTK2], [gtk+-2.0])
 PKG_CHECK_MODULES([POPPLER_GLIB], [poppler-glib])
 
-AC_CONFIG_FILES([Makefile src/Makefile])
+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
 
 cat <<EOF;
@@ -199,11 +237,18 @@ Configuration summary:
   package version: $PACKAGE_VERSION
   build date: `date --utc '+%F %T'` (UTC)
 
+  Tools:
+    AsciiDoc (a2x): . . . . . . $have_a2x
+    xsltproc: . . . . . . . . . $have_xsltproc
+
   Libraries:
     libcairo: . . . . . . . . . `$PKG_CONFIG --modversion cairo`
     libgtk-2.0: . . . . . . . . `$PKG_CONFIG --modversion gtk+-2.0`
     libpoppler-glib:  . . . . . `$PKG_CONFIG --modversion poppler-glib`
 
+  Features:
+    documentation:  . . . . . . $build_documentation
+
 This package is maintained by $PACKAGE_MAINTAINER.
 Please report bugs to $PACKAGE_BUGREPORT.