Index: libcfa/Makefile.in
===================================================================
--- libcfa/Makefile.in	(revision a5121bff2d239413034fc4cc466f9e5b15eebd1b)
+++ libcfa/Makefile.in	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
@@ -229,4 +229,6 @@
 CFLAGS = @CFLAGS@
 CONFIGURATION = @CONFIGURATION@
+CONFIG_CFAFLAGS = @CONFIG_CFAFLAGS@
+CONFIG_CFLAGS = @CONFIG_CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
Index: libcfa/configure
===================================================================
--- libcfa/configure	(revision a5121bff2d239413034fc4cc466f9e5b15eebd1b)
+++ libcfa/configure	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
@@ -623,4 +623,6 @@
 CFA_PREFIX
 CFA_NAME
+CONFIG_CFAFLAGS
+CONFIG_CFLAGS
 ARCH_FLAGS
 CFACPP
@@ -629,8 +631,4 @@
 CONFIGURATION
 ARCHITECTURE
-AM_BACKSLASH
-AM_DEFAULT_VERBOSITY
-AM_DEFAULT_V
-AM_V
 am__untar
 am__tar
@@ -656,4 +654,8 @@
 INSTALL_SCRIPT
 INSTALL_PROGRAM
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
 target_alias
 host_alias
@@ -1910,4 +1912,43 @@
 
 
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=0;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
 
 
@@ -2343,43 +2384,4 @@
 rmdir .tst 2>/dev/null
 
-# Check whether --enable-silent-rules was given.
-if test "${enable_silent_rules+set}" = set; then :
-  enableval=$enable_silent_rules;
-fi
-
-case $enable_silent_rules in # (((
-  yes) AM_DEFAULT_VERBOSITY=0;;
-   no) AM_DEFAULT_VERBOSITY=1;;
-    *) AM_DEFAULT_VERBOSITY=1;;
-esac
-am_make=${MAKE-make}
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
-$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
-if ${am_cv_make_support_nested_variables+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if $as_echo 'TRUE=$(BAR$(V))
-BAR0=false
-BAR1=true
-V=1
-am__doit:
-	@$(TRUE)
-.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
-  am_cv_make_support_nested_variables=yes
-else
-  am_cv_make_support_nested_variables=no
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
-$as_echo "$am_cv_make_support_nested_variables" >&6; }
-if test $am_cv_make_support_nested_variables = yes; then
-    AM_V='$(V)'
-  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
-else
-  AM_V=$AM_DEFAULT_VERBOSITY
-  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
-fi
-AM_BACKSLASH='\'
-
 if test "`cd $srcdir && pwd`" != "`pwd`"; then
   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
@@ -2498,4 +2500,7 @@
 
 
+# don't use the default CFLAGS as they unconditonnaly add -O2
+: ${CFLAGS=""}
+
 # Allow program name tansformation
 # will fill program_transform_name with appropriate sed regex
@@ -2511,4 +2516,6 @@
 
 
+#==============================================================================
+#Handle specific flags
 case $ARCHITECTURE in
 	"x64"        ) ARCH_FLAGS="-m64";;
@@ -2516,4 +2523,22 @@
 	"arm"        ) ARCH_FLAGS="";;
 esac
+
+
+
+case $CONFIGURATION in
+	"debug"   )
+		CONFIG_CFLAGS="-O0 -g"
+		CONFIG_CFAFLAGS="-debug"
+	;;
+	"nodebug" )
+		CONFIG_CFLAGS="-O2 -s"
+		CONFIG_CFAFLAGS="-nodebug"
+	;;
+	"nolib"   )
+		CONFIG_CFLAGS=""
+		CONFIG_CFAFLAGS=""
+	;;
+esac
+
 
 
Index: libcfa/configure.ac
===================================================================
--- libcfa/configure.ac	(revision a5121bff2d239413034fc4cc466f9e5b15eebd1b)
+++ libcfa/configure.ac	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
@@ -5,8 +5,12 @@
 AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
 AC_CONFIG_AUX_DIR([./automake])
+AM_SILENT_RULES([yes])
 
 m4_include([../automake/cfa.m4])
 
 AM_INIT_AUTOMAKE([subdir-objects])
+
+# don't use the default CFLAGS as they unconditonnaly add -O2
+: ${CFLAGS=""}
 
 # Allow program name tansformation
@@ -23,4 +27,6 @@
 AC_SUBST(CFACPP)
 
+#==============================================================================
+#Handle specific flags
 case $ARCHITECTURE in
 	"x64"        ) ARCH_FLAGS="-m64";;
@@ -30,4 +36,22 @@
 
 AC_SUBST(ARCH_FLAGS)
+
+case $CONFIGURATION in
+	"debug"   )
+		CONFIG_CFLAGS="-O0 -g"
+		CONFIG_CFAFLAGS="-debug"
+	;;
+	"nodebug" )
+		CONFIG_CFLAGS="-O2 -s"
+		CONFIG_CFAFLAGS="-nodebug"
+	;;
+	"nolib"   )
+		CONFIG_CFLAGS=""
+		CONFIG_CFAFLAGS=""
+	;;
+esac
+
+AC_SUBST(CONFIG_CFLAGS)
+AC_SUBST(CONFIG_CFAFLAGS)
 
 #==============================================================================
Index: libcfa/prelude/Makefile.am
===================================================================
--- libcfa/prelude/Makefile.am	(revision a5121bff2d239413034fc4cc466f9e5b15eebd1b)
+++ libcfa/prelude/Makefile.am	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
@@ -24,5 +24,6 @@
 
 CC = @CFACC@
-AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
+AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
+AM_CFAFLAGS = @CONFIG_CFAFLAGS@
 
 $(DEPDIR) :
Index: libcfa/prelude/Makefile.in
===================================================================
--- libcfa/prelude/Makefile.in	(revision a5121bff2d239413034fc4cc466f9e5b15eebd1b)
+++ libcfa/prelude/Makefile.in	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
@@ -174,4 +174,6 @@
 CFLAGS = @CFLAGS@
 CONFIGURATION = @CONFIGURATION@
+CONFIG_CFAFLAGS = @CONFIG_CFAFLAGS@
+CONFIG_CFLAGS = @CONFIG_CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
@@ -263,5 +265,6 @@
 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
 noinst_DATA = ../src/prelude.c
-AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
+AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
+AM_CFAFLAGS = @CONFIG_CFAFLAGS@
 MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cf
 MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
Index: libcfa/src/Makefile.am
===================================================================
--- libcfa/src/Makefile.am	(revision a5121bff2d239413034fc4cc466f9e5b15eebd1b)
+++ libcfa/src/Makefile.am	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
@@ -28,7 +28,7 @@
 # use -no-include-stdhdr to prevent rebuild cycles
 # The built sources must not depend on the installed headers
-AM_CFAFLAGS = -quiet -in-tree -imacros prelude.c -I$(srcdir)/stdhdr
-AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
-AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
+AM_CFAFLAGS = -quiet -in-tree -imacros prelude.c -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
+AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
+AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
 CFACC = @CFACC@
 
Index: libcfa/src/Makefile.in
===================================================================
--- libcfa/src/Makefile.in	(revision a5121bff2d239413034fc4cc466f9e5b15eebd1b)
+++ libcfa/src/Makefile.in	(revision 575a6e500466575fde0acedd9b84c09b42ac2ee8)
@@ -243,4 +243,6 @@
 CFLAGS = @CFLAGS@
 CONFIGURATION = @CONFIGURATION@
+CONFIG_CFAFLAGS = @CONFIG_CFAFLAGS@
+CONFIG_CFLAGS = @CONFIG_CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
@@ -339,7 +341,7 @@
 # use -no-include-stdhdr to prevent rebuild cycles
 # The built sources must not depend on the installed headers
-AM_CFAFLAGS = -quiet -in-tree -imacros prelude.c -I$(srcdir)/stdhdr
-AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
-AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@
+AM_CFAFLAGS = -quiet -in-tree -imacros prelude.c -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
+AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
+AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
 
 #----------------------------------------------------------------------------------------------------------------
