aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorToni <matzeton@googlemail.com>2022-02-28 14:58:45 +0100
committerGitHub <noreply@github.com>2022-02-28 14:58:45 +0100
commit00d9a16b6a7e3c5ca90930e3991ac3476bd48780 (patch)
treef99a46599ccb85f0a3f0b7c577cf8ee30cc2124d /configure.ac
parent61a3c2eb5b3cac0f36a1bfadc5261b7694d3bfab (diff)
Added `--enable-code-coverage' build using lcov for coverage generation. (#1430)
* CI job generates a coverage report Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac7
1 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 2a732efe2..462847387 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,8 @@ AS_IF([test "${with_only_libndpi+set}" = set],[
AC_ARG_WITH(sanitizer, AS_HELP_STRING([--with-sanitizer], [Build with support for address, undefined and leak sanitizer]))
AC_ARG_ENABLE(fuzztargets, AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
+AC_ARG_ENABLE(code-coverage, AS_HELP_STRING([--enable-code-coverage], [Generate Code Coverage report]))
+
AS_IF([test "x$enable_fuzztargets" = "xyes"], [BUILD_FUZZTARGETS=1], [BUILD_FUZZTARGETS=0])
AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
@@ -23,6 +25,11 @@ AS_IF([test "${with_sanitizer+set}" = set],[
LDFLAGS="${LDFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak"
])
+AS_IF([test "x$enable_code_coverage" = "xyes"],[
+ CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
+ LDFLAGS="${LDFLAGS} --coverage"
+])
+
LT_INIT
LT_LIB_M
PKG_PROG_PKG_CONFIG