valgrind-tests.m4 revision 1.1.1.2.4.1 1 # valgrind-tests.m4 serial 3
2 dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl From Simon Josefsson
8 dnl with adaptations to MPC
9
10 # gl_VALGRIND_TESTS()
11 # -------------------
12 # Check if valgrind is available, and set VALGRIND to it if available.
13 AC_DEFUN([gl_VALGRIND_TESTS],
14 [
15 # Run self-tests under valgrind?
16 if test "$cross_compiling" = no; then
17 AC_CHECK_PROGS(VALGRIND, valgrind)
18 fi
19
20 VALGRIND_OPTS="-q --error-exitcode=1 --leak-check=full"
21
22 AC_MSG_CHECKING([whether valgrind is working])
23 if test -n "$VALGRIND" \
24 && $VALGRIND $VALGRIND_OPTS $SHELL -c 'exit 0' > /dev/null 2>&1; then
25 AC_MSG_RESULT([yes])
26 AC_DEFINE([MPC_USE_VALGRIND], 1, [Use valgrind for make check])
27 # Addition AE: enable suppression file through a shell variable
28 AC_MSG_CHECKING([for valgrind suppression file])
29 if test -n "$VALGRIND_SUPPRESSION"; then
30 AC_MSG_RESULT($VALGRIND_SUPPRESSION)
31 VALGRIND_OPTS="$VALGRIND_OPTS --suppressions=$VALGRIND_SUPPRESSION"
32 else
33 AC_MSG_RESULT([no])
34 fi
35 else
36 AC_MSG_RESULT([no])
37 VALGRIND=
38 VALGRIND_OPTS=
39 fi
40
41 AC_SUBST([VALGRIND_OPTS])
42 ])
43
44