Author: kelnos
Date: 2009-05-04 07:50:17 +0000 (Mon, 04 May 2009)
New Revision: 29924

Modified:
   xfce4-dev-tools/trunk/ChangeLog
   xfce4-dev-tools/trunk/m4macros/xdt-features.m4
Log:
        * m4macros/xdt-features.m4: Add a bunch more compiler warning
          options when --enable-debug={yes,full} is specified.

Modified: xfce4-dev-tools/trunk/ChangeLog
===================================================================
--- xfce4-dev-tools/trunk/ChangeLog     2009-05-01 00:20:23 UTC (rev 29923)
+++ xfce4-dev-tools/trunk/ChangeLog     2009-05-04 07:50:17 UTC (rev 29924)
@@ -1,3 +1,8 @@
+2009-05-04     Brian Tarricone <bj...@cornell.edu>
+
+       * m4macros/xdt-features.m4: Add a bunch more compiler warning
+         options when --enable-debug={yes,full} is specified.
+
 2009-02-25  Stephan Arts <step...@xfce.org>
 
        * == 4.6.0 Released! ==

Modified: xfce4-dev-tools/trunk/m4macros/xdt-features.m4
===================================================================
--- xfce4-dev-tools/trunk/m4macros/xdt-features.m4      2009-05-01 00:20:23 UTC 
(rev 29923)
+++ xfce4-dev-tools/trunk/m4macros/xdt-features.m4      2009-05-04 07:50:17 UTC 
(rev 29924)
@@ -31,7 +31,29 @@
 AC_PREREQ([2.53])
 
 
+dnl XDT_SUPPORTED_FLAGS(VAR, FLAGS)
+dnl
+dnl For each token in FLAGS, checks to be sure the compiler supports
+dnl the flag, and if so, adds each one to VAR.
+dnl
+AC_DEFUN([XDT_SUPPORTED_FLAGS],
+[
+  for flag in $2; do
+    AC_MSG_CHECKING([if $CC supports $flag])
+    saved_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $flag"
+    AC_COMPILE_IFELSE([ ], [flag_supported=yes], [flag_supported=no])
+    CFLAGS="$saved_CFLAGS"
+    AC_MSG_RESULT([$flag_supported])
 
+    if test "x$flag_supported" = "xyes"; then
+      $1="$$1 $flag"
+    fi
+  done
+])
+
+
+
 dnl XDT_FEATURE_DEBUG()
 dnl
 AC_DEFUN([XDT_FEATURE_DEBUG],
@@ -45,26 +67,42 @@
   if test x"$enable_debug" != x"no"; then
     AC_DEFINE([DEBUG], [1], [Define for debugging support])
 
-    if test x"$GCC" = x"yes"; then
-      xdt_cv_additional_CFLAGS="-Wall"
-    fi
-    xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS 
-DXFCE_DISABLE_DEPRECATED"
+    xdt_cv_additional_CFLAGS="-DXFCE_DISABLE_DEPRECATED \
+                              -Wall -Wextra \
+                              -Wno-missing-field-initializers \
+                              -Wno-unused-parameter -Wold-style-definition \
+                              -Wdeclaration-after-statement \
+                              -Wmissing-declarations -Wredundant-decls \
+                              -Wmissing-noreturn -Wshadow -Wpointer-arith \
+                              -Wcast-align -Wformat-security \
+                              -Winit-self -Wmissing-include-dirs -Wundef \
+                              -Wmissing-format-attribute -Wnested-externs \
+                              -fstack-protector -D_FORTIFY_SOURCE=2"
     
     if test x"$enable_debug" = x"full"; then
       AC_DEFINE([DEBUG_TRACE], [1], [Define for tracing support])
-      if test x"$GCC" = x"yes"; then
-        xdt_cv_additional_CFLAGS="-g3 -Werror $xdt_cv_additional_CFLAGS"
-      fi
+      xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -g3 -Werror"
       AC_MSG_RESULT([full])
     else
-      if test x"$GCC" = x"yes"; then
-        xdt_cv_additional_CFLAGS="-g $xdt_cv_additional_CFLAGS"
-      fi
+      xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -g"
       AC_MSG_RESULT([yes])
     fi
 
-    CFLAGS="$CFLAGS $xdt_cv_additional_CFLAGS"
-    CXXFLAGS="$CXXFLAGS $xdt_cv_additional_CFLAGS"
+    XDT_SUPPORTED_FLAGS([supported_CFLAGS], [$xdt_cv_additional_CFLAGS])
+
+    ifelse([$CXX], , , [
+      dnl FIXME: should test on c++ compiler, but the following line causes
+      dnl        autoconf errors for projects that don't check for a
+      dnl        c++ compiler at all.
+      dnl AC_LANG_PUSH([C++])
+      dnl XDT_SUPPORTED_FLAGS([supported_CXXFLAGS], 
[$xdt_cv_additional_CFLAGS])
+      dnl AC_LANG_POP()
+      dnl        instead, just use supported_CFLAGS...
+      supported_CXXFLAGS="$supported_CFLAGS"
+    ])
+
+    CFLAGS="$CFLAGS $supported_CFLAGS"
+    CXXFLAGS="$CXXFLAGS $supported_CXXFLAGS"
   else
     AC_MSG_RESULT([no])
   fi

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to