# LIBLDAP_CHECK_CONFIG ([DEFAULT-ACTION])
# ----------------------------------------------------------
# Checks for ldap. DEFAULT-ACTION is the string yes or no to
# specify whether to default to --with-ldap or --without-ldap.
# If not supplied, DEFAULT-ACTION is no.
# This macro #defines HAVE_LDAP if a required header files is
# found, and sets @LDAP_CPPFLAGS@, @LDAP_LDFLAGS@ and @LDAP_LIBS@
# to the necessary values.
# Users may override the detected values by doing something like:
# LDAP_LIBS="-lldap" LDAP_CPPFLAGS="-I/usr/myinclude" ./configure
# This macro is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
AC_DEFUN([LIBLDAP_TRY_LINK],
_save_ldap_cppflags="$CPPFLAGS"
_save_ldap_cflags="$CFLAGS"
_save_ldap_ldflags="$LDFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
printf("%p,%p", ldap_initialize, ldap_str2attributetype);
CPPFLAGS="$_save_ldap_cppflags"
CFLAGS="$_save_ldap_cflags"
LDFLAGS="$_save_ldap_ldflags"
unset _save_ldap_cppflags
[AS_IF([test "x$ldap_link" = "xyes"], [$5], [$6])]dnl
AC_DEFUN([LIBLDAP_CHECK_CONFIG],
If you want to check LDAP servers:
AS_HELP_STRING([--with-ldap@<:@=DIR@:>@],[Include LDAP support @<:@default=no@:>@. DIR is the LDAP base install directory, default is to search through a number of common places for the LDAP files.])],
[ if test "$withval" = "no"; then
elif test "$withval" = "yes"; then
],[_libldap_with=ifelse([$1],,[no],[$1])])
if test "x$_libldap_with" != x"no"; then
AC_MSG_CHECKING([for LDAP support of ldap.h])
if test "$_libldap_with" = "yes"; then
if test -f /usr/local/openldap/include/ldap.h; then
LDAP_INCDIR=/usr/local/openldap/include/
LDAP_LIBDIR=/usr/local/openldap/lib/
elif test -f /usr/include/ldap.h; then
elif test -f /usr/local/include/ldap.h; then
LDAP_INCDIR=/usr/local/include
LDAP_LIBDIR=/usr/local/lib