3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_ldap])
9 if test x$with_[]modname != xno; then
11 dnl ############################################################
12 dnl # Check for compiler
13 dnl ############################################################
16 dnl ############################################################
17 dnl # Check for command line options
18 dnl ############################################################
20 dnl extra argument: --with-rlm-ldap-lib-dir
22 AC_ARG_WITH(rlm-ldap-lib-dir,
23 [ --with-rlm-ldap-lib-dir=DIR directory for LDAP library files []],
26 AC_MSG_ERROR(Need rlm-ldap-lib-dir)
31 rlm_ldap_lib_dir="$withval"
36 dnl extra argument: --with-rlm-ldap-include-dir
38 AC_ARG_WITH(rlm-ldap-include-dir,
39 [ --with-rlm-ldap-include-dir=DIR directory for LDAP include files []],
42 AC_MSG_ERROR(Need rlm-ldap-include-dir)
47 rlm_ldap_include_dir="$withval"
52 dnl extra argument: --enable-shared --disable-shared
55 dnl OpenLDAP doesn't provide an autoconf test for their libldap,
56 dnl and we can't reasonably check for all the dependancies for
57 dnl every version and every set of options.
58 if test "x$enable_shared" = "xno"; then
59 AC_MSG_WARN(Static linking with libldap will probably result in unresolved symbols.)
62 dnl extra argument: --with-threads
63 rlm_ldap_with_threads=yes
65 [ --with-threads use threads, if available. (default=yes) ],
68 rlm_ldap_with_threads=no
74 dnl ############################################################
75 dnl # Check for libraries
76 dnl ############################################################
78 dnl pthread stuff is usually in -lpthread
79 dnl or in -lc_r, on *BSD
80 if test "x$rlm_ldap_with_threads" = "xyes"; then
81 AC_CHECK_LIB(pthread, pthread_create,
82 [ LIBS="-lpthread $LIBS" ],
83 [ AC_CHECK_LIB(c_r, pthread_create,
84 [ LIBS="-lc_r $LIBS" ],
85 [ rlm_ldap_with_threads="no" ]
90 dnl Try only "-lldap_r" or "-lldap"
91 dnl Static linking will probably not work, but nobody ever
92 dnl complained about it.
93 smart_try_dir=$rlm_ldap_lib_dir
94 if test "x$rlm_ldap_with_threads" = "xyes"; then
95 FR_SMART_CHECK_LIB(ldap_r, ldap_init)
96 if test "x$ac_cv_lib_ldap_r_ldap_init" != "xyes"; then
97 fail="$fail libldap_r"
100 FR_SMART_CHECK_LIB(ldap, ldap_init)
101 if test "x$ac_cv_lib_ldap_ldap_init" != "xyes"; then
106 dnl ############################################################
107 dnl # Check for header files
108 dnl ############################################################
110 smart_try_dir=$rlm_ldap_include_dir
111 FR_SMART_CHECK_INCLUDE(ldap.h)
112 if test "$ac_cv_header_ldap_h" != "yes"; then
116 dnl ############################################################
117 dnl # Check for library functions
118 dnl ############################################################
120 if test "x$fail" = "x"; then
121 AC_CHECK_FUNC(ldap_start_tls_s,
122 [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_START_TLS" ])
123 AC_CHECK_FUNC(ldap_initialize,
124 [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_INITIALIZE" ])
125 AC_CHECK_FUNC(ldap_int_tls_config,
126 [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_INT_TLS_CONFIG" ])
129 AC_CHECK_FUNCS(ldap_set_rebind_proc)
130 AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, ac_cv_ldap_set_rebind_proc, [
133 #include <ldap.h>], [ldap_set_rebind_proc(0, 0, 0);],
134 [ac_cv_ldap_set_rebind_proc=3],
135 [ac_cv_ldap_set_rebind_proc=2]) ])
141 echo \*\*\* module modname is disabled.
144 if test x"$fail" != x""; then
145 if test x"${enable_strict_dependencies}" = x"yes"; then
146 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
148 AC_MSG_WARN([silently not building ]modname[.])
149 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
150 if test x"$headersuggestion" != x; then
151 AC_MSG_WARN([$headersuggestion])
153 if test x"$libsuggestion" != x; then
154 AC_MSG_WARN([$libsuggestion])
160 dnl extra argument: --with-edir
161 dnl If using Novell eDirectory, enable UP and Novell specific code
164 [ --with-edir enable Novell eDirectory integration. (default=no) ],
167 SMART_CFLAGS="$SMART_CFLAGS -DWITH_EDIR"
175 ldap_ldflags=$SMART_LIBS
176 ldap_cflags="$SMART_CFLAGS -DLDAP_DEPRECATED -DLDAP_SET_REBIND_PROC_ARGS=$ac_cv_ldap_set_rebind_proc"
178 AC_SUBST(ldap_ldflags)
179 AC_SUBST(ldap_cflags)