mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-21 22:50:08 +03:00
build: Disable compiler TLS by default
The global struct is quite large (~700 bytes on 64-bit systems which will be allocated for each thread whether it uses libxml2 or not) and already close to the total size limit on some platforms. Disable compiler TLS by default.
This commit is contained in:
parent
7f00273cf0
commit
cf6e58d63c
@ -52,6 +52,7 @@ option(LIBXML2_WITH_SCHEMATRON "Add Schematron support" ON)
|
||||
option(LIBXML2_WITH_TESTS "Build tests" ON)
|
||||
option(LIBXML2_WITH_THREADS "Add multithread support" ON)
|
||||
option(LIBXML2_WITH_THREAD_ALLOC "Add per-thread memory" OFF)
|
||||
option(LIBXML2_WITH_TLS "Enable thread-local storage" OFF)
|
||||
option(LIBXML2_WITH_TREE "Add the DOM like tree manipulation APIs" ON)
|
||||
set(LIBXML2_WITH_UNICODE ON)
|
||||
option(LIBXML2_WITH_VALID "Add the DTD validation support" ON)
|
||||
@ -182,28 +183,30 @@ if (NOT MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_c_source_compiles(
|
||||
"_Thread_local int v; int main(){return 0;}"
|
||||
XML_THREAD_LOCAL_C11
|
||||
)
|
||||
if (XML_THREAD_LOCAL_C11)
|
||||
set(XML_THREAD_LOCAL "_Thread_local")
|
||||
else()
|
||||
check_c_source_compiles(
|
||||
"__thread int v; int main(){return 0;}"
|
||||
XML_THREAD_LOCAL_THREAD
|
||||
)
|
||||
if (XML_THREAD_LOCAL_THREAD)
|
||||
set(XML_THREAD_LOCAL "__thread")
|
||||
else()
|
||||
check_c_source_compiles(
|
||||
"__declspec(thread) int v; int main(){return 0;}"
|
||||
XML_THREAD_LOCAL_DECLSPEC
|
||||
)
|
||||
if (XML_THREAD_LOCAL_DECLSPEC)
|
||||
set(XML_THREAD_LOCAL "__declspec(thread)")
|
||||
endif()
|
||||
endif()
|
||||
if(LIBXML2_WITH_TLS)
|
||||
check_c_source_compiles(
|
||||
"_Thread_local int v; int main(){return 0;}"
|
||||
XML_THREAD_LOCAL_C11
|
||||
)
|
||||
if (XML_THREAD_LOCAL_C11)
|
||||
set(XML_THREAD_LOCAL "_Thread_local")
|
||||
else()
|
||||
check_c_source_compiles(
|
||||
"__thread int v; int main(){return 0;}"
|
||||
XML_THREAD_LOCAL_THREAD
|
||||
)
|
||||
if (XML_THREAD_LOCAL_THREAD)
|
||||
set(XML_THREAD_LOCAL "__thread")
|
||||
else()
|
||||
check_c_source_compiles(
|
||||
"__declspec(thread) int v; int main(){return 0;}"
|
||||
XML_THREAD_LOCAL_DECLSPEC
|
||||
)
|
||||
if (XML_THREAD_LOCAL_DECLSPEC)
|
||||
set(XML_THREAD_LOCAL "__declspec(thread)")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(
|
||||
|
@ -408,7 +408,7 @@ XML_INCLUDEDIR='-I${includedir}/libxml2'
|
||||
XML_CFLAGS=""
|
||||
|
||||
dnl Thread-local storage
|
||||
if test "$with_tls" != "no"; then
|
||||
if test "$with_tls" = "yes"; then
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_SOURCE([_Thread_local int v;]) ], [
|
||||
AC_DEFINE([XML_THREAD_LOCAL], [_Thread_local], [TLS specifier]) ], [
|
||||
|
Loading…
x
Reference in New Issue
Block a user