r15477 - gnucash/trunk - Force --enable-debug to strip spurious optimization added by AC_PROG_CC (for gcc). But if the user has optimization in their CFLAGS, make sure it's respected.
Josh Sled
jsled at cvs.gnucash.org
Tue Jan 30 21:36:54 EST 2007
Author: jsled
Date: 2007-01-30 21:36:53 -0500 (Tue, 30 Jan 2007)
New Revision: 15477
Trac: http://svn.gnucash.org/trac/changeset/15477
Modified:
gnucash/trunk/configure.in
Log:
Force --enable-debug to strip spurious optimization added by AC_PROG_CC (for gcc). But if the user has optimization in their CFLAGS, make sure it's respected.
Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in 2007-01-31 02:25:32 UTC (rev 15476)
+++ gnucash/trunk/configure.in 2007-01-31 02:36:53 UTC (rev 15477)
@@ -37,6 +37,15 @@
GNUCASH_MINOR_VERSION=`echo $GNUCASH_VERSION_STRING | [ sed -e 's/^\([^\.]*\)\.\([^.]*\)\.\(.*\)$/\2/' ]`
GNUCASH_MICRO_VERSION=`echo $GNUCASH_VERSION_STRING | [ sed -e 's/^\([^\.]*\)\.\([^.]*\)\.\(.*\)$/\3/' ]`
+# save any user/environment optimization flags before we muck with them in
+# --enable-debug:
+USER_OPTIMIZATION=""
+for flag in $CFLAGS; do
+ if test -z $(echo $flag | sed -e 's,-O.,,'); then
+ USER_OPTIMIZATION="$USER_OPTIMIZATION ${flag}"
+ fi
+done
+
## Do this first, because the other tests depend on it:
# Check for gcc and intltool (somehow breaks the suggested content
@@ -563,7 +572,10 @@
AC_ARG_ENABLE( debug,
[ --enable-debug compile with debugging flags set],
- CFLAGS="${CFLAGS} -g"
+ # remove any optimization flags...
+ CFLAGS=$(echo $CFLAGS | sed -e 's,-O.,,g')
+ # ...except for those the user wants.
+ CFLAGS="${CFLAGS} -g ${USER_OPTIMIZATION}"
LDFLAGS="${LDFLAGS} -g"
AC_DEFINE(DEBUG_MEMORY,1,Enable debug memory),
AC_DEFINE(DEBUG_MEMORY,0,Enable debug memory) )
More information about the gnucash-changes
mailing list