meson: Change the 'tls' option to be boolean.

Change the 'tls' option to be a boolean value instead of a feature.

This still allows manually disabling TLS in builds that would otherwise
support it, but it shouldn't be affected by meson's --auto-features
option.
This commit is contained in:
Kyle Brenneman 2021-09-13 16:45:47 -06:00
parent f3ef4d4afc
commit 94ea1327d8
3 changed files with 11 additions and 7 deletions

View file

@ -84,7 +84,7 @@ build-x86_64-tsd-meson:
extends:
- .build-check-meson
variables:
CONFIGURE_OPTIONS: -Dtls=disabled
CONFIGURE_OPTIONS: -Dtls=false
build-i386-tsd:
extends:
@ -96,7 +96,7 @@ build-i386-tsd-meson:
extends:
- .build-check-meson
variables:
CONFIGURE_OPTIONS: -Dtls=disabled --cross-file .gitlab-ci/i686-linux-gnu
CONFIGURE_OPTIONS: -Dtls=false --cross-file .gitlab-ci/i686-linux-gnu
build-pure-c-tls:
extends:
@ -120,4 +120,4 @@ build-pure-c-tld-meson:
extends:
- .build-check-meson
variables:
CONFIGURE_OPTIONS: -Dasm=disabled -Dtls=disabled
CONFIGURE_OPTIONS: -Dasm=disabled -Dtls=false

View file

@ -114,14 +114,17 @@ if cc.compiles('typeof(int *);', name : 'typeof')
endif
with_tls = get_option('tls')
if with_tls.auto()
if with_tls
# Use a __thread variable if possible, even if we can't use the TLS assembly
# stubs, because it's still faster than calling pthread_getspecific.
have_tls = cc.compiles(
'__thread int foo;',
name : '__thread',
)
else
have_tls = with_tls.enabled()
have_tls = false
endif
message('Using TLS variable for dispatch table: @0@'.format(have_tls))
if have_tls
add_project_arguments('-DGLDISPATCH_USE_TLS', language : ['c'])

View file

@ -60,8 +60,9 @@ option(
)
option(
'tls',
type : 'feature',
description : 'Use Thread Local Storage.'
type : 'boolean',
value : true,
description : 'Use Thread Local Storage (if supported).'
)
option(
'dispatch-page-size',