From: Adrian Ho <ml+postgresql@03s.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17083: [PATCH] PostgreSQL fails to build with OpenLDAP 2.5.x
Date: Wed, 7 Jul 2021 15:54:59 +0800
Message-ID: <e78eb1f9-57b1-dae9-39c8-5dd72268be89@03s.net> (raw)
In-Reply-To: <1677203.1625582865@sss.pgh.pa.us>
References: <17083-a19190d9591946a7@postgresql.org>
<1666182.1625579201@sss.pgh.pa.us>
<cc729116-2a2d-9edd-a32d-4066b92e4a75@03s.net>
<1677203.1625582865@sss.pgh.pa.us>
On 6/7/21 10:47 pm, Tom Lane wrote:
> Looking at the Autoconf docs, what AC_SEARCH_LIBS is specified to do is
> "Prepend `-lLIBRARY' to `LIBS' for the first library found to contain
> FUNCTION". So I'd suggest
>
> * Save contents of LIBS and set it to empty
> * Run AC_SEARCH_LIBS
> * LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
> * Restore LIBS
>
> I think we have some instances of that pattern already.
Thanks, Tom, that turned out to only require one additional line, since
$LIBS is already being saved and restored around that block:
inline patch 1: configure.in (+10/-7 lines) download inline-1.patchdiff --git a/configure.in b/configure.inindex 14a6be6..842d61b 100644--- a/configure.in+++ b/configure.in@@ -1241,17 +1241,20 @@ fi
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])],- [$EXTRA_LDAP_LIBS])- LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
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])],+ # OpenLDAP 2.5 merged ldap_r with ldap+ LIBS=""+ AC_SEARCH_LIBS(ldap_simple_bind, [ldap_r ldap], [],+ [AC_MSG_ERROR([not found in any LDAP library])],
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
- LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"+ LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"+ LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
else
+ AC_CHECK_LIB(ldap, ldap_bind, [],+ [AC_MSG_ERROR([library 'ldap' is required for LDAP])],+ [$EXTRA_LDAP_LIBS])+ LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
fi
AC_CHECK_FUNCS([ldap_initialize])
--
Best Regards,
Adrian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: ml+postgresql@03s.net, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17083: [PATCH] PostgreSQL fails to build with OpenLDAP 2.5.x
In-Reply-To: <e78eb1f9-57b1-dae9-39c8-5dd72268be89@03s.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox