libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 8/8] emit sysrooted paths when installing .la files


From: Paolo Bonzini
Subject: [RFC PATCH 8/8] emit sysrooted paths when installing .la files
Date: Thu, 22 Jul 2010 20:36:30 +0200

---
 libltdl/config/ltmain.m4sh |   43 ++++++++++++++++++++++++++++++++++++-------
 libltdl/m4/libtool.m4      |   15 +++++++++++----
 2 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 1a8041f..206bda9 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -594,6 +594,22 @@ func_resolve_sysroot ()
   esac
 }
 
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case "$lt_sysroot:$1" in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result==$func_stripname_result
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
 
 # func_infer_tag arg
 # Infer tagged configuration to use if any are available and
@@ -5040,14 +5056,14 @@ func_mode_link ()
 
        # Find the relevant object directory and library name.
        if test "X$installed" = Xyes; then
-         if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+         if test ! -f "$lt_sysroot$libdir/$linklib" && test -f 
"$abs_ladir/$linklib"; then
            func_warning "library \`$lib' was moved."
            dir="$ladir"
            absdir="$abs_ladir"
            libdir="$abs_ladir"
          else
-           dir="$libdir"
-           absdir="$libdir"
+           dir="$lt_sysroot$libdir"
+           absdir="$lt_sysroot$libdir"
          fi
          test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
        else
@@ -6082,7 +6098,8 @@ func_mode_link ()
        # If the user specified any rpath flags, then add them.
        temp_xrpath=
        for libdir in $xrpath; do
-         temp_xrpath="$temp_xrpath -R$libdir"
+         func_replace_sysroot "$libdir"
+         temp_xrpath="$temp_xrpath -R$func_replace_sysroot_result"
          case "$finalize_rpath " in
          *" $libdir "*) ;;
          *) finalize_rpath="$finalize_rpath $libdir" ;;
@@ -6528,6 +6545,8 @@ EOF
          for libdir in $rpath; do
            if test -n "$hardcode_libdir_flag_spec"; then
              if test -n "$hardcode_libdir_separator"; then
+               func_replace_sysroot "$libdir"
+               libdir=$func_replace_sysroot_result
                if test -z "$hardcode_libdirs"; then
                  hardcode_libdirs="$libdir"
                else
@@ -7692,7 +7711,17 @@ EOF
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
                test -z "$libdir" && \
                  func_fatal_error "\`$deplib' is not a valid libtool archive"
-               newdependency_libs="$newdependency_libs $libdir/$name"
+               newdependency_libs="$newdependency_libs 
${lt_sysroot:+=}$libdir/$name"
+               ;;
+             -L*)
+               func_stripname -L '' "$i"
+               func_replace_sysroot "$func_stripname_result"
+               newdeplibs="$newdeplibs -L$func_replace_sysroot_result"
+               ;;
+             -R*)
+               func_stripname -R '' "$i"
+               func_replace_sysroot "$func_stripname_result"
+               newdeplibs="$newdeplibs -R$func_replace_sysroot_result"
                ;;
              *) newdependency_libs="$newdependency_libs $deplib" ;;
              esac
@@ -7708,7 +7737,7 @@ EOF
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
                test -z "$libdir" && \
                  func_fatal_error "\`$lib' is not a valid libtool archive"
-               newdlfiles="$newdlfiles $libdir/$name"
+               newdlfiles="$newdlfiles ${lt_sysroot:+=}$libdir/$name"
                ;;
              *) newdlfiles="$newdlfiles $lib" ;;
              esac
@@ -7727,7 +7756,7 @@ EOF
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
                test -z "$libdir" && \
                  func_fatal_error "\`$lib' is not a valid libtool archive"
-               newdlprefiles="$newdlprefiles $libdir/$name"
+               newdlprefiles="$newdlprefiles ${lt_sysroot:+=}$libdir/$name"
                ;;
              esac
            done
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index cf24144..81cf740 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -6473,13 +6473,20 @@ if AC_TRY_EVAL(ac_compile); then
           test $p = "-R"; then
         prev=$p
         continue
-       else
-        prev=
        fi
 
+       # Expand the sysroot to ease extracting the directories later.
+       case $p in
+       -L*) func_stripname '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+       -R*) func_stripname '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+       -l*) func_stripname '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+       esac
+       case $p in
+       =*) func_stripname '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
        if test "$pre_test_object_deps_done" = no; then
-        case ${prev}${p} in
-        -L* | -R*)
+        case ${prev} in
+        -L | -R)
           # Internal compiler library paths should come after those
           # provided the user.  The postdeps already come after the
           # user supplied libs so there is no need to process them.
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]