diff --git a/ChangeLog b/ChangeLog
index 0c321c7..6848ca2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-07-17  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+	Insert WINE CMD support for dos_setup.
+
+	* builds/detect.mk: WINE CMD ECHO cannot handle special
+	characters for DOS ECHO.
+
+2009-07-17  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+	Prevent misunderstanding WINE CMD as UNIX.
+
+	* builds/unix/detect.mk: Before UNIX checking by /sbin/init etc, 
+	WINE CMD is checked. If WINE CMD, UNIX checking is skipped.
+	* builds/toplevel.mk: Ditto.
+
 2009-07-15  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
 	Borland C++ compiler patch proposed by Mirco Babin.
diff --git a/builds/detect.mk b/builds/detect.mk
index 987ae51..2685cd9 100644
--- a/builds/detect.mk
+++ b/builds/detect.mk
@@ -137,10 +137,17 @@ dos_setup:
 	@type builds$(SEP)newline
 	@echo The following settings are used:
 	@type builds$(SEP)newline
+ifeq ($(is_wine),)
 	@echo   platform˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙$(PLATFORM)
 	@echo   compiler˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙$(CC)
 	@echo   configuration directory˙˙˙˙˙˙$(subst /,$(SEP),$(BUILD_DIR))
 	@echo   configuration rules˙˙˙˙˙˙˙˙˙˙$(subst /,$(SEP),$(CONFIG_RULES))
+else
+	@echo   platform                     $(PLATFORM)
+	@echo   compiler                     $(CC)
+	@echo   configuration directory      $(subst /,$(SEP),$(BUILD_DIR))
+	@echo   configuration rules          $(subst /,$(SEP),$(CONFIG_RULES))
+endif
 	@type builds$(SEP)newline
 	@echo If this does not correspond to your system or settings please remove the file
 	@echo '$(CONFIG_MK)' from this directory then read the INSTALL file for help.
@@ -148,7 +155,11 @@ dos_setup:
 	@echo Otherwise, simply type 'make' again to build the library.
 	@echo or 'make refdoc' to build the API reference (the latter needs python).
 	@type builds$(SEP)newline
+ifeq ($(is_wine),)
 	@$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK)) > nul
+else
+	@$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK))
+endif
 
 
 # EOF
diff --git a/builds/toplevel.mk b/builds/toplevel.mk
index e6a8e93..1d3acc2 100644
--- a/builds/toplevel.mk
+++ b/builds/toplevel.mk
@@ -120,9 +120,20 @@ ifdef check_platform
   #
   # Note: This test is duplicated in `builds/unix/detect.mk'.
   #
-  is_unix := $(strip $(wildcard /sbin/init) \
-                     $(wildcard /usr/sbin/init) \
-                     $(wildcard /hurd/auth))
+  ifneq ($(findstring Windows_NT,$(OS)),)
+    ifeq ($(COMSPEC),)
+      ifneq ($(ComSpec),)
+        is_wine := $(ComSpec)
+      endif
+    endif
+  endif
+
+  ifeq ($(is_wine),)
+    is_unix := $(strip $(wildcard /sbin/init) \
+                       $(wildcard /usr/sbin/init) \
+                       $(wildcard /hurd/auth))
+  endif
+
   ifneq ($(is_unix),)
 
     distclean:
diff --git a/builds/unix/detect.mk b/builds/unix/detect.mk
index e74af57..26a035a 100644
--- a/builds/unix/detect.mk
+++ b/builds/unix/detect.mk
@@ -18,9 +18,20 @@ ifeq ($(PLATFORM),ansi)
 
   # Note: this test is duplicated in "builds/toplevel.mk".
   #
-  is_unix := $(strip $(wildcard /sbin/init) \
-                     $(wildcard /usr/sbin/init) \
-                     $(wildcard /hurd/auth))
+  ifneq ($(findstring Windows_NT,$(OS)),)
+    ifeq ($(COMSPEC),)
+      ifneq ($(ComSpec),)
+        is_wine := $(ComSpec)
+      endif
+    endif
+  endif
+ 
+  ifeq ($(is_wine),)
+    is_unix := $(strip $(wildcard /sbin/init) \
+                       $(wildcard /usr/sbin/init) \
+                       $(wildcard /hurd/auth))
+  endif
+
   ifneq ($(is_unix),)
 
     PLATFORM := unix
