5 # Set up the LD_LIBRARY_PATH (or similar env variable for your system)
7 # Copyright (C) 1997-2002 Free Software Foundation, Inc.
9 # Author: Scott Christley <scottc@net-community.com>
10 # Author: Ovidiu Predescu <ovidiu@net-community.com>
11 # Rewrite: Richard Frith-Macdonald <richard@brainstorm.co.uk>
12 # Author: Nicola Pero <n.pero@mi.flashnet.it>
14 # This file is part of the GNUstep Makefile Package.
16 # This library is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License
18 # as published by the Free Software Foundation; either version 2
19 # of the License, or (at your option) any later version.
21 # You should have received a copy of the GNU General Public
22 # License along with this library; see the file COPYING.LIB.
23 # If not, write to the Free Software Foundation,
24 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 # This file is sourced. This means extra care is needed when changing
28 # it. Please read the comments on GNUstep.sh.in before touching it.
30 # The first (and only) parameter to this script is the canonical
31 # operating system name.
33 host_os=$GNUSTEP_HOST_OS
35 if [ -z "$host_os" ]; then
44 for dir in $GNUSTEP_PATHLIST; do
46 # prepare the path_fragment for libraries and this dir
47 if [ -z "$GNUSTEP_FLATTENED" ]; then
48 path_fragment="$dir/Library/Libraries/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS/$LIBRARY_COMBO:$dir/Library/Libraries/$GNUSTEP_HOST_CPU/$GNUSTEP_HOST_OS"
50 path_fragment="$dir/Library/Libraries"
53 # Append the path_fragment to lib_paths
54 if [ -z "$lib_paths" ]; then
55 lib_paths="$path_fragment"
57 lib_paths="$lib_paths:$path_fragment"
60 # prepare the path_fragment for frameworks and this dir
61 path_fragment="$dir/Library/Frameworks"
63 # Append the path_fragment to fw_paths
64 if [ -z "$fw_paths" ]; then
65 fw_paths="$path_fragment"
67 fw_paths="$fw_paths:$path_fragment"
78 if [ -n "$additional_library_paths" ]; then
83 for dir in $additional_library_paths; do
84 additional="${additional}${dir}:"
88 lib_paths="${additional}${lib_paths}"
95 if [ -n "$additional_framework_paths" ]; then
100 for dir in $additional_framework_paths; do
101 additional="${additional}${dir}:"
105 fw_paths="${additional}${fw_paths}"
115 if [ -z "$DYLD_LIBRARY_PATH" ]; then
116 DYLD_LIBRARY_PATH="$lib_paths"
118 if ( echo ${DYLD_LIBRARY_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
119 DYLD_LIBRARY_PATH="$lib_paths:$DYLD_LIBRARY_PATH"
122 export DYLD_LIBRARY_PATH
126 if [ -z "$DYLD_LIBRARY_PATH" ]; then
127 DYLD_LIBRARY_PATH="$lib_paths"
129 if ( echo ${DYLD_LIBRARY_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
130 DYLD_LIBRARY_PATH="$lib_paths:$DYLD_LIBRARY_PATH"
133 export DYLD_LIBRARY_PATH
135 # The code below has been temporarily removed, because...
136 # Frameworks in GNUstep-make are supported by creating a link like
138 # Libraries/libMyFramework.dylib ->
139 # Frameworks/MyFramework.framework/Versions/Current/libMyFramework.dylib,
141 # to mitigate the fact that FSF GCC does not support a -framework flag.
143 # On Darwin, however, we partially emulate -framework by setting the
144 # "install_name" to the framework name during linking. The dynamic
145 # linker (dyld) is smart enough to find the framework under this name,
146 # but only if DYLD_FRAMEWORK_PATH is set (unless we set the
147 # "install_name" to an absolute path, which we don't). We'd really like
148 # to fully support -framework, though.
150 # Use otool -L MyApplication.app/MyApplication, for instance, to see
151 # how the shared libraries/frameworks are linked.
153 # if [ "$LIBRARY_COMBO" = "apple-apple-apple" -o \
154 # "$LIBRARY_COMBO" = "apple" ]; then
156 if [ -z "$DYLD_FRAMEWORK_PATH" ]; then
157 DYLD_FRAMEWORK_PATH="$fw_paths"
159 if ( echo ${DYLD_FRAMEWORK_PATH}|
160 fgrep -v "${fw_paths}" >/dev/null ); then
161 DYLD_FRAMEWORK_PATH="$fw_paths:$DYLD_FRAMEWORK_PATH"
164 export DYLD_FRAMEWORK_PATH;;
167 if [ -z "$SHLIB_PATH" ]; then
168 SHLIB_PATH="$lib_paths"
170 if ( echo ${SHLIB_PATH}|fgrep -v "${lib_paths}" >/dev/null ); then
171 SHLIB_PATH="$lib_paths:$SHLIB_PATH"
175 if [ -z "$LD_LIBRARY_PATH" ]; then
176 LD_LIBRARY_PATH="$lib_paths"
178 if ( echo ${LD_LIBRARY_PATH}| grep -v "${lib_paths}" >/dev/null ); then
179 LD_LIBRARY_PATH="$lib_paths:$LD_LIBRARY_PATH"
182 export LD_LIBRARY_PATH;;
185 if [ -z "$LD_LIBRARY_PATH" ]; then
186 LD_LIBRARY_PATH="$lib_paths"
188 if ( echo ${LD_LIBRARY_PATH}| grep -v "${lib_paths}" >/dev/null ); then
189 LD_LIBRARY_PATH="$lib_paths:$LD_LIBRARY_PATH"
192 export LD_LIBRARY_PATH;;