summaryrefslogtreecommitdiff
path: root/win32/win32.h
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2021-01-26 12:31:02 +0000
committerSteve Hay <steve.m.hay@googlemail.com>2021-01-26 12:31:02 +0000
commit341a561fb3c3b40f8730c0c5da27a1ea1136d781 (patch)
tree535af0c9b53f0534068277dc2ae7877eed81e589 /win32/win32.h
parentfc65ff1f9f343e12605b2676b8ef4e5ca41131b0 (diff)
downloadperl-341a561fb3c3b40f8730c0c5da27a1ea1136d781.tar.gz
Restore build with some mingw.org compilers using mingw runtimes >= 3.21
MinGW runtime version 3.21 added a definition of mkstemp(), so requires a fix similar to f33b2f5852 for MinGW-w64's runtime 4.0 onwards. Based on a patch by Dan Collins on GH#15446. This commit also tweaks 43b3b04375, having discovered that mingw runtime 3.22 also contains a definition of timespec. For me, this fixes the build with my mingw.org 5.3.0 compiler using any of the mingw runtimes 3.21, 3.22.4 or 5.0 without breaking older versions such as 4.9.3 with the 3.20 runtime (or even with the withdrawn 4.0.3 runtime, which had __MINGW32_MAJOR/MINOR_VERSION set to 3.20 whilst adding new a __MINGW_MAJOR/MINOR_VERSION set to 4.0). However, 6.3.0 and 7.3.0 have other issues when compiling win32sck.c, while 8.2.0 and 9.2.0 have other issues again when compiling win32.c. See GH#18510 for more details. Also, C++ mode builds with some MinGW/MinGW-w64 compilers are still broken, as documented in 8a217c9aa7. See GH#16459 for more details.
Diffstat (limited to 'win32/win32.h')
-rw-r--r--win32/win32.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/win32/win32.h b/win32/win32.h
index 2325d0edc9..6d5e186204 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -418,7 +418,9 @@ extern void *sbrk(ptrdiff_t need);
#endif
extern char * getlogin(void);
extern int chown(const char *p, uid_t o, gid_t g);
-#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 4
+#if((!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 4) && \
+ (!defined(__MINGW32_MAJOR_VERSION) || __MINGW32_MAJOR_VERSION < 3 || \
+ (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 21)))
extern int mkstemp(const char *path);
#endif
#endif