diff options
author | Martin Storsjö <martin@martin.st> | 2019-06-10 10:28:33 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2019-06-10 10:43:56 +0300 |
commit | 39dba4cd6d2a43df68916b1fd05b2f2409b92775 (patch) | |
tree | b506de2cc809de0806b4489c333d95e9229ae7aa /tools | |
parent | e06232862237466679ec2ea8326111e06e5d3a99 (diff) |
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.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/meson.build | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/meson.build b/tools/meson.build index e4bd668..9f9356d 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -31,6 +31,17 @@ if not get_option('build_tools') 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 @@ dav1d = executable('dav1d', link_with : libdav1d, include_directories : [dav1d_inc_dirs], - dependencies : [getopt_dependency, thread_dependency], + dependencies : [getopt_dependency, thread_dependency, rt_dependency], install : true, ) |