]) dnl end of AC_DEFUN()
+
+dnl Determine the name of the library to pass to dlopen() based on the name
+dnl that would normally be given to AC_CHECK_LIB. The preprocessor symbol
+dnl given is set to the quoted library file name.
+dnl The standard dynamic library file name is first generated, based on the
+dnl current system type, then a search is performed for that file on the
+dnl standard dynamic library path. If it is a symbolic link, the destination
+dnl of the link is used as the file name, after stripping off any minor
+dnl version numbers. If a library file can't be found, a guess is made.
+dnl This macro assumes AC_PROG_LIBTOOL has been called and requires perl
+dnl to be available.
+dnl
+dnl CURL_DLLIB_NAME(VARIABLE, library_name)
+dnl e.g. CURL_DLLIB_NAME(LDAP_NAME, ldap) on a Linux system might result
+dnl in LDAP_NAME holding the string "libldap.so.2".
+
+AC_DEFUN([CURL_DLLIB_NAME],
+[
+AC_MSG_CHECKING([name of dynamic library $2])
+
+dnl Create the dynamic library name of the correct form for this platform
+DLGUESSLIB=`name=$2 eval echo "$libname_spec"`
+DLGUESSFILE=`libname=$DLGUESSLIB release="" major="" eval echo "$soname_spec"`
+
+if test "$cross_compiling" = yes; then
+ dnl Can't look at filesystem when cross-compiling
+ AC_DEFINE_UNQUOTED($1, "$DLGUESSFILE", [$2 dynamic library file])
+ AC_MSG_RESULT([$DLGUESSFILE (guess while cross-compiling)])
+else
+
+ DLFOUNDFILE=""
+ if test "$sys_lib_dlsearch_path_spec" ; then
+ for direc in $sys_lib_dlsearch_path_spec ; do
+ DLTRYFILE="$direc/$DLGUESSFILE"
+ dnl Find where the symbolic link for this name points
+ changequote(<<, >>)dnl
+ <<
+ DLFOUNDFILE=`perl -e 'use File::Basename; (basename(readlink($ARGV[0])) =~ /^(.*[^\d]\.\d+)[\d\.]*$/ && print ${1}) || exit 1;' "$DLTRYFILE" 2>&5`
+ >>
+ changequote([, ])dnl
+ if test "$?" -eq "0"; then
+ dnl Found the file link
+ break
+ fi
+ done
+ fi
+
+ if test -z "$DLFOUNDFILE" ; then
+ DLFOUNDFILE="$DLGUESSFILE"
+ fi
+
+ AC_DEFINE_UNQUOTED($1, "$DLFOUNDFILE", [$2 dynamic library file])
+ AC_MSG_RESULT($DLFOUNDFILE)
+fi
+])
AC_MSG_RESULT(no)
)
+dnl **********************************************************************
+dnl Check for the name of dynamic OpenLDAP libraries
+dnl **********************************************************************
+
+LDAPLIBNAME=""
+AC_ARG_WITH(ldap-lib,
+AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of dynamic ldap lib file]),
+ [LDAPLIBNAME="$withval"])
+
+LBERLIBNAME=""
+AC_ARG_WITH(lber-lib,
+AC_HELP_STRING([--with-lber-lib=libname],[Specify name of dynamic lber lib file]),
+ [LBERLIBNAME="$withval"])
+
+if test x$CURL_DISABLE_LDAP != x1 ; then
+
+ if test -z "$LDAPLIBNAME" ; then
+ case $host in
+ *-*-cygwin | *-*-mingw* | *-*-pw32*)
+ dnl Windows uses a single and unique OpenLDAP DLL name
+ LDAPLIBNAME="wldap32.dll"
+ LBERLIBNAME="no"
+ ;;
+ esac
+ fi
+
+ if test "$LDAPLIBNAME" ; then
+ AC_DEFINE_UNQUOTED(DL_LDAP_FILE, "$LDAPLIBNAME")
+ AC_MSG_CHECKING([name of dynamic library ldap])
+ AC_MSG_RESULT($LDAPLIBNAME)
+ else
+ dnl Try to find the right ldap library name for this system
+ CURL_DLLIB_NAME(DL_LDAP_FILE, ldap)
+ fi
+
+ if test "$LBERLIBNAME" ; then
+ dnl If name is "no" then don't define this variable at all
+ dnl (it's only needed if libldap.so's dependencies are broken).
+ if test "$LBERLIBNAME" != "no" ; then
+ AC_DEFINE_UNQUOTED(DL_LBER_FILE, "$LBERLIBNAME")
+ fi
+ AC_MSG_CHECKING([name of dynamic library lber])
+ AC_MSG_RESULT($LBERLIBNAME)
+ else
+ dnl Try to find the right lber library name for this system
+ CURL_DLLIB_NAME(DL_LBER_FILE, lber)
+ fi
+fi
+
dnl **********************************************************************
dnl Check for the presence of the winmm library.
dnl **********************************************************************
and havoc is what happens.
More details on this is found in this libcurl mailing list thread:
http://curl.haxx.se/mail/lib-2002-08/0000.html
-
-1. LDAP support requires that not only the OpenLDAP shared libraries be
- present at run time, but the development libraries (liblber.so and
- libldap.so) as well (not applicable to Windows).
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
+ @echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@
ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
else
#define USE_OPENSSL 1
#define USE_SSLEAY 1
+#define CURL_DISABLE_LDAP 1
+
#define OS "AmigaOS"
# define USE_OPENSSL 1
#endif
+#define CURL_DISABLE_LDAP 1
+
#define HAVE_RAND_STATUS 1
#define HAVE_RAND_EGD 1
#define HAVE_FIONBIO
+/* to disable LDAP */
+#define CURL_DISABLE_LDAP
+
/* use ioctlsocket() for non-blocking sockets */
#define HAVE_IOCTLSOCKET
+/* lber dynamic library file */
+/* #undef DL_LBER_FILE */
+
+/* ldap dynamic library file */
+#define DL_LDAP_FILE "wldap32.dll"
+
/*************************************************
* This section is for compiler specific defines.*
*************************************************/
#define USE_OPENSSL 1
#endif
+/* to disable LDAP */
+#define CURL_DISABLE_LDAP 1
+
/* Because djgpp <= 2.03 doesn't have snprintf() etc.
*/
#if (DJGPP_MINOR < 4)
*/
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) || defined(WIN32)
static void *libldap = NULL;
-#ifndef WIN32
+#if defined(DL_LBER_FILE)
static void *liblber = NULL;
#endif
#endif
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
if (libldap == NULL) {
/*
- * libldap.so should be able to resolve its dependency on
- * liblber.so automatically, but since it does not we will
+ * libldap.so can normally resolve its dependency on liblber.so
+ * automatically, but in broken installation it does not so
* handle it here by opening liblber.so as global.
*/
- *mod_name = "liblber.so";
+#ifdef DL_LBER_FILE
+ *mod_name = DL_LBER_FILE;
liblber = dlopen(*mod_name, DLOPEN_MODE);
+ if (!liblber)
+ return 0;
+#endif
/* Assume loading libldap.so will fail if loading of liblber.so failed
*/
- if (liblber) {
- *mod_name = "libldap.so";
- libldap = dlopen(*mod_name, RTLD_LAZY);
- }
+ *mod_name = DL_LDAP_FILE;
+ libldap = dlopen(*mod_name, RTLD_LAZY);
}
- return (libldap != NULL && liblber != NULL);
+ return (libldap != NULL);
#elif defined(WIN32)
- *mod_name = "wldap32.dll";
+ *mod_name = DL_LDAP_FILE;
if (!libldap)
libldap = (void*)LoadLibrary(*mod_name);
return (libldap != NULL);
dlclose(libldap);
libldap=NULL;
}
+#ifdef DL_LBER_FILE
if (liblber) {
dlclose(liblber);
liblber=NULL;
}
+#endif
#elif defined(WIN32)
if (libldap) {
FreeLibrary ((HMODULE)libldap);
/* Somewhere around 7.12.0 HAVE_INET_NTOP was introduced. */
#define HAVE_INET_NTOP 1
+
+/* to disable LDAP */
+#define CURL_DISABLE_LDAP 1