1 # valgrind-tests.m4 serial 2
2 dnl Copyright (C) 2008-2011 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.
7 dnl From Simon Josefsson
8 dnl with adaptations to MPC
12 # Check if valgrind is available, and set VALGRIND to it if available.
13 AC_DEFUN([gl_VALGRIND_TESTS],
15 # Run self-tests under valgrind?
16 if test "$cross_compiling" = no; then
17 AC_CHECK_PROGS(VALGRIND, valgrind)
20 if test -n "$VALGRIND" && $VALGRIND -q true > /dev/null 2>&1; then
21 opt_valgrind_tests=yes
22 VALGRIND="$VALGRIND -q --error-exitcode=1 --leak-check=full"
23 # Addition AE: enable suppression file through a shell variable
24 AC_MSG_CHECKING([for valgrind suppression file])
25 if test -n "$VALGRIND_SUPPRESSION"; then
26 AC_MSG_RESULT($VALGRIND_SUPPRESSION)
27 VALGRIND="$VALGRIND --suppressions=$VALGRIND_SUPPRESSION"
31 AC_DEFINE([MPC_USE_VALGRIND], 1, [Use valgrind for make check])
37 AC_MSG_CHECKING([whether self tests are run under valgrind])
38 AC_MSG_RESULT($opt_valgrind_tests)