$NetBSD$

--- src/interfaces/ecpg/ecpglib/Makefile.orig	2011-09-27 10:46:19.000000000 +0000
+++ src/interfaces/ecpg/ecpglib/Makefile
@@ -34,7 +34,7 @@ ifneq ($(PORTNAME), win32)
 OBJS += thread.o
 endif
 
-SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) -lm $(PTHREAD_LIBS)
+SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) $(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS)
 
 ifeq ($(PORTNAME), win32)
 # Link to shfolder.dll instead of shell32.dll
