Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m12Op-0003sA-Iu for pgsql-bugs@arkaria.postgresql.org; Wed, 07 Jul 2021 07:55:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m12Om-00020N-6T for pgsql-bugs@arkaria.postgresql.org; Wed, 07 Jul 2021 07:55:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m12Ol-0001zA-Ju for pgsql-bugs@lists.postgresql.org; Wed, 07 Jul 2021 07:55:11 +0000 Received: from bumble.birch.relay.mailchannels.net ([23.83.209.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m12Oi-0000Uj-1u for pgsql-bugs@lists.postgresql.org; Wed, 07 Jul 2021 07:55:10 +0000 X-Sender-Id: dreamhost|x-authsender|03s_mobile@tclish.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 85DA6321DA1; Wed, 7 Jul 2021 07:55:05 +0000 (UTC) Received: from pdx1-sub0-mail-a21.g.dreamhost.com (100-96-27-225.trex.outbound.svc.cluster.local [100.96.27.225]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 04D18321FE5; Wed, 7 Jul 2021 07:55:05 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|03s_mobile@tclish.org Received: from pdx1-sub0-mail-a21.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.27.225 (trex/6.3.3); Wed, 07 Jul 2021 07:55:05 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|03s_mobile@tclish.org X-MailChannels-Auth-Id: dreamhost X-Power-Suffer: 714276445ed44bc6_1625644505253_1662985876 X-MC-Loop-Signature: 1625644505253:1762520865 X-MC-Ingress-Time: 1625644505253 Received: from pdx1-sub0-mail-a21.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a21.g.dreamhost.com (Postfix) with ESMTP id A9949B74F5; Wed, 7 Jul 2021 00:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=03s.net; h=subject:to:cc :references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=03s.net; bh=qa7wRxkCj Tqzlguy80Zl33Xd8YQ=; b=fxPKMFzMuz6/KSLjGYrXyWXD9h9XETkAl55UOeeqf SBVfGLF5R9Og/KsHWsAfMLlcQhaht8in2URhIkxh3v5gbX+NBikuBDrk4tG3DCZ+ 7zcPC2NkxrhmQhPSguhXa7qbxfj7FomcJP0rkF9pe0egDFQrLYE9xKSdbGZ156Ta 5k= Received: from [192.168.99.35] (unknown [112.199.247.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: 03s_mobile@tclish.org) by pdx1-sub0-mail-a21.g.dreamhost.com (Postfix) with ESMTPSA id 81C1FB74EF; Wed, 7 Jul 2021 00:55:02 -0700 (PDT) Subject: Re: BUG #17083: [PATCH] PostgreSQL fails to build with OpenLDAP 2.5.x To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org References: <17083-a19190d9591946a7@postgresql.org> <1666182.1625579201@sss.pgh.pa.us> <1677203.1625582865@sss.pgh.pa.us> X-DH-BACKEND: pdx1-sub0-mail-a21 From: Adrian Ho Message-ID: Date: Wed, 7 Jul 2021 15:54:59 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <1677203.1625582865@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: diff --git a/configure.in b/configure.in index 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