Allow emscripten platform to build without threads

This commit is contained in:
Sam Lantinga 2022-08-01 09:51:21 -07:00
parent e4cc076a79
commit 954bbdf3ae
3 changed files with 19 additions and 19 deletions

View File

@ -2711,10 +2711,14 @@ endif()
# We always need to have threads and timers around # We always need to have threads and timers around
if(NOT HAVE_SDL_THREADS) if(NOT HAVE_SDL_THREADS)
# The emscripten platform has been carefully vetted to work without threads
if (EMSCRIPTEN)
set(SDL_THREADS_DISABLED 1)
file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c)
list(APPEND SOURCE_FILES ${THREADS_SOURCES})
else()
message_error("Threads are needed by many SDL subsystems and may not be disabled") message_error("Threads are needed by many SDL subsystems and may not be disabled")
#set(SDL_THREADS_DISABLED 1) endif()
#file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c)
#list(APPEND SOURCE_FILES ${THREADS_SOURCES})
endif() endif()
if(NOT HAVE_SDL_TIMERS) if(NOT HAVE_SDL_TIMERS)
set(SDL_TIMER_DUMMY 1) set(SDL_TIMER_DUMMY 1)

15
configure vendored
View File

@ -852,7 +852,6 @@ enable_hidapi
enable_sensor enable_sensor
enable_power enable_power
enable_filesystem enable_filesystem
enable_threads
enable_timers enable_timers
enable_file enable_file
enable_misc enable_misc
@ -1643,7 +1642,6 @@ Optional Features:
--enable-sensor Enable the sensor subsystem [default=yes] --enable-sensor Enable the sensor subsystem [default=yes]
--enable-power Enable the power subsystem [default=yes] --enable-power Enable the power subsystem [default=yes]
--enable-filesystem Enable the filesystem subsystem [default=yes] --enable-filesystem Enable the filesystem subsystem [default=yes]
--enable-threads Enable the threading subsystem [default=yes]
--enable-timers Enable the timer subsystem [default=yes] --enable-timers Enable the timer subsystem [default=yes]
--enable-file Enable the file subsystem [default=yes] --enable-file Enable the file subsystem [default=yes]
--enable-misc Enable the misc subsystem [default=yes] --enable-misc Enable the misc subsystem [default=yes]
@ -20351,14 +20349,11 @@ printf "%s\n" "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h
else else
SUMMARY_modules="${SUMMARY_modules} filesystem" SUMMARY_modules="${SUMMARY_modules} filesystem"
fi fi
# Check whether --enable-threads was given. # Many subsystems depend on threads, so leave them enabled by default
if test ${enable_threads+y} #AC_ARG_ENABLE(threads,
then : #[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])],
enableval=$enable_threads; # , enable_threads=yes)
else $as_nop enable_threads=yes
enable_threads=yes
fi
if test x$enable_threads != xyes; then if test x$enable_threads != xyes; then
printf "%s\n" "#define SDL_THREADS_DISABLED 1" >>confdefs.h printf "%s\n" "#define SDL_THREADS_DISABLED 1" >>confdefs.h

View File

@ -526,11 +526,12 @@ fi
#AC_ARG_ENABLE(threads, #AC_ARG_ENABLE(threads,
#[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])], #[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])],
# , enable_threads=yes) # , enable_threads=yes)
#if test x$enable_threads != xyes; then enable_threads=yes
# AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ]) if test x$enable_threads != xyes; then
#else AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
# SUMMARY_modules="${SUMMARY_modules} threads" else
#fi SUMMARY_modules="${SUMMARY_modules} threads"
fi
AC_ARG_ENABLE(timers, AC_ARG_ENABLE(timers,
[AS_HELP_STRING([--enable-timers], [Enable the timer subsystem [default=yes]])], [AS_HELP_STRING([--enable-timers], [Enable the timer subsystem [default=yes]])],
, enable_timers=yes) , enable_timers=yes)