diff --git a/ChangeLog b/ChangeLog
index ddfc48de12..d96f8a916b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Sun May 14 18:05:59 2000  WATANABE Hirofumi  <eban@os.rim.or.jp>
+
+	* Makefile.in: missing/nt.c -> win32/win32.c
+
+	* configure.in: bug fix; static linking on mingw32
+
+	* cygwin/GNUmakefile.in: remove VPATH.
+
+	* ext/extmk.rb.in: Makefile set binmode with mingw32 on cygwin32.
+
+	* lib/mkmf.rb: ditto.
+
+	* win32/config.h: undef HAVE_SYS_FILE_H.
+
 Sun May 14 02:02:48 2000  WATANABE Hirofumi  <eban@os.rim.or.jp>
 
 	* lib/irb/ruby-lex.rb: '/' should be escaped in charcter class.
diff --git a/Makefile.in b/Makefile.in
index deffe4d7a7..b2dddb45e8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -212,9 +212,6 @@ strtol.@OBJEXT@: @srcdir@/missing/strtol.c
 strtoul.@OBJEXT@: @srcdir@/missing/strtoul.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strtoul.c
 
-nt.@OBJEXT@: @srcdir@/missing/nt.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/nt.c
-
 x68.@OBJEXT@: @srcdir@/missing/x68.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/x68.c
 
@@ -224,6 +221,9 @@ os2.@OBJEXT@: @srcdir@/missing/os2.c
 dl_os2.@OBJEXT@: @srcdir@/missing/dl_os2.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/dl_os2.c
 
+win32.@OBJEXT@: @srcdir@/win32/win32.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/win32/win32.c
+
 # Prevent GNU make v3 from overflowing arg limit on SysV.
 .NOEXPORT:
 ###
diff --git a/configure b/configure
index dacc2e3ed2..4c06877872 100644
--- a/configure
+++ b/configure
@@ -4958,14 +4958,10 @@ if test "$enable_shared" = 'yes'; then
 	FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
 	case "$target_os" in
 	cygwin*)
-	    LIBOBJS="$LIBOBJS strftime.o"
-	    CCDLFLAGS=-DUSEIMPORTLIB
-	    ;;
+	    CCDLFLAGS=-DUSEIMPORTLIB ;;
 	mingw*)
-	    LIBOBJS="$LIBOBJS win32.o"
-	    CFLAGS="-DNT -D__MSVCRT__ $CFLAGS"
 	    CCDLFLAGS=-DIMPORT
-	    ;;
+	    SOLIBS='-lwsock32 -lmsvcrt' ;;
 	esac
 	;;
     *)
@@ -4974,16 +4970,16 @@ if test "$enable_shared" = 'yes'; then
 fi
 
 case "$target_os" in
-	nextstep*)
+    nextstep*)
     	CFLAGS="$CFLAGS -pipe"
-		;;
-	openstep*)
+	;;
+    openstep*)
     	CFLAGS="$CFLAGS -pipe"
-		;;
-	rhasody*)
+	;;
+    rhasody*)
     	CFLAGS="$CFLAGS -pipe -no-precomp"
-		;;
-	osf*)
+	;;
+    osf*)
 	if test "$without_gcc" = "no" ; then
 	  CFLAGS="$CFLAGS -ansi"
 	else
@@ -5001,8 +4997,15 @@ case "$target_os" in
 	  CFLAGS="$CFLAGS -std"
 	fi
 		;;
-	*)
-		;;	
+    cygwin*)
+	LIBOBJS="$LIBOBJS strftime.o"
+	;;
+    mingw*)
+	LIBOBJS="$LIBOBJS win32.o"
+	CFLAGS="-DNT -D__MSVCRT__ $CFLAGS"
+	;;
+    *)
+	;;	
 esac
 
 
@@ -5100,7 +5103,7 @@ EOF
 fi
 
 echo "creating config.h"
-cat confdefs.h > config.h
+tr -d '\015' < confdefs.h > config.h
 
 trap '' 1 2 15
 cat > confcache <<\EOF
diff --git a/configure.in b/configure.in
index 1a33cc0026..308371961f 100644
--- a/configure.in
+++ b/configure.in
@@ -792,14 +792,10 @@ if test "$enable_shared" = 'yes'; then
 	FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
 	case "$target_os" in
 	cygwin*)
-	    LIBOBJS="$LIBOBJS strftime.o"
-	    CCDLFLAGS=-DUSEIMPORTLIB
-	    ;;
+	    CCDLFLAGS=-DUSEIMPORTLIB ;;
 	mingw*)
-	    LIBOBJS="$LIBOBJS win32.o"
-	    CFLAGS="-DNT -D__MSVCRT__ $CFLAGS"
 	    CCDLFLAGS=-DIMPORT
-	    ;;
+	    SOLIBS='-lwsock32 -lmsvcrt' ;;
 	esac
 	;;
     *)
@@ -808,16 +804,16 @@ if test "$enable_shared" = 'yes'; then
 fi
 
 case "$target_os" in
-	nextstep*)
+    nextstep*)
     	CFLAGS="$CFLAGS -pipe"
-		;;
-	openstep*)
+	;;
+    openstep*)
     	CFLAGS="$CFLAGS -pipe"
-		;;
-	rhasody*)
+	;;
+    rhasody*)
     	CFLAGS="$CFLAGS -pipe -no-precomp"
-		;;
-	osf*)
+	;;
+    osf*)
 	if test "$without_gcc" = "no" ; then
 	  CFLAGS="$CFLAGS -ansi"
 	else
@@ -835,8 +831,15 @@ case "$target_os" in
 	  CFLAGS="$CFLAGS -std"
 	fi
 		;;
-	*)
-		;;	
+    cygwin*)
+	LIBOBJS="$LIBOBJS strftime.o"
+	;;
+    mingw*)
+	LIBOBJS="$LIBOBJS win32.o"
+	CFLAGS="-DNT -D__MSVCRT__ $CFLAGS"
+	;;
+    *)
+	;;	
 esac
 
 AC_SUBST(LIBRUBY_LDSHARED)
@@ -903,6 +906,6 @@ if test "$search_path" != ""; then
 fi
 
 echo "creating config.h"
-cat confdefs.h > config.h
+tr -d '\015' < confdefs.h > config.h
 
 AC_OUTPUT($FIRSTMAKEFILE Makefile ext/extmk.rb)
diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in
index ba3a1d2664..d4ee88d1d1 100644
--- a/cygwin/GNUmakefile.in
+++ b/cygwin/GNUmakefile.in
@@ -3,7 +3,6 @@ include Makefile
 ARCH=@arch@
 
 ifneq (,$(findstring mingw, $(ARCH)))
-VPATH = @srcdir@/missing:@srcdir@/win32
 DLL = rubymg.dll
 DLLWRAP_FLAGS =
 else
@@ -11,7 +10,9 @@ DLL = rubycw.dll
 DLLWRAP_FLAGS = -Wl,-e,__cygwin_noncygwin_dll_entry@12
 endif
 
+ifeq (,$(strip $(LIBRUBY_ALIASES)))
 miniruby$(EXEEXT): $(DLL)
+endif
 
 $(DLL): $(OBJS) dmyext.o
 	$(LDSHARED) $(DLDFLAGS) -o $(DLL) --output-lib=$(LIBRUBY_SO) --dllname=$(DLL) --add-stdcall-alias $(OBJS) dmyext.o $(LIBS)
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index 279906830f..90e6c71592 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -348,6 +348,7 @@ def create_makefile(target)
 
   $srcdir = $top_srcdir + "/ext/" + $mdir
   mfile = open("Makefile", "w")
+  mfile.binmode if /mingw/ =~ RUBY_PLATFORM
   mfile.printf "\
 SHELL = /bin/sh
 
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 1301bf0f5d..0cd91f38a5 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -356,6 +356,7 @@ def create_makefile(target)
   $objs = $objs.join(" ")
 
   mfile = open("Makefile", "w")
+  mfile.binmode if /mingw/ =~ RUBY_PLATFORM
   mfile.print  <<EOMF
 SHELL = /bin/sh
 
diff --git a/win32/config.h b/win32/config.h
index b1a2d8d0d9..32c9f4e43d 100644
--- a/win32/config.h
+++ b/win32/config.h
@@ -5,7 +5,7 @@
 /* #define HAVE_UNISTD_H 1 */
 #define HAVE_STDLIB_H 1
 #define HAVE_LIMITS_H 1
-#define HAVE_SYS_FILE_H 1
+/* #define HAVE_SYS_FILE_H 1 */
 #define HAVE_FCNTL_H 1
 /* #define HAVE_PWD_H 1       */
 /* #define HAVE_SYS_TIME_H 1  */