# LIBPCRE2_CHECK_CONFIG ([DEFAULT-ACTION])
# ----------------------------------------------------------
# This macro #defines HAVE_PCRE2_H if required header files are
# found, and sets @LIBPCRE2_LDFLAGS@ and @LIBPCRE2_CFLAGS@ to the necessary
# This macro 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.
AC_DEFUN([LIBPCRE2_TRY_LINK],
#define PCRE2_CODE_UNIT_WIDTH 8
PCRE2_SIZE error_offset = 0;
pcre2_code *regexp = pcre2_compile("test", PCRE2_ZERO_TERMINATED, PCRE2_UTF, &error, &error_offset, NULL);
AC_DEFUN([LIBPCRE2_CHECK_CONFIG],
If you want to specify libpcre2 installation directories:
AC_HELP_STRING([--with-libpcre2@<:@=DIR@:>@], [use libpcre2 from given base install directory (DIR), default is to search through a number of common places for the libpcre2 files.])],
if test "$withval" = "yes"; then
if test -f /usr/local/include/pcre2.h; then
_libpcre2_dir_lib="$withval/lib"
test "x$withval" = "xyes" && withval=/usr
LIBPCRE2_CFLAGS="-I$withval/include"
LIBPCRE2_LDFLAGS="-L$withval/lib"
AC_ARG_WITH([libpcre2-include],
AC_HELP_STRING([--with-libpcre2-include@<:@=DIR@:>@],
[use libpcre2 include headers from given path.]
LIBPCRE2_CFLAGS="-I$withval"
AC_ARG_WITH([libpcre2-lib],
AC_HELP_STRING([--with-libpcre2-lib@<:@=DIR@:>@],
[use libpcre2 libraries from given path.]
_libpcre2_dir_lib="$withval"
LIBPCRE2_LDFLAGS="-L$withval"
if test "x$enable_static_libs" = "xyes"; then
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
test -z "$PKG_CONFIG" -a -z "$_libpcre2_dir_lib" && AC_MSG_ERROR([Not found pkg-config library])
m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
AC_MSG_CHECKING(for libpcre2 support)
LIBPCRE2_LIBS="-lpcre2-8"
if test "x$enable_static" = "xyes"; then
LIBPCRE2_LIBS=" $LIBPCRE2_LIBS -lpthread"
elif test "x$enable_static_libs" = "xyes" -a -z "$PKG_CONFIG"; then
LIBPCRE2_LIBS="$_libpcre2_dir_lib/libpcre2.a"