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