rendered paste bodyjsled@phoenix [~/stuff/proj/gnucash/src-trunk]$ svn diff configure.in
Index: configure.in
===================================================================
--- configure.in (revision 15400)
+++ configure.in (working copy)
@@ -39,6 +39,14 @@
## Do this first, because the other tests depend on it:
+USER_OPTIMIZATION=""
+for flag in $CFLAGS; do
+ if test -z $(echo $flag | sed -e 's,-O.,,'); then
+ USER_OPTIMIZATION="$USER_OPTIMIZATION ${flag}"
+ fi
+done
+echo "user_opt $USER_OPTIMIZATION"
+
# Check for gcc and intltool (somehow breaks the suggested content
# order, doesn't it? Whatever.)
AC_PROG_CC
@@ -544,7 +552,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) )