[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 6/8] teach libtool -L= and -R=
From: |
Paolo Bonzini |
Subject: |
[RFC PATCH 6/8] teach libtool -L= and -R= |
Date: |
Thu, 22 Jul 2010 20:36:28 +0200 |
---
libltdl/config/ltmain.m4sh | 81 ++++++++++++++++++++++++++++++++-----------
1 files changed, 60 insertions(+), 21 deletions(-)
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 8864916..4251bb3 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -565,6 +565,36 @@ func_source ()
}
+# func_resolve_sysroot PATH
+# Change PATH to an absolute path or replace a leading = with a
+# sysroot. Store the result into func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+ func_resolve_sysroot_result=$1
+ case $func_resolve_sysroot_result in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$func_resolve_sysroot_result"
+ func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+ ;;
+ *)
+ if test -d "$1"; then
+ absdir=`cd "$1" && pwd`
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of \`$dir'"
+ func_resolve_sysroot_result=`cd "$dir" && pwd`
+ else
+ func_dirname_and_basename "$1" "" "."
+ absdir=`cd "$func_dirname_result" && pwd`
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of
\`$func_dirname_result'"
+ func_resolve_sysroot_result="$absdir/$func_basename_result"
+ fi
+ ;;
+ esac
+}
+
+
# func_infer_tag arg
# Infer tagged configuration to use if any are available and
# if one wasn't chosen via the "--tag" command line option.
@@ -4062,29 +4092,26 @@ func_mode_link ()
;;
-L*)
- func_stripname '-L' '' "$arg"
- dir=$func_stripname_result
- if test -z "$dir"; then
+ func_stripname "-L" '' "$1"
+ if test -z "$func_stripname_result"; then
if test "$#" -gt 0; then
func_fatal_error "require no space between \`-L' and \`$1'"
else
func_fatal_error "need path for \`-L' option"
fi
fi
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- test -z "$absdir" && \
- func_fatal_error "cannot determine absolute directory name of
\`$dir'"
- dir="$absdir"
- ;;
- esac
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
case "$deplibs " in
- *" -L$dir "*) ;;
+ *" -L$dir "* | *" $arg "*)
+ # Will only happen for absolute or sysroot arguments
+ ;;
*)
- deplibs="$deplibs -L$dir"
+ # Preserve sysroot, but never include relative directories
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs="$deplibs $arg" ;;
+ *) deplibs="$deplibs -L$dir" ;;
+ esac
lib_search_path="$lib_search_path $dir"
;;
esac
@@ -4236,6 +4263,10 @@ func_mode_link ()
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$arg"
+ dir=$lt_sysroot$func_stripname_result
+ ;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
@@ -4764,7 +4795,8 @@ func_mode_link ()
test "$pass" = conv && continue
newdependency_libs="$deplib $newdependency_libs"
func_stripname '-L' '' "$deplib"
- newlib_search_path="$newlib_search_path $func_stripname_result"
+ func_resolve_sysroot "$func_stripname_result"
+ newlib_search_path="$newlib_search_path
$func_resolve_sysroot_result"
;;
prog)
if test "$pass" = conv; then
@@ -4778,7 +4810,8 @@ func_mode_link ()
finalize_deplibs="$deplib $finalize_deplibs"
fi
func_stripname '-L' '' "$deplib"
- newlib_search_path="$newlib_search_path $func_stripname_result"
+ func_resolve_sysroot "$func_stripname_result"
+ newlib_search_path="$newlib_search_path
$func_resolve_sysroot_result"
;;
*)
func_warning "\`-L' is ignored for archives/objects"
@@ -4788,8 +4821,9 @@ func_mode_link ()
;; # -L
-R*)
if test "$pass" = link; then
- func_stripname '-R' '' "$deplib"
- dir=$func_stripname_result
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
*" $dir "*) ;;
@@ -5071,6 +5105,7 @@ func_mode_link ()
for deplib in $dependency_libs; do
case $deplib in
-L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
newlib_search_path="$newlib_search_path $func_stripname_result"
;;
esac
@@ -5473,11 +5508,13 @@ func_mode_link ()
for deplib in $dependency_libs; do
newdependency_libs="$deplib $newdependency_libs"
if $opt_duplicate_deps ; then
+ func_resolve_sysroot "$deplib"
+ deplib=$func_resolve_sysroot_result
case "$tmp_libs " in
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
+ tmp_libs="$tmp_libs $deplib"
fi
- tmp_libs="$tmp_libs $deplib"
done
if test "$link_all_deplibs" != no; then
@@ -5487,8 +5524,10 @@ func_mode_link ()
case $deplib in
-L*) path="$deplib" ;;
*.la)
+ func_resolve_sysroot "$deplib"
+ deplib=$func_resolve_sysroot_result
func_dirname "$deplib" "" "."
- dir="$func_dirname_result"
+ dir=$func_dirname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
--
1.7.1
- [RFC PATCH 0/8] sysroot support, Paolo Bonzini, 2010/07/22
- [RFC PATCH 1/8] handle sysroot flags, Paolo Bonzini, 2010/07/22
- [RFC PATCH 2/8] fix buglet, Paolo Bonzini, 2010/07/22
- [RFC PATCH 3/8] provide shell functions to configure, Paolo Bonzini, 2010/07/22
- [RFC PATCH 4/8] Add --with-sysroot, Paolo Bonzini, 2010/07/22
- [RFC PATCH 5/8] add a basic sysroot test, Paolo Bonzini, 2010/07/22
- [RFC PATCH 6/8] teach libtool -L= and -R=,
Paolo Bonzini <=
- [RFC PATCH 7/8] handle sysrooted paths when reading dependencies to la files, Paolo Bonzini, 2010/07/22
- [RFC PATCH 8/8] emit sysrooted paths when installing .la files, Paolo Bonzini, 2010/07/22
- Re: [RFC PATCH 0/8] sysroot support, Charles Wilson, 2010/07/23