summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorL. E. Segovia <amy@amyspark.me>2022-12-03 11:05:03 -0300
committerL. E. Segovia <amy@amyspark.me>2022-12-06 17:37:38 +0000
commit8ec9990bb90aa23aacbedcce3aebfb1a698cb8fc (patch)
tree098ec445a0463b6c0503e4cc26cfaca2a12ac76d /meson.build
parentf69081bb94bfa75affafb17a371c1d66d91e5f19 (diff)
downloadlcms2-8ec9990bb90aa23aacbedcce3aebfb1a698cb8fc.tar.gz
meson: Complete check for gmtime
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build20
1 files changed, 17 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index 35cbec8..92f81c6 100644
--- a/meson.build
+++ b/meson.build
@@ -31,10 +31,24 @@ if host_machine.endian() == 'big'
endif
# Check for threadsafe variants of gmtime
-if cc.has_function('gmtime_r', prefix: '#include <time.h>')
+if cc.has_header_symbol('time.h', 'gmtime_r')
cargs += '-DHAVE_GMTIME_R=1'
-elif cc.has_function('gmtime_s', prefix: '#include <time.h>')
- cargs += '-DHAVE_GMTIME_S=1'
+elif cc.has_header_symbol('time.h', 'gmtime_s')
+ if cc.links(
+ '''
+ #include <time.h>
+
+ int main() {
+ time_t t;
+ struct tm m;
+ gmtime_s(&m, &t);
+ return 0;
+ }
+ ''',
+ name: 'gmtime_s can be used',
+ )
+ cargs += '-DHAVE_GMTIME_S=1'
+ endif
endif
m_dep = cc.find_library('m', required: false)