[gnome-builder] libide: make tracing and debug options available via configure



commit ae549b40258bb172383402581539277084af0a4b
Author: Christian Hergert <christian hergert me>
Date:   Mon Mar 2 14:30:32 2015 -0800

    libide: make tracing and debug options available via configure

 Makefile.am                                        |    1 +
 build/autotools/autoconf.d/20_debug.post-config    |    6 +++-
 .../autoconf.d/30_command_line_options.pre-am      |   28 ++++++++++++++++++++
 build/autotools/autoconf.d/50_debug.post-am        |    1 +
 libide/Makefile.am                                 |   10 +++++++
 libide/ide-debug.h                                 |    6 ++--
 src/gnome-builder.mk                               |    2 +
 7 files changed, 50 insertions(+), 4 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index ecea72f..dd42616 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,7 @@ include build/autotools/automake/AutomakeDocs.mk
 
 ACLOCAL_AMFLAGS = -I build/autotools/m4 ${ACLOCAL_FLAGS}
 
+AM_CPPFLAGS =
 AM_LDFLAGS = -lstdc++
 
 include libide/Makefile.am
diff --git a/build/autotools/autoconf.d/20_debug.post-config b/build/autotools/autoconf.d/20_debug.post-config
index 990d696..a09abf5 100644
--- a/build/autotools/autoconf.d/20_debug.post-config
+++ b/build/autotools/autoconf.d/20_debug.post-config
@@ -1 +1,5 @@
-echo "  Tracing .......................... : ${enable_tracing}"
+echo "Developer Build Options"
+echo ""
+echo "  Debug Build .......................... : ${enable_debug}"
+echo "  Trace Build .......................... : ${enable_tracing}"
+echo "  Maintainer Flags ..................... : ${enable_maintainer_flags}"
diff --git a/build/autotools/autoconf.d/30_command_line_options.pre-am 
b/build/autotools/autoconf.d/30_command_line_options.pre-am
index cb091e9..c19c6e0 100644
--- a/build/autotools/autoconf.d/30_command_line_options.pre-am
+++ b/build/autotools/autoconf.d/30_command_line_options.pre-am
@@ -11,3 +11,31 @@ AC_ARG_ENABLE([maintainer-flags],
                               [Use strict compiler flags @<:@default=]maintainer_flags_default[@:>@])],
               [],
               [enable_maintainer_flags=maintainer_flags_default])
+
+dnl **************************************************************************
+dnl Enable extra debugging options
+dnl **************************************************************************
+m4_define([debug_default],
+         [m4_if(m4_eval(project_minor_version % 2), [1],
+         [yes], [minimum])])
+AC_ARG_ENABLE([debug],
+             [AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
+                             [turn on debugging @<:@default=debug_default@:>@])],
+                             [],
+                             [enable_debug=debug_default])
+AS_CASE([$enable_debug],
+       [yes], [],
+       [minimum], [
+               CFLAGS="$CFLAGS -DG_DISABLE_CAST_CHECKS"
+               CFLAGS="$CFLAGS -DIDE_DISABLE_DEBUG"
+               CFLAGS="$CFLAGS -DIDE_DISABLE_TRACE"
+       ],
+       [no], [
+               CFLAGS="$CFLAGS -DG_DISABLE_ASSERT"
+               CFLAGS="$CFLAGS -DG_DISABLE_CHECKS"
+               CFLAGS="$CFLAGS -DG_DISABLE_CAST_CHECKS"
+               CFLAGS="$CFLAGS -DIDE_DISABLE_DEBUG"
+               CFLAGS="$CFLAGS -DIDE_DISABLE_TRACE"
+       ],
+       [AC_MSG_ERROR([Unknown argument to --enable-debug])]
+)
diff --git a/build/autotools/autoconf.d/50_debug.post-am b/build/autotools/autoconf.d/50_debug.post-am
new file mode 100644
index 0000000..fe3f1f6
--- /dev/null
+++ b/build/autotools/autoconf.d/50_debug.post-am
@@ -0,0 +1 @@
+AM_CONDITIONAL([ENABLE_DEBUG], [test "$enable_debug" = "yes"])
diff --git a/libide/Makefile.am b/libide/Makefile.am
index e2a824d..0ec6c62 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -287,6 +287,16 @@ libide_1_0_la_LIBADD = \
        libeditorconfig.la \
        $(NULL)
 
+if ENABLE_TRACING
+else
+AM_CPPFLAGS += -DIDE_DISABLE_TRACING
+endif
+
+if ENABLE_DEBUG
+else
+AM_CPPFLAGS += -DIDE_DISABLE_DEBUG
+endif
+
 libide_1_0_la_built_sources = \
        libide/resources/ide-resources.c \
        libide/resources/ide-resources.h \
diff --git a/libide/ide-debug.h b/libide/ide-debug.h
index ceba8a6..4b46583 100644
--- a/libide/ide-debug.h
+++ b/libide/ide-debug.h
@@ -27,14 +27,14 @@ G_BEGIN_DECLS
 # define G_LOG_LEVEL_TRACE (1 << G_LOG_LEVEL_USER_SHIFT)
 #endif
 
-#ifdef IDE_ENABLE_DEBUG
+#ifndef IDE_DISABLE_DEBUG
 # define IDE_DEBUG(...)                                                \
-   g_log(G_LOG_DOMAIN, G_LOG_LEVEL_TRACE, ##__VA_ARGS__)
+   g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, ##__VA_ARGS__)
 #else
 # define IDE_DEBUG(...)
 #endif
 
-#ifdef IDE_ENABLE_TRACE
+#ifndef IDE_DISABLE_TRACE
 # define IDE_TRACE_MSG(fmt, ...)                                       \
    g_log(G_LOG_DOMAIN, G_LOG_LEVEL_TRACE, "TRACE: %s():%d: "fmt,       \
          G_STRFUNC, __LINE__, ##__VA_ARGS__)
diff --git a/src/gnome-builder.mk b/src/gnome-builder.mk
index 3c39446..4039565 100644
--- a/src/gnome-builder.mk
+++ b/src/gnome-builder.mk
@@ -271,6 +271,8 @@ libgnome_builder_la_CFLAGS = \
 
 if ENABLE_TRACING
 libgnome_builder_la_CFLAGS += -DGB_ENABLE_TRACE
+else
+libgnome_builder_la_CFLAGS += -DIDE_DISABLE_TRACE
 endif
 
 gnome_builder_SOURCES = src/main.c


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