--- a/configure.ac 2014-11-01 17:49:19.341284752 +0100 +++ b/configure.ac 2014-11-01 20:04:37.820715480 +0100 @@ -985,6 +985,10 @@ AS_HELP_STRING([--disable-ooenv], [Disable ooenv for the instdir installation.])) +AC_ARG_ENABLE(valgrind, + AS_HELP_STRING([--enable-valgrind], + [Enable valgrind support.])) + AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable link-time optimization. Suitable for (optimised) product builds. Building might take @@ -5751,10 +5755,12 @@ AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS]) dnl =================================================================== -dnl Check if valgrind headers are available +dnl Check whether to enable valgrind support and if headers available dnl =================================================================== ENABLE_VALGRIND= -if test "$cross_compiling" != yes; then +AC_MSG_CHECKING([whether to enable valgrind support]) +if test "$enable_valgrind" = yes -a "$cross_compiling" != yes; then + AC_MSG_RESULT([yes]) prev_cppflags=$CPPFLAGS # Is VALGRIND_CFLAGS something one is supposed to have in the environment, # or where does it come from? @@ -5762,6 +5768,11 @@ AC_CHECK_HEADER([valgrind/valgrind.h], [ENABLE_VALGRIND=TRUE]) CPPFLAGS=$prev_cppflags + if test -z "$ENABLE_VALGRIND"; then + AC_MSG_ERROR([Could not find valgrind/valgrind.h, but valgrind support was requested.]) + fi +else + AC_MSG_RESULT([no]) fi AC_SUBST([ENABLE_VALGRIND]) if test -z "$ENABLE_VALGRIND"; then