libtool-commit
[Top][All Lists]
Advanced

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

[SCM] GNU Libtool branch, master, updated. v2.2.10-121-g8f5c589


From: Ralf Wildenhues
Subject: [SCM] GNU Libtool branch, master, updated. v2.2.10-121-g8f5c589
Date: Sat, 28 Aug 2010 09:28:23 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Libtool".

The branch, master has been updated
       via  8f5c58990dd80e4505d057a3deefcf63c8bd31e0 (commit)
       via  22a120690392cccc59921c70f1f3e8cd523bb849 (commit)
       via  75b9ac5fa27c4940141d719a42a07f4397e14c60 (commit)
       via  a1d74f242cae77a941fbaa0505badf488d85f618 (commit)
       via  2bde23f84fd69c2b135ef53f43a22a90c14e7e8c (commit)
       via  5dca3212e16b8cd502a74f7c8e0a18187e36a03c (commit)
       via  b9accaaa3b3e4d3cc1a72d5366e5526b65819026 (commit)
       via  d32c96ccd6dacf2c60504a6b847e3d82400adfac (commit)
       via  55e986b8b4a3582998946c1a13e411d3122a7610 (commit)
       via  09a695acf973319b218665d7a3c37f4630c190c6 (commit)
       via  5735d4b16d9efb5e6348f7cd2eb348a38395f1fc (commit)
       via  8f2fcb912f57135270ee7969dc5e56bca77925fe (commit)
       via  3f6731bd3fd9ce2b5fe022441105e186a9dd15e2 (commit)
       via  a3cff76611dc8e7681835946b4f9184d09684ef3 (commit)
       via  d77a3a512406a429ca3e1f6aa8894552818d89c5 (commit)
       via  adb8f844f3327b2b8f6f92945f539e4df7aec24d (commit)
       via  c45a28813427ec5e25414d2a0db754eb9bbd970b (commit)
       via  3334f7ed5851ef1e96b052f2984c4acdbf39e20c (commit)
       via  a8f549c1348c0bdedf3c01e6bed6c1e1aa5e8855 (commit)
      from  e634870fa811d215f8e36a10670fb5397ab95671 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8f5c58990dd80e4505d057a3deefcf63c8bd31e0
Merge: e634870 22a1206
Author: Ralf Wildenhues <address@hidden>
Date:   Sat Aug 28 10:39:40 2010 +0200

    Merge branch 'sysroot'
    
    * sysroot:
      Add ChangeLog entries for the sysroot branch.
      fix AIX testsuite regression
      fix --mode=finish
      improve code for sysroot --mode=finish
      add libtool --mode=finish mode for sysroot
      reorganize parsing of --mode=finish arguments
      fix sysroot handling for deplibs of preopened libtool libs
      fix sysroot tests to pass on Fedora 13
      initial version of the NEWS entry
      add sysroot test
      emit sysrooted paths when installing .la files
      process postdeps to include sysrooted paths
      handle sysrooted paths when reading dependencies to la files
      teach libtool -L= and -R=
      add --with-sysroot
      handle sysroot flags

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                  |   88 +++++++++++++++
 Makefile.am                |    3 +-
 NEWS                       |   10 ++
 doc/libtool.texi           |   18 ++-
 libltdl/config/ltmain.m4sh |  264 ++++++++++++++++++++++++++++++++------------
 libltdl/m4/libtool.m4      |   76 ++++++++++++-
 tests/sysroot.at           |  208 ++++++++++++++++++++++++++++++++++
 7 files changed, 583 insertions(+), 84 deletions(-)
 create mode 100644 tests/sysroot.at

diff --git a/ChangeLog b/ChangeLog
index 77a0b2a..036eb2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,91 @@
+2010-08-22  Ralf Wildenhues  <address@hidden>
+
+       fix AIX testsuite regression
+       * libltdl/config/ltmain.m4sh (func_resolve_sysroot): Partly
+       revert v2.2.10-83-gc45a288: Do not absolutize path here, only do
+       sysroot replacement.
+       (func_mode_link): Adjust.
+
+2010-08-22  Charles Wilson  <address@hidden>
+
+       fix --mode=finish
+       * libltdl/config/ltmain.m4sh (func_mode_finish): Invert then/else
+       blocks of the "if $opt_dry_run" conditional.
+
+2010-08-15  Paolo Bonzini  <address@hidden>
+
+       improve code for sysroot --mode=finish
+       * libltdl/config/ltmain.m4sh (func_mode_finish): Change sysroot_regex
+       and sysroot_cmd delimiter from pipe to slash.  Wrap the entire for
+       loop with "if $opt_dry_run...fi" and print an explanatory message
+       for the --dry-run case.
+
+2010-08-12  Paolo Bonzini  <address@hidden>
+
+       add libtool --mode=finish mode for sysroot
+       * doc/libtool.texi (Finish mode): Document behavior when *.la files
+       are passed.
+       * libltdl/config/ltmain.m4sh (func_mode_finish): Eliminate sysroot
+       or `=' signs representing it from files in $libs.
+       * tests/sysroot.at (SYSROOT_TESTS): Test for presence of sysroot
+       references before running libtool --mode=finish, and for absence
+       afterwards.
+
+       reorganize parsing of --mode=finish arguments
+       * libltdl/config/ltmain.m4sh (func_mode_finish): Split arguments for
+       directories and *.la files.
+
+       fix sysroot handling for deplibs of preopened libtool libs
+       * libltdl/config/ltmain.m4sh: Pass $dependency_libs of preopened libtool
+       through func_resolve_sysroot.
+
+       fix sysroot tests to pass on Fedora 13
+       * tests/sysroot.at: Link $prefix/include into the sysroot as well, as
+       required by newer GCC.
+
+2010-07-29  Paolo Bonzini  <address@hidden>
+
+       initial version of the NEWS entry
+       * NEWS: Document sysroot support.
+
+       add sysroot test
+       * Makefile.am (TESTSUITE_AT): Add tests/sysroot.at.
+       * tests/sysroot.at: New.
+
+       emit sysrooted paths when installing .la files
+       * libltdl/config/ltmain.m4sh (func_replace_sysroot): New.
+       (func_mode_link): Prepend paths in $libdir with the sysroot.  Further,
+       replace the sysroot with = (using func_replace_sysroot) whenever
+       such a path is written in a .la file.
+
+       process postdeps to include sysrooted paths
+       * libltdl/m4/libtool.m4 (_LT_FUNC_STRIPNAME_CNF): New (from Charles 
Wilson).
+       (_LT_SYS_HIDDEN_LIBDEPS): Require it.  Use func_stripname_cnf to convert
+       sysroot (-L= and -R=) usage in postdeps.  Adjust the code because -L, -R
+       and -l flags will now always be separated from the rest of the argument.
+
+       handle sysrooted paths when reading dependencies to la files
+       * libltdl/config/ltmain.m4sh (func_mode_execute, func_mode_install,
+       func_mode_link): Whenever a .la file occurs in another .la file,
+       expand the sysroot path in it.
+
+2010-07-28  Paolo Bonzini  <address@hidden>
+
+       teach libtool -L= and -R=
+       * 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.
+
+       add --with-sysroot
+       * libltdl/m4/libtool.m4 (_LT_HOST_NONCANONICAL, _LT_WITH_SYSROOT): New.
+       (LT_SETUP): Require _LT_WITH_SYSROOT.
+
+       handle sysroot flags
+       * libltdl/config/ltmain.m4sh (func_mode_link): Recognize --sysroot
+       option.
+
 2010-08-27  Ralf Wildenhues  <address@hidden>
 
        * NEWS: Only bootstrapping needs new Automake and Autoconf.
diff --git a/Makefile.am b/Makefile.am
index 85bad6a..ec654b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -504,7 +504,8 @@ TESTSUITE_AT        = tests/testsuite.at \
                  tests/cmdline_wrap.at \
                  tests/pic_flag.at \
                  tests/darwin.at \
-                 tests/deplibs-mingw.at
+                 tests/deplibs-mingw.at \
+                 tests/sysroot.at
 
 EXTRA_DIST     += $(srcdir)/$(TESTSUITE) $(TESTSUITE_AT) 
$(srcdir)/tests/package.m4
 
diff --git a/NEWS b/NEWS
index 11ae6ca..a6e73c2 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,16 @@ New in 2.2.12 2010-08-??: git version 2.2.11a, Libtool team:
 
 * New features:
 
+  - Sysroot support.  This allows you to build cross-compiled packages
+    with the same prefix that will be used on the destination machine,
+    and still find dependent libraries under the compiler's "sysroot".
+    Without sysroot support, paths internal to the build system may leak
+    into the product of the build.
+
+    Sysroot support is disabled unless the --with-sysroot configure
+    option is passed to configure, because .la files generated with
+    sysroot support will _not_ be usable in general with older Libtools.
+
   - On non-cygwin Windows systems, we now lookup potential library
     file names without regard to file name case.
   - The old testsuite now uses the `parallel-tests' Automake test driver
diff --git a/doc/libtool.texi b/doc/libtool.texi
index f042a78..be7d3bf 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -1723,12 +1723,18 @@ commands are also completed.
 @cindex finish mode
 @cindex mode, finish
 
address@hidden mode helps system administrators install libtool libraries
-so that they can be located and linked into user programs.
-
-Each @var{mode-arg} is interpreted as the name of a library directory.
-Running this command may require superuser privileges, so the
address@hidden option may be useful.
address@hidden mode has two functions.  One is to help system administrators
+install libtool libraries so that they can be located and linked into
+user programs.  To invoke this functionality, pass the name of a library
+directory as @var{mode-arg}.  Running this command may require superuser
+privileges, and the @option{--dry-run} option may be useful.
+
+The second is to facilitate transferring libtool libraries to a native
+compilation environment after they were built in a cross-compilation
+environment.  Cross-compilation environments may rely on recent libtool
+features, and running libtool in finish mode will make it easier to
+work with older versions of libtool.  This task is performed whenever
+the @var{mode-arg} is a @samp{.la} file.
 
 @node Uninstall mode
 @section Uninstall mode
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index c6671a0..f23878e 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -546,6 +546,37 @@ func_source ()
 }
 
 
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH 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
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  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
 # if one wasn't chosen via the "--tag" command line option.
@@ -1231,6 +1262,9 @@ func_mode_execute ()
       dir=
       case $file in
       *.la)
+       func_resolve_sysroot "$file"
+       file=$func_resolve_sysroot_result
+
        # Check to see that this really is a libtool archive.
        func_lalib_unsafe_p "$file" \
          || func_fatal_help "\`$lib' is not a valid libtool archive"
@@ -1348,15 +1382,52 @@ test "$opt_mode" = execute && func_mode_execute 
${1+"$@"}
 func_mode_finish ()
 {
     $opt_debug
-    libdirs="$nonopt"
+    libs=
+    libdirs=
     admincmds=
 
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for dir
-      do
-       func_append libdirs " $dir"
-      done
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+       func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+       if func_lalib_unsafe_p "$opt"; then
+         func_append libs " $opt"
+       else
+         func_warning "\`$opt' is not a valid libtool archive"
+       fi
+
+      else
+       func_fatal_error "invalid argument \`$opt'"
+      fi
+    done
 
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+         sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+           > $tmpdir/tmp-la
+         mv -f $tmpdir/tmp-la $lib
+       done
+        ${RM}r "$tmpdir"
+      fi
+    fi
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
       for libdir in $libdirs; do
        if test -n "$finish_cmds"; then
          # Do each command in the finish commands.
@@ -1375,49 +1446,51 @@ func_mode_finish ()
     # Exit here if they wanted silent mode.
     $opt_silent && exit $EXIT_SUCCESS
 
-    echo 
"----------------------------------------------------------------------"
-    echo "Libraries have been installed in:"
-    for libdir in $libdirs; do
-      $ECHO "   $libdir"
-    done
-    echo
-    echo "If you ever happen to want to link against installed libraries"
-    echo "in a given directory, LIBDIR, you must either use libtool, and"
-    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    echo "flag during linking and do at least one of the following:"
-    if test -n "$shlibpath_var"; then
-      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      echo "     during execution"
-    fi
-    if test -n "$runpath_var"; then
-      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
-      echo "     during linking"
-    fi
-    if test -n "$hardcode_libdir_flag_spec"; then
-      libdir=LIBDIR
-      eval flag=\"$hardcode_libdir_flag_spec\"
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo 
"----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+       $ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+       echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+       echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+       libdir=LIBDIR
+       eval flag=\"$hardcode_libdir_flag_spec\"
 
-      $ECHO "   - use the \`$flag' linker flag"
-    fi
-    if test -n "$admincmds"; then
-      $ECHO "   - have your system administrator run these commands:$admincmds"
-    fi
-    if test -f /etc/ld.so.conf; then
-      echo "   - have your system administrator add LIBDIR to 
\`/etc/ld.so.conf'"
-    fi
-    echo
+       $ECHO "   - use the \`$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+       $ECHO "   - have your system administrator run these 
commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+       echo "   - have your system administrator add LIBDIR to 
\`/etc/ld.so.conf'"
+      fi
+      echo
 
-    echo "See any operating system documentation about shared libraries for"
-    case $host in
-      solaris2.[6789]|solaris2.1[0-9])
-        echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-       echo "pages."
-       ;;
-      *)
-        echo "more information, such as the ld(1) and ld.so(8) manual pages."
-        ;;
-    esac
-    echo 
"----------------------------------------------------------------------"
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+       solaris2.[6789]|solaris2.1[0-9])
+         echo "more information, such as the ld(1), crle(1) and ld.so(8) 
manual"
+         echo "pages."
+         ;;
+       *)
+         echo "more information, such as the ld(1) and ld.so(8) manual pages."
+         ;;
+      esac
+      echo 
"----------------------------------------------------------------------"
+    fi
     exit $EXIT_SUCCESS
 }
 
@@ -1582,6 +1655,9 @@ func_mode_install ()
        ;;
 
       *.la)
+       func_resolve_sysroot "$file"
+       file=$func_resolve_sysroot_result
+
        # Check to see that this really is a libtool archive.
        func_lalib_unsafe_p "$file" \
          || func_fatal_help "\`$file' is not a valid libtool archive"
@@ -4342,15 +4418,16 @@ 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
+       func_resolve_sysroot "$func_stripname_result"
+       dir=$func_resolve_sysroot_result
        # We need an absolute path.
        case $dir in
        [\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -4362,9 +4439,15 @@ func_mode_link ()
          ;;
        esac
        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
@@ -4435,7 +4518,7 @@ func_mode_link ()
       # Tru64 UNIX uses -model [arg] to determine the layout of C++
       # classes, name mangling, and exception handling.
       # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot)
+      -model|-arch|-isysroot|--sysroot)
        func_append compiler_flags " $arg"
        func_append compile_command " $arg"
        func_append finalize_command " $arg"
@@ -4516,6 +4599,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"
          ;;
@@ -4632,8 +4719,9 @@ func_mode_link ()
       # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
       # @file                GCC response files
       # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*)
         func_quote_for_eval "$arg"
        arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
@@ -4746,16 +4834,17 @@ func_mode_link ()
       *.la)
        # A libtool-controlled library.
 
+       func_resolve_sysroot "$arg"
        if test "$prev" = dlfiles; then
          # This library was specified with -dlopen.
-         func_append dlfiles " $arg"
+         func_append dlfiles " $func_resolve_sysroot_result"
          prev=
        elif test "$prev" = dlprefiles; then
          # The library was specified with -dlpreopen.
-         func_append dlprefiles " $arg"
+         func_append dlprefiles " $func_resolve_sysroot_result"
          prev=
        else
-         func_append deplibs " $arg"
+         func_append deplibs " $func_resolve_sysroot_result"
        fi
        continue
        ;;
@@ -4909,8 +4998,9 @@ func_mode_link ()
        for lib in $dlprefiles; do
          # Ignore non-libtool-libs
          dependency_libs=
+         func_resolve_sysroot "$lib"
          case $lib in
-         *.la) func_source "$lib" ;;
+         *.la) func_source "$func_resolve_sysroot_result" ;;
          esac
 
          # Collect preopened libtool deplibs, except any this library
@@ -5043,7 +5133,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
@@ -5057,7 +5148,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"
@@ -5068,7 +5160,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 "*) ;;
@@ -5078,7 +5171,10 @@ func_mode_link ()
          deplibs="$deplib $deplibs"
          continue
          ;;
-       *.la) lib="$deplib" ;;
+       *.la)
+         func_resolve_sysroot "$deplib"
+         lib=$func_resolve_sysroot_result
+         ;;
        *.$libext)
          if test "$pass" = conv; then
            deplibs="$deplib $deplibs"
@@ -5275,14 +5371,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
@@ -5376,7 +5472,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?
@@ -5777,12 +5874,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
@@ -5792,8 +5895,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" ;;
@@ -6338,7 +6443,8 @@ func_mode_link ()
        # If the user specified any rpath flags, then add them.
        temp_xrpath=
        for libdir in $xrpath; do
-         func_append temp_xrpath " -R$libdir"
+         func_replace_sysroot "$libdir"
+         func_append temp_xrpath " -R$func_replace_sysroot_result"
          case "$finalize_rpath " in
          *" $libdir "*) ;;
          *) func_append finalize_rpath " $libdir" ;;
@@ -6796,6 +6902,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
@@ -8004,7 +8112,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"
-               func_append newdependency_libs " $libdir/$name"
+               func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+               ;;
+             -L*)
+               func_stripname -L '' "$deplib"
+               func_replace_sysroot "$func_stripname_result"
+               func_append newdependency_libs " -L$func_replace_sysroot_result"
+               ;;
+             -R*)
+               func_stripname -R '' "$deplib"
+               func_replace_sysroot "$func_stripname_result"
+               func_append newdependency_libs " -R$func_replace_sysroot_result"
                ;;
              *) func_append newdependency_libs " $deplib" ;;
              esac
@@ -8020,7 +8138,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"
-               func_append newdlfiles " $libdir/$name"
+               func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
                ;;
              *) func_append newdlfiles " $lib" ;;
              esac
@@ -8039,7 +8157,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"
-               func_append newdlprefiles " $libdir/$name"
+               func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
                ;;
              esac
            done
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 891a9f8..5bf28b7 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -173,6 +173,7 @@ m4_require([_LT_CHECK_MAGIC_METHOD])dnl
 m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
 
 _LT_CONFIG_LIBTOOL_INIT([
 # See if we are running on zsh, and set the options which allow our
@@ -1166,6 +1167,39 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects 
backslashes])
 ])# _LT_PROG_ECHO_BACKSLASH
 
 
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$GCC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
 # _LT_ENABLE_LOCK
 # ---------------
 m4_defun([_LT_ENABLE_LOCK],
@@ -6686,6 +6720,29 @@ AC_LANG_POP
 ])# _LT_LANG_CXX_CONFIG
 
 
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
 # ---------------------------------
 # Figure out "hidden" library dependencies from verbose
@@ -6694,6 +6751,7 @@ AC_LANG_POP
 # objects, libraries and library flags.
 m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
 # Dependencies to place before and after the object being linked:
 _LT_TAGVAR(predep_objects, $1)=
 _LT_TAGVAR(postdep_objects, $1)=
@@ -6764,13 +6822,22 @@ 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.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; 
p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; 
p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; 
p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$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.
@@ -6790,6 +6857,7 @@ if AC_TRY_EVAL(ac_compile); then
           _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
         fi
        fi
+       prev=
        ;;
 
     *.$objext)
diff --git a/tests/sysroot.at b/tests/sysroot.at
new file mode 100644
index 0000000..c0ac6d1
--- /dev/null
+++ b/tests/sysroot.at
@@ -0,0 +1,208 @@
+# static.at -- test flags for sysrooting          -*- Autotest -*-
+#
+#   Copyright (C) 2009 Free Software Foundation, Inc.
+#   Written by Paolo Bonzini, 2009
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+m4_define([SYSROOT_TEST], [
+AT_SETUP([$1])
+AT_KEYWORDS([libtool sysroot])
+
+gcc_sysroot=`$CC --print-sysroot 2> /dev/null`
+if test $? != 0; then
+  gcc_sysroot=
+fi
+AT_CHECK([test -n "$gcc_sysroot" || exit 77])
+
+# Detect installation prefix for the compiler
+prefix=
+for i in crt1.o crt2.o crti.o; do
+  j=`$CC --print-file-name $i 2> /dev/null`
+  test $? = 0 || continue
+  case "$j" in
+    $gcc_sysroot*/lib/$i)
+      prefix=`echo "$j" | sed "s,^$gcc_sysroot\\(.*\\)/lib/$i\$,\\1,"`
+      break ;;
+  esac
+done
+AT_CHECK([test -n "$prefix" || exit 77])
+
+sysroot=`pwd`/sys-root
+
+# difficult to use AS_DIRNAME inside the AT_CHECK macro, so
+# encapsulate as a shell function.
+local_dirname() {
+  AS_DIRNAME(["$[]1"])
+}
+
+AT_CHECK([
+(cd "$gcc_sysroot" && find ".$prefix/bin" ".$prefix/include" ".$prefix/lib" \! 
-type d) | \
+while read file; do
+  dir=`local_dirname "$sysroot/$file"`
+  test -d "$dir" || mkdir -p "$dir"
+  rm -f "$sysroot/$file"
+  ln -s "$gcc_sysroot/$file" "$sysroot/$file" || \
+    cp "$gcc_sysroot/$file" "$sysroot/$file"
+done])
+
+LDFLAGS="$LDFLAGS --sysroot=$sysroot -no-undefined"
+configure_options="$configure_options --with-sysroot=$sysroot --prefix=$prefix"
+
+#???
+if test "$shlibpath_var" = PATH; then
+  configure_options="$configure_options --libdir=/$prefix/bin"
+fi
+
+AT_CHECK([mkdir lib1 lib2 prog])
+
+# Build and install package 1.
+AT_DATA([lib1/configure.ac],
+[[AC_INIT([lib1], [1.0])
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AC_CONFIG_SRCDIR([lib1.c])
+LT_INIT
+AC_OUTPUT(Makefile)
+]])
+
+AT_DATA([lib1/Makefile.am],
+[[lib_LTLIBRARIES = lib1.la
+lib1_la_SOURCES = lib1.c
+lib1_la_LDFLAGS = -rpath $(libdir)
+]])
+
+AT_DATA([lib1/lib1.c],
+[[#include <string.h>
+#include <stdlib.h>
+char *f(const char *s)
+{
+  return strdup (s);
+}
+]])
+
+cd lib1
+LT_AT_BOOTSTRAP([], [-I $abs_top_srcdir/libltdl/m4], [ignore],
+               [--add-missing], [], [], [all])
+
+AT_CHECK([$MAKE install DESTDIR=$sysroot], [0], [ignore], [ignore])
+AT_CHECK([test -f "$sysroot/$prefix/lib/lib1.la"])
+AT_CHECK([grep -F "$sysroot" "$sysroot/$prefix/lib/lib1.la"], [1])
+cd ..
+
+# Build and install package 2.
+AT_DATA([lib2/configure.ac],
+[[AC_INIT([lib2], [1.0])
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AC_CONFIG_SRCDIR([lib2.c])
+LT_INIT
+sysroot=$with_sysroot
+AC_SUBST([sysroot])
+AC_OUTPUT(Makefile)
+]])
+
+AT_DATA([lib2/Makefile.am],
+[[lib_LTLIBRARIES = lib2.la
+lib2_la_SOURCES = lib2.c
+lib2_la_LDFLAGS = -rpath $(libdir)
+lib2_la_LIBADD = $2]1[$3
+]])
+
+AT_DATA([lib2/lib2.c],
+[[#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+extern char *f(const char *s);
+char *g(const char *s)
+{
+  char *q = f(s);
+  puts (q);
+  return q;
+}
+]])
+
+cd lib2
+LT_AT_BOOTSTRAP([], [-I $abs_top_srcdir/libltdl/m4], [ignore],
+               [--add-missing], [], [], [all])
+
+AT_CHECK([$MAKE install DESTDIR=$sysroot], [0], [ignore], [ignore])
+AT_CHECK([test -f $sysroot/$prefix/lib/lib2.la])
+AT_CHECK([grep -F "$sysroot" "$sysroot/$prefix/lib/lib2.la"], [1])
+cd ..
+
+# Build and install a program.
+AT_DATA([prog/configure.ac],
+[[AC_INIT([prog], [1.0])
+AM_INIT_AUTOMAKE([foreign])
+AC_PROG_CC
+AC_CONFIG_SRCDIR([prog.c])
+LT_INIT
+sysroot=$with_sysroot
+AC_SUBST([sysroot])
+AC_OUTPUT(Makefile)
+]])
+
+AT_DATA([prog/Makefile.am],
+[[bin_PROGRAMS = prog
+prog_SOURCES = prog.c
+prog_LDADD = $2]2[$3
+]])
+
+AT_DATA([prog/prog.c],
+[[#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+extern char *g(const char *s);
+int main()
+{
+  char *q = g("hello world");
+  free (q);
+  return 0;
+}
+]])
+
+cd prog
+LT_AT_BOOTSTRAP([], [-I $abs_top_srcdir/libltdl/m4], [ignore],
+               [--add-missing], [], [], [all])
+
+AT_CHECK([$MAKE install DESTDIR=$sysroot], [0], [ignore], [ignore])
+AT_CHECK([test -f $sysroot/$prefix/bin/prog$EXEEXT])
+AT_CHECK([grep -F "$sysroot" "$sysroot/$prefix/bin/prog$EXEEXT"], [1])
+AT_CHECK([grep "'.*=" $sysroot/$prefix/lib/lib2.la], [0], [ignore])
+AT_CHECK([./libtool --mode=finish $sysroot/$prefix/lib/lib@<:@12@:>@.la], [0], 
[ignore])
+AT_CHECK([grep "'.*=" $sysroot/$prefix/lib/lib@<:@12@:>@.la], [1])
+
+# missing tests
+# 1) pass absolute .la files
+# 2) pass absolute -L
+# 2) pass relative .la files
+
+cd ..
+AT_CLEANUP
+])
+
+AT_BANNER([sysroot tests])
+SYSROOT_TEST([-L=.../lib -l],        [-L=$(libdir) -l], [])
+SYSROOT_TEST([-L SYSROOT/.../lib -l], [-L$(sysroot)$(libdir) -l], [])
+SYSROOT_TEST([SYSROOT/.../*.la],      [$(sysroot)$(libdir)/lib], [.la])
+
+dnl This one does not make sense.
+dnl SYSROOT_TEST([=.../*.la],        [=$(libdir)/lib], [.la])


hooks/post-receive
-- 
GNU Libtool



reply via email to

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