(tree_move): fix coding style.
[midnight-commander.git] / m4.include / mc-check-search-type.m4
blob21d4cb4039c48f0ecb54797c3fb49d4491d97155
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.
11 AC_DEFUN([mc_CHECK_SEARCH_TYPE_PCRE],[
12     AX_PATH_LIB_PCRE
14     if test x"${PCRE_LIBS}" = x; then
15         AC_MSG_ERROR([$1])
16     fi
18     SEARCH_TYPE="pcre"
21 AC_DEFUN([mc_CHECK_SEARCH_TYPE_PCRE2],[
22     AX_CHECK_PCRE2([8], [], [:])
24     if test $pcre2_cv_libpcre2 = yes; then
25         SEARCH_TYPE="pcre2"
26     else
27         dnl pcre2 not found -- try pcre
28         AC_MSG_WARN([Cannot find pcre2 library, trying pcre one...])
29         mc_CHECK_SEARCH_TYPE_PCRE([$1])
30     fi
34 AC_DEFUN([mc_CHECK_SEARCH_TYPE],[
36     AC_ARG_WITH([search-engine],
37         AS_HELP_STRING([--with-search-engine=type],
38         [Select low-level search engine @<:@glib|pcre|pcre2@:>@])
39       )
41     case x$with_search_engine in
42     xglib)
43         SEARCH_TYPE="glib-regexp"
44         ;;
45     xpcre)
46         mc_CHECK_SEARCH_TYPE_PCRE([Cannot find pcre library])
47         ;;
48     xpcre2)
49         mc_CHECK_SEARCH_TYPE_PCRE2([Neither pcre2 nor pcre library found!])
50         ;;
51     x)
52         SEARCH_TYPE="glib-regexp"
53         ;;
54     *)
55         AC_MSG_ERROR([Value of the search-engine is incorrect])
56         ;;
57     esac
59     if test x"$SEARCH_TYPE" = x"glib-regexp"; then
60         AC_DEFINE(SEARCH_TYPE_GLIB, 1, [Define to select 'glib-regexp' search type])
61     else
62         AC_DEFINE(SEARCH_TYPE_PCRE, 1, [Define to select 'pcre2' or 'pcre' search type])
63     fi