Commit 42c17a6b authored by Tom Lane's avatar Tom Lane

Revise OpenLDAP configuration and linking to work on more platforms

than before.  Albe Laurenz (but editorialized heavily by me, so if it
doesn't work it's my fault).
parent bf6b92d6
This source diff could not be displayed because it is too large. You can view the blob instead.
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.473 2006/08/23 12:01:52 meskes Exp $ dnl $PostgreSQL: pgsql/configure.in,v 1.474 2006/09/09 03:15:40 tgl Exp $
dnl dnl
dnl Developers, please strive to achieve this order: dnl Developers, please strive to achieve this order:
dnl dnl
...@@ -709,14 +709,6 @@ if test "$with_pam" = yes ; then ...@@ -709,14 +709,6 @@ if test "$with_pam" = yes ; then
fi fi
if test "$with_ldap" = yes ; then
if test "$PORTNAME" != "win32"; then
AC_CHECK_LIB(ldap, ldap_bind, [], [AC_MSG_ERROR([library 'ldap' is required for LDAP])])
else
AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32' is required for LDAP])])
fi
fi
## ##
## Header files ## Header files
## ##
...@@ -1109,14 +1101,6 @@ AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r]) ...@@ -1109,14 +1101,6 @@ AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
PGAC_FUNC_GETPWUID_R_5ARG PGAC_FUNC_GETPWUID_R_5ARG
PGAC_FUNC_STRERROR_R_INT PGAC_FUNC_STRERROR_R_INT
# this will link libpq against libldap_r
if test "$with_ldap" = yes ; then
if test "$PORTNAME" != "win32"; then
AC_CHECK_LIB(ldap_r, ldap_simple_bind, [], [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])])
PTHREAD_LIBS="$PTHREAD_LIBS -lldap_r"
fi
fi
CFLAGS="$_CFLAGS" CFLAGS="$_CFLAGS"
LIBS="$_LIBS" LIBS="$_LIBS"
...@@ -1130,6 +1114,32 @@ AC_SUBST(PTHREAD_CFLAGS) ...@@ -1130,6 +1114,32 @@ AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_LIBS)
# We can test for libldap_r only after we know PTHREAD_LIBS
if test "$with_ldap" = yes ; then
_LIBS="$LIBS"
if test "$PORTNAME" != "win32"; then
AC_CHECK_LIB(ldap, ldap_bind, [], [AC_MSG_ERROR([library 'ldap' is required for LDAP])])
LDAP_LIBS_BE="-lldap"
if test "$enable_thread_safety" = yes; then
# on some platforms ldap_r fails to link without PTHREAD_LIBS
AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
[AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
[$PTHREAD_LIBS])
LDAP_LIBS_FE="-lldap_r"
else
LDAP_LIBS_FE="-lldap"
fi
else
AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32' is required for LDAP])])
LDAP_LIBS_FE="-lwldap32"
LDAP_LIBS_BE="-lwldap32"
fi
LIBS="$_LIBS"
fi
AC_SUBST(LDAP_LIBS_FE)
AC_SUBST(LDAP_LIBS_BE)
# This test makes sure that run tests work at all. Sometimes a shared # This test makes sure that run tests work at all. Sometimes a shared
# library is found by the linker, but the runtime linker can't find it. # library is found by the linker, but the runtime linker can't find it.
# This check should come after all modifications of compiler or linker # This check should come after all modifications of compiler or linker
......
# -*-makefile-*- # -*-makefile-*-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.226 2006/08/23 12:01:52 meskes Exp $ # $PostgreSQL: pgsql/src/Makefile.global.in,v 1.227 2006/09/09 03:15:40 tgl Exp $
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets, # All PostgreSQL makefiles include this file and use the variables it sets,
...@@ -219,6 +219,8 @@ DTRACEFLAGS = @DTRACEFLAGS@ ...@@ -219,6 +219,8 @@ DTRACEFLAGS = @DTRACEFLAGS@
# Linking # Linking
LIBS = @LIBS@ LIBS = @LIBS@
LDAP_LIBS_FE = @LDAP_LIBS_FE@
LDAP_LIBS_BE = @LDAP_LIBS_BE@
LD = @LD@ LD = @LD@
with_gnu_ld = @with_gnu_ld@ with_gnu_ld = @with_gnu_ld@
ld_R_works = @ld_R_works@ ld_R_works = @ld_R_works@
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/backend/Makefile,v 1.118 2006/08/16 14:57:37 petere Exp $ # $PostgreSQL: pgsql/src/backend/Makefile,v 1.119 2006/09/09 03:15:40 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -25,8 +25,8 @@ endif ...@@ -25,8 +25,8 @@ endif
OBJS = $(SUBSYSOBJS) $(LOCALOBJS) $(top_builddir)/src/port/libpgport_srv.a OBJS = $(SUBSYSOBJS) $(LOCALOBJS) $(top_builddir)/src/port/libpgport_srv.a
# We put libpgport into OBJS, so remove it from LIBS # We put libpgport into OBJS, so remove it from LIBS; also add libldap
LIBS := $(filter-out -lpgport, $(LIBS)) LIBS := $(filter-out -lpgport, $(LIBS)) $(LDAP_LIBS_BE)
# The backend doesn't need everything that's in LIBS, however # The backend doesn't need everything that's in LIBS, however
LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS)) LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))
......
...@@ -223,6 +223,9 @@ ...@@ -223,6 +223,9 @@
/* Define to 1 if you have the `ldap' library (-lldap). */ /* Define to 1 if you have the `ldap' library (-lldap). */
#undef HAVE_LIBLDAP #undef HAVE_LIBLDAP
/* Define to 1 if you have the `ldap_r' library (-lldap_r). */
#undef HAVE_LIBLDAP_R
/* Define to 1 if you have the `pam' library (-lpam). */ /* Define to 1 if you have the `pam' library (-lpam). */
#undef HAVE_LIBPAM #undef HAVE_LIBPAM
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.147 2006/07/27 13:20:24 momjian Exp $ # $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.148 2006/09/09 03:15:40 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -57,12 +57,12 @@ endif ...@@ -57,12 +57,12 @@ endif
# shared library link. (The order in which you list them here doesn't # shared library link. (The order in which you list them here doesn't
# matter.) # matter.)
ifneq ($(PORTNAME), win32) ifneq ($(PORTNAME), win32)
SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(PTHREAD_LIBS) SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(LDAP_LIBS_FE) $(PTHREAD_LIBS)
else else
SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl $(PTHREAD_LIBS), $(LIBS)) SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE)
endif endif
ifeq ($(PORTNAME), win32) ifeq ($(PORTNAME), win32)
SHLIB_LINK += -lshfolder -lwsock32 -lws2_32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32 -lwldap32, $(LIBS)) SHLIB_LINK += -lshfolder -lwsock32 -lws2_32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS))
endif endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment