SDL: Threads are used by many SDL subsystems and may not be disabled.

From e4cc076a792dc782135c45688e2d63b9805c824e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 1 Aug 2022 09:15:44 -0700
Subject: [PATCH] Threads are used by many SDL subsystems and may not be
 disabled.

Fixes https://github.com/libsdl-org/SDL/issues/5095
---
 CMakeLists.txt |  7 ++++---
 configure.ac   | 17 +++++++++--------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 45128b2a711..8869ad6278a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2711,9 +2711,10 @@ endif()
 
 # We always need to have threads and timers around
 if(NOT HAVE_SDL_THREADS)
-  set(SDL_THREADS_DISABLED 1)
-  file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c)
-  list(APPEND SOURCE_FILES ${THREADS_SOURCES})
+  message_error("Threads are needed by many SDL subsystems and may not be disabled")
+  #set(SDL_THREADS_DISABLED 1)
+  #file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c)
+  #list(APPEND SOURCE_FILES ${THREADS_SOURCES})
 endif()
 if(NOT HAVE_SDL_TIMERS)
   set(SDL_TIMER_DUMMY 1)
diff --git a/configure.ac b/configure.ac
index fccb2a33b80..5d59cd90a50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -522,14 +522,15 @@ if test x$enable_filesystem != xyes; then
 else
     SUMMARY_modules="${SUMMARY_modules} filesystem"
 fi
-AC_ARG_ENABLE(threads,
-[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])],
-              , enable_threads=yes)
-if test x$enable_threads != xyes; then
-    AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} threads"
-fi
+# Many subsystems depend on threads, so leave them enabled by default
+#AC_ARG_ENABLE(threads,
+#[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])],
+#              , enable_threads=yes)
+#if test x$enable_threads != xyes; then
+#    AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
+#else
+#    SUMMARY_modules="${SUMMARY_modules} threads"
+#fi
 AC_ARG_ENABLE(timers,
 [AS_HELP_STRING([--enable-timers], [Enable the timer subsystem [default=yes]])],
               , enable_timers=yes)