* win32/Makefile.sub (MKFILES): update MKFILES if configure files get
  changed.

* win32/configure.bat, win32/setup.mak (configure_args): store
  arguments to configure.


Index: win32/Makefile.sub
===================================================================
RCS file: /cvs/ruby/src/ruby/win32/Makefile.sub,v
retrieving revision 1.92
diff -U2 -p -r1.92 Makefile.sub
--- win32/Makefile.sub	27 Apr 2005 14:42:37 -0000	1.92
+++ win32/Makefile.sub	28 Apr 2005 03:07:23 -0000
@@ -7,4 +7,10 @@ NULL = nul
 #### Start of system configuration section. ####
 
+!if defined(pathlist)
+PATH = $(pathlist:;=/bin;)$(PATH)
+INCLUDE = $(pathlist:;=/include;)
+LIB = $(pathlist:;=/lib;)
+!endif
+
 ## variables may be overridden by $(compile_dir)/Makefile
 !ifndef srcdir
@@ -189,4 +195,8 @@ rubyw: $(WPROGRAM)
 !include $(srcdir)/common.mk
 
+$(MKFILES): $(srcdir)/win32/Makefile.sub $(srcdir)/win32/configure.bat $(srcdir)/win32/setup.mak
+	$(srcdir:/=\)\win32\configure.bat $(configure_args)
+	@echo $(MKFILES) should be updated, re-run $(MAKE).
+
 CONFIG_H = ./.config.h.time
 
@@ -197,4 +207,7 @@ config.status: $(CONFIG_H)
 $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub
 	@echo Creating config.h
+!if exist(config.h)
+	@copy config.h config.h.old > nul
+!endif
 	@$(srcdir:/=\)\win32\ifchange.bat config.h <<
 #define STDC_HEADERS 1
Index: win32/configure.bat
===================================================================
RCS file: /cvs/ruby/src/ruby/win32/configure.bat,v
retrieving revision 1.7
diff -U2 -p -r1.7 configure.bat
--- win32/configure.bat	19 Apr 2005 22:27:41 -0000	1.7
+++ win32/configure.bat	28 Apr 2005 06:39:55 -0000
@@ -7,6 +7,8 @@ echo> ~tmp~.mak ####
 echo>> ~tmp~.mak conf = %0
 echo>> ~tmp~.mak $(conf:\=/): nul
-echo>> ~tmp~.mak 	@del ~tmp~.mak
+echo>> ~tmp~.mak 	@del ~setup~.mak
 echo>> ~tmp~.mak 	@-$(MAKE) -l$(MAKEFLAGS) -f $(@D)/setup.mak \
+if exist pathlist.tmp del pathlist.tmp
+echo>confargs.tmp #define CONFIGURE_ARGS \
 :loop
 if "%1" == "" goto :end
@@ -22,11 +24,14 @@ if "%1" == "--enable-install-doc" goto :
 if "%1" == "--disable-install-doc" goto :disable-rdoc
 if "%1" == "--extout" goto :extout
+if "%1" == "--path" goto :path
 if "%1" == "-h" goto :help
 if "%1" == "--help" goto :help
   echo>> ~tmp~.mak 	"%1" \
+  echo>>confargs.tmp %1 \
   shift
 goto :loop
 :srcdir
   echo>> ~tmp~.mak 	"srcdir=%2" \
+  echo>>confargs.tmp %1=%2 \
   shift
   shift
@@ -34,4 +39,5 @@ goto :loop
 :prefix
   echo>> ~tmp~.mak 	"prefix=%2" \
+  echo>>confargs.tmp %1=%2 \
   shift
   shift
@@ -39,4 +45,5 @@ goto :loop
 :suffix
   echo>> ~tmp~.mak 	"RUBY_SUFFIX=%2" \
+  echo>>confargs.tmp %1=%2 \
   shift
   shift
@@ -44,4 +51,5 @@ goto :loop
 :installname
   echo>> ~tmp~.mak 	"RUBY_INSTALL_NAME=%2" \
+  echo>>confargs.tmp %1=%2 \
   shift
   shift
@@ -49,4 +57,5 @@ goto :loop
 :soname
   echo>> ~tmp~.mak 	"RUBY_SO_NAME=%2" \
+  echo>>confargs.tmp %1=%2 \
   shift
   shift
@@ -54,4 +63,5 @@ goto :loop
 :target
   echo>> ~tmp~.mak 	"%2" \
+  echo>>confargs.tmp %1=%2 \
   shift
   shift
@@ -59,16 +69,26 @@ goto :loop
 :extstatic
   echo>> ~tmp~.mak 	"EXTSTATIC=static" \
+  echo>>confargs.tmp %1 \
   shift
 goto :loop
 :enable-rdoc
   echo>> ~tmp~.mak 	"RDOCTARGET=install-doc" \
+  echo>>confargs.tmp %1 \
   shift
 goto :loop
 :disable-rdoc
   echo>> ~tmp~.mak 	"RDOCTARGET=install-nodoc" \
+  echo>>confargs.tmp %1 \
   shift
 goto :loop
 :extout
   echo>> ~tmp~.mak 	"EXTOUT=%2" \
+  echo>>confargs.tmp %1=%2 \
+  shift
+  shift
+goto :loop
+:path
+  echo>>pathlist.tmp %2;\
+  echo>>confargs.tmp %1=%2 \
   shift
   shift
@@ -85,8 +105,25 @@ goto :loop
   echo   --with-static-linked-ext link external modules statically
   echo   --disable-install-doc   do not install rdoc indexes during install
+  del *.tmp
   del ~tmp~.mak
 goto :exit
 :end
 echo>> ~tmp~.mak 	WIN32DIR=$(@D)
-nmake -alf ~tmp~.mak
+echo.>>confargs.tmp
+echo>confargs.c #define $ $$ 
+type>>confargs.c confargs.tmp
+echo>>confargs.c configure_args = CONFIGURE_ARGS
+echo>>confargs.c #undef $
+if exist pathlist.tmp echo>>confargs.c #define PATH_LIST \
+if exist pathlist.tmp type>>confargs.c pathlist.tmp
+if exist pathlist.tmp echo.>>confargs.c
+if exist pathlist.tmp echo>>confargs.c pathlist = PATH_LIST
+cl -EP confargs.c > ~setup~.mak 2>nul
+if exist pathlist.tmp echo>>~setup~.mak PATH = $(pathlist:;=/bin;)$(PATH)
+if exist pathlist.tmp echo>>~setup~.mak INCLUDE = $(pathlist:;=/include;)
+if exist pathlist.tmp echo>>~setup~.mak LIB = $(pathlist:;=/lib;)
+type>>~setup~.mak ~tmp~.mak
+del *.tmp > nul
+del ~tmp~.mak > nul
+nmake -alf ~setup~.mak
 :exit
Index: win32/setup.mak
===================================================================
RCS file: /cvs/ruby/src/ruby/win32/setup.mak,v
retrieving revision 1.24
diff -U2 -p -r1.24 setup.mak
--- win32/setup.mak	27 Apr 2005 14:42:37 -0000	1.24
+++ win32/setup.mak	28 Apr 2005 04:08:43 -0000
@@ -140,5 +140,10 @@ $(CPU) = $(PROCESSOR_LEVEL)
 
 -epilogue-: nul
+!if exist(confargs.c)
+	@$(CPP) confargs.c | findstr /v /r ^^$$ >> $(MAKEFILE)
+	@del confargs.c
+!endif
 	@type << >>$(MAKEFILE)
+
 # OS = $(OS)
 # RUBY_INSTALL_NAME = ruby
@@ -154,4 +159,3 @@ $(CPU) = $(PROCESSOR_LEVEL)
 $(BANG)include $$(srcdir)/win32/Makefile.sub
 <<
-	@$(srcdir:/=\)\win32\rm.bat config.h config.status
 	@echo type `$(MAKE)' to make ruby for $(OS).
