]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/acinclude.m4
adding gprof support to the HLT build system
[u/mrichter/AliRoot.git] / HLT / acinclude.m4
index b7c83568ce0cbc8a704833ac5bc3fd343b5227f3..8cb3d72324e527c630f28e64bf414cf8c03d06cc 100644 (file)
@@ -46,6 +46,32 @@ AC_DEFUN([AC_DEBUG],
   AC_MSG_RESULT($enable_debug 'CFLAGS=$CFLAGS')
 ])
 
+dnl ------------------------------------------------------------------
+AC_DEFUN([AC_PROFILING],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_PROG_CXX])
+  AC_MSG_CHECKING(whether to add profiling info)
+  AC_ARG_ENABLE(profiling,
+    [AC_HELP_STRING([--enable-profiling],[Enable profiling info in objects])],
+    [],[enable_profiling=no])
+  if test "x$enable_profiling" = "xno" ; then
+    CFLAGS=`echo $CFLAGS | sed 's,-pg,,'`
+    CXXFLAGS=`echo $CXXFLAGS | sed 's,-pg,,'`
+  else
+    AC_DEFINE(PROFILING)
+    case $CXXFLAGS in
+    *-pg*) ;;
+    *)    CXXFLAGS="$CXXFLAGS -pg" ;;
+    esac
+    case $CFLAGS in
+    *-pg*) ;;
+    *)    CFLAGS="$CFLAGS -pg" ;;
+    esac
+  fi
+  AC_MSG_RESULT($enable_profiling 'CFLAGS=$CFLAGS')
+])
+
 dnl ------------------------------------------------------------------
 AC_DEFUN([AC_OPTIMIZATION],
 [