diff configure.in @ 103707:6f4661f3af1c

(--enable-profiling): New option.
author Dan Nicolaescu <dann@ics.uci.edu>
date Fri, 03 Jul 2009 13:04:57 +0000
parents 02bc348744ed
children bae3b52cda07
line wrap: on
line diff
--- a/configure.in	Fri Jul 03 11:35:04 2009 +0000
+++ b/configure.in	Fri Jul 03 13:04:57 2009 +0000
@@ -273,6 +273,19 @@
 [Define this to check for errors in cons list.])
 fi
 
+AC_ARG_ENABLE(profiling,
+[  --enable-profiling
+			  Build emacs with profiling support.
+			  This might not work on all platforms.],
+[ac_enable_profiling="${enableval}"],[])
+if test x$ac_enable_profiling != x ; then
+   PROFILING_CFLAGS="-DPROFILING=1 -pg"
+   PROFILING_LDFLAGS="-pg"
+else
+   PROFILING_CFLAGS=
+   PROFILING_LDFLAGS=
+fi
+
 #### Make srcdir absolute, if it isn't already.  It's important to
 #### avoid running the path through pwd unnecessarily, since pwd can
 #### give you automounter prefixes, which can go away.  We do all this
@@ -931,7 +944,7 @@
 
 /* Get the CFLAGS for real compilation.  */
 #ifdef __GNUC__
-configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH '${SPECIFIED_CFLAGS}'
+configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
 #else
 configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
 #endif
@@ -939,6 +952,8 @@
 #endif /* not THIS_IS_CONFIGURE */
 ' > ${tempcname}
 
+LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}"
+
 # The value of CPP is a quoted variable reference, so we need to do this
 # to get its actual value...
 CPP=`eval "echo $CPP"`