Refactor code and build system to use libpcre2 as the default

This commit is contained in:
Ervin Hegedus
2025-05-15 21:13:52 +02:00
parent 9bc3300a3a
commit d7b38f034e
14 changed files with 106 additions and 107 deletions

View File

@@ -19,19 +19,17 @@ AC_ARG_WITH(
pcre,
[AS_HELP_STRING([--with-pcre=PATH],[Path to pcre prefix or config script])],
[test_paths="${with_pcre}"],
[test_paths="/usr/local/libpcre /usr/local/pcre /usr/local /opt/libpcre /opt/pcre /opt /usr"])
[with_pcre="no"])
if test "x${with_pcre2}" != "x" && test "x${with_pcre2}" != "xno"; then
AC_MSG_NOTICE([pcre2 specified; omitting check for pcre])
AS_CASE(["${with_pcre}"],
[no], [test_paths=],
[yes], [test_paths="/usr/local/libpcre /usr/local/pcre /usr/local /opt/libpcre /opt/pcre /opt /usr"],
[test_paths="${with_pcre}"])
if test "x${with_pcre}" = "x" || test "x${with_pcre}" = "xno"; then
AC_MSG_NOTICE([pcre not specified; omitting check for pcre])
else
AC_MSG_CHECKING([for libpcre config script])
dnl # Determine pcre lib directory
if test -z "${with_pcre}"; then
test_paths="/usr/local/pcre /usr/local /usr"
else
test_paths="${with_pcre}"
fi
AC_MSG_CHECKING([for libpcre configig script])
for x in ${test_paths}; do
dnl # Determine if the script was specified and use it directly
@@ -87,7 +85,8 @@ else
AC_MSG_NOTICE([*** pcre library not found.])
else
AC_MSG_NOTICE([using pcre v${PCRE_VERSION}])
ifelse([$1], , , $1)
fi
PCRE_CFLAGS="-DWITH_PCRE ${PCRE_CFLAGS}"
ifelse([$1], , , $1)
fi
fi
])

View File

@@ -18,17 +18,17 @@ AC_DEFUN([CHECK_PCRE2],
AC_ARG_WITH(
pcre2,
[AS_HELP_STRING([--with-pcre2=PATH],[Path to pcre2 prefix or config script])],
, with_pcre2=no)
[test_paths="${with_pcre2}"],
[with_pcre2="yes"])
AS_CASE(["${with_pcre2}"],
[no], [test_paths=],
[yes], [test_paths="/usr/local/libpcre2 /usr/local/pcre2 /usr/local /opt/libpcre2 /opt/pcre2 /opt /usr"],
[test_paths="${with_pcre2}"])
[no], [test_paths=],
[yes], [test_paths="/usr/local/libpcre2 /usr/local/pcre2 /usr/local /opt/libpcre2 /opt/pcre2 /opt /usr"],
[test_paths="${with_pcre2}"])
if test "x${with_pcre2}" = "x" || test "x${with_pcre2}" = "xno"; then
AC_MSG_NOTICE([pcre2 not specified; omitting check])
if test "x${with_pcre}" != "x" || test "x${with_pcre}" != "xno"; then
AC_MSG_NOTICE([pcre specified; omitting check for pcre2])
else
AC_MSG_CHECKING([for libpcre2 config script])
for x in ${test_paths}; do
@@ -86,8 +86,8 @@ else
ifelse([$2], , AC_MSG_ERROR([pcre2 library is required]), $2)
else
AC_MSG_NOTICE([using pcre2 v${PCRE2_VERSION}])
PCRE2_CFLAGS="-DWITH_PCRE2 ${PCRE2_CFLAGS}"
ifelse([$1], , , $1)
PCRE2_CFLAGS="${PCRE2_CFLAGS}"
ifelse([$1], , , $1)
fi
fi
])