threads,configure.ac,meson.build: define and use HAVE_TIMESPEC_GET

Tested with Travis and Appveyor.

v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds
v3: use check_functions in Scons (Eric)

Cc: Rob Herring <robh@kernel.org>
Cc: Alexander von Gluck IV <kallisti5@unixzen.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674
Fixes: f1a3648784 ("threads: update for late C11 changes")
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk> (v2)
This commit is contained in:
Nicolai Hähnle 2017-11-15 12:41:58 +01:00
parent a8bdf0e0c4
commit 2e3d0dd6c8
4 changed files with 6 additions and 2 deletions

View file

@ -848,6 +848,7 @@ AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"]) AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"])
AC_MSG_CHECKING([whether strtod has locale support]) AC_MSG_CHECKING([whether strtod has locale support])
AC_LINK_IFELSE([AC_LANG_SOURCE([[ AC_LINK_IFELSE([AC_LANG_SOURCE([[

View file

@ -382,7 +382,7 @@ tss_set(tss_t key, void *val)
/*-------------------- 7.25.7 Time functions --------------------*/ /*-------------------- 7.25.7 Time functions --------------------*/
// 7.25.6.1 // 7.25.6.1
#ifdef __HAIKU__ #ifndef HAVE_TIMESPEC_GET
static inline int static inline int
timespec_get(struct timespec *ts, int base) timespec_get(struct timespec *ts, int base)
{ {

View file

@ -578,7 +578,7 @@ foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h']
endif endif
endforeach endforeach
foreach f : ['strtof', 'mkostemp', 'posix_memalign'] foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get']
if cc.has_function(f) if cc.has_function(f)
pre_args += '-DHAVE_@0@'.format(f.to_upper()) pre_args += '-DHAVE_@0@'.format(f.to_upper())
endif endif

View file

@ -355,6 +355,9 @@ def generate(env):
if check_functions(env, ['strtod_l', 'strtof_l']): if check_functions(env, ['strtod_l', 'strtof_l']):
cppdefines += ['HAVE_STRTOD_L'] cppdefines += ['HAVE_STRTOD_L']
if check_functions(env, ['timespec_get']):
cppdefines += ['HAVE_TIMESPEC_GET']
if platform == 'windows': if platform == 'windows':
cppdefines += [ cppdefines += [
'WIN32', 'WIN32',