mc-tests.m4 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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.
  9. AC_DEFUN([mc_UNIT_TESTS],[
  10. AC_ARG_ENABLE(
  11. [tests],
  12. AS_HELP_STRING([--enable-tests], [Enable unit tests (see http://libcheck.github.io/check/) @<:@auto@:>@])
  13. )
  14. dnl 'tests_msg' holds the human-readable message to show in configure's summary text.
  15. if test x$enable_tests == xno; then
  16. dnl The user explicitly specified '--disable-tests'.
  17. tests_msg="no"
  18. else
  19. PKG_CHECK_MODULES(
  20. CHECK,
  21. [check >= 0.9.8],
  22. [
  23. have_check=yes
  24. tests_msg="yes"
  25. ],
  26. [
  27. AC_MSG_WARN(['Check' testing framework not found. Check your environment])
  28. tests_msg="no ('Check' testing framework not found)"
  29. dnl The following behavior, of "exit if feature requested but not found", is just a
  30. dnl preference and can be safely removed.
  31. if test x$enable_tests == xyes; then
  32. AC_MSG_ERROR([You explicitly specified '--enable-tests', but this requirement cannot be met.])
  33. fi
  34. ])
  35. AC_SUBST(CHECK_CFLAGS)
  36. AC_SUBST(CHECK_LIBS)
  37. fi
  38. AM_CONDITIONAL(HAVE_TESTS, test x"$have_check" = "xyes")
  39. # on cygwin, the linker does not accept the "-z" option
  40. case $host_os in
  41. cygwin*)
  42. TESTS_LDFLAGS="-Wl,--allow-multiple-definition"
  43. ;;
  44. *)
  45. TESTS_LDFLAGS="-Wl,-z,muldefs"
  46. ;;
  47. esac
  48. AC_SUBST(TESTS_LDFLAGS)
  49. ])