diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:58:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:58:51 +0000 |
commit | cbffab246997fb5a06211dfb706b54e5ae5bb59f (patch) | |
tree | 0573c5d96f58d74d76a49c0f2a70398e389a36d3 /m4/dpkg-coverage.m4 | |
parent | Initial commit. (diff) | |
download | dpkg-upstream.tar.xz dpkg-upstream.zip |
Adding upstream version 1.21.22.upstream/1.21.22upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4/dpkg-coverage.m4')
-rw-r--r-- | m4/dpkg-coverage.m4 | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/m4/dpkg-coverage.m4 b/m4/dpkg-coverage.m4 new file mode 100644 index 0000000..70b67d1 --- /dev/null +++ b/m4/dpkg-coverage.m4 @@ -0,0 +1,51 @@ +# serial 1 +# 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]) +]) |