[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Factor out .la validity checks
From: |
Noah Misch |
Subject: |
Factor out .la validity checks |
Date: |
Fri, 22 Oct 2004 15:59:29 -0700 |
User-agent: |
Mutt/1.5.6i |
This patch (against HEAD) factors out a common sanity check for the validity of
a .la file. The check varied slightly throughout ltmain.m4sh, and it regularly
failed to quote the file name. This also eliminates a sub-shell, which might
speed things up on some platforms. Comments and test results appreciated.
2004-10-22 Noah Misch <address@hidden>
* config/ltmain.m4sh (func_lalib_p, func_ltwrapper_p): New
functions that abstract .la sanity checking.
(func_mode_execute, func_mode_install, func_mode_link,
func_mode_uninstall): Use them.
diff -X dontdiff -uwrp lt-clean/config/ltmain.m4sh
lt-func_lalib_p/config/ltmain.m4sh
--- lt-clean/config/ltmain.m4sh Fri Oct 22 03:05:59 2004
+++ lt-func_lalib_p/config/ltmain.m4sh Fri Oct 22 18:26:11 2004
@@ -135,6 +135,19 @@ func_fatal_configuration ()
func_fatal_error "Fatal configuration error."
}
+# func_lalib_p file - true iff `file' is a libtool `.la' library
+# func_ltwrapper_p file - true iff `file' is a libtool wrapper script
+#
+# These functions are only basic sanity checks; they will hardly flush
+# out determined imposters.
+func_lalib_p ()
+{
+ $SED -e 4q "$1" | $GREP "^# Generated by .*$PACKAGE" >/dev/null 2>&1
+}
+func_ltwrapper_p ()
+{
+ func_lalib_p "$1"
+}
# func_config
# Display the configuration for all the tags in this script.
@@ -1430,7 +1443,7 @@ func_mode_execute ()
case $file in
*.la)
# Check to see that this really is a libtool archive.
- (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE") >/dev/null
2>&1 || \
+ func_lalib_p "$file" || \
func_fatal_help "\`$lib' is not a valid libtool archive"
# Read the libtool library.
@@ -1497,7 +1510,7 @@ func_mode_execute ()
-*) ;;
*)
# Do a test to see if this is really a libtool program.
- if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE")
>/dev/null 2>&1; then
+ if func_lalib_p "$file"; then
# If there is no directory component, then add one.
case $file in
*/* | *\\*) . $file ;;
@@ -1758,7 +1771,7 @@ func_mode_install ()
*.la)
# Check to see that this really is a libtool archive.
- (${SED} -e '2q' $file | $GREP "^# Generated by ltmain.sh ") >/dev/null
2>&1 || \
+ func_lalib_p "$file" || \
func_fatal_help "\`$file' is not a valid libtool archive"
library_names=
@@ -1939,7 +1952,7 @@ func_mode_install ()
wrapper=$file
;;
esac
- if (${SED} -e '4q' $wrapper | $GREP "^# Generated by
.*$PACKAGE")>/dev/null 2>&1; then
+ if func_ltwrapper_p "$wrapper"; then
notinst_deplibs=
relink_command=
@@ -2289,7 +2302,7 @@ func_mode_link ()
# A libtool-controlled object.
# Check to see that this really is a libtool object.
- if (${SED} -e '2q' $arg | $GREP "^# Generated by ltmain.sh ")
>/dev/null 2>&1; then
+ if func_lalib_p "$arg"; then
pic_object=
non_pic_object=
@@ -2784,7 +2797,7 @@ func_mode_link ()
# A libtool-controlled object.
# Check to see that this really is a libtool object.
- if (${SED} -e '2q' $arg | $GREP "^# Generated by .*$PACKAGE")
>/dev/null 2>&1; then
+ if func_lalib_p "$arg"; then
pic_object=
non_pic_object=
@@ -3124,8 +3137,7 @@ func_mode_link ()
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $deplib "*)
- if (${SED} -e '2q' $lib |
- $GREP "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ if func_lalib_p "$lib"; then
library_names=
old_library=
case $lib in
@@ -3294,10 +3306,8 @@ func_mode_link ()
fi
# Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $lib | $GREP "^# Generated by ltmain.sh ")
>/dev/null 2>&1; then :
- else
+ func_lalib_p "$lib" || \
func_fatal_error "\`$lib' is not a valid libtool archive"
- fi
ladir=`$ECHO "X$lib" | $Xsed -e 's%/[[^/]]*$%%'`
test "X$ladir" = "X$lib" && ladir="."
@@ -6490,7 +6500,7 @@ func_mode_uninstall ()
case $name in
*.la)
# Possibly a libtool archive, so verify it.
- if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE")
>/dev/null 2>&1; then
+ if func_lalib_p "$file"; then
. $dir/$name
# Delete the libtool libraries and symlinks.
@@ -6539,7 +6549,7 @@ func_mode_uninstall ()
*.lo)
# Possibly a libtool object, so verify it.
- if (${SED} -e '2q' $file | $GREP "^# Generated by .*$PACKAGE")
>/dev/null 2>&1; then
+ if func_lalib_p "$file"; then
# Read the .lo file
. $dir/$name
@@ -6571,7 +6581,7 @@ func_mode_uninstall ()
;;
esac
# Do a test to see if this is a libtool program.
- if (${SED} -e '4q' $file | $GREP "^# Generated by .*$PACKAGE")
>/dev/null 2>&1; then
+ if func_ltwrapper_p "$file"; then
relink_command=
. $dir/$noexename
- Factor out .la validity checks,
Noah Misch <=