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.
# 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 ()
| $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.
# 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=
-*) ;;
*)
# 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 ;;
*.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=
;;
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
;;
# 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=
# 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=
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="."