From aca6fc8c3611b5e7d4faaed61e52dedf057d7219 Mon Sep 17 00:00:00 2001 From: Jean Guyomarc'h Date: Fri, 22 Jan 2016 21:06:35 +0100 Subject: [PATCH] autotools: fix code coverage on OSX OSX uses clang as a default compiler instead of gcc. Gcov does not exist for clang, but clang has an alternative which requires additional compilier and linker flags. Signed-off-by: Cedric BAIL --- configure.ac | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 19bf4805cf..4b25b55bb4 100644 --- a/configure.ac +++ b/configure.ac @@ -327,8 +327,10 @@ EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) if test "${want_coverage}" = "yes" ; then AC_CHECK_PROG([have_lcov], [lcov], [yes], [no]) if test "x${have_lcov}" = "xyes" ; then - EFLALL_COV_CFLAGS="${EFLALL_COV_CFLAGS} -fprofile-arcs -ftest-coverage" - EFLALL_COV_LIBS="${EFLALL_COV_LIBS} -lgcov" + AC_SEARCH_LIBS([gcov], [_gcov_init]) + EFL_CHECK_COMPILER_FLAGS([EFLALL], [-fprofile-arcs -ftest-coverage]) + EFL_CHECK_COMPILER_FLAGS([EFLALL], [-fprofile-instr-generate -fcoverage-mapping]) + EFL_CHECK_LINKER_FLAGS([EFLALL], [-fprofile-instr-generate -fcoverage-mapping]) if test "x${prefer_assert}" = "xno"; then EFLALL_COV_CFLAGS="${EFLALL_COV_CFLAGS} -DNDEBUG" else