--- glib-2.36.0/configure.ac.orig	2013-04-08 16:49:59 +0400
+++ glib-2.36.0/configure.ac	2013-04-08 22:51:15 +0400
@@ -2177,14 +2177,20 @@
 	  ])
 
 	  g_threads_impl="POSIX"
+          AC_DEFINE([THREADS_POSIX], [1], [Use pthreads])
 	  AC_SUBST(GTHREAD_COMPILE_IMPL_DEFINES)
           CPPFLAGS="$glib_save_CPPFLAGS"
 ], [test x$have_threads = xwin32], [
+           AC_DEFINE([THREADS_WIN32], [1], [Use w32 threads])
 	   g_threads_impl="WIN32"
 ], [
+           AC_DEFINE([THREADS_NONE], [1], [Use no threads])
 	   g_threads_impl="NONE"
            G_THREAD_LIBS=error
 ])
+AM_CONDITIONAL(THREADS_POSIX, [test "$g_threads_impl" = "POSIX"])
+AM_CONDITIONAL(THREADS_WIN32, [test "$g_threads_impl" = "WIN32"])
+AM_CONDITIONAL(THREADS_NONE, [test "$g_threads_impl" = "NONE"])
 
 if test "x$G_THREAD_LIBS" = xerror; then
         AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
--- glib-2.36.0/glib/Makefile.am.orig	2013-04-08 16:49:58 +0400
+++ glib-2.36.0/glib/Makefile.am	2013-04-08 22:53:25 +0400
@@ -214,11 +214,13 @@
 libglib_2_0_la_SOURCES += glib-unix.c
 endif
 
-if OS_WIN32
+if THREADS_WIN32
 libglib_2_0_la_SOURCES += gthread-win32.c
 else
+if THREADS_POSIX
 libglib_2_0_la_SOURCES += gthread-posix.c
 endif
+endif
 
 EXTRA_libglib_2_0_la_SOURCES = \
 	giounix.c	\
--- glib-2.36.0/glib/gthread-posix.c.orig	2013-04-08 22:54:37 +0400
+++ glib-2.36.0/glib/gthread-posix.c	2013-04-08 23:01:03 +0400
@@ -66,6 +66,9 @@
 #ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
 #endif
+#ifdef G_OS_WIN32
+#include <windows.h>
+#endif
 
 static void
 g_thread_abort (gint         status,
--- glib-2.36.0/glib/glib-init.c.orig	2013-04-08 23:06:06 +0400
+++ glib-2.36.0/glib/glib-init.c	2013-04-08 23:22:19 +0400
@@ -239,12 +239,16 @@
     case DLL_PROCESS_ATTACH:
       glib_dll = hinstDLL;
       g_clock_win32_init ();
+#ifdef THREADS_WIN32
       g_thread_win32_init ();
+#endif
       glib_init ();
       break;
 
     case DLL_THREAD_DETACH:
+#ifdef THREADS_WIN32
       g_thread_win32_thread_detach ();
+#endif
       break;
 
     default:
