summaryrefslogtreecommitdiff
path: root/m4/curl-functions.m4
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-01-25 10:14:25 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-01-26 00:29:50 +0100
commit179311ec37ffed5b88f446f4348993a51a168abd (patch)
tree5901fd48c71f975a1d3ff41aa330968305f0a353 /m4/curl-functions.m4
parent3cbf731d9ec7146f9f1a6ac0fbd9af7fe358f5bb (diff)
downloadcurl-179311ec37ffed5b88f446f4348993a51a168abd.tar.gz
configure: rewrite --enable-code-coverage
The previously used ax_code_coverage.m4 is not license compatible and must not be used. Reported-by: William A. Rowe Jr Fixes #3497 Closes #3499
Diffstat (limited to 'm4/curl-functions.m4')
-rw-r--r--m4/curl-functions.m442
1 files changed, 41 insertions, 1 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index 275b67b15..9f230b3f8 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@@ -7025,3 +7025,43 @@ AC_DEFUN([CURL_RUN_IFELSE], [
AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
LD_LIBRARY_PATH=$old # restore
])
+
+dnl CURL_COVERAGE
+dnl --------------------------------------------------
+dnl Switch on options and libs to build with gcc's code coverage.
+dnl
+
+AC_DEFUN([CURL_COVERAGE],[
+ AC_REQUIRE([AC_PROG_SED])
+ AC_REQUIRE([AC_ARG_ENABLE])
+ AC_MSG_CHECKING([for code coverage support])
+ coverage="no"
+ curl_coverage_msg="disabled"
+
+ dnl check if enabled by argument
+ AC_ARG_ENABLE(code-coverage,
+ AC_HELP_STRING([--enable-code-coverage], [Provide code coverage]),
+ coverage="yes",
+ coverage="no")
+
+ dnl if not gcc switch off again
+ AS_IF([ test "$GCC" != "yes" ], coverage="no" )
+ AC_MSG_RESULT($coverage)
+
+ if test "x$coverage" = "xyes"; then
+ curl_coverage_msg="enabled"
+
+ AC_CHECK_TOOL([GCOV], [gcov], [gcov])
+ if test -z "$GCOV"; then
+ AC_MSG_ERROR([needs gcov for code coverage])
+ fi
+ AC_CHECK_PROG([LCOV], [lcov], [lcov])
+ if test -z "$LCOV"; then
+ AC_MSG_ERROR([needs lcov for code coverage])
+ fi
+
+ CPPFLAGS="$CPPFLAGS -DNDEBUG"
+ CFLAGS="$CLAGS -O0 -g -fprofile-arcs -ftest-coverage"
+ LIBS="$LIBS -lgcov"
+ fi
+])