mc-check-search-type.m4 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. dnl @synopsis MC_VERSION
  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 @version 2009-06-19
  7. dnl @license GPL
  8. dnl @copyright Free Software Foundation, Inc.
  9. AC_DEFUN([MC_CHECK_SEARCH_TYPE_PCRE],[
  10. AX_PATH_LIB_PCRE
  11. if test x"${PCRE_LIBS}" = x; then
  12. AC_MSG_ERROR([Your system don't have pcre library (or pcre devel stuff)])
  13. else
  14. SEARCH_TYPE="pcre"
  15. AC_DEFINE(SEARCH_TYPE_PCRE, 1, [Define to select 'pcre' search type])
  16. fi
  17. ])
  18. AC_DEFUN([MC_CHECK_SEARCH_TYPE_GLIB],[
  19. $PKG_CONFIG --max-version 2.14 glib-2.0
  20. if test $? -eq 0; then
  21. AC_MSG_RESULT([[Selected 'glib' search engine, but you don't have glib >= 2.14. Trying to use 'pcre' engine], (WARNING)])
  22. MC_CHECK_SEARCH_TYPE_PCRE
  23. else
  24. AC_DEFINE(SEARCH_TYPE_GLIB, 1, [Define to select 'glib-regexp' search type])
  25. fi
  26. ])
  27. AC_DEFUN([MC_CHECK_SEARCH_TYPE],[
  28. AC_ARG_WITH([search-engine],
  29. AC_HELP_STRING([--with-search-engine=type],
  30. [Select low-level search engine (since glib >= 2.14). [[glib|pcre]]])
  31. )
  32. case x$with_search_engine in
  33. xglib)
  34. SEARCH_TYPE="glib-regexp"
  35. ;;
  36. xpcre)
  37. MC_CHECK_SEARCH_TYPE_PCRE
  38. ;;
  39. x)
  40. SEARCH_TYPE="glib-regexp"
  41. ;;
  42. *)
  43. AC_MSG_ERROR([Value of the search-engine is incorrect])
  44. ;;
  45. esac
  46. if test x"$SEARCH_TYPE" = x"glib-regexp"; then
  47. MC_CHECK_SEARCH_TYPE_GLIB
  48. fi
  49. ])