1 dnl @synopsis CHECK_LIBPCRE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
3 dnl This macro searches for an installed libpcre library. If nothing
4 dnl was specified when calling configure, it searches first in /usr/local
5 dnl and then in /usr. If the --with-libpcre=DIR is specified, it will try
6 dnl to find it in DIR/include/pcre.h and DIR/lib/libpcre.a. If --without-libpcre
7 dnl is specified, the library is not searched at all.
9 dnl It defines the symbol HAVE_LIBPCRE if the library is found. You should
10 dnl use autoheader to include a definition for this symbol in a config.h
13 dnl Sources files should then use something like
15 dnl #ifdef HAVE_LIBPCRE
17 dnl #endif /* HAVE_LIBPCRE */
20 dnl based on CHECK_ZLIB by Loic Dachary <loic@senga.org>
23 AC_DEFUN([CHECK_LIBPCRE],
27 [AC_MSG_CHECKING(if libpcre is wanted)
29 [ --with-libpcre=DIR root directory path of libpcre installation [defaults to
30 /usr/local or /usr if not found in /usr/local]
31 --without-libpcre to disable libpcre usage completely],
32 [if test "$withval" != no ; then
33 LIBPCRE_HOME="$withval"
34 AC_MSG_RESULT([yes: libraries ${LIBPCRE_HOME}/lib includes ${LIBPCRE_HOME}/include])
38 [LIBPCRE_HOME=/usr/local
39 if test ! -f "${LIBPCRE_HOME}/include/pcre.h"
43 AC_MSG_RESULT([yes: libraries ${LIBPCRE_HOME}/lib includes ${LIBPCRE_HOME}/include])
47 # Locate libpcre, if wanted
49 if test -n "${LIBPCRE_HOME}"
51 LDFLAGS="$LDFLAGS -L${LIBPCRE_HOME}/lib"
52 CPPFLAGS="$CPPFLAGS -I${LIBPCRE_HOME}/include"
53 AC_CHECK_LIB(pcre, pcre_compile, $1, $2)