Re: [HACKERS] Fix linking of OpenLDAP libraries - Mailing list pgsql-patches

From Albe Laurenz
Subject Re: [HACKERS] Fix linking of OpenLDAP libraries
Date
Msg-id 52EF20B2E3209443BC37736D00C3C1380A4019FE@EXADV1.host.magwien.gv.at
Whole thread Raw
Responses Re: [HACKERS] Fix linking of OpenLDAP libraries  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] Fix linking of OpenLDAP libraries  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
>> I have realized that my modifications in configure.in and
>> src/interfaces/libpq/Makefile to link libpq against
>> OpenLDAP are buggy.
>>
>> Here is a proposed patch to fix it.

[...]

>>   # The backend doesn't need everything that's in LIBS, however
>> ! LIBS := $(filter-out -lz -lreadline -ledit -ltermcap
>>          -lncurses -lcurses -lldap_r $(PTHREAD_LIBS), $(LIBS))
>
> This seems pretty risky.  What if PTHREAD_LIBS contains -L switches?
> They'd get removed even if needed for other libraries.
>
> It would probably be safer not to put LDAP into LIBS at all,
> but invent two new macros for configure to set, say LDAP_LIBS
> and LDAP_LIBS_R, and add these to the link lines in the backend
> and libpq respectively.

Here is a new patch that replaces the previous one; it adds two
macros LDAP_LIBS_FE and LDAP_LIBS_BE for frontend and backend,
respectively.

I did not only add them to the Makefile for interfaces/libpq,
but also everywhere something is linked against libpq in case
somebody links static.
I don't know if that's necessary, or if static builds are
supported - if not, the changes to those Makefiles should
perhaps not be applied.

Tested on Linux, AIX and Windows.

Yours,
Laurenz Albe

pgsql-patches by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: [HACKERS] Template0 age is increasing speedily.
Next
From: Martijn van Oosterhout
Date:
Subject: Re: [HACKERS] Backend SSL configuration enhancement