sync handling of subsystems

- add DUMMY-define in case the subsystem is enabled but not available (filesystem/misc/locale)
- add missing PSP/VITA-filesystem defines
- sync the order of filesystems in SDL_config.h.cmake/in
- add option to disable locale subsystem in configure
This commit is contained in:
pionere 2022-01-10 17:00:32 +01:00 committed by Ryan C. Gordon
parent ea8cf4bd0f
commit 65e9415b98
5 changed files with 121 additions and 49 deletions

View File

@ -2568,19 +2568,19 @@ if(NOT HAVE_SDL_LOADSO)
set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES})
endif() endif()
if(NOT HAVE_SDL_FILESYSTEM) if(NOT HAVE_SDL_FILESYSTEM)
set(SDL_FILESYSTEM_DISABLED 1) set(SDL_FILESYSTEM_DUMMY 1)
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
endif() endif()
if(NOT HAVE_SDL_LOCALE) if(NOT HAVE_SDL_LOCALE)
set(SDL_LOCALE_DISABLED 1) set(SDL_LOCALE_DUMMY 1)
file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES})
endif() endif()
if(NOT HAVE_SDL_MISC) if(NOT HAVE_SDL_MISC)
set(SDL_MISC_DISABLED 1) set(SDL_MISC_DUMMY 1)
file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES})
endif() endif()
# We always need to have threads and timers around # We always need to have threads and timers around

77
configure vendored
View File

@ -823,6 +823,7 @@ enable_threads
enable_timers enable_timers
enable_file enable_file
enable_misc enable_misc
enable_locale
enable_loadso enable_loadso
enable_cpuinfo enable_cpuinfo
enable_assembly enable_assembly
@ -1601,6 +1602,7 @@ Optional Features:
--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]
--enable-locale Enable the locale subsystem [default=yes]
--enable-loadso Enable the shared object loading subsystem --enable-loadso Enable the shared object loading subsystem
[default=yes] [default=yes]
--enable-cpuinfo Enable the cpuinfo subsystem [default=yes] --enable-cpuinfo Enable the cpuinfo subsystem [default=yes]
@ -18116,6 +18118,20 @@ $as_echo "#define SDL_MISC_DISABLED 1" >>confdefs.h
else else
SUMMARY_modules="${SUMMARY_modules} misc" SUMMARY_modules="${SUMMARY_modules} misc"
fi fi
# Check whether --enable-locale was given.
if test "${enable_locale+set}" = set; then :
enableval=$enable_locale;
else
enable_locale=yes
fi
if test x$enable_locale != xyes; then
$as_echo "#define SDL_LOCALE_DISABLED 1" >>confdefs.h
else
SUMMARY_modules="${SUMMARY_modules} locale"
fi
# Check whether --enable-threads was given. # Check whether --enable-threads was given.
if test "${enable_threads+set}" = set; then : if test "${enable_threads+set}" = set; then :
enableval=$enable_threads; enableval=$enable_threads;
@ -25839,10 +25855,11 @@ $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
have_misc=yes have_misc=yes
fi fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
fi
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
case $ARCH in case $ARCH in
@ -26060,9 +26077,10 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
have_misc=yes have_misc=yes
fi fi
# Use the Windows locale APIs. # Use the Windows locale APIs.
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
have_locale=yes
fi
# Set up files for the video library # Set up files for the video library
if test x$enable_video = xyes; then if test x$enable_video = xyes; then
@ -26351,9 +26369,10 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
have_misc=yes have_misc=yes
fi fi
# Set up files for the locale library # Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
have_locale=yes
fi
# The Haiku platform requires special setup. # The Haiku platform requires special setup.
SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
@ -26379,9 +26398,10 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
have_misc=yes have_misc=yes
fi fi
# Set up files for the locale library # Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
fi
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
@ -26515,9 +26535,10 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
have_misc=yes have_misc=yes
fi fi
# Set up files for the locale library # Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
fi
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
@ -26683,8 +26704,10 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
have_timers=yes have_timers=yes
fi fi
# Set up files for the locale library # Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
have_locale=yes
fi
;; ;;
*-*-riscos*) *-*-riscos*)
ARCH=riscos ARCH=riscos
@ -26757,8 +26780,10 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
fi fi
# Use the Unix locale APIs. # Use the Unix locale APIs.
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
fi
# Set up files for the video library # Set up files for the video library
if test x$enable_video = xyes; then if test x$enable_video = xyes; then
@ -26856,9 +26881,19 @@ INSTALL_SDL2_CONFIG=$enable_sdl2_config
# Verify that we have all the platform specific files we need # Verify that we have all the platform specific files we need
if test x$have_misc != xyes; then if test x$have_misc != xyes; then
if test x$enable_misc = xyes; then
$as_echo "#define SDL_MISC_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c" SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c"
fi fi
if test x$have_locale != xyes; then if test x$have_locale != xyes; then
if test x$enable_locale = xyes; then
$as_echo "#define SDL_LOCALE_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c" SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
fi fi
if test x$have_joystick != xyes; then if test x$have_joystick != xyes; then
@ -26904,7 +26939,7 @@ fi
if test x$have_filesystem != xyes; then if test x$have_filesystem != xyes; then
if test x$enable_filesystem = xyes; then if test x$enable_filesystem = xyes; then
$as_echo "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h $as_echo "#define SDL_FILESYSTEM_DUMMY 1" >>confdefs.h
fi fi
SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c" SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"

View File

@ -535,6 +535,14 @@ if test x$enable_misc != xyes; then
else else
SUMMARY_modules="${SUMMARY_modules} misc" SUMMARY_modules="${SUMMARY_modules} misc"
fi fi
AC_ARG_ENABLE(locale,
[AS_HELP_STRING([--enable-locale], [Enable the locale subsystem [default=yes]])],
, enable_locale=yes)
if test x$enable_locale != xyes; then
AC_DEFINE(SDL_LOCALE_DISABLED, 1, [ ])
else
SUMMARY_modules="${SUMMARY_modules} locale"
fi
AC_ARG_ENABLE(loadso, AC_ARG_ENABLE(loadso,
[AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]])], [AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]])],
, enable_loadso=yes) , enable_loadso=yes)
@ -3728,10 +3736,11 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
have_misc=yes have_misc=yes
fi fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
fi
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
case $ARCH in case $ARCH in
@ -3915,9 +3924,10 @@ case "$host" in
have_misc=yes have_misc=yes
fi fi
# Use the Windows locale APIs. # Use the Windows locale APIs.
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
have_locale=yes
fi
# Set up files for the video library # Set up files for the video library
if test x$enable_video = xyes; then if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ]) AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
@ -4106,9 +4116,10 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
have_misc=yes have_misc=yes
fi fi
# Set up files for the locale library # Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
have_locale=yes
fi
# The Haiku platform requires special setup. # The Haiku platform requires special setup.
SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
@ -4134,9 +4145,10 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
have_misc=yes have_misc=yes
fi fi
# Set up files for the locale library # Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
fi
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
@ -4248,9 +4260,10 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
have_misc=yes have_misc=yes
fi fi
# Set up files for the locale library # Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
fi
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
@ -4388,8 +4401,10 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
have_timers=yes have_timers=yes
fi fi
# Set up files for the locale library # Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
have_locale=yes
fi
;; ;;
*-*-riscos*) *-*-riscos*)
ARCH=riscos ARCH=riscos
@ -4456,8 +4471,10 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
fi fi
# Use the Unix locale APIs. # Use the Unix locale APIs.
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" if test x$enable_locale = xyes; then
have_locale=yes SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
fi
# Set up files for the video library # Set up files for the video library
if test x$enable_video = xyes; then if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ]) AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ])
@ -4534,9 +4551,15 @@ AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config])
# Verify that we have all the platform specific files we need # Verify that we have all the platform specific files we need
if test x$have_misc != xyes; then if test x$have_misc != xyes; then
if test x$enable_misc = xyes; then
AC_DEFINE(SDL_MISC_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c" SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c"
fi fi
if test x$have_locale != xyes; then if test x$have_locale != xyes; then
if test x$enable_locale = xyes; then
AC_DEFINE(SDL_LOCALE_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c" SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
fi fi
if test x$have_joystick != xyes; then if test x$have_joystick != xyes; then
@ -4571,7 +4594,7 @@ if test x$have_timers != xyes; then
fi fi
if test x$have_filesystem != xyes; then if test x$have_filesystem != xyes; then
if test x$enable_filesystem = xyes; then if test x$enable_filesystem = xyes; then
AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ]) AC_DEFINE(SDL_FILESYSTEM_DUMMY, 1, [ ])
fi fi
SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c" SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
fi fi

View File

@ -493,6 +493,12 @@
#cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@ #cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@
#cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@ #cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@
/* Enable misc subsystem */
#cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@
/* Enable locale subsystem */
#cmakedefine SDL_LOCALE_DUMMY @SDL_LOCALE_DUMMY@
/* Enable assembly routines */ /* Enable assembly routines */
#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@

View File

@ -447,16 +447,24 @@
#undef SDL_POWER_HARDWIRED #undef SDL_POWER_HARDWIRED
/* Enable system filesystem support */ /* Enable system filesystem support */
#undef SDL_FILESYSTEM_ANDROID
#undef SDL_FILESYSTEM_HAIKU #undef SDL_FILESYSTEM_HAIKU
#undef SDL_FILESYSTEM_COCOA #undef SDL_FILESYSTEM_COCOA
#undef SDL_FILESYSTEM_DUMMY #undef SDL_FILESYSTEM_DUMMY
#undef SDL_FILESYSTEM_RISCOS
#undef SDL_FILESYSTEM_UNIX #undef SDL_FILESYSTEM_UNIX
#undef SDL_FILESYSTEM_WINDOWS #undef SDL_FILESYSTEM_WINDOWS
#undef SDL_FILESYSTEM_NACL #undef SDL_FILESYSTEM_NACL
#undef SDL_FILESYSTEM_ANDROID
#undef SDL_FILESYSTEM_EMSCRIPTEN #undef SDL_FILESYSTEM_EMSCRIPTEN
#undef SDL_FILESYSTEM_OS2 #undef SDL_FILESYSTEM_OS2
#undef SDL_FILESYSTEM_RISCOS #undef SDL_FILESYSTEM_VITA
#undef SDL_FILESYSTEM_PSP
/* Enable misc subsystem */
#undef SDL_MISC_DUMMY
/* Enable locale subsystem */
#undef SDL_LOCALE_DUMMY
/* Enable assembly routines */ /* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES #undef SDL_ASSEMBLY_ROUTINES