Added option to 'configure' to control debug information for compilation
authorChristophe CURIS <christophe.curis@free.fr>
Fri, 16 Nov 2012 00:24:07 +0000 (16 01:24 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Fri, 16 Nov 2012 08:06:19 +0000 (16 08:06 +0000)
As reported by Amadeusz Sławiński, there were a number of debug-only
information printed by the menu parser, which had no reason to be
in a user package.

This patch removes all the hard-coded DEBUG definitions pointed
by Amadeusz and adds a new (standard-like) option '--enable-debug'
to the configure script, which activates debug stuff for the devs.
The default behaviour is now to not have them.
As a side effect, the option also disable optimisation, which are
generally annoying when trying to run a debugger.

WINGs/Examples/Makefile.am
WINGs/Extras/Makefile.am
WINGs/Makefile.am
WINGs/Tests/Makefile.am
configure.ac

index 877f233..924d378 100644 (file)
@@ -26,4 +26,4 @@ server_LDADD = $(top_builddir)/WINGs/libWUtil.la @LIBRARY_SEARCH_PATH@ @INTLIBS@
 
 
 INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-       -DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
+       -DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@
index ef2b9ef..f1dc17f 100644 (file)
@@ -21,7 +21,7 @@ libExtraWINGs_la_SOURCES =    \
        wtabledelegates.h 
 
 INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
-       -DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
+       -DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@
 
 LDADD= $(top_builddir)/WINGs/libWINGs.la $(top_builddir)/wrlib/libwraster.la \
        $(top_builddir)/WINGs/libWUtil.la \
index 8a904ff..8792ae6 100644 (file)
@@ -86,7 +86,7 @@ libWUtil_la_SOURCES =         \
        wutil.c
 
 
-AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\" -DRESOURCE_PATH=\"$(datadir)/WINGs\" -DDEBUG
+AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\" -DRESOURCE_PATH=\"$(datadir)/WINGs\"
 AM_CFLAGS =
 
 INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
index 54c90ff..2609171 100644 (file)
@@ -17,6 +17,4 @@ wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la
 EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
 
 INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
-       -DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@ \
-       -DDEBUG
-       
+       -DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFTFLAGS@ @HEADER_SEARCH_PATH@
index ddec730..c55a5c5 100644 (file)
@@ -73,6 +73,20 @@ AC_PROG_LN_S
 AC_PROG_GCC_TRADITIONAL
 AC_PROG_LIBTOOL
 
+
+dnl Debugging Options
+dnl =================
+AC_ARG_ENABLE(debug,
+    [AS_HELP_STRING([--enable-debug], [enable debugging options, @<:@default=no@:>@])],
+    [AS_CASE(["$enableval"],
+        [yes], [debug=yes],
+        [no],  [debug=no],
+        [AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
+    [debug=no])
+AS_IF([test "x$debug" = "xyes"],
+    [CFLAGS="-g -O0 -DDEBUG"])
+
+
 AX_CFLAGS_GCC_OPTION(-Wall)
 AX_CFLAGS_GCC_OPTION(-Wextra -Wno-sign-compare -Wno-unused-parameter)
 
@@ -94,7 +108,7 @@ case "${host}" in
        ;;
        *-*-openbsd*)
                WM_OSDEP="bsd"
-       CFLAGS="$CFLAGS -DOPENBSD"
+               CFLAGS="$CFLAGS -DOPENBSD"
        ;;
        *-*-dragonfly*)
                WM_OSDEP="bsd"
@@ -901,6 +915,7 @@ dnl echo "Supported languages beside English  : $languages"
 if test "x$MOFILES" != "x"; then
        echo "Installation path for translations  : $NLSDIR" | sed -e 's|\$(prefix)|'"$prefix|"
 fi
+AS_IF([test "x$debug" = "xyes"], [echo "Debug information enabled           : $debug"])
 echo
 
 dnl WM_PRINT_REDCRAP_BUG_STATUS