summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac42
1 files changed, 42 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 29b50be..079a2c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,6 +72,47 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
done
fi
+# ----------------------------------------------------------------------
+# Coverage
+
+AC_MSG_CHECKING([whether to build with gcov testing])
+AC_ARG_ENABLE([coverage],
+ AS_HELP_STRING([--enable-coverage],
+ [Whether to enable coverage testing ]),
+ [],
+ [enable_coverage=no])
+
+AC_MSG_RESULT([$enable_coverage])
+
+if test "$enable_coverage" = "yes"; then
+ if test "$GCC" != "yes"; then
+ AC_MSG_ERROR(Coverage testing requires GCC)
+ fi
+
+ AC_PATH_PROG(GCOV, gcov, no)
+ if test "$GCOV" = "no" ; then
+ AC_MSG_ERROR(gcov tool is not available)
+ fi
+
+ AC_PATH_PROG(LCOV, lcov, no)
+ if test "$LCOV" = "no" ; then
+ AC_MSG_ERROR(lcov tool is not installed)
+ fi
+
+ AC_PATH_PROG(GENHTML, genhtml, no)
+ if test "$GENHTML" = "no" ; then
+ AC_MSG_ERROR(lcov's genhtml tool is not installed)
+ fi
+
+ CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
+ LDFLAGS="$LDFLAGS -lgcov"
+fi
+
+AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
+AC_SUBST(LCOV)
+AC_SUBST(GCOV)
+AC_SUBST(GENHTML)
+
# ---------------------------------------------------------------------
# Debug mode
@@ -89,6 +130,7 @@ fi
AC_CONFIG_FILES([Makefile
module/Makefile
+ tests/Makefile
])
AC_OUTPUT