diff options
Diffstat (limited to 'm4/salut-valgrind.m4')
-rw-r--r-- | m4/salut-valgrind.m4 | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/m4/salut-valgrind.m4 b/m4/salut-valgrind.m4 index 53ff90f1..6c1ffd51 100644 --- a/m4/salut-valgrind.m4 +++ b/m4/salut-valgrind.m4 @@ -2,22 +2,26 @@ dnl Detect Valgrind location and flags AC_DEFUN([SALUT_VALGRIND], [ + enable=$1 + VALGRIND_REQ="2.1" PKG_CHECK_MODULES(VALGRIND, valgrind > $VALGRIND_REQ, - use_valgrind="yes", - [ - use_valgrind="no" - AC_MSG_RESULT([no]) - ]) + have_valgrind_runtime="yes", have_valgrind_runtime="no") + + AC_PATH_PROG(VALGRIND_PATH, valgrind) - if test "x$use_valgrind" = xyes; then + # Compile the instrumentation for valgrind only if the valgrind + # libraries are installed and the valgrind executable is found + if test "x$enable" = xyes && + test "$have_valgrind_runtime" = yes && + test -n "$VALGRIND_PATH" ; + then AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used]) - AC_MSG_NOTICE(Using extra code paths for valgrind) + AC_MSG_NOTICE(using compile-time instrumentation for valgrind) fi AC_SUBST(VALGRIND_CFLAGS) AC_SUBST(VALGRIND_LIBS) - - AC_PATH_PROG(VALGRIND_PATH, valgrind, no) - AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno") + + AM_CONDITIONAL(HAVE_VALGRIND, test -n "$VALGRIND_PATH") ]) |