allow developers to more easily build a profiling version of the interpreter
and modules by configuring with the --enable-profiling flag.
diff --git a/configure.in b/configure.in
index cff0ed3..7e13874 100644
--- a/configure.in
+++ b/configure.in
@@ -485,6 +485,24 @@
 fi
 AC_MSG_RESULT($enable_shared)
 
+AC_MSG_CHECKING(for --enable-profiling)
+AC_ARG_ENABLE(profiling,
+              AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
+[ac_save_cc="$CC"
+ CC="$CC -pg"
+ AC_TRY_RUN([int main() { return 0; }],
+   ac_enable_profiling="yes",
+   ac_enable_profiling="no",
+   ac_enable_profiling="no")
+ CC="$ac_save_cc"])
+AC_MSG_RESULT($ac_enable_profiling)
+
+case "$ac_enable_profiling" in
+    "yes")
+	BASECFLAGS="-pg $BASECFLAGS"
+	LDFLAGS="-pg $LDFLAGS"
+    ;;
+esac
 
 AC_MSG_CHECKING(LDLIBRARY)