Bug 752034 - Use the Windows SDK when building with Clang on Windows; r=ted

This commit is contained in:
Ehsan Akhgari 2013-06-13 13:09:22 -04:00
parent 64be84714f
commit 33c9930db5
6 changed files with 90 additions and 68 deletions

1
aclocal.m4 vendored
View File

@ -29,6 +29,7 @@ builtin(include, build/autoconf/android.m4)dnl
builtin(include, build/autoconf/zlib.m4)dnl
builtin(include, build/autoconf/linux.m4)dnl
builtin(include, build/autoconf/python-virtualenv.m4)dnl
builtin(include, build/autoconf/winsdk.m4)dnl
MOZ_PROG_CHECKMSYS()

37
build/autoconf/winsdk.m4 Normal file
View File

@ -0,0 +1,37 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Identify which version of the SDK we're building with
dnl Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
dnl from there
AC_DEFUN([MOZ_FIND_WINSDK_VERSION], [
MOZ_CHECK_HEADERS([winsdkver.h])
if test "$ac_cv_header_winsdkver_h" = "yes"; then
dnl Get the highest _WIN32_WINNT and NTDDI versions supported
dnl Take the higher of the two
dnl This is done because the Windows 7 beta SDK reports its
dnl NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
AC_CACHE_CHECK(for highest Windows version supported by this SDK,
ac_cv_winsdk_maxver,
[cat > conftest.h <<EOF
#include <winsdkver.h>
#include <sdkddkver.h>
#if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
#define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
#else
#define WINSDK_MAXVER NTDDI_MAXVER
#endif
WINSDK_MAXVER
EOF
ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
rm -f conftest.h
])
MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
else
dnl Any SDK which doesn't have WinSDKVer.h is too old.
AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
fi
])

View File

@ -448,7 +448,7 @@ esac
case "$target" in
*-mingw*)
if test "$GCC" != "yes"; then
if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
# Check to see if we are really running in a msvc environemnt
_WIN32_MSVC=1
AC_CHECK_PROGS(MIDL, midl)
@ -573,38 +573,6 @@ case "$target" in
;;
esac
# Identify which version of the SDK we're building with
# Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
# from there
MOZ_CHECK_HEADERS([winsdkver.h])
if test "$ac_cv_header_winsdkver_h" = "yes"; then
# Get the highest _WIN32_WINNT and NTDDI versions supported
# Take the higher of the two
# This is done because the Windows 7 beta SDK reports its
# NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
AC_CACHE_CHECK(for highest Windows version supported by this SDK,
ac_cv_winsdk_maxver,
[cat > conftest.h <<EOF
#include <winsdkver.h>
#include <sdkddkver.h>
#if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
#define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
#else
#define WINSDK_MAXVER NTDDI_MAXVER
#endif
WINSDK_MAXVER
EOF
ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
rm -f conftest.h
])
MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
else
# Any SDK which doesn't have WinSDKVer.h is too old.
AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
fi
unset _MSVC_VER_FILTER
AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
@ -672,7 +640,7 @@ EOF
if test "$WRAP_STL_INCLUDES" = "1"; then
STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
fi
else
elif test -z "$CLANG_CC"; then
# Check w32api version
_W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
_W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
@ -723,6 +691,11 @@ EOF
MOZ_WINSDK_MAXVER=0x06020000
fi # !GNU_CC
# If MSVC or clang
if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
MOZ_FIND_WINSDK_VERSION
fi
AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
# Require OS features provided by IE 6.0 SP2 (XP SP2)

1
js/src/aclocal.m4 vendored
View File

@ -28,5 +28,6 @@ builtin(include, build/autoconf/android.m4)dnl
builtin(include, build/autoconf/zlib.m4)dnl
builtin(include, build/autoconf/linux.m4)dnl
builtin(include, build/autoconf/python-virtualenv.m4)dnl
builtin(include, build/autoconf/winsdk.m4)dnl
MOZ_PROG_CHECKMSYS()

View File

@ -0,0 +1,37 @@
dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Identify which version of the SDK we're building with
dnl Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
dnl from there
AC_DEFUN([MOZ_FIND_WINSDK_VERSION], [
MOZ_CHECK_HEADERS([winsdkver.h])
if test "$ac_cv_header_winsdkver_h" = "yes"; then
dnl Get the highest _WIN32_WINNT and NTDDI versions supported
dnl Take the higher of the two
dnl This is done because the Windows 7 beta SDK reports its
dnl NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
AC_CACHE_CHECK(for highest Windows version supported by this SDK,
ac_cv_winsdk_maxver,
[cat > conftest.h <<EOF
#include <winsdkver.h>
#include <sdkddkver.h>
#if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
#define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
#else
#define WINSDK_MAXVER NTDDI_MAXVER
#endif
WINSDK_MAXVER
EOF
ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
rm -f conftest.h
])
MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
else
dnl Any SDK which doesn't have WinSDKVer.h is too old.
AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
fi
])

View File

@ -437,7 +437,7 @@ esac
case "$target" in
*-mingw*)
if test "$GCC" != "yes"; then
if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
# Check to see if we are really running in a msvc environemnt
_WIN32_MSVC=1
@ -523,40 +523,8 @@ case "$target" in
INCREMENTAL_LINKER=1
# Identify which version of the SDK we're building with
# Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
# from there
MOZ_CHECK_HEADERS([winsdkver.h])
if test "$ac_cv_header_winsdkver_h" = "yes"; then
# Get the highest _WIN32_WINNT and NTDDI versions supported
# Take the higher of the two
# This is done because the Windows 7 beta SDK reports its
# NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
AC_CACHE_CHECK(for highest Windows version supported by this SDK,
ac_cv_winsdk_maxver,
[cat > conftest.h <<EOF
#include <winsdkver.h>
#include <sdkddkver.h>
#if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
#define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
#else
#define WINSDK_MAXVER NTDDI_MAXVER
#endif
WINSDK_MAXVER
EOF
ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
rm -f conftest.h
])
MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
else
# Any SDK which doesn't have WinSDKVer.h is too old.
AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
fi
unset _MSVC_VER_FILTER
else
elif test -z "$CLANG_CC"; then
# Check w32api version
_W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
_W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
@ -595,6 +563,11 @@ EOF
MOZ_WINSDK_MAXVER=0x06010000
fi # !GNU_CC
# If MSVC or clang
if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
MOZ_FIND_WINSDK_VERSION
fi
AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
# Require OS features provided by IE 6.0 SP2 (XP SP2)