Index: bcc32/Makefile.sub
===================================================================
RCS file: /cvs/ruby/src/ruby/bcc32/Makefile.sub,v
retrieving revision 1.71
diff -U2 -p -r1.71 Makefile.sub
--- bcc32/Makefile.sub	3 Mar 2005 09:44:32 -0000	1.71
+++ bcc32/Makefile.sub	7 Apr 2005 04:18:25 -0000
@@ -286,4 +286,5 @@ config.status: $(MKFILES) $(srcdir)bcc32
 # Generated automatically by Makefile.sub.
 s,@SHELL@,$$(COMSPEC),;t t
+s,@ALT_SEPARATOR@,\,;t t
 s,@PATH_SEPARATOR@,;,;t t
 s,@CFLAGS@,$(CFLAGS),;t t
@@ -331,4 +332,6 @@ s,@ARFLAGS@,$(ARFLAGS) ,;t t
 s,@LN_S@,$(LN_S),;t t
 s,@SET_MAKE@,$(SET_MAKE),;t t
+s,@CP@,copy > nul,;t t
+s,@INSTALL@,copy > nul,;t t
 s,@LIBOBJS@, acosh.obj crypt.obj erf.obj win32.obj,;t t
 s,@ALLOCA@,$(ALLOCA),;t t
Index: lib/mkmf.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/mkmf.rb,v
retrieving revision 1.215
diff -U2 -p -r1.215 mkmf.rb
--- lib/mkmf.rb	7 Apr 2005 14:58:53 -0000	1.215
+++ lib/mkmf.rb	8 Apr 2005 08:42:02 -0000
@@ -1039,5 +1039,15 @@ static:		$(STATIC_LIB)#{$extout ? " inst
 	dest = "#{dir}/#{File.basename(f)}"
 	mfile.print("install-rb#{sfx}: #{dest}\n")
-	mfile.print("#{dest}: #{f}\n\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) #{f} #{dir}\n")
+	mfile.print("#{dest}: #{f}\n\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) ")
+	sep = config_string('ALT_SEPARATOR')
+        if sep
+          f = f.gsub("/", sep)
+          sep = ":/="+sep
+          f = f.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
+          f = f.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
+        else
+          sep = ""
+        end
+	mfile.print("#{f} $(@D#{sep})\n")
       end
     end
Index: win32/Makefile.sub
===================================================================
RCS file: /cvs/ruby/src/ruby/win32/Makefile.sub,v
retrieving revision 1.87
diff -U2 -p -r1.87 Makefile.sub
--- win32/Makefile.sub	3 Mar 2005 09:38:40 -0000	1.87
+++ win32/Makefile.sub	8 Apr 2005 08:20:27 -0000
@@ -71,7 +71,9 @@ DEBUGFLAGS = -Zi
 OPTFLAGS = -O2b2xg-
 !endif
-!if !defined(OS) || !defined(RT)
+!if !defined(OS)
 OS = mswin32
-RT = msvcrt
+!endif
+!if !defined(RT)
+!error RT not defined.  Retry from configure pass.
 !endif
 
@@ -115,4 +117,7 @@ CFLAGS = -MD $(DEBUGFLAGS) $(OPTFLAGS) $
 CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)/missing
 !endif
+!if !defined(CXXFLAGS)
+CXXFLAGS = $(CFLAGS)
+!endif
 !if !defined(LDFLAGS)
 LDFLAGS = -link -incremental:no -debug -opt:ref -opt:icf
@@ -299,4 +304,5 @@ config.status: $(MKFILES) $(srcdir)/win3
 # Generated automatically by Makefile.sub.
 s,@SHELL@,$$(COMSPEC),;t t
+s,@ALT_SEPARATOR@,\,;t t
 s,@PATH_SEPARATOR@,;,;t t
 s,@CFLAGS@,$(CFLAGS),;t t
@@ -338,4 +344,6 @@ s,@target_os@,$(OS),;t t
 s,@CC@,$(CC),;t t
 s,@CPP@,$(CPP),;t t
+s,@CXX@,$$(CC),;t t
+s,@LD@,$$(CC),;t t
 s,@YACC@,$(YACC),;t t
 s,@RANLIB@,,;t t
@@ -344,4 +352,6 @@ s,@ARFLAGS@,$(ARFLAGS),;t t
 s,@LN_S@,$(LN_S),;t t
 s,@SET_MAKE@,$(SET_MAKE),;t t
+s,@CP@,copy > nul,;t t
+s,@INSTALL@,copy > nul,;t t
 s,@LIBOBJS@, acosh.obj crypt.obj erf.obj win32.obj,;t t
 s,@ALLOCA@,$(ALLOCA),;t t
Index: win32/configure.bat
===================================================================
RCS file: /cvs/ruby/src/ruby/win32/configure.bat,v
retrieving revision 1.6
diff -U2 -p -r1.6 configure.bat
--- win32/configure.bat	9 Feb 2004 08:46:24 -0000	1.6
+++ win32/configure.bat	8 Apr 2005 08:04:36 -0000
@@ -21,4 +21,5 @@ if "%1" == "--program-name" goto :progna
 if "%1" == "--enable-install-doc" goto :enable-rdoc
 if "%1" == "--disable-install-doc" goto :disable-rdoc
+if "%1" == "--extout" goto :extout
 if "%1" == "-h" goto :help
 if "%1" == "--help" goto :help
@@ -68,4 +69,9 @@ goto :loop
   shift
 goto :loop
+:extout
+  echo>> ~tmp~.mak 	"EXTOUT=%2" \
+  shift
+  shift
+goto :loop
 :help
   echo Configuration:
Index: win32/setup.mak
===================================================================
RCS file: /cvs/ruby/src/ruby/win32/setup.mak,v
retrieving revision 1.21
diff -U2 -p -r1.21 setup.mak
--- win32/setup.mak	2 Apr 2005 13:35:02 -0000	1.21
+++ win32/setup.mak	8 Apr 2005 08:29:47 -0000
@@ -14,6 +14,5 @@ prefix = /usr
 !endif
 OS = mswin32
-RT = msvcrt
-INCLUDE = !include
+BANG = !
 APPEND = echo>>$(MAKEFILE)
 !ifdef MAKEFILE
@@ -24,5 +23,6 @@ MAKEFILE = Makefile
 ARCH = PROCESSOR_ARCHITECTURE
 CPU = PROCESSOR_LEVEL
-CPP = cl -nologo -EP
+CC = cl -nologo
+CPP = $(CC) -EP
 
 all: -prologue- -generic- -epilogue-
@@ -33,5 +33,7 @@ i686-$(OS): -prologue- -i686- -epilogue-
 alpha-$(OS): -prologue- -alpha- -epilogue-
 
--prologue-: nul
+-prologue-: -basic-vars- -runtime- -version-
+
+-basic-vars-: nul
 	@type << > $(MAKEFILE)
 ### Makefile for ruby $(OS) ###
@@ -42,6 +44,61 @@ EXTSTATIC = $(EXTSTATIC)
 RDOCTARGET = $(RDOCTARGET)
 !endif
+!if defined(EXTOUT)
+EXTOUT = $(EXTOUT)
+!endif
 <<
-	@$(CPP) -I$(srcdir) -DRUBY_EXTERN="//" <<"Creating $(MAKEFILE)" >> $(MAKEFILE)
+
+-runtime-: nul
+	@echo OS = mswin32 >>$(MAKEFILE)
+	@$(CC) -MD <<rtname.c user32.lib > nul
+#include <windows.h>
+#include <memory.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdio.h>
+#ifndef MAXPATHLEN
+# define MAXPATHLEN 1024
+#endif
+
+int
+runtime_name()
+{
+    char libpath[MAXPATHLEN+1];
+    char *p, *base = NULL;
+    HMODULE msvcrt = NULL;
+    MEMORY_BASIC_INFORMATION m;
+
+    memset(&m, 0, sizeof(m));
+    if (VirtualQuery(malloc, &m, sizeof(m)) && m.State == MEM_COMMIT)
+	msvcrt = (HMODULE)m.AllocationBase;
+    GetModuleFileName(msvcrt, libpath, sizeof libpath);
+
+    libpath[sizeof(libpath) - 1] = '\0';
+    for (p = libpath; *p; p = CharNext(p)) {
+	if (*p == '\\') {
+	    base = ++p;
+	}
+    }
+    if (!base) return 0;
+    if (p = strchr(base, '.')) *p = '\0';
+    for (p = base; *p; p = CharNext(p)) {
+	if (isascii(*p) && isupper(*p))
+	    *p = tolower(*p);
+    }
+    printf("RT = %s\n", base);
+    return 1;
+}
+
+int main(int argc, char **argv)
+{
+    if (!runtime_name()) return EXIT_FAILURE;
+    return EXIT_SUCCESS;
+}
+<<
+	@.\rtname >>$(MAKEFILE)
+	@del rtname.*
+
+-version-: nul
+	@$(CPP) -I$(srcdir) -DRUBY_EXTERN="//" <<"Creating $(MAKEFILE)" | findstr /v /r ^^$$ >>$(MAKEFILE)
 #include "version.h"
 MAJOR = RUBY_VERSION_MAJOR
@@ -80,5 +137,4 @@ $(CPU) = $(PROCESSOR_LEVEL)
 	@type << >>$(MAKEFILE)
 # OS = $(OS)
-# RT = $(RT)
 # RUBY_INSTALL_NAME = ruby
 # RUBY_SO_NAME = $$(RT)-$$(RUBY_INSTALL_NAME)$$(MAJOR)$$(MINOR)
@@ -91,5 +147,5 @@ $(CPU) = $(PROCESSOR_LEVEL)
 # EXTLIBS =
 
-$(INCLUDE) $$(srcdir)/win32/Makefile.sub
+$(BANG)include $$(srcdir)/win32/Makefile.sub
 <<
 	@$(srcdir:/=\)\win32\rm.bat config.h config.status
Index: wince/Makefile.sub
===================================================================
RCS file: /cvs/ruby/src/ruby/wince/Makefile.sub,v
retrieving revision 1.34
diff -U2 -p -r1.34 Makefile.sub
--- wince/Makefile.sub	5 Mar 2005 03:52:21 -0000	1.34
+++ wince/Makefile.sub	7 Apr 2005 04:19:45 -0000
@@ -310,4 +310,5 @@ config.status: $(MKFILES) $(srcdir)/winc
 # Generated automatically by Makefile.sub.
 s,@SHELL@,$$(COMSPEC),;t t
+s,@ALT_SEPARATOR@,\,;t t
 s,@PATH_SEPARATOR@,;,;t t
 s,@CFLAGS@,$(CFLAGS),;t t
@@ -355,4 +356,6 @@ s,@ARFLAGS@,$(ARFLAGS),;t t
 s,@LN_S@,$(LN_S),;t t
 s,@SET_MAKE@,$(SET_MAKE),;t t
+s,@CP@,copy > nul,;t t
+s,@INSTALL@,copy > nul,;t t
 s,@LIBOBJS@, acosh.obj crypt.obj erf.obj win32.obj isinf.obj isnan.obj,;t t
 s,@ALLOCA@,$(ALLOCA),;t t
