From: Christophe CURIS <[email protected]>

The previous code made a dumb change to CFLAGS which would cause user
supplied CFLAGS to be ignored, and possible compiler compatibility issues.

The new code does the same changes in a smoother way, so we do not totally
drop user specified or script detected compiler options.

When debug is enabled, we also include a reminder for the final CFLAGS
value.

Signed-off-by: Christophe CURIS <[email protected]>
---
 configure.ac | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index b46b575..0415bbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,18 @@ AC_ARG_ENABLE(debug,
         [AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
     [debug=no])
 AS_IF([test "x$debug" = "xyes"],
-    [CFLAGS="-g -O0" ; CPPFLAGS="$CPPFLAGS -DDEBUG"])
+    [dnl This flag should have already been detected and added, but if user
+     dnl provided an explicit CFLAGS it may not be the case
+     AS_IF([echo " $CFLAGS " | grep " -g " 2>&1 > /dev/null],
+           [@%:@ Debug symbol already activated],
+           [AX_CFLAGS_GCC_OPTION([-g])])
+     dnl
+     dnl This flag generally makes debugging nightmarish, remove it if present
+     CFLAGS="`echo "$CFLAGS" | sed -e 's/-fomit-frame-pointer *//' `"
+     dnl
+     dnl Enable internal debug code
+     CPPFLAGS="$CPPFLAGS -DDEBUG"
+])
 
 
 AX_CFLAGS_GCC_OPTION(-Wall)
@@ -841,7 +852,8 @@ 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"])
+AS_IF([test "x$debug" = "xyes"],
+    [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
 echo
 
 dnl WM_PRINT_REDCRAP_BUG_STATUS
-- 
1.8.4.rc3


-- 
To unsubscribe, send mail to [email protected].

Reply via email to