From e3f5970b417f23f3b741af89daa91f49a951691b Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Tue, 14 Nov 2023 15:45:20 -0600 Subject: [PATCH 1/3] Adjusted configure.ac to use pcre2 instead of pcre --- configure.ac | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index e3076c9263..626f8cbbf7 100644 --- a/configure.ac +++ b/configure.ac @@ -504,20 +504,12 @@ CF3_WITH_LIBRARY(openssl, [ ) ]) -dnl PCRE +dnl PCRE2 -AC_ARG_WITH([pcre], [AS_HELP_STRING([--with-pcre[[=PATH]]], [Specify PCRE path])], [], [with_pcre=yes]) - -if test "x$with_pcre" = "xno"; then - AC_MSG_ERROR([PCRE is required]) +if test "x$with_pcre2" = "xno"; then + AC_MSG_ERROR([PCRE2 is required]) fi - -CF3_WITH_LIBRARY(pcre, [ - AC_CHECK_LIB(pcre, pcre_exec, [], [AC_MSG_ERROR(Cannot find PCRE)]) - AC_CHECK_HEADERS([pcre.h], [], - [AC_CHECK_HEADERS([pcre/pcre.h], [PCRE_CPPFLAGS="-Ipcre"], - AC_MSG_ERROR(Cannot find PCRE))]) -]) +AX_CHECK_PCRE2([], [], AC_MSG_ERROR(Cannot find PCRE2)) dnl defined for libntech From 7b96a666fcc41cca304d4b95d52aa49db755c1eb Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Tue, 14 Nov 2023 15:45:38 -0600 Subject: [PATCH 2/3] squash with previous --- m4/ax_check_pcre2.m4 | 163 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 m4/ax_check_pcre2.m4 diff --git a/m4/ax_check_pcre2.m4 b/m4/ax_check_pcre2.m4 new file mode 100644 index 0000000000..9ae01addf3 --- /dev/null +++ b/m4/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 +]) From 1ad59f7bba6312e50dfa20b6e23dfa96f2e10677 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Tue, 14 Nov 2023 16:45:44 -0600 Subject: [PATCH 3/3] wip --- configure.ac | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 626f8cbbf7..1dc0296b58 100644 --- a/configure.ac +++ b/configure.ac @@ -513,7 +513,7 @@ AX_CHECK_PCRE2([], [], AC_MSG_ERROR(Cannot find PCRE2)) dnl defined for libntech -AC_DEFINE(WITH_PCRE, 1, [Define if PCRE is being used]) +AC_DEFINE(WITH_PCRE2, 1, [Define if PCRE2 is being used]) dnl systemd-socket activation @@ -1298,10 +1298,10 @@ dnl ###################################################################### dnl Collect all the options dnl ###################################################################### -CORE_CPPFLAGS="$LMDB_CPPFLAGS $TOKYOCABINET_CPPFLAGS $QDBM_CPPFLAGS $PCRE_CPPFLAGS $OPENSSL_CPPFLAGS $SQLITE3_CPPFLAGS $LIBACL_CPPFLAGS $LIBCURL_CPPFLAGS $LIBYAML_CPPFLAGS $POSTGRESQL_CPPFLAGS $MYSQL_CPPFLAGS $LIBXML2_CPPFLAGS $CPPFLAGS $CFECOMPAT_CPPFLAGS" -CORE_CFLAGS="$LMDB_CFLAGS $TOKYOCABINET_CFLAGS $QDBM_CFLAGS $PCRE_CFLAGS $OPENSSL_CFLAGS $SQLITE3_CFLAGS $LIBACL_CFLAGS $LIBCURL_CFLAGS $LIBYAML_CFLAGS $POSTGRESQL_CFLAGS $MYSQL_CFLAGS $LIBXML2_CFLAGS $CFLAGS" -CORE_LDFLAGS="$LMDB_LDFLAGS $TOKYOCABINET_LDFLAGS $QDBM_LDFLAGS $PCRE_LDFLAGS $OPENSSL_LDFLAGS $SQLITE3_LDFLAGS $LIBACL_LDFLAGS $LIBCURL_LDFLAGS $LIBYAML_LDFLAGS $POSTGRESQL_LDFLAGS $MYSQL_LDFLAGS $LIBXML2_LDFLAGS $LDFLAGS" -CORE_LIBS="$LMDB_LIBS $TOKYOCABINET_LIBS $QDBM_LIBS $PCRE_LIBS $OPENSSL_LIBS $SQLITE3_LIBS $LIBACL_LIBS $LIBCURL_LIBS $LIBYAML_LIBS $POSTGRESQL_LIBS $MYSQL_LIBS $LIBXML2_LIBS $LIBS" +CORE_CPPFLAGS="$LMDB_CPPFLAGS $TOKYOCABINET_CPPFLAGS $QDBM_CPPFLAGS $PCRE2_CPPFLAGS $OPENSSL_CPPFLAGS $SQLITE3_CPPFLAGS $LIBACL_CPPFLAGS $LIBCURL_CPPFLAGS $LIBYAML_CPPFLAGS $POSTGRESQL_CPPFLAGS $MYSQL_CPPFLAGS $LIBXML2_CPPFLAGS $CPPFLAGS $CFECOMPAT_CPPFLAGS" +CORE_CFLAGS="$LMDB_CFLAGS $TOKYOCABINET_CFLAGS $QDBM_CFLAGS $PCRE2_CFLAGS $OPENSSL_CFLAGS $SQLITE3_CFLAGS $LIBACL_CFLAGS $LIBCURL_CFLAGS $LIBYAML_CFLAGS $POSTGRESQL_CFLAGS $MYSQL_CFLAGS $LIBXML2_CFLAGS $CFLAGS" +CORE_LDFLAGS="$LMDB_LDFLAGS $TOKYOCABINET_LDFLAGS $QDBM_LDFLAGS $PCRE2_LDFLAGS $OPENSSL_LDFLAGS $SQLITE3_LDFLAGS $LIBACL_LDFLAGS $LIBCURL_LDFLAGS $LIBYAML_LDFLAGS $POSTGRESQL_LDFLAGS $MYSQL_LDFLAGS $LIBXML2_LDFLAGS $LDFLAGS" +CORE_LIBS="$LMDB_LIBS $TOKYOCABINET_LIBS $QDBM_LIBS $PCRE2_LIBS $OPENSSL_LIBS $SQLITE3_LIBS $LIBACL_LIBS $LIBCURL_LIBS $LIBYAML_LIBS $POSTGRESQL_LIBS $MYSQL_LIBS $LIBXML2_LIBS $LIBS" dnl ###################################################################### dnl Make them available to subprojects. @@ -1723,7 +1723,7 @@ AC_MSG_RESULT([> Required libraries]) AC_MSG_RESULT([-> OpenSSL: $OPENSSL_PATH]) -AC_MSG_RESULT([-> PCRE: $PCRE_PATH]) +AC_MSG_RESULT([-> PCRE2: $PCRE2_PATH]) if test $WITH_TOKYO = 1; then AC_MSG_RESULT([-> DB: Tokyo Cabinet: $TOKYOCABINET_PATH])