1 dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
2 dnl That code is public domain and can be freely used or copied.
4 dnl Macro that check if coverage support is wanted and, if yes, if
7 dnl Usage: EFL_CHECK_COVERAGE(tests [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
8 dnl The parameter 'tests' is used if a dependency is needed. If set to "yes",
9 dnl the dependency is available.
10 dnl Defines EFL_COVERAGE_CFLAGS and EFL_COVERAGE_LIBS variables
11 dnl Defines the automake conditionnal EFL_ENABLE_COVERAGE
13 AC_DEFUN([EFL_CHECK_COVERAGE],
18 AC_ARG_ENABLE([coverage],
19 [AC_HELP_STRING([--enable-coverage], [enable coverage profiling instrumentation @<:@default=disabled@:>@])],
21 if test "x${enableval}" = "xyes" ; then
22 _efl_enable_coverage="yes"
24 _efl_enable_coverage="no"
27 [_efl_enable_coverage="no"])
29 AC_MSG_CHECKING([whether to use profiling instrumentation])
30 AC_MSG_RESULT([$_efl_enable_coverage])
34 if test "x$_efl_enable_coverage" = "xyes" && test ! "x$1" = "xyes" ; then
35 AC_MSG_WARN([Coverage report requested but tests not being built, disable profiling instrumentation.])
36 AC_MSG_WARN([Run configure with --enable-tests])
37 _efl_enable_coverage="no"
40 if test "x$_efl_enable_coverage" = "xyes" ; then
41 AC_CHECK_PROG(have_lcov, [lcov], [yes], [no])
42 if test "x$have_lcov" = "xyes" ; then
43 EFL_COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage"
44 EFL_COVERAGE_LIBS="-lgcov"
45 # remove any optimisation flag and force debug symbols
46 EFL_DEBUG_CFLAGS="-g -O0 -DDEBUG"
48 AC_MSG_WARN([lcov is not found, disable profiling instrumentation])
49 _efl_enable_coverage="no"
54 AC_SUBST(EFL_COVERAGE_CFLAGS)
55 AC_SUBST(EFL_COVERAGE_LIBS)
57 AM_CONDITIONAL(EFL_ENABLE_COVERAGE, test "x${_efl_enable_coverage}" = "xyes")
59 AS_IF([test "x$_efl_enable_coverage" = "xyes"], [$2], [$3])
62 dnl End of efl_coverage.m4