-
-_CRTIMP int __cdecl __MINGW_NOTHROW fstat (int, struct stat*);
-_CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int);
-_CRTIMP int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*);
-_CRTIMP int __cdecl __MINGW_NOTHROW lstat (const char*, struct stat*);
+/* This prevents definition in MinGW's wchar.h of inline functions
+ that use struct _stat64i32 etc., which we don't define and don't
+ support in our implementation of 'stat' and 'fstat'. If we don't
+ prevent definition of those inline functions, any program (e.g.,
+ test programs run by configure) that includes both wchar.h and
+ sys/stat.h will fail to compile. */
+#define _WSTAT_DEFINED
+
+int __cdecl __MINGW_NOTHROW fstat (int, struct stat*);
+int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*);
+int __cdecl __MINGW_NOTHROW lstat (const char*, struct stat*);
+int __cdecl __MINGW_NOTHROW fstatat (int, char const *,
+ struct stat *, int);
+int __cdecl __MINGW_NOTHROW chmod (const char*, int);