? msvc
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.130.2.17
diff -u -u -5 -r1.130.2.17 Makefile.am
--- Makefile.am	5 Jun 2005 18:18:17 -0000	1.130.2.17
+++ Makefile.am	5 Jul 2005 21:00:35 -0000
@@ -269,10 +269,11 @@
 
 # Be sure to reexport important environment variables:
 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
 	CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
 	LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
+	AR="$(AR)" AR_FLAGS="${AR_FLAGS}" AR_SEP="${AR_SEP}" STRIP="$(STRIP)" \
 	OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
 	CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
 	F77="$(F77)" FFLAGS="$(FFLAGS)" \
 	GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
 
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.1.2.58
diff -u -u -5 -r1.1.2.58 ltmain.m4sh
--- config/ltmain.m4sh	3 Jul 2005 16:56:25 -0000	1.1.2.58
+++ config/ltmain.m4sh	5 Jul 2005 21:00:36 -0000
@@ -626,10 +626,40 @@
   esac
   $ECHO "$win32_libid_type"
 }
 
 
+# func_msvc_dashL_to_LINK deplibs_variable deplibs...
+func_msvc_dashL_to_LINK ()
+{
+  $opt_debug
+  # weed out -L options
+  deplibs_variable=$1
+  shift
+  tmp_libs=
+  for deplib; do
+    case $deplib in
+    -L*)
+      deplib=`$ECHO "X${deplib}" | $Xsed -e 's/^-L//'`
+      case $host_os in
+      mingw*)
+	LINK="$LINK -LIBPATH:`cmd \\\\/C echo \"$bar \" | sed -e 's/\"\(.*\) \" /\1/'`"
+	;;
+      *)
+	LINK="$LINK -LIBPATH:`cygpath -w \"$deplib\"`"
+	;;
+      esac
+      ;;
+    *)  
+      tmp_libs="$tmp_libs $deplib"
+      ;;
+    esac
+  done
+  eval $deplibs_variable="\"$tmp_libs\""
+}
+
+
 
 # func_infer_tag arg
 # Infer tagged configuration to use if any are available and
 # if one wasn't chosen via the "--tag" command line option.
 # Only attempt this if the compiler in the base compile
@@ -929,13 +959,21 @@
 func_extract_an_archive ()
 {
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
-    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
-    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
-    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+    if test "X$ar_extract_one_by_one" != "Xyes"; then
+      $show "(cd $f_ex_an_ar_dir && $AR ${AR_XFLAGS}${AR_SEP}$f_ex_an_ar_oldlib)"
+      $run eval "(cd \$f_ex_an_ar_dir && $AR ${AR_XFLAGS}${AR_SEP}\$f_ex_an_ar_oldlib)" || exit $?
+    else
+      $AR ${AR_TFLAGS}${AR_SEP}"$f_ex_an_ar_oldlib" | while read name
+      do
+        $show "(cd $f_ex_an_ar_dir && $AR ${AR_XFLAGS}${AR_SEP}$name $f_ex_an_ar_oldlib)"
+        $run eval "(cd \$f_ex_an_ar_dir && $AR ${AR_XFLAGS}${AR_SEP}\$name \$f_ex_an_ar_oldlib)" || exit $?
+      done
+    fi
+    if ($AR ${AR_TFLAGS}${AR_SEP}"$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
      :
     else
      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
     fi
 }
@@ -2596,10 +2634,11 @@
 	    continue
 	    ;;
 	  *-*-mingw* | *-*-os2*)
 	    # These systems don't actually have a C library (as such)
 	    test "X$arg" = "X-lc" && continue
+	    test "X$with_gcc" != "Xyes" && test "X$arg" = "X-lm" && continue
 	    ;;
 	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
 	    # Do not include libc due to us having libc/libc_r.
 	    test "X$arg" = "X-lc" && continue
 	    ;;
@@ -4076,10 +4115,21 @@
 	      case " $tmp_libs " in
 	      *" $deplib "*) ;;
 	      *) tmp_libs="$tmp_libs $deplib" ;;
 	      esac
 	      ;;
+	    -l*)
+	      if test "X$with_gcc" != Xyes; then
+		case $host_os/$linkmode in
+		mingw*/prog | cygwin*/prog)
+		  # assume MSVC
+		  deplib=`$ECHO "X${deplib}.lib" | $Xsed -e 's/^-l//'`
+		  ;;
+		esac
+	      fi
+	      tmp_libs="$tmp_libs $deplib"
+	      ;;
 	    *) tmp_libs="$tmp_libs $deplib" ;;
 	    esac
 	  done
 	  eval $var=\"$tmp_libs\"
 	done # for var
@@ -4657,12 +4707,17 @@
 		  ;;
 		esac
 	      fi
 	      if test -n "$a_deplib" ; then
 		libname=`eval "\\$ECHO \"$libname_spec\""`
+		if test -n "$file_magic_glob"; then
+		  libnameglob=`$ECHO "X$libname" | $Xsed -e $file_magic_glob`
+		else
+		  libnameglob=$libname
+		fi
 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[[.-]]* 2>/dev/null`
+		  potential_libs=`ls $i/$libnameglob[[.-]]* 2>/dev/null`
 		  for potent_lib in $potential_libs; do
 		      # Follow soft links.
 		      if ls -lLd "$potent_lib" 2>/dev/null |
 			 $GREP " -> " >/dev/null; then
 			continue
@@ -4681,11 +4736,18 @@
 			esac
 		      done
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
 			 $SED -e 10q |
 			 $EGREP "$file_magic_regex" > /dev/null; then
-			newdeplibs="$newdeplibs $a_deplib"
+			case $with_gcc/$host in
+			no/*-*-mingw* | /*-*-mingw* | no/*-*-cygwin* | /*-*-cygwin*)
+			  newdeplibs="$newdeplibs ${name}.lib"
+			  ;;
+			*)
+			  newdeplibs="$newdeplibs $a_deplib"
+			  ;;
+			esac
 			a_deplib=""
 			break 2
 		      fi
 		  done
 		done
@@ -5185,10 +5247,17 @@
 
 	  func_extract_archives $gentop $dlprefiles
 	  libobjs="$libobjs $func_extract_archives_result"
 	fi
 
+	case $host_os/$with_gcc/$pass in
+	  mingw*/no/link | mingw*//link | cygwin*/no/link | cygwin*//link)
+	    # assume MSVC
+	    func_msvc_dashL_to_LINK deplibs $deplibs
+	  ;;
+	esac
+
 	save_ifs="$IFS"; IFS='~'
 	for cmd in $cmds; do
 	  IFS="$save_ifs"
 	  eval cmd=\"$cmd\"
 	  func_quote_for_expand "$cmd"
@@ -5395,10 +5464,17 @@
 	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([[^ $]]*\).ltframework% -framework \1%g'`
 	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([[^ $]]*\).ltframework% -framework \1%g'`
 	;;
       esac
 
+      case $host_os/$with_gcc/$pass in
+        mingw*/no/link | mingw*//link | cygwin*/no/link | cygwin*//link)
+	  # assume MSVC
+	  func_msvc_dashL_to_LINK compile_deplibs $compile_deplibs
+	;;
+      esac
+
       compile_command="$compile_command $compile_deplibs"
       finalize_command="$finalize_command $finalize_deplibs"
 
       if test -n "$rpath$xrpath"; then
 	# If the user specified any rpath flags, then add them.
@@ -5681,11 +5757,13 @@
 */
 EOF
 	    cat >> $cwrappersource<<"EOF"
 #include <stdio.h>
 #include <stdlib.h>
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 #include <malloc.h>
 #include <stdarg.h>
 #include <assert.h>
 #include <ctype.h>
 #include <string.h>
@@ -5733,15 +5811,19 @@
   if (stale) { free ((void *) stale); stale = 0; } \
 } while (0)
 
 /* -DDEBUG is fairly common in CFLAGS.  */
 #undef DEBUG
+#ifdef _MSC_VER
+# define DEBUG()
+#else
 #if defined DEBUGWRAPPER
 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 #else
 # define DEBUG(format, ...)
 #endif
+#endif
 
 const char *program_name = NULL;
 
 void * xmalloc (size_t num);
 char * xstrdup (const char *string);
@@ -5845,10 +5927,13 @@
 
   DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
   if ((!path) || (!*path))
     return 0;
 
+#ifdef _MSC_VER
+  return 1;
+#else
   if ((stat (path, &st) >= 0) &&
       (
 	/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 #if defined (S_IXOTH)
        ((st.st_mode & S_IXOTH) == S_IXOTH) ||
@@ -5859,10 +5944,11 @@
        ((st.st_mode & S_IXUSR) == S_IXUSR))
       )
     return 1;
   else
     return 0;
+#endif
 }
 
 /* Searches for the full path of the wrapper.  Returns
    newly allocated full path name if found, NULL otherwise */
 char *
@@ -6009,11 +6095,15 @@
 	  # we should really use a build-platform specific compiler
 	  # here, but OTOH, the wrappers (shell script and this C one)
 	  # are only useful if you want to execute the "real" binary.
 	  # Since the "real" binary is built for $host, then this
 	  # wrapper might as well be built for $host, too.
-	  $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+	  if test "$with_gcc" = "yes"; then
+	    $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+	  else
+	    $run $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+	  fi
 	  ;;
 	esac
 	$RM $output
 	trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
 
Index: libltdl/Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/Makefile.am,v
retrieving revision 1.64.2.18
diff -u -u -5 -r1.64.2.18 Makefile.am
--- libltdl/Makefile.am	22 Apr 2005 10:03:59 -0000	1.64.2.18
+++ libltdl/Makefile.am	5 Jul 2005 21:00:36 -0000
@@ -58,17 +58,17 @@
 			  lt__alloc.c \
 			  lt_dlloader.c \
 			  lt_error.c \
 			  ltdl.c ltdl.h \
 			  slist.c
-libltdl_la_CPPFLAGS	= -DLTDLOPEN=libltdl $(AM_CPPFLAGS)
+libltdl_la_CPPFLAGS	= -DLTDLOPEN=ltdl $(AM_CPPFLAGS)
 libltdl_la_LDFLAGS	= $(AM_LDFLAGS) $(VERSION_INFO) $(LT_DLPREOPEN)
 libltdl_la_LIBADD	= $(LTLIBOBJS)
 libltdl_la_DEPENDENCIES	= $(LT_DLLOADERS) $(LTLIBOBJS)
 
 libltdlc_la_SOURCES	= $(libltdl_la_SOURCES)
-libltdlc_la_CPPFLAGS	= -DLTDLOPEN=libltdlc $(AM_CPPFLAGS)
+libltdlc_la_CPPFLAGS	= -DLTDLOPEN=ltdlc $(AM_CPPFLAGS)
 libltdlc_la_LDFLAGS	= $(AM_LDFLAGS) $(LT_DLPREOPEN)
 libltdlc_la_LIBADD	= $(libltdl_la_LIBADD)
 libltdlc_la_DEPENDENCIES= $(libltdl_la_DEPENDENCIES)
 
 ## The loaders are preopened by libltdl, itself always built from
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.125.2.65
diff -u -u -5 -r1.125.2.65 libtool.m4
--- m4/libtool.m4	3 Jul 2005 18:15:30 -0000	1.125.2.65
+++ m4/libtool.m4	5 Jul 2005 21:00:37 -0000
@@ -1021,18 +1021,65 @@
 
 need_locks="$enable_libtool_lock"
 ])# _LT_ENABLE_LOCK
 
 
+# _LT_PROG_AR
+# ----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar lib "link -lib"], false)
+: ${AR=ar}
+_LT_DECL([], [AR], [1], [The archiver])
+
+AC_CACHE_CHECK([the archiver ($AR) interface],[lt_cv_ar_interface],
+  [lt_cv_ar_interface="ar"
+  printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval "$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext" &>conftest.err)
+  ac_status=$?
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  test $ac_status = 0 && test -f conftest.lib && lt_cv_ar_interface="lib"
+  rm -f conftest*])
+
+case $lt_cv_ar_interface in
+ar)
+  : ${AR_FLAGS=cru}
+  : ${AR_TFLAGS=t}
+  : ${AR_XFLAGS=x}
+  test -z "$AR_SEP" && AR_SEP=' '
+  _LT_TAGVAR(ar_extract_one_by_one, $1)=no
+  ;;
+lib)
+  : ${AR_FLAGS="-NOLOGO -OUT:"}
+  : ${AR_TFLAGS="-NOLOGO -LIST "}
+  : ${AR_XFLAGS="-NOLOGO -EXTRACT:"}
+  test -z "$AR_SEP" && AR_SEP=''
+  _LT_TAGVAR(ar_extract_one_by_one, $1)=yes
+  # Don't use ranlib
+  : ${RANLIB=:}
+  ;;
+esac
+
+_LT_DECL([], [ar_extract_one_by_one], [1],
+  [Extract archive members one by one])
+
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+_LT_DECL([], [AR_TFLAGS], [1], [Flags to list archive content])
+_LT_DECL([], [AR_XFLAGS], [1], [Flags to extract an archive])
+_LT_DECL([], [AR_SEP], [1], [Separator between AR flags and AR files])
+AC_SUBST([AR])
+AC_SUBST([AR_FLAGS])
+AC_SUBST([AR_SEP])
+])# LT_PROG_AR
+
+
 # _LT_CMD_OLD_ARCHIVE
 # -------------------
 m4_defun([_LT_CMD_OLD_ARCHIVE],
-[AC_CHECK_TOOL(AR, ar, false)
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1])
+[_LT_PROG_AR
 
 AC_CHECK_TOOL(STRIP, strip, :)
 test -z "$STRIP" && STRIP=:
 _LT_DECL([], [STRIP], [1], [A symbol stripping program])
 
@@ -1040,11 +1087,11 @@
 test -z "$RANLIB" && RANLIB=:
 _LT_DECL([], [RANLIB], [1],
     [Commands used to install an old-style archive])
 
 # Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_archive_cmds='$AR $AR_FLAGS$AR_SEP$oldlib$oldobjs$old_deplibs'
 old_postinstall_cmds='chmod 644 $oldlib'
 old_postuninstall_cmds=
 
 if test -n "$RANLIB"; then
   case $host_os in
@@ -1124,11 +1171,11 @@
   [$2=no
    save_LDFLAGS="$LDFLAGS"
    LDFLAGS="$LDFLAGS $3"
    printf "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The compiler can only warn and ignore the option if not recognized
+     # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
        $ECHO "X$_lt_linker_boilerplate" | $Xsed > conftest.exp
@@ -1850,17 +1897,39 @@
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
     ;;
 
   *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    # Assume MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}.lib'
+    sys_lib_search_path_spec="$LIB"
+    if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+      # It is most probably a Windows format PATH.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+    else
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+    fi
+    # FIXME: find the short name or the path components, as spaces are
+    # common. (e.g. "Program Files" -> "PROGRA~1")
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    dynamic_linker='Win32 link.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
 
 darwin* | rhapsody*)
@@ -2685,18 +2754,30 @@
 tpf*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 esac
 ])
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+  file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | sed -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+  ;;
+*)
+  file_magic_glob=
+  ;;
+esac
+
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 _LT_DECL([], [deplibs_check_method], [1],
     [Method to check whether dependent libraries are shared objects])
 _LT_DECL([], [file_magic_cmd], [1],
     [Command to use when deplibs_check_method == "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method == "file_magic"])
 ])# _LT_CHECK_MAGIC_METHOD
 
 
 # LT_PATH_NM
 # ----------
@@ -3673,11 +3754,11 @@
       fi
       ;;
 
     amigaos*)
       if test "$host_cpu" = m68k; then
-        _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+        _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS$AR_SEP$lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
         _LT_TAGVAR(hardcode_minus_L, $1)=yes
       fi
 
       # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
@@ -3820,11 +3901,11 @@
     # PORTME fill in a description of your system's linker (not GNU ld)
     case $host_os in
     aix3*)
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=yes
-      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS$AR_SEP$lib $output_objdir/$soname'
       # Note: this linker hardcodes the directories in LIBPATH if there
       # are no directories specified by -L.
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
       if test "$GCC" = yes && test -z "$link_static_flag"; then
 	# Neither direct hardcoding nor static linking is supported with a
@@ -3947,18 +4028,18 @@
 	  _LT_TAGVAR(always_export_symbols, $1)=yes
 	  # Exported symbols can be pulled into shared objects from archives
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
 	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS$AR_SEP$output_objdir/$libname$release.a $output_objdir/$soname'
 	fi
       fi
       ;;
 
     amigaos*)
       if test "$host_cpu" = m68k; then
-        _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+        _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS$AR_SEP$lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
         _LT_TAGVAR(hardcode_minus_L, $1)=yes
       fi
       # see comment about different semantics on the GNU ld section
       _LT_TAGVAR(ld_shlibs, $1)=no
@@ -3973,22 +4054,33 @@
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
       # Tell ltmain to make .lib files, not .a files.
       libext=lib
       # Tell ltmain to make .dll files, not .so files.
       shrext_cmds=".dll"
       # FIXME: Setting linknames here is a bad hack.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-      # FIXME: Should let the user specify the lib program.
-      _LT_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
-      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -link -dll~linknames='
+      _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	else
+	  sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	fi~
+	$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs @$output_objdir/$soname.exp -link -DLL~
+	linknames='
+      # The linker will not automatically build a static lib if we build a DLL.
+      # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+      case $host_os in
+	# Not needed on MinGW
+	cygwin*) _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' ;;
+      esac
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      # Don't use ranlib
+      _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
       ;;
 
     darwin* | rhapsody*)
       case $host_os in
       rhapsody* | darwin1.[[012]])
@@ -4935,11 +5027,11 @@
   	    # Exported symbols can be pulled into shared objects from archives
   	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
   	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
   	    # This is similar to how AIX traditionally builds its shared
 	    # libraries.
-  	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+  	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS$AR_SEP$output_objdir/$libname$release.a $output_objdir/$soname'
           fi
         fi
         ;;
       chorus*)
         case $cc_basename in
Index: tests/demo/foo.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/demo/foo.h,v
retrieving revision 1.1.2.1
diff -u -u -5 -r1.1.2.1 foo.h
--- tests/demo/foo.h	22 Apr 2005 10:03:59 -0000	1.1.2.1
+++ tests/demo/foo.h	5 Jul 2005 21:00:37 -0000
@@ -31,10 +31,16 @@
 #  ifndef __CYGWIN__
 #    define __CYGWIN__
 #  endif
 #endif
 
+#ifdef _MSC_VER
+# define EXTERN extern __declspec(dllimport)
+#else
+# define EXTERN extern
+#endif
+
 /* __BEGIN_DECLS should be used at the beginning of your declarations,
    so that C++ compilers don't mangle their names.  Use __END_DECLS at
    the end of C declarations. */
 #undef __BEGIN_DECLS
 #undef __END_DECLS
@@ -65,9 +71,9 @@
 
 /* Declarations.  Note the wonderful use of the above macros. */
 __BEGIN_DECLS
 int foo LT_PARAMS((void));
 int hello LT_PARAMS((void));
-extern int nothing;
+EXTERN int nothing;
 __END_DECLS
 
 #endif /* !_FOO_H_ */
Index: tests/depdemo/sysdep.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/depdemo/sysdep.h,v
retrieving revision 1.1.2.1
diff -u -u -5 -r1.1.2.1 sysdep.h
--- tests/depdemo/sysdep.h	22 Apr 2005 10:04:00 -0000	1.1.2.1
+++ tests/depdemo/sysdep.h	5 Jul 2005 21:00:37 -0000
@@ -42,6 +42,12 @@
 # define __P(protos) protos
 #else
 # define __P(protos) ()
 #endif
 
+#ifdef _MSC_VER
+# define EXTERN extern __declspec(dllimport)
+#else
+# define EXTERN extern
+#endif
+
 #endif /* !_SYSDEP_H_ */
Index: tests/depdemo/l1/l1.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/depdemo/l1/l1.h,v
retrieving revision 1.1.2.1
diff -u -u -5 -r1.1.2.1 l1.h
--- tests/depdemo/l1/l1.h	22 Apr 2005 10:04:00 -0000	1.1.2.1
+++ tests/depdemo/l1/l1.h	5 Jul 2005 21:00:37 -0000
@@ -22,10 +22,10 @@
 #define _L1_H_ 1
 
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l1;
+EXTERN int var_l1;
 int	func_l1 __P((int));
 __END_DECLS
 
 #endif /* !_L1_H_ */
Index: tests/depdemo/l2/l2.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/depdemo/l2/l2.h,v
retrieving revision 1.1.2.1
diff -u -u -5 -r1.1.2.1 l2.h
--- tests/depdemo/l2/l2.h	22 Apr 2005 10:04:00 -0000	1.1.2.1
+++ tests/depdemo/l2/l2.h	5 Jul 2005 21:00:37 -0000
@@ -22,10 +22,10 @@
 #define _L2_H_ 1
 
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l2;
+EXTERN int var_l2;
 int	func_l2 __P((int));
 __END_DECLS
 
 #endif /* !_L2_H_ */
Index: tests/depdemo/l3/l3.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/depdemo/l3/l3.h,v
retrieving revision 1.1.2.1
diff -u -u -5 -r1.1.2.1 l3.h
--- tests/depdemo/l3/l3.h	22 Apr 2005 10:04:00 -0000	1.1.2.1
+++ tests/depdemo/l3/l3.h	5 Jul 2005 21:00:37 -0000
@@ -22,10 +22,10 @@
 #define _L3_H_ 1
 
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l3;
+EXTERN int var_l3;
 int	func_l3 __P((int));
 __END_DECLS
 
 #endif /* !_L3_H_ */
Index: tests/depdemo/l4/l4.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/depdemo/l4/l4.h,v
retrieving revision 1.1.2.1
diff -u -u -5 -r1.1.2.1 l4.h
--- tests/depdemo/l4/l4.h	22 Apr 2005 10:04:00 -0000	1.1.2.1
+++ tests/depdemo/l4/l4.h	5 Jul 2005 21:00:37 -0000
@@ -22,10 +22,10 @@
 #define _L4_H_ 1
 
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l4;
+EXTERN int var_l4;
 int	func_l4 __P((int));
 __END_DECLS
 
 #endif /* !_L4_H_ */
Index: tests/pdemo/foo.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/pdemo/foo.h,v
retrieving revision 1.1.2.2
diff -u -u -5 -r1.1.2.2 foo.h
--- tests/pdemo/foo.h	27 Apr 2005 14:15:54 -0000	1.1.2.2
+++ tests/pdemo/foo.h	5 Jul 2005 21:00:37 -0000
@@ -69,10 +69,12 @@
 #      define EXTERN extern __declspec(dllimport)
 #    endif
 #  else
 #    define EXTERN extern
 #  endif
+#elif defined(_MSC_VER)
+#  define EXTERN extern __declspec(dllimport)
 #else
 #  define EXTERN extern
 #endif
 
 /* Silly constants that the functions return. */
