introduced a more flexible thread build
diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
index c687678..2a236a6 100644
--- a/win32/Makefile.msvc
+++ b/win32/Makefile.msvc
@@ -71,7 +71,7 @@
 # The preprocessor and its options.
 CPP = cl.exe /EP
 CPPFLAGS = /nologo /I$(XML_SRCDIR)\include
-!if "$(WITH_THREADS)" == "1"
+!if "$(WITH_THREADS)" != "no"
 CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT"
 !endif
 
@@ -79,9 +79,16 @@
 CC = cl.exe
 CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 /MD
 CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX)
-!if "$(WITH_THREADS)" == "1"
+!if "$(WITH_THREADS)" != "no"
 CFLAGS = $(CFLAGS) /D "_REENTRANT"
 !endif
+!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls"
+CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS" /D "HAVE_COMPILER_TLS"
+!else if "$(WITH_THREADS)" == "native"
+CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS"
+!else if "$(WITH_THREADS)" == "posix"
+CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H"
+!endif
 !if "$(WITH_ZLIB)" == "1"
 CFLAGS = $(CFLAGS) /D "HAVE_ZLIB_H"
 !endif
@@ -100,6 +107,9 @@
 !if "$(WITH_ZLIB)" == "1"
 LIBS = $(LIBS) zlib.lib
 !endif
+!if "$(WITH_THREADS)" == "posix"
+LIBS = $(LIBS) pthreadVC.lib
+!endif
 
 # The archiver and its options.
 AR = lib.exe
@@ -192,6 +202,11 @@
 	$(BINDIR)\testSchemas.exe\
 	$(BINDIR)\testURI.exe\
 	$(BINDIR)\testXPath.exe
+!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" || "$(WITH_THREADS)" == "native"
+UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe
+!else if "$(WITH_THREADS)" == "posix"
+UTILS = $(UTILS) $(BINDIR)\testThreads.exe
+!endif
 
 all : libxml libxmla utils
 
@@ -282,7 +297,7 @@
 !else
 {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe:
 	$(CC) $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< 
-	$(LD) $(LDFLAGS) /OUT:$@ $(XML_IMP) $(UTILS_INTDIR)\$(<B).obj
+	$(LD) $(LDFLAGS) /OUT:$@ $(XML_IMP) $(LIBS) $(UTILS_INTDIR)\$(<B).obj
 !endif
 
 # Builds xmllint and friends. Uses the implicit rule for commands.