[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFT PATCH v4 3/8] teach libtool -L= and -R=
From: |
Ralf Wildenhues |
Subject: |
Re: [RFT PATCH v4 3/8] teach libtool -L= and -R= |
Date: |
Thu, 19 Aug 2010 06:58:31 +0200 |
User-agent: |
Mutt/1.5.20 (2010-04-22) |
* Paolo Bonzini wrote on Sun, Aug 01, 2010 at 04:47:29PM CEST:
> * libltdl/config/ltmain.m4sh (func_resolve_sysroot): New.
> (func_mode_link): Always pass result of stripping -L and -R to
> func_resolve_sysroot before using it. Remove absolute path expansion
> when func_resolve_sysroot subsumes it. Expand sysroot in -rpath.
> When processing dependent libraries also resolve sysroot paths there.
> --- a/libltdl/config/ltmain.m4sh
> +++ b/libltdl/config/ltmain.m4sh
> @@ -544,6 +544,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
> +}
Why does this function absolutize paths that have nothing to do with
sysroot, even in-tree deplib paths?
Is there a deeper reason in this? If yes, there should probably be a
test which is fixed by it.
Asking because inserting
func_resolve_sysroot_result=$1
return
in the '*)' case makes the test pass on AIX.
The callers previously did this in only one place (and checked for it to
be true in one other place), namely here:
> @@ -4340,29 +4370,26 @@ func_mode_link ()
> ;;
>
> -L*)
> - func_stripname '-L' '' "$arg"
> - dir=$func_stripname_result
> - if test -z "$dir"; then
> + func_stripname "-L" '' "$arg"
> + 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
> + ;;
> *)
> - func_append deplibs " -L$dir"
> + # Preserve sysroot, but never include relative directories
> + case $dir in
> + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
> + *) func_append deplibs " -L$dir" ;;
> + esac
> func_append lib_search_path " $dir"
> ;;
> esac
and here:
> @@ -4514,6 +4541,10 @@ func_mode_link ()
> # We need an absolute path.
> case $dir in
> [\\/]* | [A-Za-z]:[\\/]*) ;;
> + =*)
> + func_stripname '=' '' "$dir"
> + dir=$lt_sysroot$func_stripname_result
> + ;;
> *)
> func_fatal_error "only absolute run-paths are allowed"
> ;;
> @@ -5042,7 +5073,8 @@ func_mode_link ()
> test "$pass" = conv && continue
> newdependency_libs="$deplib $newdependency_libs"
> func_stripname '-L' '' "$deplib"
> - func_append newlib_search_path " $func_stripname_result"
> + func_resolve_sysroot "$func_stripname_result"
> + func_append newlib_search_path " $func_resolve_sysroot_result"
> ;;
> prog)
> if test "$pass" = conv; then
> @@ -5056,7 +5088,8 @@ func_mode_link ()
> finalize_deplibs="$deplib $finalize_deplibs"
> fi
> func_stripname '-L' '' "$deplib"
> - func_append newlib_search_path " $func_stripname_result"
> + func_resolve_sysroot "$func_stripname_result"
> + func_append newlib_search_path " $func_resolve_sysroot_result"
> ;;
> *)
> func_warning "\`-L' is ignored for archives/objects"
> @@ -5067,7 +5100,8 @@ func_mode_link ()
> -R*)
> if test "$pass" = link; then
> func_stripname '-R' '' "$deplib"
> - dir=$func_stripname_result
> + func_resolve_sysroot "$func_stripname_result"
> + dir=$func_resolve_sysroot_result
> # Make sure the xrpath contains only unique directories.
> case "$xrpath " in
> *" $dir "*) ;;
> @@ -5375,7 +5409,8 @@ func_mode_link ()
> for deplib in $dependency_libs; do
> case $deplib in
> -L*) func_stripname '-L' '' "$deplib"
> - func_append newlib_search_path " $func_stripname_result"
> + func_resolve_sysroot "$func_stripname_result"
> + func_append newlib_search_path " $func_resolve_sysroot_result"
> ;;
> esac
> # Need to link against all dependency_libs?
> @@ -5776,12 +5811,18 @@ func_mode_link ()
> tmp_libs=
> for deplib in $dependency_libs; do
> newdependency_libs="$deplib $newdependency_libs"
> + case $deplib in
> + -L*) func_stripname '-L' '' "$deplib"
> + func_resolve_sysroot "$func_stripname_result";;
> + *) func_resolve_sysroot "$deplib" ;;
> + esac
> if $opt_preserve_dup_deps ; then
> case "$tmp_libs " in
> - *" $deplib "*) func_append specialdeplibs " $deplib" ;;
> + *" $func_resolve_sysroot_result "*)
> + func_append specialdeplibs " $func_resolve_sysroot_result" ;;
> esac
> fi
> - func_append tmp_libs " $deplib"
> + func_append tmp_libs " $func_resolve_sysroot_result"
> done
>
> if test "$link_all_deplibs" != no; then
then here, it looks like there is double absolutization (absolution?):
> @@ -5791,8 +5832,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" ;;
Thanks,
Ralf
- [RFT PATCH v4 0/8] Sysroot series, Paolo Bonzini, 2010/08/01
- [RFT PATCH v4 3/8] teach libtool -L= and -R=, Paolo Bonzini, 2010/08/01
- Re: [RFT PATCH v4 3/8] teach libtool -L= and -R=,
Ralf Wildenhues <=
- Re: [RFT PATCH v4 3/8] teach libtool -L= and -R=, Ralf Wildenhues, 2010/08/19
- Re: [RFT PATCH v4 3/8] teach libtool -L= and -R=, Paolo Bonzini, 2010/08/19
- [PATCH] Do not absolutize paths eagerly., Ralf Wildenhues, 2010/08/20
- Re: [PATCH] Do not absolutize paths eagerly., Ralf Wildenhues, 2010/08/21
- Re: [PATCH] Do not absolutize paths eagerly., Charles Wilson, 2010/08/21
- Re: [PATCH] Do not absolutize paths eagerly., Paolo Bonzini, 2010/08/22
- Re: [PATCH] Do not absolutize paths eagerly., Paolo Bonzini, 2010/08/22
[RFT PATCH v4 2/8] add --with-sysroot, Paolo Bonzini, 2010/08/01
[RFT PATCH v4 1/8] handle sysroot flags, Paolo Bonzini, 2010/08/01
[RFT PATCH v4 7/8] add sysroot test, Paolo Bonzini, 2010/08/01