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.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2717273..3a074da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,7 @@
 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_TRIO OFF)
 set(LIBXML2_WITH_UNICODE ON)
@@ -195,28 +196,30 @@
 	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(
diff --git a/configure.ac b/configure.ac
index e5677c4..9cb7553 100644
--- a/configure.ac
+++ b/configure.ac
@@ -439,7 +439,7 @@
 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]) ], [