Index: configure.in
===================================================================
--- configure.in	(revision 24663)
+++ configure.in	(working copy)
@@ -444,49 +444,55 @@
                 capable of https:// access.]),
 [])
 
-AC_ARG_ENABLE(debug,
-AC_HELP_STRING([--enable-debug],
-	       [Turn on debugging]),
-[
-    if test "$enableval" = "yes" ; then
-      enable_debugging="yes"
-    else
-      enable_debugging="no"
-    fi
-],
-[
-    enable_debugging="no"
-])
+enable_debugging=no
 
 AC_ARG_ENABLE(maintainer-mode,
 AC_HELP_STRING([--enable-maintainer-mode],
 	       [Turn on debugging and very strict compile-time warnings]),
 [
     if test "$enableval" = "yes" ; then
-      if test "$enable_debugging" = "no" ; then
-        AC_MSG_ERROR(Can't have --disable-debug and --enable-maintainer-mode)
-      fi
       enable_debugging=yes
+      remove_optimization=yes
+      add_debug_flags=yes
+
       if test "$GCC" = "yes"; then
         CFLAGS="$CFLAGS -Wpointer-arith -Wwrite-strings -Wshadow"
       fi
     fi
 ])
 
+AC_ARG_ENABLE(debug,
+AC_HELP_STRING([--enable-debug],
+	       [Turn on debugging]),
+[
+    if test "$enableval" = "yes" ; then
+      enable_debugging="yes"
+      add_debug_flags=yes
+      remove_optimization=yes
+    fi
+])
+
 if test "$enable_debugging" = "yes" ; then
   dnl At the moment, we don't want optimization, because we're
   dnl debugging.
-  CFLAGS=["`echo $CFLAGS' ' | sed -e 's/-O[^ ]* //g'`"]
+  remove_optimization=yes
   dnl SVN_DEBUG enables specific features for developer builds
   dnl AP_DEBUG enables specific (Apache) features for developer builds
-  CFLAGS="$CFLAGS -DSVN_DEBUG -DAP_DEBUG"
+  add_debug_flags=yes
 else
   if test "$enable_debugging" = "no" ; then
     CFLAGS=["`echo $CFLAGS' ' | sed -e 's/-g[0-9] //g' | sed -e 's/-g//g'`"]
   fi
 fi
 
+if test "$remove_optimization" = "yes" ; then
+  CFLAGS=["`echo $CFLAGS' ' | sed -e 's/-O[^ ]* //g'`"]
+fi
 
+if test "$add_debug_flags" = "yes" ; then
+  CFLAGS="$CFLAGS -DSVN_DEBUG -DAP_DEBUG"
+fi
+
 AC_ARG_WITH(editor,
 AC_HELP_STRING([--with-editor=PATH],
                [Specify a default editor for the subversion client.]),

