From 3d01dd2eef68072321021c11ab2b64d3352bea35 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 22 Nov 2007 15:28:34 +0000 Subject: [PATCH] * m4/valgrind.m4: New file. * configure.ac: Use it. --- ChangeLog | 5 +++++ configure.ac | 2 +- m4/valgrind.m4 | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 m4/valgrind.m4 diff --git a/ChangeLog b/ChangeLog index 44cf73ee9..8ba6c6bc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-11-22 Alexandre Duret-Lutz + + * m4/valgrind.m4: New file. + * configure.ac: Use it. + 2007-10-05 Alexandre Duret-Lutz * wrap/python/cgi/ltl2tgba.in: Adjust to newer versions of swig. diff --git a/configure.ac b/configure.ac index c19b60d94..2067044a5 100644 --- a/configure.ac +++ b/configure.ac @@ -63,7 +63,7 @@ AC_CHECK_PROG([MODELLA], [modella], [modella]) AC_CHECK_PROG([LTL2NBA], [script4lbtt.py], [script4lbtt.py]) AC_CHECK_PROG([PERL], [perl], [perl]) AC_CHECK_PROG([SPIN], [spin], [spin]) -AC_CHECK_PROG([VALGRIND], [valgrind], [valgrind]) +AX_CHECK_VALGRIND AC_CHECK_PROG([WRING2LBTT], [wring2lbtt], [wring2lbtt]) AC_CONFIG_FILES([ diff --git a/m4/valgrind.m4 b/m4/valgrind.m4 new file mode 100644 index 000000000..0453d8168 --- /dev/null +++ b/m4/valgrind.m4 @@ -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 +])