diff --git a/src/Makefile.global.in b/src/Makefile.global.in index a2e2fe7578d..fa9cbc456a1 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -574,13 +574,19 @@ endif libpq = -L$(libpq_builddir) -lpq # This macro is for use by client executables (not libraries) that use libpq. -# We force clients to pull symbols from the non-shared libraries libpgport +# We want clients to pull symbols from the non-shared libraries libpgport # and libpgcommon rather than pulling some libpgport symbols from libpq just # because libpq uses those functions too. This makes applications less # dependent on changes in libpq's usage of pgport. To do this we link to # pgport before libpq. This does cause duplicate -lpgport's to appear -# on client link lines. -ifdef PGXS +# on client link lines, since that also appears in $(LIBS). On platforms +# where we have symbol export control for libpq, the whole exercise is +# unnecessary because libpq won't expose any of these symbols. Currently, +# only macOS warns about duplicate library references, so we only suppress +# the duplicates on macOS. +ifeq ($(PORTNAME),darwin) +libpq_pgport = $(libpq) +else ifdef PGXS libpq_pgport = -L$(libdir) -lpgcommon -lpgport $(libpq) else libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)