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" ])
132 echo \*\*\* module modname is disabled.
135 if test x"$fail" != x""; then
136 if test x"${enable_strict_dependencies}" = x"yes"; then
137 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
139 AC_MSG_WARN([silently not building ]modname[.])
140 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
141 if test x"$headersuggestion" != x; then
142 AC_MSG_WARN([$headersuggestion])
144 if test x"$libsuggestion" != x; then
145 AC_MSG_WARN([$libsuggestion])
151 dnl extra argument: --with-edir
152 dnl If using Novell eDirectory, enable UP and Novell specific code
155 [ --with-edir enable Novell eDirectory integration. (default=no) ],
158 SMART_CFLAGS="$SMART_CFLAGS -DNOVELL_UNIVERSAL_PASSWORD"
159 edir="edir_ldapext.c"
166 ldap_ldflags=$SMART_LIBS
167 ldap_cflags=$SMART_CFLAGS
169 AC_SUBST(ldap_ldflags)
170 AC_SUBST(ldap_cflags)