Permalink
Browse files

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
  • Loading branch information...
bagder committed Jan 25, 2019
1 parent 3cbf731 commit 179311ec37ffed5b88f446f4348993a51a168abd
Showing with 46 additions and 280 deletions.
  1. +4 −6 configure.ac
  2. +1 −5 lib/Makefile.am
  3. +0 −264 m4/ax_code_coverage.m4
  4. +41 −1 m4/curl-functions.m4
  5. +0 −4 src/Makefile.am
@@ -31,7 +31,7 @@ XC_OVR_ZZ60
CURL_OVERRIDE_AUTOCONF

dnl configure script copyright
AC_COPYRIGHT([Copyright (c) 1998 - 2017 Daniel Stenberg, <daniel@haxx.se>
AC_COPYRIGHT([Copyright (c) 1998 - 2019 Daniel Stenberg, <daniel@haxx.se>
This configure script may be copied, distributed and modified under the
terms of the curl license; see COPYING for more details])

@@ -131,11 +131,8 @@ dnl figure out the libcurl version
CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h`
XC_CHECK_PROG_CC

dnl Check if gcc is being used before adding AX_CODE_COVERAGE
AS_IF([ test "$GCC" = "yes" ], [AX_CODE_COVERAGE],
# not using GCC so pass a test below - CODE_COVERAGE_ENABLED_TRUE is not zero length
CODE_COVERAGE_ENABLED_TRUE='#'
)
dnl for --enable-code-coverage
CURL_COVERAGE

XC_AUTOMAKE
AC_MSG_CHECKING([curl version])
@@ -4314,6 +4311,7 @@ AC_MSG_NOTICE([Configured to build curl/libcurl:
Built-in manual: ${curl_manual_msg}
--libcurl option: ${curl_libcurl_msg}
Verbose errors: ${curl_verbose_msg}
Code coverage: ${curl_coverage_msg}
SSPI support: ${curl_sspi_msg}
ca cert bundle: ${ca}${ca_warning}
ca cert path: ${capath}${capath_warning}
@@ -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
@@ -87,10 +87,6 @@ libcurl_la_CPPFLAGS_EXTRA =
libcurl_la_LDFLAGS_EXTRA =
libcurl_la_CFLAGS_EXTRA =

@CODE_COVERAGE_RULES@
libcurl_la_LDFLAGS_EXTRA += $(CODE_COVERAGE_LDFLAGS)
libcurl_la_CFLAGS_EXTRA += $(CODE_COVERAGE_CFLAGS)

if CURL_LT_SHLIB_USE_VERSION_INFO
libcurl_la_LDFLAGS_EXTRA += $(VERSIONINFO)
endif

This file was deleted.

Oops, something went wrong.
@@ -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
])
@@ -69,10 +69,6 @@ endif
curl_LDFLAGS = @LIBMETALINK_LDFLAGS@
curl_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMETALINK_CPPFLAGS)

@CODE_COVERAGE_RULES@
curl_LDFLAGS += $(CODE_COVERAGE_LDFLAGS)
CFLAGS += $(CODE_COVERAGE_CFLAGS)

# if unit tests are enabled, build a static library to link them with
if BUILD_UNITTESTS
noinst_LTLIBRARIES = libcurltool.la

0 comments on commit 179311e

Please sign in to comment.