Unverified Commit 179311ec authored by Daniel Stenberg's avatar Daniel Stenberg
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
parent 3cbf731d
Loading
Loading
Loading
Loading
+4 −6
Changes for configure.ac: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -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}
+1 −5
Changes for lib/Makefile.am: 1 added line, 5 removed lines.
Original line number Diff line number Diff line
@@ -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
−264

File deleted.

+41 −1
Changes for m4/curl-functions.m4: 41 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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
])
−4
Changes for src/Makefile.am: 0 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -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