diff --git a/configure.ac b/configure.ac
index e730619ea17ce87df7b5c62225094e1d7d0e34db..b5057acdb96ef30ddeb07c4eddf7693fb9deb045 100644
--- a/configure.ac
+++ b/configure.ac
@@ -602,8 +602,10 @@ if test "x$with_profiler" != "xno"; then
    else
       proflibs="-lprofiler"
    fi
-   AC_CHECK_LIB([profiler],[ProfilerFlush],[have_profiler="yes"],[have_profiler="no"],
-                $proflibs)
+   AC_CHECK_LIB([profiler],[ProfilerFlush],
+    [have_profiler="yes" 
+      AC_DEFINE([WITH_PROFILER],1,[Link against the gperftools profiling library.])],
+    [have_profiler="no"], $proflibs)
 
    if test "$have_profiler" = "yes"; then
       PROFILER_LIBS="$proflibs"