2012-07-01 05:01:46 -07:00
|
|
|
dnl Copyright (C) 2008-2012 Vincent Torri <vtorri at univ-evry dot fr>
|
2008-10-16 01:41:40 -07:00
|
|
|
dnl That code is public domain and can be freely used or copied.
|
|
|
|
|
|
|
|
dnl Macro that check if tests programs are wanted and if yes, if
|
|
|
|
dnl the Check library is available.
|
2012-07-01 05:01:46 -07:00
|
|
|
dnl the lcov program is available.
|
2008-10-16 01:41:40 -07:00
|
|
|
|
2012-07-01 05:01:46 -07:00
|
|
|
dnl Usage: EFL_CHECK_TESTS(EFL[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
2008-10-16 01:41:40 -07:00
|
|
|
dnl Define the automake conditionnal EFL_ENABLE_TESTS
|
|
|
|
|
|
|
|
AC_DEFUN([EFL_CHECK_TESTS],
|
|
|
|
[
|
2012-07-01 05:01:46 -07:00
|
|
|
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
2008-10-16 01:41:40 -07:00
|
|
|
|
|
|
|
dnl configure option
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([tests],
|
2009-06-26 23:42:14 -07:00
|
|
|
[AC_HELP_STRING([--enable-tests], [enable tests @<:@default=disabled@:>@])],
|
2008-10-16 01:41:40 -07:00
|
|
|
[
|
|
|
|
if test "x${enableval}" = "xyes" ; then
|
|
|
|
_efl_enable_tests="yes"
|
|
|
|
else
|
|
|
|
_efl_enable_tests="no"
|
|
|
|
fi
|
|
|
|
],
|
2009-06-26 23:42:14 -07:00
|
|
|
[_efl_enable_tests="no"])
|
|
|
|
|
2008-10-16 01:41:40 -07:00
|
|
|
AC_MSG_CHECKING([whether tests are built])
|
|
|
|
AC_MSG_RESULT([${_efl_enable_tests}])
|
|
|
|
|
2009-02-22 22:45:56 -08:00
|
|
|
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
|
|
|
|
2008-10-16 01:41:40 -07:00
|
|
|
if test "x${_efl_enable_tests}" = "xyes" ; then
|
|
|
|
PKG_CHECK_MODULES([CHECK],
|
|
|
|
[check >= 0.9.5],
|
|
|
|
[dummy="yes"],
|
2009-06-26 23:42:14 -07:00
|
|
|
[_efl_enable_tests="no"])
|
2008-10-16 01:41:40 -07:00
|
|
|
fi
|
|
|
|
|
2012-07-01 05:01:46 -07:00
|
|
|
efl_enable_coverage="no"
|
|
|
|
if test "x${_efl_enable_tests}" = "xyes" ; then
|
|
|
|
AC_CHECK_PROG(have_lcov, [lcov], [yes], [no])
|
|
|
|
if test "x$have_lcov" = "xyes" ; then
|
|
|
|
m4_defn([UPEFL])[]_CFLAGS="${m4_defn([UPEFL])[]_CFLAGS} -fprofile-arcs -ftest-coverage"
|
|
|
|
m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} -lgcov"
|
|
|
|
# remove any optimisation flag and force debug symbols
|
2012-07-01 06:34:52 -07:00
|
|
|
if test "x${prefer_assert}" = "xno"; then
|
|
|
|
m4_defn([UPEFL])[]_CFLAGS="${m4_defn([UPEFL])[]_CFLAGS} -DNDEBUG"
|
|
|
|
else
|
|
|
|
m4_defn([UPEFL])[]_CFLAGS="${m4_defn([UPEFL])[]_CFLAGS} -g -O0 -DDEBUG"
|
|
|
|
fi
|
2012-07-01 05:01:46 -07:00
|
|
|
efl_enable_coverage="yes"
|
|
|
|
else
|
|
|
|
AC_MSG_WARN([lcov is not found, disable profiling instrumentation])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2008-10-16 01:41:40 -07:00
|
|
|
AM_CONDITIONAL(EFL_ENABLE_TESTS, test "x${_efl_enable_tests}" = "xyes")
|
|
|
|
|
2012-07-01 05:01:46 -07:00
|
|
|
AS_IF([test "x$_efl_enable_tests" = "xyes"], [$2], [$3])
|
|
|
|
|
|
|
|
m4_popdef([UPEFL])
|
2008-10-16 01:41:40 -07:00
|
|
|
])
|
2009-06-26 23:42:14 -07:00
|
|
|
|
|
|
|
dnl End of efl_tests.m4
|