diff -ur orig/SDL-1.2.14/configure.in SDL-1.2.14/configure.in
--- orig/SDL-1.2.14/configure.in	2009-10-17 18:35:03.000000000 +0100
+++ SDL-1.2.14/configure.in	2010-02-13 19:58:38.000000000 +0000
@@ -82,6 +82,10 @@
         BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
         BASE_LDFLAGS="-mno-cygwin"
         ;;
+    *mingw32ce*)
+        BASE_CFLAGS=""
+	BASE_LDFLAGS=""
+        ;;
     *)
         BASE_CFLAGS="-D_GNU_SOURCE=1"
         BASE_LDFLAGS=""
@@ -2453,6 +2457,59 @@
             have_timers=yes
         fi
         ;;
+
+    *mingw32ce*)
+        ARCH=wince
+
+        CheckDummyVideo
+        CheckDiskAudio
+        CheckDummyAudio
+        CheckWIN32
+
+#        if test x$enable_video = xyes; then
+#            AC_DEFINE(SDL_VIDEO_DRIVER_GAPI)
+#            SOURCES="$SOURCES $srcdir/src/video/gapi/*.c"
+#            have_video=yes
+#        fi
+
+        # Set up files for the audio library
+        if test x$enable_audio = xyes; then
+            AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
+            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
+            have_audio=yes
+        fi
+        # Set up files for the thread library
+        if test x$enable_threads = xyes; then
+            AC_DEFINE(SDL_THREAD_WIN32)
+            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
+            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
+            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
+            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
+            have_threads=yes
+        fi
+        # Set up files for the timer library
+        if test x$enable_timers = xyes; then
+            AC_DEFINE(SDL_TIMER_WINCE)
+            SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
+            have_timers=yes
+        fi
+        # Set up files for the shared object loading library
+        if test x$enable_loadso = xyes; then
+            AC_DEFINE(SDL_LOADSO_WIN32)
+            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
+            have_loadso=yes
+        fi
+
+        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmtimer"
+
+        # Windows CE requires special setup
+        #SOURCES="$SOURCES $srcdir/src/main/win32/*.rc"
+        SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
+        SDL_CFLAGS="$SDL_CFLAGS -mwin32 -Dmain=SDL_main -D_WIN32_WCE=0x0500"
+        SDL_LIBS="-lSDLmain $SDL_LIBS"
+
+        ;;
+
     *-*-cygwin* | *-*-mingw32*)
         ARCH=win32
         if test "$build" != "$host"; then # cross-compiling
diff -ur orig/SDL-1.2.14/src/thread/win32/SDL_syssem.c SDL-1.2.14/src/thread/win32/SDL_syssem.c
--- orig/SDL-1.2.14/src/thread/win32/SDL_syssem.c	2009-10-13 00:07:15.000000000 +0100
+++ SDL-1.2.14/src/thread/win32/SDL_syssem.c	2010-02-13 19:58:38.000000000 +0000
@@ -38,7 +38,7 @@
 #else
 	HANDLE id;
 #endif
-	Uint32 volatile count;
+	LONG volatile count;
 };
 
 
diff -ur orig/SDL-1.2.14/src/thread/win32/SDL_systhread.c SDL-1.2.14/src/thread/win32/SDL_systhread.c
--- orig/SDL-1.2.14/src/thread/win32/SDL_systhread.c	2009-10-13 00:07:15.000000000 +0100
+++ SDL-1.2.14/src/thread/win32/SDL_systhread.c	2010-02-13 19:58:38.000000000 +0000
@@ -38,8 +38,8 @@
 
 #if __GNUC__
 typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
-        unsigned (__stdcall *func)(void *), void *arg, 
-        unsigned, unsigned *threadID);
+        DWORD (__stdcall *func)(void *), void *arg, 
+        unsigned, DWORD *threadID);
 typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
 #elif defined(__WATCOMC__)
 /* This is for Watcom targets except OS2 */
@@ -65,7 +65,7 @@
   pfnSDL_CurrentEndThread pfnCurrentEndThread;
 } tThreadStartParms, *pThreadStartParms;
 
-static unsigned __stdcall RunThread(void *data)
+static DWORD __stdcall RunThread(void *data)
 {
   pThreadStartParms pThreadParms = (pThreadStartParms)data;
   pfnSDL_CurrentEndThread pfnCurrentEndThread = NULL;
@@ -99,7 +99,7 @@
 	pfnSDL_CurrentEndThread pfnEndThread = _endthreadex;
 #endif
 #endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */
-	unsigned threadid;
+	DWORD threadid;
 	pThreadStartParms pThreadParms = (pThreadStartParms)SDL_malloc(sizeof(tThreadStartParms));
 	if (!pThreadParms) {
 		SDL_OutOfMemory();
diff -ur orig/SDL-1.2.14/src/video/gapi/SDL_gapivideo.c SDL-1.2.14/src/video/gapi/SDL_gapivideo.c
--- orig/SDL-1.2.14/src/video/gapi/SDL_gapivideo.c	2009-10-13 00:07:14.000000000 +0100
+++ SDL-1.2.14/src/video/gapi/SDL_gapivideo.c	2010-02-13 19:58:38.000000000 +0000
@@ -59,6 +59,10 @@
 
 #define GAPIVID_DRIVER_NAME "gapi"
 
+#ifdef __GNUC__
+#define _T(x) L ## x
+#endif
+
 #if defined(DEBUG) || defined (_DEBUG) || defined(NDEBUG)
 #define REPORT_VIDEO_INFO 1
 #else
@@ -509,8 +513,6 @@
    pLogical->palNumEntries = ncolors;
 
    hPalette = CreatePalette( pLogical );
-   ASSERT(hPalette);
-	
 
    // Realize the palette
    hdc = GetDC(0);
diff -ur orig/SDL-1.2.14/src/video/wincommon/SDL_sysevents.c SDL-1.2.14/src/video/wincommon/SDL_sysevents.c
--- orig/SDL-1.2.14/src/video/wincommon/SDL_sysevents.c	2009-10-13 00:07:14.000000000 +0100
+++ SDL-1.2.14/src/video/wincommon/SDL_sysevents.c	2010-02-13 20:02:10.000000000 +0000
@@ -54,6 +54,7 @@
 
 #ifdef SDL_VIDEO_DRIVER_GAPI
 #include "../gapi/SDL_gapivideo.h"
+#undef WM_MOUSELEAVE
 #endif
 
 #ifdef _WIN32_WCE
@@ -532,6 +533,7 @@
 			int style;
 			int width;
 			int height;
+                        int have_menu = 0;
 
 			/* We don't want to clobber an internal resize */
 			if ( SDL_resizing )
@@ -564,12 +566,17 @@
 			   Aparently it's too difficult for MS to check
 			   inside their function, so I have to do it here.
           		 */
+
+                        have_menu = 0;
+#ifndef _WIN32_WCE
+                        if ((style & WS_CHILDWINDOW) == 0)
+                        {
+                            have_menu = GetMenu(hwnd) != NULL;
+                        }
+#endif
+
          		style = GetWindowLong(hwnd, GWL_STYLE);
-         		AdjustWindowRect(
-				&size,
-				style,
-            			style & WS_CHILDWINDOW ? FALSE
-						       : GetMenu(hwnd) != NULL);
+         		AdjustWindowRectEx(&size, style, have_menu, 0);
 
 			width = size.right - size.left;
 			height = size.bottom - size.top;
diff -ur orig/SDL-1.2.14/src/video/windib/SDL_dibvideo.c SDL-1.2.14/src/video/windib/SDL_dibvideo.c
--- orig/SDL-1.2.14/src/video/windib/SDL_dibvideo.c	2009-10-17 08:45:42.000000000 +0100
+++ SDL-1.2.14/src/video/windib/SDL_dibvideo.c	2010-02-13 19:58:38.000000000 +0000
@@ -1032,9 +1032,7 @@
 		   in the desired palette, set those entries (10-245) and
 		   then map everything into the new system palette.
 		 */
-#endif
 
-#ifndef _WIN32_WCE
 		/* Copy the entries into the system palette */
 		UnrealizeObject(screen_pal);
 #endif
