diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:45:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:45:20 +0000 |
commit | 9a08cbfcc1ef900a04580f35afe2a4592d7d6030 (patch) | |
tree | 004cc7027bca2f2c0bcb5806527c8e0c48df2d6e /m4/dpkg-coverage.m4 | |
parent | Initial commit. (diff) | |
download | dpkg-upstream.tar.xz dpkg-upstream.zip |
Adding upstream version 1.19.8.upstream/1.19.8upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | m4/dpkg-coverage.m4 | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/m4/dpkg-coverage.m4 b/m4/dpkg-coverage.m4 new file mode 100644 index 0000000..6cc097d --- /dev/null +++ b/m4/dpkg-coverage.m4 @@ -0,0 +1,50 @@ +# Copyright © 2010 Guillem Jover <guillem@debian.org> + +# DPKG_CODE_COVERAGE +# ------------------ +# Add configuration option to enable code coverage support. +AC_DEFUN([DPKG_CODE_COVERAGE], [ + AC_ARG_ENABLE([coverage], + [AS_HELP_STRING([--enable-coverage], [whether to enable code coverage])], + [], [enable_coverage=no]) + AM_CONDITIONAL([COVERAGE_ENABLED], [test x$enable_coverage = xyes]) + + AS_IF([test "x$enable_coverage" = "xyes"], [ + AS_IF([test "x$GCC" = "xno"], [ + AC_MSG_ERROR([not compiling with gcc, which is required for C coverage support]) + ]) + + AC_CHECK_PROGS([GCOV], [gcov]) + AS_IF([test -z "$GCOV"], [ + AC_MSG_ERROR([missing gcov, which is required for C coverage support]) + ]) + + AC_CHECK_PROGS([LCOV], [lcov]) + AS_IF([test -z "$LCOV"], [ + AC_MSG_ERROR([missing lcov, which is required for C coverage support]) + ]) + + AC_CHECK_PROGS([LCOV_GENHTML], [genhtml]) + AS_IF([test -z "$LCOV_GENHTML"], [ + AC_MSG_ERROR([missing genhtml, which is required for C coverage support]) + ]) + + CFLAGS="$CFLAGS --coverage -O0" + LDFLAGS="$LDFLAGS --coverage -O0" + + AC_MSG_CHECKING([for Devel::Cover perl module]) + AS_IF([$($PERL -e "require Devel::Cover;" 2>/dev/null)], [ + PERL_COVERAGE="-MDevel::Cover" + AC_SUBST(PERL_COVERAGE) + AC_MSG_RESULT([ok]) + ], [ + AC_MSG_ERROR([Devel::Cover perl module is required for coverage support]) + ]) + AC_CHECK_PROGS([PERL_COVER], [cover]) + AS_IF([test -z "$PERL_COVER"], [ + AC_MSG_ERROR([missing cover, which is required for perl coverage support]) + ]) + ]) + AC_MSG_CHECKING([whether to build with code coverage]) + AC_MSG_RESULT([$enable_coverage]) +]) |