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.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15477 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled
2007-01-31 02:36:53 +00:00
parent 227489040d
commit 68f9050a4b

View File

@@ -37,6 +37,15 @@ GNUCASH_MAJOR_VERSION=`echo $GNUCASH_VERSION_STRING | [ sed -e 's/^\([^\.]*\)\.\
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_SUBST(GNC_LIBEXECDIR)
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) )