mirror of https://github.com/mpv-player/mpv
build: don't rely on "__thread" being always available with GCC
Thread-local storage in GCC is platform-specific, and some platforms that are otherwise perfectly capable of running mpv may lack TLS support in GCC. This change adds a test for GCC variant of TLS and relies on its result instead of assumption. Provided that LLVM's `__thread` support is similar to GCC, the test is called "GCC/LLVM TLS". Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
parent
26458419a7
commit
ee2ba599e7
|
@ -125,7 +125,7 @@ int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt,
|
|||
|
||||
#if HAVE_C11_TLS
|
||||
#define MP_TLS _Thread_local
|
||||
#elif defined(__GNUC__)
|
||||
#elif HAVE_GCC_TLS
|
||||
#define MP_TLS __thread
|
||||
#endif
|
||||
|
||||
|
|
4
wscript
4
wscript
|
@ -185,6 +185,10 @@ main_dependencies = [
|
|||
'name': 'c11-tls',
|
||||
'desc': 'C11 TLS support',
|
||||
'func': check_statement('stddef.h', 'static _Thread_local int x = 0'),
|
||||
}, {
|
||||
'name': 'gcc-tls',
|
||||
'desc': 'GCC TLS support',
|
||||
'func': check_statement('stddef.h', 'static __thread int x = 0'),
|
||||
}, {
|
||||
'name': 'librt',
|
||||
'desc': 'linking with -lrt',
|
||||
|
|
Loading…
Reference in New Issue