Added description of Quick search modes.
[kaloumi3.git] / m4.include / ax_path_lib_pcre.m4
blob178998c2d240e81e95b0af051d6e418fdcd9c02c
1 dnl @synopsis AX_PATH_LIB_PCRE [(A/NA)]
2 dnl
3 dnl check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly.
4 dnl
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.
8 dnl
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.
11 dnl
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])
19 AC_ARG_WITH([pcre],
20             AC_HELP_STRING([--with-pcre[[=prefix]]].[ compile pcre part (via libpcre check)]),
21             ,
22             [with_pcre="yes"]
24 if test x"$with_pcre" = "xno" ; then
25   AC_MSG_RESULT([disabled])
26   m4_ifval($2,$2)
27 else
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`"
34   else
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])
51         m4_ifval($1,$1)
52      else
53         AC_MSG_CHECKING([lib pcre])
54         AC_MSG_RESULT([no, (WARNING)])
55         m4_ifval($2,$2)
56      fi
58      CFLAGS="$OLDCFLAGS"
59      LDFLAGS="$OLDLDFLAGS"
61   fi
64 AC_SUBST([PCRE_LIBS])
65 AC_SUBST([PCRE_CFLAGS])