[Xfce4-commits] <xfce4-dev-tools:master> beef up the XDT_FEATURE_DEBUG macro a bit

Brian J. Tarricone noreply at xfce.org
Sat Sep 19 02:42:01 CEST 2009


Updating branch refs/heads/master
         to 0b00f6c1ea8c7e7d1ca772bf46f4c0e770970925 (commit)
       from 881dcbabcc5cdc488b2b051f8a5ea7b1db0abba6 (commit)

commit 0b00f6c1ea8c7e7d1ca772bf46f4c0e770970925
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Fri Sep 18 17:41:43 2009 -0700

    beef up the XDT_FEATURE_DEBUG macro a bit

 NEWS                     |    7 +++++++
 m4macros/xdt-features.m4 |   29 +++++++++++++++++++++--------
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 420a3ad..393f7c9 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,13 @@
 - Add XDT_FEATURE_LINKER_OPTS that checks for and enables useful linker
   optimizations if supported.  This currently only checks for
   --as-needed and -O1, but more may be added in the future.
+- Beef up XDT_FEATURE_DEBUG:
+  * Add new 'minimum' debug level, which is now the default and behaves
+    similarly to the old 'no' default.
+  * Debug level 'no' disables many glib/gobject-related checks and
+    asserts (this is not really recommended).
+  * Debug level 'full' disables code optimization.
+  * The macro now takes an argument to specify the default debug level.
 
 4.7.0
 =====
diff --git a/m4macros/xdt-features.m4 b/m4macros/xdt-features.m4
index aacc54c..7c72f81 100644
--- a/m4macros/xdt-features.m4
+++ b/m4macros/xdt-features.m4
@@ -54,17 +54,21 @@ AC_DEFUN([XDT_SUPPORTED_FLAGS],
 
 
 
-dnl XDT_FEATURE_DEBUG()
+dnl XDT_FEATURE_DEBUG(default_level=minimum)
 dnl
 AC_DEFUN([XDT_FEATURE_DEBUG],
 [
+  test "$1" && default_level=$1 || default_level=minimum
+
   AC_ARG_ENABLE([debug],
-AC_HELP_STRING([--enable-debug[=yes|no|full]], [Build with debugging support])
-AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
-  [], [enable_debug=no])
+                AC_HELP_STRING([--enable-debug@<:@=no|minimum|yes|full@:>@],
+                               [Build with debugging support (default=$default_level)])
+                AC_HELP_STRING([--disable-debug],
+                               [Include no debugging support [default]]),
+                [], [enable_debug=$default_level])
 
   AC_MSG_CHECKING([whether to build with debugging support])
-  if test x"$enable_debug" != x"no"; then
+  if test x"$enable_debug" = x"full" -o x"$enable_debug" = x"yes"; then
     AC_DEFINE([DEBUG], [1], [Define for debugging support])
 
     xdt_cv_additional_CFLAGS="-DXFCE_DISABLE_DEPRECATED \
@@ -77,11 +81,13 @@ AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
                               -Wcast-align -Wformat-security \
                               -Winit-self -Wmissing-include-dirs -Wundef \
                               -Wmissing-format-attribute -Wnested-externs \
-                              -fstack-protector -D_FORTIFY_SOURCE=2"
+                              -fstack-protector"
+    CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
     
     if test x"$enable_debug" = x"full"; then
       AC_DEFINE([DEBUG_TRACE], [1], [Define for tracing support])
-      xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -g3 -Werror"
+      xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -O0 -g3 -Werror"
+      CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG"
       AC_MSG_RESULT([full])
     else
       xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -g"
@@ -104,7 +110,14 @@ AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
     CFLAGS="$CFLAGS $supported_CFLAGS"
     CXXFLAGS="$CXXFLAGS $supported_CXXFLAGS"
   else
-    AC_MSG_RESULT([no])
+    CPPFLAGS="$CPPFLAGS -DNDEBUG"
+
+    if test x"$enable_debug" = x"no"; then
+      CPPFLAGS="$CPPFLAGS -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
+      AC_MSG_RESULT([no])
+    else
+      AC_MSG_RESULT([minimum])
+    fi
   fi
 ])
 



More information about the Xfce4-commits mailing list