# Copyright (c) 1998, Regents of the University of California
 #
 # IDENTIFICATION
-#    $PostgreSQL: pgsql/src/Makefile.shlib,v 1.88 2004/11/17 17:08:15 tgl Exp $
+#    $PostgreSQL: pgsql/src/Makefile.shlib,v 1.89 2004/11/19 21:27:42 tgl Exp $
 #
 #-------------------------------------------------------------------------
 
     SHLIB_LINK     += `$(CC) $(LDFLAGS) -print-libgcc-file-name`
   endif
   ifeq ($(with_gnu_ld), yes)
-    LINK.shared        = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname) -Wl,+b -Wl,$(libdir)
+    LINK.shared        = $(CC) $(LDFLAGS) -shared -Wl,-h -Wl,$(soname)
   else
-    LINK.shared        = $(LD) +h $(soname) -b +b $(libdir)
+    # can't use the CC-syntax rpath pattern here
+    rpath =
+    ifeq ($(enable_rpath), yes)
+      LINK.shared  = $(LD) +h $(soname) -b +b $(rpathdir)
+    else
+      LINK.shared  = $(LD) +h $(soname) -b
+    endif
   endif
 endif
 
 
 # Set up rpath so that the executables don't need SHLIB_PATH to be set.
 # (Note: --disable-rpath is a really bad idea on this platform...)
 ifeq ($(with_gnu_ld), yes)
-   rpath = -Wl,-rpath,$(rpathdir)
+   rpath = -Wl,-rpath -Wl,$(rpathdir)
 else
-   rpath = -Wl,+b,$(rpathdir)
+   rpath = -Wl,+b -Wl,$(rpathdir)
 endif
 
 # catch null pointer dereferences