SMART_CLFAGS=
if test x$with_[]modname != xno; then
+ dnl ############################################################
+ dnl # Check for compiler
+ dnl ############################################################
AC_PROG_CC
- AC_CHECK_LIB(resolv, inet_aton)
+ dnl ############################################################
+ dnl # Check for command line options
+ dnl ############################################################
dnl extra argument: --with-rlm-ldap-lib-dir
rlm_ldap_lib_dir=
AC_ARG_WITH(rlm-ldap-lib-dir,
- [ --with-rlm-ldap-lib-dir=DIR Directory for LDAP library files []],
+ [ --with-rlm-ldap-lib-dir=DIR directory for LDAP library files []],
[ case "$withval" in
no)
AC_MSG_ERROR(Need rlm-ldap-lib-dir)
)
dnl extra argument: --with-rlm-ldap-include-dir
- rlm_ldap_inc_dir=
+ rlm_ldap_include_dir=
AC_ARG_WITH(rlm-ldap-include-dir,
- [ --with-rlm-ldap-include-dir=DIR Directory for LDAP include files []],
+ [ --with-rlm-ldap-include-dir=DIR directory for LDAP include files []],
[ case "$withval" in
no)
AC_MSG_ERROR(Need rlm-ldap-include-dir)
esac ]
)
- smart_try_dir=$rlm_ldap_include_dir
- FR_SMART_CHECK_INCLUDE(lber.h)
- if test "$ac_cv_header_lber_h" != "yes"; then
- fail="$fail lber.h"
- fi
- FR_SMART_CHECK_INCLUDE(ldap.h)
- if test "$ac_cv_header_ldap_h" != "yes"; then
- fail="$fail ldap.h"
- fi
- if test "x$fail" = "x"; then
- SMART_CFLAGS="$SMART_CFLAGS -I$rlm_ldap_include_dir"
+ dnl extra argument: --enable-shared --disable-shared
+ AC_ENABLE_SHARED
+
+ dnl OpenLDAP doesn't provide an autoconf test for their libldap,
+ dnl and we can't reasonably check for all the dependancies for
+ dnl every version and every set of options.
+ if test "x$enable_shared" = "xno"; then
+ AC_MSG_WARN(Static linking with libldap will probably result in unresolved symbols.)
fi
- FR_SMART_CHECK_LIB(sasl, sasl_encode)
- FR_SMART_CHECK_LIB(crypto, DH_new)
- FR_SMART_CHECK_LIB(ssl, SSL_new)
+ dnl extra argument: --with-threads
+ rlm_ldap_with_threads=yes
+ AC_ARG_WITH(threads,
+ [ --with-threads use threads, if available. (default=yes) ],
+ [ case "$withval" in
+ no)
+ rlm_ldap_with_threads=no
+ ;;
+ *)
+ ;;
+ esac ])
+
+ dnl ############################################################
+ dnl # Check for libraries
+ dnl ############################################################
+
+ dnl pthread stuff is usually in -lpthread
+ dnl or in -lc_r, on *BSD
+ if test "x$rlm_ldap_with_threads" = "xyes"; then
+ AC_CHECK_LIB(pthread, pthread_create,
+ [ LIBS="-lpthread $LIBS" ],
+ AC_CHECK_LIB(c_r, pthread_create,
+ [ LIBS="-lc_r $LIBS" ],
+ [ rlm_ldap_with_threads="no" ]
+ )
+ )
+ fi
+ dnl Try only "-lldap_r" or "-lldap"
+ dnl Static linking will probably not work, but nobody ever
+ dnl complained about it.
smart_try_dir=$rlm_ldap_lib_dir
- FR_SMART_CHECK_LIB(lber, ber_init)
- if test "x$ac_cv_lib_lber_ber_init" != "xyes"; then
- fail="$fail liblber"
- else
- if test "x$ac_cv_header_pthread_h" = "xyes"; then
- FR_SMART_CHECK_LIB(ldap_r, ldap_init)
- if test "x$ac_cv_lib_ldap_r_ldap_init" != "xyes"; then
- fail="$fail libldap_r"
- else
- libldap=ldap_r
- fi
- else
- FR_SMART_CHECK_LIB(ldap, ldap_init)
- if test "x$ac_cv_lib_ldap_ldap_init" != "xyes"; then
- fail="$fail libldap"
- else
- libldap=ldap
+ if test "x$rlm_ldap_with_threads" = "xyes"; then
+ FR_SMART_CHECK_LIB(ldap_r, ldap_init)
+ if test "x$ac_cv_lib_ldap_r_ldap_init" != "xyes"; then
+ fail="$fail libldap_r"
fi
- fi
- fi
-
- if test x"$libldap" != "x"; then
- SMART_LIBS="$SMART_LIBS -L$rlm_ldap_lib_dir"
+ else
+ FR_SMART_CHECK_LIB(ldap, ldap_init)
+ if test "x$ac_cv_lib_ldap_ldap_init" != "xyes"; then
+ fail="$fail libldap"
+ fi
+ fi
- FR_SMART_CHECK_LIB("$libldap", ldap_start_tls_s)
+ dnl ############################################################
+ dnl # Check for header files
+ dnl ############################################################
- if test "x${ac_cv_lib_ldap_ldap_start_tls_s}${ac_cv_lib_ldap_r_ldap_start_tls_s}" != "x"; then
- SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_START_TLS"
- fi
-
- FR_SMART_CHECK_LIB("$libldap", ldap_initialize)
+ smart_try_dir=$rlm_ldap_include_dir
+ FR_SMART_CHECK_INCLUDE(ldap.h)
+ if test "$ac_cv_header_ldap_h" != "yes"; then
+ fail="$fail ldap.h"
+ fi
- if test "x${ac_cv_lib_ldap_ldap_initialize}${ac_cv_lib_ldap_r_ldap_initialize}" != "x"; then
- SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_INITIALIZE"
- fi
-
- FR_SMART_CHECK_LIB("$libldap", ldap_int_tls_config)
+ dnl ############################################################
+ dnl # Check for library functions
+ dnl ############################################################
- if test "x${ac_cv_lib_ldap_ldap_int_tls_config}${ac_cv_lib_ldap_r_ldap_int_tls_config}" != "x"; then
- SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_INT_TLS_CONFIG"
- fi
+ if test "x$fail" = "x"; then
+ AC_CHECK_FUNC(ldap_start_tls_s,
+ [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_START_TLS" ])
+ AC_CHECK_FUNC(ldap_initialize,
+ [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_INITIALIZE" ])
+ AC_CHECK_FUNC(ldap_int_tls_config,
+ [ SMART_CFLAGS="$SMART_CFLAGS -DHAVE_LDAP_INT_TLS_CONFIG" ])
fi
-
targetname=modname
else
targetname=
AC_MSG_WARN([silently not building ]modname[.])
AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
if test x"$headersuggestion" != x; then
- AC_MSG_WARN([$headersuggestion])
+ AC_MSG_WARN([$headersuggestion])
fi
if test x"$libsuggestion" != x; then
- AC_MSG_WARN([$libsuggestion])
+ AC_MSG_WARN([$libsuggestion])
fi
targetname=""
fi
dnl If using Novell eDirectory, enable UP and Novell specific code
WITH_EDIRECTORY=no
AC_ARG_WITH(edir,
-[ --with-edir Enable Novell eDirectory integration. (default=no) ],
+[ --with-edir enable Novell eDirectory integration. (default=no) ],
[ case "$withval" in
yes)
- SMART_CFLAGS="$SMART_CFLAGS -DNOVELL_UNIVERSAL_PASSWORD "
+ SMART_CFLAGS="$SMART_CFLAGS -DNOVELL_UNIVERSAL_PASSWORD"
edir="edir_ldapext.c"
;;
*)