5 # Set up the LD_LIBRARY_PATH (or similar env variable for your system)
7 # Copyright (C) 1998 Free Software Foundation, Inc.
9 # Author: Scott Christley <scottc@net-community.com>
10 # Author: Ovidiu Predescu <ovidiu@net-community.com>
12 # This file is part of the GNUstep Makefile Package.
14 # This library is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
19 # You should have received a copy of the GNU General Public
20 # License along with this library; see the file COPYING.LIB.
21 # If not, write to the Free Software Foundation,
22 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 # The first (and only) parameter to this script is the canonical
26 # operating system name.
28 if ( "$GNUSTEP_FLATTENED" == "" ) then
29 set last_path_part="Library/Libraries/${GNUSTEP_HOST_CPU}/${GNUSTEP_HOST_OS}/${LIBRARY_COMBO}"
30 set tool_path_part="Library/Libraries/${GNUSTEP_HOST_CPU}/${GNUSTEP_HOST_OS}"
32 set last_path_part="Library/Libraries"
33 set tool_path_part="Library/Libraries"
36 set host_os=${GNUSTEP_HOST_OS}
38 if ( "${host_os}" == "" ) then
42 set lib_paths="${GNUSTEP_USER_ROOT}/${last_path_part}:${GNUSTEP_USER_ROOT}/${tool_path_part}:${GNUSTEP_LOCAL_ROOT}/${last_path_part}:${GNUSTEP_LOCAL_ROOT}/${tool_path_part}:${GNUSTEP_NETWORK_ROOT}/${last_path_part}:${GNUSTEP_NETWORK_ROOT}/${tool_path_part}:${GNUSTEP_SYSTEM_ROOT}/${last_path_part}:${GNUSTEP_SYSTEM_ROOT}/${tool_path_part}"
44 set last_path_part="Library/Frameworks"
46 set fw_paths="${GNUSTEP_USER_ROOT}/${last_path_part}:${GNUSTEP_LOCAL_ROOT}/${last_path_part}:${GNUSTEP_NETWORK_ROOT}/${last_path_part}:${GNUSTEP_SYSTEM_ROOT}/${last_path_part}"
48 switch ( "${host_os}" )
51 if ( $?DYLD_LIBRARY_PATH == 0 ) then
52 setenv DYLD_LIBRARY_PATH "${lib_paths}"
53 else if ( { (echo "${DYLD_LIBRARY_PATH}" | fgrep -v "${lib_paths}" >/dev/null) } ) then
54 setenv DYLD_LIBRARY_PATH "${lib_paths}:${DYLD_LIBRARY_PATH}"
56 if ( $?additional_lib_paths == 1) then
57 foreach dir (${additional_lib_paths})
58 set additional="${additional}${dir}:"
62 if ( "${?additional}" == "1" ) then
63 if ( { (echo "${DYLD_LIBRARY_PATH}" | fgrep -v "${additional}" >/dev/null) } ) then
64 setenv DYLD_LIBRARY_PATH="${additional}${DYLD_LIBRARY_PATH}"
70 if ( $?DYLD_LIBRARY_PATH == 0 ) then
71 setenv DYLD_LIBRARY_PATH "${lib_paths}"
72 else if ( { (echo "${DYLD_LIBRARY_PATH}" | fgrep -v "${lib_paths}" >/dev/null) } ) then
73 setenv DYLD_LIBRARY_PATH "${lib_paths}:${DYLD_LIBRARY_PATH}"
75 if ( $?additional_lib_paths == 1) then
76 foreach dir (${additional_lib_paths})
77 set additional="${additional}${dir}:"
81 if ( "${?additional}" == "1" ) then
82 if ( { (echo "${DYLD_LIBRARY_PATH}" | fgrep -v "${additional}" >/dev/null) } ) then
83 setenv DYLD_LIBRARY_PATH="${additional}${DYLD_LIBRARY_PATH}"
87 # The code below has been temporarily removed, because...
88 # With GNUstep -make on any platform, when you compile a
89 # framework, it is supported by creating a link like
90 # Librairies/libMyFramework.dylib ->
91 # Frameworks/MyFramework.framework/Versions/Current/libMyFramework.dylib, to
92 # mitigate the fact that FSF GCC supports to link frameworks with the -frameworks
93 # flag only on Darwin .
94 # Well concerning library GNUstep -make on Darwin, the problem lies in the fact
95 # the Darwin linker seems to be unable to link the library when you pass the
96 # flag -lMyFramework to compile an application which depends on it, strangely it
97 # links the framework directly. You can see that with otool -L
98 # Whatever/MyApplication.app/MyApplication which will output
99 # MyFramework.framework/MyFramework and not libMyFramework.dylib .
100 # So because a framework is linked when it is present even when you want to
101 # link the equivalent library, the application will not find the framework when
102 # you launch it with DYLD_FRAMEWORK_PATH empty. To correct that, we must
103 # set DYLD_FRAMEWORK_PATH in any cases until the Darwin linker behaves correctly.
105 # if ( ( "${LIBRARY_COMBO}" == "apple-apple-apple" ) \
106 # || ( "${LIBRARY_COMBO}" == "apple") ) then
110 if ( $?DYLD_FRAMEWORK_PATH == 0 ) then
111 setenv DYLD_FRAMEWORK_PATH "${fw_paths}"
112 else if ( { (echo "${DYLD_FRAMEWORK_PATH}" | fgrep -v "${fw_paths}" >/dev/null) } ) then
113 setenv DYLD_FRAMEWORK_PATH "${fw_paths}:${DYLD_FRAMEWORK_PATH}"
115 if ( $?additional_framework_paths == 1) then
116 foreach dir (${additional_framework_paths})
117 set additional="${additional}${dir}:"
121 if ( "${?additional}" == "1" ) then
122 if ( { (echo "${DYLD_FRAMEWORK_PATH}" | fgrep -v "${additional}" >/dev/null) } ) then
123 setenv DYLD_FRAMEWORK_PATH="${additional}${DYLD_FRAMEWORK_PATH}"
129 if ( $?SHLIB_PATH == 0 ) then
130 setenv SHLIB_PATH "${lib_paths}"
131 else if ( { (echo "${SHLIB_PATH}" | fgrep -v "${lib_paths}" >/dev/null) } ) then
132 setenv SHLIB_PATH "${lib_paths}:${SHLIB_PATH}"
134 if ( $?additional_lib_paths == 1) then
135 foreach dir (${additional_lib_paths})
136 set additional="${additional}${dir}:"
140 if ( "${?additional}" == "1" ) then
141 if ( { (echo "${SHLIB_PATH}" | fgrep -v "${additional}" >/dev/null) } ) then
142 setenv SHLIB_PATH="${additional}${SHLIB_PATH}"
146 if ( $?LD_LIBRARY_PATH == 0 ) then
147 setenv LD_LIBRARY_PATH "${lib_paths}"
148 else if ( { (echo "${LD_LIBRARY_PATH}" | fgrep -v "${lib_paths}" >/dev/null) } ) then
149 setenv LD_LIBRARY_PATH "${lib_paths}:${LD_LIBRARY_PATH}"
152 if ( $?additional_lib_paths == 1) then
153 foreach dir (${additional_lib_paths})
154 set additional="${additional}${dir}:"
158 if ( "${?additional}" == "1" ) then
159 if ( { (echo "${LD_LIBRARY_PATH}" | fgrep -v "${additional}" >/dev/null) } ) then
160 setenv LD_LIBRARY_PATH="${additional}${LD_LIBRARY_PATH}"
166 if ( $?LD_LIBRARY_PATH == 0 ) then
167 setenv LD_LIBRARY_PATH "${lib_paths}"
168 else if ( { (echo "${LD_LIBRARY_PATH}" | fgrep -v "${lib_paths}" >/dev/null) } ) then
169 setenv LD_LIBRARY_PATH "${lib_paths}:${LD_LIBRARY_PATH}"
171 if ( $?additional_lib_paths == 1) then
172 foreach dir (${additional_lib_paths})
173 set additional="${additional}${dir}:"
177 if ( "${?additional}" == "1" ) then
178 if ( { (echo "${LD_LIBRARY_PATH}" | fgrep -v "${additional}" >/dev/null) } ) then
179 setenv LD_LIBRARY_PATH="${additional}${LD_LIBRARY_PATH}"
186 unset tool_path_part last_path_part host_os additional dir lib_paths fw_paths