(mc_search_regex__get_max_num_of_replace_tokens): refactor loop.
[midnight-commander.git] / m4.include / mc-tests.m4
blobaa553ff9a2bc978e7cdc4ca4c4bb229e7d2320c9
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.10],
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     dnl sighandler_t is GNU extension
46     dnl AC_USE_SYSTEM_EXTENSIONS is required
47     AC_CHECK_TYPES([sighandler_t], [], [], [
48         #include <signal.h>
49     ])
51     # on cygwin, the linker does not accept the "-z" option
52     case $host_os in
53         cygwin*)
54             TESTS_LDFLAGS="-Wl,--allow-multiple-definition"
55             ;;
56         *)
57             TESTS_LDFLAGS="-Wl,-z,muldefs"
58             ;;
59     esac
61     AC_SUBST(TESTS_LDFLAGS)