wmtime: Fixed Debian bug #661843. Applied a patch by Milan Cermak.
[dockapps.git] / wmweather+ / m4 / libpcre.m4
blob94faefeeebbb4a881706a0b4db0577f269cb6e57
1 dnl @synopsis CHECK_LIBPCRE([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2 dnl
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.
8 dnl
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
11 dnl file.
12 dnl
13 dnl Sources files should then use something like
14 dnl
15 dnl #ifdef HAVE_LIBPCRE
16 dnl #include <pcre.h>
17 dnl #endif /* HAVE_LIBPCRE */
18 dnl
19 dnl @version 1.0
20 dnl based on CHECK_ZLIB by Loic Dachary <loic@senga.org>
21 dnl
23 AC_DEFUN([CHECK_LIBPCRE],
25 # Handle user hints
27          [AC_MSG_CHECKING(if libpcre is wanted)
28          AC_ARG_WITH(libpcre,
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])
35                       else
36                           AC_MSG_RESULT(no)
37                       fi],
38                      [LIBPCRE_HOME=/usr/local
39                       if test ! -f "${LIBPCRE_HOME}/include/pcre.h"
40                       then
41                          LIBPCRE_HOME=/usr
42                       fi
43                       AC_MSG_RESULT([yes: libraries ${LIBPCRE_HOME}/lib  includes ${LIBPCRE_HOME}/include])
44                      ])
47 # Locate libpcre, if wanted
49          if test -n "${LIBPCRE_HOME}"
50          then
51              LDFLAGS="$LDFLAGS -L${LIBPCRE_HOME}/lib"
52              CPPFLAGS="$CPPFLAGS -I${LIBPCRE_HOME}/include"
53              AC_CHECK_LIB(pcre, pcre_compile, $1, $2)
54          else
55              $2
56          fi
57     ])