diff --git a/ChangeLog b/ChangeLog index 3014447c..419cb09b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-10-24 Noah Misch + + * 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. + 2004-10-24 Gary V. Vaughan * config/ltmain.m4sh (opt_silent): Whether --silent was given. diff --git a/config/ltmain.m4sh b/config/ltmain.m4sh index ebc7d57a..f68477a6 100644 --- a/config/ltmain.m4sh +++ b/config/ltmain.m4sh @@ -572,6 +572,28 @@ _LT_EOF fi } + +# func_lalib_p file +# True iff FILE is a libtool `.la' library. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_lalib_p "$1" +} + + # func_win32_libid arg # return the library type of file 'arg' # @@ -1416,7 +1438,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. @@ -1483,7 +1505,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 ;; @@ -1743,7 +1765,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= @@ -1914,7 +1936,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= @@ -2267,7 +2289,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= @@ -2760,7 +2782,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= @@ -3098,8 +3120,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 @@ -3268,10 +3289,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="." @@ -6461,7 +6480,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. @@ -6508,7 +6527,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 @@ -6540,7 +6559,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