aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m455
-rw-r--r--configure.ac49
-rw-r--r--docs/KNOWN_BUGS4
-rw-r--r--lib/Makefile.netware1
-rw-r--r--lib/config-amigaos.h2
-rw-r--r--lib/config-mac.h2
-rw-r--r--lib/config-riscos.h3
-rw-r--r--lib/config-win32.h6
-rw-r--r--lib/config.dj3
-rw-r--r--lib/ldap.c24
-rw-r--r--packages/vms/config-vms.h3
11 files changed, 138 insertions, 14 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 552e6c810..6e62f988d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -766,3 +766,58 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
]) 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
+])
diff --git a/configure.ac b/configure.ac
index e04088b01..7fbb3c4f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -372,6 +372,55 @@ AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
)
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 **********************************************************************
diff --git a/docs/KNOWN_BUGS b/docs/KNOWN_BUGS
index 7cbb6280f..3634154d2 100644
--- a/docs/KNOWN_BUGS
+++ b/docs/KNOWN_BUGS
@@ -91,7 +91,3 @@ may have been fixed since this was written!
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).
diff --git a/lib/Makefile.netware b/lib/Makefile.netware
index 35c7932ce..a41656fbc 100644
--- a/lib/Makefile.netware
+++ b/lib/Makefile.netware
@@ -336,6 +336,7 @@ config.h: Makefile.netware
@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
diff --git a/lib/config-amigaos.h b/lib/config-amigaos.h
index 387adebf7..88779753d 100644
--- a/lib/config-amigaos.h
+++ b/lib/config-amigaos.h
@@ -57,6 +57,8 @@
#define USE_OPENSSL 1
#define USE_SSLEAY 1
+#define CURL_DISABLE_LDAP 1
+
#define OS "AmigaOS"
diff --git a/lib/config-mac.h b/lib/config-mac.h
index 8b0b0337c..d742452b1 100644
--- a/lib/config-mac.h
+++ b/lib/config-mac.h
@@ -36,6 +36,8 @@
# define USE_OPENSSL 1
#endif
+#define CURL_DISABLE_LDAP 1
+
#define HAVE_RAND_STATUS 1
#define HAVE_RAND_EGD 1
diff --git a/lib/config-riscos.h b/lib/config-riscos.h
index 85dec3ea4..be18c8693 100644
--- a/lib/config-riscos.h
+++ b/lib/config-riscos.h
@@ -388,3 +388,6 @@
#define HAVE_FIONBIO
+/* to disable LDAP */
+#define CURL_DISABLE_LDAP
+
diff --git a/lib/config-win32.h b/lib/config-win32.h
index a12394f2c..e17ef98ae 100644
--- a/lib/config-win32.h
+++ b/lib/config-win32.h
@@ -232,6 +232,12 @@
/* 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.*
*************************************************/
diff --git a/lib/config.dj b/lib/config.dj
index f2d38d3da..4b53bd9ae 100644
--- a/lib/config.dj
+++ b/lib/config.dj
@@ -93,6 +93,9 @@
#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)
diff --git a/lib/ldap.c b/lib/ldap.c
index 15c19b377..bb8a84933 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -110,7 +110,7 @@ typedef void * (*dynafunc)(void *input);
*/
#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
@@ -120,24 +120,26 @@ static int DynaOpen(const char **mod_name)
#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);
@@ -155,10 +157,12 @@ static void DynaClose(void)
dlclose(libldap);
libldap=NULL;
}
+#ifdef DL_LBER_FILE
if (liblber) {
dlclose(liblber);
liblber=NULL;
}
+#endif
#elif defined(WIN32)
if (libldap) {
FreeLibrary ((HMODULE)libldap);
diff --git a/packages/vms/config-vms.h b/packages/vms/config-vms.h
index 275f0f12e..3152a8ae9 100644
--- a/packages/vms/config-vms.h
+++ b/packages/vms/config-vms.h
@@ -274,3 +274,6 @@
/* Somewhere around 7.12.0 HAVE_INET_NTOP was introduced. */
#define HAVE_INET_NTOP 1
+
+/* to disable LDAP */
+#define CURL_DISABLE_LDAP 1