summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorEric Lambert <eric_lambert@xyratex.com>2014-08-08 13:29:01 -0700
committerEric Lambert <eric_lambert@xyratex.com>2014-08-08 13:29:01 -0700
commit9b92176b4e00e287c09f540f4e801941418115b3 (patch)
treeaa830d315398dc797adb97e1e7c8e6b1b68356ec /configure.ac
parentf83caee42afe6c500a4588b41e91ed8047ccb994 (diff)
downloadliberasurecode-9b92176b4e00e287c09f540f4e801941418115b3.tar.gz
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).
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac19
1 files changed, 19 insertions, 0 deletions
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)