win32: define __MSVCRT_VERSION__ when compiling with MingW, for __stat64

Need to define this when using MingW, so that the includes provide
__stat64 and friends. We need at least Windows XP SP2 for this.
Fixes #568632.
This commit is contained in:
Tim-Philipp Müller 2009-04-17 15:46:52 +01:00
parent 581ccbb581
commit 923b33a316

View file

@ -231,6 +231,25 @@ case $host_os in
mingw* | msvc* | mks*)
dnl HAVE_WIN32 currently means "disable POSIXisms".
AC_DEFINE_UNQUOTED(HAVE_WIN32, 1, [Defined if compiling for Windows])
dnl define __MSVCRT_VERSION__ version if not set already by the
dnl compiler (ie. mostly for mingw). This is needed for things like
dnl __stat64 to be available. If set by the compiler, ensure it's
dnl new enough - we need at least WinXP SP2.
AC_TRY_COMPILE([ ], [ return __MSVCRT_VERSION__; ], [
AC_TRY_COMPILE([ ], [
#if __MSVCRT_VERSION__ < 0x0601
#error "MSVCRT too old"
#endif
], [
AC_MSG_NOTICE([MSVCRT version looks ok])
], [
AC_MSG_ERROR([MSVCRT version too old, need at least WinXP SP2])
])
], [
AC_MSG_NOTICE([Setting MSVCRT version to 0x0601])
AC_DEFINE_UNQUOTED(__MSVCRT_VERSION__, 0x0601, [We need at least WinXP SP2 for __stat64])
])
;;
*)
;;