~vjsamuel/drizzle/bug-616035

1497.2.2 by Eric Day
Initial auth_ldap plugin. There are no test cases since this would require a pre-configured LDAP server running. Testing will instead be done on one of the build hosts that has been configured with LDAP and a separate test script.
1
dnl  Copyright (C) 2009 Sun Microsystems
2
dnl This file is free software; Sun Microsystems
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
  [
1497.2.4 by Eric Day
Fixed libldap detection for Solaris/Netscape headers.
17
    LDAP *ldap;
18
    ldap_initialize(&ldap, "ldap://localhost/");
1497.2.2 by Eric Day
Initial auth_ldap plugin. There are no test cases since this would require a pre-configured LDAP server running. Testing will instead be done on one of the build hosts that has been configured with LDAP and a separate test script.
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
    [
1497.2.4 by Eric Day
Fixed libldap detection for Solaris/Netscape headers.
30
      LDAP *ldap;
31
      ldap_initialize(&ldap, "ldap://localhost/");
1497.2.2 by Eric Day
Initial auth_ldap plugin. There are no test cases since this would require a pre-configured LDAP server running. Testing will instead be done on one of the build hosts that has been configured with LDAP and a separate test script.
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
])