1997-10-02 23:05:46 +00:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# ld_lib_path.sh
|
|
|
|
#
|
2001-07-06 09:37:11 +00:00
|
|
|
# Set up the LD_LIBRARY_PATH (or similar env variable for your system)
|
1997-10-02 23:05:46 +00:00
|
|
|
#
|
2002-04-04 14:26:03 +00:00
|
|
|
# Copyright (C) 1997-2002 Free Software Foundation, Inc.
|
1997-10-02 23:05:46 +00:00
|
|
|
#
|
|
|
|
# Author: Scott Christley <scottc@net-community.com>
|
1997-10-13 23:30:17 +00:00
|
|
|
# Author: Ovidiu Predescu <ovidiu@net-community.com>
|
2002-04-04 15:55:07 +00:00
|
|
|
# Rewrite: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
# Author: Nicola Pero <n.pero@mi.flashnet.it>
|
2002-04-04 14:26:03 +00:00
|
|
|
#
|
1997-10-02 23:05:46 +00:00
|
|
|
# This file is part of the GNUstep Makefile Package.
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public
|
|
|
|
# License along with this library; see the file COPYING.LIB.
|
|
|
|
# If not, write to the Free Software Foundation,
|
2005-05-22 03:20:14 +00:00
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1997-10-02 23:05:46 +00:00
|
|
|
#
|
|
|
|
|
2002-04-04 14:26:03 +00:00
|
|
|
# This file is sourced. This means extra care is needed when changing
|
|
|
|
# it. Please read the comments on GNUstep.sh.in before touching it.
|
|
|
|
|
1997-10-02 23:05:46 +00:00
|
|
|
# The first (and only) parameter to this script is the canonical
|
1997-10-28 19:00:28 +00:00
|
|
|
# operating system name.
|
1997-10-13 23:30:17 +00:00
|
|
|
|
|
|
|
host_os=$GNUSTEP_HOST_OS
|
|
|
|
|
|
|
|
if [ -z "$host_os" ]; then
|
|
|
|
host_os=$1
|
|
|
|
fi
|
|
|
|
|
2002-04-04 15:38:21 +00:00
|
|
|
|
|
|
|
old_IFS="$IFS"
|
|
|
|
IFS=:
|
|
|
|
lib_paths=
|
2004-04-02 07:28:02 +00:00
|
|
|
fw_paths=
|
2002-06-19 03:46:08 +00:00
|
|
|
for dir in $GNUSTEP_PATHLIST; do
|
2002-04-04 15:38:21 +00:00
|
|
|
|
2004-04-02 07:28:02 +00:00
|
|
|
# prepare the path_fragment for libraries and this dir
|
2002-04-04 15:38:21 +00:00
|
|
|
if [ -z "$GNUSTEP_FLATTENED" ]; then
|
2003-04-28 02:29:49 +00:00
|
|
|
path_fragment="$dir/Library/Libraries/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO:$dir/Library/Libraries/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS"
|
2002-04-04 15:38:21 +00:00
|
|
|
else
|
2003-04-28 02:29:49 +00:00
|
|
|
path_fragment="$dir/Library/Libraries"
|
2002-04-04 15:38:21 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Append the path_fragment to lib_paths
|
|
|
|
if [ -z "$lib_paths" ]; then
|
|
|
|
lib_paths="$path_fragment"
|
|
|
|
else
|
|
|
|
lib_paths="$lib_paths:$path_fragment"
|
|
|
|
fi
|
|
|
|
|
2004-04-02 07:28:02 +00:00
|
|
|
# prepare the path_fragment for frameworks and this dir
|
|
|
|
path_fragment="$dir/Library/Frameworks"
|
|
|
|
|
|
|
|
# Append the path_fragment to fw_paths
|
|
|
|
if [ -z "$fw_paths" ]; then
|
|
|
|
fw_paths="$path_fragment"
|
|
|
|
else
|
|
|
|
fw_paths="$fw_paths:$path_fragment"
|
|
|
|
fi
|
|
|
|
|
2002-04-04 15:38:21 +00:00
|
|
|
unset path_fragment
|
|
|
|
|
|
|
|
done
|
2002-04-12 00:52:46 +00:00
|
|
|
IFS="$old_IFS"
|
2002-04-04 15:38:21 +00:00
|
|
|
unset old_IFS
|
|
|
|
unset dir
|
|
|
|
|
1999-09-24 19:15:22 +00:00
|
|
|
|
|
|
|
if [ -n "$additional_library_paths" ]; then
|
2002-04-04 15:29:45 +00:00
|
|
|
old_IFS="$IFS"
|
|
|
|
IFS="
|
|
|
|
"
|
2002-04-04 14:26:03 +00:00
|
|
|
additional=""
|
1999-09-24 19:15:22 +00:00
|
|
|
for dir in $additional_library_paths; do
|
|
|
|
additional="${additional}${dir}:"
|
|
|
|
done
|
2002-01-11 12:35:05 +00:00
|
|
|
unset dir
|
2002-04-04 14:26:03 +00:00
|
|
|
|
|
|
|
lib_paths="${additional}${lib_paths}"
|
2002-04-04 15:29:45 +00:00
|
|
|
|
2002-04-04 14:26:03 +00:00
|
|
|
unset additional
|
2002-04-04 15:29:45 +00:00
|
|
|
IFS="$old_IFS"
|
|
|
|
unset old_IFS
|
1999-09-24 19:15:22 +00:00
|
|
|
fi
|
|
|
|
|
2004-04-02 07:28:02 +00:00
|
|
|
if [ -n "$additional_framework_paths" ]; then
|
|
|
|
old_IFS="$IFS"
|
|
|
|
IFS="
|
|
|
|
"
|
|
|
|
additional=""
|
|
|
|
for dir in $additional_framework_paths; do
|
|
|
|
additional="${additional}${dir}:"
|
|
|
|
done
|
|
|
|
unset dir
|
|
|
|
|
|
|
|
fw_paths="${additional}${fw_paths}"
|
|
|
|
|
|
|
|
unset additional
|
|
|
|
IFS="$old_IFS"
|
|
|
|
unset old_IFS
|
|
|
|
fi
|
|
|
|
|
1997-10-13 23:30:17 +00:00
|
|
|
case "$host_os" in
|
1997-10-02 23:05:46 +00:00
|
|
|
|
1997-10-13 23:30:17 +00:00
|
|
|
*nextstep4*)
|
1998-09-14 14:54:23 +00:00
|
|
|
if [ -z "$DYLD_LIBRARY_PATH" ]; then
|
2002-12-31 04:16:16 +00:00
|
|
|
DYLD_LIBRARY_PATH="$lib_paths"
|
|
|
|
else
|
|
|
|
if ( echo ${DYLD_LIBRARY_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
|
|
|
|
DYLD_LIBRARY_PATH="$lib_paths:$DYLD_LIBRARY_PATH"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
export DYLD_LIBRARY_PATH
|
|
|
|
;;
|
|
|
|
|
|
|
|
*darwin*)
|
|
|
|
if [ -z "$DYLD_LIBRARY_PATH" ]; then
|
1999-09-24 19:15:22 +00:00
|
|
|
DYLD_LIBRARY_PATH="$lib_paths"
|
1998-08-20 17:48:46 +00:00
|
|
|
else
|
1999-09-24 19:15:22 +00:00
|
|
|
if ( echo ${DYLD_LIBRARY_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
|
|
|
|
DYLD_LIBRARY_PATH="$lib_paths:$DYLD_LIBRARY_PATH"
|
|
|
|
fi
|
1998-08-20 17:48:46 +00:00
|
|
|
fi
|
1997-12-05 02:09:12 +00:00
|
|
|
export DYLD_LIBRARY_PATH
|
2004-08-24 16:46:08 +00:00
|
|
|
|
|
|
|
# The code below has been temporarily removed, because...
|
2005-04-15 22:48:30 +00:00
|
|
|
# Frameworks in GNUstep-make are supported by creating a link like
|
|
|
|
#
|
|
|
|
# Libraries/libMyFramework.dylib ->
|
|
|
|
# Frameworks/MyFramework.framework/Versions/Current/libMyFramework.dylib,
|
|
|
|
#
|
|
|
|
# to mitigate the fact that FSF GCC does not support a -framework flag.
|
|
|
|
#
|
|
|
|
# On Darwin, however, we partially emulate -framework by setting the
|
|
|
|
# "install_name" to the framework name during linking. The dynamic
|
|
|
|
# linker (dyld) is smart enough to find the framework under this name,
|
|
|
|
# but only if DYLD_FRAMEWORK_PATH is set (unless we set the
|
|
|
|
# "install_name" to an absolute path, which we don't). We'd really like
|
|
|
|
# to fully support -framework, though.
|
|
|
|
#
|
|
|
|
# Use otool -L MyApplication.app/MyApplication, for instance, to see
|
|
|
|
# how the shared libraries/frameworks are linked.
|
2004-08-24 16:46:08 +00:00
|
|
|
#
|
|
|
|
# if [ "$LIBRARY_COMBO" = "apple-apple-apple" -o \
|
2005-04-15 22:48:30 +00:00
|
|
|
# "$LIBRARY_COMBO" = "apple" ]; then
|
2004-08-24 16:46:08 +00:00
|
|
|
|
2004-06-07 14:54:18 +00:00
|
|
|
if [ -z "$DYLD_FRAMEWORK_PATH" ]; then
|
|
|
|
DYLD_FRAMEWORK_PATH="$fw_paths"
|
|
|
|
else
|
|
|
|
if ( echo ${DYLD_FRAMEWORK_PATH}|
|
|
|
|
fgrep -v "${fw_paths}" >/dev/null ); then
|
|
|
|
DYLD_FRAMEWORK_PATH="$fw_paths:$DYLD_FRAMEWORK_PATH"
|
2004-04-02 07:28:02 +00:00
|
|
|
fi
|
|
|
|
fi
|
2004-06-07 14:54:18 +00:00
|
|
|
export DYLD_FRAMEWORK_PATH;;
|
1997-10-02 23:05:46 +00:00
|
|
|
|
2000-04-06 15:01:12 +00:00
|
|
|
*hpux*)
|
|
|
|
if [ -z "$SHLIB_PATH" ]; then
|
|
|
|
SHLIB_PATH="$lib_paths"
|
|
|
|
else
|
|
|
|
if ( echo ${SHLIB_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
|
|
|
|
SHLIB_PATH="$lib_paths:$SHLIB_PATH"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
export SHLIB_PATH;
|
|
|
|
if [ -z "$LD_LIBRARY_PATH" ]; then
|
|
|
|
LD_LIBRARY_PATH="$lib_paths"
|
|
|
|
else
|
2000-11-15 05:03:14 +00:00
|
|
|
if ( echo ${LD_LIBRARY_PATH}| grep -v "${lib_paths}" >/dev/null ); then
|
2000-04-06 15:01:12 +00:00
|
|
|
LD_LIBRARY_PATH="$lib_paths:$LD_LIBRARY_PATH"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
export LD_LIBRARY_PATH;;
|
|
|
|
|
1997-10-13 23:30:17 +00:00
|
|
|
*)
|
1998-09-14 14:54:23 +00:00
|
|
|
if [ -z "$LD_LIBRARY_PATH" ]; then
|
1999-09-24 19:15:22 +00:00
|
|
|
LD_LIBRARY_PATH="$lib_paths"
|
1998-08-20 17:48:46 +00:00
|
|
|
else
|
2000-11-15 05:03:14 +00:00
|
|
|
if ( echo ${LD_LIBRARY_PATH}| grep -v "${lib_paths}" >/dev/null ); then
|
1999-09-24 19:15:22 +00:00
|
|
|
LD_LIBRARY_PATH="$lib_paths:$LD_LIBRARY_PATH"
|
|
|
|
fi
|
1997-10-15 22:45:58 +00:00
|
|
|
fi
|
1997-10-13 23:30:17 +00:00
|
|
|
export LD_LIBRARY_PATH;;
|
1997-10-02 23:05:46 +00:00
|
|
|
|
1997-10-13 23:30:17 +00:00
|
|
|
esac
|
1997-10-02 23:05:46 +00:00
|
|
|
|
2002-01-11 12:35:05 +00:00
|
|
|
unset host_os
|
|
|
|
unset lib_paths
|
2004-04-02 07:28:02 +00:00
|
|
|
unset fw_paths
|
2002-01-11 12:35:05 +00:00
|
|
|
|