diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-04-26 09:02:00 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:16:19 -0500 |
commit | d4bcee3d27974e48e94bae9d3908722596df3a62 (patch) | |
tree | 4c65053416e2c0b83f95172ab5012bbbcefff212 /source4/lib | |
parent | a09593c37a307388c0fed175d70c896a9d2d47db (diff) | |
download | samba-d4bcee3d27974e48e94bae9d3908722596df3a62.tar.gz samba-d4bcee3d27974e48e94bae9d3908722596df3a62.tar.bz2 samba-d4bcee3d27974e48e94bae9d3908722596df3a62.zip |
r6485: Move LDAP detection M4 file and use it for the standalone ldb build
Remove a couple of unused M4 macros.
The standalone LDB build will not work until I've figured out what
AC_CHECK_LIB_EXT() does exactly (it's Samba-specific)
(This used to be commit cc20d6bb7f06e077ebe4c366e545e187a0c79472)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/configure.in | 1 | ||||
-rw-r--r-- | source4/lib/ldb/ldap.m4 | 89 |
2 files changed, 90 insertions, 0 deletions
diff --git a/source4/lib/ldb/configure.in b/source4/lib/ldb/configure.in index 33269bbc76..9de28cbe26 100644 --- a/source4/lib/ldb/configure.in +++ b/source4/lib/ldb/configure.in @@ -5,5 +5,6 @@ AC_PROG_CC AC_FUNC_MMAP AC_PATH_PROG(YODL2MAN,yodl2man) AC_PATH_PROG(GCOV,gcov) +sinclude(ldap.m4) sinclude(config.m4) AC_OUTPUT(Makefile) diff --git a/source4/lib/ldb/ldap.m4 b/source4/lib/ldb/ldap.m4 new file mode 100644 index 0000000000..a9e3fb5678 --- /dev/null +++ b/source4/lib/ldb/ldap.m4 @@ -0,0 +1,89 @@ +######################################################## +# Compile with LDAP support? + +LDAP_LIBS="" +with_ldap_support=auto +AC_MSG_CHECKING([for LDAP support]) + +AC_ARG_WITH(ldap, +[ --with-ldap LDAP support (default yes)], +[ case "$withval" in + yes|no) + with_ldap_support=$withval + ;; + esac ]) + +AC_MSG_RESULT($with_ldap_support) + +if test x"$with_ldap_support" != x"no"; then + + ################################################################## + # first test for ldap.h and lber.h + # (ldap.h is required for this test) + AC_CHECK_HEADERS(ldap.h lber.h) + + if test x"$ac_cv_header_ldap_h" != x"yes"; then + if test x"$with_ldap_support" = x"yes"; then + AC_MSG_ERROR(ldap.h is needed for LDAP support) + else + AC_MSG_WARN(ldap.h is needed for LDAP support) + fi + + with_ldap_support=no + fi +fi + +if test x"$with_ldap_support" != x"no"; then + ac_save_LIBS=$LIBS + + ################################################################## + # we might need the lber lib on some systems. To avoid link errors + # this test must be before the libldap test + AC_CHECK_LIB_EXT(lber, LDAP_LIBS, ber_scanf) + + ######################################################## + # now see if we can find the ldap libs in standard paths + AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init) + + AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS) + + ######################################################## + # If we have LDAP, does it's rebind procedure take 2 or 3 arguments? + # Check found in pam_ldap 145. + AC_CHECK_FUNC_EXT(ldap_set_rebind_proc,$LDAP_LIBS) + + LIBS="$LIBS $LDAP_LIBS" + AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, smb_ldap_cv_ldap_set_rebind_proc, [ + AC_TRY_COMPILE([ + #include <lber.h> + #include <ldap.h>], + [ldap_set_rebind_proc(0, 0, 0);], + [smb_ldap_cv_ldap_set_rebind_proc=3], + [smb_ldap_cv_ldap_set_rebind_proc=2] + ) + ]) + + AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc]) + + AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS) + + if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes" -a x"$ac_cv_func_ext_ldap_domain2hostlist" = x"yes"; then + AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available]) + with_ldap_support=yes + AC_MSG_CHECKING(whether LDAP support is used) + AC_MSG_RESULT(yes) + SMB_EXT_LIB_ENABLE(LDAP,YES) + else + if test x"$with_ldap_support" = x"yes"; then + AC_MSG_ERROR(libldap is needed for LDAP support) + else + AC_MSG_WARN(libldap is needed for LDAP support) + fi + + LDAP_LIBS="" + with_ldap_support=no + fi + LIBS=$ac_save_LIBS +fi + +SMB_EXT_LIB(LDAP,[${LDAP_LIBS}],[${LDAP_CFLAGS}],[${LDAP_CPPFLAGS}],[${LDAP_LDFLAGS}]) |