From 9b92176b4e00e287c09f540f4e801941418115b3 Mon Sep 17 00:00:00 2001 From: Eric Lambert Date: Fri, 8 Aug 2014 13:29:01 -0700 Subject: Added ability to generate coverage data with configure --enable-gcov. Currently only works on Linux (build/tests will run on OS X but coverage data is not generated). --- configure.ac | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 3f20373..3155567 100644 --- a/configure.ac +++ b/configure.ac @@ -49,6 +49,25 @@ else CFLAGS="-O2 -g -Werror -D_GNU_SOURCE=1" fi +AC_ARG_ENABLE([gcov], +[ --enable-gcov Turn on code coverage], +[case "${enableval}" in + yes) gcov=true ;; + no) gcov=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-gcov]) ;; +esac],[gcov=false]) +if test x$gcov = xtrue ; then + AC_CHECK_LIB(gcov, main, + [ + GCOV_FLAGS="-fprofile-arcs -ftest-coverage" + GCOV_LDFLAGS="-lgcov" + ], [ + AC_MSG_ERROR([failed to locate gcov library]) + ]) +fi +AC_SUBST(GCOV_FLAGS) +AC_SUBST(GCOV_LDFLAGS) + dnl Expand the sources and objects needed to build the library AC_SUBST(ac_aux_dir) AC_SUBST(OBJECTS) -- cgit v1.2.1