--- pr/src/md/windows/ntdllmn.c	Tue Nov 12 04:52:34 2013
+++ pr/src/md/windows/ntdllmn.c	Tue Nov 26 11:22:28 2013
@@ -30,6 +30,7 @@
 
     switch (fdwReason) {
         case DLL_PROCESS_ATTACH:
+#ifdef _MSC_VER
             /*
              * If lpvReserved is NULL, we are dynamically loaded
              * and therefore can't use static thread-local storage.
@@ -39,6 +40,13 @@
             } else {
                 _pr_use_static_tls = TRUE;
             }
+#else
+            /* 
+             * No __declspec(thread) on mingw, so just use
+             * the Tls* API always.
+             */
+            _pr_use_static_tls = FALSE;
+#endif
             break;
         case DLL_THREAD_ATTACH:
             break;
