diff -ur xvidcore.orig/build/generic/configure.in xvidcore/build/generic/configure.in
--- xvidcore.orig/build/generic/configure.in	Wed May 18 16:59:28 2011
+++ xvidcore/build/generic/configure.in	Wed Jun  1 02:13:44 2011
@@ -297,10 +297,10 @@
 	;;
      [[cC]][[yY]][[gG]][[wW]][[iI]][[nN]]*|mingw32*|mks*)
 	AC_MSG_RESULT([ok])
-	STATIC_LIB="xvidcore.\$(STATIC_EXTENSION)"
-	SHARED_LIB="xvidcore.\$(SHARED_EXTENSION)"
-	SPECIFIC_LDFLAGS="-mno-cygwin -shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def"
-	SPECIFIC_CFLAGS="-mno-cygwin"
+	STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
+	SHARED_LIB="libxvidcore.\$(SHARED_EXTENSION)"
+	SPECIFIC_LDFLAGS="-shared -Wl,--dll,--out-implib,\$@.a libxvidcore.def"
+	SPECIFIC_CFLAGS=""
 	;;
      darwin*|raphsody*)
 	STATIC_LIB="libxvidcore.\$(STATIC_EXTENSION)"
diff -ur xvidcore.orig/src/encoder.c xvidcore/src/encoder.c
--- xvidcore.orig/src/encoder.c	Wed May 18 18:02:35 2011
+++ xvidcore/src/encoder.c	Wed Jun  1 02:56:28 2011
@@ -449,7 +449,7 @@
 
 	/* multithreaded stuff */
 	if (create->num_threads > 0) {
-#ifndef HAVE_PTHREAD
+#if !defined(HAVE_PTHREAD) && !defined(WIN32)
 		int t = MAX(1, create->num_threads);
 #else
 		int t = MIN(create->num_threads, (int) (pEnc->mbParam.mb_height>>1)); /* at least two rows per thread */
@@ -1651,7 +1651,7 @@
 	int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices));
 	int slices_per_thread = (num_slices*1024 / num_threads);
 	int mb_height = pEnc->mbParam.mb_height;
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	void * status = NULL;
 #endif
 	uint16_t k;
@@ -1694,7 +1694,7 @@
 	pEnc->smpData[0].bs = bs;
 	pEnc->smpData[0].sStat = &pEnc->current->sStat;
 
-#ifdef HAVE_PTHREAD	
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* create threads */
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&pEnc->smpData[k].handle, NULL, 
@@ -1704,7 +1704,7 @@
 
 	SliceCodeI(&pEnc->smpData[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* wait until all threads are finished */
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(pEnc->smpData[k].handle, &status);
@@ -1918,7 +1918,7 @@
 
 	int k = 0, bound = 0, num_slices = pEnc->num_slices;
 	int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices));
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	void * status = NULL;
 	int threads_per_slice = (pEnc->num_threads*1024 / num_threads);
 #endif
@@ -2017,7 +2017,7 @@
 		}
 	}
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	if (pEnc->num_threads > 0) {
 
 		/* multithreaded motion estimation - dispatch threads */
@@ -2118,7 +2118,7 @@
 	pEnc->smpData[0].bs = bs;
 	pEnc->smpData[0].sStat = &current->sStat;
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* create threads */
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&pEnc->smpData[k].handle, NULL, 
@@ -2128,7 +2128,7 @@
 
 	SliceCodeP(&pEnc->smpData[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* wait until all threads are finished */
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(pEnc->smpData[k].handle, &status);
@@ -2296,7 +2296,7 @@
 	int bits = BitstreamPos(bs);
 	int k = 0, bound = 0, num_slices = pEnc->num_slices;
 	int num_threads = MAX(1, MIN(pEnc->num_threads, num_slices));
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	void * status = NULL;
 	int threads_per_slice = (pEnc->num_threads*1024 / num_threads);
 #endif
@@ -2367,7 +2367,7 @@
 
 	start_timer();
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	if (pEnc->num_threads > 0) {
 
 		/* multithreaded motion estimation - dispatch threads */
@@ -2475,7 +2475,7 @@
 		}
 	}
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&pEnc->smpData[k].handle, NULL, 
 			(void*)SliceCodeB, (void*)&pEnc->smpData[k]);
@@ -2486,7 +2486,7 @@
 	pEnc->smpData[0].sStat = &frame->sStat;
 	SliceCodeB(&pEnc->smpData[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(pEnc->smpData[k].handle, &status);
 	}
diff -ur xvidcore.orig/src/image/postprocessing.c xvidcore/src/image/postprocessing.c
--- xvidcore.orig/src/image/postprocessing.c	Wed May 18 18:02:35 2011
+++ xvidcore/src/image/postprocessing.c	Wed Jun  1 02:40:36 2011
@@ -133,7 +133,7 @@
 				int flags, int brightness, int frame_num, int bvop, int threads)
 {
 	int k;
-#ifndef HAVE_PTHREAD
+#if !defined(HAVE_PTHREAD) && !defined(WIN32)
 	int num_threads = 1;
 #else
 	int num_threads = MAX(1, MIN(threads, 4));
@@ -155,7 +155,7 @@
 
 		data[k].stop_y = mb_height*2;
 	}
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* create threads */
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&data[k].handle, NULL, 
@@ -164,7 +164,7 @@
 #endif
 	stripe_deblock_h(&data[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* wait until all threads are finished */
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(data[k].handle, &status);
@@ -178,7 +178,7 @@
 		data[k].stop_x = mb_width*2;
 	}
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* create threads */
 	for (k = 1; k < num_threads; k++) {
 		pthread_create(&data[k].handle, NULL, 
@@ -187,7 +187,7 @@
 #endif
 	stripe_deblock_v(&data[0]);
 
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(WIN32)
 	/* wait until all threads are finished */
 	for (k = 1; k < num_threads; k++) {
 		pthread_join(data[k].handle, &status);
diff -ur xvidcore.orig/src/portab.h xvidcore/src/portab.h
--- xvidcore.orig/src/portab.h	Wed May 18 18:02:35 2011
+++ xvidcore/src/portab.h	Wed Jun  1 02:53:10 2011
@@ -74,11 +74,16 @@
 #ifdef WIN32
 
 # include <windows.h>
-# define pthread_t				HANDLE
-# define pthread_create(t,u,f,d) *(t)=CreateThread(NULL,0,f,d,0,NULL)
-# define pthread_join(t,s)		{ WaitForSingleObject(t,INFINITE); \
+
+# ifdef HAVE_PTHREAD
+#  include <pthread.h>
+# else
+#  include <process.h>
+#  define pthread_t				HANDLE
+#  define pthread_create(t,u,f,d) *(t)=_beginthreadex(NULL,0,f,d,0,NULL)
+#  define pthread_join(t,s)		{ WaitForSingleObject(t,INFINITE); \
 									CloseHandle(t); } 
-# define sched_yield()			Sleep(0);
+#  define sched_yield()			Sleep(0);
 static __inline int pthread_num_processors_np() 
 {
 	DWORD p_aff, s_aff, r = 0;
@@ -86,6 +91,7 @@
 	for(; p_aff != 0; p_aff>>=1) r += p_aff&1;
 	return r;
 }
+# endif
 
 #elif defined(__amigaos4__)
 
