]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in (win32_libid): Rewritten to improve speed.
authorCharles Wilson <cwilson@ece.gatech.edu>
Mon, 17 Feb 2003 18:55:45 +0000 (18:55 +0000)
committerRobert Boehne <rboehne@gnu.org>
Mon, 17 Feb 2003 18:55:45 +0000 (18:55 +0000)
ChangeLog
ltmain.in

index 53af095092be2f421f0cf709e41017485ba2144c..ba89b5a5dee295cc453db8b98c4f2c5675481827 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-17  Charles Wilson  <cwilson@ece.gatech.edu>
+
+       * ltmain.in (win32_libid): Rewritten to improve speed.
+
 2003-02-11  Richard Dawe  <rich@phekda.freeserve.co.uk>
 
        * libtoolize.in: Use the program found by AC_PROG_LN_S
index a6c39f7e925425c2dacbd171cc488286e5c7c246..60b8f59c41a0ccf8433692fabb3594536c8ee336 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -123,24 +123,34 @@ o2lo="s/\\.${objext}\$/.lo/"
 # that is supplied when $file_magic_command is called.
 win32_libid () {
   win32_libid_type="unknown"
-  if eval $OBJDUMP -f $1 2>/dev/null | \
-     grep -E 'file format pei+-i386(.*architecture: i386)?' >/dev/null ; then
-    win32_libid_type="x86 DLL"
-  else
-    if eval $OBJDUMP -f $1 2>/dev/null | \
-      grep -E 'file format pei*-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_libid_type="x86"
-      if eval file $1 2>/dev/null | \
-         grep -E 'ar archive' >/dev/null; then
-        win32_libid_type="$win32_libid_type archive"
-        if eval $NM -f posix -A $1 | awk '{print $3}' | grep "I" >/dev/null ; then
-          win32_libid_type="$win32_libid_type import"
-        else
-          win32_libid_type="$win32_libid_type static"
-        fi
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | head -n 10 2>/dev/null | \
+      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;}}'`
+      if test "X$win32_nmres" = "Ximport" ; then
+        win32_libid_type="x86 archive import"
+      else
+        win32_libid_type="x86 archive static"
       fi
     fi
-  fi
+    ;;
+  *DLL*) 
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
   echo $win32_libid_type
 }