* m4/valgrind.m4: New file.
* configure.ac: Use it.
This commit is contained in:
parent
ec6bca7992
commit
3d01dd2eef
3 changed files with 39 additions and 1 deletions
33
m4/valgrind.m4
Normal file
33
m4/valgrind.m4
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# _AX_CHECK_VALGRIND_SANITY(IF-SANE, IF-NOT)
|
||||
# ------------------------------------------
|
||||
# Some installations of valgrind emit spurious warnings in ld.so or
|
||||
# other standard libraries. We cannot rely on these during "make check".
|
||||
# We check that by running valgrind on "ls".
|
||||
AC_DEFUN([_AX_CHECK_VALGRIND_SANITY],
|
||||
[
|
||||
if (exec 8>valgrind.err
|
||||
exitcode=0
|
||||
$VALGRIND --tool=memcheck --leak-check=yes --log-fd=8 -q ls >/dev/null ||
|
||||
exitcode=$?
|
||||
test -z "`sed 1q valgrind.err`" || exitcode=50
|
||||
rm -f valgrind.err
|
||||
exit $exitcode
|
||||
); then
|
||||
$1;
|
||||
else
|
||||
$2;
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CHECK_VALGRIND], [
|
||||
AC_CHECK_PROG([VALGRIND], [valgrind], [valgrind])
|
||||
if test -n "$VALGRIND"; then
|
||||
AC_CACHE_CHECK([wether valgrind is sane],
|
||||
[ax_cv_valgrind_sanity],
|
||||
[_AX_CHECK_VALGRIND_SANITY([ax_cv_valgrind_sanity=yes],
|
||||
[ax_cv_valgrind_sanity=no])])
|
||||
if test x"$ax_cv_valgrind_sanity" = xno; then
|
||||
VALGRIND=
|
||||
fi
|
||||
fi
|
||||
])
|
||||
Loading…
Add table
Add a link
Reference in a new issue