shlib revision 62449
150276Speter#!/bin/sh 250276Speter############################################################################## 362449Speter# Copyright (c) 1998,2000 Free Software Foundation, Inc. # 450276Speter# # 550276Speter# Permission is hereby granted, free of charge, to any person obtaining a # 650276Speter# copy of this software and associated documentation files (the "Software"), # 750276Speter# to deal in the Software without restriction, including without limitation # 850276Speter# the rights to use, copy, modify, merge, publish, distribute, distribute # 950276Speter# with modifications, sublicense, and/or sell copies of the Software, and to # 1050276Speter# permit persons to whom the Software is furnished to do so, subject to the # 1150276Speter# following conditions: # 1250276Speter# # 1350276Speter# The above copyright notice and this permission notice shall be included in # 1450276Speter# all copies or substantial portions of the Software. # 1550276Speter# # 1650276Speter# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 1750276Speter# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 1850276Speter# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 1950276Speter# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 2050276Speter# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 2150276Speter# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 2250276Speter# DEALINGS IN THE SOFTWARE. # 2350276Speter# # 2450276Speter# Except as contained in this notice, the name(s) of the above copyright # 2550276Speter# holders shall not be used in advertising or otherwise to promote the sale, # 2650276Speter# use or other dealings in this Software without prior written # 2750276Speter# authorization. # 2850276Speter############################################################################## 2950276Speter# 3050276Speter# Author: Thomas E. Dickey <dickey@clark.net> 1996 3150276Speter# 3262449Speter# $Id: shlib,v 1.6 2000/05/20 23:01:17 tom Exp $ 3350276Speter# Use this script as a wrapper when running executables linked to shared 3450276Speter# libraries on systems that use the $LD_LIBRARY_PATH variable and don't embed 3550276Speter# the soname's path within the linked executable (such as IRIX), e.g, 3650276Speter# 3750276Speter# shlib knight 3850276Speter# 3950276Speter# Setting LD_LIBRARY_PATH, overrides/supplements the loader's normal search 4050276Speter# path, and works on most systems. The drawback is that then the environment 4150276Speter# variable has to be set to run the programs within this directory tree. 4250276Speter# 4350276Speter# For Linux (and other systems using the GNU loader), we can use the rpath 4450276Speter# directive, which embeds the pathname of the library within the executable. 4550276Speter# Using the Linux loader's rpath directive introduces a constraint, since 4650276Speter# it's embedded into the binary, and means that the binary cannot be moved 4750276Speter# around (though it'll work if the $exec_prefix convention that puts the bin 4850276Speter# and lib directories under the same parent is followed). 4950276Speter# 5050276Speter# Using the actual soname (e.g., ../lib/libncurses.so) alone, is a more 5150276Speter# flexible solution; you can link without having to set the environment 5250276Speter# variable, and on some systems (IRIX) you can even run the resulting binaries 5350276Speter# without setting LD_LIBRARY_PATH. 5450276Speter# 5550276Speter# Using a conventional link, with -L and -l options on Linux results in a 5650276Speter# statically linked executable, which we don't want at all. 5750276Speter# 5862449Speter# Special cases: 5962449Speter# 6062449Speter# BeOS R4.5 uses $LIBRARY_PATH rather than $LD_LIBRARY_PATH. 6150276Speter 6250276Speter# 6350276Speter# Make sure that we use the PATH that was set in run_tic.sh 6450276Speter# 6550276Speterif test X$NEWPATH != X ; then 6650276Speter PATH=$NEWPATH 6750276Speter export PATH 6850276Speterfi 6950276Speter 7050276Speterq="" 7150276Speterfor p in lib ../lib 7250276Speterdo 7350276Speter if test -d $p; then 7450276Speter q="$p" 7550276Speter fi 7650276Speterdone 7750276Speterif test -n "$q" ; then 7850276Speter if test -n "$LD_LIBRARY_PATH"; then 7950276Speter LD_LIBRARY_PATH="$q:$LD_LIBRARY_PATH" 8062449Speter elif test -n "$LIBRARY_PATH" ; then 8162449Speter LIBRARY_PATH="$q:$LIBRARY_PATH" 8250276Speter else 8350276Speter LD_LIBRARY_PATH="$q" 8450276Speter fi 8550276Speter export LD_LIBRARY_PATH 8650276Speterfi 8750276Spetereval "$*" 88