10e3d5408SPeter Wemm#!/bin/sh 20e3d5408SPeter Wemm############################################################################## 30e3d5408SPeter Wemm# Copyright (c) 1998 Free Software Foundation, Inc. # 40e3d5408SPeter Wemm# # 50e3d5408SPeter Wemm# Permission is hereby granted, free of charge, to any person obtaining a # 60e3d5408SPeter Wemm# copy of this software and associated documentation files (the "Software"), # 70e3d5408SPeter Wemm# to deal in the Software without restriction, including without limitation # 80e3d5408SPeter Wemm# the rights to use, copy, modify, merge, publish, distribute, distribute # 90e3d5408SPeter Wemm# with modifications, sublicense, and/or sell copies of the Software, and to # 100e3d5408SPeter Wemm# permit persons to whom the Software is furnished to do so, subject to the # 110e3d5408SPeter Wemm# following conditions: # 120e3d5408SPeter Wemm# # 130e3d5408SPeter Wemm# The above copyright notice and this permission notice shall be included in # 140e3d5408SPeter Wemm# all copies or substantial portions of the Software. # 150e3d5408SPeter Wemm# # 160e3d5408SPeter Wemm# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # 170e3d5408SPeter Wemm# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # 180e3d5408SPeter Wemm# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # 190e3d5408SPeter Wemm# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # 200e3d5408SPeter Wemm# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # 210e3d5408SPeter Wemm# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # 220e3d5408SPeter Wemm# DEALINGS IN THE SOFTWARE. # 230e3d5408SPeter Wemm# # 240e3d5408SPeter Wemm# Except as contained in this notice, the name(s) of the above copyright # 250e3d5408SPeter Wemm# holders shall not be used in advertising or otherwise to promote the sale, # 260e3d5408SPeter Wemm# use or other dealings in this Software without prior written # 270e3d5408SPeter Wemm# authorization. # 280e3d5408SPeter Wemm############################################################################## 290e3d5408SPeter Wemm# 300e3d5408SPeter Wemm# Author: Thomas E. Dickey <dickey@clark.net> 1996 310e3d5408SPeter Wemm# 320e3d5408SPeter Wemm# $Id: shlib,v 1.5 1998/05/31 00:29:38 mooney Exp $ 330e3d5408SPeter Wemm# Use this script as a wrapper when running executables linked to shared 340e3d5408SPeter Wemm# libraries on systems that use the $LD_LIBRARY_PATH variable and don't embed 350e3d5408SPeter Wemm# the soname's path within the linked executable (such as IRIX), e.g, 360e3d5408SPeter Wemm# 370e3d5408SPeter Wemm# shlib knight 380e3d5408SPeter Wemm# 390e3d5408SPeter Wemm# Setting LD_LIBRARY_PATH, overrides/supplements the loader's normal search 400e3d5408SPeter Wemm# path, and works on most systems. The drawback is that then the environment 410e3d5408SPeter Wemm# variable has to be set to run the programs within this directory tree. 420e3d5408SPeter Wemm# 430e3d5408SPeter Wemm# For Linux (and other systems using the GNU loader), we can use the rpath 440e3d5408SPeter Wemm# directive, which embeds the pathname of the library within the executable. 450e3d5408SPeter Wemm# Using the Linux loader's rpath directive introduces a constraint, since 460e3d5408SPeter Wemm# it's embedded into the binary, and means that the binary cannot be moved 470e3d5408SPeter Wemm# around (though it'll work if the $exec_prefix convention that puts the bin 480e3d5408SPeter Wemm# and lib directories under the same parent is followed). 490e3d5408SPeter Wemm# 500e3d5408SPeter Wemm# Using the actual soname (e.g., ../lib/libncurses.so) alone, is a more 510e3d5408SPeter Wemm# flexible solution; you can link without having to set the environment 520e3d5408SPeter Wemm# variable, and on some systems (IRIX) you can even run the resulting binaries 530e3d5408SPeter Wemm# without setting LD_LIBRARY_PATH. 540e3d5408SPeter Wemm# 550e3d5408SPeter Wemm# Using a conventional link, with -L and -l options on Linux results in a 560e3d5408SPeter Wemm# statically linked executable, which we don't want at all. 570e3d5408SPeter Wemm# 580e3d5408SPeter Wemm 590e3d5408SPeter Wemm# 600e3d5408SPeter Wemm# Make sure that we use the PATH that was set in run_tic.sh 610e3d5408SPeter Wemm# 620e3d5408SPeter Wemmif test X$NEWPATH != X ; then 630e3d5408SPeter Wemm PATH=$NEWPATH 640e3d5408SPeter Wemm export PATH 650e3d5408SPeter Wemmfi 660e3d5408SPeter Wemm 670e3d5408SPeter Wemmq="" 680e3d5408SPeter Wemmfor p in lib ../lib 690e3d5408SPeter Wemmdo 700e3d5408SPeter Wemm if test -d $p; then 710e3d5408SPeter Wemm q="$p" 720e3d5408SPeter Wemm fi 730e3d5408SPeter Wemmdone 740e3d5408SPeter Wemmif test -n "$q" ; then 750e3d5408SPeter Wemm if test -n "$LD_LIBRARY_PATH"; then 760e3d5408SPeter Wemm LD_LIBRARY_PATH="$q:$LD_LIBRARY_PATH" 770e3d5408SPeter Wemm else 780e3d5408SPeter Wemm LD_LIBRARY_PATH="$q" 790e3d5408SPeter Wemm fi 800e3d5408SPeter Wemm export LD_LIBRARY_PATH 810e3d5408SPeter Wemmfi 820e3d5408SPeter Wemmeval "$*" 83