From 49dc768d4c579298d56777348422ebdca565a3ef Mon Sep 17 00:00:00 2001 From: aliguori Date: Sun, 8 Mar 2009 16:26:59 +0000 Subject: [PATCH] Fix windows build and clean up use of We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values so let's do it in OS_CFLAGS. Then, we can pepper in windows.h includes where using #includes that require it. Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6783 c046a42c-6fe2-441c-8c8c-71466251a162 --- block-raw-win32.c | 1 + block.c | 4 ++++ configure | 1 + kqemu.c | 1 - net.c | 1 + osdep.c | 1 - qemu-common.h | 6 ------ qemu-img.c | 1 - qemu_socket.h | 2 -- savevm.c | 1 + slirp/slirp.h | 1 - sysemu.h | 4 ++++ tap-win32.c | 1 - vl.c | 1 + 14 files changed, 13 insertions(+), 13 deletions(-) diff --git a/block-raw-win32.c b/block-raw-win32.c index 19fa80dd76..6387b09593 100644 --- a/block-raw-win32.c +++ b/block-raw-win32.c @@ -25,6 +25,7 @@ #include "qemu-timer.h" #include "block_int.h" #include +#include #include //#define WIN32_AIO diff --git a/block.c b/block.c index 36de3b6183..bd65ed3611 100644 --- a/block.c +++ b/block.c @@ -40,6 +40,10 @@ #endif #endif +#ifdef _WIN32 +#include +#endif + #define SECTOR_BITS 9 #define SECTOR_SIZE (1 << SECTOR_BITS) diff --git a/configure b/configure index 22795e85a1..819817a37a 100755 --- a/configure +++ b/configure @@ -590,6 +590,7 @@ if test "$mingw32" = "yes" ; then oss="no" linux_user="no" bsd_user="no" + OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501" fi if test ! -x "$(which cgcc 2>/dev/null)"; then diff --git a/kqemu.c b/kqemu.c index 25f4ea784a..96660b0132 100644 --- a/kqemu.c +++ b/kqemu.c @@ -19,7 +19,6 @@ */ #include "config.h" #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN #include #include #else diff --git a/net.c b/net.c index 90c4b5b3c6..c853dafb86 100644 --- a/net.c +++ b/net.c @@ -102,6 +102,7 @@ #endif #ifdef _WIN32 +#include #include #include #include diff --git a/osdep.c b/osdep.c index a583d77a0a..91fb39efaa 100644 --- a/osdep.c +++ b/osdep.c @@ -37,7 +37,6 @@ #include "config-host.h" #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN #include #elif defined(HOST_BSD) #include diff --git a/qemu-common.h b/qemu-common.h index f8ac7e6fd6..6848b337fa 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -2,12 +2,6 @@ #ifndef QEMU_COMMON_H #define QEMU_COMMON_H -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#define WINVER 0x0501 /* needed for ipv6 bits */ -#include -#endif - #define QEMU_NORETURN __attribute__ ((__noreturn__)) /* Hack around the mess dyngen-exec.h causes: We need QEMU_NORETURN in files that diff --git a/qemu-img.c b/qemu-img.c index d83ffe3ee9..2af695fbe6 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -27,7 +27,6 @@ #include #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN #include #endif diff --git a/qemu_socket.h b/qemu_socket.h index c8ca07ea7d..fc5b5889b7 100644 --- a/qemu_socket.h +++ b/qemu_socket.h @@ -3,8 +3,6 @@ #define QEMU_SOCKET_H #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#define WINVER 0x0501 /* needed for ipv6 bits */ #include #include #include diff --git a/savevm.c b/savevm.c index 837a9f01c6..6104f629ab 100644 --- a/savevm.c +++ b/savevm.c @@ -71,6 +71,7 @@ #endif #ifdef _WIN32 +#include #include #include #include diff --git a/slirp/slirp.h b/slirp/slirp.h index 6f8a7f6022..8309fe051c 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -29,7 +29,6 @@ typedef uint32_t u_int32_t; typedef uint64_t u_int64_t; typedef char *caddr_t; -#define WIN32_LEAN_AND_MEAN # include # include # include diff --git a/sysemu.h b/sysemu.h index 8775412b7c..3eab34b399 100644 --- a/sysemu.h +++ b/sysemu.h @@ -4,6 +4,10 @@ #include "qemu-common.h" +#ifdef _WIN32 +#include +#endif + /* vl.c */ extern const char *bios_name; extern const char *bios_dir; diff --git a/tap-win32.c b/tap-win32.c index 3279644236..df31fda497 100644 --- a/tap-win32.c +++ b/tap-win32.c @@ -30,7 +30,6 @@ #include "net.h" #include "sysemu.h" #include -#define WIN32_LEAN_AND_MEAN #include /* NOTE: PCIBus is redefined in winddk.h */ diff --git a/vl.c b/vl.c index 06e9f73352..b7417008ad 100644 --- a/vl.c +++ b/vl.c @@ -103,6 +103,7 @@ #endif #ifdef _WIN32 +#include #include #include #include