From 8e579752192d61f034ccc0f4045d98123fcca909 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri, 19 Nov 2004 21:27:42 +0000
Subject: [PATCH] Clean up rpath handling for HPUX --- we can't use the
 cc-style rpath switch syntax when calling ld directly.

---
 src/Makefile.shlib          | 12 +++++++++---
 src/makefiles/Makefile.hpux |  4 ++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 1890182c800..6653b270e91 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -6,7 +6,7 @@
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -154,9 +154,15 @@ ifeq ($(PORTNAME), hpux)
     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
 
diff --git a/src/makefiles/Makefile.hpux b/src/makefiles/Makefile.hpux
index 4a1e551ec14..4c407105582 100644
--- a/src/makefiles/Makefile.hpux
+++ b/src/makefiles/Makefile.hpux
@@ -19,9 +19,9 @@ LIBS := -lxnet $(LIBS)
 # 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
-- 
GitLab