diff -r -u --strip-trailing-cr libxslt-1.1.29.original/configure.in libxslt-1.1.29/configure.in
--- libxslt-1.1.29.original/configure.in	2017-05-17 21:59:25.802503900 +0200
+++ libxslt-1.1.29/configure.in	2017-05-17 21:59:25.442628300 +0200
@@ -3,6 +3,7 @@
 AC_INIT(libxslt/xslt.c)
 AC_CONFIG_HEADERS(config.h)
 AC_CANONICAL_HOST
+AC_LIBTOOL_WIN32_DLL
 AC_USE_SYSTEM_EXTENSIONS
 
 dnl
@@ -638,15 +639,17 @@
  WIN32_EXTRA_LDFLAGS="-no-undefined"
  ;;
  *-*-mingw*)
- WIN32_EXTRA_LIBADD="-lwsock32"
+ WIN32_EXTRA_LIBADD="-lws2_32 -lmswsock"
  WIN32_EXTRA_LDFLAGS="-no-undefined"
- AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
- AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
- AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
+ if test "x${PYTHON}" != "x"
+ then
+   WIN32_EXTRA_PYTHON_LIBADD="-shrext .pyd " #-L${pythondir}/../../libs -lpython$(echo ${PYTHON_VERSION} | tr -d .)
+ fi
  ;;
 esac
 AC_SUBST(WIN32_EXTRA_LIBADD)
 AC_SUBST(WIN32_EXTRA_LDFLAGS)
+AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
 
 
 AC_SUBST(XSLTPROCDV)
diff -r -u --strip-trailing-cr libxslt-1.1.29.original/libexslt/Makefile.am libxslt-1.1.29/libexslt/Makefile.am
--- libxslt-1.1.29.original/libexslt/Makefile.am	2017-05-17 21:59:29.358345500 +0200
+++ libxslt-1.1.29/libexslt/Makefile.am	2017-05-17 21:59:25.458562200 +0200
@@ -28,7 +28,7 @@
 	dynamic.c
 
 libexslt_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS) $(LIBGCRYPT_LIBS)
-libexslt_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -version-info $(LIBEXSLT_VERSION_INFO)
+libexslt_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -version-info $(LIBEXSLT_VERSION_INFO) -no-undefined
 
 man_MANS = libexslt.3
 
diff -r -u --strip-trailing-cr libxslt-1.1.29.original/libxslt/Makefile.am libxslt-1.1.29/libxslt/Makefile.am
--- libxslt-1.1.29.original/libxslt/Makefile.am	2017-05-17 21:59:29.922614100 +0200
+++ libxslt-1.1.29/libxslt/Makefile.am	2017-05-17 21:59:25.474209700 +0200
@@ -66,7 +66,8 @@
 libxslt_la_LDFLAGS =					\
 		$(WIN32_EXTRA_LDFLAGS)			\
 		$(LIBXSLT_VERSION_SCRIPT)		\
-		-version-info $(LIBXSLT_VERSION_INFO)
+		-version-info $(LIBXSLT_VERSION_INFO) \
+		-no-undefined
 
 man_MANS = libxslt.3
 
diff -r -u --strip-trailing-cr libxslt-1.1.29.original/libxslt/security.c libxslt-1.1.29/libxslt/security.c
--- libxslt-1.1.29.original/libxslt/security.c	2017-05-17 21:59:30.135479400 +0200
+++ libxslt-1.1.29/libxslt/security.c	2017-05-17 21:59:25.209064200 +0200
@@ -342,8 +342,16 @@
 		}
 	    }
 	    ret = xsltCheckWritePath(sec, ctxt, directory);
-	    if (ret == 1)
+	    if (ret == 1) {
 		ret = mkdir(directory, 0755);
+		if (ret == -1 && errno == EEXIST) {
+		    struct stat buf;
+                    ret = stat(directory, &buf);
+                    if (ret == 0) {
+                        ret = S_ISDIR(buf.st_mode) ? 0 : -1;
+                    }
+		}
+	    }
 	}
 	xmlFree(directory);
 	if (ret < 0)
diff -r -u --strip-trailing-cr libxslt-1.1.29.original/libxslt.m4 libxslt-1.1.29/libxslt.m4
--- libxslt-1.1.29.original/libxslt.m4	2017-05-17 21:59:30.590904900 +0200
+++ libxslt-1.1.29/libxslt.m4	2017-05-17 21:59:25.349129300 +0200
@@ -52,8 +52,10 @@
            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
     if test "x$enable_xslttest" = "xyes" ; then
       ac_save_CFLAGS="$CFLAGS"
+      ac_save_CXXFLAGS="$CXXFLAGS"
       ac_save_LIBS="$LIBS"
       CFLAGS="$CFLAGS $XSLT_CFLAGS"
+      CXXFLAGS="$CXXFLAGS $XSLT_CFLAGS"
       LIBS="$XSLT_LIBS $LIBS"
 dnl
 dnl Now check if the installed libxslt is sufficiently new.
@@ -138,6 +140,7 @@
 }
 ],, no_xslt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
        CFLAGS="$ac_save_CFLAGS"
+       CXXFLAGS="$ac_save_CXXFLAGS"
        LIBS="$ac_save_LIBS"
      fi
   fi
@@ -158,6 +161,7 @@
        else
           echo "*** Could not run libxslt test program, checking why..."
           CFLAGS="$CFLAGS $XSLT_CFLAGS"
+          CXXFLAGS="$CXXFLAGS $XSLT_CFLAGS"
           LIBS="$LIBS $XSLT_LIBS"
           AC_TRY_LINK([
 #include <libxslt/xslt.h>
@@ -177,6 +181,7 @@
           echo "*** or that you have moved LIBXSLT since it was installed. In the latter case, you"
           echo "*** may want to edit the xslt-config script: $XSLT_CONFIG" ])
           CFLAGS="$ac_save_CFLAGS"
+          CXXFLAGS="$ac_save_CXXFLAGS"
           LIBS="$ac_save_LIBS"
        fi
      fi
diff -r -u --strip-trailing-cr libxslt-1.1.29.original/python/libxslt.c libxslt-1.1.29/python/libxslt.c
--- libxslt-1.1.29.original/python/libxslt.c	2017-05-17 21:59:30.889669200 +0200
+++ libxslt-1.1.29/python/libxslt.c	2017-05-17 21:59:25.317594800 +0200
@@ -22,9 +22,7 @@
 
 #include <stdio.h>
 
-#if (defined(_MSC_VER) || defined(__MINGW32__)) && !defined(vsnprintf)
-#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
-#elif defined(XSLT_NEED_TRIO)
+#if defined(XSLT_NEED_TRIO)
 #include "trio.h"
 #define vsnprintf trio_vsnprintf
 #endif
diff -r -u --strip-trailing-cr libxslt-1.1.29.original/python/libxslt_wrap.h libxslt-1.1.29/python/libxslt_wrap.h
--- libxslt-1.1.29.original/python/libxslt_wrap.h	2017-05-17 21:59:30.909202400 +0200
+++ libxslt-1.1.29/python/libxslt_wrap.h	2017-05-17 21:59:25.239802800 +0200
@@ -17,6 +17,7 @@
 #include <libxslt/transform.h>
 #include <libxslt/variables.h>
 #include <libxslt/xsltconfig.h>
+#include <libxslt/xsltlocale.h>
 
 #define Pystylesheet_Get(v) (((v) == Py_None) ? NULL : \
         (((Pystylesheet_Object *)(v))->obj))
diff -r -u --strip-trailing-cr libxslt-1.1.29.original/python/Makefile.am libxslt-1.1.29/python/Makefile.am
--- libxslt-1.1.29.original/python/Makefile.am	2017-05-17 21:59:30.928088500 +0200
+++ libxslt-1.1.29/python/Makefile.am	2017-05-17 21:59:25.412061300 +0200
@@ -19,7 +19,7 @@
 	libxslt-python-api.xml	\
 	$(DOCS)
 
-libxsltmod_la_LDFLAGS =  $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
+libxsltmod_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -module -avoid-version -shared
 
 if WITH_PYTHON
 mylibs = \
@@ -37,7 +37,7 @@
 	-I../libexslt
 libxsltmod_la_SOURCES = libxslt.c types.c
 nodist_libxsltmod_la_SOURCES = libxslt-py.c
-libxsltmod_la_LIBADD = $(mylibs) $(PYTHON_LIBS)
+libxsltmod_la_LIBADD = $(mylibs) $(PYTHON_LIBS) @WIN32_EXTRA_PYTHON_LIBADD@
 
 libxslt.py: $(srcdir)/libxsl.py libxsltclass.py
 	cat $(srcdir)/libxsl.py libxsltclass.py > $@
diff -r -u --strip-trailing-cr libxslt-1.1.29.original/tests/plugins/Makefile.am libxslt-1.1.29/tests/plugins/Makefile.am
--- libxslt-1.1.29.original/tests/plugins/Makefile.am	2017-05-17 22:00:05.706349200 +0200
+++ libxslt-1.1.29/tests/plugins/Makefile.am	2017-05-17 21:59:25.286309000 +0200
@@ -21,7 +21,7 @@
 xmlsoft_org_xslt_testplugin_la_CFLAGS = -DMODULE_COMPILE $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
 xmlsoft_org_xslt_testplugin_la_SOURCES = testplugin.c
 xmlsoft_org_xslt_testplugin_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS)
-xmlsoft_org_xslt_testplugin_la_LDFLAGS = -module -avoid-version -rpath $(plugindir)
+xmlsoft_org_xslt_testplugin_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(plugindir)
 
 test-logall:
 	@echo '## Running plugin tests'
