summaryrefslogtreecommitdiffstats
path: root/ltmain.sh
diff options
context:
space:
mode:
authorDave Korn <dave.korn.cygwin@gmail.com>2009-08-20 11:11:34 +0000
committerDave Korn <davek@gcc.gnu.org>2009-08-20 11:11:34 +0000
commit197c68cc978ee36fab09445e9f09a5752f2585f1 (patch)
tree6446715545bbf4f4faafb6ffe1c751e47a437490 /ltmain.sh
parentalpha.c (alpha_end_function): Do not clear crtl->emit structure and free insn... (diff)
downloadgcc-197c68cc978ee36fab09445e9f09a5752f2585f1.tar.gz
gcc-197c68cc978ee36fab09445e9f09a5752f2585f1.tar.bz2
gcc-197c68cc978ee36fab09445e9f09a5752f2585f1.tar.xz
Makefile.am (libgomp_la_LDFLAGS): Add -bindir flag.
libgomp/ChangeLog: * Makefile.am (libgomp_la_LDFLAGS): Add -bindir flag. * Makefile.in: Regenerate. ChangeLog: * ltmain.sh (func_normal_abspath): New function. (func_relative_path): Likewise. (func_mode_help): Document new -bindir option for link mode. (func_mode_link): Add new -bindir option, and use it to place output DLL if specified. libgfortran/ChangeLog: * Makefile.am (LTLDFLAGS): Add -bindir flag. * Makefile.in: Regenerate. libssp/ChangeLog: * Makefile.am (libssp_la_LDFLAGS): Add -bindir flag. * Makefile.in: Regenerate. libjava/libltdl/ChangeLog: * Makefile.am (libltdl_la_LDFLAGS): Add -bindir flag. * Makefile.in: Regenerate. libjava/classpath/ChangeLog: * ltmain.sh (func_normal_abspath): New function. (func_relative_path): Likewise. (func_mode_help): Document new -bindir option for link mode. (func_mode_link): Add new -bindir option, and use it to place output DLL if specified. From-SVN: r150960
Diffstat (limited to 'ltmain.sh')
-rw-r--r--ltmain.sh178
1 files changed, 177 insertions, 1 deletions
diff --git a/ltmain.sh b/ltmain.sh
index 8dfa0b3b558..b01cb29a683 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -170,6 +170,151 @@ func_dirname_and_basename ()
170 170
171# Generated shell functions inserted here. 171# Generated shell functions inserted here.
172 172
173# These SED scripts presuppose an absolute path with a trailing slash.
174pathcar="s,^/\([^/]*\).*$,\1,"
175pathcdr="s,^/[^/]*,,"
176removedotparts="s,/\(\./\)\{1\,\},/,g;s,/\.$,/,"
177collapseslashes="s,/\{1\,\},/,g"
178finalslash="s,/*$,/,"
179
180# func_normal_abspath PATH
181# Remove doubled-up and trailing slashes, "." path components,
182# and cancel out any ".." path components in PATH after making
183# it an absolute path.
184# value returned in "$func_normal_abspath_result"
185func_normal_abspath ()
186{
187 # Start from root dir and reassemble the path.
188 func_normal_abspath_result=
189 func_normal_abspath_tpath=$1
190 func_normal_abspath_altnamespace=
191 case $func_normal_abspath_tpath in
192 "")
193 # Empty path, that just means $cwd.
194 func_stripname '' '/' "`pwd`"
195 func_normal_abspath_result=$func_stripname_result
196 return
197 ;;
198 # The next three entries are used to spot a run of precisely
199 # two leading slashes without using negated character classes;
200 # we take advantage of case's first-match behaviour.
201 ///*)
202 # Unusual form of absolute path, do nothing.
203 ;;
204 //*)
205 # Not necessarily an ordinary path; POSIX reserves leading '//'
206 # and for example Cygwin uses it to access remote file shares
207 # over CIFS/SMB, so we conserve a leading double slash if found.
208 func_normal_abspath_altnamespace=/
209 ;;
210 /*)
211 # Absolute path, do nothing.
212 ;;
213 *)
214 # Relative path, prepend $cwd.
215 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
216 ;;
217 esac
218 # Cancel out all the simple stuff to save iterations. We also want
219 # the path to end with a slash for ease of parsing, so make sure
220 # there is one (and only one) here.
221 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
222 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
223 while :; do
224 # Processed it all yet?
225 if test "$func_normal_abspath_tpath" = / ; then
226 # If we ascended to the root using ".." the result may be empty now.
227 if test -z "$func_normal_abspath_result" ; then
228 func_normal_abspath_result=/
229 fi
230 break
231 fi
232 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
233 -e "$pathcar"`
234 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
235 -e "$pathcdr"`
236 # Figure out what to do with it
237 case $func_normal_abspath_tcomponent in
238 "")
239 # Trailing empty path component, ignore it.
240 ;;
241 ..)
242 # Parent dir; strip last assembled component from result.
243 func_dirname "$func_normal_abspath_result"
244 func_normal_abspath_result=$func_dirname_result
245 ;;
246 *)
247 # Actual path component, append it.
248 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
249 ;;
250 esac
251 done
252 # Restore leading double-slash if one was found on entry.
253 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
254}
255
256# func_relative_path SRCDIR DSTDIR
257# generates a relative path from SRCDIR to DSTDIR, with a trailing
258# slash if non-empty, suitable for immediately appending a filename
259# without needing to append a separator.
260# value returned in "$func_relative_path_result"
261func_relative_path ()
262{
263 func_relative_path_result=
264 func_normal_abspath "$1"
265 func_relative_path_tlibdir=$func_normal_abspath_result
266 func_normal_abspath "$2"
267 func_relative_path_tbindir=$func_normal_abspath_result
268
269 # Ascend the tree starting from libdir
270 while :; do
271 # check if we have found a prefix of bindir
272 case $func_relative_path_tbindir in
273 $func_relative_path_tlibdir)
274 # found an exact match
275 func_relative_path_tcancelled=
276 break
277 ;;
278 $func_relative_path_tlibdir*)
279 # found a matching prefix
280 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
281 func_relative_path_tcancelled=$func_stripname_result
282 if test -z "$func_relative_path_result"; then
283 func_relative_path_result=.
284 fi
285 break
286 ;;
287 *)
288 func_dirname $func_relative_path_tlibdir
289 func_relative_path_tlibdir=${func_dirname_result}
290 if test "x$func_relative_path_tlibdir" = x ; then
291 # Have to descend all the way to the root!
292 func_relative_path_result=../$func_relative_path_result
293 func_relative_path_tcancelled=$func_relative_path_tbindir
294 break
295 fi
296 func_relative_path_result=../$func_relative_path_result
297 ;;
298 esac
299 done
300
301 # Now calculate path; take care to avoid doubling-up slashes.
302 func_stripname '' '/' "$func_relative_path_result"
303 func_relative_path_result=$func_stripname_result
304 func_stripname '/' '/' "$func_relative_path_tcancelled"
305 if test "x$func_stripname_result" != x ; then
306 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
307 fi
308
309 # Normalisation. If bindir is libdir, return empty string,
310 # else relative path ending with a slash; either way, target
311 # file name can be directly appended.
312 if test ! -z "$func_relative_path_result"; then
313 func_stripname './' '' "$func_relative_path_result/"
314 func_relative_path_result=$func_stripname_result
315 fi
316}
317
173# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 318# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
174# is ksh but when the shell is invoked as "sh" and the current value of 319# is ksh but when the shell is invoked as "sh" and the current value of
175# the _XPG environment variable is not equal to 1 (one), the special 320# the _XPG environment variable is not equal to 1 (one), the special
@@ -1558,6 +1703,8 @@ The following components of LINK-COMMAND are treated specially:
1558 1703
1559 -all-static do not do any dynamic linking at all 1704 -all-static do not do any dynamic linking at all
1560 -avoid-version do not add a version suffix if possible 1705 -avoid-version do not add a version suffix if possible
1706 -bindir BINDIR specify path to binaries directory (for systems where
1707 libraries must be found in the PATH setting at runtime)
1561 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 1708 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1562 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 1709 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1563 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 1710 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
@@ -4072,6 +4219,7 @@ func_mode_link ()
4072 new_inherited_linker_flags= 4219 new_inherited_linker_flags=
4073 4220
4074 avoid_version=no 4221 avoid_version=no
4222 bindir=
4075 dlfiles= 4223 dlfiles=
4076 dlprefiles= 4224 dlprefiles=
4077 dlself=no 4225 dlself=no
@@ -4164,6 +4312,11 @@ func_mode_link ()
4164 esac 4312 esac
4165 4313
4166 case $prev in 4314 case $prev in
4315 bindir)
4316 bindir="$arg"
4317 prev=
4318 continue
4319 ;;
4167 dlfiles|dlprefiles) 4320 dlfiles|dlprefiles)
4168 if test "$preload" = no; then 4321 if test "$preload" = no; then
4169 # Add the symbol object into the linking commands. 4322 # Add the symbol object into the linking commands.
@@ -4425,6 +4578,11 @@ func_mode_link ()
4425 continue 4578 continue
4426 ;; 4579 ;;
4427 4580
4581 -bindir)
4582 prev=bindir
4583 continue
4584 ;;
4585
4428 -dlopen) 4586 -dlopen)
4429 prev=dlfiles 4587 prev=dlfiles
4430 continue 4588 continue
@@ -8121,9 +8279,27 @@ EOF
8121 fi 8279 fi
8122 $RM $output 8280 $RM $output
8123 # place dlname in correct position for cygwin 8281 # place dlname in correct position for cygwin
8282 # In fact, it would be nice if we could use this code for all target
8283 # systems that can't hard-code library paths into their executables
8284 # and that have no shared library path variable independent of PATH,
8285 # but it turns out we can't easily determine that from inspecting
8286 # libtool variables, so we have to hard-code the OSs to which it
8287 # applies here; at the moment, that means platforms that use the PE
8288 # object format with DLL files. See the long comment at the top of
8289 # tests/bindir.at for full details.
8124 tdlname=$dlname 8290 tdlname=$dlname
8125 case $host,$output,$installed,$module,$dlname in 8291 case $host,$output,$installed,$module,$dlname in
8126 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 8292 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
8293 # If a -bindir argument was supplied, place the dll there.
8294 if test "x$bindir" != x ;
8295 then
8296 func_relative_path "$install_libdir" "$bindir"
8297 tdlname=$func_relative_path_result$dlname
8298 else
8299 # Otherwise fall back on heuristic.
8300 tdlname=../bin/$dlname
8301 fi
8302 ;;
8127 esac 8303 esac
8128 $ECHO > $output "\ 8304 $ECHO > $output "\
8129# $outputname - a libtool library file 8305# $outputname - a libtool library file