--- postgresql-8.0.3/src/interfaces/ecpg/compatlib/Makefile.fix	2005-03-13 14:04:45.000000000 -0800
+++ postgresql-8.0.3/src/interfaces/ecpg/compatlib/Makefile	2005-07-06 07:22:22.000000000 -0700
@@ -20,8 +20,8 @@
 override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) \
 	-I$(top_srcdir)/src/include/utils $(CPPFLAGS)
 override CFLAGS += $(PTHREAD_CFLAGS)
-SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) \
-	$(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
+SHLIB_LINK_PRE_USR_LIB = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq)
+SHLIB_LINK = $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
 
 OBJS= informix.o
 
@@ -30,6 +30,8 @@
 # Shared library stuff
 include $(top_srcdir)/src/Makefile.shlib
 
+SHLIB_LINK := $(SHLIB_LINK_PRE_USR_LIB) $(SHLIB_LINK)
+
 install: all installdirs install-lib
 
 installdirs:
--- postgresql-8.0.3/src/interfaces/ecpg/ecpglib/Makefile.fix	2005-03-13 14:04:45.000000000 -0800
+++ postgresql-8.0.3/src/interfaces/ecpg/ecpglib/Makefile	2005-07-06 07:30:24.000000000 -0700
@@ -27,8 +27,8 @@
 OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
 	connect.o misc.o path.o exec.o
 
-SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \
-	$(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
+SHLIB_LINK_PRE_USR_LIB = -L../pgtypeslib -lpgtypes $(libpq)
+SHLIB_LINK = $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
 
 ifeq ($(PORTNAME), win32)
 # Link to shfolder.dll instead of shell32.dll
@@ -40,6 +40,8 @@
 # Shared library stuff
 include $(top_srcdir)/src/Makefile.shlib
 
+SHLIB_LINK := $(SHLIB_LINK_PRE_USR_LIB) $(SHLIB_LINK)
+
 # We use some port modules verbatim, but since we need to
 # compile with appropriate options to build a shared lib, we can't
 # necessarily use the same object files as the backend uses. Instead,
