~vjsamuel/drizzle/bug-616035

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
dnl  Copyright (C) 2009 Sun Microsystems
dnl This file is free software; Sun Microsystems
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

#--------------------------------------------------------------------
# Check for libldap
#--------------------------------------------------------------------


AC_DEFUN([_PANDORA_SEARCH_LIBLDAP],[
  AC_REQUIRE([AC_LIB_PREFIX])

  AC_LIB_HAVE_LINKFLAGS(ldap,,
  [#include <ldap.h>],
  [
    LDAP *ldap;
    ldap_initialize(&ldap, "ldap://localhost/");
  ])
  AS_IF([test "x$ac_cv_libldap" = "xno"],
  [
    unset ac_cv_libldap
    unset HAVE_LIBLDAP
    unset LIBLDAP
    unset LIBLDAP_PREFIX
    unset LTLIBLDAP
    AC_LIB_HAVE_LINKFLAGS(ldap,,
    [#include <ldap/ldap.h>],
    [
      LDAP *ldap;
      ldap_initialize(&ldap, "ldap://localhost/");
    ])
    AS_IF([test "x$ac_cv_libldap" = "xyes"], [
      ac_cv_ldap_location="<ldap/ldap.h>"
    ])
  ],[
    ac_cv_ldap_location="<ldap.h>"
  ])

  AM_CONDITIONAL(HAVE_LIBLDAP, [test "x${ac_cv_libldap}" = "xyes"])
])

AC_DEFUN([_PANDORA_HAVE_LIBLDAP],[

  AC_ARG_ENABLE([libldap],
    [AS_HELP_STRING([--disable-libldap],
      [Build with libldap support @<:@default=on@:>@])],
    [ac_enable_libldap="$enableval"],
    [ac_enable_libldap="yes"])

  _PANDORA_SEARCH_LIBLDAP
])


AC_DEFUN([PANDORA_HAVE_LIBLDAP],[
  AC_REQUIRE([_PANDORA_HAVE_LIBLDAP])
])

AC_DEFUN([_PANDORA_REQUIRE_LIBLDAP],[
  ac_enable_libldap="yes"
  _PANDORA_SEARCH_LIBLDAP

  AS_IF([test x$ac_cv_libldap = xno],[
    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.])
  ],[
    AC_DEFINE_UNQUOTED(LDAP_HEADER,[${ac_cv_ldap_location}],
                       [Location of ldap header])
  ])
])

AC_DEFUN([PANDORA_REQUIRE_LIBLDAP],[
  AC_REQUIRE([_PANDORA_REQUIRE_LIBLDAP])
])