diff --git a/AUTHORS b/AUTHORS index 625a45dd4..b64143aac 100644 --- a/AUTHORS +++ b/AUTHORS @@ -66,6 +66,9 @@ Anton Chumak Antonio Palama, DOS port DOS port. +broly + Support of PCRE2 + Dmitry Koterov s3 extfs bugfixes and improvements diff --git a/acinclude.m4 b/acinclude.m4 index 0422d7ff1..e14327809 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -6,6 +6,7 @@ m4_include([m4.include/gnulib/mountlist.m4]) m4_include([m4.include/gnulib/windows-stat-inodes.m4]) m4_include([m4.include/gnulib/sys_types_h.m4]) m4_include([m4.include/ax_path_lib_pcre.m4]) +m4_include([m4.include/ax_check_pcre2.m4]) m4_include([m4.include/dx_doxygen.m4]) m4_include([m4.include/ax_require_defined.m4]) m4_include([m4.include/ax_check_compile_flag.m4]) diff --git a/doc/INSTALL b/doc/INSTALL index 749c41652..3881c523b 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -375,8 +375,7 @@ Newer versions may work, but haven't been tested. PCRE ---- -If the version of glib you have installed is older than 2.14.x, then you -also need to install PCRE library. +Both PCRE and PCRE2 libraries are supported. You can get PCRE from diff --git a/lib/Makefile.am b/lib/Makefile.am index 00f489a9d..a466599c9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -73,5 +73,3 @@ if HAVE_GMODULE else libmc_la_LIBADD += $(GLIB_LIBS) endif - -libmc_la_LIBADD += $(PCRE_LIBS) diff --git a/lib/filehighlight/Makefile.am b/lib/filehighlight/Makefile.am index 57a8d949f..dee24e29f 100644 --- a/lib/filehighlight/Makefile.am +++ b/lib/filehighlight/Makefile.am @@ -6,4 +6,4 @@ libmcfilehighlight_la_SOURCES = \ ini-file-read.c \ internal.h -AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS) +AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) diff --git a/lib/search.h b/lib/search.h index 3432a5596..321a19237 100644 --- a/lib/search.h +++ b/lib/search.h @@ -8,9 +8,13 @@ #include #ifdef SEARCH_TYPE_PCRE +#ifdef HAVE_PCRE2 +#define PCRE2_CODE_UNIT_WIDTH 8 +#include +#else #include #endif - +#endif /* SEARCH_TYPE_PCRE */ /*** typedefs(not structures) and defined constants **********************************************/ typedef enum mc_search_cbret_t mc_search_cbret_t; @@ -24,8 +28,15 @@ typedef mc_search_cbret_t (*mc_update_fn) (const void *user_data, gsize char_off #ifdef SEARCH_TYPE_GLIB #define mc_search_matchinfo_t GMatchInfo #else +#ifdef HAVE_PCRE2 +/* no pcre_extra in PCRE2. pcre2_jit_compile (equivalent of pcre_study) handles + * all of this internally. but we can use this to hold the pcre2_matches data + * until the search is complete */ +#define mc_search_matchinfo_t pcre2_match_data +#else #define mc_search_matchinfo_t pcre_extra #endif +#endif /*** enums ***************************************************************************************/ @@ -102,7 +113,12 @@ typedef struct mc_search_struct mc_search_matchinfo_t *regex_match_info; GString *regex_buffer; #ifdef SEARCH_TYPE_PCRE +#ifdef HAVE_PCRE2 + /* pcre2 will provide a pointer to a match_data structure that can be manipulated like an iovector*/ + size_t *iovector; +#else int iovector[MC_SEARCH__NUM_REPLACE_ARGS * 2]; +#endif #endif /* SEARCH_TYPE_PCRE */ /* private data */ diff --git a/lib/search/Makefile.am b/lib/search/Makefile.am index ed9d3aadb..48774a5ae 100644 --- a/lib/search/Makefile.am +++ b/lib/search/Makefile.am @@ -9,4 +9,4 @@ libsearch_la_SOURCES = \ glob.c \ hex.c -AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS) +AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) diff --git a/lib/search/internal.h b/lib/search/internal.h index d7b015ce3..08cb019d5 100644 --- a/lib/search/internal.h +++ b/lib/search/internal.h @@ -6,8 +6,12 @@ #ifdef SEARCH_TYPE_GLIB #define mc_search_regex_t GRegex #else +#ifdef HAVE_PCRE2 +#define mc_search_regex_t pcre2_code +#else #define mc_search_regex_t pcre #endif +#endif /*** enums ***************************************************************************************/ diff --git a/lib/search/regex.c b/lib/search/regex.c index 035f19b75..d24cf483d 100644 --- a/lib/search/regex.c +++ b/lib/search/regex.c @@ -345,9 +345,15 @@ mc_search__regex_found_cond_one (mc_search_t * lc_mc_search, mc_search_regex_t * } lc_mc_search->num_results = g_match_info_get_match_count (lc_mc_search->regex_match_info); #else /* SEARCH_TYPE_GLIB */ - lc_mc_search->num_results = pcre_exec (regex, lc_mc_search->regex_match_info, - search_str->str, search_str->len, 0, 0, - lc_mc_search->iovector, MC_SEARCH__NUM_REPLACE_ARGS); + + lc_mc_search->num_results = +#ifdef HAVE_PCRE2 + pcre2_match (regex, (unsigned char *) search_str->str, search_str->len, 0, 0, + lc_mc_search->regex_match_info, NULL); +#else + pcre_exec (regex, lc_mc_search->regex_match_info, search_str->str, search_str->len, 0, 0, + lc_mc_search->iovector, MC_SEARCH__NUM_REPLACE_ARGS); +#endif if (lc_mc_search->num_results < 0) { return COND__NOT_FOUND; @@ -835,15 +841,29 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_ return; } #else /* SEARCH_TYPE_GLIB */ + +#ifdef HAVE_PCRE2 + int errcode; + char error[BUF_SMALL]; + size_t erroffset; + int pcre_options = PCRE2_MULTILINE; +#else const char *error; int erroffset; int pcre_options = PCRE_EXTRA | PCRE_MULTILINE; +#endif if (str_isutf8 (charset) && mc_global.utf8_display) { +#ifdef HAVE_PCRE2 + pcre_options |= PCRE2_UTF; + if (!lc_mc_search->is_case_sensitive) + pcre_options |= PCRE2_CASELESS; +#else pcre_options |= PCRE_UTF8; if (!lc_mc_search->is_case_sensitive) pcre_options |= PCRE_CASELESS; +#endif } else if (!lc_mc_search->is_case_sensitive) { @@ -855,14 +875,26 @@ mc_search__cond_struct_new_init_regex (const char *charset, mc_search_t * lc_mc_ } mc_search_cond->regex_handle = +#ifdef HAVE_PCRE2 + pcre2_compile ((unsigned char *) mc_search_cond->str->str, PCRE2_ZERO_TERMINATED, + pcre_options, &errcode, &erroffset, NULL); +#else pcre_compile (mc_search_cond->str->str, pcre_options, &error, &erroffset, NULL); +#endif if (mc_search_cond->regex_handle == NULL) { +#ifdef HAVE_PCRE2 + pcre2_get_error_message (errcode, (unsigned char *) error, sizeof (error)); +#endif mc_search_set_error (lc_mc_search, MC_SEARCH_E_REGEX_COMPILE, "%s", error); return; } +#ifdef HAVE_PCRE2 + if (pcre2_jit_compile (mc_search_cond->regex_handle, PCRE2_JIT_COMPLETE) && *error != '\0') +#else lc_mc_search->regex_match_info = pcre_study (mc_search_cond->regex_handle, 0, &error); if (lc_mc_search->regex_match_info == NULL && error != NULL) +#endif { mc_search_set_error (lc_mc_search, MC_SEARCH_E_REGEX_COMPILE, "%s", error); MC_PTR_FREE (mc_search_cond->regex_handle); diff --git a/lib/search/search.c b/lib/search/search.c index 1393038c9..8ccb65fb9 100644 --- a/lib/search/search.c +++ b/lib/search/search.c @@ -71,7 +71,10 @@ mc_search__cond_struct_new (mc_search_t * lc_mc_search, const GString * str, con mc_search_cond = g_malloc0 (sizeof (mc_search_cond_t)); mc_search_cond->str = mc_g_string_dup (str); mc_search_cond->charset = g_strdup (charset); - +#ifdef HAVE_PCRE2 + lc_mc_search->regex_match_info = pcre2_match_data_create (MC_SEARCH__NUM_REPLACE_ARGS, NULL); + lc_mc_search->iovector = pcre2_get_ovector_pointer (lc_mc_search->regex_match_info); +#endif switch (lc_mc_search->search_type) { case MC_SEARCH_T_GLOB: diff --git a/m4.include/ax_check_pcre2.m4 b/m4.include/ax_check_pcre2.m4 new file mode 100644 index 000000000..9ae01addf --- /dev/null +++ b/m4.include/ax_check_pcre2.m4 @@ -0,0 +1,163 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_pcre2.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_PCRE2([bits], [action-if-found], [action-if-not-found]) +# +# DESCRIPTION +# +# Search for an installed libpcre2-8 library. If nothing was specified +# when calling configure, it searches first in /usr/local and then in +# /usr, /opt/local and /sw. If the --with-pcre2=DIR is specified, it will +# try to find it in DIR/include/pcre2.h and DIR/lib/libpcre2-8. If +# --without-pcre2 is specified, the library is not searched at all. +# +# If 'bits' is empty or '8', PCRE2 8-bit character support is checked +# only. If 'bits' contains '16', PCRE2 8-bit and 16-bit character support +# are checked. If 'bits' contains '32', PCRE2 8-bit and 32-bit character +# support are checked. When 'bits' contains both '16' and '32', PCRE2 +# 8-bit, 16-bit, and 32-bit character support is checked. +# +# If either the header file (pcre2.h), or the library (libpcre2-8) is not +# found, or the specified PCRE2 character bit width is not supported, +# shell commands 'action-if-not-found' is run. If 'action-if-not-found' is +# not specified, the configuration exits on error, asking for a valid +# PCRE2 installation directory or --without-pcre2. +# +# If both header file and library are found, and the specified PCRE2 bit +# widths are supported, shell commands 'action-if-found' is run. If +# 'action-if-found' is not specified, the default action appends +# '-I${PCRE2_HOME}/include' to CPFLAGS, appends '-L$PCRE2_HOME}/lib' to +# LDFLAGS, prepends '-lpcre2-8' to LIBS, and calls AC_DEFINE(HAVE_PCRE2). +# You should use autoheader to include a definition for this symbol in a +# config.h file. Sample usage in a C/C++ source is as follows: +# +# #ifdef HAVE_PCRE2 +# #define PCRE2_CODE_UNIT_WIDTH 8 +# #include +# #endif /* HAVE_PCRE2 */ +# +# LICENSE +# +# Copyright (c) 2020 Robert van Engelen +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_PCRE2], +# +# Handle user hints +# +[AC_MSG_CHECKING(if PCRE2 is wanted) +pcre2_places="/usr/local /usr /opt/local /sw" +AC_ARG_WITH([pcre2], +[ --with-pcre2=DIR root directory path of PCRE2 installation @<:@defaults to + /usr/local or /usr if not found in /usr/local@:>@ + --without-pcre2 to disable PCRE2 usage completely], +[if test "$withval" != "no" ; then + AC_MSG_RESULT(yes) + if test -d "$withval" + then + pcre2_places="$withval $pcre2_places" + else + AC_MSG_WARN([Sorry, $withval does not exist, checking usual places]) + fi +else + pcre2_places="" + AC_MSG_RESULT(no) +fi], +[AC_MSG_RESULT(yes)]) +# +# Locate PCRE2, if wanted +# +if test -n "${pcre2_places}" +then + # check the user supplied or any other more or less 'standard' place: + # Most UNIX systems : /usr/local and /usr + # MacPorts / Fink on OSX : /opt/local respectively /sw + for PCRE2_HOME in ${pcre2_places} ; do + if test -f "${PCRE2_HOME}/include/pcre2.h"; then break; fi + PCRE2_HOME="" + done + + PCRE2_OLD_LDFLAGS=$LDFLAGS + PCRE2_OLD_CPPFLAGS=$CPPFLAGS + if test -n "${PCRE2_HOME}"; then + LDFLAGS="$LDFLAGS -L${PCRE2_HOME}/lib" + CPPFLAGS="$CPPFLAGS -I${PCRE2_HOME}/include" + fi + AC_LANG_PUSH([C]) + AC_CHECK_LIB([pcre2-8], [pcre2_compile_8], [pcre2_cv_libpcre2=yes], [pcre2_cv_libpcre2=no]) + AC_CHECK_HEADER([pcre2.h], [pcre2_cv_pcre2_h=yes], [pcre2_cv_pcre2_h=no], [#define PCRE2_CODE_UNIT_WIDTH 8]) + case "$1" in + *16*) + AC_CHECK_LIB([pcre2-16], [pcre2_compile_16], [pcre2_cv_libpcre2_16=yes], [pcre2_cv_libpcre2_16=no]) + AC_CHECK_HEADER([pcre2.h], [pcre2_cv_pcre2_16_h=yes], [pcre2_cv_pcre2_16_h=no], [#define PCRE2_CODE_UNIT_WIDTH 16]) + if test "$pcre2_cv_libpcre2_16" = "no" || test "$pcre2_cv_pcre2_16_h" = "no"; then + pcre2_cv_libpcre2=no + fi + ;; + esac + case "$1" in + *32*) + AC_CHECK_LIB([pcre2-32], [pcre2_compile_32], [pcre2_cv_libpcre2_32=yes], [pcre2_cv_libpcre2_32=no]) + AC_CHECK_HEADER([pcre2.h], [pcre2_cv_pcre2_32_h=yes], [pcre2_cv_pcre2_32_h=no], [#define PCRE2_CODE_UNIT_WIDTH 32]) + if test "$pcre2_cv_libpcre2_32" = "no" || test "$pcre2_cv_pcre2_32_h" = "no"; then + pcre2_cv_libpcre2=no + fi + esac + AC_LANG_POP([C]) + if test "$pcre2_cv_libpcre2" = "yes" && test "$pcre2_cv_pcre2_h" = "yes" + then + # + # If both library and header were found, action-if-found + # + m4_ifblank([$2],[ + CPPFLAGS="$CPPFLAGS -I${PCRE2_HOME}/include" + LDFLAGS="$LDFLAGS -L${PCRE2_HOME}/lib" + LIBS="-lpcre2-8 $LIBS" + AC_DEFINE([HAVE_PCRE2], [1], + [Define to 1 if you have `PCRE2' library (-lpcre2-$1)]) + ],[ + # Restore variables + LDFLAGS="$PCRE2_OLD_LDFLAGS" + CPPFLAGS="$PCRE2_OLD_CPPFLAGS" + $2 + ]) + else + # + # If either header or library was not found, action-if-not-found + # + m4_default([$3],[ + AC_MSG_ERROR([either specify a valid PCRE2 installation with --with-pcre2=DIR or disable PCRE2 usage with --without-pcre2]) + ]) + fi +fi +]) diff --git a/m4.include/ax_path_lib_pcre.m4 b/m4.include/ax_path_lib_pcre.m4 index 37dea1372..5355dd700 100644 --- a/m4.include/ax_path_lib_pcre.m4 +++ b/m4.include/ax_path_lib_pcre.m4 @@ -1,51 +1,59 @@ -dnl @synopsis AX_PATH_LIB_PCRE [(A/NA)] -dnl -dnl check for pcre lib and set PCRE_LIBS and PCRE_CPPFLAGS accordingly. -dnl -dnl also provide --with-pcre option that may point to the $prefix of -dnl the pcre installation - the macro will check $pcre/include and -dnl $pcre/lib to contain the necessary files. -dnl -dnl the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported -dnl and they can take advantage of the LIBS/CFLAGS additions. -dnl -dnl @author Guido U. Draheim -dnl @author Slava Zanko -dnl @version 2009-07-06 -dnl @license GPLWithACException +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_path_lib_pcre.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PATH_LIB_PCRE [(A/NA)] +# +# DESCRIPTION +# +# check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly. +# +# also provide --with-pcre option that may point to the $prefix of the +# pcre installation - the macro will check $pcre/include and $pcre/lib to +# contain the necessary files. +# +# the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported and +# they can take advantage of the LIBS/CFLAGS additions. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 9 AC_DEFUN([AX_PATH_LIB_PCRE],[dnl AC_MSG_CHECKING([lib pcre]) -AC_ARG_WITH([pcre], - AS_HELP_STRING([--with-pcre@<:@=prefix@:>@], [Compile pcre part (via libpcre check)]), - , - [with_pcre="yes"] -) -if test x"$with_pcre" = "xno" ; then +AC_ARG_WITH(pcre, +[ --with-pcre[[=prefix]] compile xmlpcre part (via libpcre check)],, + with_pcre="yes") +if test ".$with_pcre" = ".no" ; then AC_MSG_RESULT([disabled]) m4_ifval($2,$2) else - AC_MSG_RESULT([(testing)]) - - if test "x$with_pcre" = "xyes" ; then - PCRE_CPPFLAGS="`pcre-config --cflags`" - PCRE_LIBS="`pcre-config --libs`" + AC_CHECK_LIB(pcre, pcre_study) + if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then + PCRE_LIBS="-lpcre" + AC_MSG_CHECKING([lib pcre]) + AC_MSG_RESULT([$PCRE_LIBS]) + m4_ifval($1,$1) else - test_PCRE_LIBS="-L$with_pcre/lib" - test_PCRE_CPPFLAGS="-I$with_pcre/include" - - OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS $test_PCRE_LIBS" - OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS $test_PCRE_CPPFLAGS" - + OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib" + OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include" AC_CHECK_LIB(pcre, pcre_compile) - - if test x"$ac_cv_lib_pcre_pcre_compile" = x"yes" ; then - AC_MSG_RESULT(setting PCRE_LIBS -L$with_pcre/lib -lpcre) - - PCRE_LIBS=$test_PCRE_LIBS - PCRE_CPPFLAGS=$test_PCRE_CPPFLAGS - + CPPFLAGS="$OLDCPPFLAGS" + LDFLAGS="$OLDLDFLAGS" + if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then + AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre) + PCRE_LIBS="-L$with_pcre/lib -lpcre" + test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include" AC_MSG_CHECKING([lib pcre]) AC_MSG_RESULT([$PCRE_LIBS]) m4_ifval($1,$1) @@ -54,14 +62,8 @@ else AC_MSG_RESULT([no, (WARNING)]) m4_ifval($2,$2) fi - - CPPFLAGS="$OLDCFPPLAGS" - LDFLAGS="$OLDLDFLAGS" - fi fi - AC_SUBST([PCRE_LIBS]) -AC_SUBST([PCRE_CPPFLAGS]) - +AC_SUBST([PCRE_CFLAGS]) ]) diff --git a/m4.include/mc-check-search-type.m4 b/m4.include/mc-check-search-type.m4 index b96c59af1..21d4cb403 100644 --- a/m4.include/mc-check-search-type.m4 +++ b/m4.include/mc-check-search-type.m4 @@ -3,28 +3,30 @@ dnl dnl Check search type in mc. Currently used glib-regexp or pcre dnl dnl @author Slava Zanko -dnl @version 2009-06-19 +dnl @author Andrew Borodin +dnl @version 2023-03-22 dnl @license GPL dnl @copyright Free Software Foundation, Inc. AC_DEFUN([mc_CHECK_SEARCH_TYPE_PCRE],[ AX_PATH_LIB_PCRE + if test x"${PCRE_LIBS}" = x; then - AC_MSG_ERROR([Your system don't have pcre library (or pcre devel stuff)]) - else - SEARCH_TYPE="pcre" - AC_DEFINE(SEARCH_TYPE_PCRE, 1, [Define to select 'pcre' search type]) + AC_MSG_ERROR([$1]) fi + + SEARCH_TYPE="pcre" ]) +AC_DEFUN([mc_CHECK_SEARCH_TYPE_PCRE2],[ + AX_CHECK_PCRE2([8], [], [:]) -AC_DEFUN([mc_CHECK_SEARCH_TYPE_GLIB],[ - $PKG_CONFIG --max-version 2.14 glib-2.0 - if test $? -eq 0; then - AC_MSG_RESULT([[Selected 'glib' search engine, but you don't have glib >= 2.14. Trying to use 'pcre' engine], (WARNING)]) - mc_CHECK_SEARCH_TYPE_PCRE + if test $pcre2_cv_libpcre2 = yes; then + SEARCH_TYPE="pcre2" else - AC_DEFINE(SEARCH_TYPE_GLIB, 1, [Define to select 'glib-regexp' search type]) + dnl pcre2 not found -- try pcre + AC_MSG_WARN([Cannot find pcre2 library, trying pcre one...]) + mc_CHECK_SEARCH_TYPE_PCRE([$1]) fi ]) @@ -33,14 +35,18 @@ AC_DEFUN([mc_CHECK_SEARCH_TYPE],[ AC_ARG_WITH([search-engine], AS_HELP_STRING([--with-search-engine=type], - [Select low-level search engine (since glib >= 2.14) @<:@glib|pcre@:>@]) + [Select low-level search engine @<:@glib|pcre|pcre2@:>@]) ) + case x$with_search_engine in xglib) SEARCH_TYPE="glib-regexp" ;; xpcre) - mc_CHECK_SEARCH_TYPE_PCRE + mc_CHECK_SEARCH_TYPE_PCRE([Cannot find pcre library]) + ;; + xpcre2) + mc_CHECK_SEARCH_TYPE_PCRE2([Neither pcre2 nor pcre library found!]) ;; x) SEARCH_TYPE="glib-regexp" @@ -51,6 +57,8 @@ AC_DEFUN([mc_CHECK_SEARCH_TYPE],[ esac if test x"$SEARCH_TYPE" = x"glib-regexp"; then - mc_CHECK_SEARCH_TYPE_GLIB + AC_DEFINE(SEARCH_TYPE_GLIB, 1, [Define to select 'glib-regexp' search type]) + else + AC_DEFINE(SEARCH_TYPE_PCRE, 1, [Define to select 'pcre2' or 'pcre' search type]) fi ]) diff --git a/src/diffviewer/Makefile.am b/src/diffviewer/Makefile.am index 88c0cea5e..7986645b7 100644 --- a/src/diffviewer/Makefile.am +++ b/src/diffviewer/Makefile.am @@ -5,4 +5,4 @@ libdiffviewer_la_SOURCES = \ search.c \ ydiff.c ydiff.h -AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS) +AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) diff --git a/src/editor/Makefile.am b/src/editor/Makefile.am index 574195928..304cb35be 100644 --- a/src/editor/Makefile.am +++ b/src/editor/Makefile.am @@ -30,4 +30,4 @@ libedit_la_SOURCES += \ endif endif -AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CPPFLAGS) +AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) diff --git a/src/filemanager/Makefile.am b/src/filemanager/Makefile.am index bf0c18319..534d8dcf3 100644 --- a/src/filemanager/Makefile.am +++ b/src/filemanager/Makefile.am @@ -30,7 +30,7 @@ libmcfilemanager_la_SOURCES = \ # Unmaintained, unsupported, etc # listmode.c listmode.h -AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS) +AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) if ENABLE_EXT2FS_ATTR libmcfilemanager_la_SOURCES += \ diff --git a/src/vfs/sftpfs/Makefile.am b/src/vfs/sftpfs/Makefile.am index 35e25c6cf..12905d11f 100644 --- a/src/vfs/sftpfs/Makefile.am +++ b/src/vfs/sftpfs/Makefile.am @@ -1,5 +1,5 @@ -AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(LIBSSH_CFLAGS) $(PCRE_CPPFLAGS) +AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(LIBSSH_CFLAGS) noinst_LTLIBRARIES = libvfs-sftpfs.la diff --git a/src/viewer/Makefile.am b/src/viewer/Makefile.am index 5bce992d6..9bf164840 100644 --- a/src/viewer/Makefile.am +++ b/src/viewer/Makefile.am @@ -18,4 +18,4 @@ libmcviewer_la_SOURCES = \ nroff.c \ search.c -AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(PCRE_CPPFLAGS) +AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) diff --git a/tests/lib/search/Makefile.am b/tests/lib/search/Makefile.am index d01c0dc94..c3296abcd 100644 --- a/tests/lib/search/Makefile.am +++ b/tests/lib/search/Makefile.am @@ -4,11 +4,10 @@ AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/lib/search \ - @CHECK_CFLAGS@ \ - @PCRE_CPPFLAGS@ + @CHECK_CFLAGS@ LIBS = @CHECK_LIBS@ \ - $(top_builddir)/lib/libmc.la @PCRE_LIBS@ + $(top_builddir)/lib/libmc.la if ENABLE_MCLIB LIBS += $(GLIB_LIBS) diff --git a/tests/src/editor/Makefile.am b/tests/src/editor/Makefile.am index 6ef612df5..cf89d3331 100644 --- a/tests/src/editor/Makefile.am +++ b/tests/src/editor/Makefile.am @@ -4,15 +4,13 @@ AM_CPPFLAGS = \ -DTEST_SHARE_DIR=\"$(abs_srcdir)\" \ $(GLIB_CFLAGS) \ -I$(top_srcdir) \ - @CHECK_CFLAGS@ \ - @PCRE_CPPFLAGS@ + @CHECK_CFLAGS@ AM_LDFLAGS = @TESTS_LDFLAGS@ LIBS = @CHECK_LIBS@ \ $(top_builddir)/src/libinternal.la \ - $(top_builddir)/lib/libmc.la \ - @PCRE_LIBS@ + $(top_builddir)/lib/libmc.la if ENABLE_MCLIB LIBS += $(GLIB_LIBS) diff --git a/tests/src/filemanager/Makefile.am b/tests/src/filemanager/Makefile.am index 267036bd8..9c980f39a 100644 --- a/tests/src/filemanager/Makefile.am +++ b/tests/src/filemanager/Makefile.am @@ -5,15 +5,13 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/lib/vfs \ -DTEST_SHARE_DIR=\"$(abs_srcdir)\" \ - @CHECK_CFLAGS@ \ - @PCRE_CPPFLAGS@ + @CHECK_CFLAGS@ AM_LDFLAGS = @TESTS_LDFLAGS@ LIBS = @CHECK_LIBS@ \ $(top_builddir)/src/libinternal.la \ - $(top_builddir)/lib/libmc.la \ - @PCRE_LIBS@ + $(top_builddir)/lib/libmc.la if ENABLE_MCLIB LIBS += $(GLIB_LIBS)