[1/2] tools: Detect windows platform with _WIN32 instead of _WINDOWS.

Dylan Smith dylan.ah.smith at gmail.com
Sat Aug 22 00:57:54 CDT 2009

This problem is relevant for building Wine on Windows.

The _WINDOWS macro is supposed to be set only for GUI applications, but
since winegcc is a console application it will never have this set.
Instead _WIN32 is better to use to detect a Windows platform.

I am not sure if _WIN32 is defined for 64-bit platforms, so I used _WIN64
just in case, although it may be redundant.
 tools/winebuild/main.c  |    2 +-
 tools/winegcc/winegcc.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index bebb37b..f97221e 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -66,7 +66,7 @@ enum target_cpu target_cpu = CPU_POWERPC;
 enum target_platform target_platform = PLATFORM_APPLE;
 #elif defined(__sun)
 enum target_platform target_platform = PLATFORM_SOLARIS;
-#elif defined(_WINDOWS)
+#elif defined(_WIN32) || defined(_WIN64)
 enum target_platform target_platform = PLATFORM_WINDOWS;
 enum target_platform target_platform = PLATFORM_UNSPECIFIED;
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 56d9c5f..64b1f9a 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -224,7 +224,7 @@ static const enum target_cpu build_cpu = CPU_POWERPC;
 static enum target_platform build_platform = PLATFORM_APPLE;
 #elif defined(__sun)
 static enum target_platform build_platform = PLATFORM_SOLARIS;
-#elif defined(_WINDOWS)
+#elif defined(_WIN32) || defined(_WIN64)
 static enum target_platform build_platform = PLATFORM_WINDOWS;
 static enum target_platform build_platform = PLATFORM_UNSPECIFIED;

More information about the wine-patches mailing list