summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build13
1 files changed, 12 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index b0f2787..7e76147 100644
--- a/meson.build
+++ b/meson.build
@@ -30,8 +30,19 @@ if host_machine.endian() == 'big'
cargs = '-DWORDS_BIGENDIAN=1'
endif
+
# Check for threadsafe variants of gmtime
-if cc.has_header_symbol('time.h', 'gmtime_r')
+# MinGW needs _POSIX_C_SOURCE or _POSIX_THREAD_SAFE_FUNCTIONS defined
+# to make gmtime_r available
+if host_machine.system() == 'windows' and cc.get_argument_syntax() != 'msvc'
+ cargs += ['-D_POSIX_C_SOURCE=199503L']
+endif
+
+if cc.has_header_symbol(
+ 'time.h',
+ 'gmtime_r',
+ args: cargs,
+)
cargs += '-DHAVE_GMTIME_R=1'
elif cc.has_header_symbol('time.h', 'gmtime_s')
if cc.links(