Help: Use stable 'if' namespace instead of experimental
[empathy-mirror.git] / m4 / empathy-valgrind.m4
blob7a44e103fed91858f9576fe0795636b30b310ca1
1 dnl Detect Valgrind location and flags
3 AC_DEFUN([EMPATHY_VALGRIND],
5   enable=$1
6   if test -n "$2"; then
7     valgrind_req=$2
8   else
9     valgrind_req="2.1"
10   fi
12   PKG_CHECK_MODULES(VALGRIND, valgrind > "$valgrind_req",
13     have_valgrind_runtime="yes", have_valgrind_runtime="no")
15   AC_PATH_PROG(VALGRIND_PATH, valgrind)
17   # Compile the instrumentation for valgrind only if the valgrind
18   # libraries are installed and the valgrind executable is found
19   if test "x$enable" = xyes &&
20      test "$have_valgrind_runtime" = yes &&
21      test -n "$VALGRIND_PATH" ;
22   then
23     AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used])
24     AC_MSG_NOTICE(using compile-time instrumentation for valgrind)
25   fi
27   AC_SUBST(VALGRIND_CFLAGS)
28   AC_SUBST(VALGRIND_LIBS)
30   AM_CONDITIONAL(HAVE_VALGRIND, test -n "$VALGRIND_PATH")