mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-09 04:58:16 +03:00
meson: simplify thread_local check
Use a simple loop. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
34fe4b8863
commit
88cc61e3e6
42
meson.build
42
meson.build
@ -294,44 +294,12 @@ endif
|
||||
|
||||
### thread local storage
|
||||
if want_tls
|
||||
tls_src = '''
|
||||
#include <threads.h>
|
||||
int main()
|
||||
{
|
||||
_Thread_local int v;
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
res = cc.compiles(tls_src, name: '_Thread_local')
|
||||
if res == true
|
||||
config_h.set('XML_THREAD_LOCAL', '_Thread_local')
|
||||
else
|
||||
tls_src = '''
|
||||
int main()
|
||||
{
|
||||
__thread int v;
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
res = cc.compiles(tls_src, name: '__thread')
|
||||
if res == true
|
||||
config_h.set('XML_THREAD_LOCAL', '__thread')
|
||||
else
|
||||
tls_src = '''
|
||||
int main()
|
||||
{
|
||||
__declspec(thread) int v;
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
res = cc.compiles(tls_src, name: '__declspec(thread)')
|
||||
if res == true
|
||||
config_h.set('XML_THREAD_LOCAL', '__declspec(thread)')
|
||||
else
|
||||
want_tls = false
|
||||
endif
|
||||
foreach t : ['_Thread_local', '__thread', '__declspec(thread)']
|
||||
if cc.compiles('@0@ int v;'.format(t))
|
||||
config_h.set('XML_THREAD_LOCAL', t)
|
||||
break
|
||||
endif
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
|
||||
### __attribute__((destructor))
|
||||
|
Loading…
x
Reference in New Issue
Block a user