]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* config/ltmain.m4sh (func_lalib_p, func_ltwrapper_p): New
authorNoah Misch <noah@cs.caltech.edu>
Sun, 24 Oct 2004 16:34:29 +0000 (16:34 +0000)
committerGary V. Vaughan <gary@gnu.org>
Sun, 24 Oct 2004 16:34:29 +0000 (16:34 +0000)
functions that abstract .la sanity checking.
(func_mode_execute, func_mode_install, func_mode_link)
(func_mode_uninstall): Use them.

ChangeLog
config/ltmain.m4sh

index 3014447c6900e9fd4ddd390d5a99cb35e30e5b3d..419cb09b281f3507ce849b143cb7557b8c10aece 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-10-24  Noah Misch  <noah@cs.caltech.edu>
+
+       * 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  <gary@gnu.org>
 
        * config/ltmain.m4sh (opt_silent): Whether --silent was given.
index ebc7d57ad38d1bc3d70ad5c5297ececc90d8b60a..f68477a62257b1a5f579ce277529a5a7bdf9154e 100644 (file)
@@ -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