build: enable valgrind
Enable valgrind to check memory usage.
Change-Id: Ib8d3affd895657864cdddade29a5871892840c5c
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/configure.ac b/configure.ac
index a83479e..f345d8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,6 +211,16 @@
AX_RESTORE_FLAGS_WITH_PREFIX(OLD, [LDFLAGS])
])
+# Check for valgrind
+AS_IF([test "x$enable_tests" = "xno"], [enable_valgrind=no])
+m4_foreach([vgtool], [valgrind_tool_list],
+ [AX_VALGRIND_DFLT(vgtool, [off])])
+AX_VALGRIND_DFLT([memcheck], [on])
+AX_VALGRIND_CHECK
+AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
+m4_foreach([vgtool], [valgrind_tool_list],
+ [AM_EXTRA_RECURSIVE_TARGETS([check-valgrind-]vgtool)])
+
# Code coverage
AX_CODE_COVERAGE
AS_IF([test "x$CODE_COVERAGE_ENABLED" = "xyes"], [
diff --git a/test/Makefile.am b/test/Makefile.am
index 0f0a18e..c8eee3f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,3 +1,5 @@
+@VALGRIND_CHECK_RULES@
+
AM_CPPFLAGS = \
-I$(top_srcdir)/ \
-I$(top_srcdir)/tools/ \