Have libpgport link before libpq so that PG client applications are more

immunte to changes in libpq's usage of pgport between major versions.

Backpatch to 8.0.X.
This commit is contained in:
Bruce Momjian 2005-03-25 18:18:41 +00:00
parent 42a00ef3b8
commit 7751c06852
14 changed files with 43 additions and 28 deletions

View File

@ -1,9 +1,9 @@
# $PostgreSQL: pgsql/contrib/dbase/Makefile,v 1.6 2004/08/20 20:13:02 momjian Exp $
# $PostgreSQL: pgsql/contrib/dbase/Makefile,v 1.6.4.1 2005/03/25 18:18:37 momjian Exp $
PROGRAM = dbf2pg
OBJS = dbf.o dbf2pg.o endian.o
PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq)
PG_LIBS = $(libpq_pgport)
# Uncomment this to provide charset translation
#PG_CPPFLAGS += -DHAVE_ICONV_H

View File

@ -1,10 +1,10 @@
# $PostgreSQL: pgsql/contrib/findoidjoins/Makefile,v 1.16 2004/08/20 20:13:03 momjian Exp $
# $PostgreSQL: pgsql/contrib/findoidjoins/Makefile,v 1.16.4.1 2005/03/25 18:18:37 momjian Exp $
PROGRAM = findoidjoins
OBJS = findoidjoins.o
PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq)
PG_LIBS = $(libpq_pgport)
SCRIPTS = make_oidjoins_check
DOCS = README.findoidjoins

View File

@ -1,10 +1,10 @@
# $PostgreSQL: pgsql/contrib/oid2name/Makefile,v 1.6 2004/08/20 20:13:05 momjian Exp $
# $PostgreSQL: pgsql/contrib/oid2name/Makefile,v 1.6.4.1 2005/03/25 18:18:38 momjian Exp $
PROGRAM = oid2name
OBJS = oid2name.o
PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq)
PG_LIBS = $(libpq_pgport)
DOCS = README.oid2name

View File

@ -2,7 +2,7 @@ PROGRAM = pg_autovacuum
OBJS = pg_autovacuum.o dllist.o
PG_CPPFLAGS = -I$(libpq_srcdir) -DFRONTEND
PG_LIBS = $(libpq)
PG_LIBS = $(libpq_pgport)
DOCS = README.pg_autovacuum

View File

@ -1,10 +1,10 @@
# $PostgreSQL: pgsql/contrib/pg_dumplo/Makefile,v 1.13 2004/08/20 20:13:05 momjian Exp $
# $PostgreSQL: pgsql/contrib/pg_dumplo/Makefile,v 1.13.4.1 2005/03/25 18:18:38 momjian Exp $
PROGRAM = pg_dumplo
OBJS = main.o lo_export.o lo_import.o utils.o
PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq)
PG_LIBS = $(libpq_pgport)
DOCS = README.pg_dumplo

View File

@ -1,10 +1,10 @@
# $PostgreSQL: pgsql/contrib/pgbench/Makefile,v 1.12 2004/08/20 20:13:06 momjian Exp $
# $PostgreSQL: pgsql/contrib/pgbench/Makefile,v 1.12.4.1 2005/03/25 18:18:39 momjian Exp $
PROGRAM = pgbench
OBJS = pgbench.o
PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq)
PG_LIBS = $(libpq_pgport)
DOCS = README.pgbench README.pgbench_jis

View File

@ -1,10 +1,10 @@
# $PostgreSQL: pgsql/contrib/vacuumlo/Makefile,v 1.13 2004/08/20 20:13:10 momjian Exp $
# $PostgreSQL: pgsql/contrib/vacuumlo/Makefile,v 1.13.4.1 2005/03/25 18:18:39 momjian Exp $
PROGRAM = vacuumlo
OBJS = vacuumlo.o
PG_CPPFLAGS = -I$(libpq_srcdir)
PG_LIBS = $(libpq)
PG_LIBS = $(libpq_pgport)
DOCS = README.vacuumlo

View File

@ -1,5 +1,5 @@
# -*-makefile-*-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.208.4.3 2005/03/24 23:54:01 tgl Exp $
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.208.4.4 2005/03/25 18:18:39 momjian Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
@ -306,8 +306,10 @@ libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
libpq_builddir = $(top_builddir)/src/interfaces/libpq
endif
# This is for use for libraries linking to libpq. Because libpqport
# isn't created with the same link flags as libpq, it can't be used.
libpq = -L$(libpq_builddir) -lpq
# If doing static linking, shared library dependency can't be
# used so we specify pthread libs for every usage of libpq
ifeq ($(enable_shared), no)
@ -320,6 +322,19 @@ libpq += $(PTHREAD_LIBS)
endif
endif
# Force clients to pull symbols from the non-shared library libpgport
# 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
libpq_pgport = -L$(libdir) -lpgport $(libpq)
else
libpq_pgport = -L$(top_builddir)/src/port -lpgport $(libpq)
endif
submake-libpq:
$(MAKE) -C $(libpq_builddir) all

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.48 2004/12/31 22:02:59 pgsql Exp $
# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.48.4.1 2005/03/25 18:18:39 momjian Exp $
#
#-------------------------------------------------------------------------
@ -21,7 +21,7 @@ OBJS= initdb.o $(WIN32RES)
all: submake-libpq submake-libpgport initdb
initdb: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
$(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
install: all installdirs
$(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X)

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/pg_ctl/Makefile,v 1.19 2004/12/31 22:03:05 pgsql Exp $
# $PostgreSQL: pgsql/src/bin/pg_ctl/Makefile,v 1.19.4.1 2005/03/25 18:18:40 momjian Exp $
#
#-------------------------------------------------------------------------
@ -21,7 +21,7 @@ OBJS= pg_ctl.o $(WIN32RES)
all: submake-libpq submake-libpgport pg_ctl
pg_ctl: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
$(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
install: all installdirs
$(INSTALL_PROGRAM) pg_ctl$(X) $(DESTDIR)$(bindir)/pg_ctl$(X)

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.59 2005/01/01 20:44:23 tgl Exp $
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.59.4.1 2005/03/25 18:18:40 momjian Exp $
#
#-------------------------------------------------------------------------
@ -25,13 +25,13 @@ EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
all: submake-libpq submake-libpgport submake-backend pg_dump pg_restore pg_dumpall
pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
$(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(EXTRA_OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
pg_dumpall: pg_dumpall.o dumputils.o $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(WIN32RES) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(WIN32RES) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
.PHONY: submake-backend
submake-backend:

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.52 2005/01/01 20:44:25 tgl Exp $
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.52.4.1 2005/03/25 18:18:40 momjian Exp $
#
#-------------------------------------------------------------------------
@ -29,7 +29,7 @@ FLEXFLAGS = -Cfe
all: submake-libpq submake-libpgport psql
psql: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
$(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
help.o: $(srcdir)/sql_help.h

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.32 2005/01/01 20:44:26 tgl Exp $
# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.32.4.1 2005/03/25 18:18:41 momjian Exp $
#
#-------------------------------------------------------------------------
@ -21,7 +21,7 @@ override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/
all: submake-libpq submake-backend $(PROGRAMS)
%: %.o $(WIN32RES)
$(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
$(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
createdb: createdb.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
createlang: createlang.o common.o print.o mbprint.o

View File

@ -7,7 +7,7 @@ top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
override LDLIBS := $(libpq) -lpgport $(LDLIBS)
override LDLIBS := $(libpq_pgport) $(LDLIBS)
PROGS = testlibpq testlibpq2 testlibpq3 testlibpq4 testlo