1
0
Эх сурвалжийг харах

Remove SDL_config.h from the public headers

The SDL headers are no longer dependent on the build configuration.

Fixes https://github.com/libsdl-org/SDL/issues/6643 and https://github.com/libsdl-org/SDL/issues/6641
Sam Lantinga 2 жил өмнө
parent
commit
63f307fe1f
100 өөрчлөгдсөн 334 нэмэгдсэн , 477 устгасан
  1. 9 12
      CMakeLists.txt
  2. 0 2
      VisualC-GDK/SDL/SDL.vcxproj
  3. 0 6
      VisualC-GDK/SDL/SDL.vcxproj.filters
  4. 0 3
      VisualC-WinRT/SDL-UWP.vcxproj
  5. 1 10
      VisualC-WinRT/SDL-UWP.vcxproj.filters
  6. 0 2
      VisualC/SDL/SDL.vcxproj
  7. 0 6
      VisualC/SDL/SDL.vcxproj.filters
  8. 1 0
      WhatsNew.txt
  9. 8 40
      Xcode/SDL/SDL.xcodeproj/project.pbxproj
  10. 0 4
      build-scripts/android-prefab.sh
  11. 2 2
      cmake/sdlchecks.cmake
  12. 1 1
      docs/README-cmake.md
  13. 1 0
      docs/README-migration.md
  14. 1 4
      docs/README-porting.md
  15. 2 2
      include/SDL_endian.h
  16. 1 1
      include/SDL_opengl.h
  17. 1 1
      include/SDL_opengles.h
  18. 1 1
      include/SDL_opengles2.h
  19. 11 88
      include/SDL_stdinc.h
  20. 15 15
      include/build_config/SDL_build_config.h
  21. 4 4
      include/build_config/SDL_build_config.h.cmake
  22. 17 19
      include/build_config/SDL_build_config_android.h
  23. 6 10
      include/build_config/SDL_build_config_emscripten.h
  24. 17 19
      include/build_config/SDL_build_config_ios.h
  25. 18 21
      include/build_config/SDL_build_config_macos.h
  26. 5 5
      include/build_config/SDL_build_config_minimal.h
  27. 4 4
      include/build_config/SDL_build_config_ngage.h
  28. 8 11
      include/build_config/SDL_build_config_windows.h
  29. 8 8
      include/build_config/SDL_build_config_wingdk.h
  30. 8 11
      include/build_config/SDL_build_config_winrt.h
  31. 8 8
      include/build_config/SDL_build_config_xbox.h
  32. 0 3
      src/SDL_assert.c
  33. 1 0
      src/SDL_assert_c.h
  34. 53 1
      src/SDL_internal.h
  35. 1 0
      src/SDL_utils_c.h
  36. 1 1
      src/core/winrt/SDL_winrtapp_common.h
  37. 1 1
      src/core/winrt/SDL_winrtapp_xaml.h
  38. 1 3
      src/cpuinfo/SDL_cpuinfo.c
  39. 5 1
      src/dynapi/SDL_dynapi.c
  40. 1 0
      src/dynapi/SDL_dynapi_overrides.h
  41. 1 0
      src/dynapi/SDL_dynapi_procs.h
  42. 1 1
      src/events/SDL_quit.c
  43. 21 3
      src/haptic/android/SDL_syshaptic_c.h
  44. 1 1
      src/locale/SDL_syslocale.h
  45. 0 1
      src/main/gdk/SDL_gdk_main.c
  46. 2 1
      src/main/ps2/SDL_ps2_main.c
  47. 1 1
      src/main/psp/SDL_psp_main.c
  48. 1 1
      src/main/windows/SDL_windows_main.c
  49. 1 2
      src/sensor/SDL_sensor_c.h
  50. 1 2
      src/sensor/SDL_syssensor.h
  51. 0 2
      src/sensor/android/SDL_androidsensor.c
  52. 1 1
      src/sensor/android/SDL_androidsensor.h
  53. 1 1
      src/sensor/coremotion/SDL_coremotionsensor.h
  54. 1 2
      src/sensor/coremotion/SDL_coremotionsensor.m
  55. 0 2
      src/sensor/dummy/SDL_dummysensor.c
  56. 1 1
      src/sensor/dummy/SDL_dummysensor.h
  57. 1 2
      src/sensor/vita/SDL_vitasensor.c
  58. 1 1
      src/sensor/vita/SDL_vitasensor.h
  59. 0 2
      src/sensor/windows/SDL_windowssensor.c
  60. 1 1
      src/sensor/windows/SDL_windowssensor.h
  61. 33 0
      src/stdlib/SDL_stdlib.c
  62. 0 1
      src/stdlib/SDL_string.c
  63. 0 3
      src/test/SDL_test_assert.c
  64. 0 4
      src/test/SDL_test_common.c
  65. 0 3
      src/test/SDL_test_compare.c
  66. 0 3
      src/test/SDL_test_crc32.c
  67. 0 2
      src/test/SDL_test_font.c
  68. 3 19
      src/test/SDL_test_fuzzer.c
  69. 1 7
      src/test/SDL_test_harness.c
  70. 0 2
      src/test/SDL_test_imageBlit.c
  71. 0 2
      src/test/SDL_test_imageBlitBlend.c
  72. 0 2
      src/test/SDL_test_imageFace.c
  73. 0 2
      src/test/SDL_test_imagePrimitives.c
  74. 0 2
      src/test/SDL_test_imagePrimitivesBlend.c
  75. 2 9
      src/test/SDL_test_log.c
  76. 0 3
      src/test/SDL_test_md5.c
  77. 0 1
      src/test/SDL_test_memory.c
  78. 3 7
      src/test/SDL_test_random.c
  79. 1 1
      src/thread/stdcpp/SDL_sysmutex_c.h
  80. 1 1
      src/thread/stdcpp/SDL_systhread_c.h
  81. 1 1
      src/video/winrt/SDL_winrtevents_c.h
  82. 1 1
      src/video/winrt/SDL_winrtgamebar_cpp.h
  83. 1 1
      src/video/winrt/SDL_winrtmouse_c.h
  84. 1 1
      src/video/winrt/SDL_winrtopengles.h
  85. 12 1
      test/CMakeLists.txt
  86. 0 2
      test/checkkeys.c
  87. 0 1
      test/checkkeysthreads.c
  88. 0 14
      test/controllermap.c
  89. 0 3
      test/loopwave.c
  90. 0 1
      test/loopwavequeue.c
  91. 0 2
      test/testatomic.c
  92. 3 1
      test/testaudiocapture.c
  93. 0 3
      test/testaudiohotplug.c
  94. 2 1
      test/testaudioinfo.c
  95. 0 2
      test/testautomation.c
  96. 2 1
      test/testautomation_audio.c
  97. 2 4
      test/testautomation_clipboard.c
  98. 2 3
      test/testautomation_events.c
  99. 2 0
      test/testautomation_guid.c
  100. 2 2
      test/testautomation_hints.c

+ 9 - 12
CMakeLists.txt

@@ -56,7 +56,6 @@ endif()
 #cmake_policy(SET CMP0042 OLD)
 
 include(CheckLibraryExists)
-include(CheckIncludeFiles)
 include(CheckIncludeFile)
 include(CheckLanguage)
 include(CheckSymbolExists)
@@ -1038,7 +1037,6 @@ if(SDL_LIBC)
       set(HAVE_${_UPPER} 1)
     endforeach()
     set(HAVE_ALLOCA 1)
-    set(STDC_HEADERS 1)
   else()
     set(HAVE_LIBC TRUE)
     set(headers_to_check
@@ -1072,7 +1070,6 @@ if(SDL_LIBC)
     check_include_file(linux/input.h HAVE_LINUX_INPUT_H)
 
     set(STDC_HEADER_NAMES "stddef.h;stdarg.h;stdlib.h;string.h;stdio.h;wchar.h;float.h")
-    check_include_files("${STDC_HEADER_NAMES}" STDC_HEADERS)
     # TODO: refine the mprotect check
     check_c_source_compiles("#include <sys/types.h>
                              #include <sys/mman.h>
@@ -2897,17 +2894,18 @@ endif()
 #   endif()
 # endif()
 
-# config variables may contain generator expression, so we need to generate SDL_config.h in 2 steps:
+# config variables may contain generator expression, so we need to generate SDL_build_config.h in 2 steps:
 # 1. replace all `#cmakedefine`'s and `@abc@`
-configure_file("${SDL3_SOURCE_DIR}/include/SDL_config.h.cmake"
-  "${SDL3_BINARY_DIR}/SDL_config.h.intermediate")
+configure_file("${SDL3_SOURCE_DIR}/include/build_config/SDL_build_config.h.cmake"
+  "${SDL3_BINARY_DIR}/SDL_build_config.h.intermediate")
 # 2. Create the "include-config-${CMAKE_BUILD_TYPE}" folder (fails on older CMake versions when it does not exist)
 string(TOLOWER "${CMAKE_BUILD_TYPE}" lower_build_type)
 execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include-config-${lower_build_type}")
-# 3. generate SDL_config in an build_type-dependent folder (which should be first in the include search path)
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include-config-${lower_build_type}/build_config")
+# 3. generate SDL_build_config.h in an build_type-dependent folder (which should be first in the include search path)
 file(GENERATE
-    OUTPUT "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL_config.h"
-    INPUT "${SDL3_BINARY_DIR}/SDL_config.h.intermediate")
+    OUTPUT "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/build_config/SDL_build_config.h"
+    INPUT "${SDL3_BINARY_DIR}/SDL_build_config.h.intermediate")
 
 # Prepare the flags and remove duplicates
 if(EXTRA_LDFLAGS)
@@ -2960,11 +2958,11 @@ configure_file("${SDL3_SOURCE_DIR}/include/SDL_revision.h.cmake"
   "${SDL3_BINARY_DIR}/include/SDL_revision.h")
 
 # Copy all non-generated headers to "${SDL3_BINARY_DIR}/include"
-# This is done to avoid the inclusion of a pre-generated SDL_config.h
+# This is done to avoid the inclusion of a pre-generated SDL_build_config.h
 file(GLOB SDL3_INCLUDE_FILES ${SDL3_SOURCE_DIR}/include/*.h)
 set(SDL3_COPIED_INCLUDE_FILES)
 foreach(_hdr IN LISTS SDL3_INCLUDE_FILES)
-  if(_hdr MATCHES ".*(SDL_config|SDL_revision).*")
+  if(_hdr MATCHES ".*SDL_revision.h")
     list(REMOVE_ITEM SDL3_INCLUDE_FILES "${_hdr}")
   else()
     get_filename_component(_name "${_hdr}" NAME)
@@ -3455,7 +3453,6 @@ if(NOT SDL3_DISABLE_INSTALL)
     FILES
       ${SDL3_INCLUDE_FILES}
       "${SDL3_BINARY_DIR}/include/SDL_revision.h"
-      "${SDL3_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL_config.h"
     DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL3)
 
   install(FILES "LICENSE.txt" DESTINATION "${LICENSES_PREFIX}")

+ 0 - 2
VisualC-GDK/SDL/SDL.vcxproj

@@ -299,8 +299,6 @@
     <ClInclude Include="..\..\include\SDL_bits.h" />
     <ClInclude Include="..\..\include\SDL_blendmode.h" />
     <ClInclude Include="..\..\include\SDL_clipboard.h" />
-    <ClInclude Include="..\..\include\SDL_config.h" />
-    <ClInclude Include="..\..\include\SDL_config_wingdk.h" />
     <ClInclude Include="..\..\include\SDL_copying.h" />
     <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
     <ClInclude Include="..\..\include\SDL_egl.h" />

+ 0 - 6
VisualC-GDK/SDL/SDL.vcxproj.filters

@@ -201,9 +201,6 @@
     <ClInclude Include="..\..\include\SDL_clipboard.h">
       <Filter>API Headers</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\include\SDL_config.h">
-      <Filter>API Headers</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\include\SDL_copying.h">
       <Filter>API Headers</Filter>
     </ClInclude>
@@ -824,9 +821,6 @@
       <Filter>render\direct3d12</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\hidapi\SDL_hidapi_c.h" />
-    <ClInclude Include="..\..\include\SDL_config_wingdk.h">
-      <Filter>API Headers</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\core\gdk\SDL_gdk.h">
       <Filter>core\gdk</Filter>
     </ClInclude>

+ 0 - 3
VisualC-WinRT/SDL-UWP.vcxproj

@@ -43,9 +43,6 @@
     <ClInclude Include="..\include\SDL_audio.h" />
     <ClInclude Include="..\include\SDL_blendmode.h" />
     <ClInclude Include="..\include\SDL_clipboard.h" />
-    <ClInclude Include="..\include\SDL_config.h" />
-    <ClInclude Include="..\include\SDL_config_minimal.h" />
-    <ClInclude Include="..\include\SDL_config_winrt.h" />
     <ClInclude Include="..\include\SDL_copying.h" />
     <ClInclude Include="..\include\SDL_cpuinfo.h" />
     <ClInclude Include="..\include\SDL_egl.h" />

+ 1 - 10
VisualC-WinRT/SDL-UWP.vcxproj.filters

@@ -33,15 +33,6 @@
     <ClInclude Include="..\include\SDL_clipboard.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\include\SDL_config.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\include\SDL_config_minimal.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\include\SDL_config_winrt.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\include\SDL_copying.h">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -846,4 +837,4 @@
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
-</Project>
+</Project>

+ 0 - 2
VisualC/SDL/SDL.vcxproj

@@ -223,8 +223,6 @@
     <ClInclude Include="..\..\include\SDL_bits.h" />
     <ClInclude Include="..\..\include\SDL_blendmode.h" />
     <ClInclude Include="..\..\include\SDL_clipboard.h" />
-    <ClInclude Include="..\..\include\SDL_config.h" />
-    <ClInclude Include="..\..\include\SDL_config_windows.h" />
     <ClInclude Include="..\..\include\SDL_copying.h" />
     <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
     <ClInclude Include="..\..\include\SDL_egl.h" />

+ 0 - 6
VisualC/SDL/SDL.vcxproj.filters

@@ -198,12 +198,6 @@
     <ClInclude Include="..\..\include\SDL_clipboard.h">
       <Filter>API Headers</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\include\SDL_config.h">
-      <Filter>API Headers</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\include\SDL_config_windows.h">
-      <Filter>API Headers</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\include\SDL_copying.h">
       <Filter>API Headers</Filter>
     </ClInclude>

+ 1 - 0
WhatsNew.txt

@@ -18,3 +18,4 @@ General:
 	* SDL_RWFromFP()
 	* SDL_SetWindowBrightness()
 	* SDL_SetWindowGammaRamp()
+* SDL_stdinc.h no longer includes stdio.h, stdlib.h, etc., it only provides the SDL C runtime functionality

+ 8 - 40
Xcode/SDL/SDL.xcodeproj/project.pbxproj

@@ -167,7 +167,6 @@
 		A75FCD1723E25AB700529352 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A75FCD1823E25AB700529352 /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A57023E2513D00DCD162 /* SDL_dataqueue.h */; };
 		A75FCD1923E25AB700529352 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A57523E2513D00DCD162 /* SDL_error_c.h */; };
-		A75FCD1B23E25AB700529352 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A75FCD1C23E25AB700529352 /* SDL_d3dmath.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8DC23E2514000DCD162 /* SDL_d3dmath.h */; };
 		A75FCD1F23E25AB700529352 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A60423E2513D00DCD162 /* SDL_egl_c.h */; };
 		A75FCD2023E25AB700529352 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -543,7 +542,6 @@
 		A75FCED023E25AC700529352 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A75FCED123E25AC700529352 /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A57023E2513D00DCD162 /* SDL_dataqueue.h */; };
 		A75FCED223E25AC700529352 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A57523E2513D00DCD162 /* SDL_error_c.h */; };
-		A75FCED423E25AC700529352 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A75FCED523E25AC700529352 /* SDL_d3dmath.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8DC23E2514000DCD162 /* SDL_d3dmath.h */; };
 		A75FCED823E25AC700529352 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A60423E2513D00DCD162 /* SDL_egl_c.h */; };
 		A75FCED923E25AC700529352 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -896,12 +894,6 @@
 		A75FDAC023E28B8000529352 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A75FDABF23E28B8000529352 /* CoreMotion.framework */; };
 		A75FDAC223E28B9600529352 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A75FDAC123E28B9600529352 /* CoreGraphics.framework */; };
 		A75FDAC423E28BA700529352 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A75FDAC323E28BA700529352 /* CoreBluetooth.framework */; };
-		A75FDAF623E35EC400529352 /* SDL_config_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDAF523E35EC400529352 /* SDL_config_ios.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		A75FDAF723E35EC400529352 /* SDL_config_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDAF523E35EC400529352 /* SDL_config_ios.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		A75FDAF823E35ED500529352 /* SDL_config_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDAF523E35EC400529352 /* SDL_config_ios.h */; };
-		A75FDAF923E35ED500529352 /* SDL_config_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDAF523E35EC400529352 /* SDL_config_ios.h */; };
-		A75FDAFA23E35ED600529352 /* SDL_config_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDAF523E35EC400529352 /* SDL_config_ios.h */; };
-		A75FDAFB23E35ED700529352 /* SDL_config_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDAF523E35EC400529352 /* SDL_config_ios.h */; };
 		A75FDB5823E39E6100529352 /* hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDB5723E39E6100529352 /* hidapi.h */; };
 		A75FDB5923E39E6100529352 /* hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDB5723E39E6100529352 /* hidapi.h */; };
 		A75FDB5A23E39E6100529352 /* hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDB5723E39E6100529352 /* hidapi.h */; };
@@ -1257,7 +1249,6 @@
 		A7D88A1F23E2437C00DCD162 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A7D88A2023E2437C00DCD162 /* SDL_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */; };
 		A7D88A2123E2437C00DCD162 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		A7D88A2323E2437C00DCD162 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A7D88A2523E2437C00DCD162 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A7D88A2623E2437C00DCD162 /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A7D88A2723E2437C00DCD162 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1325,7 +1316,6 @@
 		A7D88BD623E24BED00DCD162 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A7D88BD723E24BED00DCD162 /* SDL_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */; };
 		A7D88BD823E24BED00DCD162 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		A7D88BDA23E24BED00DCD162 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A7D88BDC23E24BED00DCD162 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A7D88BDD23E24BED00DCD162 /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A7D88BDE23E24BED00DCD162 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -3250,8 +3240,6 @@
 		AA7558021595D4D800BBD41B /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CB1595D4D800BBD41B /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		AA7558081595D4D800BBD41B /* SDL_config_macos.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CE1595D4D800BBD41B /* SDL_config_macos.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		AA75580C1595D4D800BBD41B /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		AA75580E1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		AA7558101595D4D800BBD41B /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -3315,8 +3303,6 @@
 		DB313FCC17554B71006C0E22 /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CB1595D4D800BBD41B /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DB313FCD17554B71006C0E22 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DB313FCE17554B71006C0E22 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		DB313FCF17554B71006C0E22 /* SDL_config_macos.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CE1595D4D800BBD41B /* SDL_config_macos.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		DB313FD017554B71006C0E22 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DB313FD117554B71006C0E22 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DB313FD217554B71006C0E22 /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DB313FD317554B71006C0E22 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -3713,7 +3699,6 @@
 		A75FDABF23E28B8000529352 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
 		A75FDAC123E28B9600529352 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
 		A75FDAC323E28BA700529352 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; };
-		A75FDAF523E35EC400529352 /* SDL_config_ios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_ios.h; sourceTree = "<group>"; };
 		A75FDB5723E39E6100529352 /* hidapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hidapi.h; path = hidapi/hidapi.h; sourceTree = "<group>"; };
 		A75FDB9223E4C8DB00529352 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hid.c; sourceTree = "<group>"; };
 		A75FDBA323E4CB6F00529352 /* LICENSE-bsd.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "LICENSE-bsd.txt"; sourceTree = "<group>"; };
@@ -4047,8 +4032,6 @@
 		AA7557CB1595D4D800BBD41B /* SDL_audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio.h; sourceTree = "<group>"; };
 		AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendmode.h; sourceTree = "<group>"; };
 		AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboard.h; sourceTree = "<group>"; };
-		AA7557CE1595D4D800BBD41B /* SDL_config_macos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_macos.h; sourceTree = "<group>"; };
-		AA7557CF1595D4D800BBD41B /* SDL_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config.h; sourceTree = "<group>"; };
 		AA7557D01595D4D800BBD41B /* SDL_copying.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_copying.h; sourceTree = "<group>"; };
 		AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cpuinfo.h; sourceTree = "<group>"; };
 		AA7557D21595D4D800BBD41B /* SDL_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_endian.h; sourceTree = "<group>"; };
@@ -4318,9 +4301,6 @@
 				AADA5B8616CCAB3000107CF7 /* SDL_bits.h */,
 				AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */,
 				AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */,
-				A75FDAF523E35EC400529352 /* SDL_config_ios.h */,
-				AA7557CE1595D4D800BBD41B /* SDL_config_macos.h */,
-				AA7557CF1595D4D800BBD41B /* SDL_config.h */,
 				AA7557D01595D4D800BBD41B /* SDL_copying.h */,
 				AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */,
 				5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */,
@@ -5415,7 +5395,6 @@
 				A75FCD1723E25AB700529352 /* SDL_clipboard.h in Headers */,
 				A75FCD1823E25AB700529352 /* SDL_dataqueue.h in Headers */,
 				A75FCD1923E25AB700529352 /* SDL_error_c.h in Headers */,
-				A75FCD1B23E25AB700529352 /* SDL_config.h in Headers */,
 				A75FCD1C23E25AB700529352 /* SDL_d3dmath.h in Headers */,
 				A75FCD1F23E25AB700529352 /* SDL_egl_c.h in Headers */,
 				A75FCD2023E25AB700529352 /* SDL_copying.h in Headers */,
@@ -5502,7 +5481,6 @@
 				A75FCD7323E25AB700529352 /* SDL_yuv_c.h in Headers */,
 				A75FCD7423E25AB700529352 /* scancodes_xfree86.h in Headers */,
 				A75FCD7523E25AB700529352 /* SDL_syspower.h in Headers */,
-				A75FDAFA23E35ED600529352 /* SDL_config_ios.h in Headers */,
 				A75FCD7723E25AB700529352 /* SDL_name.h in Headers */,
 				A75FCD7823E25AB700529352 /* eglext.h in Headers */,
 				A75FCD7923E25AB700529352 /* SDL_events_c.h in Headers */,
@@ -5644,7 +5622,6 @@
 				A75FCED023E25AC700529352 /* SDL_clipboard.h in Headers */,
 				A75FCED123E25AC700529352 /* SDL_dataqueue.h in Headers */,
 				A75FCED223E25AC700529352 /* SDL_error_c.h in Headers */,
-				A75FCED423E25AC700529352 /* SDL_config.h in Headers */,
 				A75FCED523E25AC700529352 /* SDL_d3dmath.h in Headers */,
 				A75FCED823E25AC700529352 /* SDL_egl_c.h in Headers */,
 				A75FCED923E25AC700529352 /* SDL_copying.h in Headers */,
@@ -5731,7 +5708,6 @@
 				A75FCF2C23E25AC700529352 /* SDL_yuv_c.h in Headers */,
 				A75FCF2D23E25AC700529352 /* scancodes_xfree86.h in Headers */,
 				A75FCF2E23E25AC700529352 /* SDL_syspower.h in Headers */,
-				A75FDAFB23E35ED700529352 /* SDL_config_ios.h in Headers */,
 				A75FCF3023E25AC700529352 /* SDL_name.h in Headers */,
 				A75FCF3123E25AC700529352 /* eglext.h in Headers */,
 				A75FCF3223E25AC700529352 /* SDL_events_c.h in Headers */,
@@ -5927,7 +5903,6 @@
 				A769B0FB23E259AE00872273 /* SDL_yuv_c.h in Headers */,
 				A769B0FC23E259AE00872273 /* scancodes_xfree86.h in Headers */,
 				A769B0FD23E259AE00872273 /* SDL_syspower.h in Headers */,
-				A75FDAF923E35ED500529352 /* SDL_config_ios.h in Headers */,
 				A769B10023E259AE00872273 /* eglext.h in Headers */,
 				A769B10123E259AE00872273 /* SDL_events_c.h in Headers */,
 				A769B10223E259AE00872273 /* math_private.h in Headers */,
@@ -6046,8 +6021,6 @@
 				A7D8AF0123E2514100DCD162 /* SDL_cocoavideo.h in Headers */,
 				A7D8AEE923E2514100DCD162 /* SDL_cocoavulkan.h in Headers */,
 				A7D8AEFB23E2514100DCD162 /* SDL_cocoawindow.h in Headers */,
-				A7D88A2323E2437C00DCD162 /* SDL_config.h in Headers */,
-				A75FDAF623E35EC400529352 /* SDL_config_ios.h in Headers */,
 				A7D88A2523E2437C00DCD162 /* SDL_copying.h in Headers */,
 				A7D8B8CD23E2514400DCD162 /* SDL_coreaudio.h in Headers */,
 				A7D8A97023E2514000DCD162 /* SDL_coremotionsensor.h in Headers */,
@@ -6280,8 +6253,6 @@
 				A7D8AF0223E2514100DCD162 /* SDL_cocoavideo.h in Headers */,
 				A7D8AEEA23E2514100DCD162 /* SDL_cocoavulkan.h in Headers */,
 				A7D8AEFC23E2514100DCD162 /* SDL_cocoawindow.h in Headers */,
-				A7D88BDA23E24BED00DCD162 /* SDL_config.h in Headers */,
-				A75FDAF723E35EC400529352 /* SDL_config_ios.h in Headers */,
 				A7D88BDC23E24BED00DCD162 /* SDL_copying.h in Headers */,
 				A7D8B8CE23E2514400DCD162 /* SDL_coreaudio.h in Headers */,
 				A7D8A97123E2514000DCD162 /* SDL_coremotionsensor.h in Headers */,
@@ -6564,7 +6535,6 @@
 				A7D8B3B423E2514200DCD162 /* SDL_yuv_c.h in Headers */,
 				A7D8BBA323E2514500DCD162 /* scancodes_xfree86.h in Headers */,
 				A7D8B5D923E2514300DCD162 /* SDL_syspower.h in Headers */,
-				A75FDAF823E35ED500529352 /* SDL_config_ios.h in Headers */,
 				A7D8B24623E2514200DCD162 /* eglext.h in Headers */,
 				A7D8BBA923E2514500DCD162 /* SDL_events_c.h in Headers */,
 				A7D8BAC523E2514500DCD162 /* math_private.h in Headers */,
@@ -6683,8 +6653,6 @@
 				A7D8AF0023E2514100DCD162 /* SDL_cocoavideo.h in Headers */,
 				A7D8AEE823E2514100DCD162 /* SDL_cocoavulkan.h in Headers */,
 				A7D8AEFA23E2514100DCD162 /* SDL_cocoawindow.h in Headers */,
-				AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */,
-				AA7558081595D4D800BBD41B /* SDL_config_macos.h in Headers */,
 				AA75580C1595D4D800BBD41B /* SDL_copying.h in Headers */,
 				A7D8B8CC23E2514400DCD162 /* SDL_coreaudio.h in Headers */,
 				A7D8A96F23E2514000DCD162 /* SDL_coremotionsensor.h in Headers */,
@@ -7082,9 +7050,7 @@
 				DB313FCE17554B71006C0E22 /* SDL_clipboard.h in Headers */,
 				A7D8A94A23E2514000DCD162 /* SDL_dataqueue.h in Headers */,
 				A7D8A96223E2514000DCD162 /* SDL_error_c.h in Headers */,
-				DB313FD017554B71006C0E22 /* SDL_config.h in Headers */,
 				A7D8B98523E2514400DCD162 /* SDL_d3dmath.h in Headers */,
-				DB313FCF17554B71006C0E22 /* SDL_config_macos.h in Headers */,
 				A7D8ABDE23E2514100DCD162 /* SDL_egl_c.h in Headers */,
 				DB313FD117554B71006C0E22 /* SDL_copying.h in Headers */,
 				F382338B2738EB8600F7F527 /* SDL_hidapi.h in Headers */,
@@ -9546,10 +9512,11 @@
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
-					/usr/X11R6/include,
-					"$(VULKAN_SDK)/include",
-					../../src/video/khronos,
+					../../include,
 					../../src/hidapi/hidapi,
+					../../src/video/khronos,
+					"$(VULKAN_SDK)/include",
+					/usr/X11R6/include,
 				);
 				INFOPLIST_FILE = "Info-Framework.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@@ -9631,10 +9598,11 @@
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
-					/usr/X11R6/include,
-					"$(VULKAN_SDK)/include",
-					../../src/video/khronos,
+					../../include,
 					../../src/hidapi/hidapi,
+					../../src/video/khronos,
+					"$(VULKAN_SDK)/include",
+					/usr/X11R6/include,
 				);
 				INFOPLIST_FILE = "Info-Framework.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 9.0;

+ 0 - 4
build-scripts/android-prefab.sh

@@ -204,8 +204,6 @@ create_shared_sdl_module() {
 EOF
         mkdir -p "${sdl_moduleworkdir}/include"
         cp -r "${abi_build_prefix}/include/SDL${sdl_major}/"* "${sdl_moduleworkdir}/include/"
-        rm "${sdl_moduleworkdir}/include/SDL_config.h"
-        cp "$sdl_root/include/SDL_config.h" "$sdl_root/include/SDL_config_android.h" "${sdl_moduleworkdir}/include/"
 
         abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
         mkdir -p "${abi_sdllibdir}"
@@ -238,8 +236,6 @@ create_static_sdl_module() {
 EOF
         mkdir -p "${sdl_moduleworkdir}/include"
         cp -r "${abi_build_prefix}/include/SDL${sdl_major}/"* "${sdl_moduleworkdir}/include"
-        rm "${sdl_moduleworkdir}/include/SDL_config.h"
-        cp "$sdl_root/include/SDL_config.h" "$sdl_root/include/SDL_config_android.h" "${sdl_moduleworkdir}/include/"
 
         abi_sdllibdir="${sdl_moduleworkdir}/libs/android.${android_abi}"
         mkdir -p "${abi_sdllibdir}"

+ 2 - 2
cmake/sdlchecks.cmake

@@ -834,8 +834,8 @@ macro(CheckPTHREAD)
         endif()
       endif()
 
-      check_include_files("pthread.h" HAVE_PTHREAD_H)
-      check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H)
+      check_include_file(pthread.h HAVE_PTHREAD_H)
+      check_include_file(pthread_np.h HAVE_PTHREAD_NP_H)
       if (HAVE_PTHREAD_H)
         check_c_source_compiles("
             #define _GNU_SOURCE 1

+ 1 - 1
docs/README-cmake.md

@@ -105,7 +105,7 @@ When using a recent version of CMake (3.14+), it should be possible to:
 
 - build SDL for iOS, both static and dynamic
 - build SDL test apps (as iOS/tvOS .app bundles)
-- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
+- generate a working SDL_build_config.h for iOS (using SDL_build_config.h.cmake as a basis)
 
 To use, set the following CMake variables when running CMake's configuration stage:
 

+ 1 - 0
docs/README-migration.md

@@ -130,6 +130,7 @@ SDL_RWFromFP(void *fp, SDL_bool autoclose)
 
 ## SDL_stdinc.h
 
+The standard C headers like stdio.h and stdlib.h are no longer included, you should include them directly in your project if you use non-SDL C runtime functions.
 M_PI is no longer defined in SDL_stdinc.h, you can use the new symbols SDL_PI_D (double) and SDL_PI_F (float) instead.
 
 

+ 1 - 4
docs/README-porting.md

@@ -23,10 +23,7 @@ There are two basic ways of building SDL at the moment:
 
 2. Using an IDE:
 
-   If you're using an IDE or other non-configure build system, you'll probably
-   want to create a custom SDL_config.h for your platform.  Edit SDL_config.h,
-   add a section for your platform, and create a custom SDL_config_{platform}.h,
-   based on SDL_config_minimal.h and SDL_config.h.in
+   If you're using an IDE or other non-configure build system, you'll probably want to create a custom `SDL_build_config.h` for your platform.  Edit `include/build_config/SDL_build_config.h`, add a section for your platform, and create a custom `SDL_build_config_{platform}.h`, based on `SDL_build_config_minimal.h` and `SDL_build_config.h.cmake`
 
    Add the top level include directory to the header search path, and then add
    the following sources to the project:

+ 2 - 2
include/SDL_endian.h

@@ -55,7 +55,7 @@ _m_prefetch(void *__P)
 #define SDL_BIG_ENDIAN  4321
 /* @} */
 
-#ifndef SDL_BYTEORDER           /* Not defined in SDL_config.h? */
+#ifndef SDL_BYTEORDER
 #ifdef __linux__
 #include <endian.h>
 #define SDL_BYTEORDER  __BYTE_ORDER
@@ -87,7 +87,7 @@ _m_prefetch(void *__P)
 #endif /* __linux__ */
 #endif /* !SDL_BYTEORDER */
 
-#ifndef SDL_FLOATWORDORDER           /* Not defined in SDL_config.h? */
+#ifndef SDL_FLOATWORDORDER
 /* predefs from newer gcc versions: */
 #if defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__)
 #if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)

+ 1 - 1
include/SDL_opengl.h

@@ -35,7 +35,7 @@
 #ifndef SDL_opengl_h_
 #define SDL_opengl_h_
 
-#include "SDL_config.h"
+#include "SDL_platform.h"
 
 #ifndef __IOS__  /* No OpenGL on iOS. */
 

+ 1 - 1
include/SDL_opengles.h

@@ -24,7 +24,7 @@
  *
  *  This is a simple file to encapsulate the OpenGL ES 1.X API headers.
  */
-#include "SDL_config.h"
+#include "SDL_platform.h"
 
 #ifdef __IOS__
 #include <OpenGLES/ES1/gl.h>

+ 1 - 1
include/SDL_opengles2.h

@@ -24,7 +24,7 @@
  *
  *  This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
  */
-#include "SDL_config.h"
+#include "SDL_platform.h"
 
 #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
 

+ 11 - 88
include/SDL_stdinc.h

@@ -28,63 +28,15 @@
 #ifndef SDL_stdinc_h_
 #define SDL_stdinc_h_
 
-#include "SDL_config.h"
+#include "SDL_platform.h"
 
-#ifdef __APPLE__
-#ifndef _DARWIN_C_SOURCE
-#define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */
-#endif
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <inttypes.h>
 #endif
+#include <stdarg.h>
+#include <stdint.h>
+#include <wchar.h>
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#if defined(STDC_HEADERS)
-# include <stdlib.h>
-# include <stddef.h>
-# include <stdarg.h>
-#else
-# if defined(HAVE_STDLIB_H)
-#  include <stdlib.h>
-# elif defined(HAVE_MALLOC_H)
-#  include <malloc.h>
-# endif
-# if defined(HAVE_STDDEF_H)
-#  include <stddef.h>
-# endif
-# if defined(HAVE_STDARG_H)
-#  include <stdarg.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
-#  include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-#if defined(HAVE_INTTYPES_H)
-# include <inttypes.h>
-#elif defined(HAVE_STDINT_H)
-# include <stdint.h>
-#endif
-#ifdef HAVE_CTYPE_H
-# include <ctype.h>
-#endif
-#ifdef HAVE_MATH_H
-# include <math.h>
-#endif
-#ifdef HAVE_FLOAT_H
-# include <float.h>
-#endif
 #if !defined(alloca)
 # if defined(HAVE_ALLOCA_H)
 #  include <alloca.h>
@@ -254,7 +206,7 @@ typedef uint64_t Uint64;
 #define SDL_PRIs64 PRIs64
 #elif defined(__WIN32__) || defined(__GDK__)
 #define SDL_PRIs64 "I64d"
-#elif defined(__LINUX__) && defined(__LP64__)
+#elif defined(__LP64__) && !defined(__APPLE__)
 #define SDL_PRIs64 "ld"
 #else
 #define SDL_PRIs64 "lld"
@@ -265,7 +217,7 @@ typedef uint64_t Uint64;
 #define SDL_PRIu64 PRIu64
 #elif defined(__WIN32__) || defined(__GDK__)
 #define SDL_PRIu64 "I64u"
-#elif defined(__LINUX__) && defined(__LP64__)
+#elif defined(__LP64__) && !defined(__APPLE__)
 #define SDL_PRIu64 "lu"
 #else
 #define SDL_PRIu64 "llu"
@@ -276,7 +228,7 @@ typedef uint64_t Uint64;
 #define SDL_PRIx64 PRIx64
 #elif defined(__WIN32__) || defined(__GDK__)
 #define SDL_PRIx64 "I64x"
-#elif defined(__LINUX__) && defined(__LP64__)
+#elif defined(__LP64__) && !defined(__APPLE__)
 #define SDL_PRIx64 "lx"
 #else
 #define SDL_PRIx64 "llx"
@@ -287,7 +239,7 @@ typedef uint64_t Uint64;
 #define SDL_PRIX64 PRIX64
 #elif defined(__WIN32__) || defined(__GDK__)
 #define SDL_PRIX64 "I64X"
-#elif defined(__LINUX__) && defined(__LP64__)
+#elif defined(__LP64__) && !defined(__APPLE__)
 #define SDL_PRIX64 "lX"
 #else
 #define SDL_PRIX64 "llX"
@@ -508,6 +460,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_t le
 extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len);
 
 extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
+extern DECLSPEC void *SDLCALL SDL_memset4(void *dst, Uint32 val, size_t dwords);
 
 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
@@ -518,36 +471,6 @@ extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c,
     SDL_memcpy((dst), (src), sizeof (*(src)))
 
 
-/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
-SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
-{
-#ifdef __APPLE__
-    memset_pattern4(dst, &val, dwords * 4);
-#elif defined(__GNUC__) && defined(__i386__)
-    int u0, u1, u2;
-    __asm__ __volatile__ (
-        "cld \n\t"
-        "rep ; stosl \n\t"
-        : "=&D" (u0), "=&a" (u1), "=&c" (u2)
-        : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
-        : "memory"
-    );
-#else
-    size_t _n = (dwords + 3) / 4;
-    Uint32 *_p = SDL_static_cast(Uint32 *, dst);
-    Uint32 _val = (val);
-    if (dwords == 0) {
-        return;
-    }
-    switch (dwords % 4) {
-        case 0: do {    *_p++ = _val;   SDL_FALLTHROUGH;
-        case 3:         *_p++ = _val;   SDL_FALLTHROUGH;
-        case 2:         *_p++ = _val;   SDL_FALLTHROUGH;
-        case 1:         *_p++ = _val;
-        } while ( --_n );
-    }
-#endif
-}
 
 extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
 

+ 15 - 15
include/SDL_config.h → include/build_config/SDL_build_config.h

@@ -19,41 +19,41 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
 /**
- *  \file SDL_config.h
+ *  \file SDL_build_config.h
  */
 
 /* Add any platform that doesn't build using the configure system. */
 #if defined(__WIN32__)
-#include "SDL_config_windows.h"
+#include "SDL_build_config_windows.h"
 #elif defined(__WINRT__)
-#include "SDL_config_winrt.h"
+#include "SDL_build_config_winrt.h"
 #elif defined(__WINGDK__)
-#include "SDL_config_wingdk.h"
+#include "SDL_build_config_wingdk.h"
 #elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
-#include "SDL_config_xbox.h"
+#include "SDL_build_config_xbox.h"
 #elif defined(__MACOS__)
-#include "SDL_config_macos.h"
+#include "SDL_build_config_macos.h"
 #elif defined(__IOS__)
-#include "SDL_config_ios.h"
+#include "SDL_build_config_ios.h"
 #elif defined(__ANDROID__)
-#include "SDL_config_android.h"
+#include "SDL_build_config_android.h"
 #elif defined(__EMSCRIPTEN__)
-#include "SDL_config_emscripten.h"
+#include "SDL_build_config_emscripten.h"
 #elif defined(__NGAGE__)
-#include "SDL_config_ngage.h"
+#include "SDL_build_config_ngage.h"
 #else
 /* This is a minimal configuration just to get SDL running on new platforms. */
-#include "SDL_config_minimal.h"
+#include "SDL_build_config_minimal.h"
 #endif /* platform config */
 
 #ifdef USING_GENERATED_CONFIG_H
-#error Wrong SDL_config.h, check your include path?
+#error Wrong SDL_build_config.h, check your include path?
 #endif
 
-#endif /* SDL_config_h_ */
+#endif /* SDL_build_config_h_ */

+ 4 - 4
include/SDL_config.h.cmake → include/build_config/SDL_build_config.h.cmake

@@ -19,11 +19,11 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_h_
+#define SDL_build_config_h_
 
 /**
- *  \file SDL_config.h.in
+ *  \file SDL_build_config.h.in
  *
  *  This is a set of defines to configure the SDL features
  */
@@ -539,4 +539,4 @@ typedef unsigned int uintptr_t;
 #endif /* Visual Studio 2008 */
 #endif /* !_STDINT_H_ && !HAVE_STDINT_H */
 
-#endif /* SDL_config_h_ */
+#endif /* SDL_build_config_h_ */

+ 17 - 19
include/SDL_config_android.h → include/build_config/SDL_build_config_android.h

@@ -19,14 +19,14 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_android_h_
-#define SDL_config_android_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_android_h_
+#define SDL_build_config_android_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
 /**
- *  \file SDL_config_android.h
+ *  \file SDL_build_config_android.h
  *
  *  This is a configuration that can be used to build SDL for Android
  */
@@ -35,17 +35,21 @@
 
 #define HAVE_GCC_ATOMICS    1
 
-#define STDC_HEADERS    1
-#define HAVE_ALLOCA_H       1
-#define HAVE_CTYPE_H    1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
 #define HAVE_INTTYPES_H 1
-#define HAVE_LIMITS_H   1
+#define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
-#define HAVE_STDINT_H   1
-#define HAVE_STDIO_H    1
-#define HAVE_STRING_H   1
-#define HAVE_SYS_TYPES_H    1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_WCHAR_H 1
 
 /* C library functions */
 #define HAVE_DLOPEN 1
@@ -136,12 +140,6 @@
 #define HAVE_SYSCONF    1
 #define HAVE_CLOCK_GETTIME  1
 
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-
 /* Enable various audio drivers */
 #define SDL_AUDIO_DRIVER_ANDROID    1
 #define SDL_AUDIO_DRIVER_OPENSLES   1
@@ -191,4 +189,4 @@
 /* Enable the filesystem driver */
 #define SDL_FILESYSTEM_ANDROID   1
 
-#endif /* SDL_config_android_h_ */
+#endif /* SDL_build_config_android_h_ */

+ 6 - 10
include/SDL_config_emscripten.h → include/build_config/SDL_build_config_emscripten.h

@@ -19,28 +19,23 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef _SDL_config_emscripten_h_
-#define _SDL_config_emscripten_h_
+#ifndef _SDL_build_config_emscripten_h_
+#define _SDL_build_config_emscripten_h_
 
 #include "SDL_platform.h"
 
 /**
- *  \file SDL_config_emscripten.h
+ *  \file SDL_build_config_emscripten.h
  *
  *  This is a configuration that can be used to build SDL for Emscripten.
  */
 
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
 #define HAVE_GCC_ATOMICS 1
 
 /* Useful headers */
-#define STDC_HEADERS 1
 #define HAVE_ALLOCA_H 1
 #define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
 #define HAVE_ICONV_H 1
 #define HAVE_INTTYPES_H 1
 #define HAVE_LIMITS_H 1
@@ -49,6 +44,7 @@
 #define HAVE_MEMORY_H 1
 #define HAVE_SIGNAL_H 1
 #define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
 #define HAVE_STDINT_H 1
 #define HAVE_STDIO_H 1
 #define HAVE_STDLIB_H 1
@@ -214,4 +210,4 @@
 /* Enable system filesystem support */
 #define SDL_FILESYSTEM_EMSCRIPTEN 1
 
-#endif /* _SDL_config_emscripten_h_ */
+#endif /* _SDL_build_config_emscripten_h_ */

+ 17 - 19
include/SDL_config_ios.h → include/build_config/SDL_build_config_ios.h

@@ -19,31 +19,29 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_ios_h_
-#define SDL_config_ios_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_ios_h_
+#define SDL_build_config_ios_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
-#ifdef __LP64__
-#define SIZEOF_VOIDP 8
-#else
-#define SIZEOF_VOIDP 4
-#endif
-
 #define HAVE_GCC_ATOMICS    1
 
-#define STDC_HEADERS    1
-#define HAVE_ALLOCA_H       1
-#define HAVE_CTYPE_H    1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
 #define HAVE_INTTYPES_H 1
-#define HAVE_LIMITS_H   1
+#define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H   1
-#define HAVE_STDINT_H   1
-#define HAVE_STDIO_H    1
-#define HAVE_STRING_H   1
-#define HAVE_SYS_TYPES_H    1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_WCHAR_H 1
 /* The libunwind functions are only available on x86 */
 /* #undef HAVE_LIBUNWIND_H */
 
@@ -213,4 +211,4 @@
 /* enable filesystem support */
 #define SDL_FILESYSTEM_COCOA   1
 
-#endif /* SDL_config_ios_h_ */
+#endif /* SDL_build_config_ios_h_ */

+ 18 - 21
include/SDL_config_macos.h → include/build_config/SDL_build_config_macos.h

@@ -19,9 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_macos_h_
-#define SDL_config_macos_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_macos_h_
+#define SDL_build_config_macos_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
@@ -30,26 +30,23 @@
 
 /* This is a set of defines to configure the SDL features */
 
-#ifdef __LP64__
-    #define SIZEOF_VOIDP 8
-#else
-    #define SIZEOF_VOIDP 4
-#endif
-
 /* Useful headers */
-#define STDC_HEADERS    1
-#define HAVE_ALLOCA_H       1
-#define HAVE_CTYPE_H    1
-#define HAVE_FLOAT_H    1
+#define HAVE_ALLOCA_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_FLOAT_H 1
 #define HAVE_INTTYPES_H 1
-#define HAVE_LIMITS_H   1
+#define HAVE_LIBUNWIND_H 1
+#define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H   1
-#define HAVE_STDINT_H   1
-#define HAVE_STDIO_H    1
-#define HAVE_STRING_H   1
-#define HAVE_SYS_TYPES_H    1
-#define HAVE_LIBUNWIND_H    1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_WCHAR_H 1
 
 /* C library functions */
 #define HAVE_DLOPEN 1
@@ -273,4 +270,4 @@
 #define SDL_ALTIVEC_BLITTERS    1
 #endif
 
-#endif /* SDL_config_macos_h_ */
+#endif /* SDL_build_config_macos_h_ */

+ 5 - 5
include/SDL_config_minimal.h → include/build_config/SDL_build_config_minimal.h

@@ -19,14 +19,14 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_minimal_h_
-#define SDL_config_minimal_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_minimal_h_
+#define SDL_build_config_minimal_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
 /**
- *  \file SDL_config_minimal.h
+ *  \file SDL_build_config_minimal.h
  *
  *  This is the minimal configuration that can be used to build SDL.
  */
@@ -92,4 +92,4 @@ typedef unsigned int uintptr_t;
 /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
 #define SDL_FILESYSTEM_DUMMY  1
 
-#endif /* SDL_config_minimal_h_ */
+#endif /* SDL_build_config_minimal_h_ */

+ 4 - 4
include/SDL_config_ngage.h → include/build_config/SDL_build_config_ngage.h

@@ -19,9 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_ngage_h_
-#define SDL_config_ngage_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_ngage_h_
+#define SDL_build_config_ngage_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
@@ -86,4 +86,4 @@ typedef unsigned long      uintptr_t;
 /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
 #define SDL_FILESYSTEM_DUMMY 1
 
-#endif /* SDL_config_ngage_h_ */
+#endif /* SDL_build_config_ngage_h_ */

+ 8 - 11
include/SDL_config_windows.h → include/build_config/SDL_build_config_windows.h

@@ -19,9 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_windows_h_
-#define SDL_config_windows_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_windows_h_
+#define SDL_build_config_windows_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
@@ -76,12 +76,6 @@ typedef unsigned int uintptr_t;
 #endif /* Visual Studio 2008 */
 #endif /* !_STDINT_H_ && !HAVE_STDINT_H */
 
-#ifdef _WIN64
-# define SIZEOF_VOIDP 8
-#else
-# define SIZEOF_VOIDP 4
-#endif
-
 #ifdef __clang__
 # define HAVE_GCC_ATOMICS 1
 #endif
@@ -119,14 +113,17 @@ typedef unsigned int uintptr_t;
 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
 #ifdef HAVE_LIBC
 /* Useful headers */
-#define STDC_HEADERS 1
 #define HAVE_CTYPE_H 1
 #define HAVE_FLOAT_H 1
 #define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
 #define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
 #define HAVE_STRING_H 1
+#define HAVE_WCHAR_H 1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -306,6 +303,6 @@ typedef unsigned int uintptr_t;
 /* Enable filesystem support */
 #define SDL_FILESYSTEM_WINDOWS  1
 
-#endif /* SDL_config_windows_h_ */
+#endif /* SDL_build_config_windows_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 8 - 8
include/SDL_config_wingdk.h → include/build_config/SDL_build_config_wingdk.h

@@ -19,18 +19,15 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_wingdk_h_
-#define SDL_config_wingdk_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_wingdk_h_
+#define SDL_build_config_wingdk_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
 /* Windows GDK does not need Windows SDK version checks because it requires
  * a recent version of the Windows 10 SDK. */
 
-/* GDK only supports 64-bit */
-# define SIZEOF_VOIDP 8
-
 #ifdef __clang__
 # define HAVE_GCC_ATOMICS 1
 #endif
@@ -61,15 +58,18 @@
 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
 #ifdef HAVE_LIBC
 /* Useful headers */
-#define STDC_HEADERS 1
 #define HAVE_CTYPE_H 1
 #define HAVE_FLOAT_H 1
 #define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
 #define HAVE_STDINT_H 1
 #define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
 #define HAVE_STRING_H 1
+#define HAVE_WCHAR_H 1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -243,6 +243,6 @@
 /* Enable filesystem support */
 #define SDL_FILESYSTEM_WINDOWS  1
 
-#endif /* SDL_config_wingdk_h_ */
+#endif /* SDL_build_config_wingdk_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 8 - 11
include/SDL_config_winrt.h → include/build_config/SDL_build_config_winrt.h

@@ -19,9 +19,9 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_winrt_h_
-#define SDL_config_winrt_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_winrt_h_
+#define SDL_build_config_winrt_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
@@ -42,12 +42,6 @@
 
 /* This is a set of defines to configure the SDL features */
 
-#ifdef _WIN64
-# define SIZEOF_VOIDP 8
-#else
-# define SIZEOF_VOIDP 4
-#endif
-
 #ifdef __clang__
 # define HAVE_GCC_ATOMICS 1
 #endif
@@ -63,15 +57,18 @@
 #define HAVE_TPCSHRD_H 1
 
 #define HAVE_LIBC 1
-#define STDC_HEADERS 1
 #define HAVE_CTYPE_H 1
 #define HAVE_FLOAT_H 1
 #define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
 #define HAVE_STDINT_H 1
 #define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
 #define HAVE_STRING_H 1
+#define HAVE_WCHAR_H 1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -216,4 +213,4 @@
 /* Enable system power support */
 #define SDL_POWER_WINRT 1
 
-#endif /* SDL_config_winrt_h_ */
+#endif /* SDL_build_config_winrt_h_ */

+ 8 - 8
include/SDL_config_xbox.h → include/build_config/SDL_build_config_xbox.h

@@ -19,18 +19,15 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#ifndef SDL_config_wingdk_h_
-#define SDL_config_wingdk_h_
-#define SDL_config_h_
+#ifndef SDL_build_config_wingdk_h_
+#define SDL_build_config_wingdk_h_
+#define SDL_build_config_h_
 
 #include "SDL_platform.h"
 
 /* Windows GDK does not need Windows SDK version checks because it requires
  * a recent version of the Windows 10 SDK. */
 
-/* GDK only supports 64-bit */
-# define SIZEOF_VOIDP 8
-
 #ifdef __clang__
 # define HAVE_GCC_ATOMICS 1
 #endif
@@ -61,15 +58,18 @@
 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
 #ifdef HAVE_LIBC
 /* Useful headers */
-#define STDC_HEADERS 1
 #define HAVE_CTYPE_H 1
 #define HAVE_FLOAT_H 1
 #define HAVE_LIMITS_H 1
 #define HAVE_MATH_H 1
 #define HAVE_SIGNAL_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDDEF_H 1
 #define HAVE_STDINT_H 1
 #define HAVE_STDIO_H 1
+#define HAVE_STDLIB_H 1
 #define HAVE_STRING_H 1
+#define HAVE_WCHAR_H 1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -225,6 +225,6 @@
 /* Disable IME as not supported yet (TODO: Xbox IME?) */
 #define SDL_DISABLE_WINDOWS_IME 1
 
-#endif /* SDL_config_wingdk_h_ */
+#endif /* SDL_build_config_wingdk_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 0 - 3
src/SDL_assert.c

@@ -36,9 +36,6 @@
 #ifndef WS_OVERLAPPEDWINDOW
 #define WS_OVERLAPPEDWINDOW 0
 #endif
-#else  /* fprintf, etc. */
-#include <stdio.h>
-#include <stdlib.h>
 #endif
 
 #if defined(__EMSCRIPTEN__)

+ 1 - 0
src/SDL_assert_c.h

@@ -18,6 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "./SDL_internal.h"
 
 #ifndef SDL_assert_c_h_
 #define SDL_assert_c_h_

+ 53 - 1
src/SDL_internal.h

@@ -48,7 +48,59 @@
 #define DECLSPEC
 #endif
 
-#include "SDL_config.h"
+#include "build_config/SDL_build_config.h"
+
+#ifdef __APPLE__
+#ifndef _DARWIN_C_SOURCE
+#define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */
+#endif
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#if defined(HAVE_STDLIB_H)
+# include <stdlib.h>
+#elif defined(HAVE_MALLOC_H)
+# include <malloc.h>
+#endif
+#if defined(HAVE_STDDEF_H)
+# include <stddef.h>
+#endif
+#if defined(HAVE_STDARG_H)
+# include <stdarg.h>
+#endif
+#ifdef HAVE_STRING_H
+# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#if defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+#elif defined(HAVE_STDINT_H)
+# include <stdint.h>
+#endif
+#ifdef HAVE_CTYPE_H
+# include <ctype.h>
+#endif
+#ifdef HAVE_MATH_H
+# include <math.h>
+#endif
+#ifdef HAVE_FLOAT_H
+# include <float.h>
+#endif
+
+#include "SDL_stdinc.h"
 
 /* If you run into a warning that O_CLOEXEC is redefined, update the SDL configuration header for your platform to add HAVE_O_CLOEXEC */
 #ifndef HAVE_O_CLOEXEC

+ 1 - 0
src/SDL_utils_c.h

@@ -18,6 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "./SDL_internal.h"
 
 #ifndef SDL_utils_h_
 #define SDL_utils_h_

+ 1 - 1
src/core/winrt/SDL_winrtapp_common.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef SDL_winrtapp_common_h_
 #define SDL_winrtapp_common_h_

+ 1 - 1
src/core/winrt/SDL_winrtapp_xaml.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef SDL_winrtapp_xaml_h_
 #define SDL_winrtapp_xaml_h_

+ 1 - 3
src/cpuinfo/SDL_cpuinfo.c

@@ -18,9 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#ifdef TEST_MAIN
-#include "SDL_config.h"
-#else
+#ifndef TEST_MAIN
 #include "../SDL_internal.h"
 #endif
 

+ 5 - 1
src/dynapi/SDL_dynapi.c

@@ -19,11 +19,15 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 
-#include "SDL_config.h"
+#include "build_config/SDL_build_config.h"
 #include "SDL_dynapi.h"
 
 #if SDL_DYNAMIC_API
 
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
 #include "SDL.h"
 
 /* These headers have system specific definitions, so aren't included above */

+ 1 - 0
src/dynapi/SDL_dynapi_overrides.h

@@ -892,3 +892,4 @@
 #define SDL_EGL_SetEGLAttributeCallbacks SDL_EGL_SetEGLAttributeCallbacks_REAL
 #define SDL_GDKSuspendComplete SDL_GDKSuspendComplete_REAL
 #define SDL_GetWindowWMInfo SDL_GetWindowWMInfo_REAL
+#define SDL_memset4 SDL_memset4_REAL

+ 1 - 0
src/dynapi/SDL_dynapi_procs.h

@@ -968,3 +968,4 @@ SDL_DYNAPI_PROC(void,SDL_EGL_SetEGLAttributeCallbacks,(SDL_EGLAttribArrayCallbac
 SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),return)
 #endif
 SDL_DYNAPI_PROC(int,SDL_GetWindowWMInfo,(SDL_Window *a, SDL_SysWMinfo *b, Uint32 c),(a,b,c),return)
+SDL_DYNAPI_PROC(void*,SDL_memset4,(void *a, Uint32 b, size_t c),(a,b,c),return)

+ 1 - 1
src/events/SDL_quit.c

@@ -31,7 +31,7 @@
 #include "SDL_events.h"
 #include "SDL_events_c.h"
 
-#if defined(HAVE_SIGNAL_H) || defined(HAVE_SIGACTION)
+#if defined(HAVE_SIGNAL_H) && defined(HAVE_SIGACTION)
 #define HAVE_SIGNAL_SUPPORT 1
 #endif
 

+ 21 - 3
src/haptic/android/SDL_syshaptic_c.h

@@ -1,12 +1,30 @@
-#include "SDL_config.h"
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
 
-#ifdef SDL_HAPTIC_ANDROID
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
 
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifdef SDL_HAPTIC_ANDROID
 
 extern int Android_AddHaptic(int device_id, const char *name);
 extern int Android_RemoveHaptic(int device_id);
 
-
 #endif /* SDL_HAPTIC_ANDROID */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 1
src/locale/SDL_syslocale.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../SDL_internal.h"
 
 /* This is the system specific header for the SDL locale API */
 

+ 0 - 1
src/main/gdk/SDL_gdk_main.c

@@ -18,7 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
 
 /* Include this so we define UNICODE properly */
 #include "../../core/windows/SDL_windows.h"

+ 2 - 1
src/main/ps2/SDL_ps2_main.c

@@ -2,7 +2,7 @@
     SDL_ps2_main.c, fjtrujy@gmail.com 
 */
 
-#include "SDL_config.h"
+#include "SDL_platform.h"
 
 #ifdef __PS2__
 
@@ -12,6 +12,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <stdio.h>
 
 #include <kernel.h>
 #include <sifrpc.h>

+ 1 - 1
src/main/psp/SDL_psp_main.c

@@ -1,7 +1,7 @@
 /*
     SDL_psp_main.c, placed in the public domain by Sam Lantinga  3/13/14
 */
-#include "SDL_config.h"
+#include "SDL_platform.h"
 
 #ifdef __PSP__
 

+ 1 - 1
src/main/windows/SDL_windows_main.c

@@ -3,7 +3,7 @@
 
     The WinMain function -- calls your program's main() function
 */
-#include "SDL_config.h"
+#include "SDL_platform.h"
 
 #ifdef __WIN32__
 

+ 1 - 2
src/sensor/SDL_sensor_c.h

@@ -18,12 +18,11 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "../SDL_internal.h"
 
 #ifndef SDL_sensor_c_h_
 #define SDL_sensor_c_h_
 
-#include "SDL_config.h"
-
 struct _SDL_SensorDriver;
 
 /* Useful functions and variables from SDL_sensor.c */

+ 1 - 2
src/sensor/SDL_syssensor.h

@@ -18,12 +18,11 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
+#include "../SDL_internal.h"
 
 #ifndef SDL_syssensor_c_h_
 #define SDL_syssensor_c_h_
 
-#include "SDL_config.h"
-
 /* This is the system specific header for the SDL sensor API */
 
 #include "SDL_sensor.h"

+ 0 - 2
src/sensor/android/SDL_androidsensor.c

@@ -20,8 +20,6 @@
 */
 #include "../../SDL_internal.h"
 
-#include "SDL_config.h"
-
 #ifdef SDL_SENSOR_ANDROID
 
 /* This is the system specific header for the SDL sensor API */

+ 1 - 1
src/sensor/android/SDL_androidsensor.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 /* The private structure used to keep track of a sensor */
 struct sensor_hwdata

+ 1 - 1
src/sensor/coremotion/SDL_coremotionsensor.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 /* The private structure used to keep track of a sensor */
 struct sensor_hwdata

+ 1 - 2
src/sensor/coremotion/SDL_coremotionsensor.m

@@ -18,8 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifdef SDL_SENSOR_COREMOTION
 

+ 0 - 2
src/sensor/dummy/SDL_dummysensor.c

@@ -20,8 +20,6 @@
 */
 #include "../../SDL_internal.h"
 
-#include "SDL_config.h"
-
 #if defined(SDL_SENSOR_DUMMY) || defined(SDL_SENSOR_DISABLED)
 
 #include "SDL_error.h"

+ 1 - 1
src/sensor/dummy/SDL_dummysensor.h

@@ -18,6 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 1 - 2
src/sensor/vita/SDL_vitasensor.c

@@ -18,8 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #if defined(SDL_SENSOR_VITA)
 

+ 1 - 1
src/sensor/vita/SDL_vitasensor.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 /* The private structure used to keep track of a sensor */
 struct sensor_hwdata

+ 0 - 2
src/sensor/windows/SDL_windowssensor.c

@@ -20,8 +20,6 @@
 */
 #include "../../SDL_internal.h"
 
-#include "SDL_config.h"
-
 #if defined(SDL_SENSOR_WINDOWS)
 
 #include "SDL_error.h"

+ 1 - 1
src/sensor/windows/SDL_windowssensor.h

@@ -18,6 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 33 - 0
src/stdlib/SDL_stdlib.c

@@ -637,6 +637,39 @@ SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
 #endif /* HAVE_MEMSET */
 }
 
+/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
+void *
+SDL_memset4(void *dst, Uint32 val, size_t dwords)
+{
+#ifdef __APPLE__
+    memset_pattern4(dst, &val, dwords * 4);
+#elif defined(__GNUC__) && defined(__i386__)
+    int u0, u1, u2;
+    __asm__ __volatile__ (
+        "cld \n\t"
+        "rep ; stosl \n\t"
+        : "=&D" (u0), "=&a" (u1), "=&c" (u2)
+        : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
+        : "memory"
+    );
+#else
+    size_t _n = (dwords + 3) / 4;
+    Uint32 *_p = SDL_static_cast(Uint32 *, dst);
+    Uint32 _val = (val);
+    if (dwords == 0) {
+        return dst;
+    }
+    switch (dwords % 4) {
+        case 0: do {    *_p++ = _val;   SDL_FALLTHROUGH;
+        case 3:         *_p++ = _val;   SDL_FALLTHROUGH;
+        case 2:         *_p++ = _val;   SDL_FALLTHROUGH;
+        case 1:         *_p++ = _val;
+        } while ( --_n );
+    }
+#endif
+    return dst;
+}
+
 #if defined(HAVE_CTYPE_H) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 int SDL_isblank(int x) { return isblank(x); }
 #else

+ 0 - 1
src/stdlib/SDL_string.c

@@ -26,7 +26,6 @@
 
 /* This file contains portable string manipulation functions for SDL */
 
-#include "SDL_stdinc.h"
 #include "SDL_vacopy.h"
 
 #if defined(__vita__)

+ 0 - 3
src/test/SDL_test_assert.c

@@ -24,9 +24,6 @@
  Used by the test framework and test cases.
 
 */
-
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 /* Assert check message format */

+ 0 - 4
src/test/SDL_test_common.c

@@ -20,12 +20,8 @@
 */
 
 /* Ported from original test/common.c file. */
-
-#include "SDL_config.h"
 #include "SDL_test.h"
 
-#include <stdio.h>
-
 static const char *video_usage[] = {
     "[--video driver]", "[--renderer driver]", "[--gldebug]",
     "[--info all|video|modes|render|event|event_motion]",

+ 0 - 3
src/test/SDL_test_compare.c

@@ -26,9 +26,6 @@
  Rewritten for test lib by Andreas Schiffler.
 
 */
-
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 

+ 0 - 3
src/test/SDL_test_crc32.c

@@ -25,9 +25,6 @@
  Original source code contributed by A. Schiffler for GSOC project.
 
 */
-
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 

+ 0 - 2
src/test/SDL_test_font.c

@@ -18,8 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 /* ---- 8x8 font definition ---- */

+ 3 - 19
src/test/SDL_test_fuzzer.c

@@ -24,27 +24,11 @@
   Data generators for fuzzing test data in a reproducible way.
 
 */
-
-#include "SDL_config.h"
-
-#include <limits.h>
-/* Visual Studio 2008 doesn't have stdint.h */
-#if defined(_MSC_VER) && _MSC_VER <= 1500
-#define UINT8_MAX   _UI8_MAX
-#define UINT16_MAX  _UI16_MAX
-#define UINT32_MAX  _UI32_MAX
-#define INT64_MIN    _I64_MIN
-#define INT64_MAX    _I64_MAX
-#define UINT64_MAX  _UI64_MAX
-#else
-#include <stdint.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <float.h>
-
 #include "SDL_test.h"
 
+#include <float.h>      /* Needed for FLT_MAX and DBL_EPSILON */
+#include <limits.h>     /* Needed for UCHAR_MAX, etc. */
+
 /**
  * Counter for fuzzer invocations
  */

+ 1 - 7
src/test/SDL_test_harness.c

@@ -18,15 +18,9 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include <stdlib.h>     /* Needed for exit() */
 
 /* Invalid test name/description message format */
 #define SDLTEST_INVALID_NAME_FORMAT "(Invalid)"

+ 0 - 2
src/test/SDL_test_imageBlit.c

@@ -18,8 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 /* GIMP RGB C-Source image dump (blit.c) */

+ 0 - 2
src/test/SDL_test_imageBlitBlend.c

@@ -18,8 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 /* GIMP RGB C-Source image dump (alpha.c) */

+ 0 - 2
src/test/SDL_test_imageFace.c

@@ -18,8 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 /* GIMP RGBA C-Source image dump (face.c) */

+ 0 - 2
src/test/SDL_test_imagePrimitives.c

@@ -18,8 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 /* GIMP RGB C-Source image dump (primitives.c) */

+ 0 - 2
src/test/SDL_test_imagePrimitivesBlend.c

@@ -18,8 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 /* GIMP RGB C-Source image dump (alpha.c) */

+ 2 - 9
src/test/SDL_test_log.c

@@ -29,18 +29,11 @@
 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
 # define _CRT_SECURE_NO_WARNINGS
 #endif
-
-#include "SDL_config.h"
-
-#include <stdarg.h> /* va_list */
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-
 #include "SDL.h"
-
 #include "SDL_test.h"
 
+#include <time.h>   /* Needed for localtime() */
+
 /* work around compiler warning on older GCCs. */
 #if (defined(__GNUC__) && (__GNUC__ <= 2))
 static size_t

+ 0 - 3
src/test/SDL_test_md5.c

@@ -50,9 +50,6 @@
  ** documentation and/or software.                                    **
  ***********************************************************************
  */
-
-#include "SDL_config.h"
-
 #include "SDL_test.h"
 
 /* Forward declaration of static helper function */

+ 0 - 1
src/test/SDL_test_memory.c

@@ -18,7 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
 #include "SDL_assert.h"
 #include "SDL_stdinc.h"
 #include "SDL_log.h"

+ 3 - 7
src/test/SDL_test_random.c

@@ -27,15 +27,11 @@
  Original source code contributed by A. Schiffler for GSOC project.
 
 */
-
-#include "SDL_config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-
 #include "SDL_test.h"
 
+#include <stdlib.h>     /* Needed for srand() and rand() */
+#include <time.h>       /* Needed for time() */
+
 /* Initialize random number generator with two integer variables */
 
 void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, unsigned int ci)

+ 1 - 1
src/thread/stdcpp/SDL_sysmutex_c.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #include <mutex>
 

+ 1 - 1
src/thread/stdcpp/SDL_systhread_c.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 /* For a thread handle, use a void pointer to a std::thread */
 typedef void * SYS_ThreadHandle;

+ 1 - 1
src/video/winrt/SDL_winrtevents_c.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 extern "C" {
 #include "../SDL_sysvideo.h"

+ 1 - 1
src/video/winrt/SDL_winrtgamebar_cpp.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef SDL_winrtgamebar_h_
 #define SDL_winrtgamebar_h_

+ 1 - 1
src/video/winrt/SDL_winrtmouse_c.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef SDL_winrtmouse_h_
 #define SDL_winrtmouse_h_

+ 1 - 1
src/video/winrt/SDL_winrtopengles.h

@@ -18,7 +18,7 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
 
 #ifndef SDL_winrtopengles_h_
 #define SDL_winrtopengles_h_

+ 12 - 1
test/CMakeLists.txt

@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.0)
 project(SDL3_test)
 
 include(CheckCCompilerFlag)
+include(CheckIncludeFile)
 include(CMakeParseArguments)
 include(CMakePushCheckState)
 
@@ -91,7 +92,17 @@ if(NOT MSVC OR NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
 endif()
 
 if (OPENGL_FOUND)
-add_definitions(-DHAVE_OPENGL)
+    add_definitions(-DHAVE_OPENGL)
+endif()
+
+check_include_file(signal.h HAVE_SIGNAL_H)
+if (HAVE_SIGNAL_H)
+    add_definitions(-DHAVE_SIGNAL_H)
+endif()
+
+check_include_file(libudev.h HAVE_LIBUDEV_H)
+if (HAVE_LIBUDEV_H)
+    add_definitions(-DHAVE_LIBUDEV_H)
 endif()
 
 add_sdl_test_executable(checkkeys checkkeys.c)

+ 0 - 2
test/checkkeys.c

@@ -15,9 +15,7 @@
    pump the event loop and catch keystrokes.
 */
 
-#include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 
 #ifdef __EMSCRIPTEN__
 #include <emscripten/emscripten.h>

+ 0 - 1
test/checkkeysthreads.c

@@ -17,7 +17,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 
 #ifdef __EMSCRIPTEN__
 #include <emscripten/emscripten.h>

+ 0 - 14
test/controllermap.c

@@ -15,13 +15,10 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 
 #include "SDL.h"
 #include "testutils.h"
 
-#ifndef SDL_JOYSTICK_DISABLED
-
 /* Define this for verbose output while mapping controllers */
 #define DEBUG_CONTROLLERMAP
 
@@ -812,15 +809,4 @@ main(int argc, char *argv[])
     return 0;
 }
 
-#else
-
-int
-main(int argc, char *argv[])
-{
-    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Joystick support.\n");
-    return 1;
-}
-
-#endif
-
 /* vi: set ts=4 sw=4 expandtab: */

+ 0 - 3
test/loopwave.c

@@ -15,9 +15,6 @@
 /* loopwaves.c is much more robust in handling WAVE files --
     This is only for simple WAVEs
 */
-#include "SDL_config.h"
-
-#include <stdio.h>
 #include <stdlib.h>
 
 #ifdef __EMSCRIPTEN__

+ 0 - 1
test/loopwavequeue.c

@@ -12,7 +12,6 @@
 
 /* Program to load a wave file and loop playing it using SDL sound queueing */
 
-#include <stdio.h>
 #include <stdlib.h>
 
 #ifdef __EMSCRIPTEN__

+ 0 - 2
test/testatomic.c

@@ -9,8 +9,6 @@
   including commercial applications, and to alter it and redistribute it
   freely.
 */
-#include <stdio.h>
-
 #include "SDL.h"
 
 /*

+ 3 - 1
test/testaudiocapture.c

@@ -9,10 +9,11 @@
   including commercial applications, and to alter it and redistribute it
   freely.
 */
-#include "SDL.h"
 
 #include <stdlib.h>
 
+#include "SDL.h"
+
 #ifdef __EMSCRIPTEN__
 #include <emscripten/emscripten.h>
 #endif
@@ -163,3 +164,4 @@ main(int argc, char **argv)
     return 0;
 }
 
+/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 3
test/testaudiohotplug.c

@@ -12,9 +12,6 @@
 
 /* Program to test hotplugging of audio devices */
 
-#include "SDL_config.h"
-
-#include <stdio.h>
 #include <stdlib.h>
 
 #if HAVE_SIGNAL_H

+ 2 - 1
test/testaudioinfo.c

@@ -9,7 +9,6 @@
   including commercial applications, and to alter it and redistribute it
   freely.
 */
-#include <stdio.h>
 #include "SDL.h"
 
 static void
@@ -102,3 +101,5 @@ main(int argc, char **argv)
     SDL_Quit();
     return 0;
 }
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 2
test/testautomation.c

@@ -11,8 +11,6 @@
 */
 
 #include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
 
 #include "SDL.h"
 #include "SDL_test.h"

+ 2 - 1
test/testautomation_audio.c

@@ -9,7 +9,6 @@
 #endif
 
 #include <stdio.h>
-#include <string.h>
 
 #include "SDL.h"
 #include "SDL_test.h"
@@ -1038,3 +1037,5 @@ SDLTest_TestSuiteReference audioTestSuite = {
     audioTests,
     _audioTearDown
 };
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 2 - 4
test/testautomation_clipboard.c

@@ -1,10 +1,6 @@
 /**
  * New/updated tests: aschiffler at ferzkopp dot net
  */
-
-#include <stdio.h>
-#include <string.h>
-
 #include "SDL.h"
 #include "SDL_test.h"
 
@@ -334,3 +330,5 @@ SDLTest_TestSuiteReference clipboardTestSuite = {
     clipboardTests,
     NULL
 };
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 2 - 3
test/testautomation_events.c

@@ -1,9 +1,6 @@
 /**
  * Events test suite
  */
-
-#include <stdio.h>
-
 #include "SDL.h"
 #include "SDL_test.h"
 
@@ -199,3 +196,5 @@ SDLTest_TestSuiteReference eventsTestSuite = {
     eventsTests,
     NULL
 };
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 2 - 0
test/testautomation_guid.c

@@ -148,3 +148,5 @@ SDLTest_TestSuiteReference guidTestSuite = {
     guidTests,
     NULL
 };
+
+/* vi: set ts=4 sw=4 expandtab: */

+ 2 - 2
test/testautomation_hints.c

@@ -2,8 +2,6 @@
  * Hints test suite
  */
 
-#include <stdio.h>
-
 #include "SDL.h"
 #include "SDL_test.h"
 
@@ -267,3 +265,5 @@ SDLTest_TestSuiteReference hintsTestSuite = {
     hintsTests,
     NULL
 };
+
+/* vi: set ts=4 sw=4 expandtab: */

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно