Ticket #3774: mcedit - fix mouse active area for maximize / close buttons
[midnight-commander.git] / m4.include / mc-tests.m4
blob742ecb0d1b69a3d7305d2b06eef3a0ad6aa67248
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://libcheck.github.io/check/) @<:@auto@:>@])
15     )
17     dnl 'tests_msg' holds the human-readable message to show in configure's summary text.
19     if test x$enable_tests == xno; then
20         dnl The user explicitly specified '--disable-tests'.
21         tests_msg="no"
22     else
23         PKG_CHECK_MODULES(
24             CHECK,
25             [check >= 0.9.8],
26             [
27                 have_check=yes
28                 tests_msg="yes"
29             ],
30             [
31                 AC_MSG_WARN(['Check' testing framework not found. Check your environment])
32                 tests_msg="no ('Check' testing framework not found)"
34                 dnl The following behavior, of "exit if feature requested but not found", is just a
35                 dnl preference and can be safely removed.
36                 if test x$enable_tests == xyes; then
37                     AC_MSG_ERROR([You explicitly specified '--enable-tests', but this requirement cannot be met.])
38                 fi
39             ])
40         AC_SUBST(CHECK_CFLAGS)
41         AC_SUBST(CHECK_LIBS)
42     fi
43     AM_CONDITIONAL(HAVE_TESTS, test x"$have_check" = "xyes")
45     # on cygwin, the linker does not accept the "-z" option
46     case $host_os in
47         cygwin*)
48             TESTS_LDFLAGS="-Wl,--allow-multiple-definition"
49             ;;
50         *)
51             TESTS_LDFLAGS="-Wl,-z,muldefs"
52             ;;
53     esac
55     AC_SUBST(TESTS_LDFLAGS)