diff --git a/aclocal.m4 b/aclocal.m4
index f320a08a032a43aeeacf3c1135b3b1b3ab1f06a1..049931cfe6cf37048d1549110394a7d36de9c2ce 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1823,12 +1823,13 @@ dnl
 
 AC_DEFUN([BM_DEBUG_SUPPORT],
 [
-  AC_ARG_ENABLE(debug,
+  AC_ARG_ENABLE([debug],
 AC_HELP_STRING([--enable-debug[=yes|no|full]], [Build with debugging support])
 AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
-    [ac_cv_debug=$enableval], [ac_cv_debug=no])
+    [], [enable_debug=no])
+
   AC_MSG_CHECKING([whether to build with debugging support])
-  if test x"$ac_cv_debug" != x"no"; then
+  if test x"$enable_debug" != x"no"; then
     AC_DEFINE(DEBUG, 1, Define for debugging support)
     if test x"$ac_cv_debug" = x"full"; then
       AC_DEFINE(DEBUG_TRACE, 1, Define for tracing support)
@@ -1839,8 +1840,36 @@ AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
       AC_MSG_RESULT([yes])
     fi
   else
+    AC_MSG_RESULT([no])
+  fi
+
+  AC_ARG_ENABLE([profiling],
+AC_HELP_STRING([--enable-profiling],
+    [Generate extra code to write profile information])
+AC_HELP_STRING([--disable-profiling],
+    [No extra code for profiling (default)]),
+    [], [enable_profiling=no])
+
+  AC_MSG_CHECKING([whether to build with profiling support])
+  if test x"$enable_profiling" != x"no"; then
+    CFLAGS="$CFLAGS -pg"
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
+  fi
+
+  AC_ARG_ENABLE([asserts],
+AC_HELP_STRING([--enable-asserts], [Enable assert statements (default)])
+AC_HELP_STRING([--disable-asserts],
+    [Disable assert statements (USE WITH CARE!!!)]),
+    [], [enable_asserts=yes])
+
+  AC_MSG_CHECKING([whether to enable assert statements])
+  if test x"$enable_asserts" != x"yes"; then
     CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
     AC_MSG_RESULT([no])
+  else
+    AC_MSG_RESULT([yes])
   fi
 ])
 
diff --git a/configure b/configure
index a1f5daf9792a435fa7926b022fd0fc93faf43403..b98b4421a64c3d0b891b88275c96265e1587e501 100755
--- a/configure
+++ b/configure
@@ -859,6 +859,10 @@ Optional Features:
   --enable-debug=yes|no|full
                           Build with debugging support
   --disable-debug         Include no debugging support default
+  --enable-profiling      Generate extra code to write profile information
+  --disable-profiling     No extra code for profiling (default)
+  --enable-asserts        Enable assert statements (default)
+  --disable-asserts       Disable assert statements (USE WITH CARE!!!)
   --enable-rpath          Specify run path to the ELF linker (default)
   --disable-rpath         Do not use -rpath (use with care!!)
 
@@ -5112,7 +5116,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
 case $host in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5115 "configure"' > conftest.$ac_ext
+  echo '#line 5119 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5805,13 +5809,14 @@ echo "$as_me: error: Library requirements (glib-2.0 >= 2.0.0) not met; consider
   # Check whether --enable-debug or --disable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval="$enable_debug"
-  ac_cv_debug=$enableval
+
 else
-  ac_cv_debug=no
+  enable_debug=no
 fi;
+
   echo "$as_me:$LINENO: checking whether to build with debugging support" >&5
 echo $ECHO_N "checking whether to build with debugging support... $ECHO_C" >&6
-  if test x"$ac_cv_debug" != x"no"; then
+  if test x"$enable_debug" != x"no"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define DEBUG 1
@@ -5832,9 +5837,46 @@ echo "${ECHO_T}full" >&6
 echo "${ECHO_T}yes" >&6
     fi
   else
+    echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  fi
+
+  # Check whether --enable-profiling or --disable-profiling was given.
+if test "${enable_profiling+set}" = set; then
+  enableval="$enable_profiling"
+
+else
+  enable_profiling=no
+fi;
+
+  echo "$as_me:$LINENO: checking whether to build with profiling support" >&5
+echo $ECHO_N "checking whether to build with profiling support... $ECHO_C" >&6
+  if test x"$enable_profiling" != x"no"; then
+    CFLAGS="$CFLAGS -pg"
+    echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  else
+    echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  fi
+
+  # Check whether --enable-asserts or --disable-asserts was given.
+if test "${enable_asserts+set}" = set; then
+  enableval="$enable_asserts"
+
+else
+  enable_asserts=yes
+fi;
+
+  echo "$as_me:$LINENO: checking whether to enable assert statements" >&5
+echo $ECHO_N "checking whether to enable assert statements... $ECHO_C" >&6
+  if test x"$enable_asserts" != x"yes"; then
     CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
     echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
+  else
+    echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
   fi
 
 
diff --git a/m4/debug.m4 b/m4/debug.m4
index 6e61751c9c2b856496410772b6a1546e675f3eac..5d1a9ba5f9eb5327284d79914ea827fdd0577a75 100644
--- a/m4/debug.m4
+++ b/m4/debug.m4
@@ -8,12 +8,13 @@ dnl
 
 AC_DEFUN([BM_DEBUG_SUPPORT],
 [
-  AC_ARG_ENABLE(debug,
+  AC_ARG_ENABLE([debug],
 AC_HELP_STRING([--enable-debug[=yes|no|full]], [Build with debugging support])
 AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
-    [ac_cv_debug=$enableval], [ac_cv_debug=no])
+    [], [enable_debug=no])
+
   AC_MSG_CHECKING([whether to build with debugging support])
-  if test x"$ac_cv_debug" != x"no"; then
+  if test x"$enable_debug" != x"no"; then
     AC_DEFINE(DEBUG, 1, Define for debugging support)
     if test x"$ac_cv_debug" = x"full"; then
       AC_DEFINE(DEBUG_TRACE, 1, Define for tracing support)
@@ -24,7 +25,35 @@ AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
       AC_MSG_RESULT([yes])
     fi
   else
+    AC_MSG_RESULT([no])
+  fi
+
+  AC_ARG_ENABLE([profiling],
+AC_HELP_STRING([--enable-profiling],
+    [Generate extra code to write profile information])
+AC_HELP_STRING([--disable-profiling],
+    [No extra code for profiling (default)]),
+    [], [enable_profiling=no])
+
+  AC_MSG_CHECKING([whether to build with profiling support])
+  if test x"$enable_profiling" != x"no"; then
+    CFLAGS="$CFLAGS -pg"
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
+  fi
+
+  AC_ARG_ENABLE([asserts],
+AC_HELP_STRING([--enable-asserts], [Enable assert statements (default)])
+AC_HELP_STRING([--disable-asserts],
+    [Disable assert statements (USE WITH CARE!!!)]),
+    [], [enable_asserts=yes])
+
+  AC_MSG_CHECKING([whether to enable assert statements])
+  if test x"$enable_asserts" != x"yes"; then
     CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
     AC_MSG_RESULT([no])
+  else
+    AC_MSG_RESULT([yes])
   fi
 ])