From 9abd8852ddb5c4b01174f8c07e3d21b1c99989df Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Mon, 16 Oct 2006 21:29:23 +0200
Subject: [PATCH] configure: Don't define _WIN64 on the command line to avoid
 trouble with system headers.

---
 configure                  | 31 -------------------------------
 configure.ac               |  3 +--
 include/msvcrt/direct.h    |  4 ++++
 include/msvcrt/malloc.h    |  4 ++++
 include/msvcrt/mbstring.h  |  4 ++++
 include/msvcrt/search.h    |  4 ++++
 include/msvcrt/stddef.h    |  4 ++++
 include/msvcrt/stdio.h     |  4 ++++
 include/msvcrt/string.h    | 10 ++++++----
 include/msvcrt/sys/types.h |  4 ++++
 include/msvcrt/time.h      |  4 ++++
 include/msvcrt/wchar.h     |  4 ++++
 12 files changed, 43 insertions(+), 37 deletions(-)

diff --git a/configure b/configure
index 431e36b484b..adf498d4522 100755
--- a/configure
+++ b/configure
@@ -23497,37 +23497,6 @@ if test $ac_cv_cpp_def___x86_64__ = yes; then
   CFLAGS="$CFLAGS -D__x86_64__"
   LINTFLAGS="$LINTFLAGS -D__x86_64__"
 fi
-
-                    { echo "$as_me:$LINENO: checking whether we need to define _WIN64" >&5
-echo $ECHO_N "checking whether we need to define _WIN64... $ECHO_C" >&6; }
-if test "${ac_cv_cpp_def__WIN64+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifndef _WIN64
-yes
-#endif
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "yes" >/dev/null 2>&1; then
-  ac_cv_cpp_def__WIN64=yes
-else
-  ac_cv_cpp_def__WIN64=no
-fi
-rm -f conftest*
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_cpp_def__WIN64" >&5
-echo "${ECHO_T}$ac_cv_cpp_def__WIN64" >&6; }
-if test $ac_cv_cpp_def__WIN64 = yes; then
-  CFLAGS="$CFLAGS -D_WIN64"
-  LINTFLAGS="$LINTFLAGS -D_WIN64"
-fi
  ;;
   *alpha*)          { echo "$as_me:$LINENO: checking whether we need to define __ALPHA__" >&5
 echo $ECHO_N "checking whether we need to define __ALPHA__... $ECHO_C" >&6; }
diff --git a/configure.ac b/configure.ac
index b9a5b241e14..5d43d53c272 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1431,8 +1431,7 @@ dnl *** check for the need to define platform-specific symbols
 
 case $host_cpu in
   *i[[3456789]]86*) WINE_CHECK_DEFINE([__i386__]) ;;
-  *x86_64*)         WINE_CHECK_DEFINE([__x86_64__])
-                    WINE_CHECK_DEFINE([_WIN64]) ;;
+  *x86_64*)         WINE_CHECK_DEFINE([__x86_64__]) ;;
   *alpha*)          WINE_CHECK_DEFINE([__ALPHA__]) ;;
   *sparc*)          WINE_CHECK_DEFINE([__sparc__]) ;;
   *powerpc*)        WINE_CHECK_DEFINE([__powerpc__]) ;;
diff --git a/include/msvcrt/direct.h b/include/msvcrt/direct.h
index bd05db9a1ff..167e7d74227 100644
--- a/include/msvcrt/direct.h
+++ b/include/msvcrt/direct.h
@@ -26,6 +26,10 @@ typedef unsigned short wchar_t;
 #define __int64 long long
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 #ifndef _SIZE_T_DEFINED
 #ifdef _WIN64
 typedef unsigned __int64 size_t;
diff --git a/include/msvcrt/malloc.h b/include/msvcrt/malloc.h
index eff45e8fb28..8f904b35853 100644
--- a/include/msvcrt/malloc.h
+++ b/include/msvcrt/malloc.h
@@ -38,6 +38,10 @@
 #define __int64 long long
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 #ifndef _SIZE_T_DEFINED
 #ifdef _WIN64
 typedef unsigned __int64 size_t;
diff --git a/include/msvcrt/mbstring.h b/include/msvcrt/mbstring.h
index f47a4c035b9..1da3213a110 100644
--- a/include/msvcrt/mbstring.h
+++ b/include/msvcrt/mbstring.h
@@ -27,6 +27,10 @@
 #define __int64 long long
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 #ifndef _SIZE_T_DEFINED
 #ifdef _WIN64
 typedef unsigned __int64 size_t;
diff --git a/include/msvcrt/search.h b/include/msvcrt/search.h
index c3a2e501619..413b697b07a 100644
--- a/include/msvcrt/search.h
+++ b/include/msvcrt/search.h
@@ -27,6 +27,10 @@
 #define __int64 long long
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 #ifndef _SIZE_T_DEFINED
 #ifdef _WIN64
 typedef unsigned __int64 size_t;
diff --git a/include/msvcrt/stddef.h b/include/msvcrt/stddef.h
index d67b3042148..62bb850e88f 100644
--- a/include/msvcrt/stddef.h
+++ b/include/msvcrt/stddef.h
@@ -23,6 +23,10 @@
 #define __WINE_USE_MSVCRT
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 #ifndef _WCHAR_T_DEFINED
 #define _WCHAR_T_DEFINED
 #ifndef __cplusplus
diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h
index bc58de382db..dfa983fb9cb 100644
--- a/include/msvcrt/stdio.h
+++ b/include/msvcrt/stdio.h
@@ -19,6 +19,10 @@
 #define __int64 long long
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 /* file._flag flags */
 #define _IOREAD          0x0001
 #define _IOWRT           0x0002
diff --git a/include/msvcrt/string.h b/include/msvcrt/string.h
index cc0b25e2bba..bf3994f0cbd 100644
--- a/include/msvcrt/string.h
+++ b/include/msvcrt/string.h
@@ -18,10 +18,12 @@ typedef unsigned short wchar_t;
 #endif
 #endif
 
-#ifndef _MSC_VER
-# ifndef __int64
-#  define __int64 long long
-# endif
+#if !defined(_MSC_VER) && !defined(__int64)
+#define __int64 long long
+#endif
+
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
 #endif
 
 #ifndef _SIZE_T_DEFINED
diff --git a/include/msvcrt/sys/types.h b/include/msvcrt/sys/types.h
index abb05a31636..53d5c6b76fb 100644
--- a/include/msvcrt/sys/types.h
+++ b/include/msvcrt/sys/types.h
@@ -27,6 +27,10 @@
 #define __int64 long long
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 #ifndef _DEV_T_DEFINED
 typedef unsigned int   _dev_t;
 #define _DEV_T_DEFINED
diff --git a/include/msvcrt/time.h b/include/msvcrt/time.h
index b2caa034cf9..0fbf1df625d 100644
--- a/include/msvcrt/time.h
+++ b/include/msvcrt/time.h
@@ -34,6 +34,10 @@ typedef unsigned short wchar_t;
 #define __int64 long long
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 #ifndef _SIZE_T_DEFINED
 #ifdef _WIN64
 typedef unsigned __int64 size_t;
diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h
index 81982e2aeb5..f07db622363 100644
--- a/include/msvcrt/wchar.h
+++ b/include/msvcrt/wchar.h
@@ -39,6 +39,10 @@ typedef unsigned short wchar_t;
 #define __int64 long long
 #endif
 
+#if defined(__x86_64__) && !defined(_WIN64)
+#define _WIN64
+#endif
+
 typedef int mbstate_t;
 
 #ifndef _SIZE_T_DEFINED
-- 
GitLab