--- mecab-0.996.orig/configure.in	2013-02-15 17:07:36.000000000 +0900
+++ mecab-0.996/configure.in	2016-01-10 19:34:10.491438159 +0900
@@ -37,7 +37,7 @@
 AC_C_BIGENDIAN
 AC_CHECK_HEADERS(string.h stdlib.h unistd.h fcntl.h stdint.h \
 		sys/stat.h sys/mman.h sys/times.h sys/types.h dirent.h \
-	        ctype.h sys/types.h io.h windows.h pthread.h)
+	        ctype.h sys/types.h io.h windows.h)
 AC_TYPE_OFF_T
 AC_TYPE_SIZE_T
 AC_CHECK_SIZEOF(char)
@@ -51,8 +51,15 @@
 
 AC_FUNC_MMAP
 AC_CHECK_LIB(stdc++, main, MECAB_LIBS="-lstdc++")
-AC_CHECK_LIB(pthread,pthread_create)
-AC_CHECK_LIB(pthread,pthread_join)
+case "$host_os" in
+ mingw*)
+  ;;
+ *)
+  AC_CHECK_HEADERS(pthread.h)
+  AC_CHECK_LIB(pthread,pthread_create)
+  AC_CHECK_LIB(pthread,pthread_join)
+  ;;
+esac
 AC_CHECK_FUNCS(getenv)
 AC_CHECK_FUNCS(opendir)
 AC_LANG(C++)
@@ -107,7 +114,7 @@
 dnl
 dnl check C++ features
 dnl
-AC_DEFUN(CHECK_CXX_STL, [
+AC_DEFUN([CHECK_CXX_STL], [
   AC_MSG_CHECKING(if ${CXX-c++} supports stl <$1> (required))
   AC_TRY_COMPILE(
 	[
@@ -253,6 +260,10 @@
 ])
 AC_MSG_RESULT([$ac_template])
 
+case "$host_os" in
+ mingw*)
+  ;;
+ *)
 AC_MSG_CHECKING([if ${CXX-c++} supports GCC native atomic operations (optional)])
 AC_TRY_COMPILE(
 [
@@ -271,6 +282,8 @@
 if test "$enable_gcc_atomic_ops" = "yes"; then
 AC_DEFINE([HAVE_GCC_ATOMIC_OPS])
 fi
+  ;;
+esac
 
 AC_MSG_CHECKING([if ${CXX-c++} supports OSX native atomic operations (optional)])
 AC_TRY_COMPILE(
@@ -301,8 +314,8 @@
 case "$host_os" in
  mingw* | os2*)
   MECAB_DEFAULT_RC='c:\\\\Program Files\\\\mecab\\\\etc\\\\mecabrc'
-  CFLAGS="$CFLAGS -municode -DUNICODE -D_UNICODE"
-  CXXFLAGS="$CXXFLAGS -municode -DUNICODE -D_UNICODE"
+  # CFLAGS="$CFLAGS -municode -DUNICODE -D_UNICODE"
+  # CXXFLAGS="$CXXFLAGS -municode -DUNICODE -D_UNICODE"
   ;;
  *)
   MECAB_DEFAULT_RC="$sysconfdir/mecabrc"
--- mecab-0.996.orig/src/common.h	2012-09-30 01:44:27.000000000 +0900
+++ mecab-0.996/src/common.h	2016-01-10 19:00:35.450155112 +0900
@@ -81,7 +81,7 @@
 #define EXIT_SUCCESS 0
 #endif
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__GNUC__)
 #define WPATH(path) (MeCab::Utf8ToWide(path).c_str())
 #else
 #define WPATH(path) (path)
--- mecab-0.996.orig/src/mmap.h	2013-02-17 17:12:30.000000000 +0900
+++ mecab-0.996/src/mmap.h	2016-01-10 19:02:02.237113907 +0900
@@ -104,7 +104,7 @@
       CHECK_FALSE(false) << "unknown open mode:" << filename;
     }
 
-    hFile = ::CreateFileW(WPATH(filename), mode1, FILE_SHARE_READ, 0,
+    hFile = ::CreateFileA(WPATH(filename), mode1, FILE_SHARE_READ, 0,
                           OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
     CHECK_FALSE(hFile != INVALID_HANDLE_VALUE)
         << "CreateFile() failed: " << filename;
--- mecab-0.996.orig/src/utils.cpp	2013-01-22 14:33:25.000000000 +0900
+++ mecab-0.996/src/utils.cpp	2016-01-10 19:21:35.411703050 +0900
@@ -359,7 +359,7 @@
       _wsplitpath(v.get(), drive.get(), dir.get(), NULL, NULL);
       const std::wstring path =
           std::wstring(drive.get()) + std::wstring(dir.get()) + L"mecabrc";
-      if (::GetFileAttributesW(path.c_str()) != -1) {
+      if (::GetFileAttributesW(path.c_str()) != static_cast<DWORD>(-1)) {
         rcfile = WideToUtf8(path);
       }
     }
--- mecab-0.996.orig/src/winmain.h	2012-10-28 13:07:01.000000000 +0900
+++ mecab-0.996/src/winmain.h	2016-01-10 19:28:42.726930459 +0900
@@ -2,7 +2,7 @@
 //
 //  Copyright(C) 2001-2011 Taku Kudo <taku@chasen.org>
 //  Copyright(C) 2004-2006 Nippon Telegraph and Telephone Corporation
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(__GNUC__)
 
 #include <windows.h>
 #include <string>
