Merge branch '3698_etags_codejump'
[midnight-commander.git] / m4.include / mc-tests.m4
blobc991fbb1efc33465fe65ef4b706c49937c65579d
1 dnl @synopsis mc_UNIT_TESTS
2 dnl
3 dnl Check if unit tests enabled
4 dnl
5 dnl @author Slava Zanko <slavazanko@gmail.com>
6 dnl @version 2011-02-10
7 dnl @license GPL
8 dnl @copyright Free Software Foundation, Inc.
10 AC_DEFUN([mc_UNIT_TESTS],[
12     AC_ARG_ENABLE(
13         [tests],
14         AS_HELP_STRING([--enable-tests], [Enable unit tests (see http://check.sourceforge.net/)])
15     )
17     if test x$enable_tests != xno; then
18         PKG_CHECK_MODULES(
19             CHECK,
20             [check >= 0.9.8],
21             [have_check=yes],
22             [AC_MSG_WARN(['Check' utility not found. Check your environment])])
23         AC_SUBST(CHECK_CFLAGS)
24         AC_SUBST(CHECK_LIBS)
25     fi
26     AM_CONDITIONAL(HAVE_TESTS, test x"$have_check" = "xyes")
28     # on cygwin, the linker does not accept the "-z" option
29     case $host_os in
30         cygwin*)
31             TESTS_LDFLAGS="-Wl,--allow-multiple-definition"
32             ;;
33         *)
34             TESTS_LDFLAGS="-Wl,-z,muldefs"
35             ;;
36     esac
38     AC_SUBST(TESTS_LDFLAGS)