From 458474d9d7ff552d697f8a85a61113582c86ae3a Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Tue, 6 Jul 2010 22:03:05 +0000 Subject: [PATCH] Accept slightly grotty coding in Makefile.global in order to keep the -L flag for src/port/ in front of any -L flags placed in LDFLAGS by configure. This undoes an L-flag-ordering change that I had thought would be safe, but seems to be making at least one buildfarm member fail --- the only theory for orca's failure that I can think of is that it's got an old copy of libpgport.a in /usr/lib. Also allow for LDFLAGS_SL to be set by contrib makefiles before they invoke Makefile.global. --- src/Makefile.global.in | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 47b2f5e491e..280578a4c39 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -1,5 +1,5 @@ # -*-makefile-*- -# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.263 2010/07/05 18:54:37 tgl Exp $ +# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.264 2010/07/06 22:03:05 tgl Exp $ #------------------------------------------------------------------------------ # All PostgreSQL makefiles include this file and use the variables it sets, @@ -235,9 +235,21 @@ OSSP_UUID_LIBS = @OSSP_UUID_LIBS@ LD = @LD@ with_gnu_ld = @with_gnu_ld@ ld_R_works = @ld_R_works@ -LDFLAGS = @LDFLAGS@ + +# We want -L for libpgport.a to be first in LDFLAGS. We also need LDFLAGS +# to be a "recursively expanded" variable, else adjustments to rpathdir +# don't work right. So we must NOT do LDFLAGS := something, meaning this has +# to be done first and elsewhere we must only do LDFLAGS += something. +ifdef PGXS + LDFLAGS = -L$(libdir) +else + LDFLAGS = -L$(top_builddir)/src/port +endif +LDFLAGS += @LDFLAGS@ + LDFLAGS_EX = @LDFLAGS_EX@ -LDFLAGS_SL = @LDFLAGS_SL@ +# LDFLAGS_SL might have already been assigned by calling makefile +LDFLAGS_SL += @LDFLAGS_SL@ LDREL = -r LDOUT = -o RANLIB = @RANLIB@ @@ -450,16 +462,11 @@ endif ########################################################################## # # substitute implementations of C library routines (see src/port/) +# note we already included -L.../src/port in LDFLAGS above LIBOBJS = @LIBOBJS@ LIBS := -lpgport $(LIBS) -# add location of libpgport.a to LDFLAGS -ifdef PGXS - LDFLAGS += -L$(libdir) -else - LDFLAGS += -L$(top_builddir)/src/port -endif # to make ws2_32.lib the last library, and always link with shfolder, # so SHGetFolderName isn't picked up from shell32.dll -- GitLab