Commit 205f8b26 authored by Dan Fandrich's avatar Dan Fandrich
Browse files

Fixed LDAP library file name bug (KNOWN_BUGS #1). configure now auto-detects

the correct dynamic library names by default, and provides override switches
--with-ldap-lib, --with-lber-lib and --without-lber-lib.  Added
CURL_DISABLE_LDAP to platform-specific config files to disable LDAP
support on those platforms that probably don't have dynamic OpenLDAP
libraries available to avoid compile errors.
parent c4ce9ac4
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
@@ -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
])
+49 −0
Original line number Diff line number Diff line
@@ -371,6 +371,55 @@ AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
       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 **********************************************************************
+0 −4
Original line number Diff line number Diff line
@@ -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).
+1 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@

#define USE_OPENSSL 1
#define USE_SSLEAY 1
#define CURL_DISABLE_LDAP 1


#define OS "AmigaOS"

Loading