From d8e8e92176bb7a88961ca125081b46ab59a59b19 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 9 Dec 2016 15:18:11 +0530 Subject: libcheck: Update the compatibility code and checks This brings us up-to-speed with the latest compatibility code from upstream check git. For completeness, we do all the checks that upstream check does, but we skip the snprintf/vsnprintf code because it's not straightforward (involves running code and that is bad for cross-compilation) and not necessary for the platforms we support anyway. If someone really wants this, they can uncomment this and copy the relevant checks from the check git repository. https://bugzilla.gnome.org/show_bug.cgi?id=775870 --- meson.build | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 82adb8406..19c363969 100644 --- a/meson.build +++ b/meson.build @@ -152,6 +152,8 @@ if cc.has_function('gmtime_r', prefix : '#include') endif if cc.has_function('localtime_r', prefix : '#include') cdata.set('HAVE_LOCALTIME_R', 1) + # Needed by libcheck + cdata.set('HAVE_DECL_LOCALTIME_R', 1) endif if cc.has_function('sigaction', prefix : '#include') cdata.set('HAVE_SIGACTION', 1) @@ -230,19 +232,20 @@ else endif # ------------------------------------------------------------------------------------- -# config.h things needed by libcheck (FIXME: move into the libcheck meson.build) (tpm) +# config.h things needed by libcheck # ------------------------------------------------------------------------------------- -# FIXME: check if it is _getpid or getpid on windows (tpm) if cc.has_function('getpid', prefix : '#include \n#include ') cdata.set('HAVE_GETPID', 1) elif cc.has_function('_getpid', prefix : '#include ') - cdata.set('HAVE__GETPID', 1) + cdata.set('HAVE__GETPID', 1) # Windows (MSVC) endif -# FIXME: check for _strdup() but how/where and with what includes? (windows?) (tpm) if cc.has_function('strdup', prefix : '#include ') cdata.set('HAVE_DECL_STRDUP', 1) elif cc.has_function('_strdup', prefix : '#include ') - cdata.set('HAVE__STRDUP', 1) + cdata.set('HAVE__STRDUP', 1) # Windows (MSVC) +endif +if cc.has_function('getline', prefix : '#include ') + cdata.set('HAVE_GETLINE', 1) endif if cc.has_function('mkstemp', prefix : '#include ') cdata.set('HAVE_MKSTEMP', 1) @@ -256,12 +259,27 @@ endif if cc.has_function('alarm', prefix : '#include ') cdata.set('HAVE_ALARM', 1) endif -if cc.has_function('localtime_r', prefix : '#include ') - cdata.set('HAVE_DECL_LOCALTIME_R', 1) +if cc.has_function('gettimeofday', prefix : '#include ') + cdata.set('HAVE_GETTIMEOFDAY', 1) endif if cc.has_function('strsignal', prefix : '#include ') cdata.set('HAVE_DECL_STRSIGNAL', 1) endif +# Check for availability of types +if not cc.has_type('clockid_t', prefix : '#include ') + cdata.set('clockid_t', 'int') +endif +if not cc.has_type('timer_t', prefix : '#include ') + cdata.set('timer_t', 'int') +endif +if not cc.has_members('struct timespec', 'tv_sec', 'tv_nsec', + prefix : '#include ') + cdata.set('STRUCT_TIMESPEC_DEFINITION_MISSING', 1) +endif +if not cc.has_members('struct itimerspec', 'it_interval', 'it_value', + prefix : '#include ') + cdata.set('STRUCT_ITIMERSPEC_DEFINITION_MISSING', 1) +endif # Platform deps; only ws2_32 and execinfo for now platform_deps = [] @@ -318,7 +336,9 @@ else endif mathlib = cc.find_library('m', required : false) -rt_lib = cc.find_library('rt', required : false) # clock_gettime +# Needed for timer_create/settime/delete +# Also provides clock_gettime in glibc < 2.17 +rt_lib = cc.find_library('rt', required : false) gir = find_program('g-ir-scanner', required : false) gnome = import('gnome') -- cgit v1.2.3