diff -Naur libiconv-1.16-orig/build-aux/ar-lib libiconv-1.16/build-aux/ar-lib
--- libiconv-1.16-orig/build-aux/ar-lib	2019-01-28 00:32:26.000000000 +0300
+++ libiconv-1.16/build-aux/ar-lib	2019-06-05 08:24:13.552541700 +0300
@@ -56,6 +56,9 @@
 	  CYGWIN*)
 	    file_conv=cygwin
 	    ;;
+	  MSYS*)
+	    file_conv=cygwin
+	    ;;
 	  *)
 	    file_conv=wine
 	    ;;
@@ -68,6 +71,9 @@
 	cygwin)
 	  file=`cygpath -m "$file" || echo "$file"`
 	  ;;
+	msys)
+	  file=`cygpath -m "$file" || echo "$file"`
+	  ;;
 	wine)
 	  file=`winepath -w "$file" || echo "$file"`
 	  ;;
diff -Naur libiconv-1.16-orig/build-aux/compile libiconv-1.16/build-aux/compile
--- libiconv-1.16-orig/build-aux/compile	2019-04-26 21:59:57.000000000 +0300
+++ libiconv-1.16/build-aux/compile	2019-06-05 08:24:46.792588200 +0300
@@ -56,6 +56,9 @@
 	  CYGWIN*)
 	    file_conv=cygwin
 	    ;;
+	  MSYS*)
+	    file_conv=cygwin
+	    ;;
 	  *)
 	    file_conv=wine
 	    ;;
@@ -70,6 +73,9 @@
 	cygwin/*)
 	  file=`cygpath -m "$file" || echo "$file"`
 	  ;;
+	msys/*)
+	  file=`cygpath -m "$file" || echo "$file"`
+	  ;;
 	wine/*)
 	  file=`winepath -w "$file" || echo "$file"`
 	  ;;
diff -Naur libiconv-1.16-orig/build-aux/config.guess libiconv-1.16/build-aux/config.guess
--- libiconv-1.16-orig/build-aux/config.guess	2019-04-26 21:29:05.000000000 +0300
+++ libiconv-1.16/build-aux/config.guess	2019-06-05 08:25:13.772626000 +0300
@@ -896,6 +896,9 @@
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
 	echo x86_64-pc-cygwin
 	exit ;;
+    amd64:MSYS*:*:* | x86_64:MSYS*:*:*)
+	echo x86_64-pc-msys
+	exit ;;
     prep*:SunOS:5.*:*)
 	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
diff -Naur libiconv-1.16-orig/build-aux/config.libpath libiconv-1.16/build-aux/config.libpath
--- libiconv-1.16-orig/build-aux/config.libpath	2019-01-06 11:51:40.000000000 +0300
+++ libiconv-1.16/build-aux/config.libpath	2019-06-05 08:27:15.542796400 +0300
@@ -56,7 +56,7 @@
   bsdi[45]*)
     shlibpath_var=LD_LIBRARY_PATH
     ;;
-  cygwin* | mingw* | pw32* | cegcc*)
+  cygwin* | msys* | mingw* | pw32* | cegcc*)
     # FIXME: first we should search . and the directory the executable is in
     shlibpath_var=PATH
     ;;
diff -Naur libiconv-1.16-orig/build-aux/config.rpath libiconv-1.16/build-aux/config.rpath
--- libiconv-1.16-orig/build-aux/config.rpath	2019-01-06 11:51:40.000000000 +0300
+++ libiconv-1.16/build-aux/config.rpath	2019-06-05 08:25:49.882676500 +0300
@@ -57,7 +57,7 @@
     aix*)
       wl='-Wl,'
       ;;
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
+    mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
       ;;
     hpux9* | hpux10* | hpux11*)
       wl='-Wl,'
@@ -149,7 +149,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++.
@@ -198,7 +198,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'
@@ -348,7 +348,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
@@ -533,7 +533,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'
     ;;
diff -Naur libiconv-1.16-orig/configure.ac libiconv-1.15/configure.ac
--- libiconv-1.16-orig/configure.ac	2016-12-04 07:33:04.000000000 -0500
+++ libiconv-1.16/configure.ac	2018-05-01 17:27:00.747183900 -0400
@@ -19,6 +19,7 @@ AC_PREREQ([2.63])
 AC_INIT([libiconv], [1.16])
 AC_CONFIG_SRCDIR([lib/iconv.c])
 AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE
 AC_CONFIG_HEADERS([config.h lib/config.h])
 AC_PROG_MAKE_SET
diff -Naur libiconv-1.16-orig/libcharset/build-aux/config.guess libiconv-1.16/libcharset/build-aux/config.guess
--- libiconv-1.16-orig/libcharset/build-aux/config.guess	2019-04-26 21:29:05.000000000 +0300
+++ libiconv-1.16/libcharset/build-aux/config.guess	2019-06-05 08:26:40.692747600 +0300
@@ -896,6 +896,9 @@
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
 	echo x86_64-pc-cygwin
 	exit ;;
+    amd64:MSYS*:*:* | x86_64:MSYS*:*:*)
+	echo x86_64-pc-msys
+	exit ;;
     prep*:SunOS:5.*:*)
 	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
diff -Naur libiconv-1.16-orig/libcharset/build-aux/config.libpath libiconv-1.16/libcharset/build-aux/config.libpath
--- libiconv-1.16-orig/libcharset/build-aux/config.libpath	2019-01-06 11:51:40.000000000 +0300
+++ libiconv-1.16/libcharset/build-aux/config.libpath	2019-06-05 08:27:01.232776400 +0300
@@ -56,7 +56,7 @@
   bsdi[45]*)
     shlibpath_var=LD_LIBRARY_PATH
     ;;
-  cygwin* | mingw* | pw32* | cegcc*)
+  cygwin* | msys* | mingw* | pw32* | cegcc*)
     # FIXME: first we should search . and the directory the executable is in
     shlibpath_var=PATH
     ;;
diff -Naur libiconv-1.16-orig/libcharset/configure.ac libiconv-1.16/libcharset/configure.ac
--- libiconv-1.16-orig/libcharset/configure.ac	2019-01-06 11:51:40.000000000 +0300
+++ libiconv-1.16/libcharset/configure.ac	2019-06-05 08:27:01.232776400 +0300
@@ -19,6 +19,7 @@
 AC_INIT([libcharset], [1.4])
 AC_CONFIG_SRCDIR([lib/localcharset.c])
 AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
 AC_PROG_MAKE_SET
 
diff -Naur libiconv-1.16-orig/srcm4/double-slash-root.m4 libiconv-1.16/srcm4/double-slash-root.m4
--- libiconv-1.16-orig/srcm4/double-slash-root.m4	2019-01-06 11:51:41.000000000 +0300
+++ libiconv-1.16/srcm4/double-slash-root.m4	2019-06-05 08:28:10.872873900 +0300
@@ -16,7 +16,7 @@
         # special semantics and is distinct from /, please report it to
         # <bug-gnulib@gnu.org>.
         case $host in
-          *-cygwin | i370-ibm-openedition)
+          *-cygwin | *-msys | i370-ibm-openedition)
             gl_cv_double_slash_root=yes ;;
           *)
             # Be optimistic and assume that / and // are the same when we
diff -Naur libiconv-1.16-orig/srcm4/intl.m4 libiconv-1.16/srcm4/intl.m4
--- libiconv-1.16-orig/srcm4/intl.m4	2019-04-26 21:29:01.000000000 +0300
+++ libiconv-1.16/srcm4/intl.m4	2019-06-05 08:28:36.022909100 +0300
@@ -136,7 +136,7 @@
   dnl    exported variables _also_ in the static library.
   if test "$enable_shared" = yes; then
     case "$host_os" in
-      mingw* | cygwin*) is_woe32dll=yes ;;
+      mingw* | cygwin* | msys*) is_woe32dll=yes ;;
       *) is_woe32dll=no ;;
     esac
   else
@@ -148,7 +148,7 @@
   dnl On mingw and Cygwin, we can activate special Makefile rules which add
   dnl version information to the shared libraries and executables.
   case "$host_os" in
-    mingw* | cygwin*) is_woe32=yes ;;
+    mingw* | cygwin* | msys*) is_woe32=yes ;;
     *) is_woe32=no ;;
   esac
   WOE32=$is_woe32
diff -Naur libiconv-1.16-orig/srcm4/malloc.m4 libiconv-1.16/srcm4/malloc.m4
--- libiconv-1.16-orig/srcm4/malloc.m4	2019-04-26 21:29:01.000000000 +0300
+++ libiconv-1.16/srcm4/malloc.m4	2019-06-05 08:29:01.913945400 +0300
@@ -33,7 +33,7 @@
        [case "$host_os" in
           # Guess yes on platforms where we know the result.
           *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \
-          | hpux* | solaris* | cygwin* | mingw*)
+          | hpux* | solaris* | cygwin* | msys* | mingw*)
             ac_cv_func_malloc_0_nonnull="guessing yes" ;;
           # If we don't know, assume the worst.
           *) ac_cv_func_malloc_0_nonnull="guessing no" ;;
diff -Naur libiconv-1.16-orig/srcm4/threadlib.m4 libiconv-1.16/srcm4/threadlib.m4
--- libiconv-1.16-orig/srcm4/threadlib.m4	2019-01-28 00:12:37.000000000 +0300
+++ libiconv-1.16/srcm4/threadlib.m4	2019-06-05 08:29:47.984009900 +0300
@@ -66,7 +66,7 @@
          dnl bugs that lead to endless loops or crashes. See
          dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
          osf*) gl_use_threads=no ;;
-         cygwin*)
+         cygwin* | msys*)
                case `uname -r` in
                  1.[0-5].*) gl_use_threads=no ;;
                  *)         gl_use_threads=yes ;;
