1 # ===========================================================================
2 # https://github.com/BrianAker/ddm4
3 # ===========================================================================
7 # AX_PROG_VALGRIND([tool],[options],[ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND])
11 # Look for valgrind and make sure it is a recent version of it.
15 # Copyright (c) 2012-2013 Brian Aker <brian@tangent.org>
17 # Copying and distribution of this file, with or without modification, are
18 # permitted in any medium without royalty provided the copyright notice
19 # and this notice are preserved. This file is offered as-is, without any
24 AC_DEFUN([AX_PROG_VALGRIND],
25 [AX_WITH_PROG([VALGRIND],[valgrind],[:])
26 AS_IF([test x"VALGRIND" = x":"],
28 [AS_IF([test -x "$VALGRIND"],
29 [AC_MSG_CHECKING([Checking to see if $VALGRIND is recent])
30 junk=`$VALGRIND --version &> version_file`
31 ax_valgrind_version=`head -1 version_file`
33 AC_MSG_RESULT([$VALGRIND is version "$ax_valgrind_version"])
37 AS_IF([test -n "${VALGRIND}"],
39 LIBTOOL_COMMAND="\${LIBTOOL} --mode=execute"
40 AC_SUBST([LIBTOOL_COMMAND])
41 AX_ADD_AM_MACRO([[TESTS_ENVIRONMENT=\"\${LIBTOOL_COMMAND} \${VALGRIND} --tool=$1 $2\"]])
42 ifelse([$3], , :, [$3])],
43 [ifelse([$4], , :, [$4])])