Index: /sources/configure.ac
===================================================================
--- /sources/configure.ac	(revision 38)
+++ /sources/configure.ac	(revision 39)
@@ -26,5 +26,5 @@
 						   [do_$1=${enableval}],
 						   [do_$1=$3])
-             AS_IF([test x${do_$1} != xno],
+             AS_IF([test x${do_$1} != "xno"],
 			 AC_DEFINE(m4_toupper([CONFIG_$1]), [], [$2]),
 			 )])
@@ -34,9 +34,10 @@
 MY_ARG_ENABLE(check_multiwriting2register, [Report if unconnected signal is written twice], [no])
 MY_ARG_ENABLE(debug, [Enable debugging], [no])
+
 MY_ARG_ENABLE(default_runtime_compilation, [Compile scheduling code], [no])
 
 # Also set -DNDEBUG when not debugging, this disables assert()s
-AS_IF([test "x$do_debug" != xyes],
-CXXFLAGS="-DNDEBUG")
+AS_IF([test "x$do_debug"  = "xyes"], [CXXFLAGS="-g"         ],
+      [test "x$do_debug" != "xyes"], [CXXFLAGS="-O2 -NDEBUG"])
 
 case $target_os in
