]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
meson: add 'threads' dependency for pthread_* function checks
authorAram Sargsyan <aram@isc.org>
Mon, 28 Jul 2025 10:53:32 +0000 (10:53 +0000)
committerOndřej Surý <ondrej@isc.org>
Tue, 5 Aug 2025 08:46:09 +0000 (10:46 +0200)
This fixes the correct detection of these functions on some
platforms like Alma Linux 8.

Co-authored-by: Aydın Mercan <aydin@isc.org>
meson.build

index c6859dec4773b36701b68e3f0172c877aed8195b..a920320a06a6a0bc78ff5e4b201cbe5a05ff7205 100644 (file)
@@ -453,16 +453,6 @@ foreach fn, header : {
     'flockfile': '#include <stdio.h>',
     'getc_unlocked': '#include <stdio.h>',
 
-    # Thread control
-    'pthread_attr_getstacksize': '#include <pthread.h>',
-    'pthread_attr_setstacksize': '#include <pthread.h>',
-    'pthread_barrier_init': '#include <pthread.h>',
-    'pthread_set_name_np': '#include <pthread.h>',
-    'pthread_setname_np': '#include <pthread.h>',
-    'pthread_spin_init': '#include <pthread.h>',
-    'pthread_yield': '#include <pthread.h>',
-    'pthread_yield_np': '#include <pthread.h>',
-
     # Processor control
     'cpuset_getaffinity': '#include <sys/cpuset.h>',
     'sched_getaffinity': '#include <sched.h>',
@@ -524,9 +514,31 @@ endif
 ###
 null_dep = dependency('', required: false)
 
-thread_dep = dependency('threads')
 m_dep = cc.find_library('m', required: false)
 
+## Threads
+thread_dep = dependency('threads')
+
+foreach fn : [
+    'pthread_attr_getstacksize',
+    'pthread_attr_setstacksize',
+    'pthread_barrier_init',
+    'pthread_set_name_np',
+    'pthread_setname_np',
+    'pthread_spin_init',
+    'pthread_yield',
+    'pthread_yield_np',
+]
+    if cc.has_function(
+        fn,
+        prefix: '#include <pthread.h>',
+        args: sys_defines,
+        dependencies: thread_dep,
+    )
+        config.set('HAVE_@0@'.format(fn.to_upper()), 1)
+    endif
+endforeach
+
 ## OpenSSL
 openssl_dep = [
     dependency('libcrypto', version: '>=1.1.1'),