diff options
author | Daiki Ueno <dueno@redhat.com> | 2019-06-19 15:31:32 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2019-06-19 15:59:01 +0200 |
commit | eb5eb7aea7fc41a2c15d853cd57c7c030644f4ee (patch) | |
tree | 53e4c60054375bd5197749edeaa02fec374602e1 | |
parent | daf1a84de39c4cdbd308c6a0b80b437689a222c7 (diff) |
build: Make threads dependency more explicit
-rw-r--r-- | common/meson.build | 6 | ||||
-rw-r--r-- | meson.build | 12 | ||||
-rw-r--r-- | p11-kit/meson.build | 4 |
3 files changed, 10 insertions, 12 deletions
diff --git a/common/meson.build b/common/meson.build index 4614bcb..656592a 100644 --- a/common/meson.build +++ b/common/meson.build @@ -31,7 +31,8 @@ libp11_library = static_library('p11-library', 'library.c', libp11_library_dep = declare_dependency(include_directories: [configinc, commoninc], - link_with: libp11_library) + link_with: libp11_library, + dependencies: thread_deps) libp11_test_sources = [ 'mock.c', @@ -42,7 +43,8 @@ libp11_test = static_library('p11-test', libp11_test_sources, include_directories: configinc) libp11_test_dep = declare_dependency(include_directories: [configinc, commoninc], - link_with: libp11_test) + link_with: libp11_test, + dependencies: thread_deps) libp11_tool_sources = [ 'tool.c' diff --git a/meson.build b/meson.build index 77883e0..89f8421 100644 --- a/meson.build +++ b/meson.build @@ -75,19 +75,15 @@ tests_c_args = [ conf.set('SIZEOF_UNSIGNED_LONG', cc.sizeof('unsigned long')) -pthread_create_deps = [] nanosleep_deps = [] dlopen_deps = [] socket_deps = [] +thread_deps = [] if host_system != 'windows' - if not cc.has_function('pthread_create') - libpthread = cc.find_library('pthread', required: false) - if cc.has_function('pthread_create', dependencies: libpthread) - pthread_create_deps += libpthread - else - error('could not find pthread_create') - endif + thread_deps += dependency('threads') + if not cc.has_function('pthread_create', dependencies: thread_deps) + error('could not find pthread_create') endif if not cc.has_function('nanosleep') diff --git a/p11-kit/meson.build b/p11-kit/meson.build index 33e1683..a78cf9e 100644 --- a/p11-kit/meson.build +++ b/p11-kit/meson.build @@ -213,7 +213,7 @@ foreach name : p11_kit_tests t = executable(name, '@0@.c'.format(name), c_args: tests_c_args + libp11_kit_testable_c_args, include_directories: [configinc, commoninc], - dependencies: [libp11_test_dep, libp11_common_dep] + libffi_deps + dlopen_deps + pthread_create_deps, + dependencies: [libp11_test_dep, libp11_common_dep] + libffi_deps + dlopen_deps, link_with: libp11_kit_testable) test(name, t) endforeach @@ -227,7 +227,7 @@ foreach name : p11_kit_progs t = executable(name, '@0@.c'.format(name), c_args: tests_c_args, include_directories: [configinc, commoninc], - dependencies: [libp11_test_dep, libp11_common_dep] + libffi_deps + dlopen_deps + pthread_create_deps, + dependencies: [libp11_test_dep, libp11_common_dep] + libffi_deps + dlopen_deps, link_with: libp11_kit_testable) endforeach |