ref: 39dba4cd6d2a43df68916b1fd05b2f2409b92775
parent: e06232862237466679ec2ea8326111e06e5d3a99
author: Martin Storsjö <[email protected]>
date: Mon Jun 10 06:28:33 EDT 2019
meson: Look for librt if clock_gettime isn't found without it On older versions of glibc, clock_gettime isn't available in the main libc, but part of a separate librt. Only look for librt if clock_gettime isn't available otherwise.
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -31,6 +31,17 @@
subdir_done()
endif
+rt_dependency = []
+if host_machine.system() != 'windows'
+ if not cc.has_function('clock_gettime', prefix : '#include <time.h>', args : test_args)
+ rt_dependency = cc.find_library('rt', required: false)
+ if not cc.has_function('clock_gettime', prefix : '#include <time.h>', args : test_args, dependencies : rt_dependency)
+ error('clock_gettime not found')
+ endif
+ endif
+endif
+
+
# dav1d cli tool sources
dav1d_sources = files(
'dav1d.c',
@@ -51,6 +62,6 @@
link_with : libdav1d,
include_directories : [dav1d_inc_dirs],
- dependencies : [getopt_dependency, thread_dependency],
+ dependencies : [getopt_dependency, thread_dependency, rt_dependency],
install : true,
)