(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.
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)