]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* config/ltmain.m4sh (func_lalib_p): Update function
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 29 Nov 2004 21:18:26 +0000 (21:18 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 29 Nov 2004 21:18:26 +0000 (21:18 +0000)
description. (func_lalib_unsafe_p): New function with same
functionality but written without forks; this function is safe
to use for cases where the argument either does not exist or
is required to be a lalib for correct operation.
* NEWS: Mention the fact that stdin is not to be used.
* (func_mode_execute, func_mode_install, func_mode_link):
Use func_lalib_unsafe_p where appropriate.
* (func_mode_execute): For the program wrapper, use
func_ltwrapper_p instead of func_lalib_p.

ChangeLog
NEWS
config/ltmain.m4sh

index 86ef4d6f3eb93b09f50b5672fc65c5039c8a2e1b..fe34e3b4b693dd268598cdc2028d4a15e617c774 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2004-11-29  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       * config/ltmain.m4sh (func_lalib_p): Update function
+       description. (func_lalib_unsafe_p): New function with same
+       functionality but written without forks; this function is safe
+       to use for cases where the argument either does not exist or
+       is required to be a lalib for correct operation.
+       * NEWS: Mention the fact that stdin is not to be used.
+       * (func_mode_execute, func_mode_install, func_mode_link):
+       Use func_lalib_unsafe_p where appropriate.
+       * (func_mode_execute): For the program wrapper, use
+       func_ltwrapper_p instead of func_lalib_p.
+
        * m4/libtool.m4 (_LT_LINKER_SHLIBS): Treat linux-dietlibc with
        the `diet' compiler wrapper (as opposed to the `diet-dyn'
        wrapper) as a static-only platform.
diff --git a/NEWS b/NEWS
index 74eae87b8cb79192d5f9f0c9e04bb73150663e31..07fb236bc041e38cc133426bcc02af91e1784a24 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ New in 2.1b: 2005-??-??; CVS version 2.1a, Libtool team:
 * Support for Portland Group compiler on Linux.
 * Fix libltdl on static platforms.
 * Support for linux-dietlibc (`diet' as well as `diet-dyn', separately).
+* Shell optimizations which break use of the stdin file descriptor in libtool.
 \f
 New in 1.9h: 2004-??-??; CVS version 1.9g, Libtool team:
 * Libtool versions can now be parallel installed, except that only one
index 39602408151fcfd40bb7eb4d2bc20699c4452188..b71e6c62ef4b132daf868f317c1f3fd12a396c26 100644 (file)
@@ -574,7 +574,7 @@ _LT_EOF
 
 
 # func_lalib_p file
-# True iff FILE is a libtool `.la' library.
+# True iff FILE is a libtool `.la' library or `.lo' object file.
 # This function is only a basic sanity check; it will hardly flush out
 # determined imposters.
 func_lalib_p ()
@@ -583,6 +583,28 @@ func_lalib_p ()
       | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 }
 
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -r "$1" && exec <"$1"; then
+       for lalib_p_l in 1 2 3 4
+       do
+           read lalib_p_line
+           case "$lalib_p_line" in
+               \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+           esac
+       done
+       exec <&-
+    fi
+    test "$lalib_p" = yes
+}
 
 # func_ltwrapper_p file
 # True iff FILE is a libtool wrapper script.
@@ -1431,15 +1453,15 @@ func_mode_execute ()
 
     # Handle -dlopen flags immediately.
     for file in $execute_dlfiles; do
-      test -f "$file" || \
-       func_fatal_help "\`$file' is not a file"
+      test -f "$file" \
+       || func_fatal_help "\`$file' is not a file"
 
       dir=
       case $file in
       *.la)
        # Check to see that this really is a libtool archive.
-       func_lalib_p "$file" \ ||
-         func_fatal_help "\`$lib' is not a valid libtool archive"
+       func_lalib_unsafe_p "$file" \
+         || func_fatal_help "\`$lib' is not a valid libtool archive"
 
        # Read the libtool library.
        dlname=
@@ -1505,7 +1527,7 @@ func_mode_execute ()
       -*) ;;
       *)
        # Do a test to see if this is really a libtool program.
-       if func_lalib_p "$file"; then
+       if func_ltwrapper_p "$file"; then
          # If there is no directory component, then add one.
          case $file in
          */* | *\\*) . $file ;;
@@ -1765,8 +1787,8 @@ func_mode_install ()
 
       *.la)
        # Check to see that this really is a libtool archive.
-       func_lalib_p "$file" || \
-         func_fatal_help "\`$file' is not a valid libtool archive"
+       func_lalib_unsafe_p "$file" \
+         || func_fatal_help "\`$file' is not a valid libtool archive"
 
        library_names=
        old_library=
@@ -2260,8 +2282,8 @@ func_mode_link ()
          ;;
        expsyms)
          export_symbols="$arg"
-         test -f "$arg" || \
-           func_fatal_error "symbol file \`$arg' does not exist"
+         test -f "$arg" \
+           || func_fatal_error "symbol file \`$arg' does not exist"
          prev=
          continue
          ;;
@@ -2299,7 +2321,7 @@ func_mode_link ()
              # A libtool-controlled object.
 
              # Check to see that this really is a libtool object.
-             if func_lalib_p "$arg"; then
+             if func_lalib_unsafe_p "$arg"; then
                pic_object=
                non_pic_object=
 
@@ -2792,7 +2814,7 @@ func_mode_link ()
        # A libtool-controlled object.
 
        # Check to see that this really is a libtool object.
-       if func_lalib_p "$arg"; then
+       if func_lalib_unsafe_p "$arg"; then
          pic_object=
          non_pic_object=
 
@@ -3305,8 +3327,8 @@ func_mode_link ()
        fi
 
        # Check to see that this really is a libtool archive.
-       func_lalib_p "$lib" || \
-         func_fatal_error "\`$lib' is not a valid libtool archive"
+       func_lalib_unsafe_p "$lib" \
+         || func_fatal_error "\`$lib' is not a valid libtool archive"
 
        ladir=`$ECHO "X$lib" | $Xsed -e 's%/[[^/]]*$%%'`
        test "X$ladir" = "X$lib" && ladir="."