From 58c64190f46cd897597c48c9e2c742a887b27124 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 10 Jul 2006 13:05:20 +0200 Subject: [PATCH] configure: Define _WIN64 when building on a 64-bit platform. --- configure | 31 +++++++++++++++++++++++++++++++ configure.ac | 3 ++- include/basetsd.h | 2 +- include/windef.h | 2 +- tools/winegcc/winegcc.c | 7 +++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/configure b/configure index ece71b4d60b..6c25767051a 100755 --- a/configure +++ b/configure @@ -24167,6 +24167,37 @@ 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 3c55d8ce33d..85e3c205786 100644 --- a/configure.ac +++ b/configure.ac @@ -1502,7 +1502,8 @@ 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__]) ;; + *x86_64*) WINE_CHECK_DEFINE([__x86_64__]) + WINE_CHECK_DEFINE([_WIN64]) ;; *alpha*) WINE_CHECK_DEFINE([__ALPHA__]) ;; *sparc*) WINE_CHECK_DEFINE([__sparc__]) ;; *powerpc*) WINE_CHECK_DEFINE([__powerpc__]) ;; diff --git a/include/basetsd.h b/include/basetsd.h index 292483a3841..444e8765bb5 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -38,7 +38,7 @@ extern "C" { * type model where int and long are 32 bit and pointer is 64-bit. */ -#ifdef __x86_64__ +#if defined(__x86_64__) && !defined(_WIN64) #define _WIN64 #endif diff --git a/include/windef.h b/include/windef.h index 2908cfc9c94..d9c03312569 100644 --- a/include/windef.h +++ b/include/windef.h @@ -45,7 +45,7 @@ extern "C" { # define __i386__ #endif -#ifdef __x86_64__ +#if defined(__x86_64__) && !defined(_WIN64) #define _WIN64 #endif diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 2cc73caca88..07d0ac1cec6 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -269,10 +269,17 @@ static void compile(struct options* opts, const char* lang) strarray_addall(comp_args, strarray_fromstring(DLLFLAGS, " ")); } +#ifdef _WIN64 + strarray_add(comp_args, "-DWIN64"); + strarray_add(comp_args, "-D_WIN64"); + strarray_add(comp_args, "-D__WIN64"); + strarray_add(comp_args, "-D__WIN64__"); +#else strarray_add(comp_args, "-DWIN32"); strarray_add(comp_args, "-D_WIN32"); strarray_add(comp_args, "-D__WIN32"); strarray_add(comp_args, "-D__WIN32__"); +#endif strarray_add(comp_args, "-D__WINNT"); strarray_add(comp_args, "-D__WINNT__");