From 923b33a31684e736d9a5ed958ca501bdc16e90d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 17 Apr 2009 15:46:52 +0100 Subject: [PATCH] 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. --- configure.ac | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index 8fa1ce3..ae1193f 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) + ]) ;; *) ;; -- 2.7.4