1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

meson: simplify thread_local check

Use a simple loop.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2024-06-20 22:09:55 -07:00
parent 34fe4b8863
commit 88cc61e3e6

View File

@ -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))