From dfae0f380211766a4238caf445bab6ad48744b0a Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 13 Jan 2017 20:47:35 +0300 Subject: [PATCH] Add configure --enable-gcov option (enable code coverage analysis) (Cherry-pick commits 0d0a16d, 45896dc from 'master' branch.) * configure.ac (gcov): New --enable-* option. * configure.ac [enable_gcov] (CFLAGS): Add "--coverage" option; filter out "-O" options. --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index b38a65a..6075689 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,14 @@ if test "$enable_assertions" != yes; then AC_DEFINE([NDEBUG], 1, [Define to disable assertion checking.]) fi +AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov], + [Turn on code coverage analysis])) +if test "$enable_gcov" = "yes"; then + CFLAGS="$CFLAGS --coverage" + # Turn off code optimization to get accurate line numbers. + CFLAGS=`echo "$CFLAGS" | sed -e 's/-O\(1\|2\|3\|4\|s\|fast\)\?//g'` +fi + AC_SUBST(PICFLAG) AC_SUBST(DEFS) -- 2.40.0