From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: PATCH: migrate pcre module to pcre2
Date: Mon, 19 Jun 2023 17:20:29 +0900 [thread overview]
Message-ID: <321D363A-50E5-4BF1-81F3-7F71EC34069A@kba.biglobe.ne.jp> (raw)
In-Reply-To: <40C90E7D-9435-4803-8185-C92E2C637003@kba.biglobe.ne.jp>
> 2023/06/13 16:35, I wrote
>
> Or is it better to set enable_pcre=no in configure.ac
> if pcre2-config is not available?
I think this is better. Availability of pcre2-config
need not be checked in two places.
Moreover, currently, pcre2-config is called at configure.ac:956
even if it doesn't exist.
PCRECONF is renamed PCRE_CONFIG. User can override PCRE_CONFIG as
./configure --enable-pcre PCRE_CONFIG=/path/to/pcre2-conf
if pcre2-config is not in PATH.
oldcflags is removed because it is not used anywhere.
diff --git a/Src/Modules/pcre.mdd b/Src/Modules/pcre.mdd
index 6eb3c691b..3e1579117 100644
--- a/Src/Modules/pcre.mdd
+++ b/Src/Modules/pcre.mdd
@@ -1,5 +1,5 @@
name=zsh/pcre
-link=`if test x$enable_pcre = xyes && (pcre-config --version >/dev/null 2>/dev/null); then echo dynamic; else echo no; fi`
+link=`if test x$enable_pcre = xyes; then echo dynamic; else echo no; fi`
load=no
autofeatures="b:pcre_compile b:pcre_study b:pcre_match"
diff --git a/configure.ac b/configure.ac
index ba76f9a60..c5263035e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -440,6 +440,17 @@ dnl Do you want to look for pcre support?
AC_ARG_ENABLE(pcre,
AS_HELP_STRING([--enable-pcre],[enable the search for the pcre2 library (may create run-time library dependencies)]))
+AC_ARG_VAR(PCRE_CONFIG, [pathname of pcre2-config if it is not in PATH])
+if test "x$enable_pcre" = xyes; then
+ AC_CHECK_PROG([PCRE_CONFIG], pcre2-config, pcre2-config)
+ if test "x$PCRE_CONFIG" = x; then
+ enable_pcre=no
+ AC_MSG_WARN([pcre2-config not found: pcre module is disabled.])
+ AC_MSG_NOTICE(
+ [Set PCRE_CONFIG to pathname of pcre2-config if it is not in PATH.])
+ fi
+fi
+
dnl Do you want to look for capability support?
AC_ARG_ENABLE(cap,
AS_HELP_STRING([--enable-cap],[enable the search for POSIX capabilities (may require additional headers to be added by hand)]))
@@ -655,15 +666,12 @@ AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_SYS_WAIT
-oldcflags="$CFLAGS"
-if test x$enable_pcre = xyes; then
-AC_CHECK_PROG([PCRECONF], pcre2-config, pcre2-config)
dnl pcre2-config --cflags may produce a -I output which needs to go into
dnl CPPFLAGS else configure's preprocessor tests don't pick it up,
dnl producing a warning.
-if test "x$ac_cv_prog_PCRECONF" = xpcre2-config; then
- CPPFLAGS="$CPPFLAGS `pcre2-config --cflags`"
-fi
+if test "x$enable_pcre" = xyes; then
+ CPPFLAGS="`$PCRE_CONFIG --cflags` $CPPFLAGS"
+ AC_CHECK_HEADERS([pcre2.h],,,[#define PCRE2_CODE_UNIT_WIDTH 8])
fi
AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
@@ -675,7 +683,6 @@ AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
netinet/in_systm.h langinfo.h wchar.h stddef.h \
sys/stropts.h iconv.h ncurses.h ncursesw/ncurses.h \
ncurses/ncurses.h)
-AC_CHECK_HEADERS([pcre2.h],,,[#define PCRE2_CODE_UNIT_WIDTH 8])
if test x$dynamic = xyes; then
AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_HEADERS(dl.h)
@@ -952,10 +959,6 @@ if test "x$ac_found_iconv" = "xyes"; then
[Define as const if the declaration of iconv() needs const.])
fi
-if test x$enable_pcre = xyes; then
- LIBS="`$ac_cv_prog_PCRECONF --libs8` $LIBS"
-fi
-
dnl ---------------------
dnl CHECK TERMCAP LIBRARY
dnl ---------------------
@@ -1316,7 +1319,6 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
pathconf sysconf \
tgetent tigetflag tigetnum tigetstr setupterm initscr resize_term \
getcchar setcchar waddwstr wget_wch win_wch use_default_colors \
- pcre2_compile_8 \
nl_langinfo \
erand48 open_memstream \
posix_openpt \
@@ -1371,6 +1373,11 @@ if test x$zsh_cv_func_realpath_accepts_null = xyes; then
AC_DEFINE(REALPATH_ACCEPTS_NULL)
fi
+if test x$enable_pcre = xyes; then
+ LIBS="`$PCRE_CONFIG --libs8` $LIBS"
+ AC_CHECK_FUNCS(pcre2_compile_8)
+fi
+
if test x$enable_cap = xyes; then
AC_CHECK_FUNCS(cap_get_proc)
fi
prev parent reply other threads:[~2023-06-19 8:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 23:35 Oliver Kiddle
2023-05-06 4:44 ` named capture groups with PCRE matching (Was: PATCH: migrate pcre module to pcre2) Stephane Chazelas
2023-05-06 18:56 ` Bart Schaefer
2023-05-06 23:06 ` Oliver Kiddle
2023-05-10 23:26 ` PATCH: migrate pcre module to pcre2 Oliver Kiddle
2023-05-12 23:12 ` Phil Pennock
2023-05-24 18:11 ` Oliver Kiddle
2023-06-13 7:35 ` Jun T
2023-06-19 8:20 ` Jun T [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=321D363A-50E5-4BF1-81F3-7F71EC34069A@kba.biglobe.ne.jp \
--to=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).