Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.174
diff -u -r1.174 Makefile.am
--- Makefile.am	26 Oct 2005 14:26:35 -0000	1.174
+++ Makefile.am	18 Nov 2005 10:57:07 -0000
@@ -378,6 +378,7 @@
 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)" STRIP="$(STRIP)" \
 	OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" \
 	SHELL="$(SHELL)" CONFIG_SHELL="$(SHELL)" \
 	CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.18
diff -u -r1.18 ltmain.m4sh
--- libltdl/config/ltmain.m4sh	10 Nov 2005 18:32:44 -0000	1.18
+++ libltdl/config/ltmain.m4sh	18 Nov 2005 10:57:10 -0000
@@ -703,6 +703,35 @@
 }
 
 
+# func_dashL_to_envvar deplibs_variable deplibs...
+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
@@ -1014,8 +1043,15 @@
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
-    func_show_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
+      func_show_eval "(cd \$f_ex_an_ar_dir && $AR ${AR_XFLAGS} ${AR_EFLAGS}\$f_ex_an_ar_oldlib)" || exit $?
+    else
+      $AR ${AR_TFLAGS} "$f_ex_an_ar_oldlib" | while read name
+      do
+	func_show_eval "(cd \$f_ex_an_ar_dir && $AR ${AR_XFLAGS} ${AR_EFLAGS}\$name \$f_ex_an_ar_oldlib)" || exit $?
+      done
+    fi
+    if ($AR ${AR_TFLAGS} "$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"
@@ -1284,6 +1320,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
@@ -2604,6 +2648,7 @@
 	  *-*-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.
@@ -4082,6 +4127,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
@@ -4669,8 +4725,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 |
@@ -4693,7 +4754,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
@@ -5256,6 +5324,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"
@@ -5450,6 +5527,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"
 
@@ -5738,7 +5834,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>
@@ -5790,10 +5890,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;
@@ -5893,6 +5997,11 @@
   return base;
 }
 
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define _stat stat
+#endif
+
 int
 check_executable(const char * path)
 {
@@ -6066,7 +6175,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
@@ -6342,44 +6454,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: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.46
diff -u -r1.46 libtool.m4
--- libltdl/m4/libtool.m4	14 Nov 2005 22:49:57 -0000	1.46
+++ libltdl/m4/libtool.m4	18 Nov 2005 10:57:13 -0000
@@ -1202,14 +1202,57 @@
 ])# _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}
+  ar_extract_one_by_one=no
+  ;;
+lib)
+  : ${AR_OFLAGS="-NOLOGO -OUT:"}
+  : ${AR_TFLAGS="-NOLOGO -LIST"}
+  : ${AR_EFLAGS="-NOLOGO -EXTRACT:"}
+  ar_extract_one_by_one=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_OFLAGS], [1], [Flags to create an archive, no space])
+_LT_DECL([], [AR_TFLAGS], [1], [Flags to list archive content])
+_LT_DECL([], [AR_XFLAGS], [1], [Flags to extract an archive])
+_LT_DECL([], [AR_EFLAGS], [1], [Flags to extract an archive, no space])
+])# 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=:
@@ -1221,7 +1264,7 @@
     [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_OFLAGS$oldlib$oldobjs$old_deplibs'
 old_postinstall_cmds='chmod 644 $oldlib'
 old_postuninstall_cmds=
 
@@ -2052,13 +2095,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
   ;;
@@ -2922,6 +2988,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
@@ -2930,6 +3006,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
 
 
@@ -3864,7 +3942,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'
@@ -3969,7 +4049,7 @@
 
     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_OFLAGS$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
@@ -4147,7 +4227,7 @@
     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_OFLAGS$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
@@ -4275,14 +4355,14 @@
 	  _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_OFLAGS$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_OFLAGS$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
@@ -4301,18 +4381,33 @@
       # 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
+      _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'
+      # Don't use ranlib
+      _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
       ;;
 
     darwin* | rhapsody*)
@@ -4868,6 +4963,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])
@@ -5240,7 +5339,7 @@
   	    _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_OFLAGS$output_objdir/$libname$release.a $output_objdir/$soname'
           fi
         fi
         ;;
@@ -5266,28 +5365,60 @@
         ;;
 
       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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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)='@'
+	  # 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]])
@@ -5600,7 +5731,7 @@
  	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
  		rm -rf $tpldir~
  		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
- 		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+ 		$AR $AR_FLAGS $AR_OFLAGS$oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
  		$RANLIB $oldlib'
  	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
  		rm -rf $tpldir~
Index: tests/demo/foo.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/demo/foo.h,v
retrieving revision 1.2
diff -u -r1.2 foo.h
--- tests/demo/foo.h	22 Apr 2005 10:10:31 -0000	1.2
+++ tests/demo/foo.h	18 Nov 2005 10:57:13 -0000
@@ -33,6 +33,12 @@
 #  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. */
@@ -67,7 +73,7 @@
 __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.2
diff -u -r1.2 sysdep.h
--- tests/depdemo/sysdep.h	22 Apr 2005 10:10:31 -0000	1.2
+++ tests/depdemo/sysdep.h	18 Nov 2005 10:57:13 -0000
@@ -44,4 +44,10 @@
 # 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.2
diff -u -r1.2 l1.h
--- tests/depdemo/l1/l1.h	22 Apr 2005 10:10:31 -0000	1.2
+++ tests/depdemo/l1/l1.h	18 Nov 2005 10:57:13 -0000
@@ -24,7 +24,7 @@
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l1;
+EXTERN int var_l1;
 int	func_l1 __P((int));
 __END_DECLS
 
Index: tests/depdemo/l2/l2.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/depdemo/l2/l2.h,v
retrieving revision 1.2
diff -u -r1.2 l2.h
--- tests/depdemo/l2/l2.h	22 Apr 2005 10:10:31 -0000	1.2
+++ tests/depdemo/l2/l2.h	18 Nov 2005 10:57:13 -0000
@@ -24,7 +24,7 @@
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l2;
+EXTERN int var_l2;
 int	func_l2 __P((int));
 __END_DECLS
 
Index: tests/depdemo/l3/l3.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/depdemo/l3/l3.h,v
retrieving revision 1.2
diff -u -r1.2 l3.h
--- tests/depdemo/l3/l3.h	22 Apr 2005 10:10:31 -0000	1.2
+++ tests/depdemo/l3/l3.h	18 Nov 2005 10:57:13 -0000
@@ -24,7 +24,7 @@
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l3;
+EXTERN int var_l3;
 int	func_l3 __P((int));
 __END_DECLS
 
Index: tests/depdemo/l4/l4.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/depdemo/l4/l4.h,v
retrieving revision 1.2
diff -u -r1.2 l4.h
--- tests/depdemo/l4/l4.h	22 Apr 2005 10:10:31 -0000	1.2
+++ tests/depdemo/l4/l4.h	18 Nov 2005 10:57:13 -0000
@@ -24,7 +24,7 @@
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l4;
+EXTERN int var_l4;
 int	func_l4 __P((int));
 __END_DECLS
 
Index: tests/pdemo/foo.h
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/pdemo/foo.h,v
retrieving revision 1.3
diff -u -r1.3 foo.h
--- tests/pdemo/foo.h	27 Apr 2005 14:15:29 -0000	1.3
+++ tests/pdemo/foo.h	18 Nov 2005 10:57:13 -0000
@@ -71,6 +71,8 @@
 #  else
 #    define EXTERN extern
 #  endif
+#elif defined(_MSC_VER)
+#  define EXTERN extern __declspec(dllimport)
 #else
 #  define EXTERN extern
 #endif
