Hi,

> I know nothing wxWidgets, but still let me comment on your patch, as
> it may reveal things needing to be fixed on the mingw32ce side.
> 
> 
>   if test "$USE_WIN32" = 1 ; then
> -    AC_CHECK_HEADERS(w32api.h,,, [ ])
> -    AC_CHECK_HEADER(windows.h,,
> -    [
> -        AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
> -    ],
> -    [ ])
> +    if test "$wxUSE_WINCE" != 1 ; then
> +        AC_CHECK_HEADER(w32api.h,,, [ ])
> +        AC_CHECK_HEADER(windows.h,,
> +        [
> +            AC_MSG_ERROR(please set CFLAGS to contain the location of 
> windows.h)
> +        ],
> +        [ ])
> +    fi
> 
> Why did you need this hunk?  Those headers should be available in mingw32ce.


At my first try the headers couldn't be found. I've just tested it again
and it seems like it was a problem in my environment. This change can go
away.

> +    if test "$wxUSE_WINCE" = 1 ; then
> +        LIBS="$LIBS -lcommctrl -lcommdlg -lws2 -lceshell -laygshell -lstdc++"
> +    else
> +        LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32
> -lctl3d32 -ladvapi32 -lwsock32 -lgdi32"
> +    fi
> 
> -lstdc++ ?  Why did you need to add it manually?  Using g++ to link does that
> for you.

Tested again, lstdc++ can indeed be removed.

> +    if test "$wxUSE_WINCE" = 1 ; then
> +        TOOLKIT=WINCE
> +        GUIDIST=WINCE_DIST
> +        WXCONFIG_CPPFLAGS="${WXCONFIG_CPPFLAGS} -D_WIN32_WCE=0x300
> -D__MSVCRT__" // -D__MSVCRT__ kan mogelijk weg
> +    fi
> +
> 
> 
> -D__MSVCRT__ looks very wrong here.  mingw32ce uses __COREDLL__ (defined
> automatically by the compiler) to signal the native runtime is coming from
> coredll.dll with all its (mis)features.  __MSVCRT__ means that the app is
> linking to msvcrt.dll, which doesn't happen with (any recent) CE.  Defining
> that for CE will may break things subtilly. Take a grep at
> src/mingw/include to see what I mean.

Hmz..my mail client apparently sent a cached version of the patch.
While preparing my original mail I already removed the MSVCRT part
from the patchfile. 

> set var="BASE_WINCE_SRC" hints="files">
>       <if cond="TOOLKIT=='WINCE'">src/msw/wince/time.cpp</if>
>   </set>
> +<set var="BASE_WINCE_SRC" hints="files">
> +    src/msw/wince/filefnwce.cpp
> +    src/msw/wince/crt.cpp
> +</set>
> 
> I know nothing Bakefiles, but that looks suspicious.  You're setting
> BASE_WINCE_SRC twice ?

I don't know anything about Bakefiles either. However, I just merged
both sections and wxWinCE compiles fine with it.

> +++ src/msw/gsocket.cpp       (working copy)
> @@ -45,7 +45,7 @@
> 
>   #endif /* _MSC_VER */
> 
> -#if defined(__CYGWIN__)
> +#if defined(__CYGWIN__) || defined(_WIN32_WCE)
>       //CYGWIN gives annoying warning about runtime stuff if we don't do this
>   #   define USE_SYS_TYPES_FD_SET
>   #   include <sys/types.h>
> 
> Just wondering (without really looking), why you needed this in mingw32ce,
> but it isn't needed in MinGW?

This one can also go away. A few months ago I got compile errors without
this change, but at the current state of CeGCC this change doesn't
appear to be neccessary anymore.

> -    return (unsigned long)::GetCurrentThreadId();
> +    return (unsigned long) GetCurrentThreadId();
> 
> I'd be willing to accept patches to our headers to change these macros to
> inline functions.  Then these changes wouldn't be needed.  I'm sure
> there's more software out there that would need this, so better do it
> one in our headers.

Without this change I get the following compile error:

./src/msw/thread.cpp: In member function 'virtual bool
wxThreadModule::OnInit()':
./src/msw/thread.cpp:1264: error: expected id-expression before '('
token

Line 1264 contains:
   gs_idMainThread = ::GetCurrentThreadId();

I'm not familiar with C++, so I have no idea what needs to be changed
for this to work.

> -        i64 = i64 * 10000000 + 116444736000000000;
> +        i64 = (i64 * 10000000 + (1164447360) * 100000000);
> 
> This doesn't solve the issue.  You'll get an overflow here:
> (1164447360) * 100000000
> 
> You need to either use LL on gcc and i64 on MSVC, or load those constants
> into 64bit variables, step by step, like so:
> 
> -        i64 = i64 * 10000000 + 116444736000000000;
> +        i64_2 = 1164447360;
> +      i64_2 *= 100000000;
> +        i64 = (i64 * 10000000 + i64_2;

Applied your proposed patch (and removed the '(' which doesn't
really belong there).

> -struct servent * WINSOCKAPI getservbyport(int port, const char * proto)
> +struct servent * WINAPI getservbyport(int port, const char * proto)
> 
> How did these build in MinGW/Cygwin?  Where is WINSOCKAPI defined?

WINSOCKAPI isn't defined in one of our headers. However, _WINSOCKAPI_ is
defined in both winsock.h and winsock2.h, but they are bogus #define's.

> +// FIXME: find out the real values these defines:
> http://msdn2.microsoft.com/en-us/library/ms901140.aspx
> +#define ANTIALIASED_QUALITY      0x0
> +#define NONANTIALIASED_QUALITY   0x0
> +#define CLEARTYPE_COMPAT_QUALITY 0x0
> +#define CLEARTYPE_QUALITY        0x0
> +#define DEFAULT_QUALITY          0x0
> +#define DRAFT_QUALITY            0x0
> +
> 
> Please don't.  Better have it failing to compile, than having hard to
> debug unexpected behaviour.  I'd prefer that you'd do it in wx side,
> if you still want to provide the funcionality:
> 
> #ifndef ANTIALIASED_QUALITY
> #define ANTIALIASED_QUALITY      0x0
> #endif
> ...
> 
> You can move up with a test application that brute forces those
> the possible numbers?  Maybe there is a function that fails if you
> pass an invalid _QUALITY?  That would make it much easier.

Okay, I removed this part from the CeGCC patch and added a new patch
to the wxWinCE component which requires this.

About the testapplication, with brute-forcing I might be able to
find out what values are valid, but that still doesn't tell me
which #define belongs to what value. Any ideas how to find that out?

> The rest looks pretty much OK for mingw32ce.  Could you remove the
> java url and resubmit?

New patches attached :)

Regards,

Erik van Pienbroek
Index: src/zlib/zutil.h
===================================================================
--- src/zlib/zutil.h    (revision 49149)
+++ src/zlib/zutil.h    (working copy)
@@ -151,7 +151,7 @@
 #  define fdopen(fd,mode) NULL /* No fdopen() */
 #endif
 
-#if (defined(_MSC_VER) && (_MSC_VER > 600))
+#if (defined(_MSC_VER) && (_MSC_VER > 600)) || defined(_WIN32_WCE)
 #  if defined(_WIN32_WCE)
 #    define fdopen(fd,mode) NULL /* No fdopen() */
 #    ifndef _PTRDIFF_T_DEFINED
Index: src/jpeg/jconfig.vc
===================================================================
--- src/jpeg/jconfig.vc (revision 49149)
+++ src/jpeg/jconfig.vc (working copy)
@@ -43,3 +43,8 @@
 #undef PROGRESS_REPORT         /* optional */
 
 #endif /* JPEG_CJPEG_DJPEG */
+
+#ifdef _WIN32_WCE
+#define NO_GETENV 1
+#endif
+
Index: src/common/appbase.cpp
===================================================================
--- src/common/appbase.cpp      (revision 49149)
+++ src/common/appbase.cpp      (working copy)
@@ -54,7 +54,9 @@
   #include  <signal.h>      // for SIGTRAP used by wxTrap()
 #endif  //Win/Unix
 
-#include <locale.h>
+#ifndef __WXWINCE__
+    #include <locale.h>
+#endif
 
 #if wxUSE_FONTMAP
     #include "wx/fontmap.h"
Index: src/common/filename.cpp
===================================================================
--- src/common/filename.cpp     (revision 49149)
+++ src/common/filename.cpp     (working copy)
@@ -90,6 +90,7 @@
 
 #ifdef __WXWINCE__
 #include "wx/msw/private.h"
+#include <fcntl.h>
 #endif
 
 #if defined(__WXMAC__)
Index: src/common/wxcrt.cpp
===================================================================
--- src/common/wxcrt.cpp	(revision 49149)
+++ src/common/wxcrt.cpp	(working copy)
@@ -1243,7 +1255,7 @@
 // wxScanf() and friends
 // ----------------------------------------------------------------------------
 
-#ifndef __VISUALC__
+#if !defined(__VISUALC__) && !defined(_WIN32_WCE)
 int wxVsscanf(const char *str, const char *format, va_list ap)
     { return wxCRT_VsscanfA(str, format, ap); }
 int wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap)
Index: src/common/filefn.cpp
===================================================================
--- src/common/filefn.cpp       (revision 49149)
+++ src/common/filefn.cpp       (working copy)
@@ -50,7 +50,7 @@
 #include <stdlib.h>
 #include <string.h>
 #if !wxONLY_WATCOM_EARLIER_THAN(1,4)
-    #if !(defined(_MSC_VER) && (_MSC_VER > 800))
+    #if !(defined(_MSC_VER) && (_MSC_VER > 800)) && !defined(__WXWINCE__)
         #include <errno.h>
     #endif
 #endif
Index: src/common/datetime.cpp
===================================================================
--- src/common/datetime.cpp     (revision 49149)
+++ src/common/datetime.cpp     (working copy)
@@ -148,7 +148,7 @@
 #if !defined(WX_TIMEZONE) && !defined(WX_GMTOFF_IN_TM)
     #if defined(__WXPALMOS__)
         #define WX_GMTOFF_IN_TM
-    #elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__)
+    #elif defined(__BORLANDC__) || (defined(__MINGW32__) && !defined(__WXWINCE__)) || defined(__VISAGECPP__)
         #define WX_TIMEZONE _timezone
     #elif defined(__MWERKS__)
         long wxmw_timezone = 28800;
@@ -170,7 +170,7 @@
         #define WX_TIMEZONE wxGetTimeZone()
     #elif defined(__DARWIN__)
         #define WX_GMTOFF_IN_TM
-    #elif defined(__WXWINCE__) && defined(__VISUALC8__)
+    #elif defined(__WXWINCE__)
         // _timezone is not present in dynamic run-time library
         #if 0
         // Solution (1): use the function equivalent of _timezone
Index: src/common/utilscmn.cpp
===================================================================
--- src/common/utilscmn.cpp     (revision 49149)
+++ src/common/utilscmn.cpp     (working copy)
@@ -63,7 +63,7 @@
 #include <string.h>
 
 #if !wxONLY_WATCOM_EARLIER_THAN(1,4)
-    #if !(defined(_MSC_VER) && (_MSC_VER > 800))
+    #if !(defined(_MSC_VER) && (_MSC_VER > 800)) && !defined(__WXWINCE__)
         #include <errno.h>
     #endif
 #endif
Index: src/msw/dcprint.cpp
===================================================================
--- src/msw/dcprint.cpp	(revision 49149)
+++ src/msw/dcprint.cpp	(working copy)
@@ -324,14 +324,14 @@
 
     HGLOBAL hDevMode = (HGLOBAL)(DWORD) data->GetDevMode();
 
-    DEVMODE *lpDevMode = hDevMode ? (DEVMODE *)::GlobalLock(hDevMode) : NULL;
+    DEVMODE *lpDevMode = hDevMode ? (DEVMODE *)GlobalLock(hDevMode) : NULL;
 
     HDC hDC = ::CreateDC(NULL, deviceName.wx_str(), NULL, lpDevMode);
     if ( !hDC )
         wxLogLastError(_T("CreateDC(printer)"));
 
     if ( lpDevMode )
-        ::GlobalUnlock(hDevMode);
+        GlobalUnlock(hDevMode);
 
     return (WXHDC) hDC;
 #endif // PostScript/Windows printing
Index: src/msw/window.cpp
===================================================================
--- src/msw/window.cpp	(revision 49149)
+++ src/msw/window.cpp	(working copy)
@@ -133,7 +133,7 @@
     #define ETS_ASSIST          7
 #endif
 
-#if defined(TME_LEAVE) && defined(WM_MOUSELEAVE) && wxUSE_DYNLIB_CLASS
+#if defined(TME_LEAVE) && defined(WM_MOUSELEAVE) && wxUSE_DYNLIB_CLASS && !defined(__WXWINCE__)
     #define HAVE_TRACKMOUSEEVENT
 #endif // everything needed for TrackMouseEvent()
 
@@ -2105,7 +2105,7 @@
     }
 #endif // __WXWINCE__/!__WXWINCE__
 
-    ::TrackPopupMenu(hMenu, flags, point.x, point.y, 0, hWnd, NULL);
+    TrackPopupMenu(hMenu, flags, point.x, point.y, 0, hWnd, NULL);
 
     // we need to do it right now as otherwise the events are never going to be
     // sent to wxCurrentPopupMenu from HandleCommand()
Index: src/msw/toplevel.cpp
===================================================================
--- src/msw/toplevel.cpp        (revision 49149)
+++ src/msw/toplevel.cpp        (working copy)
@@ -671,7 +671,7 @@
 
     DoShowWindow(nShowCmd);
 
-#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__) && !defined(__MINGW32__))
     // Addornments have to be added when the frame is the correct size
     wxFrame* frame = wxDynamicCast(this, wxFrame);
     if (frame && frame->GetMenuBar())
--- src/msw/toplevel.cpp	(revision 49149)
+++ src/msw/toplevel.cpp	(working copy)
@@ -726,7 +726,7 @@
 bool wxTopLevelWindowMSW::IsMaximized() const
 {
     return IsAlwaysMaximized() ||
-#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) && !defined(__WINCE_STANDARDSDK__)
+#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) && !defined(__WINCE_STANDARDSDK__) && !defined(_WIN32_WCE)
 
            (::IsZoomed(GetHwnd()) != 0) ||
 #endif
@@ -1119,7 +1119,7 @@
 
 bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
 {
-#if wxUSE_DYNLIB_CLASS
+#if wxUSE_DYNLIB_CLASS && !defined(__WXWINCE__)
     typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD);
     static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL;
 
@@ -1143,7 +1145,7 @@
         return true;
     }
 
-#if wxUSE_DYNLIB_CLASS
+#if wxUSE_DYNLIB_CLASS && !defined(__WXWINCE__)
     // Otherwise, set the layered style if needed and set the alpha value
     if ((exstyle & WS_EX_LAYERED) == 0 )
         SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED);
Index: src/msw/utilsgui.cpp
===================================================================
--- src/msw/utilsgui.cpp	(revision 49149)
+++ src/msw/utilsgui.cpp	(working copy)
@@ -117,7 +117,7 @@
     if ( hData == 0 )
         return NULL;
 
-    wxChar *theText = (wxChar *)::LockResource(hData);
+    wxChar *theText = (wxChar *)LockResource(hData);
     if ( !theText )
         return NULL;
 
Index: src/msw/menu.cpp
===================================================================
--- src/msw/menu.cpp	(revision 49149)
+++ src/msw/menu.cpp	(working copy)
@@ -453,7 +453,7 @@
         {
             // try to use InsertMenuItem() as it's guaranteed to look correct
             // while our owner-drawn code is not
-#ifndef __DMC__
+#if !defined(__DMC__) && !defined(__WXWINCE__)
             // DMC at march 2007 doesn't have HBITMAP hbmpItem tagMENUITEMINFOA /W
             // MIIM_BITMAP only works under WinME/2000+
             WinStruct<MENUITEMINFO> mii;
Index: src/msw/thread.cpp
===================================================================
--- src/msw/thread.cpp	(revision 49149)
+++ src/msw/thread.cpp	(working copy)
@@ -905,7 +905,7 @@
 
 bool wxThread::IsMain()
 {
-    return ::GetCurrentThreadId() == gs_idMainThread || gs_idMainThread == 0;
+    return GetCurrentThreadId() == gs_idMainThread || gs_idMainThread == 0;
 }
 
 void wxThread::Yield()
@@ -930,7 +930,7 @@
 
 unsigned long wxThread::GetCurrentId()
 {
-    return (unsigned long)::GetCurrentThreadId();
+    return (unsigned long) GetCurrentThreadId();
 }
 
 bool wxThread::SetConcurrency(size_t WXUNUSED_IN_WINCE(level))
@@ -1230,7 +1230,7 @@
 bool wxThreadModule::OnInit()
 {
     // allocate TLS index for storing the pointer to the current thread
-    gs_tlsThisThread = ::TlsAlloc();
+    gs_tlsThisThread = TlsAlloc();
     if ( gs_tlsThisThread == 0xFFFFFFFF )
     {
         // in normal circumstances it will only happen if all other
@@ -1245,7 +1245,7 @@
     // TLS instead
     if ( !::TlsSetValue(gs_tlsThisThread, (LPVOID)0) )
     {
-        ::TlsFree(gs_tlsThisThread);
+        TlsFree(gs_tlsThisThread);
         gs_tlsThisThread = 0xFFFFFFFF;
 
         wxLogSysError(_("Thread module initialization failed: can not store value in thread local storage"));
@@ -1261,14 +1261,14 @@
     gs_critsectThreadDelete = new wxCriticalSection;
 
     // no error return for GetCurrentThreadId()
-    gs_idMainThread = ::GetCurrentThreadId();
+    gs_idMainThread = GetCurrentThreadId();
 
     return true;
 }
 
 void wxThreadModule::OnExit()
 {
-    if ( !::TlsFree(gs_tlsThisThread) )
+    if ( !TlsFree(gs_tlsThisThread) )
     {
         wxLogLastError(wxT("TlsFree failed."));
     }
Index: src/msw/ownerdrw.cpp
===================================================================
--- src/msw/ownerdrw.cpp	(revision 49149)
+++ src/msw/ownerdrw.cpp	(working copy)
@@ -357,6 +357,7 @@
 
         SIZE sizeRect;
         ::GetTextExtentPoint32(hdc, strMenuText.c_str(), strMenuText.length(), &sizeRect);
+#ifndef _WIN32_WCE
         ::DrawState(hdc, NULL, NULL,
                     (LPARAM)strMenuText.wx_str(),
                     strMenuText.length(),
@@ -365,6 +366,7 @@
                     DST_PREFIXTEXT |
                     (((st & wxODDisabled) && !(st & wxODSelected)) ? DSS_DISABLED : 0) |
                     (((st & wxODHidePrefix) && !wxMSWSystemMenuFontModule::ms_showCues) ? 512 : 0)); // 512 == DSS_HIDEPREFIX
+#endif
 
         // ::SetTextAlign(hdc, TA_RIGHT) doesn't work with DSS_DISABLED or DSS_MONO
         // as the last parameter in DrawState() (at least with Windows98). So we have
@@ -375,6 +377,7 @@
             dc.GetTextExtent(m_strAccel, &accel_width, &accel_height);
             // right align accel string with right edge of menu ( offset by the
             // margin width )
+#ifndef _WIN32_WCE
             ::DrawState(hdc, NULL, NULL,
                     (LPARAM)m_strAccel.wx_str(),
                     m_strAccel.length(),
@@ -382,6 +385,7 @@
                     0, 0,
                     DST_TEXT |
                     (((st & wxODDisabled) && !(st & wxODSelected)) ? DSS_DISABLED : 0));
+#endif
         }
 
         (void)SetBkMode(hdc, nPrevMode);
Index: src/msw/display.cpp
===================================================================
--- src/msw/display.cpp (revision 49149)
+++ src/msw/display.cpp (working copy)
@@ -509,6 +509,9 @@
 
 wxDisplayFactoryWin32Base::wxDisplayFactoryWin32Base()
 {
+#ifdef __WXWINCE__
+   return;
+#else
     if ( ms_supportsMultimon == -1 )
     {
         ms_supportsMultimon = 0;
@@ -527,6 +530,7 @@
         // we can safely let dllUser32 go out of scope, the DLL itself will
         // still remain loaded as all Win32 programs use it
     }
+#endif
 }
 
 void wxDisplayFactoryWin32Base::Clear()
@@ -581,6 +585,9 @@
 
 wxDisplayFactoryMultimon::wxDisplayFactoryMultimon()
 {
+#ifdef __WXWINCE__
+    return;
+#else
     if ( !ms_supportsMultimon )
         return;
 
@@ -600,6 +607,7 @@
     {
         wxLogLastError(wxT("EnumDisplayMonitors"));
     }
+#endif
 }
 
 /* static */
@@ -735,21 +743,27 @@
     static ChangeDisplaySettingsEx_t pfnChangeDisplaySettingsEx = NULL;
     if ( !pfnChangeDisplaySettingsEx )
     {
+#ifdef __WXWINCE__
         wxDynamicLibrary dllUser32(_T("user32.dll"));
         if ( dllUser32.IsLoaded() )
         {
+            wxDL_INIT_FUNC(pfn, ChangeDisplaySettingsEx, dllUser32);
+        }
+#else
+        wxDynamicLibrary dllUser32(_T("user32.dll"));
+        if ( dllUser32.IsLoaded() )
+        {
             wxDL_INIT_FUNC_AW(pfn, ChangeDisplaySettingsEx, dllUser32);
         }
         //else: huh, no user32.dll??
 
-#ifndef __WXWINCE__
         if ( !pfnChangeDisplaySettingsEx )
         {
             // we must be under Win95 and so there is no multiple monitors
             // support anyhow
             pfnChangeDisplaySettingsEx = ChangeDisplaySettingsExForWin95;
         }
-#endif // !__WXWINCE__
+#endif
     }
 
     // do change the mode
Index: src/msw/utilsexc.cpp
===================================================================
--- src/msw/utilsexc.cpp        (revision 49149)
+++ src/msw/utilsexc.cpp        (working copy)
@@ -70,7 +70,7 @@
 #include <stdlib.h>
 #include <string.h>
 #ifndef __WATCOMC__
-    #if !(defined(_MSC_VER) && (_MSC_VER > 800))
+    #if !(defined(_MSC_VER) && (_MSC_VER > 800)) && !defined(__WXWINCE__)
         #include <errno.h>
     #endif
 #endif
Index: src/msw/wince/time.cpp
===================================================================
--- src/msw/wince/time.cpp      (revision 49149)
+++ src/msw/wince/time.cpp      (working copy)
@@ -88,6 +88,7 @@
        wildabbr
 };
 
+long timezone ; // global variable
 
 #define Locale (&C_time_locale)
 
@@ -553,16 +554,13 @@
 #define DO_LOCALTIME                1
 
 
-long timezone ; // global variable
-
-
 ////////////////////////////////////////////////////////////////////////
 // Common code for localtime and gmtime (static)
 ////////////////////////////////////////////////////////////////////////
 
 static struct tm * __cdecl common_localtime(const time_t *t, BOOL bLocal)
 {
-    wxLongLong i64;
+    wxLongLong i64, i64_2;
     FILETIME   ft;
     wxString str ;
     SYSTEMTIME SystemTime;
@@ -583,7 +581,9 @@
     else
     {
         i64 = *t;
-        i64 = i64 * 10000000 + 116444736000000000;
+        i64_2 = 1164447360;
+        i64_2 *= 100000000;
+        i64 = i64 * 10000000 + i64_2;
 
         ft.dwLowDateTime  = i64.GetLo();
         ft.dwHighDateTime = i64.GetHi();
Index: src/msw/font.cpp
===================================================================
--- src/msw/font.cpp    (revision 49149)
+++ src/msw/font.cpp    (working copy)
@@ -90,6 +90,10 @@
     IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
 #endif
 
+// FIXME: The value of this constant isn't known in arm-wince-mingw32ce
+#ifndef CLEARTYPE_QUALITY
+#define CLEARTYPE_QUALITY      0x0
+#endif
 
 // ----------------------------------------------------------------------------
 // constants
Index: src/msw/wince/net.cpp
===================================================================
--- src/msw/wince/net.cpp	(revision 49149)
+++ src/msw/wince/net.cpp	(working copy)
@@ -42,11 +42,11 @@
 
 static struct protoent RgProtoEnt[] =
 {
- { "tcp", {NULL}, 6 },
- { "udp", {NULL}, 17 },
- { "icmp", {NULL}, 1 },
- { "ip", {NULL}, 0 },
- { NULL, {NULL}, 0 }
+ { "tcp", NULL, 6 },
+ { "udp", NULL, 17 },
+ { "icmp", NULL, 1 },
+ { "ip", NULL, 0 },
+ { NULL, NULL, 0 }
 };
 
 
@@ -62,32 +62,32 @@
 
 static struct servent RgServEnt[] =
 {
- { "ftp", {NULL}, 21, "tcp" },
- { "ftp-data", {NULL}, 20, "tcp" },
- { "telnet", {NULL}, 23, "tcp" },
- { "smtp", {NULL}, 25, "tcp" },
- { "http", {NULL}, 80, "tcp" },
- { "http", {NULL}, 80, "udp" },
- { "pop", {NULL}, 109, "tcp" },
- { "pop2", {NULL}, 109, "tcp" },
- { "pop3", {NULL}, 110, "tcp" },
- { "nntp", {NULL}, 119, "tcp" },
- { "finger", {NULL}, 79, "tcp" },
+ { "ftp", NULL, 21, "tcp" },
+ { "ftp-data", NULL, 20, "tcp" },
+ { "telnet", NULL, 23, "tcp" },
+ { "smtp", NULL, 25, "tcp" },
+ { "http", NULL, 80, "tcp" },
+ { "http", NULL, 80, "udp" },
+ { "pop", NULL, 109, "tcp" },
+ { "pop2", NULL, 109, "tcp" },
+ { "pop3", NULL, 110, "tcp" },
+ { "nntp", NULL, 119, "tcp" },
+ { "finger", NULL, 79, "tcp" },
  /* include most of the simple TCP services for testing */
- { "echo", {NULL}, 7, "tcp" },
- { "echo", {NULL}, 7, "udp" },
- { "discard", {NULL}, 9, "tcp" },
- { "discard", {NULL}, 9, "udp" },
- { "chargen", {NULL}, 19, "tcp" },
- { "chargen", {NULL}, 19, "udp" },
- { "systat", {NULL}, 11, "tcp" },
- { "systat", {NULL}, 11, "udp" },
- { "daytime", {NULL}, 13, "tcp" },
- { "daytime", {NULL}, 13, "udp" },
- { "netstat", {NULL}, 15, "tcp" },
- { "qotd", {NULL}, 17, "tcp" },
- { "qotd", {NULL}, 17, "udp" },
- { NULL, {NULL}, 0, NULL }
+ { "echo", NULL, 7, "tcp" },
+ { "echo", NULL, 7, "udp" },
+ { "discard", NULL, 9, "tcp" },
+ { "discard", NULL, 9, "udp" },
+ { "chargen", NULL, 19, "tcp" },
+ { "chargen", NULL, 19, "udp" },
+ { "systat", NULL, 11, "tcp" },
+ { "systat", NULL, 11, "udp" },
+ { "daytime", NULL, 13, "tcp" },
+ { "daytime", NULL, 13, "udp" },
+ { "netstat", NULL, 15, "tcp" },
+ { "qotd", NULL, 17, "tcp" },
+ { "qotd", NULL, 17, "udp" },
+ { NULL, NULL, 0, NULL }
 };
 
 // Since table kept in host byte order,
@@ -108,7 +108,7 @@
 }
 
 
-struct servent * WINSOCKAPI getservbyport(int port, const char * proto)
+struct servent * WINAPI getservbyport(int port, const char * proto)
 {
 
  port = ntohs((unsigned short)port); // arrives in network byte order
@@ -140,7 +140,7 @@
 }
 
 
-struct servent * WINSOCKAPI getservbyname(const char * name,
+struct servent * WINAPI getservbyname(const char * name,
                                           const char * proto)
 {
  struct servent *ps = &RgServEnt[0];
@@ -173,7 +173,7 @@
 }
 
 
-struct protoent * WINSOCKAPI getprotobynumber(int proto)
+struct protoent * WINAPI getprotobynumber(int proto)
 {
  struct protoent *pr = &RgProtoEnt[0];
  while (NULL != pr->p_name)
Index: src/msw/wince/filefnwce.cpp
===================================================================
--- src/msw/wince/filefnwce.cpp (revision 49149)
+++ src/msw/wince/filefnwce.cpp (working copy)
@@ -163,7 +163,7 @@
     int method;
     switch ( origin ) {
         default:
-            wxFAIL_MSG(_("unknown seek origin"));
+            wxFAIL_MSG(wxT("unknown seek origin"));
 
         case SEEK_SET:
             method = FILE_BEGIN;
@@ -182,7 +182,7 @@
     DWORD res = SetFilePointer((HANDLE) fd, offset, &high, method) ;
     if (res == 0xFFFFFFFF && GetLastError() != NO_ERROR)
     {
-        wxLogSysError(_("can't seek on file descriptor %d"), fd);
+        wxLogSysError(wxT("can't seek on file descriptor %d"), fd);
         return wxInvalidOffset;
     }
     else
@@ -195,7 +195,7 @@
     DWORD res = SetFilePointer((HANDLE) fd, 0, &high, FILE_CURRENT) ;
     if (res == 0xFFFFFFFF && GetLastError() != NO_ERROR)
     {
-        wxLogSysError(_("can't get seek position on file descriptor %d"), fd);
+        wxLogSysError(wxT("can't get seek position on file descriptor %d"), fd);
         return wxInvalidOffset;
     }
     else
Index: src/msw/wince/helpwce.cpp
===================================================================
--- src/msw/wince/helpwce.cpp   (revision 49149)
+++ src/msw/wince/helpwce.cpp   (working copy)
@@ -116,7 +116,7 @@
         url = url + wxT("#") + topic;
 
     return CreateProcess(wxT("peghelp.exe"),
-        url, NULL, NULL, FALSE, 0, NULL,
+        (WCHAR *) (const wchar_t *) url, NULL, NULL, FALSE, 0, NULL,
         NULL, NULL, NULL) != 0 ;
 }
 
Index: src/msw/stdpaths.cpp
===================================================================
--- src/msw/stdpaths.cpp        (revision 49149)
+++ src/msw/stdpaths.cpp        (working copy)
@@ -131,7 +131,7 @@
 
 #if wxUSE_UNICODE
     #ifdef __WXWINCE__
-        static const wchar_t UNICODE_SUFFIX = L''; // WinCE SH functions don't seem to have 'W'
+        static const wchar_t UNICODE_SUFFIX = L'\0'; // WinCE SH functions don't seem to have 'W'
     #else
         static const wchar_t UNICODE_SUFFIX = L'W';
     #endif
Index: src/msw/dib.cpp
===================================================================
--- src/msw/dib.cpp     (revision 49149)
+++ src/msw/dib.cpp     (working copy)
@@ -52,6 +52,7 @@
 #include "wx/msw/dib.h"
 
 #ifdef __WXWINCE__
+    #include <aygshell.h>
     #include <shellapi.h>       // for SHLoadDIBitmap()
 #endif
 
Index: src/msw/gsockmsw.cpp
===================================================================
--- src/msw/gsockmsw.cpp	(revision 49149)
+++ src/msw/gsockmsw.cpp	(working copy)
@@ -121,10 +121,12 @@
 #else
 /* Typedef the needed function prototypes and the WSANETWORKEVENTS structure
 */
+#ifdef __VISUALC__
 typedef struct _WSANETWORKEVENTS {
        long lNetworkEvents;
        int iErrorCode[10];
 } WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS;
+#endif
 typedef HANDLE (PASCAL *WSACreateEventFunc)(void);
 typedef int (PASCAL *WSAEventSelectFunc)(SOCKET,HANDLE,long);
 typedef int (PASCAL *WSAWaitForMultipleEventsFunc)(long,HANDLE,BOOL,long,BOOL);
Index: src/msw/utils.cpp
===================================================================
--- src/msw/utils.cpp   (revision 49149)
+++ src/msw/utils.cpp   (working copy)
@@ -96,7 +96,7 @@
 #endif
 
 #ifndef __WATCOMC__
-    #if !(defined(_MSC_VER) && (_MSC_VER > 800))
+    #if !(defined(_MSC_VER) && (_MSC_VER > 800)) && !defined(__WXWINCE__)
         #include <errno.h>
     #endif
 #endif
@@ -1035,7 +1035,7 @@
 
 unsigned long wxGetProcessId()
 {
-    return ::GetCurrentProcessId();
+    return GetCurrentProcessId();
 }
 
 // Emit a beeeeeep
@@ -1187,7 +1187,7 @@
     BOOL wow64 = FALSE;
     if ( pfnIsWow64Process )
     {
-        pfnIsWow64Process(::GetCurrentProcess(), &wow64);
+        pfnIsWow64Process(GetCurrentProcess(), &wow64);
     }
     //else: running under a system without Win64 support
 
Index: src/generic/fontdlgg.cpp
===================================================================
--- src/generic/fontdlgg.cpp    (revision 49149)
+++ src/generic/fontdlgg.cpp    (working copy)
@@ -34,6 +34,7 @@
     #include "wx/settings.h"
     #include "wx/cmndata.h"
     #include "wx/sizer.h"
+    #include "wx/textctrl.h"
 #endif
 
 #include <string.h>
Index: include/wx/wxcrtvararg.h
===================================================================
--- include/wx/wxcrtvararg.h	(revision 49149)
+++ include/wx/wxcrtvararg.h	(working copy)
@@ -188,7 +188,6 @@
     #define wxNEED_WPRINTF
 #endif
 
-
 #if defined(wxNEED_WPRINTF)
     /*
         we need to implement all wide character printf functions either because
@@ -217,7 +216,9 @@
 #define wxCRT_ScanfA     scanf
 #define wxCRT_SscanfA    sscanf
 #define wxCRT_FscanfA    fscanf
+#if !defined(__WXWINCE__)
 #define wxCRT_VsscanfA   vsscanf
+#endif
 
 #if defined(wxNEED_WPRINTF)
     int wxCRT_ScanfW(const wchar_t *format, ...);
@@ -442,7 +443,7 @@
                    wxCRT_SscanfW, (str.AsWCharBuf(), wxScanfConvertFormatW(format)))
 
 // Visual C++ doesn't provide vsscanf()
-#ifndef __VISUALC___
+#if !defined(__VISUALC___) && !defined(__WXWINCE__)
 int WXDLLIMPEXP_BASE wxVsscanf(const char *str, const char *format, va_list ap);
 int WXDLLIMPEXP_BASE wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap);
 int WXDLLIMPEXP_BASE wxVsscanf(const wxCharBuffer& str, const char *format, va_list ap);
Index: include/wx/msw/wince/net.h
===================================================================
--- include/wx/msw/wince/net.h	(revision 49149)
+++ include/wx/msw/wince/net.h	(working copy)
@@ -12,9 +12,9 @@
 
 */
 
-struct servent * WINSOCKAPI getservbyport(int port, const char * proto) ;
+struct servent * WINAPI getservbyport(int port, const char * proto) ;
 
-struct servent * WINSOCKAPI getservbyname(const char * name,
+struct servent * WINAPI getservbyname(const char * name,
                                           const char * proto) ;
-struct protoent * WINSOCKAPI getprotobynumber(int proto) ;
+struct protoent * WINAPI getprotobynumber(int proto) ;
 
Index: include/wx/wxcrtbase.h
===================================================================
--- include/wx/wxcrtbase.h	(revision 49149)
+++ include/wx/wxcrtbase.h	(working copy)
@@ -504,8 +504,8 @@
 /* there are no env vars at all under CE, so no _tgetenv neither */
 #ifdef __WXWINCE__
     /* can't define as inline function as this is a C file... */
-    #define wxCRT_GetenvA(name)     (name, NULL)
-    #define wxCRT_GetenvW(name)     (name, NULL)
+    #define wxCRT_GetenvA(name)     (char *) (name, NULL)
+    #define wxCRT_GetenvW(name)     (wchar_t *) (name, NULL)
 #else
     #define wxCRT_GetenvA           getenv
     #ifdef _tgetenv
@@ -517,12 +517,18 @@
 WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name);
 #endif
 
-
+/* wince doesn't have system(), but ShellExecuteEx() */
+#ifdef __WXWINCE__
+// FIXME: Implement a macro which translates the system() argument to a argument recognized by ShellExecuteEx()
+#define wxCRT_SystemA(x)              ((int) 0)
+#define wxCRT_SystemW(x)              ((int) 0)
+#else
 #define wxCRT_SystemA               system
 /* mingw32 doesn't provide _tsystem() or _wsystem(): */
 #if defined(_tsystem)
     #define  wxCRT_SystemW          _wsystem
 #endif
+#endif
 
 #define wxCRT_AtofA                 atof
 #define wxCRT_AtoiA                 atoi
@@ -535,7 +541,7 @@
         #define wxCRT_AtolW         watol
     /* else: use ANSI versions */
     #endif
-#elif defined(wxHAVE_TCHAR_SUPPORT)
+#elif defined(wxHAVE_TCHAR_SUPPORT) && !defined(__WXWINCE__)
     #define  wxCRT_AtoiW           _wtoi
     #define  wxCRT_AtolW           _wtol
     /* _wtof doesn't exist */
Index: include/wx/defs.h
===================================================================
--- include/wx/defs.h	(revision 49149)
+++ include/wx/defs.h	(working copy)
@@ -37,6 +37,7 @@
          !defined(__WXMGL__)   && \
          !defined(__WXDFB__)   && \
          !defined(__WXX11__)   && \
+         !defined(__WXWINCE__) && \
           wxUSE_GUI
 #       ifdef __UNIX__
 #           error "No Target! You should use wx-config program for compilation flags!"
Index: mingw/include/sys/time.h
===================================================================
--- mingw/include/sys/time.h	(revision 1062)
+++ mingw/include/sys/time.h	(working copy)
@@ -36,10 +36,8 @@
 
    The timezone pointer arg is ignored.  Errors are ignored.
 */ 
-#ifndef __COREDLL__
 int __cdecl gettimeofday(struct timeval *__restrict__,
 			 void *__restrict__  /*	tzp (unused) */);
-#endif
 
 #ifdef	__cplusplus
 }
Index: w32api/include/commdlg.h
===================================================================
--- w32api/include/commdlg.h	(revision 1062)
+++ w32api/include/commdlg.h	(working copy)
@@ -525,8 +525,12 @@
 } PRINTDLGEXW, *LPPRINTDLGEXW;
 #endif /* WINVER >= 0x0500 */
 
+#ifdef _WIN32_WCE
+BOOL WINAPI ChooseColor(LPCHOOSECOLORW);
+#else
 BOOL WINAPI ChooseColorA(LPCHOOSECOLORA);
 BOOL WINAPI ChooseColorW(LPCHOOSECOLORW);
+#endif
 BOOL WINAPI ChooseFontA(LPCHOOSEFONTA);
 BOOL WINAPI ChooseFontW(LPCHOOSEFONTW);
 DWORD WINAPI CommDlgExtendedError(void);
@@ -568,7 +572,9 @@
 typedef OFNOTIFYW OFNOTIFY,*LPOFNOTIFY;
 typedef PAGESETUPDLGW PAGESETUPDLG,*LPPAGESETUPDLG;
 typedef PRINTDLGW PRINTDLG,*LPPRINTDLG;
+#ifndef _WIN32_WCE
 #define ChooseColor ChooseColorW
+#endif
 #define ChooseFont ChooseFontW
 #define FindText FindTextW
 #define GetFileTitle GetFileTitleW
@@ -598,7 +604,9 @@
 typedef OFNOTIFYA OFNOTIFY,*LPOFNOTIFY;
 typedef PAGESETUPDLGA PAGESETUPDLG,*LPPAGESETUPDLG;
 typedef PRINTDLGA PRINTDLG,*LPPRINTDLG;
+#ifndef _WIN32_WCE
 #define ChooseColor ChooseColorA
+#endif
 #define ChooseFont ChooseFontA
 #define FindText FindTextA
 #define GetFileTitle GetFileTitleA
Index: w32api/include/shellapi.h
===================================================================
--- w32api/include/shellapi.h	(revision 1062)
+++ w32api/include/shellapi.h	(working copy)
@@ -326,6 +326,7 @@
 #ifdef _WIN32_WCE
 BOOL WINAPI SHGetShortcutTarget(LPCTSTR,LPTSTR,int); 
 BOOL WINAPI SHCreateShortcut(LPTSTR,LPTSTR);
+HBITMAP WINAPI SHLoadDIBitmap(LPCTSTR);
 #endif
 
 #ifdef UNICODE
Index: w32api/include/winbase.h
===================================================================
--- w32api/include/winbase.h	(revision 1062)
+++ w32api/include/winbase.h	(working copy)
@@ -900,6 +900,7 @@
 	WORD wProcessorLevel;
 	WORD wProcessorRevision;
 } SYSTEM_INFO,*LPSYSTEM_INFO;
+#ifndef _WIN32_WCE
 typedef struct _SYSTEM_POWER_STATUS {
 	BYTE ACLineStatus;
 	BYTE BatteryFlag;
@@ -908,6 +909,7 @@
 	DWORD BatteryLifeTime;
 	DWORD BatteryFullLifeTime;
 } SYSTEM_POWER_STATUS,*LPSYSTEM_POWER_STATUS;
+#endif
 typedef struct _TIME_ZONE_INFORMATION {
 	LONG Bias;
 	WCHAR StandardName[32];
@@ -1589,8 +1591,9 @@
 WINBASEAPI UINT WINAPI GetSystemDirectoryA(LPSTR,UINT);
 WINBASEAPI UINT WINAPI GetSystemDirectoryW(LPWSTR,UINT);
 WINBASEAPI VOID WINAPI GetSystemInfo(LPSYSTEM_INFO);
+#ifndef _WIN32_WCE
 WINBASEAPI BOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
-#ifdef _WIN32_WCE
+#else
 WINBASEAPI DWORD GetSystemPowerStatusEx2(PSYSTEM_POWER_STATUS_EX2,DWORD,BOOL);
 WINBASEAPI BOOL GetSystemPowerStatusEx(PSYSTEM_POWER_STATUS_EX,BOOL);
 #endif
Index: w32api/include/winuser.h
===================================================================
--- w32api/include/winuser.h	(revision 1062)
+++ w32api/include/winuser.h	(working copy)
@@ -2452,6 +2452,11 @@
 #define RIDEV_APPKEYS      0x00000400
 #endif
 
+#ifdef __COREDLL__
+#define SYS_COLOR_INDEX_FLAG 0x40000000
+#endif
+
 #ifndef RC_INVOKED
 typedef BOOL(CALLBACK *DLGPROC)(HWND,UINT,WPARAM,LPARAM);
 typedef VOID(CALLBACK *TIMERPROC)(HWND,UINT,UINT,DWORD);
@@ -3554,6 +3559,10 @@
 WINUSERAPI BOOL WINAPI EnumDesktopWindows(HDESK,ENUMWINDOWSPROC,LPARAM);
 WINUSERAPI BOOL WINAPI EnumDisplayMonitors(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
 #ifndef NOGDI
+#ifdef _WIN32_WCE
+WINUSERAPI BOOL WINAPI EnumDisplaySettings(LPCWSTR,DWORD,PDEVMODEW);
+WINUSERAPI BOOL WINAPI EnumDisplayDevices(LPCWSTR,DWORD,PDISPLAY_DEVICEW,DWORD);
+#else
 WINUSERAPI BOOL WINAPI EnumDisplaySettingsA(LPCSTR,DWORD,PDEVMODEA);
 WINUSERAPI BOOL WINAPI EnumDisplaySettingsW(LPCWSTR,DWORD,PDEVMODEW);
 #if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410)
@@ -3563,6 +3572,7 @@
 WINUSERAPI BOOL WINAPI EnumDisplayDevicesA(LPCSTR,DWORD,PDISPLAY_DEVICEA,DWORD);
 WINUSERAPI BOOL WINAPI EnumDisplayDevicesW(LPCWSTR,DWORD,PDISPLAY_DEVICEW,DWORD);
 #endif
+#endif
 WINUSERAPI int WINAPI EnumPropsA(HWND,PROPENUMPROCA);
 WINUSERAPI int WINAPI EnumPropsW(HWND,PROPENUMPROCW);
 WINUSERAPI int WINAPI EnumPropsExA(HWND,PROPENUMPROCEXA,LPARAM);
@@ -4029,7 +4039,12 @@
 WINUSERAPI int WINAPI ToUnicode(UINT,UINT,PBYTE,LPWSTR,int,UINT);
 WINUSERAPI int WINAPI ToUnicodeEx(UINT,UINT,PBYTE,LPWSTR,int,UINT,HKL);
 WINUSERAPI BOOL WINAPI TrackMouseEvent(LPTRACKMOUSEEVENT);
+#ifdef _WIN32_WCE
+#define TrackPopupMenu(hmenu, uFlags, x, y, nReserved, hWnd, rect) \
+    TrackPopupMenuEx(hmenu, uFlags, x, y, hWnd, NULL)
+#else
 WINUSERAPI BOOL WINAPI TrackPopupMenu(HMENU,UINT,int,int,int,HWND,LPCRECT);
+#endif
 WINUSERAPI BOOL WINAPI TrackPopupMenuEx(HMENU,UINT,int,int,HWND,LPTPMPARAMS);
 WINUSERAPI int WINAPI TranslateAcceleratorA(HWND,HACCEL,LPMSG);
 WINUSERAPI int WINAPI TranslateAcceleratorW(HWND,HACCEL,LPMSG);
@@ -4243,9 +4258,11 @@
 #define ChangeDisplaySettings ChangeDisplaySettingsW
 #define ChangeDisplaySettingsEx ChangeDisplaySettingsExW
 #define CreateDesktop CreateDesktopW
+#ifndef _WIN32_WCE
 #define EnumDisplaySettings EnumDisplaySettingsW
 #define EnumDisplaySettingsEx EnumDisplaySettingsExW
 #define EnumDisplayDevices EnumDisplayDevicesW
+#endif
 #endif /* NOGDI */
 #else /* UNICODE */
 #define EDITWORDBREAKPROC EDITWORDBREAKPROCA
@@ -4408,9 +4425,11 @@
 #define ChangeDisplaySettings ChangeDisplaySettingsA
 #define ChangeDisplaySettingsEx ChangeDisplaySettingsExA
 #define CreateDesktop CreateDesktopA
+#ifndef _WIN32_WCE_
 #define EnumDisplaySettings EnumDisplaySettingsA
 #define EnumDisplaySettingsEx EnumDisplaySettingsExA
 #define EnumDisplayDevices EnumDisplayDevicesA
+#endif
 #endif /* NOGDI */
 #endif /* UNICODE */
 #endif /* RC_INVOKED */
Index: configure.in
===================================================================
--- configure.in	(revision 49149)
+++ configure.in	(working copy)
@@ -94,7 +94,7 @@
 dnl the list of all available toolkits
 dnl
 dnl update NUM_TOOLKITS calculation below when adding a new toolkit here!
-ALL_TOOLKITS="COCOA GTK MAC MGL MICROWIN MOTIF MSW PM X11 DFB"
+ALL_TOOLKITS="COCOA GTK MAC MGL MICROWIN MOTIF MSW PM X11 DFB WINCE"
 
 dnl NB: these wxUSE_XXX constants have value of 0 or 1 unlike all the other ones
 dnl     which are either yes or no
@@ -108,6 +108,7 @@
 DEFAULT_wxUSE_PM=0
 DEFAULT_wxUSE_X11=0
 DEFAULT_wxUSE_DFB=0
+DEFAULT_wxUSE_WINCE=0
 
 dnl these are the values which are really default for the given platform -
 dnl they're not cached and are only used if no --with-toolkit was given *and*
@@ -122,6 +123,7 @@
 DEFAULT_DEFAULT_wxUSE_PM=0
 DEFAULT_DEFAULT_wxUSE_X11=0
 DEFAULT_DEFAULT_wxUSE_DFB=0
+DEFAULT_DEFAULT_wxUSE_WINCE=0
 
 PROGRAM_EXT=
 SO_SUFFIX=so
@@ -262,6 +264,12 @@
     AC_DEFINE(__UNIXWARE__)
   ;;
 
+  *-*-mingw32ce*)
+    SO_SUFFIX=dll
+    PROGRAM_EXT=".exe"
+    DEFAULT_DEFAULT_wxUSE_WINCE=1
+  ;;
+
   *-*-cygwin* | *-*-mingw32* )
     dnl MBN: some of the defines have been moved after toolkit detection
     dnl      because for wxMotif/wxGTK/wxX11 to build on Cygwin
@@ -481,6 +489,7 @@
 AC_ARG_WITH(directfb,      [  --with-directfb         use DirectFB], [wxUSE_DFB="$withval" wxUSE_UNIVERSAL="yes" CACHE_DFB=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(microwin,      [  --with-microwin         use MicroWindows], [wxUSE_MICROWIN="$withval" CACHE_MICROWIN=1 TOOLKIT_GIVEN=1])
 AC_ARG_WITH(x11,           [  --with-x11              use X11], [wxUSE_X11="$withval" wxUSE_UNIVERSAL="yes" CACHE_X11=1 TOOLKIT_GIVEN=1])
+AC_ARG_WITH(wince,         [  --with-wince            use WinCE], [wxUSE_WINCE="$withval" CACHE_WINCE=1 TOOLKIT_GIVEN=1])
 WX_ARG_ENABLE(nanox,       [  --enable-nanox          use NanoX], wxUSE_NANOX)
 
 AC_ARG_ENABLE(gtk2,        [  --disable-gtk2          use GTK+ 1.2 instead of 2.0], [wxUSE_GTK2="$enableval"])
@@ -1010,7 +1019,8 @@
     dnl this? what about using ALL_TOOLKITS? TODO)
     NUM_TOOLKITS=`expr ${wxUSE_COCOA:-0} + ${wxUSE_GTK:-0} + ${wxUSE_MAC:-0} \
                   + ${wxUSE_MGL:-0} + ${wxUSE_DFB:-0} + ${wxUSE_MICROWIN:-0} \
-                  + ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} + ${wxUSE_X11:-0}`
+                  + ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} + ${wxUSE_X11:-0} \
+                  + ${wxUSE_WINCE:-0}` 
 
     dnl Allow wxUSE_PM only for OS/2 with EMX.
     case "${host}" in
@@ -2664,7 +2674,11 @@
 
     dnl --- FIXME: This is still a somewhat random list of libs,
     dnl ---        some of them should probably be included conditionally.
-    LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32"
+    if test "$wxUSE_WINCE" = 1 ; then
+        LIBS="$LIBS -lcommctrl -lcommdlg -lws2 -lceshell -laygshell"
+    else
+        LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32"
+    fi
 
     if test "$wxUSE_ACCESSIBILITY" = "yes" ; then
         LIBS="$LIBS -loleacc"
@@ -2738,6 +2754,12 @@
         esac
     fi
 
+    if test "$wxUSE_WINCE" = 1 ; then
+        TOOLKIT=WINCE
+        GUIDIST=WINCE_DIST
+        WXCONFIG_CPPFLAGS="${WXCONFIG_CPPFLAGS} -D_WIN32_WCE=0x300"
+    fi
+
     if test "$wxUSE_GTK" = 1; then
         dnl GTK+ test program must be compiled with C compiler
         AC_MSG_CHECKING([for GTK+ version])
@@ -3785,6 +3807,10 @@
 
     dnl test for GCC's visibility support (sets CFLAGS_VISIBILITY, which is
     dnl assigned to CFLAGS and CXXFLAGS below)
+    if test "$wxUSE_WINCE" = 1 ; then
+        wxUSE_VISIBILITY="no"
+    fi
+
     if test "$wxUSE_VISIBILITY" != "no"; then
         WX_VISIBILITY
     fi
@@ -4661,7 +4687,7 @@
 dnl ---------------------------------------------------------------------------
 
 dnl under MSW (except mingw32) we always have thread support
-if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
+if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1 -a "$TOOLKIT" != "WINCE" ; then
 
     dnl the code below:
     dnl
@@ -5243,7 +5269,7 @@
 dnl ------------------------------------------------------------------------
 
 dnl under MSW we always have LoadLibrary/GetProcAddress
-if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1; then
+if test "$TOOLKIT" != "MSW" -a "$USE_OS2" != 1 -a "$TOOLKIT" != "WINCE" ; then
 
     HAVE_DL_FUNCS=0
     HAVE_SHL_FUNCS=0
@@ -5635,6 +5661,10 @@
   fi
 fi
 
+if test "$wxUSE_WINCE" = 1 ; then
+  wxUSE_CONFIG="no"
+fi
+
 if test "$wxUSE_CONFIG" = "yes" ; then
   if test "$wxUSE_TEXTFILE" != "yes"; then
     AC_MSG_WARN(wxConfig requires wxTextFile... disabled)
@@ -5645,6 +5675,10 @@
   fi
 fi
 
+if test "$wxUSE_WINCE" = 1 ; then
+  wxUSE_INTL="no"
+fi
+
 if test "$wxUSE_INTL" = "yes" ; then
   if test "$wxUSE_FILE" != "yes"; then
     AC_MSG_WARN(I18n code requires wxFile... disabled)
@@ -5931,7 +5965,7 @@
 
 if test "$wxUSE_SOCKETS" = "yes"; then
     dnl under MSW we always have sockets
-    if test "$TOOLKIT" != "MSW"; then
+    if test "$TOOLKIT" != "MSW" -a "$TOOLKIT" != "WINCE" ; then
         dnl under Solaris and OS/2, socket functions live in -lsocket
         AC_CHECK_FUNC(socket,,
             [
@@ -5953,7 +5987,7 @@
     dnl this test may be appropriate if building under cygwin
     dnl right now I'm assuming it also uses the winsock stuff
     dnl like mingw does..  -- RL
-    if test "$TOOLKIT" != "MSW"; then
+    if test "$TOOLKIT" != "MSW" -a "$TOOLKIT" != "WINCE" ; then
         dnl determine the type of third argument for getsockname
         dnl This test needs to be done in C++ mode since gsocket.cpp now
         dnl is C++ code and pointer cast that are possible even without
@@ -6226,6 +6260,11 @@
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS layout"
 fi
 
+if test "$wxUSE_WINCE" = 1 ; then
+    wxUSE_MDI="no"
+    wxUSE_MDI_ARCHITECTURE="no"
+fi
+
 if test "$wxUSE_MDI" = "yes"; then
     AC_DEFINE(wxUSE_MDI)
 
@@ -6314,7 +6353,12 @@
                            [AC_MSG_RESULT(no)],
                            [AC_MSG_RESULT(yes)
                             WXCONFIG_CXXFLAGS="$WXCONFIG_CXXFLAGS -fvtable-thunks"])
-            LIBS=" -lrpcrt4 -loleaut32 -lole32 -luuid$LIBS"
+            if test "$wxUSE_WINCE" = 1 ; then
+                LIBS=" -loleaut32 -lole32 -luuid$LIBS"
+            else
+                LIBS=" -lrpcrt4 -loleaut32 -lole32 -luuid$LIBS"
+            fi
+
             if test "$wxUSE_OLE" = "yes" ; then
                 AC_DEFINE(wxUSE_OLE)
                 AC_DEFINE(wxUSE_OLE_AUTOMATION)
@@ -6807,6 +6851,10 @@
 fi
 
 USE_HTML=0
+if test "$wxUSE_WINCE" = 1 ; then
+    wxUSE_HTML="no"
+fi
+
 if test "$wxUSE_HTML" = "yes"; then
     AC_DEFINE(wxUSE_HTML)
     USE_HTML=1
@@ -6841,6 +6889,10 @@
 fi
 
 USE_XRC=0
+if test "$wxUSE_WINCE" = 1 ; then
+    wxUSE_XRC="no"
+fi
+
 if test "$wxUSE_XRC" = "yes"; then
     if test "$wxUSE_XML" != "yes"; then
         AC_MSG_WARN([XML library not built, XRC resources disabled])
@@ -6853,6 +6905,10 @@
 fi
 
 USE_AUI=0
+if test "$wxUSE_WINCE" = 1 ; then
+   wxUSE_AUI="no"
+fi
+
 if test "$wxUSE_AUI" = "yes"; then
    AC_DEFINE(wxUSE_AUI)
    USE_AUI=1
@@ -6875,6 +6931,10 @@
     AC_DEFINE(wxUSE_METAFILE)
 fi
 
+if test "$wxUSE_WINCE" = 1 ; then
+    wxUSE_MIMETYPE="no"
+fi
+
 if test "$wxUSE_MIMETYPE" = "yes"; then
     AC_DEFINE(wxUSE_MIMETYPE)
 fi
@@ -6912,6 +6972,10 @@
   LIBS=" -lunicows $LIBS"
 fi
 
+if test "$wxUSE_WINCE" = 1 ; then
+    wxUSE_RICHTEXT="no"
+fi
+
 USE_RICHTEXT=0
 if test "$wxUSE_RICHTEXT" = "yes"; then
     AC_DEFINE(wxUSE_RICHTEXT)
@@ -7033,6 +7097,18 @@
 dnl wxMSW-only options
 dnl ---------------------------------------------------------------------------
 
+if test "$wxUSE_WINCE" = 1 ; then
+
+if test "$wxUSE_DIB" = "yes"; then
+    AC_DEFINE(wxUSE_WXDIB)
+fi
+
+if test "$wxUSE_REGKEY" = "yes"; then
+    AC_DEFINE(wxUSE_REGKEY)
+fi
+
+fi
+
 if test "$wxUSE_MSW" = 1 ; then
 
     if test "$wxUSE_DC_CACHEING" = "yes"; then
Index: build/bakefiles/build_cfg.bkl
===================================================================
--- build/bakefiles/build_cfg.bkl	(revision 49149)
+++ build/bakefiles/build_cfg.bkl	(working copy)
@@ -9,7 +9,7 @@
     -->
 
     <if cond="FORMAT not in ['autoconf','msvc6prj','msevc4prj','msvs2005prj'] and
-              TOOLKIT in ['PM','MSW','MGL','MOTIF']">
+              TOOLKIT in ['PM','MSW','MGL','MOTIF','WINCE']">
 
         <set var="BUILD_CFG_FILE" make_var="1">
             $(SETUPHDIR)$(DIRSEP)build.cfg
Index: build/bakefiles/files.bkl
===================================================================
--- build/bakefiles/files.bkl   (revision 49149)
+++ build/bakefiles/files.bkl   (working copy)
@@ -117,7 +117,9 @@
     src/msw/volume.cpp
 </set>
 <set var="BASE_WINCE_SRC" hints="files">
-    <if cond="TOOLKIT=='WINCE'">src/msw/wince/time.cpp</if>
+    src/msw/wince/time.cpp
+    src/msw/wince/filefnwce.cpp
+    src/msw/wince/crt.cpp
 </set>
 <set var="BASE_WIN32_HDR" hints="files">
     wx/msw/apptrait.h
@@ -1788,9 +1792,7 @@
     src/generic/fontdlgg.cpp
     src/msw/wince/checklst.cpp
     src/msw/wince/choicece.cpp
-    src/msw/wince/crt.cpp
     src/msw/wince/filedlgwce.cpp
-    src/msw/wince/filefnwce.cpp
     src/msw/wince/helpwce.cpp
     src/msw/wince/menuce.cpp
     src/msw/wince/tbarwce.cpp
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to