diff --git a/Makefile.am b/Makefile.am index 8f7b6b0e..a48ad44d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,3 +10,16 @@ EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N FAQ.I18N.cs FAQ.I18N.sk \ The-perfect-Window-Maker-patch.txt \ README.es README.pt COPYING.WTFPL autogen.sh +if USE_LCOV +coverage-reset: + find . -type f -name '*.gcda' -exec rm -f '{}' ';' + lcov --directory . --zerocounters + +coverage: + rm -rf coverage @lcov_output_directory@ + -mkdir -p coverage @lcov_output_directory@ + lcov --compat-libtool --capture --directory . --output-file coverage/coverage.info + genhtml --output-directory @lcov_output_directory@ coverage/coverage.info + +.PHONY: coverage-reset coverage +endif diff --git a/configure.ac b/configure.ac index 2caa212d..36054967 100644 --- a/configure.ac +++ b/configure.ac @@ -155,6 +155,24 @@ AS_IF([test "x$with_boehm_gc" = "xyes"], ) ) +dnl LCOV +dnl ==== +AC_ARG_ENABLE([lcov], + [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])], + [], + [enable_lcov=no]) + +AS_IF([test "x$enable_lcov" != "xno"], + [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage) + if test "x$enable_lcov" = "xyes"; then + lcov_output_directory="coverage-report" + else + lcov_output_directory="${enable_lcov}/coverage-report" + fi + AC_SUBST(lcov_output_directory)] +) +AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"]) + dnl dnl ============================ dnl Checks for library functions