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 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 # With GNUstep -make on any platform, when you compile a
137 # framework, it is supported by creating a link like
138 # Librairies/libMyFramework.dylib ->
139 # Frameworks/MyFramework.framework/Versions/Current/libMyFramework.dylib, to
140 # mitigate the fact that FSF GCC supports to link frameworks with the -frameworks
141 # flag only on Darwin .
142 # Well concerning library GNUstep -make on Darwin, the problem lies in the fact
143 # the Darwin linker seems to be unable to link the library when you pass the
144 # flag -lMyFramework to compile an application which depends on it, strangely it
145 # links the framework directly. You can see that with otool -L
146 # Whatever/MyApplication.app/MyApplication which will output
147 # MyFramework.framework/MyFramework and not libMyFramework.dylib .
148 # So because a framework is linked when it is present even when you want to
149 # link the equivalent library, the application will not find the framework when
150 # you launch it with DYLD_FRAMEWORK_PATH empty. To correct that, we must
151 # set DYLD_FRAMEWORK_PATH in any cases until the Darwin linker behaves correctly.
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;;