1 ########################################################
2 # Compile with LDAP support?
6 AC_MSG_CHECKING([for LDAP support])
9 AS_HELP_STRING([--with-ldap],[LDAP backend support (default=yes)]),
12 with_ldap_support=$withval
16 AC_MSG_RESULT($with_ldap_support)
18 if test x"$with_ldap_support" != x"no"; then
20 ##################################################################
21 # first test for ldap.h and lber.h
22 # (ldap.h is required for this test)
23 AC_CHECK_HEADERS(ldap.h lber.h)
25 if test x"$ac_cv_header_ldap_h" != x"yes"; then
26 if test x"$with_ldap_support" = x"yes"; then
27 AC_MSG_ERROR(ldap.h is needed for LDAP support)
29 AC_MSG_WARN(ldap.h is needed for LDAP support)
36 if test x"$with_ldap_support" != x"no"; then
39 ##################################################################
40 # we might need the lber lib on some systems. To avoid link errors
41 # this test must be before the libldap test
42 AC_CHECK_LIB_EXT(lber, LDAP_LIBS, ber_scanf)
44 ########################################################
45 # now see if we can find the ldap libs in standard paths
46 AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
48 AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS)
50 ########################################################
51 # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
52 # Check found in pam_ldap 145.
53 AC_CHECK_FUNC_EXT(ldap_set_rebind_proc,$LDAP_LIBS)
55 LIBS="$LIBS $LDAP_LIBS"
56 AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, smb_ldap_cv_ldap_set_rebind_proc, [
60 [ldap_set_rebind_proc(0, 0, 0);],
61 [smb_ldap_cv_ldap_set_rebind_proc=3],
62 [smb_ldap_cv_ldap_set_rebind_proc=2]
66 AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
68 AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)
70 if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes" -a x"$ac_cv_func_ext_ldap_domain2hostlist" = x"yes"; then
71 AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
72 AC_DEFINE(HAVE_LDB_LDAP,1,[Whether ldb_ldap is available])
74 AC_MSG_CHECKING(whether LDAP support is used)
78 if test x"$with_ldap_support" = x"yes"; then
79 AC_MSG_ERROR(libldap is needed for LDAP support)
81 AC_MSG_WARN(libldap is needed for LDAP support)
90 SMB_EXT_LIB(LDAP,[${LDAP_LIBS}],[${LDAP_CFLAGS}],[${LDAP_CPPFLAGS}],[${LDAP_LDFLAGS}])