first define Windows symbols if they're not defined on the command line: we
    can autodetect everything we need if _WIN32 is defined
  */
+#if defined(__CYGWIN32__) && !defined(__WXMOTIF__) && !defined(__WXGTK__) \
+    && !defined(__WXX11__)
+    /* for Cygwin, default to wxMSW unless otherwise specified */
+    #ifndef __WXMSW__
+        #define __WXMSW__
+    #endif
+
+    #ifndef _WIN32
+        #define _WIN32
+    #endif
+
+    #ifndef WIN32
+        #define WIN32
+    #endif
+#endif
+
 #if defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)
     #ifndef __WXMSW__
         #define __WXMSW__
 
 
 # Add "-mthreads" if you want to have threads under mingw32
 # Add "-mno-cygwin" if you want to link with msvcrt.dll in Cywin and Wine
-#                  Otherwise, you link against the native runtime (cygwin.dll or libc)
-#                  Having the flag in mingw32 does not hurt as you always link against msvcrt.dll
-#                  By default it should be on, to minimize dependencies on Cygwin, and
-#                  have more correct filename behaviour in Wine.
+#                   Otherwise, you link against the native runtime (cygwin.dll
+#                   or libc). Having the flag in mingw32 does not hurt as you
+#                   always link against msvcrt.dll By default it should be on,
+#                   to minimize dependencies on Cygwin, and have more correct
+#                   filename behaviour in Wine.
 COMMON_FLAGS = -mno-cygwin  # -mthreads
 
 # Debugging information
 else
 APPVER=4.0 # 3.50
 # This means 'enable Windows 95 features' (in wxWindows and in the compiler).
-WINVERSION=-DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__
+WINVERSION=-DWINVER=0x0400 -D__GNUWIN32__
 endif
 
 # This is never used and should be expunged.
 # build wxbase/wxMSW
 ifeq ($(wxUSE_GUI),1)
     TOOLKIT=msw
-    GUI = -D__WXMSW__ -D__WINDOWS__
+    GUI =
 else
     TOOLKIT=base
-    GUI = -D__WXMSW__ -D__WINDOWS__ -DwxUSE_GUI=0
+    GUI = -DwxUSE_GUI=0
 endif
 
 ifeq ($(FINAL),1)
 BASELIBS=-lstdc++ -lgcc -lodbc32 -lwsock32
 ifeq ($(wxUSE_GUI),1)
   WINLIBS= $(BASELIBS) \
-         -lwinspool -lwinmm -lshell32 \
-         -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
-         -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) #  -loldnames
+          -lwinspool -lwinmm -lshell32 \
+          -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
+          -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) #  -loldnames
 else
   WINLIBS=$(BASELIBS)
 endif
 
 #WINLIBS=-lstdc++ -lgcc \
-#      -lwinspool -lwinmm -lshell32 \
+#    -lwinspool -lwinmm -lshell32 \
 #    -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 # -loldnames
 
 # Shouldn't need to change these...