diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-09 15:18:11 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-09 15:31:01 +0530 |
commit | d8e8e92176bb7a88961ca125081b46ab59a59b19 (patch) | |
tree | 861b395c4c302ffb00974d4fba534d925ca71414 /meson.build | |
parent | eb1f861012b6f9972b17f3a1c16de09302feb3df (diff) |
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
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 36 |
1 files changed, 28 insertions, 8 deletions
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<time.h>') endif if cc.has_function('localtime_r', prefix : '#include<time.h>') cdata.set('HAVE_LOCALTIME_R', 1) + # Needed by libcheck + cdata.set('HAVE_DECL_LOCALTIME_R', 1) endif if cc.has_function('sigaction', prefix : '#include<signal.h>') 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 <sys/types.h>\n#include <unistd.h>') cdata.set('HAVE_GETPID', 1) elif cc.has_function('_getpid', prefix : '#include <process.h>') - 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 <string.h>') cdata.set('HAVE_DECL_STRDUP', 1) elif cc.has_function('_strdup', prefix : '#include <string.h>') - cdata.set('HAVE__STRDUP', 1) + cdata.set('HAVE__STRDUP', 1) # Windows (MSVC) +endif +if cc.has_function('getline', prefix : '#include <stdio.h>') + cdata.set('HAVE_GETLINE', 1) endif if cc.has_function('mkstemp', prefix : '#include <stdlib.h>') cdata.set('HAVE_MKSTEMP', 1) @@ -256,12 +259,27 @@ endif if cc.has_function('alarm', prefix : '#include <unistd.h>') cdata.set('HAVE_ALARM', 1) endif -if cc.has_function('localtime_r', prefix : '#include <time.h>') - cdata.set('HAVE_DECL_LOCALTIME_R', 1) +if cc.has_function('gettimeofday', prefix : '#include <sys/time.h>') + cdata.set('HAVE_GETTIMEOFDAY', 1) endif if cc.has_function('strsignal', prefix : '#include <string.h>') cdata.set('HAVE_DECL_STRSIGNAL', 1) endif +# Check for availability of types +if not cc.has_type('clockid_t', prefix : '#include <time.h>') + cdata.set('clockid_t', 'int') +endif +if not cc.has_type('timer_t', prefix : '#include <time.h>') + cdata.set('timer_t', 'int') +endif +if not cc.has_members('struct timespec', 'tv_sec', 'tv_nsec', + prefix : '#include <time.h>') + cdata.set('STRUCT_TIMESPEC_DEFINITION_MISSING', 1) +endif +if not cc.has_members('struct itimerspec', 'it_interval', 'it_value', + prefix : '#include <time.h>') + 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') |