[gthumb] configure: added additional warnings if --enable-debug is used



commit 7593e6f7289c812decfffc273b545c4fadef8c2f
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Apr 1 13:41:32 2015 +0200

    configure: added additional warnings if --enable-debug is used

 configure.ac |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index bcaa892..f7c32d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,6 +103,32 @@ if test x$ENABLE_DEBUG = xyes; then
        CFLAGS="$CFLAGS -g -O0 -DDEBUG"
 fi
 
+dnl ===========================================================================
+
+if test x$ENABLE_DEBUG = xyes; then
+WARN_CFLAGS="-Wall -Wcast-align -Wtype-limits -Wclobbered -Wempty-body -Wignored-qualifiers 
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare -Wformat-security"
+else
+WARN_CFLAGS="-Wall"
+fi
+
+for option in $WARN_CFLAGS; do
+       SAVE_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS $option"
+       AC_MSG_CHECKING([whether gcc understands $option])
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[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
+CFLAGS="$CFLAGS $WARNINGS"
+
+dnl ===========================================================================
+
 AC_ARG_ENABLE(run_in_place,
              AS_HELP_STRING([--enable-run-in-place],[load ui data and extensions from the source tree]),
              [case "${enableval}" in
@@ -117,6 +143,8 @@ if test x$enable_run_in_place = xyes; then
        AC_DEFINE(RUN_IN_PLACE, 1, [load ui data and extensions from the source tree])
 fi
 
+dnl ===========================================================================
+
 AC_ARG_ENABLE(test-suite,
              AS_HELP_STRING([--enable-test-suite], [enable the compilation of the test suite]),
              [case "${enableval}" in


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