diff -Naur flex-2.6.0/build-aux/compile flex-2.6.0-msys2/build-aux/compile
--- flex-2.6.0/build-aux/compile	2013-11-01 17:28:50.000000000 +0400
+++ flex-2.6.0-msys2/build-aux/compile	2014-02-16 11:03:46.600200000 +0400
@@ -54,7 +54,7 @@
 	  MINGW*)
 	    file_conv=mingw
 	    ;;
-	  CYGWIN*)
+	  CYGWIN*|MSYS*)
 	    file_conv=cygwin
 	    ;;
 	  *)
@@ -68,7 +68,7 @@
 	mingw/*)
 	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
 	  ;;
-	cygwin/*)
+	cygwin/*|msys/*)
 	  file=`cygpath -m "$file" || echo "$file"`
 	  ;;
 	wine/*)
diff -Naur flex-2.6.0/build-aux/config.guess flex-2.6.0-msys2/build-aux/config.guess
--- flex-2.6.0/build-aux/config.guess	2013-11-01 17:28:50.000000000 +0400
+++ flex-2.6.0-msys2/build-aux/config.guess	2014-02-16 11:04:45.474600000 +0400
@@ -844,6 +844,9 @@
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
 	echo x86_64-unknown-cygwin
 	exit ;;
+    amd64:MSYS*:*:* | x86_64:MSYS*:*:*)
+	echo x86_64-unknown-msys
+	exit ;;
     p*:CYGWIN*:*)
 	echo powerpcle-unknown-cygwin
 	exit ;;
diff -Naur flex-2.6.0/build-aux/config.rpath flex-2.6.0-msys2/build-aux/config.rpath
--- flex-2.6.0/build-aux/config.rpath	2012-08-26 18:07:14.000000000 +0400
+++ flex-2.6.0-msys2/build-aux/config.rpath	2014-02-16 11:05:49.341000000 +0400
@@ -64,7 +64,7 @@
           ;;
       esac
       ;;
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
+    mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
       ;;
     hpux9* | hpux10* | hpux11*)
       wl='-Wl,'
@@ -138,7 +138,7 @@
 hardcode_minus_L=no
 
 case "$host_os" in
-  cygwin* | mingw* | pw32* | cegcc*)
+  cygwin* | msys* | mingw* | pw32* | cegcc*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
@@ -188,7 +188,7 @@
         ld_shlibs=no
       fi
       ;;
-    cygwin* | mingw* | pw32* | cegcc*)
+    cygwin* | msys* | mingw* | pw32* | cegcc*)
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
@@ -332,7 +332,7 @@
       ;;
     bsdi[45]*)
       ;;
-    cygwin* | mingw* | pw32* | cegcc*)
+    cygwin* | msys* | mingw* | pw32* | cegcc*)
       # When not using gcc, we currently assume that we are using
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -523,7 +523,7 @@
   bsdi[45]*)
     library_names_spec='$libname$shrext'
     ;;
-  cygwin* | mingw* | pw32* | cegcc*)
+  cygwin* | msys* | mingw* | pw32* | cegcc*)
     shrext=.dll
     library_names_spec='$libname.dll.a $libname.lib'
     ;;
