bfa733a1b84efeab3b51c402a2c6e1dd92f44566
[awesomized/libmemcached] / m4 / pandora_have_libpcre.m4
1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 #--------------------------------------------------------------------
7 # Check for libpcre
8 #--------------------------------------------------------------------
9
10
11 AC_DEFUN([_PANDORA_SEARCH_LIBPCRE],[
12 AC_REQUIRE([AC_LIB_PREFIX])
13
14 AC_LIB_HAVE_LINKFLAGS(pcre,,
15 [#include <pcre.h>],
16 [
17 pcre *re= NULL;
18 pcre_version();
19 ])
20 AS_IF([test "x$ac_cv_libpcre" = "xno"],
21 [
22 unset ac_cv_libpcre
23 unset HAVE_LIBPCRE
24 unset LIBPCRE
25 unset LIBPCRE_PREFIX
26 unset LTLIBPCRE
27 AC_LIB_HAVE_LINKFLAGS(pcre,,
28 [#include <pcre/pcre.h>],
29 [
30 pcre *re= NULL;
31 pcre_version();
32 ])
33 AS_IF([test "x$ac_cv_libpcre" = "xyes"], [
34 ac_cv_pcre_location="<pcre/pcre.h>"
35 ])
36 ],[
37 ac_cv_pcre_location="<pcre.h>"
38 ])
39
40 AM_CONDITIONAL(HAVE_LIBPCRE, [test "x${ac_cv_libpcre}" = "xyes"])
41 ])
42
43 AC_DEFUN([_PANDORA_HAVE_LIBPCRE],[
44
45 AC_ARG_ENABLE([libpcre],
46 [AS_HELP_STRING([--disable-libpcre],
47 [Build with libpcre support @<:@default=on@:>@])],
48 [ac_enable_libpcre="$enableval"],
49 [ac_enable_libpcre="yes"])
50
51 _PANDORA_SEARCH_LIBPCRE
52 ])
53
54
55 AC_DEFUN([PANDORA_HAVE_LIBPCRE],[
56 AC_REQUIRE([_PANDORA_HAVE_LIBPCRE])
57 ])
58
59 AC_DEFUN([_PANDORA_REQUIRE_LIBPCRE],[
60 ac_enable_libpcre="yes"
61 _PANDORA_SEARCH_LIBPCRE
62
63 AS_IF([test x$ac_cv_libpcre = xno],[
64 AC_MSG_ERROR([libpcre is required for ${PACKAGE}. On Debian this can be found in libpcre3-dev. On RedHat this can be found in pcre-devel.])
65 ],[
66 AC_DEFINE_UNQUOTED(PCRE_HEADER,[${ac_cv_pcre_location}],
67 [Location of pcre header])
68 ])
69 ])
70
71 AC_DEFUN([PANDORA_REQUIRE_LIBPCRE],[
72 AC_REQUIRE([_PANDORA_REQUIRE_LIBPCRE])
73 ])