Build: Define THREAD_LOCAL even if !WITH_TURBOJPEG

The SIMD dispatchers use thread-local storage now as well, because of
f579cc11b3.
This commit is contained in:
DRC
2023-02-01 11:54:09 -06:00
parent fd93d98a95
commit dd89ce6cd6

View File

@@ -468,19 +468,17 @@ if(NOT INLINE_WORKS)
endif() endif()
message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})") message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})")
if(WITH_TURBOJPEG) if(MSVC)
if(MSVC) set(THREAD_LOCAL "__declspec(thread)")
set(THREAD_LOCAL "__declspec(thread)") else()
else() set(THREAD_LOCAL "__thread")
set(THREAD_LOCAL "__thread") endif()
endif() check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL)
check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL) if(HAVE_THREAD_LOCAL)
if(HAVE_THREAD_LOCAL) message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}")
message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}") else()
else() message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.")
message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.") unset(THREAD_LOCAL)
unset(THREAD_LOCAL)
endif()
endif() endif()
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)