mc-tests.m4 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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.10],
  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. AS_IF([test x"$have_check" = "xyes"], [AC_DEFINE([HAVE_TESTS], [1], [Build with unit tests.])])
  40. dnl sighandler_t is GNU extension
  41. dnl AC_USE_SYSTEM_EXTENSIONS is required
  42. AC_CHECK_TYPES([sighandler_t], [], [], [
  43. #include <signal.h>
  44. ])
  45. ])