# LIBPCRE_CHECK_CONFIG ([DEFAULT-ACTION])
# ----------------------------------------------------------
# This macro #defines HAVE_PCRE_H if required header files are
# found, and sets @LIBPCRE_LDFLAGS@ and @LIBPCRE_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([LIBPCRE_TRY_LINK],
const char* error = NULL;
pcre *regexp = pcre_compile("test", PCRE_UTF8, &error, &error_offset, NULL);
AC_DEFUN([LIBPCRE_CHECK_CONFIG],
If you want to specify libpcre installation directories:
AC_HELP_STRING([--with-libpcre@<:@=DIR@:>@], [use libpcre from given base install directory (DIR), default is to search through a number of common places for the libpcre files.])],
if test "$withval" = "yes"; then
if test -f /usr/local/include/pcre.h; then
_libpcre_dir_lib="$withval/lib"
test "x$withval" = "xyes" && withval=/usr
LIBPCRE_CFLAGS="-I$withval/include"
LIBPCRE_LDFLAGS="-L$withval/lib"
AC_ARG_WITH([libpcre-include],
AC_HELP_STRING([--with-libpcre-include@<:@=DIR@:>@],
[use libpcre include headers from given path.]
LIBPCRE_CFLAGS="-I$withval"
AC_ARG_WITH([libpcre-lib],
AC_HELP_STRING([--with-libpcre-lib@<:@=DIR@:>@],
[use libpcre libraries from given path.]
_libpcre_dir_lib="$withval"
LIBPCRE_LDFLAGS="-L$withval"
if test "x$enable_static_libs" = "xyes"; then
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
test -z "$PKG_CONFIG" -a -z "$_libpcre_dir_lib" && AC_MSG_ERROR([Not found pkg-config library])
m4_pattern_allow([^PKG_CONFIG_LIBDIR$])
AC_MSG_CHECKING(for libpcre support)
if test "x$enable_static" = "xyes"; then
LIBPCRE_LIBS=" $LIBPCRE_LIBS -lpthread"
elif test "x$enable_static_libs" = "xyes" -a -z "$PKG_CONFIG"; then
LIBPCRE_LIBS="$_libpcre_dir_lib/libpcre.a"
elif test "x$enable_static_libs" = "xyes"; then
test "x$static_linking_support" = "xno" -a -z "$_libpcre_dir_lib" && AC_MSG_ERROR(["Compiler not support statically linked libs from default folders"])