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',
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'
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')
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
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