| 1 | ########################################################
|
|---|
| 2 | # Compile with LDAP support?
|
|---|
| 3 |
|
|---|
| 4 | LDAP_LIBS=""
|
|---|
| 5 | with_ldap_support=auto
|
|---|
| 6 | AC_MSG_CHECKING([for LDAP support])
|
|---|
| 7 |
|
|---|
| 8 | AC_ARG_WITH(ldap,
|
|---|
| 9 | AS_HELP_STRING([--with-ldap],[LDAP backend support (default=yes)]),
|
|---|
| 10 | [ case "$withval" in
|
|---|
| 11 | yes|no)
|
|---|
| 12 | with_ldap_support=$withval
|
|---|
| 13 | ;;
|
|---|
| 14 | esac ])
|
|---|
| 15 |
|
|---|
| 16 | AC_MSG_RESULT($with_ldap_support)
|
|---|
| 17 |
|
|---|
| 18 | if test x"$with_ldap_support" != x"no"; then
|
|---|
| 19 |
|
|---|
| 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)
|
|---|
| 24 |
|
|---|
| 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)
|
|---|
| 28 | else
|
|---|
| 29 | AC_MSG_WARN(ldap.h is needed for LDAP support)
|
|---|
| 30 | fi
|
|---|
| 31 |
|
|---|
| 32 | with_ldap_support=no
|
|---|
| 33 | fi
|
|---|
| 34 | fi
|
|---|
| 35 |
|
|---|
| 36 | if test x"$with_ldap_support" != x"no"; then
|
|---|
| 37 | ac_save_LIBS=$LIBS
|
|---|
| 38 |
|
|---|
| 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)
|
|---|
| 43 |
|
|---|
| 44 | ########################################################
|
|---|
| 45 | # now see if we can find the ldap libs in standard paths
|
|---|
| 46 | AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init)
|
|---|
| 47 |
|
|---|
| 48 | AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS)
|
|---|
| 49 |
|
|---|
| 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)
|
|---|
| 54 |
|
|---|
| 55 | LIBS="$LIBS $LDAP_LIBS"
|
|---|
| 56 | AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, smb_ldap_cv_ldap_set_rebind_proc, [
|
|---|
| 57 | AC_TRY_COMPILE([
|
|---|
| 58 | #include <lber.h>
|
|---|
| 59 | #include <ldap.h>],
|
|---|
| 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]
|
|---|
| 63 | )
|
|---|
| 64 | ])
|
|---|
| 65 |
|
|---|
| 66 | AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
|
|---|
| 67 |
|
|---|
| 68 | AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS)
|
|---|
| 69 |
|
|---|
| 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])
|
|---|
| 73 | with_ldap_support=yes
|
|---|
| 74 | AC_MSG_CHECKING(whether LDAP support is used)
|
|---|
| 75 | AC_MSG_RESULT(yes)
|
|---|
| 76 | SMB_ENABLE(LDAP,YES)
|
|---|
| 77 | else
|
|---|
| 78 | if test x"$with_ldap_support" = x"yes"; then
|
|---|
| 79 | AC_MSG_ERROR(libldap is needed for LDAP support)
|
|---|
| 80 | else
|
|---|
| 81 | AC_MSG_WARN(libldap is needed for LDAP support)
|
|---|
| 82 | fi
|
|---|
| 83 |
|
|---|
| 84 | LDAP_LIBS=""
|
|---|
| 85 | with_ldap_support=no
|
|---|
| 86 | fi
|
|---|
| 87 | LIBS=$ac_save_LIBS
|
|---|
| 88 | fi
|
|---|
| 89 |
|
|---|
| 90 | SMB_EXT_LIB(LDAP,[${LDAP_LIBS}],[${LDAP_CFLAGS}],[${LDAP_CPPFLAGS}],[${LDAP_LDFLAGS}])
|
|---|