AC_ARG_WITH([valgrind],
AC_HELP_STRING([--with-valgrind],
[Enable Valgrind annotations (small runtime overhead, default NO)]))
-if test "x$with_valgrind" != "xyes"; then
+if test x$with_valgrind != xyes; then
AC_DEFINE([NVALGRIND], 1, [disable Valgrind annotations])
fi
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(valgrind/memcheck.h)
+AC_CHECK_HEADER(valgrind/memcheck.h, memcheck_ok=yes, memcheck_ok=no)
+
+if test x$with_valgrind = xyes && test $memcheck_ok = no; then
+ AC_MSG_WARN([Valgrind memcheck support requested, but <valgrind/memcheck.h> not found.])
+fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST