Skip to content

Commit

Permalink
build: Make threads dependency more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
ueno committed Jun 19, 2019
1 parent daf1a84 commit eb5eb7a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 4 additions & 2 deletions common/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'
Expand Down
12 changes: 4 additions & 8 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions p11-kit/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit eb5eb7a

Please sign in to comment.