diff -Naur mpdecimal-2.5.0-orig/configure.ac mpdecimal-2.5.0/configure.ac
--- mpdecimal-2.5.0-orig/configure.ac	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/configure.ac	2020-07-16 10:01:48.795325300 +0300
@@ -12,6 +12,8 @@
 AC_MSG_RESULT($ac_sys_system)
 
 LIBSTATIC=libmpdec.a
+IS_WINDOWS=no
+LIBIMPORT=
 case $ac_sys_system in
     darwin*|Darwin*)
         LIBNAME="libmpdec.dylib"
@@ -19,6 +21,22 @@
         LIBSHARED="libmpdec.2.5.0.dylib"
         CONFIGURE_LDFLAGS="-dynamiclib -install_name @rpath/$LIBSONAME -compatibility_version 2.5 -current_version 2.5.0"
         ;;
+    mingw*|MINGW*)
+        LIBNAME=
+        LIBIMPORT="libmpdec.dll.a"
+        LIBSONAME=
+        LIBSHARED="libmpdec-2.dll"
+        CONFIGURE_LDFLAGS="-shared -Wl,--out-implib,$LIBIMPORT"
+        IS_WINDOWS=yes
+        ;;
+    msys*|MSYS*)
+        LIBNAME=
+        LIBIMPORT="libmpdec.dll.a"
+        LIBSONAME=
+        LIBSHARED="msys-mpdec-2.dll"
+        CONFIGURE_LDFLAGS="-shared -Wl,--out-implib,$LIBIMPORT"
+        IS_WINDOWS=yes
+        ;;
     *)
         LIBNAME="libmpdec.so"
         LIBSONAME="libmpdec.so.2"
@@ -31,9 +49,12 @@
 AC_SUBST(LIBNAME)
 AC_SUBST(LIBSONAME)
 AC_SUBST(LIBSHARED)
+AC_SUBST(LIBIMPORT)
+AC_SUBST(IS_WINDOWS)
 
 
 LIBSTATIC_CXX=libmpdec++.a
+LIBIMPORT_CXX=
 case $ac_sys_system in
     darwin*|Darwin*)
         LIBNAME_CXX="libmpdec++.dylib"
@@ -41,6 +62,20 @@
         LIBSHARED_CXX="libmpdec++.2.5.0.dylib"
         CONFIGURE_LDXXFLAGS="-dynamiclib -install_name @rpath/$LIBSONAME_CXX -undefined dynamic_lookup -compatibility_version 2.5 -current_version 2.5.0"
         ;;
+    mingw*|MINGW*)
+        LIBNAME_CXX=
+        LIBIMPORT_CXX="libmpdec++.dll.a"
+        LIBSONAME_CXX=
+        LIBSHARED_CXX="libmpdec++-2.dll"
+        CONFIGURE_LDXXFLAGS="-shared -Wl,--out-implib,$LIBIMPORT_CXX"
+        ;;
+    msys*|MSYS*)
+        LIBNAME_CXX=
+        LIBIMPORT_CXX="libmpdec++.dll.a"
+        LIBSONAME_CXX=
+        LIBSHARED_CXX="msys-mpdec++-2.dll"
+        CONFIGURE_LDXXFLAGS="-shared -Wl,--out-implib,$LIBIMPORT_CXX"
+        ;;
     *)
         LIBNAME_CXX="libmpdec++.so"
         LIBSONAME_CXX="libmpdec++.so.2"
@@ -53,6 +88,7 @@
 AC_SUBST(LIBNAME_CXX)
 AC_SUBST(LIBSONAME_CXX)
 AC_SUBST(LIBSHARED_CXX)
+AC_SUBST(LIBIMPORT_CXX)
 
 # Apparently purely informational for this particular build:
 AC_CANONICAL_HOST
diff -Naur mpdecimal-2.5.0-orig/libmpdec/Makefile.in mpdecimal-2.5.0/libmpdec/Makefile.in
--- mpdecimal-2.5.0-orig/libmpdec/Makefile.in	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/libmpdec/Makefile.in	2020-07-16 10:01:17.712406300 +0300
@@ -8,6 +8,8 @@
 LIBNAME = @LIBNAME@
 LIBSONAME = @LIBSONAME@
 LIBSHARED = @LIBSHARED@
+LIBIMPORT = @LIBIMPORT@
+IS_WINDOWS= @IS_WINDOWS@
 
 CC = @CC@
 LD = @LD@
@@ -54,8 +56,10 @@
 
 $(LIBSHARED): Makefile $(SHARED_OBJS)
 	$(LD) $(MPD_LDFLAGS) -o $(LIBSHARED) $(SHARED_OBJS) -lm
+ifeq ($(IS_WINDOWS),no)
 	ln -sf $(LIBSHARED) $(LIBNAME)
 	ln -sf $(LIBSHARED) $(LIBSONAME)
+endif
 
 
 basearith.o:\
diff -Naur mpdecimal-2.5.0-orig/libmpdec++/Makefile.in mpdecimal-2.5.0/libmpdec++/Makefile.in
--- mpdecimal-2.5.0-orig/libmpdec++/Makefile.in	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/libmpdec++/Makefile.in	2020-07-16 10:01:36.106553800 +0300
@@ -8,11 +8,14 @@
 LIBNAME = @LIBNAME@
 LIBSONAME = @LIBSONAME@
 LIBSHARED = @LIBSHARED@
+LIBIMPORT = @LIBIMPORT@
+IS_WINDOWS= @IS_WINDOWS@
 
 LIBSTATIC_CXX = @LIBSTATIC_CXX@
 LIBNAME_CXX = @LIBNAME_CXX@
 LIBSONAME_CXX = @LIBSONAME_CXX@
 LIBSHARED_CXX = @LIBSHARED_CXX@
+LIBIMPORT_CXX = @LIBIMPORT_CXX@
 
 CXX = @CXX@
 LDXX = @LDXX@
@@ -53,8 +56,12 @@
 
 $(LIBSHARED_CXX): Makefile $(SHARED_OBJS)
+ifeq ($(IS_WINDOWS),yes)
+	$(LDXX) $(MPD_LDXXFLAGS) -o $(LIBSHARED_CXX) $(SHARED_OBJS) ../libmpdec/$(LIBIMPORT) -lm
+else
 	$(LDXX) $(MPD_LDXXFLAGS) -o $(LIBSHARED_CXX) $(SHARED_OBJS) -lm
 	ln -sf $(LIBSHARED_CXX) $(LIBNAME_CXX)
 	ln -sf $(LIBSHARED_CXX) $(LIBSONAME_CXX)
+endif
 
 
 decimal.o:\
diff -Naur mpdecimal-2.5.0-orig/Makefile.in mpdecimal-2.5.0/Makefile.in
--- mpdecimal-2.5.0-orig/Makefile.in	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/Makefile.in	2020-07-16 10:01:03.688124100 +0300
@@ -14,15 +14,19 @@
 LIBNAME = @LIBNAME@
 LIBSONAME = @LIBSONAME@
 LIBSHARED = @LIBSHARED@
+LIBIMPORT = @LIBIMPORT@
+IS_WINDOWS= @IS_WINDOWS@
 
 LIBSTATIC_CXX = @LIBSTATIC_CXX@
 LIBNAME_CXX = @LIBNAME_CXX@
 LIBSONAME_CXX = @LIBSONAME_CXX@
 LIBSHARED_CXX = @LIBSHARED_CXX@
+LIBIMPORT_CXX = @LIBIMPORT_CXX@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 includedir = @includedir@
+bindir = @bindir@
 libdir = @libdir@
 datarootdir = @datarootdir@
 docdir = @docdir@
@@ -65,8 +68,14 @@
 	$(INSTALL) -m 644 libmpdec/mpdecimal.h $(DESTDIR)$(includedir)
 	$(INSTALL) -d -m 755 $(DESTDIR)$(libdir)
 	$(INSTALL) -m 644 libmpdec/$(LIBSTATIC) $(DESTDIR)$(libdir)
+ifeq ($(IS_WINDOWS),yes)
+	$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
+	$(INSTALL) -m 655 libmpdec/$(LIBIMPORT) $(DESTDIR)$(libdir)
+	$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(bindir)
+else
 	$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(libdir)
 	cd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) $(LIBNAME)
+endif
 	$(INSTALL) -d -m 755 $(DESTDIR)$(docdir)
 	cp -R doc/libmpdec $(DESTDIR)$(docdir)
 
@@ -75,8 +83,14 @@
 	$(INSTALL) -m 644 libmpdec++/decimal.hh $(DESTDIR)$(includedir)
 	$(INSTALL) -d -m 755 $(DESTDIR)$(libdir)
 	$(INSTALL) -m 644 libmpdec++/$(LIBSTATIC_CXX) $(DESTDIR)$(libdir)
+ifeq ($(IS_WINDOWS),yes)
+	$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
+	$(INSTALL) -m 644 libmpdec++/$(LIBIMPORT_CXX) $(DESTDIR)$(libdir)
+	$(INSTALL) -m 755 libmpdec++/$(LIBSHARED_CXX) $(DESTDIR)$(bindir)
+else
 	$(INSTALL) -m 755 libmpdec++/$(LIBSHARED_CXX) $(DESTDIR)$(libdir)
 	cd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED_CXX) $(LIBSONAME_CXX) && ln -sf $(LIBSHARED_CXX) $(LIBNAME_CXX)
+endif
 	cp -R doc/libmpdec++ $(DESTDIR)$(docdir)
 
 
diff -Naur mpdecimal-2.5.0-orig/tests/Makefile.in mpdecimal-2.5.0/tests/Makefile.in
--- mpdecimal-2.5.0-orig/tests/Makefile.in	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/tests/Makefile.in	2020-07-16 09:18:19.812162800 +0300
@@ -6,6 +6,9 @@
 CC = @CC@
 AR = @AR@
 
+# Windows demands some special build rules.
+IS_WINDOWS = @IS_WINDOWS@
+
 CONFIGURE_CFLAGS = @CONFIGURE_CFLAGS@
 CFLAGS ?= $(CONFIGURE_CFLAGS)
 
@@ -41,6 +44,9 @@
 clean: FORCE
 	rm -f *.o *.gch *.gcda *.gcno *.gcov *.dyn *.dpi *.lock
 	rm -f runtest runtest_shared runtest_alloc runtest_alloc_shared
+ifeq ($(IS_WINDOWS),yes)
+	rm -f *.dll *.exe
+endif
 
 distclean: FORCE
 	$(MAKE) clean
diff -Naur mpdecimal-2.5.0-orig/tests/runshort.sh mpdecimal-2.5.0/tests/runshort.sh
--- mpdecimal-2.5.0-orig/tests/runshort.sh	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/tests/runshort.sh	2020-07-16 10:07:26.285336100 +0300
@@ -30,6 +30,13 @@
 
 printf "Running additional tests ...\n\n"
 
+case "$(uname -s)" in
+  CYGWIN*|MINGW*|MSYS*)
+  cp -f ../libmpdec/*.dll .
+  cp -f ../libmpdec++/*.dll .
+  ;;
+esac
+
 if ! ./runtest additional.decTest
 then
     printf "\nFAIL\n\n\n"
diff -Naur mpdecimal-2.5.0-orig/tests/runshort_alloc.sh mpdecimal-2.5.0/tests/runshort_alloc.sh
--- mpdecimal-2.5.0-orig/tests/runshort_alloc.sh	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/tests/runshort_alloc.sh	2020-07-16 10:07:24.025648400 +0300
@@ -22,6 +22,13 @@
 
 printf "Running official tests with allocation failures ...\n\n"
 
+case "$(uname -s)" in
+  CYGWIN*|MINGW*|MSYS*)
+  cp -f ../libmpdec/*.dll .
+  cp -f ../libmpdec++/*.dll .
+  ;;
+esac
+
 if  ! ./runtest_alloc official.decTest
 then
     printf "\nFAIL\n\n\n"
diff -Naur mpdecimal-2.5.0-orig/tests/runtest.c mpdecimal-2.5.0/tests/runtest.c
--- mpdecimal-2.5.0-orig/tests/runtest.c	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/tests/runtest.c	2020-07-16 09:18:19.834286900 +0300
@@ -46,6 +46,10 @@
 
 #include "malloc_fail.h"
 
+#if defined(__MINGW32__)
+#define random rand
+#define srandom srand
+#endif
 
 #define MAXLINE 400000
 #define MAXTOKEN 32
diff -Naur mpdecimal-2.5.0-orig/tests++/runshort.sh mpdecimal-2.5.0/tests++/runshort.sh
--- mpdecimal-2.5.0-orig/tests++/runshort.sh	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/tests++/runshort.sh	2020-07-16 10:07:44.750505500 +0300
@@ -22,6 +22,13 @@
 
 printf "Running official tests ...\n\n"
 
+case "$(uname -s)" in
+  CYGWIN*|MINGW*|MSYS*)
+  cp -f ../libmpdec/*.dll .
+  cp -f ../libmpdec++/*.dll .
+  ;;
+esac
+
 if  ! ./runtest official.topTest --threaded; then
     printf "\nFAIL\n\n\n"
     exit 1
diff -Naur mpdecimal-2.5.0-orig/tests++/runshort_alloc.sh mpdecimal-2.5.0/tests++/runshort_alloc.sh
--- mpdecimal-2.5.0-orig/tests++/runshort_alloc.sh	2020-06-27 22:41:49.000000000 +0300
+++ mpdecimal-2.5.0/tests++/runshort_alloc.sh	2020-07-16 10:07:37.918615300 +0300
@@ -22,6 +22,13 @@
 
 printf "Running official tests with allocation failures ...\n\n"
 
+case "$(uname -s)" in
+  CYGWIN*|MINGW*|MSYS*)
+  cp -f ../libmpdec/*.dll .
+  cp -f ../libmpdec++/*.dll .
+  ;;
+esac
+
 if  ! ./runtest_alloc official.topTest --threaded; then
     printf "\nFAIL\n\n\n"
     exit 1
