Next pass in removing gettext (solve warnings on lion, we don't use GETTEXT anyways).
[m6w6/libmemcached] / m4 / pandora_have_libldap.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 libldap
8 #--------------------------------------------------------------------
9
10
11 AC_DEFUN([_PANDORA_SEARCH_LIBLDAP],[
12 AC_REQUIRE([AC_LIB_PREFIX])
13
14 AC_LIB_HAVE_LINKFLAGS(ldap,,
15 [#include <ldap.h>],
16 [
17 LDAP *ldap;
18 ldap_initialize(&ldap, "ldap://localhost/");
19 ])
20 AS_IF([test "x$ac_cv_libldap" = "xno"],
21 [
22 unset ac_cv_libldap
23 unset HAVE_LIBLDAP
24 unset LIBLDAP
25 unset LIBLDAP_PREFIX
26 unset LTLIBLDAP
27 AC_LIB_HAVE_LINKFLAGS(ldap,,
28 [#include <ldap/ldap.h>],
29 [
30 LDAP *ldap;
31 ldap_initialize(&ldap, "ldap://localhost/");
32 ])
33 AS_IF([test "x$ac_cv_libldap" = "xyes"], [
34 ac_cv_ldap_location="<ldap/ldap.h>"
35 ])
36 ],[
37 ac_cv_ldap_location="<ldap.h>"
38 ])
39
40 AM_CONDITIONAL(HAVE_LIBLDAP, [test "x${ac_cv_libldap}" = "xyes"])
41 ])
42
43 AC_DEFUN([_PANDORA_HAVE_LIBLDAP],[
44
45 AC_ARG_ENABLE([libldap],
46 [AS_HELP_STRING([--disable-libldap],
47 [Build with libldap support @<:@default=on@:>@])],
48 [ac_enable_libldap="$enableval"],
49 [ac_enable_libldap="yes"])
50
51 _PANDORA_SEARCH_LIBLDAP
52 ])
53
54
55 AC_DEFUN([PANDORA_HAVE_LIBLDAP],[
56 AC_REQUIRE([_PANDORA_HAVE_LIBLDAP])
57 ])
58
59 AC_DEFUN([_PANDORA_REQUIRE_LIBLDAP],[
60 ac_enable_libldap="yes"
61 _PANDORA_SEARCH_LIBLDAP
62
63 AS_IF([test x$ac_cv_libldap = xno],[
64 AC_MSG_ERROR([libldap is required for ${PACKAGE}. On Debian this can be found in libldap2-dev. On RedHat this can be found in openldap-devel.])
65 ],[
66 AC_DEFINE_UNQUOTED(LDAP_HEADER,[${ac_cv_ldap_location}],
67 [Location of ldap header])
68 ])
69 ])
70
71 AC_DEFUN([PANDORA_REQUIRE_LIBLDAP],[
72 AC_REQUIRE([_PANDORA_REQUIRE_LIBLDAP])
73 ])