From 5a33f7f18934e378efaae41fbc28ae5c6f75e610 Mon Sep 17 00:00:00 2001
From: Steven Knight <knight@baldmt.com>
Date: Mon, 2 Aug 2004 12:11:48 +0000
Subject: Add  support on IRIX.  (Chad Austin)

---
 doc/man/scons.1                  | 5 +++--
 src/CHANGES.txt                  | 3 ++-
 src/engine/SCons/Tool/sgilink.py | 7 +++++++
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/doc/man/scons.1 b/doc/man/scons.1
index 135e5f7..557db2c 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -5658,8 +5658,9 @@ General options passed to the Java RMI stub compiler.
 
 .IP RPATH
 A list of paths to search for shared libraries when running programs.
-Currently only used in the GNU linker.  Ignored on platforms and
-toolchains that don't support it.  Note that the paths added to RPATH
+Currently only used in the GNU linker (gnulink) and IRIX linker (sgilink).
+Ignored on platforms and toolchains that don't support it.
+Note that the paths added to RPATH
 are not transformed by
 .B scons
 in any way:  if you want an absolute
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 083d640..6550064 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -28,7 +28,8 @@ RELEASE 0.96 - XXX
   From Chad Austin and Christoph Wiedemann:
 
   - Add support for a $RPATH variable to supply a list of directories
-    to search for shared libraries when linking a program.
+    to search for shared libraries when linking a program.  Used by
+    the GNU and IRIX linkers (gnulink and sgilink).
 
   From Charles Crain:
 
diff --git a/src/engine/SCons/Tool/sgilink.py b/src/engine/SCons/Tool/sgilink.py
index 80cfcf4..85d9e30 100644
--- a/src/engine/SCons/Tool/sgilink.py
+++ b/src/engine/SCons/Tool/sgilink.py
@@ -46,5 +46,12 @@ def generate(env):
     env['LINK'] = env.Detect(linkers) or 'cc'
     env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared')
 
+    # __RPATH is set to $_RPATH in the platform specification if that
+    # platform supports it.
+    env.Append(LINKFLAGS=['$__RPATH'])
+    env['RPATHPREFIX'] = '-rpath '
+    env['RPATHSUFFIX'] = ''
+    env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}'
+
 def exists(env):
     return env.Detect(linkers)
-- 
cgit v0.12