diff -Naur libidn-1.36-orig/build-aux/ar-lib libidn-1.36/build-aux/ar-lib
--- libidn-1.36-orig/build-aux/ar-lib	2020-07-22 18:13:45.000000000 +0300
+++ libidn-1.36/build-aux/ar-lib	2020-10-23 10:02:10.745632900 +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 libidn-1.36-orig/build-aux/config.guess libidn-1.36/build-aux/config.guess
--- libidn-1.36-orig/build-aux/config.guess	2020-07-22 18:13:45.000000000 +0300
+++ libidn-1.36/build-aux/config.guess	2020-10-23 09:53:14.620324500 +0300
@@ -883,6 +883,9 @@
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
 	echo x86_64-unknown-cygwin
 	exit ;;
+    amd64:MSYS*:*:* | x86_64:MSYS*:*:*)
+	echo x86_64-unknown-msys
+	exit ;;
     prep*:SunOS:5.*:*)
 	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
 	exit ;;
diff -Naur libidn-1.36-orig/build-aux/config.rpath libidn-1.36/build-aux/config.rpath
--- libidn-1.36-orig/build-aux/config.rpath	2020-07-22 18:13:22.000000000 +0300
+++ libidn-1.36/build-aux/config.rpath	2020-10-23 09:53:14.764928400 +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 libidn-1.36-orig/gl/m4/csharpexec.m4 libidn-1.36/gl/m4/csharpexec.m4
--- libidn-1.36-orig/gl/m4/csharpexec.m4	2020-04-28 18:02:37.000000000 +0300
+++ libidn-1.36/gl/m4/csharpexec.m4	2020-10-23 09:53:14.904873300 +0300
@@ -44,7 +44,7 @@
            ifelse([$1], , , [&& clix $2/$1 >/dev/null 2>/dev/null]); then
           HAVE_CLIX=1
           case $host_os in
-            cygwin* | mingw* | pw32*)
+            cygwin* | msys* |mingw* | pw32*)
               CLIX_PATH_VAR=PATH
               ;;
             darwin* | rhapsody*)
diff -Naur libidn-1.36-orig/gl/m4/double-slash-root.m4 libidn-1.36/gl/m4/double-slash-root.m4
--- libidn-1.36-orig/gl/m4/double-slash-root.m4	2020-04-28 18:02:37.000000000 +0300
+++ libidn-1.36/gl/m4/double-slash-root.m4	2020-10-23 10:07:06.565863700 +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 libidn-1.36-orig/gl/m4/dup2.m4 libidn-1.36/gl/m4/dup2.m4
--- libidn-1.36-orig/gl/m4/dup2.m4	2020-07-22 17:48:36.000000000 +0300
+++ libidn-1.36/gl/m4/dup2.m4	2020-10-23 10:00:08.688947400 +0300
@@ -70,6 +70,8 @@
            gl_cv_func_dup2_works="guessing no" ;;
          cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
            gl_cv_func_dup2_works="guessing no" ;;
+         msys*) # on msys 1.5.x, dup2(1,1) returns 0
+           gl_cv_func_dup2_works="guessing no" ;;
          aix* | freebsd*)
                  # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE,
                  # not EBADF.
diff -Naur libidn-1.36-orig/gl/m4/getcwd.m4 libidn-1.36/gl/m4/getcwd.m4
--- libidn-1.36-orig/gl/m4/getcwd.m4	2020-04-28 18:02:38.000000000 +0300
+++ libidn-1.36/gl/m4/getcwd.m4	2020-10-23 10:00:41.969482500 +0300
@@ -54,6 +54,8 @@
             *-musl*)       gl_cv_func_getcwd_null="guessing yes";;
                            # Guess yes on Cygwin.
             cygwin*)       gl_cv_func_getcwd_null="guessing yes";;
+                           # Guess yes on Msys.
+            msys*)         gl_cv_func_getcwd_null="guessing yes";;
                            # If we don't know, obey --enable-cross-guesses.
             *)             gl_cv_func_getcwd_null="$gl_cross_guess_normal";;
           esac
diff -Naur libidn-1.36-orig/gl/m4/getdtablesize.m4 libidn-1.36/gl/m4/getdtablesize.m4
--- libidn-1.36-orig/gl/m4/getdtablesize.m4	2020-04-28 18:02:38.000000000 +0300
+++ libidn-1.36/gl/m4/getdtablesize.m4	2020-10-23 10:04:19.146953900 +0300
@@ -41,6 +41,8 @@
              [case "$host_os" in
                 cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows
                   gl_cv_func_getdtablesize_works="guessing no" ;;
+                msys*)   # on msys 1.5.25, getdtablesize() automatically grows
+                  gl_cv_func_getdtablesize_works="guessing no" ;;
                 *) gl_cv_func_getdtablesize_works="guessing yes" ;;
               esac
              ])
diff -Naur libidn-1.36-orig/gl/m4/malloc.m4 libidn-1.36/gl/m4/malloc.m4
--- libidn-1.36-orig/gl/m4/malloc.m4	2020-04-28 18:02:38.000000000 +0300
+++ libidn-1.36/gl/m4/malloc.m4	2020-10-23 09:58:46.678677100 +0300
@@ -31,7 +31,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, obey --enable-cross-guesses.
           *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;;
diff -Naur libidn-1.36-orig/gl/m4/pthread_sigmask.m4 libidn-1.36/gl/m4/pthread_sigmask.m4
--- libidn-1.36-orig/gl/m4/pthread_sigmask.m4	2020-04-28 18:02:38.000000000 +0300
+++ libidn-1.36/gl/m4/pthread_sigmask.m4	2020-10-23 10:04:44.418260900 +0300
@@ -181,6 +181,8 @@
           [case "$host_os" in
              cygwin*)
                gl_cv_func_pthread_sigmask_return_works="guessing no";;
+             msys*)
+               gl_cv_func_pthread_sigmask_return_works="guessing no";;
              *)
                gl_cv_func_pthread_sigmask_return_works="guessing yes";;
            esac
diff -Naur libidn-1.36-orig/lib/gl/m4/setlocale.m4 libidn-1.36/lib/gl/m4/setlocale.m4
--- libidn-1.36-orig/lib/gl/m4/setlocale.m4	2020-04-28 18:03:20.000000000 +0300
+++ libidn-1.36/lib/gl/m4/setlocale.m4	2020-10-23 09:53:15.618355400 +0300
@@ -18,7 +18,7 @@
     mingw*) NEED_SETLOCALE_IMPROVED=1 ;;
     dnl On Cygwin 1.5.x, setlocale always succeeds but setlocale(LC_CTYPE,NULL)
     dnl is then still "C".
-    cygwin*)
+    cygwin* | msys*)
       case `uname -r` in
         1.5.*) NEED_SETLOCALE_IMPROVED=1 ;;
       esac
diff -Naur libidn-1.36-orig/m4/threadlib.m4 libidn-1.36/m4/threadlib.m4
--- libidn-1.36-orig/m4/threadlib.m4	2020-07-22 18:13:23.000000000 +0300
+++ libidn-1.36/m4/threadlib.m4	2020-10-23 09:53:15.762988700 +0300
@@ -68,7 +68,7 @@
          dnl bugs that lead to endless loops or crashes. See
          dnl <http://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 ;;
