diff --git a/meson.build b/meson.build index c6859dec47..a920320a06 100644 --- a/meson.build +++ b/meson.build @@ -453,16 +453,6 @@ foreach fn, header : { 'flockfile': '#include ', 'getc_unlocked': '#include ', - # Thread control - 'pthread_attr_getstacksize': '#include ', - 'pthread_attr_setstacksize': '#include ', - 'pthread_barrier_init': '#include ', - 'pthread_set_name_np': '#include ', - 'pthread_setname_np': '#include ', - 'pthread_spin_init': '#include ', - 'pthread_yield': '#include ', - 'pthread_yield_np': '#include ', - # Processor control 'cpuset_getaffinity': '#include ', 'sched_getaffinity': '#include ', @@ -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 ', + 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'),