Home | History | Annotate | Line # | Download | only in m4
valgrind-tests.m4 revision 1.1.1.1.8.2
      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.
      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   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"
     28     else
     29        AC_MSG_RESULT([no])
     30     fi
     31     AC_DEFINE([MPC_USE_VALGRIND], 1, [Use valgrind for make check])
     32   else
     33     opt_valgrind_tests=no
     34     VALGRIND=
     35   fi
     36 
     37   AC_MSG_CHECKING([whether self tests are run under valgrind])
     38   AC_MSG_RESULT($opt_valgrind_tests)
     39 ])
     40 
     41