summaryrefslogtreecommitdiffstats
path: root/m4/pdns_enable_coverage.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:14:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:14:51 +0000
commitbc282425088455198a7a99511c75914477d4ed32 (patch)
tree1b1fb887a634136a093deea7e4dd95d054201e7a /m4/pdns_enable_coverage.m4
parentReleasing progress-linux version 1.8.3-3~progress7.99u1. (diff)
downloaddnsdist-bc282425088455198a7a99511c75914477d4ed32.tar.xz
dnsdist-bc282425088455198a7a99511c75914477d4ed32.zip
Merging upstream version 1.9.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4/pdns_enable_coverage.m4')
-rw-r--r--m4/pdns_enable_coverage.m432
1 files changed, 32 insertions, 0 deletions
diff --git a/m4/pdns_enable_coverage.m4 b/m4/pdns_enable_coverage.m4
new file mode 100644
index 0000000..9e06468
--- /dev/null
+++ b/m4/pdns_enable_coverage.m4
@@ -0,0 +1,32 @@
+AC_DEFUN([PDNS_ENABLE_COVERAGE], [
+ AC_MSG_CHECKING([whether to enable code coverage])
+ AC_ARG_ENABLE([coverage],
+ AS_HELP_STRING([--enable-coverage],
+ [enable code coverage @<:@default=no@:>@]),
+ [enable_coverage=$enableval],
+ [enable_coverage=no]
+ )
+ AC_MSG_RESULT([$enable_coverage])
+
+ AS_IF([test "x$enable_coverage" = "xclang"], [
+ dnl let's see if the clang++ specific format is supported,
+ dnl as it has a much lower overhead and is more accurate,
+ dnl see https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
+ gl_COMPILER_OPTION_IF([-fprofile-instr-generate -fcoverage-mapping], [
+ CFLAGS="$CFLAGS -DCOVERAGE -DCLANG_COVERAGE -fprofile-instr-generate -fcoverage-mapping"
+ CXXFLAGS="$CXXFLAGS -DCOVERAGE -DCLANG_COVERAGE -fprofile-instr-generate -fcoverage-mapping"
+ ], [
+ AC_MSG_ERROR([$CXX does not support gathering coverage data in the clang format])
+ ])
+ ])
+
+ AS_IF([test "x$enable_coverage" = "xyes"], [
+ gl_COMPILER_OPTION_IF([-fprofile-arcs -ftest-coverage], [
+ CFLAGS="$CFLAGS -DCOVERAGE --coverage"
+ CXXFLAGS="$CXXFLAGS -DCOVERAGE --coverage"
+ LDFLAGS="$LDFLAGS --coverage"
+ ], [
+ AC_MSG_ERROR([$CXX does not support gathering coverage data])
+ ])
+ ])
+])