mc-check-search-type.m4 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. dnl @synopsis mc_CHECK_SEARCH_TYPE
  2. dnl
  3. dnl Check search type in mc. Currently used glib-regexp or pcre
  4. dnl
  5. dnl @author Slava Zanko <slavazanko@gmail.com>
  6. dnl @author Andrew Borodin <aborodin@vmail.ru>
  7. dnl @version 2023-03-22
  8. dnl @license GPL
  9. dnl @copyright Free Software Foundation, Inc.
  10. AC_DEFUN([mc_CHECK_SEARCH_TYPE_PCRE],[
  11. AX_PATH_LIB_PCRE
  12. if test x"${PCRE_LIBS}" = x; then
  13. AC_MSG_ERROR([$1])
  14. fi
  15. SEARCH_TYPE="pcre"
  16. ])
  17. AC_DEFUN([mc_CHECK_SEARCH_TYPE_PCRE2],[
  18. AX_CHECK_PCRE2([8], [], [:])
  19. if test $pcre2_cv_libpcre2 = yes; then
  20. SEARCH_TYPE="pcre2"
  21. else
  22. dnl pcre2 not found -- try pcre
  23. AC_MSG_WARN([Cannot find pcre2 library, trying pcre one...])
  24. mc_CHECK_SEARCH_TYPE_PCRE([$1])
  25. fi
  26. ])
  27. AC_DEFUN([mc_CHECK_SEARCH_TYPE],[
  28. AC_ARG_WITH([search-engine],
  29. AS_HELP_STRING([--with-search-engine=type],
  30. [Select low-level search engine @<:@glib|pcre|pcre2@:>@])
  31. )
  32. case x$with_search_engine in
  33. xglib)
  34. SEARCH_TYPE="glib-regexp"
  35. ;;
  36. xpcre)
  37. mc_CHECK_SEARCH_TYPE_PCRE([Cannot find pcre library])
  38. ;;
  39. xpcre2)
  40. mc_CHECK_SEARCH_TYPE_PCRE2([Neither pcre2 nor pcre library found!])
  41. ;;
  42. x)
  43. SEARCH_TYPE="glib-regexp"
  44. ;;
  45. *)
  46. AC_MSG_ERROR([Value of the search-engine is incorrect])
  47. ;;
  48. esac
  49. if test x"$SEARCH_TYPE" = x"glib-regexp"; then
  50. AC_DEFINE(SEARCH_TYPE_GLIB, 1, [Define to select 'glib-regexp' search type])
  51. else
  52. AC_DEFINE(SEARCH_TYPE_PCRE, 1, [Define to select 'pcre2' or 'pcre' search type])
  53. fi
  54. ])