Index: NEWS
===================================================================
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.182
diff -u -r1.182 NEWS
--- NEWS	8 Aug 2005 09:23:57 -0000	1.182
+++ NEWS	15 Aug 2005 23:19:58 -0000
@@ -12,6 +12,7 @@
   in object names, to enhance GCJ support.
 * Detection of compiler wrappers like distcc/ccache and $host_alias prefix.
 * Initial Support for FC (modern Fortran).
+* Much improved but still experimental support for MSVC/C++.
 
 New in 1.9h: 2004-??-??; CVS version 1.9g, Libtool team:
 * Bug fixes.
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.84
diff -u -r1.84 ltmain.m4sh
--- config/ltmain.m4sh	12 Aug 2005 21:06:13 -0000	1.84
+++ config/ltmain.m4sh	15 Aug 2005 23:20:00 -0000
@@ -704,6 +704,38 @@
 }
 
 
+# func_dashL_to_envvar deplibs_variable deplibs...
+# Move -L options from deplibs to $dashL_envvar
+# and store the rest of the deplibs in
+# $deplibs_variable
+func_dashL_to_envvar ()
+{
+  deplibs_variable=$1
+  shift
+  tmp_libs=
+  for deplib; do
+    case $deplib in
+    -L*)
+      env_path=`$ECHO "X${deplib}" | $Xsed -e 's/^-L//'`
+      case $host_os in
+      mingw*)
+	env_path=`cmd \\\\/C echo "$env_path " | $SED -e 's/"\(.*\) " *$/\1/'`
+	;;
+      cygwin*)
+	env_path=`cygpath -w "$env_path"`
+	;;
+      esac
+      eval $dashL_envvar="\"\$$dashL_envvar $dashL_envvar_spec$env_path\""
+      ;;
+    *)
+      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
@@ -1285,6 +1317,14 @@
     case $host_os in
     cygwin* | mingw* | pw32* | os2*)
       pic_mode=default
+      if test "$with_gcc" != yes; then
+	# Assume MSVC
+	if test "$tagname" = CC; then
+	  base_compile="$base_compile -TC"
+	elif test "$tagname" = CXX; then
+	  base_compile="$base_compile -TP"
+	fi
+      fi
       ;;
     esac
     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
@@ -2601,6 +2641,7 @@
 	  *-*-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.
@@ -4060,6 +4101,17 @@
 	      *) 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
@@ -4642,8 +4694,13 @@
 	      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 |
@@ -4666,7 +4723,14 @@
 		      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
@@ -4952,7 +5016,27 @@
 	      fi
 	    done
 	    IFS="$save_ifs"
-	    if test -n "$export_symbols_regex"; then
+	    case $host_os/$with_gcc/$skipped_export in
+	    mingw*/no/: | mingw*//: | cygwin*/no/: | cygwin*//:)
+	      # Assume MSVC _and_ lib archiver interface...
+	      # Build a lib using a command file and export symbols from
+	      # the lib instead of from the objects individually.
+	      skipped_export=false
+	      for obj in $libobjs; do
+		$ECHO \""$obj"\"
+	      done > $output_objdir/$libname.symlibcmd
+	      $RM $output_objdir/$libname.symlib
+	      func_show_eval '$AR $AR_FLAGS ${AR_OFLAGS}$output_objdir/$libname.symlib @$output_objdir/$libname.symlibcmd'
+	      save_libobjs="$libobjs"
+	      libobjs="$output_objdir/$libname.symlib"
+	      # Rerun export_symbols_cmds
+	      $run $RM $export_symbols
+	      func_execute_cmds "$export_symbols_cmds" 'exit $?'
+	      libobjs="$save_libobjs"
+	      ;;
+	    esac
+	    # No use to run $export_symbols_regex if exports are skipped...
+	    if test "X$skipped_export" != "X:" && test -n "$export_symbols_regex"; then
 	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
 	    fi
@@ -5186,6 +5270,15 @@
 	  libobjs="$libobjs $func_extract_archives_result"
 	fi
 
+	case $pass/$dashL_envvar in
+	link/) ;;
+	link/*)
+	  # Move all -L options to the environment variable
+	  # specified by $dashL_envvar.
+	  func_dashL_to_envvar deplibs $deplibs
+	  ;;
+	esac
+
 	save_ifs="$IFS"; IFS='~'
 	for cmd in $cmds; do
 	  IFS="$save_ifs"
@@ -5380,6 +5473,25 @@
 	;;
       esac
 
+      case $pass/$dashL_envvar in
+      link/) ;;
+      link/*)
+	# Move all -L options to the environment variable
+	# specified by $dashL_envvar.
+	eval save_dashL_envvar="\"\$$dashL_envvar\""
+
+	func_dashL_to_envvar compile_deplibs $compile_deplibs
+	eval prepend_dashL_envvar="$dashL_envvar=\\\"\$$dashL_envvar\\\""
+	compile_command="$prepend_dashL_envvar $compile_command"
+	eval $dashL_envvar="\"$save_dashL_envvar\""
+
+	func_dashL_to_envvar finalize_deplibs $finalize_deplibs
+	eval prepend_dashL_envvar="$dashL_envvar=\\\"\$$dashL_envvar\\\""
+	finalize_command="$prepend_dashL_envvar $finalize_command"
+	eval $dashL_envvar="\"$save_dashL_envvar\""
+	;;
+      esac
+
       compile_command="$compile_command $compile_deplibs"
       finalize_command="$finalize_command $finalize_deplibs"
 
@@ -5668,7 +5780,11 @@
 	    cat >> $cwrappersource<<"EOF"
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
+#ifdef _MSC_VER
+# include <direct.h>
+#else
+# include <unistd.h>
+#endif
 #include <malloc.h>
 #include <stdarg.h>
 #include <assert.h>
@@ -5720,10 +5836,14 @@
 
 /* -DDEBUG is fairly common in CFLAGS.  */
 #undef DEBUG
-#if defined DEBUGWRAPPER
-# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#ifdef _MSC_VER
+# define DEBUG()
 #else
-# define DEBUG(format, ...)
+# if defined DEBUGWRAPPER
+#  define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+# else
+#  define DEBUG(format, ...)
+# endif
 #endif
 
 const char *program_name = NULL;
@@ -5823,6 +5943,11 @@
   return base;
 }
 
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define _stat stat
+#endif
+
 int
 check_executable(const char * path)
 {
@@ -5996,7 +6121,10 @@
 	  # 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.
-	  $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+	  $opt_dry_run || {
+	     $opt_dry_run || $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+	     $STRIP $cwrapper
+	  }
 	  ;;
 	esac
 	$RM $output
@@ -6272,44 +6400,59 @@
 	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 	  cmds=$old_archive_cmds
 	else
-	  # the command line is too long to link in one step, link in parts
-	  func_echo "using piecewise archive linking..."
-	  save_RANLIB=$RANLIB
-	  RANLIB=:
-	  objlist=
-	  concat_cmds=
-	  save_oldobjs=$oldobjs
-	  # Is there a better way of finding the last object in the list?
-	  for obj in $save_oldobjs
-	  do
-	    last_oldobj=$obj
-	  done
-	  for obj in $save_oldobjs
-	  do
-	    oldobjs="$objlist $obj"
-	    objlist="$objlist $obj"
-	    eval test_cmds=\"$old_archive_cmds\"
-	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
-	       test "$len" -le "$max_cmd_len"; then
-	      :
-	    else
-	      # the above command should be used before it gets too long
-	      oldobjs=$objlist
-	      if test "$obj" = "$last_oldobj" ; then
-		RANLIB=$save_RANLIB
+	  case $host_os/$with_gcc in
+	  mingw*/no | mingw*/ | cygwin*/no | cygwin*/)
+	    # Assume MSVC _and_ lib archiver interface...
+	    func_echo "using command file archive linking..."
+	    for obj in $oldobjs; do
+	      $ECHO \""$obj"\"
+	    done > $output_objdir/$libname.libcmd
+	    save_oldobjs="$oldobjs"
+	    oldobjs=" @$output_objdir/$libname.libcmd"
+	    eval cmds=\"\$old_archive_cmds\"
+	    oldobjs="$save_oldobjs"
+	    ;;
+	  *)
+	    # the command line is too long to link in one step, link in parts
+	    func_echo "using piecewise archive linking..."
+	    save_RANLIB=$RANLIB
+	    RANLIB=:
+	    objlist=
+	    concat_cmds=
+	    save_oldobjs=$oldobjs
+	    # Is there a better way of finding the last object in the list?
+	    for obj in $save_oldobjs
+	    do
+	      last_oldobj=$obj
+	    done
+	    for obj in $save_oldobjs
+	    do
+	      oldobjs="$objlist $obj"
+	      objlist="$objlist $obj"
+	      eval test_cmds=\"$old_archive_cmds\"
+	      if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+		 test "$len" -le "$max_cmd_len"; then
+		:
+	      else
+		# the above command should be used before it gets too long
+		oldobjs=$objlist
+		if test "$obj" = "$last_oldobj" ; then
+		  RANLIB=$save_RANLIB
+		fi
+		test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+		eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+		objlist=
 	      fi
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
-	      objlist=
+	    done
+	    RANLIB=$save_RANLIB
+	    oldobjs=$objlist
+	    if test "X$oldobjs" = "X" ; then
+	      eval cmds=\"\$concat_cmds\"
+	    else
+	      eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
 	    fi
-	  done
-	  RANLIB=$save_RANLIB
-	  oldobjs=$objlist
-	  if test "X$oldobjs" = "X" ; then
-	    eval cmds=\"\$concat_cmds\"
-	  else
-	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
-	  fi
+	    ;;
+	  esac
 	fi
       fi
       func_execute_cmds "$cmds" 'exit $?'
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.209
diff -u -r1.209 libtool.m4
--- m4/libtool.m4	10 Aug 2005 06:25:10 -0000	1.209
+++ m4/libtool.m4	15 Aug 2005 23:20:03 -0000
@@ -1881,13 +1881,36 @@
       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'
+    shlibpath_overrides_runpath=yes
+    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
   ;;
@@ -2716,6 +2739,16 @@
   ;;
 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
@@ -2724,6 +2757,8 @@
     [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
 
 
@@ -3599,7 +3634,9 @@
     _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
   ;;
   cygwin* | mingw*)
-    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+    if test X$with_gcc = yes; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+    fi
   ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
@@ -4005,18 +4042,32 @@
       # 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
+      _LT_TAGVAR(file_list_spec, $1)='@'
       # 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(dashL_envvar, $1)=LINK
+      _LT_TAGVAR(dashL_envvar_spec, $1)='-LIBPATH:'
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      # Don't use ranlib
+      _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
       ;;
 
     darwin* | rhapsody*)
@@ -4582,6 +4633,10 @@
     [Commands necessary for linking programs (against libraries) with templates])
 _LT_TAGDECL([], [file_list_spec], [1],
     [Specify filename containing input files])
+_LT_TAGDECL([], [dashL_envvar], [1],
+    [When linking, move all paths specified with -L options to this variable])
+_LT_TAGDECL([], [dashL_envvar_spec], [1],
+    [When moving paths with dashL_envvar, prepend this to each path])
 dnl FIXME: Not yet implemented
 dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
 dnl    [Compiler flag to generate thread safe objects])
@@ -4986,28 +5041,61 @@
         ;;
 
       cygwin* | mingw* | pw32*)
-        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-        # as there is no search path for DLLs.
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-        _LT_TAGVAR(always_export_symbols, $1)=no
-        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
-          # If the export-symbols file already is a .def file (1st line
-          # is EXPORTS), use it as is; otherwise, prepend...
-          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-  	    cp $export_symbols $output_objdir/$soname.def;
-          else
-  	    echo EXPORTS > $output_objdir/$soname.def;
-  	    cat $export_symbols >> $output_objdir/$soname.def;
-          fi~
-          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
-        else
-          _LT_TAGVAR(ld_shlibs, $1)=no
-        fi
-        ;;
+	if test "$GXX" = yes; then
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	else
+	  # Assume MSVC++
+	  # 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
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+	  # 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 $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'
+	fi
+	;;
       darwin* | rhapsody*)
         case $host_os in
           rhapsody* | darwin1.[[012]])
