1 dnl @synopsis AX_PATH_LIB_PCRE [(A/NA)]
3 dnl check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly.
5 dnl also provide --with-pcre option that may point to the $prefix of
6 dnl the pcre installation - the macro will check $pcre/include and
7 dnl $pcre/lib to contain the necessary files.
9 dnl the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported
10 dnl and they can take advantage of the LIBS/CFLAGS additions.
12 dnl @author Guido U. Draheim <guidod@gmx.de>
13 dnl @author Slava Zanko <slavazanko@gmail.com>
14 dnl @version 2009-07-06
15 dnl @license GPLWithACException
17 AC_DEFUN([AX_PATH_LIB_PCRE],[dnl
18 AC_MSG_CHECKING([lib pcre])
20 AC_HELP_STRING([--with-pcre[[=prefix]]], [compile pcre part (via libpcre check)]),
24 if test x"$with_pcre" = "xno" ; then
25 AC_MSG_RESULT([disabled])
29 AC_MSG_RESULT([(testing)])
31 if test "x$with_pcre" = "xyes" ; then
32 PCRE_CFLAGS="`pcre-config --cflags`"
33 PCRE_LIBS="`pcre-config --libs`"
35 test_PCRE_LIBS="-L$with_pcre/lib"
36 test_PCRE_CFLAGS="-I$with_pcre/include"
38 OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS $test_PCRE_LIBS"
39 OLDCFLAGS="$CFLAGS" ; CFLAGS="$CFLAGS $test_PCRE_CFLAGS"
41 AC_CHECK_LIB(pcre, pcre_compile)
43 if test x"$ac_cv_lib_pcre_pcre_compile" = x"yes" ; then
44 AC_MSG_RESULT(setting PCRE_LIBS -L$with_pcre/lib -lpcre)
46 PCRE_LIBS=$test_PCRE_LIBS
47 test_PCRE_CFLAGS=$test_PCRE_CFLAGS
49 AC_MSG_CHECKING([lib pcre])
50 AC_MSG_RESULT([$PCRE_LIBS])
53 AC_MSG_CHECKING([lib pcre])
54 AC_MSG_RESULT([no, (WARNING)])
65 AC_SUBST([PCRE_CFLAGS])