diff options
author | Andrew Morrow <acm@10gen.com> | 2013-04-02 17:15:13 -0400 |
---|---|---|
committer | Andrew Morrow <acm@10gen.com> | 2013-04-08 20:58:23 -0400 |
commit | 53d7bcd4ed2996a4115211075643090173e7cf7a (patch) | |
tree | a943169a906e77725e50137c43ca44ec2d1b693c /src/mongo/platform | |
parent | ad60f1bdacbcc1fe212a78f310ea73a2f07ec62a (diff) | |
download | mongo-53d7bcd4ed2996a4115211075643090173e7cf7a.tar.gz |
SERVER-8969 Support specifying minimum windows version to build
Diffstat (limited to 'src/mongo/platform')
-rw-r--r-- | src/mongo/platform/atomic_intrinsics_win32.h | 7 | ||||
-rw-r--r-- | src/mongo/platform/windows_basic.h | 41 |
2 files changed, 45 insertions, 3 deletions
diff --git a/src/mongo/platform/atomic_intrinsics_win32.h b/src/mongo/platform/atomic_intrinsics_win32.h index 91ecc8fce2c..b48805e331a 100644 --- a/src/mongo/platform/atomic_intrinsics_win32.h +++ b/src/mongo/platform/atomic_intrinsics_win32.h @@ -87,7 +87,12 @@ namespace mongo { template <typename T> class AtomicIntrinsics<T, typename boost::enable_if_c<sizeof(T) == sizeof(LONGLONG)>::type> { public: - static const bool kHaveInterlocked64 = (_WIN32_WINNT >= _WIN32_WINNT_VISTA); + +#if defined(NTDDI_VERSION) && defined(NTDDI_VISTA) && (NTDDI_VERSION >= NTDDI_VISTA) + static const bool kHaveInterlocked64 = true; +#else + static const bool kHaveInterlocked64 = false; +#endif static T compareAndSwap(volatile T* dest, T expected, T newValue) { return InterlockedImpl<kHaveInterlocked64>::compareAndSwap(dest, expected, newValue); diff --git a/src/mongo/platform/windows_basic.h b/src/mongo/platform/windows_basic.h index 96789116c18..371e3416da8 100644 --- a/src/mongo/platform/windows_basic.h +++ b/src/mongo/platform/windows_basic.h @@ -18,7 +18,26 @@ #pragma once -#if defined(_WIN32) +#if !defined(_WIN32) +#error "windows_basic included but _WIN32 is not defined" +#endif + +// Ensure that _WIN32_WINNT is set to something before we include windows.h. For server builds +// both _WIN32_WINNT and NTDDI_VERSION are set as defines on the command line, but we need +// these here for things like client driver builds, where they may not already be set. +#if !defined(_WIN32_WINNT) +// Can't use symbolic versions here, since we may not have seen sdkddkver.h yet. +#if defined(_WIN64) +// 64-bit builds default to Windows Vista support. +#define _WIN32_WINNT 0x0600 +#else +// 32-bit builds default to Windows XP support. +#define _WIN32_WINNT 0x0501 +#endif +#endif + +// No need to set WINVER, SdkDdkVer.h does that for us, we double check this below. + // for rand_s() usage: # define _CRT_RAND_S # ifndef NOMINMAX @@ -26,10 +45,28 @@ # endif // tell windows.h not to include a bunch of headers we don't need: # define WIN32_LEAN_AND_MEAN -# include "mongo/targetver.h" # include <winsock2.h> //this must be included before the first windows.h include # include <ws2tcpip.h> # include <wspiapi.h> # include <windows.h> + +// Should come either from the command line, or if not set there, the inclusion of sdkddkver.h +// via windows.h above should set it based in _WIN32_WINNT, which is assuredly set by now. +#if !defined(NTDDI_VERSION) +#error "NTDDI_VERSION is not defined" +#endif + +#if !defined(WINVER) || (WINVER != _WIN32_WINNT) +#error "Expected WINVER to have been defined and to equal _WIN32_WINNT" +#endif + +#if defined(_WIN64) +#if !defined(NTDDI_VISTA) || (NTDDI_VERSION < NTDDI_VISTA) +#error "64 bit mongo does not support Windows versions older than Vista" +#endif +#else +#if !defined(NTDDI_WINXPSP3) || (NTDDI_VERSION < NTDDI_WINXPSP3) +#error "32 bit mongo does not support Windows versions older than XP Service Pack 3" +#endif #endif |