]> granicus.if.org Git - p11-kit/commitdiff
build: Make threads dependency more explicit
authorDaiki Ueno <dueno@redhat.com>
Wed, 19 Jun 2019 13:31:32 +0000 (15:31 +0200)
committerDaiki Ueno <ueno@gnu.org>
Wed, 19 Jun 2019 13:59:01 +0000 (15:59 +0200)
common/meson.build
meson.build
p11-kit/meson.build

index 4614bcb0b1f9fc88301679ac828d80e08a18bf0b..656592a87abadc4e2a465d57a349e6b9339c9290 100644 (file)
@@ -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'
index 77883e00f4b5b4072a33cf87657f45c88fd2a0cb..89f84219b3d20e041260e9de322379f82e9e1a95 100644 (file)
@@ -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')
index 33e1683f515f5d84fb8949f00afa332bf8e9b9c5..a78cf9eae07568fb9c7353e0b8011a9e29b900d8 100644 (file)
@@ -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