From 05e3c38e7f68f08e59d68664b175f7d38e54b45a Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Tue, 19 Jul 2022 05:48:31 +0200 Subject: [PATCH] early-access version 2847 --- README.md | 2 +- externals/SDL/.github/workflows/android.yml | 50 +- .../SDL/.github/workflows/emscripten.yml | 25 +- externals/SDL/.github/workflows/main.yml | 166 +- externals/SDL/.github/workflows/os2.yml | 26 + externals/SDL/.github/workflows/psp.yaml | 23 +- externals/SDL/.github/workflows/riscos.yml | 71 +- externals/SDL/.github/workflows/vita.yaml | 25 +- externals/SDL/.gitignore | 1 - externals/SDL/CMakeLists.txt | 1102 +- externals/SDL/INSTALL.txt | 4 +- externals/SDL/Makefile.in | 4 +- externals/SDL/Makefile.os2 | 29 +- externals/SDL/Makefile.psp | 5 +- externals/SDL/SDL2Config.cmake | 10 +- externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj | 16 +- .../SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters | 21 - externals/SDL/VisualC/SDL/SDL.vcxproj | 13 +- externals/SDL/VisualC/SDL/SDL.vcxproj.filters | 26 +- .../tests/controllermap/controllermap.vcxproj | 1 - .../VisualC/tests/loopwave/loopwave.vcxproj | 3 +- .../testautomation/testautomation.vcxproj | 1 - .../testgamecontroller.vcxproj | 1 - .../tests/testoverlay2/testoverlay2.vcxproj | 1 - .../testrendertarget/testrendertarget.vcxproj | 3 +- .../VisualC/tests/testscale/testscale.vcxproj | 3 +- .../tests/testsprite2/testsprite2.vcxproj | 3 +- externals/SDL/WhatsNew.txt | 78 - externals/SDL/Xcode/SDL/Info-Framework.plist | 4 +- .../Xcode/SDL/SDL.xcodeproj/project.pbxproj | 223 +- .../SDL/pkg-support/resources/ReadMe.txt | 14 +- .../SDLTest/SDLTest.xcodeproj/project.pbxproj | 6 +- .../SDL/Xcode/SDLTest/TestDropFile-Info.plist | 2 +- externals/SDL/acinclude/libtool.m4 | 2 +- .../src/org/libsdl/app/SDLActivity.java | 127 +- .../org/libsdl/app/SDLControllerManager.java | 38 +- .../SDL/android-project/app/build.gradle | 4 - .../android-project/app/jni/src/Android.mk | 2 +- .../main/java/org/libsdl/app/SDLActivity.java | 127 +- .../org/libsdl/app/SDLControllerManager.java | 38 +- externals/SDL/autogen.sh | 8 +- .../SDL/build-scripts/androidbuildlibs.sh | 37 +- externals/SDL/build-scripts/clang++-fat.sh | 6 +- externals/SDL/build-scripts/clang-fat.sh | 8 +- externals/SDL/build-scripts/config.guess | 37 +- externals/SDL/build-scripts/fnsince.pl | 12 +- externals/SDL/build-scripts/ltmain.sh | 16 +- externals/SDL/build-scripts/os2-buildbot.sh | 5 +- .../SDL/build-scripts/update-copyright.sh | 9 +- externals/SDL/build-scripts/wikiheaders.pl | 163 +- externals/SDL/build-scripts/winrtbuild.ps1 | 2 +- externals/SDL/cmake/macros.cmake | 23 +- externals/SDL/cmake/sdlchecks.cmake | 192 +- externals/SDL/configure | 12695 ++++++---------- externals/SDL/configure.ac | 491 +- externals/SDL/debian/changelog | 6 + externals/SDL/debian/copyright | 12 +- externals/SDL/docs/README-android.md | 3 - externals/SDL/docs/README-cmake.md | 2 +- externals/SDL/docs/README-directfb.md | 42 +- externals/SDL/docs/README-linux.md | 17 +- externals/SDL/docs/README-macos.md | 11 +- externals/SDL/docs/README-psp.md | 43 +- externals/SDL/docs/README-raspberrypi.md | 2 +- externals/SDL/docs/README-visualc.md | 2 +- externals/SDL/docs/README-vita.md | 5 +- externals/SDL/docs/README-windows.md | 81 +- externals/SDL/docs/README.md | 7 +- externals/SDL/docs/doxyfile | 1 - externals/SDL/include/SDL_assert.h | 4 +- externals/SDL/include/SDL_audio.h | 5 +- externals/SDL/include/SDL_blendmode.h | 10 +- externals/SDL/include/SDL_config.h | 4 +- externals/SDL/include/SDL_config.h.cmake | 23 +- externals/SDL/include/SDL_config.h.in | 25 +- externals/SDL/include/SDL_config_android.h | 1 - externals/SDL/include/SDL_config_emscripten.h | 2 - externals/SDL/include/SDL_config_iphoneos.h | 3 +- externals/SDL/include/SDL_config_macosx.h | 8 +- externals/SDL/include/SDL_config_os2.h | 7 +- externals/SDL/include/SDL_config_pandora.h | 1 - externals/SDL/include/SDL_config_psp.h | 11 +- externals/SDL/include/SDL_config_windows.h | 83 +- externals/SDL/include/SDL_config_winrt.h | 15 +- externals/SDL/include/SDL_config_wiz.h | 2 +- externals/SDL/include/SDL_cpuinfo.h | 38 +- externals/SDL/include/SDL_endian.h | 31 - externals/SDL/include/SDL_events.h | 27 - externals/SDL/include/SDL_gamecontroller.h | 53 +- externals/SDL/include/SDL_hints.h | 356 +- externals/SDL/include/SDL_joystick.h | 103 +- externals/SDL/include/SDL_keyboard.h | 21 - externals/SDL/include/SDL_keycode.h | 7 +- externals/SDL/include/SDL_log.h | 4 +- externals/SDL/include/SDL_metal.h | 1 - externals/SDL/include/SDL_platform.h | 17 +- externals/SDL/include/SDL_rect.h | 156 +- externals/SDL/include/SDL_render.h | 58 +- externals/SDL/include/SDL_rwops.h | 14 + externals/SDL/include/SDL_scancode.h | 20 - externals/SDL/include/SDL_stdinc.h | 88 +- externals/SDL/include/SDL_system.h | 34 +- externals/SDL/include/SDL_syswm.h | 2 - externals/SDL/include/SDL_thread.h | 2 +- externals/SDL/include/SDL_touch.h | 8 - externals/SDL/include/SDL_version.h | 22 +- externals/SDL/include/SDL_video.h | 10 +- externals/SDL/include/begin_code.h | 2 +- externals/SDL/sdl2-config-version.cmake.in | 3 +- externals/SDL/sdl2-config.cmake.in | 252 +- externals/SDL/sdl2-config.in | 9 +- externals/SDL/src/SDL.c | 39 +- externals/SDL/src/SDL_assert.c | 67 +- externals/SDL/src/SDL_error.c | 2 + externals/SDL/src/SDL_hints.c | 10 +- externals/SDL/src/SDL_internal.h | 3 +- externals/SDL/src/SDL_log.c | 92 +- externals/SDL/src/atomic/SDL_spinlock.c | 16 - externals/SDL/src/audio/SDL_audio.c | 140 +- externals/SDL/src/audio/SDL_audio_c.h | 5 + externals/SDL/src/audio/SDL_audiocvt.c | 212 +- externals/SDL/src/audio/SDL_mixer.c | 107 +- externals/SDL/src/audio/SDL_sysaudio.h | 24 +- externals/SDL/src/audio/SDL_wave.c | 2 +- externals/SDL/src/audio/aaudio/SDL_aaudio.c | 17 +- externals/SDL/src/audio/alsa/SDL_alsa_audio.c | 33 +- .../SDL/src/audio/android/SDL_androidaudio.c | 21 +- externals/SDL/src/audio/arts/SDL_artsaudio.c | 38 +- .../SDL/src/audio/coreaudio/SDL_coreaudio.m | 72 +- .../src/audio/directsound/SDL_directsound.c | 44 +- externals/SDL/src/audio/disk/SDL_diskaudio.c | 14 +- externals/SDL/src/audio/dsp/SDL_dspaudio.c | 14 +- .../SDL/src/audio/dummy/SDL_dummyaudio.c | 12 +- .../audio/emscripten/SDL_emscriptenaudio.c | 70 +- externals/SDL/src/audio/esd/SDL_esdaudio.c | 14 +- .../SDL/src/audio/fusionsound/SDL_fsaudio.c | 39 +- .../SDL/src/audio/haiku/SDL_haikuaudio.cc | 82 +- externals/SDL/src/audio/jack/SDL_jackaudio.c | 13 +- externals/SDL/src/audio/nacl/SDL_naclaudio.c | 61 +- externals/SDL/src/audio/nacl/SDL_naclaudio.h | 3 +- externals/SDL/src/audio/nas/SDL_nasaudio.c | 72 +- .../SDL/src/audio/netbsd/SDL_netbsdaudio.c | 62 +- .../SDL/src/audio/openslES/SDL_openslES.c | 70 +- externals/SDL/src/audio/os2/SDL_os2audio.c | 31 +- externals/SDL/src/audio/paudio/SDL_paudio.c | 78 +- .../SDL/src/audio/pipewire/SDL_pipewire.c | 252 +- .../SDL/src/audio/pipewire/SDL_pipewire.h | 6 +- externals/SDL/src/audio/psp/SDL_pspaudio.c | 14 +- .../SDL/src/audio/pulseaudio/SDL_pulseaudio.c | 143 +- .../SDL/src/audio/pulseaudio/SDL_pulseaudio.h | 6 +- externals/SDL/src/audio/qsa/SDL_qsa_audio.c | 111 +- externals/SDL/src/audio/qsa/SDL_qsa_audio.h | 3 + .../SDL/src/audio/sndio/SDL_sndioaudio.c | 25 +- externals/SDL/src/audio/sun/SDL_sunaudio.c | 11 +- externals/SDL/src/audio/vita/SDL_vitaaudio.c | 95 +- externals/SDL/src/audio/vita/SDL_vitaaudio.h | 4 +- externals/SDL/src/audio/wasapi/SDL_wasapi.c | 44 +- externals/SDL/src/audio/wasapi/SDL_wasapi.h | 1 + .../SDL/src/audio/wasapi/SDL_wasapi_win32.c | 2 +- externals/SDL/src/audio/winmm/SDL_winmm.c | 30 +- externals/SDL/src/core/android/SDL_android.c | 19 +- externals/SDL/src/core/linux/SDL_dbus.c | 1 - externals/SDL/src/core/linux/SDL_fcitx.c | 94 +- externals/SDL/src/core/linux/SDL_fcitx.h | 2 +- externals/SDL/src/core/linux/SDL_ibus.c | 224 +- externals/SDL/src/core/linux/SDL_ibus.h | 2 +- externals/SDL/src/core/linux/SDL_ime.c | 6 +- externals/SDL/src/core/linux/SDL_ime.h | 2 +- .../SDL/src/core/openbsd/SDL_wscons_kbd.c | 9 +- .../SDL/src/core/os2/geniconv/geniconv.c | 29 +- externals/SDL/src/core/windows/SDL_hid.c | 8 +- externals/SDL/src/core/windows/SDL_hid.h | 4 + externals/SDL/src/core/windows/SDL_windows.c | 73 +- externals/SDL/src/core/windows/SDL_windows.h | 15 - externals/SDL/src/core/windows/SDL_xinput.c | 3 + externals/SDL/src/core/windows/SDL_xinput.h | 84 +- .../SDL/src/core/winrt/SDL_winrtapp_xaml.cpp | 2 +- externals/SDL/src/cpuinfo/SDL_cpuinfo.c | 85 +- externals/SDL/src/dynapi/SDL_dynapi.h | 4 - .../SDL/src/dynapi/SDL_dynapi_overrides.h | 28 +- externals/SDL/src/dynapi/SDL_dynapi_procs.h | 34 +- externals/SDL/src/dynapi/gendynapi.pl | 4 - externals/SDL/src/events/SDL_events.c | 151 +- externals/SDL/src/events/SDL_keyboard.c | 33 +- externals/SDL/src/events/SDL_mouse.c | 206 +- externals/SDL/src/events/SDL_mouse_c.h | 12 - externals/SDL/src/events/SDL_touch.c | 22 +- externals/SDL/src/events/SDL_touch_c.h | 1 - externals/SDL/src/events/SDL_windowevents.c | 7 +- externals/SDL/src/events/scancodes_darwin.h | 4 +- externals/SDL/src/events/scancodes_linux.h | 4 +- externals/SDL/src/events/scancodes_windows.h | 4 +- externals/SDL/src/events/scancodes_xfree86.h | 4 +- externals/SDL/src/file/SDL_rwops.c | 245 +- .../src/filesystem/os2/SDL_sysfilesystem.c | 24 +- .../src/filesystem/psp/SDL_sysfilesystem.c | 58 +- .../filesystem/windows/SDL_sysfilesystem.c | 20 +- .../SDL/src/haptic/windows/SDL_dinputhaptic.c | 6 +- .../SDL/src/haptic/windows/SDL_xinputhaptic.c | 3 +- externals/SDL/src/hidapi/SDL_hidapi.c | 112 +- externals/SDL/src/hidapi/android/hid.cpp | 119 +- externals/SDL/src/hidapi/libusb/hid.c | 54 +- externals/SDL/src/hidapi/mac/hid.c | 33 +- externals/SDL/src/hidapi/windows/hid.c | 32 +- .../SDL/src/joystick/SDL_gamecontroller.c | 78 +- .../SDL/src/joystick/SDL_gamecontrollerdb.h | 29 +- externals/SDL/src/joystick/SDL_joystick.c | 523 +- externals/SDL/src/joystick/SDL_joystick_c.h | 11 +- externals/SDL/src/joystick/SDL_sysjoystick.h | 6 - .../src/joystick/android/SDL_sysjoystick.c | 8 - .../SDL/src/joystick/bsd/SDL_bsdjoystick.c | 11 +- externals/SDL/src/joystick/controller_type.h | 685 +- .../src/joystick/darwin/SDL_iokitjoystick.c | 8 +- .../SDL/src/joystick/dummy/SDL_sysjoystick.c | 7 - .../src/joystick/emscripten/SDL_sysjoystick.c | 7 - .../src/joystick/haiku/SDL_haikujoystick.cc | 17 +- .../src/joystick/hidapi/SDL_hidapi_gamecube.c | 33 +- .../SDL/src/joystick/hidapi/SDL_hidapi_luna.c | 10 +- .../SDL/src/joystick/hidapi/SDL_hidapi_ps4.c | 18 +- .../SDL/src/joystick/hidapi/SDL_hidapi_ps5.c | 21 +- .../src/joystick/hidapi/SDL_hidapi_rumble.c | 2 +- .../src/joystick/hidapi/SDL_hidapi_stadia.c | 2 +- .../src/joystick/hidapi/SDL_hidapi_steam.c | 2 +- .../src/joystick/hidapi/SDL_hidapi_switch.c | 179 +- .../src/joystick/hidapi/SDL_hidapi_xbox360.c | 2 +- .../src/joystick/hidapi/SDL_hidapi_xbox360w.c | 10 +- .../src/joystick/hidapi/SDL_hidapi_xboxone.c | 50 +- .../src/joystick/hidapi/SDL_hidapijoystick.c | 175 +- .../joystick/hidapi/SDL_hidapijoystick_c.h | 2 +- .../src/joystick/iphoneos/SDL_mfijoystick.m | 63 +- .../SDL/src/joystick/linux/SDL_sysjoystick.c | 552 +- .../src/joystick/linux/SDL_sysjoystick_c.h | 6 - .../SDL/src/joystick/os2/SDL_os2joystick.c | 9 +- .../SDL/src/joystick/psp/SDL_sysjoystick.c | 8 +- .../SDL/src/joystick/sort_controllers.py | 2 +- externals/SDL/src/joystick/usb_ids.h | 4 - .../joystick/virtual/SDL_virtualjoystick.c | 447 +- .../joystick/virtual/SDL_virtualjoystick_c.h | 18 +- .../SDL/src/joystick/vita/SDL_sysjoystick.c | 12 +- .../src/joystick/windows/SDL_dinputjoystick.c | 8 +- .../joystick/windows/SDL_rawinputjoystick.c | 209 +- .../windows/SDL_windows_gaming_input.c | 123 +- .../joystick/windows/SDL_windowsjoystick.c | 16 +- .../joystick/windows/SDL_windowsjoystick_c.h | 2 +- .../src/joystick/windows/SDL_xinputjoystick.c | 18 +- externals/SDL/src/libm/math_private.h | 5 +- externals/SDL/src/loadso/os2/SDL_sysloadso.c | 2 +- .../SDL/src/loadso/windows/SDL_sysloadso.c | 2 +- externals/SDL/src/main/haiku/SDL_BApp.h | 51 +- externals/SDL/src/main/uikit/SDL_uikit_main.c | 1 + .../SDL/src/main/windows/SDL_windows_main.c | 2 +- externals/SDL/src/main/windows/version.rc | 8 +- externals/SDL/src/misc/winrt/SDL_sysurl.cpp | 3 +- externals/SDL/src/power/linux/SDL_syspower.c | 32 +- externals/SDL/src/render/SDL_d3dmath.c | 4 +- externals/SDL/src/render/SDL_d3dmath.h | 4 +- externals/SDL/src/render/SDL_render.c | 279 +- externals/SDL/src/render/SDL_sysrender.h | 28 +- .../SDL/src/render/direct3d/SDL_render_d3d.c | 153 +- .../src/render/direct3d11/SDL_render_d3d11.c | 135 +- .../src/render/direct3d11/SDL_shaders_d3d11.c | 4 +- .../src/render/direct3d11/SDL_shaders_d3d11.h | 2 - .../SDL/src/render/metal/SDL_render_metal.m | 154 +- .../SDL/src/render/opengl/SDL_render_gl.c | 257 +- .../SDL/src/render/opengl/SDL_shaders_gl.c | 3 +- .../SDL/src/render/opengl/SDL_shaders_gl.h | 2 - .../src/render/opengles2/SDL_render_gles2.c | 116 +- .../src/render/opengles2/SDL_shaders_gles2.c | 5 - .../src/render/opengles2/SDL_shaders_gles2.h | 2 - externals/SDL/src/render/psp/SDL_render_psp.c | 67 +- .../src/render/software/SDL_blendfillrect.c | 4 +- .../SDL/src/render/software/SDL_blendline.c | 2 +- .../SDL/src/render/software/SDL_blendpoint.c | 4 +- .../SDL/src/render/software/SDL_drawline.c | 4 +- .../SDL/src/render/software/SDL_drawpoint.c | 4 +- .../SDL/src/render/software/SDL_render_sw.c | 138 +- .../SDL/src/render/software/SDL_rotate.c | 235 +- .../SDL/src/render/software/SDL_rotate.h | 10 +- .../SDL/src/render/software/SDL_triangle.c | 57 +- .../src/render/vitagxm/SDL_render_vita_gxm.c | 291 +- .../vitagxm/SDL_render_vita_gxm_memory.c | 76 +- .../vitagxm/SDL_render_vita_gxm_memory.h | 16 +- .../vitagxm/SDL_render_vita_gxm_tools.c | 152 +- .../vitagxm/SDL_render_vita_gxm_tools.h | 7 +- .../vitagxm/SDL_render_vita_gxm_types.h | 13 +- .../src/sensor/windows/SDL_windowssensor.c | 5 +- externals/SDL/src/stdlib/SDL_getenv.c | 14 +- externals/SDL/src/stdlib/SDL_iconv.c | 25 +- externals/SDL/src/stdlib/SDL_malloc.c | 16 +- externals/SDL/src/stdlib/SDL_qsort.c | 33 - externals/SDL/src/stdlib/SDL_stdlib.c | 7 +- externals/SDL/src/stdlib/SDL_string.c | 194 +- externals/SDL/src/test/SDL_test_common.c | 2 - externals/SDL/src/test/SDL_test_harness.c | 11 +- externals/SDL/src/test/SDL_test_random.c | 2 +- externals/SDL/src/thread/SDL_thread_c.h | 4 - .../SDL/src/thread/generic/SDL_syscond.c | 6 +- .../SDL/src/thread/generic/SDL_sysmutex.c | 6 +- externals/SDL/src/thread/generic/SDL_syssem.c | 6 +- externals/SDL/src/thread/os2/SDL_sysmutex.c | 16 +- externals/SDL/src/thread/os2/SDL_syssem.c | 6 +- externals/SDL/src/thread/psp/SDL_syscond.c | 6 +- externals/SDL/src/thread/psp/SDL_sysmutex.c | 6 +- externals/SDL/src/thread/psp/SDL_syssem.c | 6 +- .../SDL/src/thread/pthread/SDL_syscond.c | 8 +- .../SDL/src/thread/pthread/SDL_sysmutex.c | 6 +- externals/SDL/src/thread/pthread/SDL_syssem.c | 8 +- .../SDL/src/thread/pthread/SDL_systhread.c | 19 +- .../SDL/src/thread/stdcpp/SDL_syscond.cpp | 15 +- .../SDL/src/thread/stdcpp/SDL_sysmutex.cpp | 11 +- .../SDL/src/thread/stdcpp/SDL_systhread.cpp | 6 +- externals/SDL/src/thread/vita/SDL_syscond.c | 6 +- externals/SDL/src/thread/vita/SDL_sysmutex.c | 6 +- externals/SDL/src/thread/vita/SDL_syssem.c | 6 +- .../SDL/src/thread/windows/SDL_syscond_cv.c | 8 +- .../SDL/src/thread/windows/SDL_sysmutex.c | 12 +- externals/SDL/src/thread/windows/SDL_syssem.c | 16 +- externals/SDL/src/timer/os2/SDL_systimer.c | 13 +- externals/SDL/src/timer/unix/SDL_systimer.c | 15 +- externals/SDL/src/video/SDL_RLEaccel.c | 32 +- externals/SDL/src/video/SDL_blit.c | 4 +- externals/SDL/src/video/SDL_blit.h | 18 +- externals/SDL/src/video/SDL_blit_0.c | 83 - externals/SDL/src/video/SDL_blit_1.c | 44 +- externals/SDL/src/video/SDL_blit_A.c | 72 +- externals/SDL/src/video/SDL_blit_N.c | 158 +- externals/SDL/src/video/SDL_blit_auto.c | 28 +- externals/SDL/src/video/SDL_blit_slow.c | 59 +- externals/SDL/src/video/SDL_bmp.c | 37 +- externals/SDL/src/video/SDL_egl.c | 102 +- externals/SDL/src/video/SDL_egl_c.h | 2 +- externals/SDL/src/video/SDL_fillrect.c | 34 +- externals/SDL/src/video/SDL_pixels.c | 43 +- externals/SDL/src/video/SDL_rect.c | 491 +- externals/SDL/src/video/SDL_surface.c | 113 +- externals/SDL/src/video/SDL_sysvideo.h | 10 - externals/SDL/src/video/SDL_video.c | 520 +- externals/SDL/src/video/SDL_vulkan_internal.h | 8 +- externals/SDL/src/video/SDL_yuv.c | 46 - .../SDL/src/video/android/SDL_androidevents.c | 11 +- .../SDL/src/video/android/SDL_androidgl.c | 2 +- .../src/video/android/SDL_androidkeyboard.c | 8 +- .../SDL/src/video/android/SDL_androidvideo.c | 3 - .../SDL/src/video/android/SDL_androidwindow.c | 36 +- .../SDL/src/video/android/SDL_androidwindow.h | 3 - .../SDL/src/video/cocoa/SDL_cocoaclipboard.h | 4 +- .../SDL/src/video/cocoa/SDL_cocoaclipboard.m | 12 +- .../SDL/src/video/cocoa/SDL_cocoaevents.m | 64 +- .../SDL/src/video/cocoa/SDL_cocoakeyboard.m | 64 +- .../SDL/src/video/cocoa/SDL_cocoamessagebox.m | 12 +- .../SDL/src/video/cocoa/SDL_cocoametalview.m | 17 +- .../SDL/src/video/cocoa/SDL_cocoamodes.m | 37 +- .../SDL/src/video/cocoa/SDL_cocoamouse.m | 139 +- .../SDL/src/video/cocoa/SDL_cocoaopengl.m | 81 +- .../SDL/src/video/cocoa/SDL_cocoaopengles.m | 37 +- .../SDL/src/video/cocoa/SDL_cocoashape.m | 17 +- .../SDL/src/video/cocoa/SDL_cocoavideo.h | 21 +- .../SDL/src/video/cocoa/SDL_cocoavideo.m | 63 +- .../SDL/src/video/cocoa/SDL_cocoawindow.h | 34 +- .../SDL/src/video/cocoa/SDL_cocoawindow.m | 430 +- .../src/video/directfb/SDL_DirectFB_window.c | 7 +- .../SDL/src/video/dummy/SDL_nullframebuffer.c | 8 +- externals/SDL/src/video/dummy/SDL_nullvideo.c | 3 +- .../video/emscripten/SDL_emscriptenevents.c | 6 +- .../emscripten/SDL_emscriptenframebuffer.c | 5 +- .../video/emscripten/SDL_emscriptenmouse.c | 9 +- .../video/emscripten/SDL_emscriptenvideo.c | 27 +- externals/SDL/src/video/haiku/SDL_BWin.h | 416 +- .../SDL/src/video/haiku/SDL_bframebuffer.cc | 150 +- externals/SDL/src/video/haiku/SDL_bopengl.cc | 36 +- externals/SDL/src/video/haiku/SDL_bvideo.cc | 29 +- externals/SDL/src/video/haiku/SDL_bwindow.cc | 14 +- externals/SDL/src/video/haiku/SDL_bwindow.h | 1 - .../SDL/src/video/kmsdrm/SDL_kmsdrmsym.h | 4 +- .../SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c | 4 +- externals/SDL/src/video/nacl/SDL_naclwindow.c | 3 +- .../offscreen/SDL_offscreenframebuffer.c | 8 +- externals/SDL/src/video/os2/SDL_os2dive.c | 8 +- .../SDL/src/video/os2/SDL_os2messagebox.c | 10 +- externals/SDL/src/video/os2/SDL_os2util.c | 9 +- externals/SDL/src/video/os2/SDL_os2video.c | 18 +- externals/SDL/src/video/os2/SDL_os2vman.c | 11 +- externals/SDL/src/video/pandora/SDL_pandora.c | 4 +- externals/SDL/src/video/psp/SDL_pspvideo.c | 4 +- .../SDL/src/video/raspberry/SDL_rpivideo.c | 4 +- .../SDL/src/video/riscos/SDL_riscosevents.c | 23 +- .../SDL/src/video/riscos/SDL_riscosmodes.c | 5 +- .../SDL/src/video/riscos/SDL_riscosvideo.c | 5 - .../SDL/src/video/riscos/SDL_riscoswindow.c | 11 +- .../SDL/src/video/riscos/scancodes_riscos.h | 4 +- externals/SDL/src/video/sdlgenblit.pl | 104 +- .../SDL/src/video/uikit/SDL_uikitevents.m | 8 +- .../SDL/src/video/uikit/SDL_uikitmessagebox.m | 26 +- .../SDL/src/video/uikit/SDL_uikitopengles.m | 4 +- .../SDL/src/video/uikit/SDL_uikitopenglview.m | 2 +- .../SDL/src/video/uikit/SDL_uikitvideo.m | 11 +- .../SDL/src/video/uikit/SDL_uikitwindow.m | 4 +- .../SDL/src/video/vita/SDL_vitaframebuffer.c | 2 +- externals/SDL/src/video/vita/SDL_vitagl.c | 2 +- externals/SDL/src/video/vita/SDL_vitagl_c.h | 2 +- externals/SDL/src/video/vita/SDL_vitagl_pvr.c | 69 +- .../SDL/src/video/vita/SDL_vitagl_pvr_c.h | 9 +- externals/SDL/src/video/vita/SDL_vitatouch.c | 29 +- externals/SDL/src/video/vita/SDL_vitavideo.c | 68 +- externals/SDL/src/video/vita/SDL_vitavideo.h | 21 +- .../SDL/src/video/vivante/SDL_vivantevideo.c | 7 +- .../SDL/src/video/wayland/SDL_waylanddyn.h | 12 +- .../SDL/src/video/wayland/SDL_waylandevents.c | 665 +- .../src/video/wayland/SDL_waylandevents_c.h | 44 - .../src/video/wayland/SDL_waylandkeyboard.h | 1 - .../src/video/wayland/SDL_waylandopengles.c | 10 +- .../SDL/src/video/wayland/SDL_waylandsym.h | 22 +- .../SDL/src/video/wayland/SDL_waylandvideo.c | 447 +- .../SDL/src/video/wayland/SDL_waylandvideo.h | 19 +- .../SDL/src/video/wayland/SDL_waylandvulkan.c | 4 +- .../SDL/src/video/wayland/SDL_waylandwindow.c | 913 +- .../SDL/src/video/wayland/SDL_waylandwindow.h | 63 +- .../SDL/src/video/windows/SDL_windowsevents.c | 305 +- .../src/video/windows/SDL_windowskeyboard.c | 276 +- .../src/video/windows/SDL_windowskeyboard.h | 2 - .../SDL/src/video/windows/SDL_windowsmodes.c | 397 +- .../SDL/src/video/windows/SDL_windowsmodes.h | 2 - .../SDL/src/video/windows/SDL_windowsmouse.c | 11 +- .../SDL/src/video/windows/SDL_windowsopengl.c | 7 - .../SDL/src/video/windows/SDL_windowsopengl.h | 1 - .../src/video/windows/SDL_windowsopengles.c | 9 - .../src/video/windows/SDL_windowsopengles.h | 1 - .../SDL/src/video/windows/SDL_windowsvideo.c | 195 - .../SDL/src/video/windows/SDL_windowsvideo.h | 255 +- .../SDL/src/video/windows/SDL_windowswindow.c | 428 +- .../SDL/src/video/windows/SDL_windowswindow.h | 9 - externals/SDL/src/video/windows/wmmsg.h | 2 +- .../SDL/src/video/winrt/SDL_winrtopengles.cpp | 2 +- .../SDL/src/video/winrt/SDL_winrtvideo.cpp | 18 +- externals/SDL/src/video/x11/SDL_x11dyn.c | 10 +- externals/SDL/src/video/x11/SDL_x11dyn.h | 6 + externals/SDL/src/video/x11/SDL_x11events.c | 80 +- externals/SDL/src/video/x11/SDL_x11events.h | 1 - externals/SDL/src/video/x11/SDL_x11keyboard.c | 13 +- .../SDL/src/video/x11/SDL_x11messagebox.c | 16 +- externals/SDL/src/video/x11/SDL_x11modes.c | 973 +- externals/SDL/src/video/x11/SDL_x11modes.h | 25 +- externals/SDL/src/video/x11/SDL_x11mouse.c | 19 +- externals/SDL/src/video/x11/SDL_x11opengl.c | 5 + externals/SDL/src/video/x11/SDL_x11sym.h | 30 +- externals/SDL/src/video/x11/SDL_x11video.h | 8 +- externals/SDL/src/video/x11/SDL_x11window.c | 320 +- externals/SDL/src/video/x11/SDL_x11window.h | 1 + externals/SDL/src/video/yuv2rgb/yuv_rgb.c | 34 - externals/SDL/src/video/yuv2rgb/yuv_rgb.h | 31 - .../SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h | 19 +- .../SDL/src/video/yuv2rgb/yuv_rgb_std_func.h | 9 +- externals/SDL/test/CMakeLists.txt | 291 +- externals/SDL/test/Makefile.in | 124 +- externals/SDL/test/Makefile.os2 | 76 +- externals/SDL/test/autogen.sh | 8 +- externals/SDL/test/checkkeys.c | 9 +- externals/SDL/test/configure | 2419 ++- externals/SDL/test/controllermap.c | 42 +- externals/SDL/test/loopwave.c | 14 +- externals/SDL/test/loopwavequeue.c | 15 +- externals/SDL/test/testatomic.c | 33 +- externals/SDL/test/testaudiohotplug.c | 14 +- externals/SDL/test/testautomation_hints.c | 8 +- externals/SDL/test/testautomation_platform.c | 21 +- externals/SDL/test/testautomation_rect.c | 106 +- externals/SDL/test/testautomation_render.c | 59 +- externals/SDL/test/testautomation_stdlib.c | 172 +- externals/SDL/test/testautomation_suites.h | 2 - externals/SDL/test/testautomation_surface.c | 182 +- externals/SDL/test/testautomation_video.c | 131 +- externals/SDL/test/testcustomcursor.c | 66 +- externals/SDL/test/testerror.c | 6 - externals/SDL/test/testevdev.c | 38 +- externals/SDL/test/testgamecontroller.c | 342 +- externals/SDL/test/testgeometry.c | 40 +- externals/SDL/test/testgesture.c | 3 +- externals/SDL/test/testgles2.c | 73 +- externals/SDL/test/testgles2_sdf.c | 18 +- externals/SDL/test/testiconv.c | 6 +- externals/SDL/test/testime.c | 10 +- externals/SDL/test/testmouse.c | 38 - externals/SDL/test/testmultiaudio.c | 6 +- externals/SDL/test/testnative.c | 34 +- externals/SDL/test/testoverlay2.c | 10 +- externals/SDL/test/testplatform.c | 63 +- externals/SDL/test/testqsort.c | 2 +- externals/SDL/test/testrendercopyex.c | 56 +- externals/SDL/test/testrendertarget.c | 58 +- externals/SDL/test/testscale.c | 55 +- externals/SDL/test/testshader.c | 49 +- externals/SDL/test/testsprite2.c | 40 +- externals/SDL/test/testspriteminimal.c | 54 +- externals/SDL/test/teststreaming.c | 10 +- externals/SDL/test/testsurround.c | 7 +- externals/SDL/test/testthread.c | 6 - externals/SDL/test/testtimer.c | 6 - externals/SDL/test/testviewport.c | 55 +- 498 files changed, 16027 insertions(+), 27028 deletions(-) create mode 100755 externals/SDL/.github/workflows/os2.yml diff --git a/README.md b/README.md index e6f85b2dc..131073669 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2846. +This is the source code for early-access 2847. ## Legal Notice diff --git a/externals/SDL/.github/workflows/android.yml b/externals/SDL/.github/workflows/android.yml index 65820ee66..7b2bd3447 100755 --- a/externals/SDL/.github/workflows/android.yml +++ b/externals/SDL/.github/workflows/android.yml @@ -4,57 +4,11 @@ on: [push, pull_request] jobs: android: - name: ${{ matrix.platform.name }} runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: Android.mk } - - { name: CMake, cmake: '-DCMAKE_SYSTEM_PROCESSOR=aarch64 -DANDROID_PLATFORM=android-23 -DCMAKE_SYSTEM_VERSION=23 ' } - steps: - uses: actions/checkout@v2 - uses: nttld/setup-ndk@v1 - id: setup_ndk with: ndk-version: r21e - - name: Build (Android.mk) - if: ${{ matrix.platform.name == 'Android.mk' }} - run: | - ./build-scripts/androidbuildlibs.sh - - name: Setup (CMake) - if: ${{ matrix.platform.name == 'CMake' }} - run: | - sudo apt-get update - sudo apt-get install ninja-build - - name: Configure (CMake) - if: ${{ matrix.platform.name == 'CMake' }} - run: | - cmake -B build \ - -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ - ${{ matrix.platform.cmake }} \ - -DSDL_STATIC_PIC=ON \ - -DCMAKE_INSTALL_PREFIX=prefix \ - -DCMAKE_BUILD_TYPE=Release \ - -GNinja - - name: Build (CMake) - if: ${{ matrix.platform.name == 'CMake' }} - run: | - cmake --build build --config Release --parallel --verbose - - name: Install (CMake) - if: ${{ matrix.platform.name == 'CMake' }} - run: | - cmake --install build --config Release - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Verify CMake configuration files - if: ${{ matrix.platform.name == 'CMake' }} - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ - ${{ matrix.platform.cmake }} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} - cmake --build cmake_config_build --verbose + - name: Build + run: ./build-scripts/androidbuildlibs.sh diff --git a/externals/SDL/.github/workflows/emscripten.yml b/externals/SDL/.github/workflows/emscripten.yml index 16f0fc723..633c39125 100755 --- a/externals/SDL/.github/workflows/emscripten.yml +++ b/externals/SDL/.github/workflows/emscripten.yml @@ -11,27 +11,6 @@ jobs: with: version: 2.0.27 - name: Configure CMake - run: | - emcmake cmake -S . -B build \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix + run: emcmake cmake -B build - name: Build - run: cmake --build build/ --verbose - - name: Run build-time tests - run: | - set -eu - export SDL_TESTS_QUICK=1 - ctest -VV --test-dir build/ - - name: Install - run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - - name: Verify CMake configuration files - run: | - emcmake cmake -S cmake/test -B cmake_config_build \ - -DCMAKE_BUILD_TYPE=Release \ - -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} - cmake --build cmake_config_build --verbose + run: cmake --build build/ diff --git a/externals/SDL/.github/workflows/main.yml b/externals/SDL/.github/workflows/main.yml index f49f54a8a..4c1850fc0 100755 --- a/externals/SDL/.github/workflows/main.yml +++ b/externals/SDL/.github/workflows/main.yml @@ -15,12 +15,15 @@ jobs: fail-fast: false matrix: platform: - - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, cc: gcc } - - { name: Windows (mingw64+clang), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, cc: clang } - - { name: Linux (CMake), os: ubuntu-20.04, shell: sh, flags: true } - - { name: Linux (autotools), os: ubuntu-20.04, shell: sh, autotools: true } - - { name: MacOS (CMake), os: macos-latest, shell: sh } - - { name: MacOS (autotools), os: macos-latest, shell: sh, autotools: true } + - { name: Windows (x64), os: windows-latest, shell: pwsh, flags: -A x64 } + - { name: Windows (x86), os: windows-latest, shell: pwsh, flags: -A Win32 } + - { name: Windows (clang-cl x64), os: windows-latest, shell: pwsh, flags: -T ClangCL -A x64 } + - { name: Windows (clang-cl x86), os: windows-latest, shell: pwsh, flags: -T ClangCL -A Win32 } + - { name: Windows (ARM64), os: windows-latest, shell: pwsh, flags: -A ARM64 } + - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 } + - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 } + - { name: Linux, os: ubuntu-20.04, shell: sh, flags: -GNinja } + - { name: MacOS, os: macos-latest, shell: sh } steps: - name: Set up MSYS2 @@ -29,30 +32,16 @@ jobs: with: msystem: ${{ matrix.platform.msystem }} install: >- - ${{ matrix.platform.msys-env }}-${{ matrix.platform.cc }} + ${{ matrix.platform.msys-env }}-gcc ${{ matrix.platform.msys-env }}-cmake ${{ matrix.platform.msys-env }}-ninja ${{ matrix.platform.msys-env }}-pkg-config - - name: Configure MSYS2 compiler - if: matrix.platform.shell == 'msys2 {0}' - run: | - if test x${{ matrix.platform.cc}} == xgcc; then - echo "CC=gcc" >> $GITHUB_ENV - echo "CXX=g++" >> $GITHUB_ENV - fi - if test x${{ matrix.platform.cc}} == xclang; then - echo "CC=clang" >> $GITHUB_ENV - echo "CXX=clang++" >> $GITHUB_ENV - fi - name: Setup Linux dependencies if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install \ - autoconf \ - gnome-desktop-testing \ - wayland-protocols \ + sudo apt-get install wayland-protocols \ pkg-config \ ninja-build \ libasound2-dev \ @@ -89,132 +78,11 @@ jobs: git clone --depth 1 https://gitlab.gnome.org/jadahl/libdecor.git --branch 0.1.0 cd libdecor meson build --buildtype release -Ddemo=false -Ddbus=disabled - ninja -v -C build + ninja -C build sudo meson install -C build - - name: Setup Macos dependencies - if: runner.os == 'macOS' - run: | - brew install \ - ninja - uses: actions/checkout@v2 - - name: Check that versioning is consistent - # We only need to run this once: arbitrarily use the Linux/CMake build - if: "runner.os == 'Linux' && ! matrix.platform.autotools" - run: ./test/versioning.sh - - name: Configure (CMake) - if: "! matrix.platform.autotools" - run: | - cmake -S . -B build -G Ninja \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DCMAKE_INSTALL_PREFIX=cmake_prefix \ - -DCMAKE_BUILD_TYPE=Release - - name: Build (CMake) - if: "! matrix.platform.autotools" - run: | - cmake --build build/ --config Release --verbose --parallel - - name: Run build-time tests (CMake) - if: "! matrix.platform.autotools" - run: | - set -eu - export SDL_TESTS_QUICK=1 - ctest -VV --test-dir build/ - - name: Install (CMake) - if: "! matrix.platform.autotools" - run: | - set -eu - cmake --install build/ --config Release - echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV - ( cd cmake_prefix; find ) | LC_ALL=C sort -u - - name: Configure (Autotools) - if: matrix.platform.autotools - run: | - set -eu - rm -fr build-autotools - mkdir build-autotools - ./autogen.sh - ( - cd build-autotools - ${{ github.workspace }}/configure \ - --prefix=${{ github.workspace }}/autotools_prefix \ - ) - if test "${{ runner.os }}" != "macOS" ; then - curdir="$(pwd)" - multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" - ( - mkdir -p build-autotools/test - cd build-autotools/test - ${{ github.workspace }}/test/configure \ - --x-includes=/usr/include \ - --x-libraries="/usr/lib/${multiarch}" \ - --prefix=${{ github.workspace }}/autotools_prefix \ - SDL_CFLAGS="-I${curdir}/include" \ - SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \ - ac_cv_lib_SDL2_ttf_TTF_Init=no \ - ${NULL+} - ) - fi - - name: Build (Autotools) - if: matrix.platform.autotools - run: | - set -eu - parallel="$(getconf _NPROCESSORS_ONLN)" - make -j"${parallel}" -C build-autotools V=1 - if test "${{ runner.os }}" != "macOS" ; then - make -j"${parallel}" -C build-autotools/test V=1 - fi - - name: Run build-time tests (Autotools) - if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }} - run: | - set -eu - curdir="$(pwd)" - parallel="$(getconf _NPROCESSORS_ONLN)" - export SDL_TESTS_QUICK=1 - make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs" - - name: Install (Autotools) - if: matrix.platform.autotools - run: | - set -eu - curdir="$(pwd)" - parallel="$(getconf _NPROCESSORS_ONLN)" - make -j"${parallel}" -C build-autotools install V=1 - if test "${{ runner.os }}" != "macOS" ; then - make -j"${parallel}" -C build-autotools/test install V=1 - fi - ( cd autotools_prefix; find . ) | LC_ALL=C sort -u - echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} - cmake --build cmake_config_build --verbose - - name: Distcheck (Autotools) - if: matrix.platform.autotools - run: | - set -eu - parallel="$(getconf _NPROCESSORS_ONLN)" - make -j"${parallel}" -C build-autotools dist V=1 - # Similar to Automake `make distcheck`: check that the tarball - # release is sufficient to do a new build - mkdir distcheck - tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz - ( cd distcheck/SDL2-* && ./configure ) - make -j"${parallel}" -C distcheck/SDL2-* - - name: Run installed-tests (Autotools) - if: "runner.os == 'Linux' && matrix.platform.autotools" - run: | - set -eu - parallel="$(getconf _NPROCESSORS_ONLN)" - sudo make -j"${parallel}" -C build-autotools install - sudo make -j"${parallel}" -C build-autotools/test install - export SDL_TESTS_QUICK=1 - # We need to set LD_LIBRARY_PATH because it isn't in the default - # linker search path. We don't need to set XDG_DATA_DIRS for - # ginsttest-runner, because /usr/local/share *is* in the default - # search path for that. - env --chdir=/ \ - LD_LIBRARY_PATH=/usr/local/lib \ - SDL_AUDIODRIVER=dummy \ - SDL_VIDEODRIVER=dummy \ - ginsttest-runner --tap SDL2 + - name: Configure CMake + run: cmake -B build -DSDL_TEST=ON ${{ matrix.platform.flags }} + - name: Build + run: cmake --build build/ + diff --git a/externals/SDL/.github/workflows/os2.yml b/externals/SDL/.github/workflows/os2.yml new file mode 100755 index 000000000..c6f11e020 --- /dev/null +++ b/externals/SDL/.github/workflows/os2.yml @@ -0,0 +1,26 @@ +name: Build (OS/2) + +on: [push, pull_request] + +jobs: + os2: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Cache OpenWatcom + uses: actions/cache@v2 + env: + cache-name: cache-openwatcom + with: + path: ~/openwatcom + key: ${{ runner.os }}-build-${{ env.cache-name }} + + - name: Download OpenWatcom if not cached + run: if [ ! -d ~/openwatcom/binl64 ]; then wget --no-verbose 'https://github.com/open-watcom/open-watcom-v2/releases/download/Current-build/open-watcom-2_0-c-linux-x64' -O ~/ow.zip && mkdir -p ~/openwatcom && cd ~/openwatcom && unzip ~/ow.zip && chmod -R a+rx ~/openwatcom ; fi + shell: bash + + - name: Build + run: WATCOM="$HOME/openwatcom" build-scripts/os2-buildbot.sh + shell: bash + diff --git a/externals/SDL/.github/workflows/psp.yaml b/externals/SDL/.github/workflows/psp.yaml index 1ca74f6e8..b1b470e81 100755 --- a/externals/SDL/.github/workflows/psp.yaml +++ b/externals/SDL/.github/workflows/psp.yaml @@ -13,25 +13,6 @@ jobs: apk update apk add cmake gmp mpc1 mpfr4 make - name: Configure CMake - run: | - cmake -S . -B build \ - -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix + run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake -DSDL_TEST=ON - name: Build - run: cmake --build build --config Release - - name: Install - run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build --config Release - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build \ - -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ - -DTEST_SHARED=FALSE \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose + run: cmake --build build diff --git a/externals/SDL/.github/workflows/riscos.yml b/externals/SDL/.github/workflows/riscos.yml index 1791c9504..3f46668b7 100755 --- a/externals/SDL/.github/workflows/riscos.yml +++ b/externals/SDL/.github/workflows/riscos.yml @@ -3,65 +3,26 @@ name: Build (RISC OS) on: [push, pull_request] jobs: - Build: - name: ${{ matrix.platform.name }} + autotools: + name: autotools runs-on: ubuntu-latest container: riscosdotinfo/riscos-gccsdk-4.7:latest + steps: + - uses: actions/checkout@v2 + - name: Configure + run: ./configure --host=arm-unknown-riscos --disable-gcc-atomics + - name: Build + run: make -j`nproc` - strategy: - fail-fast: false - matrix: - platform: - - { name: autotools, test_args: '-DTEST_SHARED=FALSE' } # FIXME: autotools should build and install shared libraries - - { name: CMake } - + cmake: + name: CMake + runs-on: ubuntu-latest + container: riscosdotinfo/riscos-gccsdk-4.7:latest steps: - name: Setup dependencies run: apt-get update && apt-get install -y cmake ninja-build - uses: actions/checkout@v2 - - name: Configure (autotools) - if: ${{ contains(matrix.platform.name, 'autotools') }} - run: | - mkdir build_autotools - cd build_autotools - ../configure \ - --host=arm-unknown-riscos \ - --disable-gcc-atomics \ - --prefix=${{ github.workspace }}/prefix_autotools - - name: Build (autotools) - if: ${{ contains(matrix.platform.name, 'autotools') }} - run: make -C build_autotools -j`nproc` V=1 - - name: Install (autotools) - if: ${{ contains(matrix.platform.name, 'autotools') }} - run: | - echo "SDL2_DIR=${{ github.workspace }}/prefix_autotools" >> $GITHUB_ENV - make -C build_autotools install - ( cd ${{ github.workspace }}/prefix_autotools; find ) | LC_ALL=C sort -u - - name: Configure (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: | - cmake -S . -B build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ - -DRISCOS=ON \ - -DSDL_GCC_ATOMICS=OFF \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/prefix_cmake - - name: Build (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: cmake --build build --verbose - - name: Install (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: | - echo "SDL2_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV - cmake --install build/ - ( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ - -DCMAKE_BUILD_TYPE=Release \ - ${{ matrix.platform.test_args }} - cmake --build cmake_config_build --verbose + - name: Configure CMake + run: cmake -S. -Bbuild -G Ninja -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake -DRISCOS=ON -DSDL_GCC_ATOMICS=OFF -DCMAKE_BUILD_TYPE=Release + - name: Build + run: cmake --build build diff --git a/externals/SDL/.github/workflows/vita.yaml b/externals/SDL/.github/workflows/vita.yaml index 4e2a02661..49d1a2bfc 100755 --- a/externals/SDL/.github/workflows/vita.yaml +++ b/externals/SDL/.github/workflows/vita.yaml @@ -16,27 +16,8 @@ jobs: - name: Install CMake and GNU Make run: | apk update - apk add cmake make ninja + apk add cmake make - name: Configure CMake - run: | - cmake -S . -B build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix + run: cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release - name: Build - run: cmake --build build --verbose - - name: Install CMake - run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ - -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose + run: cmake --build build diff --git a/externals/SDL/.gitignore b/externals/SDL/.gitignore index 1f5e7249f..fd27cb76a 100755 --- a/externals/SDL/.gitignore +++ b/externals/SDL/.gitignore @@ -22,7 +22,6 @@ buildbot *.exe *.o *.obj -*.res *.lib *.a *.la diff --git a/externals/SDL/CMakeLists.txt b/externals/SDL/CMakeLists.txt index cc1b87b4a..9686ecbea 100755 --- a/externals/SDL/CMakeLists.txt +++ b/externals/SDL/CMakeLists.txt @@ -47,6 +47,7 @@ include(CheckCSourceCompiles) include(CheckCSourceRuns) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) +include(CheckTypeSize) include(CheckStructHasMember) include(CMakeDependentOption) include(FindPkgConfig) @@ -55,18 +56,23 @@ set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) -# Enable large file support on 32-bit glibc, so that we can access files -# with large inode numbers -check_symbol_exists("__GLIBC__" "stdlib.h" LIBC_IS_GLIBC) -if (LIBC_IS_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4) - add_compile_definitions(PRIVATE _FILE_OFFSET_BITS=64) -endif() - -# See docs/release_checklist.md +# General settings +# Edit include/SDL_version.h and change the version, then: +# SDL_MICRO_VERSION += 1; +# SDL_INTERFACE_AGE += 1; +# SDL_BINARY_AGE += 1; +# if any functions have been added, set SDL_INTERFACE_AGE to 0. +# if backwards compatibility has been broken, +# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. set(SDL_MAJOR_VERSION 2) -set(SDL_MINOR_VERSION 23) -set(SDL_MICRO_VERSION 1) +set(SDL_MINOR_VERSION 0) +set(SDL_MICRO_VERSION 20) +set(SDL_INTERFACE_AGE 2) +set(SDL_BINARY_AGE 20) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") +# the following should match the versions in Xcode project file: +set(DYLIB_CURRENT_VERSION 19.2.0) +set(DYLIB_COMPATIBILITY_VERSION 1.0.0) # Set defaults preventing destination file conflicts set(SDL_CMAKE_DEBUG_POSTFIX "d" @@ -75,40 +81,13 @@ set(SDL_CMAKE_DEBUG_POSTFIX "d" mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX) # Calculate a libtool-like version number -math(EXPR SDL_BINARY_AGE "${SDL_MINOR_VERSION} * 100 + ${SDL_MICRO_VERSION}") -if(SDL_MINOR_VERSION MATCHES "[02468]$") - # Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1 - set(SDL_INTERFACE_AGE ${SDL_MICRO_VERSION}) -else() - # Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0 - set(SDL_INTERFACE_AGE 0) -endif() - -# Increment this if there is an incompatible change - but if that happens, -# we should rename the library from SDL2 to SDL3, at which point this would -# reset to 0 anyway. -set(LT_MAJOR "0") - +math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}") math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}") -math(EXPR LT_CURRENT "${LT_MAJOR} + ${LT_AGE}") +math(EXPR LT_MAJOR "${LT_CURRENT}- ${LT_AGE}") set(LT_REVISION "${SDL_INTERFACE_AGE}") -# For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. -# TODO: in SDL 3, set the OUTPUT_NAME to plain SDL3, which will simplify -# it to libSDL3.so.0 -set(LT_RELEASE "2.0") +set(LT_RELEASE "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}") set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}") -# The following should match the versions in the Xcode project file. -# Each version is 1 higher than you might expect, for compatibility -# with libtool: macOS ABI versioning is 1-based, unlike other platforms -# which are normally 0-based. -math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${LT_MAJOR} + ${LT_AGE} + 1") -math(EXPR DYLIB_CURRENT_VERSION_MINOR "${LT_REVISION}") -math(EXPR DYLIB_COMPAT_VERSION_MAJOR "${LT_MAJOR} + 1") -set(DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.${DYLIB_CURRENT_VERSION_MINOR}.0") -set(DYLIB_COMPATIBILITY_VERSION "${DYLIB_COMPAT_VERSION_MAJOR}.0.0") - #message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}") # General settings & flags @@ -250,7 +229,7 @@ if(APPLE OR ARCH_64 OR MSVC_CLANG) set(OPT_DEF_SSEMATH ON) endif() endif() -if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2) +if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP) set(OPT_DEF_LIBC ON) endif() @@ -293,10 +272,10 @@ if(MSVC) endif() endif() -# Those are used for pkg-config and friends, so that the sdl2.pc, sdl2-config, +# Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config, # etc. are created correctly. set(SDL_LIBS "-lSDL2") -set(SDL_CFLAGS ) +set(SDL_CFLAGS "") # When building shared lib for Windows with MinGW, # avoid the DLL having a "lib" prefix @@ -314,14 +293,14 @@ if(CYGWIN) # We build SDL on cygwin without the UNIX emulation layer target_include_directories(sdl-build-options INTERFACE "/usr/include/mingw") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mno-cygwin") - check_c_source_compiles("int main(int argc, char **argv) { return 0; }" + check_c_source_compiles("int main(int argc, char **argv) {}" HAVE_GCC_NO_CYGWIN) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) if(HAVE_GCC_NO_CYGWIN) - list(APPEND EXTRA_LDFLAGS_BUILD "-mno-cygwin") + list(APPEND EXTRA_LDFLAGS "-mno-cygwin") list(APPEND SDL_LIBS "-mno-cygwin") endif() - list(APPEND SDL_CFLAGS "-I/usr/include/mingw") + set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include/mingw") endif() # General includes @@ -352,10 +331,9 @@ if(EMSCRIPTEN) set(SDL_ATOMIC_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF) - set(SDL_TEST_ENABLED_BY_DEFAULT OFF) endif() -if(VITA OR PSP OR PS2) +if(VITA OR PSP) set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) endif() @@ -379,15 +357,11 @@ if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT) endif() endif() -if (NOT DEFINED SDL_TEST_ENABLED_BY_DEFAULT) - set(SDL_TEST_ENABLED_BY_DEFAULT ON) -endif() - set(LONGESTOPTIONNAME 0) # set_option and friends will change this. set(SDL_SUBSYSTEMS Atomic Audio Video Render Events Joystick Haptic Hidapi Power Threads Timers - File Loadso CPUinfo Filesystem Sensor Locale Misc) + File Loadso CPUinfo Filesystem Dlopen Sensor Locale) foreach(_SUB ${SDL_SUBSYSTEMS}) string(TOUPPER ${_SUB} _OPT) if (NOT DEFINED SDL_${_OPT}_ENABLED_BY_DEFAULT) @@ -396,11 +370,6 @@ foreach(_SUB ${SDL_SUBSYSTEMS}) option(SDL_${_OPT} "Enable the ${_SUB} subsystem" ${SDL_${_OPT}_ENABLED_BY_DEFAULT}) endforeach() -# Allow some projects to be built conditionally. -set_option(SDL2_DISABLE_SDL2MAIN "Disable building/installation of SDL2main" OFF) -set_option(SDL2_DISABLE_INSTALL "Disable installation of SDL2" OFF) -set_option(SDL2_DISABLE_UNINSTALL "Disable uninstallation of SDL2" OFF) - option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") #set_option(SDL_DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON) set_option(SDL_LIBC "Use the system C library" ${OPT_DEF_LIBC}) @@ -449,14 +418,14 @@ set_option(SDL_RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) set_option(SDL_CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" ${UNIX_SYS}) set_option(SDL_X11 "Use X11 video driver" ${UNIX_SYS}) dep_option(SDL_X11_SHARED "Dynamically load X11 support" ON "SDL_X11" OFF) -set(SDL_X11_OPTIONS Xcursor Xdbe XInput Xfixes Xrandr Xscrnsaver XShape) +set(SDL_X11_OPTIONS Xcursor Xdbe Xinerama XInput Xfixes Xrandr Xscrnsaver XShape Xvm) foreach(_SUB ${SDL_X11_OPTIONS}) string(TOUPPER "SDL_X11_${_SUB}" _OPT) dep_option(${_OPT} "Enable ${_SUB} support" ON "SDL_X11" OFF) endforeach() set_option(SDL_WAYLAND "Use Wayland video driver" ${UNIX_SYS}) dep_option(SDL_WAYLAND_SHARED "Dynamically load Wayland support" ON "SDL_WAYLAND" OFF) -dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" OFF) +dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" ON) dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" ON "SDL_WAYLAND_LIBDECOR" OFF) dep_option(SDL_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "SDL_WAYLAND" OFF) set_option(SDL_RPI "Use Raspberry Pi video driver" ${UNIX_SYS}) @@ -480,15 +449,13 @@ set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") set(SDL_STATIC ${SDL_STATIC_ENABLED_BY_DEFAULT} CACHE BOOL "Build a static version of the library") -set(SDL_TEST ${SDL_TEST_ENABLED_BY_DEFAULT} CACHE BOOL "Build the SDL2_test library") -dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" "${CMAKE_POSITION_INDEPENDENT_CODE}" "SDL_STATIC" OFF) -dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST OFF) -set_option(SDL_INSTALL_TESTS "Install test-cases" OFF) +dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) +set_option(SDL_TEST "Build the test directory" OFF) if(VITA) - set_option(VIDEO_VITA_PIB "Build with PSVita piglet gles2 support" OFF) - set_option(VIDEO_VITA_PVR "Build with PSVita PVR gles/gles2 support" OFF) + set_option(VIDEO_VITA_PIB "Build with PSVita piglet gles2 support" OFF) + set_option(VIDEO_VITA_PVR "Build with PSVita PVR gles/gles2 support" OFF) endif() # General source files @@ -500,7 +467,6 @@ file(GLOB SOURCE_FILES ${SDL2_SOURCE_DIR}/src/dynapi/*.c ${SDL2_SOURCE_DIR}/src/events/*.c ${SDL2_SOURCE_DIR}/src/file/*.c - ${SDL2_SOURCE_DIR}/src/joystick/*.c ${SDL2_SOURCE_DIR}/src/haptic/*.c ${SDL2_SOURCE_DIR}/src/hidapi/*.c ${SDL2_SOURCE_DIR}/src/libm/*.c @@ -517,18 +483,15 @@ file(GLOB SOURCE_FILES ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) -set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 1) -if(SDL_ASSERTIONS MATCHES "^(auto|)$") +if(SDL_ASSERTIONS STREQUAL "auto") # Do nada - use optimization settings to determine the assertion level - set(SDL_DEFAULT_ASSERT_LEVEL ) - set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 0) -elseif(SDL_ASSERTIONS MATCHES "^(disabled|0)$") +elseif(SDL_ASSERTIONS STREQUAL "disabled") set(SDL_DEFAULT_ASSERT_LEVEL 0) -elseif(SDL_ASSERTIONS MATCHES "^(release|1)$") +elseif(SDL_ASSERTIONS STREQUAL "release") set(SDL_DEFAULT_ASSERT_LEVEL 1) -elseif(SDL_ASSERTIONS MATCHES "^(enabled|2)$") +elseif(SDL_ASSERTIONS STREQUAL "enabled") set(SDL_DEFAULT_ASSERT_LEVEL 2) -elseif(SDL_ASSERTIONS MATCHES "^(paranoid|3)$") +elseif(SDL_ASSERTIONS STREQUAL "paranoid") set(SDL_DEFAULT_ASSERT_LEVEL 3) else() message_error("unknown assertion level") @@ -577,7 +540,7 @@ if(USE_GCC OR USE_CLANG) #if !defined(__GNUC__) || __GNUC__ < 3 #error Dependency tracking requires GCC 3.0 or newer #endif - int main(int argc, char **argv) { return 0; }" HAVE_DEPENDENCY_TRACKING) + int main(int argc, char **argv) { }" HAVE_DEPENDENCY_TRACKING) endif() if(SDL_GCC_ATOMICS) @@ -588,19 +551,17 @@ if(USE_GCC OR USE_CLANG) __sync_lock_test_and_set(&x, y); __sync_fetch_and_add(&a, 1); __sync_bool_compare_and_swap(&a, 5, 10); - __sync_bool_compare_and_swap(&x, y, z); - return 0; }" HAVE_GCC_ATOMICS) + __sync_bool_compare_and_swap(&x, y, z); }" HAVE_GCC_ATOMICS) if(NOT HAVE_GCC_ATOMICS) check_c_source_compiles("int main(int argc, char **argv) { int a; __sync_lock_test_and_set(&a, 1); - __sync_lock_release(&a); - return 0; }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET) + __sync_lock_release(&a); }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET) endif() endif() set(CMAKE_REQUIRED_FLAGS "-mpreferred-stack-boundary=2") - check_c_source_compiles("int x = 0; int main(int argc, char **argv) { return 0; }" + check_c_source_compiles("int x = 0; int main(int argc, char **argv) {}" HAVE_GCC_PREFERRED_STACK_BOUNDARY) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) @@ -609,7 +570,7 @@ if(USE_GCC OR USE_CLANG) #if !defined(__GNUC__) || __GNUC__ < 4 #error SDL only uses visibility attributes in GCC 4 or newer #endif - int main(int argc, char **argv) { return 0; }" HAVE_GCC_FVISIBILITY) + int main(int argc, char **argv) {}" HAVE_GCC_FVISIBILITY) if(HAVE_GCC_FVISIBILITY) list(APPEND EXTRA_CFLAGS "-fvisibility=hidden") endif() @@ -621,16 +582,15 @@ if(USE_GCC OR USE_CLANG) endif() if(APPLE) - # FIXME: use generator expression instead of appending to EXTRA_LDFLAGS_BUILD - list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-undefined,error") - list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") - list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-current_version,${DYLIB_CURRENT_VERSION}") + list(APPEND EXTRA_LDFLAGS "-Wl,-undefined,error") + list(APPEND EXTRA_LDFLAGS "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") + list(APPEND EXTRA_LDFLAGS "-Wl,-current_version,${DYLIB_CURRENT_VERSION}") elseif(NOT OPENBSD) set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") check_c_compiler_flag("" HAVE_NO_UNDEFINED) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) if(HAVE_NO_UNDEFINED AND NOT (USE_CLANG AND WINDOWS)) - list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,--no-undefined") + list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") endif() endif() @@ -643,19 +603,10 @@ if(USE_GCC OR USE_CLANG) endif() endif() endif() -if(MSVC) - target_compile_definitions(sdl-build-options INTERFACE "-D_CRT_SECURE_NO_DEPRECATE") - target_compile_definitions(sdl-build-options INTERFACE "-D_CRT_NONSTDC_NO_DEPRECATE") - target_compile_definitions(sdl-build-options INTERFACE "-D_CRT_SECURE_NO_WARNINGS") -endif() - -if(MSVC) - # Due to a limitation of Microsoft's LTO implementation, LTO must be disabled for memcpy and memset. - set_property(SOURCE src/stdlib/SDL_memcpy.c src/stdlib/SDL_memset.c APPEND PROPERTY COMPILE_FLAGS /GL-) -endif() if(SDL_ASSEMBLY) if(USE_GCC OR USE_CLANG) + set(SDL_ASSEMBLY_ROUTINES 1) # TODO: Those all seem to be quite GCC specific - needs to be # reworked for better compiler support set(HAVE_ASSEMBLY TRUE) @@ -675,7 +626,7 @@ if(SDL_ASSEMBLY) #ifndef __MMX__ #error Assembler CPP flag not enabled #endif - int main(int argc, char **argv) { return 0; }" HAVE_MMX) + int main(int argc, char **argv) { }" HAVE_MMX) if(HAVE_MMX) list(APPEND EXTRA_CFLAGS "-mmmx") endif() @@ -692,7 +643,6 @@ if(SDL_ASSEMBLY) int main(int argc, char **argv) { void *p = 0; _m_prefetch(p); - return 0; }" HAVE_3DNOW) if(HAVE_3DNOW) list(APPEND EXTRA_CFLAGS "-m3dnow") @@ -716,7 +666,7 @@ if(SDL_ASSEMBLY) #ifndef __SSE__ #error Assembler CPP flag not enabled #endif - int main(int argc, char **argv) { return 0; }" HAVE_SSE) + int main(int argc, char **argv) { }" HAVE_SSE) if(HAVE_SSE) list(APPEND EXTRA_CFLAGS "-msse") endif() @@ -739,7 +689,7 @@ if(SDL_ASSEMBLY) #ifndef __SSE2__ #error Assembler CPP flag not enabled #endif - int main(int argc, char **argv) { return 0; }" HAVE_SSE2) + int main(int argc, char **argv) { }" HAVE_SSE2) if(HAVE_SSE2) list(APPEND EXTRA_CFLAGS "-msse2") endif() @@ -762,7 +712,7 @@ if(SDL_ASSEMBLY) #ifndef __SSE3__ #error Assembler CPP flag not enabled #endif - int main(int argc, char **argv) { return 0; }" HAVE_SSE3) + int main(int argc, char **argv) { }" HAVE_SSE3) if(HAVE_SSE3) list(APPEND EXTRA_CFLAGS "-msse3") endif() @@ -791,12 +741,12 @@ if(SDL_ASSEMBLY) vector unsigned int vzero() { return vec_splat_u32(0); } - int main(int argc, char **argv) { return 0; }" HAVE_ALTIVEC_H_HDR) + int main(int argc, char **argv) { }" HAVE_ALTIVEC_H_HDR) check_c_source_compiles(" vector unsigned int vzero() { return vec_splat_u32(0); } - int main(int argc, char **argv) { return 0; }" HAVE_ALTIVEC) + int main(int argc, char **argv) { }" HAVE_ALTIVEC) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) if(HAVE_ALTIVEC OR HAVE_ALTIVEC_H_HDR) set(HAVE_ALTIVEC TRUE) # if only HAVE_ALTIVEC_H_HDR is set @@ -829,7 +779,7 @@ if(SDL_ASSEMBLY) set(HAVE_ARMSIMD TRUE) set(SDL_ARM_SIMD_BLITTERS 1) file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) - list(APPEND SOURCE_FILES ${ARMSIMD_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ARMSIMD_SOURCES}) set(WARN_ABOUT_ARM_SIMD_ASM_MIT TRUE) endif() endif() @@ -857,7 +807,7 @@ if(SDL_ASSEMBLY) set(HAVE_ARMNEON TRUE) set(SDL_ARM_NEON_BLITTERS 1) file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) - list(APPEND SOURCE_FILES ${ARMNEON_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ARMNEON_SOURCES}) set(WARN_ABOUT_ARM_NEON_ASM_MIT TRUE) endif() endif() @@ -873,6 +823,7 @@ if(SDL_ASSEMBLY) set(HAVE_SSE2 TRUE) set(HAVE_SSE3 TRUE) check_include_file("immintrin.h" HAVE_IMMINTRIN_H) + set(SDL_ASSEMBLY_ROUTINES 1) endif() endif() @@ -888,7 +839,7 @@ if(SDL_LIBC) endforeach() set(HAVE_SIGNAL_H 1) foreach(_FN - malloc calloc realloc free bsearch qsort abs memset memcpy memmove memcmp + malloc calloc realloc free qsort abs memset memcpy memmove memcmp wcslen _wcsdup wcsdup wcsstr wcscmp wcsncmp _wcsicmp _wcsnicmp strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp @@ -900,7 +851,9 @@ if(SDL_LIBC) string(TOUPPER ${_FN} _UPPER) set(HAVE_${_UPPER} 1) endforeach() - set(HAVE_ALLOCA 1) + if(NOT CYGWIN AND NOT MINGW) + set(HAVE_ALLOCA 1) + endif() set(HAVE_M_PI 1) target_compile_definitions(sdl-build-options INTERFACE "-D_USE_MATH_DEFINES") # needed for M_PI set(STDC_HEADERS 1) @@ -917,14 +870,15 @@ if(SDL_LIBC) 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) + check_type_size("size_t" SIZEOF_SIZE_T) check_symbol_exists(M_PI math.h HAVE_M_PI) # TODO: refine the mprotect check check_c_source_compiles("#include #include - int main(void) { return 0; }" HAVE_MPROTECT) + int main() { }" HAVE_MPROTECT) foreach(_FN strtod malloc calloc realloc free getenv setenv putenv unsetenv - bsearch qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat + qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp @@ -1005,6 +959,10 @@ foreach(_SUB ${SDL_SUBSYSTEMS}) set(SDL_${_OPT}_DISABLED 1) endif() endforeach() +if(SDL_JOYSTICK) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) +endif() if(SDL_HAPTIC) if(NOT SDL_JOYSTICK) # Haptic requires some private functions from the joystick subsystem. @@ -1019,16 +977,14 @@ if(SDL_AUDIO) if(SDL_DUMMYAUDIO) set(SDL_AUDIO_DRIVER_DUMMY 1) file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) - list(APPEND SOURCE_FILES ${DUMMYAUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${DUMMYAUDIO_SOURCES}) set(HAVE_DUMMYAUDIO TRUE) - set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_DISKAUDIO) set(SDL_AUDIO_DRIVER_DISK 1) file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c) - list(APPEND SOURCE_FILES ${DISKAUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${DISKAUDIO_SOURCES}) set(HAVE_DISKAUDIO TRUE) - set(HAVE_SDL_AUDIO TRUE) endif() endif() @@ -1039,7 +995,7 @@ if(UNIX OR APPLE) if(SDL_LOADSO AND HAVE_DLOPEN) set(SDL_LOADSO_DLOPEN 1) file(GLOB DLOPEN_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) - list(APPEND SOURCE_FILES ${DLOPEN_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${DLOPEN_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() endif() @@ -1053,7 +1009,7 @@ if(SDL_JOYSTICK) set(HAVE_VIRTUAL_JOYSTICK TRUE) set(SDL_JOYSTICK_VIRTUAL 1) file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/virtual/*.c) - list(APPEND SOURCE_FILES ${JOYSTICK_VIRTUAL_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_VIRTUAL_SOURCES}) endif() endif() @@ -1061,14 +1017,14 @@ if(SDL_VIDEO) if(SDL_DUMMYVIDEO) set(SDL_VIDEO_DRIVER_DUMMY 1) file(GLOB VIDEO_DUMMY_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) - list(APPEND SOURCE_FILES ${VIDEO_DUMMY_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_DUMMY_SOURCES}) set(HAVE_DUMMYVIDEO TRUE) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_OFFSCREEN) set(SDL_VIDEO_DRIVER_OFFSCREEN 1) file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/offscreen/*.c) - list(APPEND SOURCE_FILES ${VIDEO_OFFSCREEN_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_OFFSCREEN_SOURCES}) set(HAVE_OFFSCREEN TRUE) set(HAVE_SDL_VIDEO TRUE) endif() @@ -1077,13 +1033,11 @@ endif() # Platform-specific options and settings if(ANDROID) file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) - if(SDL_MISC) - file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) - endif() + file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) # SDL_spinlock.c Needs to be compiled in ARM mode. # There seems to be no better way currently to set the ARM mode. @@ -1100,31 +1054,31 @@ if(ANDROID) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_ANDROID 1) file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_AUDIO_SOURCES}) set(SDL_AUDIO_DRIVER_OPENSLES 1) file(GLOB OPENSLES_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/openslES/*.c) - list(APPEND SOURCE_FILES ${OPENSLES_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${OPENSLES_AUDIO_SOURCES}) find_library(ANDROID_OPENSLES_LIBRARY OpenSLES) list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_OPENSLES_LIBRARY}) set(SDL_AUDIO_DRIVER_AAUDIO 1) file(GLOB AAUDIO_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/aaudio/*.c) - list(APPEND SOURCE_FILES ${AAUDIO_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${AAUDIO_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_ANDROID 1) file(GLOB ANDROID_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_HAPTIC) set(SDL_HAPTIC_ANDROID 1) file(GLOB ANDROID_HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_HAPTIC_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() if(SDL_HIDAPI) @@ -1133,42 +1087,42 @@ if(ANDROID) if(SDL_JOYSTICK) set(SDL_JOYSTICK_ANDROID 1) file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) - list(APPEND SOURCE_FILES ${ANDROID_JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_DLOPEN 1) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) - list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() if(SDL_POWER) set(SDL_POWER_ANDROID 1) file(GLOB ANDROID_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_POWER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) file(GLOB ANDROID_LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_LOCALE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_ANDROID 1) set(HAVE_SDL_SENSORS TRUE) file(GLOB ANDROID_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_SENSOR_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_SENSOR_SOURCES}) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_ANDROID 1) file(GLOB ANDROID_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/android/*.c) - list(APPEND SOURCE_FILES ${ANDROID_VIDEO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) # Core stuff @@ -1194,17 +1148,17 @@ if(ANDROID) list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY}) endif() - if(SDL_VULKAN) - CHECK_C_SOURCE_COMPILES(" - #if defined(__ARM_ARCH) && __ARM_ARCH < 7 - #error Vulkan doesn't work on this configuration - #endif - int main(int argc, char **argv) { return 0; } - " VULKAN_PASSED_ANDROID_CHECKS) - if(VULKAN_PASSED_ANDROID_CHECKS) - set(SDL_VIDEO_VULKAN 1) - set(HAVE_VULKAN TRUE) - endif() + CHECK_C_SOURCE_COMPILES(" + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + int main(void) { + return 0; + } + " VULKAN_PASSED_ANDROID_CHECKS) + if(NOT VULKAN_PASSED_ANDROID_CHECKS) + set(SDL_VULKAN OFF) + message(STATUS "Vulkan doesn't work on this configuration") endif() endif() @@ -1214,45 +1168,39 @@ elseif(EMSCRIPTEN) # Hide noisy warnings that intend to aid mostly during initial stages of porting a new # project. Uncomment at will for verbose cross-compiling -I/../ path info. target_compile_options(sdl-build-options INTERFACE "-Wno-warn-absolute-paths") - - if(SDL_MISC) - file(GLOB EMSRIPTEN_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/emscripten/*.c) - list(APPEND SOURCE_FILES ${EMSRIPTEN_MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) - endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_EMSCRIPTEN 1) file(GLOB EM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/emscripten/*.c) - list(APPEND SOURCE_FILES ${EM_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${EM_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_EMSCRIPTEN 1) file(GLOB EM_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/emscripten/*.c) - list(APPEND SOURCE_FILES ${EM_FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${EM_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_EMSCRIPTEN 1) file(GLOB EM_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/emscripten/*.c) - list(APPEND SOURCE_FILES ${EM_JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${EM_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_EMSCRIPTEN 1) file(GLOB EM_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/emscripten/*.c) - list(APPEND SOURCE_FILES ${EM_POWER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${EM_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/emscripten/*.c) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) if(SDL_CLOCK_GETTIME) @@ -1262,7 +1210,7 @@ elseif(EMSCRIPTEN) if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1) file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c) - list(APPEND SOURCE_FILES ${EM_VIDEO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${EM_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) #enable gles @@ -1281,17 +1229,17 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) if(SYSV5 OR SOLARIS OR HPUX) set(SDL_AUDIO_DRIVER_SUNAUDIO 1) file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) - list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${SUN_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(NETBSD) set(SDL_AUDIO_DRIVER_NETBSD 1) file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c) - list(APPEND SOURCE_FILES ${NETBSD_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${NETBSD_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(AIX) set(SDL_AUDIO_DRIVER_PAUDIO 1) file(GLOB AIX_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/paudio/*.c) - list(APPEND SOURCE_FILES ${AIX_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${AIX_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() CheckOSS() @@ -1320,42 +1268,39 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) CheckOpenGLES() CheckWayland() CheckVivante() - # FIXME: implement CheckVulkan() - if(SDL_VULKAN) - set(SDL_VIDEO_VULKAN 1) - set(HAVE_VULKAN TRUE) - endif() endif() if(UNIX) file(GLOB CORE_UNIX_SOURCES ${SDL2_SOURCE_DIR}/src/core/unix/*.c) - list(APPEND SOURCE_FILES ${CORE_UNIX_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_UNIX_SOURCES}) check_c_source_compiles(" #include #ifndef EVIOCGNAME #error EVIOCGNAME() ioctl not available #endif - int main(int argc, char** argv) { return 0; }" HAVE_INPUT_EVENTS) + int main(int argc, char** argv) {}" HAVE_INPUT_EVENTS) if(LINUX) check_c_source_compiles(" #include #include - int main(int argc, char **argv) { + + int main(int argc, char **argv) + { struct kbentry kbe; kbe.kb_table = KG_CTRL; ioctl(0, KDGKBENT, &kbe); - return 0; }" HAVE_INPUT_KD) elseif(FREEBSD) check_c_source_compiles(" #include #include - int main(int argc, char **argv) { + + int main(int argc, char **argv) + { accentmap_t accTable; ioctl(0, KDENABIO, 1); - return 0; }" HAVE_INPUT_KBIO) endif() @@ -1366,7 +1311,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) if(SDL_HAPTIC AND HAVE_INPUT_EVENTS) set(SDL_HAPTIC_LINUX 1) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c) - list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() @@ -1392,6 +1337,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) if(DBUS_FOUND) set(HAVE_DBUS_DBUS_H TRUE) target_include_directories(sdl-build-options INTERFACE "${DBUS_INCLUDE_DIRS}") + list(APPEND EXTRA_LIBS ${DBUS_LIBRARIES}) # Fcitx need only dbus. set(HAVE_FCITX TRUE) endif() @@ -1400,6 +1346,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) if(IBUS_FOUND) set(HAVE_IBUS_IBUS_H TRUE) target_include_directories(sdl-build-options INTERFACE "${IBUS_INCLUDE_DIRS}") + list(APPEND EXTRA_LIBS ${IBUS_LIBRARIES}) endif() if (HAVE_IBUS_IBUS_H OR HAVE_FCITX) @@ -1416,47 +1363,45 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) endif() if(HAVE_LIBUNWIND_H) - # We've already found the header, so link the lib if present. - # NB: This .pc file is not present on FreeBSD where the implicitly - # linked base system libgcc_s includes all libunwind ABI. - pkg_search_module(UNWIND libunwind) - pkg_search_module(UNWIND_GENERIC libunwind-generic) - list(APPEND EXTRA_TEST_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES}) + # We've already found the header, so REQUIRE the lib to be present + pkg_search_module(UNWIND REQUIRED libunwind) + pkg_search_module(UNWIND_GENERIC REQUIRED libunwind-generic) + list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES}) endif() endif() if(HAVE_DBUS_DBUS_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_dbus.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_dbus.c") endif() if(SDL_USE_IME) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ime.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ime.c") endif() if(HAVE_IBUS_IBUS_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ibus.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ibus.c") endif() if(HAVE_FCITX) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_fcitx.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_fcitx.c") endif() if(HAVE_LIBUDEV_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c") endif() if(HAVE_INPUT_EVENTS) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c") - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") endif() if(HAVE_INPUT_KBIO) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") endif() # Always compiled for Linux, unconditionally: - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") + set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") # src/core/unix/*.c is included in a generic if(UNIX) section, elsewhere. endif() @@ -1472,7 +1417,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) if(LINUX AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) - list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() endif() @@ -1497,38 +1442,36 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H") endif() - if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/unix/*.c) - list(APPEND SOURCE_FILES ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) - endif() + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) if(SDL_POWER) if(LINUX) set(SDL_POWER_LINUX 1) file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c) - list(APPEND SOURCE_FILES ${POWER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_UNIX 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() @@ -1555,10 +1498,10 @@ elseif(WINDOWS) check_c_source_compiles(" #include - int main(int argc, char **argv) { return 0; }" HAVE_WIN32_CC) + int main(int argc, char **argv) { }" HAVE_WIN32_CC) file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) if(WINDOWS_STORE) file(GLOB WINRT_SOURCE_FILES ${SDL2_SOURCE_DIR}/src/core/winrt/*.c ${SDL2_SOURCE_DIR}/src/core/winrt/*.cpp) @@ -1568,20 +1511,19 @@ elseif(WINDOWS) if(MSVC AND NOT SDL_LIBC) # Prevent codegen that would use the VC runtime libraries. set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-") - if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") + if(NOT ARCH_64) set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE") endif() endif() - if(SDL_MISC) - if(WINDOWS_STORE) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp) - else() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c) - endif() - list(APPEND SOURCE_FILES ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) + if(WINDOWS_STORE) + file(GLOB WINRT_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp) + set(SOURCE_FILES ${SOURCE_FILES} ${WINRT_MISC_SOURCES}) + else() + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) endif() + set(HAVE_SDL_MISC TRUE) # Check for DirectX if(SDL_DIRECTX) @@ -1597,22 +1539,14 @@ elseif(WINDOWS) check_include_file(d3d9.h HAVE_D3D_H) check_include_file(d3d11_1.h HAVE_D3D11_H) - check_c_source_compiles(" - #include - #include - #include - ID3D12Device5 *device; - #if WDK_NTDDI_VERSION > 0x0A000008 - int main(int argc, char **argv) { return 0; } - #endif" HAVE_D3D12_H) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) - if(WINDOWS_STORE OR CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") + if(WINDOWS_STORE OR VCPKG_TARGET_TRIPLET MATCHES "arm-windows") set(HAVE_DINPUT_H 0) endif() check_include_file(dxgi.h HAVE_DXGI_H) - if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_D3D12_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) + if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) set(HAVE_DIRECTX TRUE) if(NOT MINGW AND NOT USE_WINSDK_DIRECTX) # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks @@ -1628,44 +1562,42 @@ elseif(WINDOWS) check_c_source_compiles(" #include #include - int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H) + int main(int argc, char **argv) { }" HAVE_XINPUT_H) check_c_source_compiles(" #include #include XINPUT_GAMEPAD_EX x1; - int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_GAMEPAD_EX) + int main(int argc, char **argv) { }" HAVE_XINPUT_GAMEPAD_EX) check_c_source_compiles(" #include #include XINPUT_STATE_EX s1; - int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_STATE_EX) + int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX) check_c_source_compiles(" #define COBJMACROS #include __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2; - int main(int argc, char **argv) { return 0; }" HAVE_WINDOWS_GAMING_INPUT_H) + int main(int argc, char **argv) { }" HAVE_WINDOWS_GAMING_INPUT_H) endif() # headers needed elsewhere check_include_file(tpcshrd.h HAVE_TPCSHRD_H) - check_include_file(roapi.h HAVE_ROAPI_H) check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H) check_include_file(audioclient.h HAVE_AUDIOCLIENT_H) check_include_file(sensorsapi.h HAVE_SENSORSAPI_H) if(SDL_AUDIO) if(NOT WINDOWS_STORE) - set(SDL_AUDIO_DRIVER_WINMM 1) - file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) - list(APPEND SOURCE_FILES ${WINMM_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) + set(SDL_AUDIO_DRIVER_WINMM 1) + file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${WINMM_AUDIO_SOURCES}) endif() + set(HAVE_SDL_AUDIO TRUE) if(HAVE_DSOUND_H AND NOT WINDOWS_STORE) set(SDL_AUDIO_DRIVER_DSOUND 1) file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c) - list(APPEND SOURCE_FILES ${DSOUND_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) + set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES}) endif() if(SDL_WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H) @@ -1675,8 +1607,7 @@ elseif(WINDOWS) if(WINDOWS_STORE) list(APPEND WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/SDL_wasapi_winrt.cpp) endif() - list(APPEND SOURCE_FILES ${WASAPI_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) + set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES}) endif() endif() @@ -1693,10 +1624,10 @@ elseif(WINDOWS) ${SDL2_SOURCE_DIR}/src/render/direct3d11/*.cpp ) else() - set(SDL_VIDEO_DRIVER_WINDOWS 1) - file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c) + set(SDL_VIDEO_DRIVER_WINDOWS 1) + file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c) endif() - list(APPEND SOURCE_FILES ${WIN_VIDEO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES}) if(SDL_RENDER_D3D AND HAVE_D3D_H AND NOT WINDOWS_STORE) set(SDL_VIDEO_RENDER_D3D 1) @@ -1706,10 +1637,6 @@ elseif(WINDOWS) set(SDL_VIDEO_RENDER_D3D11 1) set(HAVE_RENDER_D3D TRUE) endif() - if(SDL_RENDER_D3D AND HAVE_D3D12_H AND NOT WINDOWS_STORE) - set(SDL_VIDEO_RENDER_D3D12 1) - set(HAVE_RENDER_D3D TRUE) - endif() set(HAVE_SDL_VIDEO TRUE) endif() @@ -1730,16 +1657,16 @@ elseif(WINDOWS) set(SDL_SENSOR_WINDOWS 1) set(HAVE_SDL_SENSORS TRUE) file(GLOB WINDOWS_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/windows/*.c) - list(APPEND SOURCE_FILES ${WINDOWS_SENSOR_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${WINDOWS_SENSOR_SOURCES}) endif() if(SDL_POWER) if(WINDOWS_STORE) set(SDL_POWER_WINRT 1) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp) + set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp) else() set(SDL_POWER_WINDOWS 1) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c) + set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c) set(HAVE_SDL_POWER TRUE) endif() endif() @@ -1750,7 +1677,7 @@ elseif(WINDOWS) else() file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/windows/*.c) endif() - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() @@ -1761,7 +1688,7 @@ elseif(WINDOWS) else() file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c) endif() - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() @@ -1782,19 +1709,19 @@ elseif(WINDOWS) if(SDL_TIMERS) set(SDL_TIMER_WINDOWS 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/windows/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_WINDOWS 1) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/windows/*.c) - list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) if(SDL_VIDEO) if(SDL_OPENGL AND NOT WINDOWS_STORE) @@ -1810,11 +1737,6 @@ elseif(WINDOWS) set(SDL_VIDEO_RENDER_OGL_ES2 1) set(HAVE_OPENGLES TRUE) endif() - - if(SDL_VULKAN) - set(SDL_VIDEO_VULKAN 1) - set(HAVE_VULKAN TRUE) - endif() endif() if(SDL_HIDAPI) @@ -1823,7 +1745,7 @@ elseif(WINDOWS) if(SDL_JOYSTICK) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c) - list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) if(NOT WINDOWS_STORE) set(SDL_JOYSTICK_RAWINPUT 1) @@ -1833,10 +1755,8 @@ elseif(WINDOWS) list(APPEND EXTRA_LIBS dinput8) endif() if(HAVE_XINPUT_H) - if(NOT WINDOWS_STORE) - set(SDL_JOYSTICK_XINPUT 1) - set(HAVE_XINPUT TRUE) - endif() + set(SDL_JOYSTICK_XINPUT 1) + set(HAVE_XINPUT TRUE) if(HAVE_WINDOWS_GAMING_INPUT_H) set(SDL_JOYSTICK_WGI 1) endif() @@ -1844,7 +1764,7 @@ elseif(WINDOWS) set(HAVE_SDL_JOYSTICK TRUE) if(SDL_HAPTIC) - if((HAVE_DINPUT_H OR HAVE_XINPUT_H) AND NOT WINDOWS_STORE) + if(HAVE_DINPUT_H OR HAVE_XINPUT_H) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c) if(HAVE_DINPUT_H) set(SDL_HAPTIC_DINPUT 1) @@ -1856,7 +1776,7 @@ elseif(WINDOWS) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) set(SDL_HAPTIC_DUMMY 1) endif() - list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() endif() @@ -1864,11 +1784,10 @@ elseif(WINDOWS) file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c) if(MINGW OR CYGWIN) - list(APPEND SDL_LIBS "-lmingw32" "-mwindows") - if(NOT SDL2_DISABLE_SDL2MAIN) - list(APPEND SDL_CFLAGS "-Dmain=SDL_main") - list(APPEND SDL_LIBS "-lSDL2main") - endif(NOT SDL2_DISABLE_SDL2MAIN) + list(APPEND EXTRA_LIBS mingw32) + list(APPEND EXTRA_LDFLAGS "-mwindows") + set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main") + list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows") endif() elseif(APPLE) @@ -1889,27 +1808,28 @@ elseif(APPLE) if(SDL_FILE) file(GLOB EXTRA_SOURCES ${SDL2_SOURCE_DIR}/src/file/cocoa/*.m) set(SOURCE_FILES ${EXTRA_SOURCES} ${SOURCE_FILES}) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. + set_source_files_properties(${EXTRA_SOURCES} PROPERTIES LANGUAGE C) set(HAVE_SDL_FILE TRUE) + else() + message_error("SDL_FILE must be enabled to build on MacOS X") endif() if(IOS OR TVOS) + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) + else() + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) endif() - - if(SDL_MISC) - if(IOS OR TVOS) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m) - else() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) - endif() - list(APPEND SOURCE_FILES ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) - endif() + set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m) - list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. + set_source_files_properties(${AUDIO_SOURCES} PROPERTIES LANGUAGE C) + set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) set(SDL_FRAMEWORK_COREAUDIO 1) set(SDL_FRAMEWORK_AUDIOTOOLBOX 1) @@ -1930,6 +1850,7 @@ elseif(APPLE) endif() set(SDL_FRAMEWORK_GAMECONTROLLER 1) set(SDL_FRAMEWORK_COREHAPTICS 1) + set(HAVE_SDL_SENSORS 1) else() file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) set_source_files_properties(${MFI_JOYSTICK_SOURCES} PROPERTIES COMPILE_FLAGS -fobjc-weak) @@ -1944,13 +1865,13 @@ elseif(APPLE) #if TARGET_CPU_X86 #error GameController framework doesn't work on this configuration #endif - int main() { return 0; }" HAVE_FRAMEWORK_GAMECONTROLLER) + int main() {}" HAVE_FRAMEWORK_GAMECONTROLLER) check_objc_source_compiles(" #include #include #import #import - int main() { return 0; }" HAVE_FRAMEWORK_COREHAPTICS) + int main() {}" HAVE_FRAMEWORK_COREHAPTICS) if(HAVE_FRAMEWORK_GAMECONTROLLER AND HAVE_FRAMEWORK_COREHAPTICS) # Only enable MFI if we also have CoreHaptics to ensure rumble works set(SDL_JOYSTICK_MFI 1) @@ -1961,7 +1882,7 @@ elseif(APPLE) set(SDL_FRAMEWORK_IOKIT 1) set(SDL_FRAMEWORK_FF 1) endif() - list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES} ${MFI_JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES} ${MFI_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -1975,8 +1896,11 @@ elseif(APPLE) set(SDL_FRAMEWORK_IOKIT 1) set(SDL_FRAMEWORK_FF 1) endif() - list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) + if(NOT SDL_JOYSTICK) + message(FATAL_ERROR "SDL_HAPTIC requires SDL_JOYSTICK to be enabled") + endif() endif() if(SDL_POWER) @@ -1988,27 +1912,29 @@ elseif(APPLE) set(SDL_POWER_MACOSX 1) set(SDL_FRAMEWORK_IOKIT 1) endif() - list(APPEND SOURCE_FILES ${POWER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/macosx/*.m) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif(SDL_TIMERS) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_COCOA 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. + set_source_files_properties(${FILESYSTEM_SOURCES} PROPERTIES LANGUAGE C) + set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() @@ -2017,7 +1943,7 @@ elseif(APPLE) set(SDL_SENSOR_COREMOTION 1) set(HAVE_SDL_SENSORS TRUE) file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/coremotion/*.m) - list(APPEND SOURCE_FILES ${SENSOR_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${SENSOR_SOURCES}) endif() endif() @@ -2031,8 +1957,7 @@ elseif(APPLE) set(SDL_IPHONE_KEYBOARD 1) set(SDL_IPHONE_LAUNCHSCREEN 1) file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m) - list(APPEND SOURCE_FILES ${UIKITVIDEO_SOURCES}) - set(HAVE_SDL_VIDEO TRUE) + set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES}) else() CheckCOCOA() if(SDL_OPENGL) @@ -2057,7 +1982,9 @@ elseif(APPLE) endif() if(SDL_VULKAN OR SDL_METAL OR SDL_RENDER_METAL) - check_objc_source_compiles(" + set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -ObjC") + check_c_source_compiles(" #include #import #import @@ -2065,26 +1992,32 @@ elseif(APPLE) #if (!TARGET_CPU_X86_64 && !TARGET_CPU_ARM64) #error Metal doesn't work on this configuration #endif - int main(int argc, char **argv) { return 0; }" HAVE_FRAMEWORK_METAL) + int main(void) { + return 0; + } + " HAVE_FRAMEWORK_METAL) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) if(HAVE_FRAMEWORK_METAL) set(SDL_FRAMEWORK_METAL 1) set(SDL_FRAMEWORK_QUARTZCORE 1) - if(SDL_VULKAN) - set(SDL_VIDEO_VULKAN 1) - set(HAVE_VULKAN TRUE) - endif() - if(SDL_METAL) - set(SDL_VIDEO_METAL 1) - set(HAVE_METAL TRUE) - endif() - if(SDL_RENDER_METAL) - file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m) - list(APPEND SOURCE_FILES ${RENDER_METAL_SOURCES}) - set(SDL_VIDEO_RENDER_METAL 1) - set(HAVE_RENDER_METAL TRUE) - endif() + else() + set(SDL_VULKAN 0) + set(SDL_METAL 0) + set(SDL_RENDER_METAL 0) endif() endif() + + if(SDL_METAL) + set(SDL_VIDEO_METAL 1) + set(HAVE_METAL TRUE) + endif() + + if(SDL_RENDER_METAL) + file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m) + set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_METAL_SOURCES}) + set(SDL_VIDEO_RENDER_METAL 1) + set(HAVE_RENDER_METAL TRUE) + endif() endif() # Actually load the frameworks at the end so we don't duplicate include. @@ -2179,27 +2112,25 @@ elseif(HAIKU) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_HAIKU 1) file(GLOB HAIKU_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/haiku/*.cc) - list(APPEND SOURCE_FILES ${HAIKU_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_HAIKU 1) file(GLOB HAIKU_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/haiku/*.cc) - list(APPEND SOURCE_FILES ${HAIKU_JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() - if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc) - list(APPEND SOURCE_FILES ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) - endif() + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc) + set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_HAIKU 1) file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.cc) - list(APPEND SOURCE_FILES ${HAIKUVIDEO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HAIKUVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) if(SDL_OPENGL) @@ -2215,61 +2146,59 @@ elseif(HAIKU) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_HAIKU 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/haiku/*.cc) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_HAIKU 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/haiku/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_POWER) set(SDL_POWER_HAIKU 1) file(GLOB HAIKU_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/haiku/*.c) - list(APPEND SOURCE_FILES ${HAIKU_POWER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HAIKU_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/haiku/*.cc) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() file(GLOB MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/haiku/*.cc) - list(APPEND SOURCE_FILES ${MAIN_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${MAIN_SOURCES}) CheckPTHREAD() list(APPEND EXTRA_LIBS root be media game device textencoding) elseif(RISCOS) - if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c) - list(APPEND SOURCE_FILES ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) - endif() + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_RISCOS 1) file(GLOB RISCOSVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/riscos/*.c) - list(APPEND SOURCE_FILES ${RISCOSVIDEO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${RISCOSVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_RISCOS 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/riscos/*.c) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) if(SDL_CLOCK_GETTIME) @@ -2290,34 +2219,32 @@ elseif(VITA) set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) endif() - if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/vita/*.c) - list(APPEND SOURCE_FILES ${MISC_SOURCES}) - set(HAVE_SDL_MISC TRUE) - endif() + file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/vita/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) + set(HAVE_SDL_MISC TRUE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_VITA 1) file(GLOB VITA_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/vita/*.c) - list(APPEND SOURCE_FILES ${VITA_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VITA_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_VITA 1) file(GLOB VITA_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/vita/*.c) - list(APPEND SOURCE_FILES ${VITA_FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VITA_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_VITA 1) file(GLOB VITA_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/vita/*.c) - list(APPEND SOURCE_FILES ${VITA_JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VITA_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_VITA 1) file(GLOB VITA_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/vita/*.c) - list(APPEND SOURCE_FILES ${VITA_POWER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VITA_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) @@ -2330,27 +2257,22 @@ elseif(VITA) ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() - if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/vita/*.c) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) - set(HAVE_SDL_LOCALE TRUE) - endif() if(SDL_TIMERS) set(SDL_TIMER_VITA 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/vita/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_VITA 1) set(HAVE_SDL_SENSORS TRUE) file(GLOB VITA_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/vita/*.c) - list(APPEND SOURCE_FILES ${VITA_SENSOR_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VITA_SENSOR_SOURCES}) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_VITA 1) file(GLOB VITA_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/vita/*.c) - list(APPEND SOURCE_FILES ${VITA_VIDEO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VITA_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) if(VIDEO_VITA_PIB) @@ -2361,10 +2283,10 @@ elseif(VITA) list(APPEND EXTRA_LIBS pib ) - set(HAVE_VIDEO_VITA_PIB ON) + set(HAVE_VITA_PIB ON) set(SDL_VIDEO_VITA_PIB 1) else() - set(HAVE_VIDEO_VITA_PIB OFF) + set(HAVE_VITA_PIB OFF) endif() endif() @@ -2372,7 +2294,6 @@ elseif(VITA) check_include_file(gpu_es4/psp2_pvr_hint.h HAVE_PVR_H) if(HAVE_PVR_H) target_compile_definitions(sdl-build-options INTERFACE "-D__psp2__") - check_include_file(gl4esinit.h HAVE_GL4ES_H) set(SDL_VIDEO_OPENGL_EGL 1) set(HAVE_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES 1) @@ -2384,20 +2305,10 @@ elseif(VITA) libgpu_es4_ext_stub_weak libIMGEGL_stub_weak ) - - set(HAVE_VIDEO_VITA_PVR ON) + set(HAVE_VITA_PVR ON) set(SDL_VIDEO_VITA_PVR 1) - - if(HAVE_GL4ES_H) - set(HAVE_OPENGL TRUE) - set(SDL_VIDEO_OPENGL 1) - set(SDL_VIDEO_RENDER_OGL 1) - list(APPEND EXTRA_LIBS libGL_stub) - set(SDL_VIDEO_VITA_PVR_OGL 1) - endif() - else() - set(HAVE_VIDEO_VITA_PVR OFF) + set(HAVE_VITA_PVR OFF) endif() endif() @@ -2408,9 +2319,7 @@ elseif(VITA) SceDisplay_stub SceCtrl_stub SceAppMgr_stub - SceAppUtil_stub SceAudio_stub - SceAudioIn_stub SceSysmodule_stub SceDisplay_stub SceCtrl_stub @@ -2441,12 +2350,12 @@ elseif(VITA) # set(HAVE_ARMSIMD TRUE) # set(SDL_ARM_SIMD_BLITTERS 1) # file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) -# list(APPEND SOURCE_FILES ${ARMSIMD_SOURCES}) +# set(SOURCE_FILES ${SOURCE_FILES} ${ARMSIMD_SOURCES}) # set(HAVE_ARMNEON TRUE) # set(SDL_ARM_NEON_BLITTERS 1) # file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) -# list(APPEND SOURCE_FILES ${ARMNEON_SOURCES}) +# set(SOURCE_FILES ${SOURCE_FILES} ${ARMNEON_SOURCES}) # set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd-asm.S PROPERTY LANGUAGE C) # set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon-asm.S PROPERTY LANGUAGE C) @@ -2466,44 +2375,44 @@ elseif(PSP) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_PSP 1) file(GLOB PSP_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/psp/*.c) - list(APPEND SOURCE_FILES ${PSP_AUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PSP_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_PSP 1) file(GLOB PSP_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/psp/*.c) - list(APPEND SOURCE_FILES ${PSP_FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PSP_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_PSP 1) file(GLOB PSP_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/psp/*.c) - list(APPEND SOURCE_FILES ${PSP_JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PSP_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_PSP 1) file(GLOB PSP_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/psp/*.c) - list(APPEND SOURCE_FILES ${PSP_POWER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PSP_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_PSP 1) file(GLOB PSP_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/psp/*.c) - list(APPEND SOURCE_FILES ${PSP_THREAD_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PSP_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_PSP 1) file(GLOB PSP_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/psp/*.c) - list(APPEND SOURCE_FILES ${PSP_TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PSP_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_PSP 1) set(SDL_VIDEO_RENDER_PSP 1) file(GLOB PSP_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/psp/*.c) - list(APPEND SOURCE_FILES ${PSP_VIDEO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PSP_VIDEO_SOURCES}) set(SDL_VIDEO_OPENGL 1) set(HAVE_SDL_VIDEO TRUE) endif() @@ -2520,103 +2429,16 @@ elseif(PSP) pspvram GL ) - -elseif(PS2) - list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__") - - if(SDL_FILESYSTEM) - set(SDL_FILESYSTEM_PS2 1) - file(GLOB PS2_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/ps2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PS2_FILESYSTEM_SOURCES}) - set(HAVE_SDL_FILESYSTEM TRUE) - endif() - if(SDL_THREADS) - set(SDL_THREAD_PS2 1) - file(GLOB PS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_sysmutex.c ${SDL2_SOURCE_DIR}/src/thread/ps2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PS2_THREAD_SOURCES}) - set(HAVE_SDL_THREADS TRUE) - endif() - if(SDL_TIMERS) - set(SDL_TIMER_PS2 1) - file(GLOB PS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/ps2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${PS2_TIMER_SOURCES}) - set(HAVE_SDL_TIMERS TRUE) - endif() -elseif(OS2) - list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR") - - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) - if(NOT (HAVE_ICONV AND HAVE_ICONV_H)) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/geniconv/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) - endif() - - if(SDL_THREADS) - set(SDL_THREAD_OS2 1) - file(GLOB OS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_THREAD_SOURCES}) - set(HAVE_SDL_THREADS TRUE) - endif() - - if(SDL_TIMERS) - set(SDL_TIMER_UNIX 1) - file(GLOB OS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_TIMER_SOURCES}) - set(HAVE_SDL_TIMERS TRUE) - endif() - - if(SDL_LOADSO) - set(SDL_LOADSO_OS2 1) - file(GLOB OS2_LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_LOADSO_SOURCES}) - set(HAVE_SDL_LOADSO TRUE) - endif() - - if(SDL_FILESYSTEM) - set(SDL_FILESYSTEM_OS2 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/os2/*.c) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) - set(HAVE_SDL_FILESYSTEM TRUE) - endif() - - if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) - set(HAVE_SDL_LOCALE TRUE) - endif() - - if(SDL_VIDEO) - set(SDL_VIDEO_DRIVER_OS2 1) - file(GLOB OS2_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_VIDEO_SOURCES}) - set(HAVE_SDL_VIDEO TRUE) - endif() - - if(SDL_AUDIO) - set(SDL_AUDIO_DRIVER_OS2 1) - file(GLOB OS2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) - list(APPEND EXTRA_LIBS mmpm2) - endif() - - if(SDL_JOYSTICK) - set(SDL_JOYSTICK_OS2 1) - file(GLOB OS2_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_JOYSTICK_SOURCES}) - set(HAVE_SDL_JOYSTICK TRUE) - endif() - - if(SDL_HIDAPI) - CheckHIDAPI() - endif() endif() -if(HAVE_VULKAN AND NOT SDL_LOADSO) +if(SDL_VULKAN AND NOT SDL_LOADSO) message(STATUS "Vulkan support is available, but disabled because there's no loadso.") - set(HAVE_VULKAN FALSE) - set(SDL_VIDEO_VULKAN 0) + set(SDL_VULKAN OFF) +endif() + +if(SDL_VULKAN) + set(SDL_VIDEO_VULKAN 1) + set(HAVE_VULKAN TRUE) endif() # Dummies @@ -2627,62 +2449,54 @@ endif() # so it always adds a dummy, without checking, if it was actually requested. # This leads to missing internal references on building, since the # src/X/*.c does not get included. -if(NOT HAVE_SDL_AUDIO) - set(SDL_AUDIO_DRIVER_DUMMY 1) - file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) - list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) -endif() -if(NOT HAVE_SDL_VIDEO) - set(SDL_VIDEO_DRIVER_DUMMY 1) - file(GLOB VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) - list(APPEND SOURCE_FILES ${VIDEO_SOURCES}) -endif() if(NOT HAVE_SDL_JOYSTICK) set(SDL_JOYSTICK_DUMMY 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) - list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) + if(SDL_JOYSTICK AND NOT APPLE) # results in unresolved symbols on OSX + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) + endif() endif() if(NOT HAVE_SDL_HAPTIC) set(SDL_HAPTIC_DUMMY 1) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) - list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) endif() if(NOT HAVE_SDL_SENSORS) set(SDL_SENSOR_DUMMY 1) file(GLOB SENSORS_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/dummy/*.c) - list(APPEND SOURCE_FILES ${SENSORS_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${SENSORS_SOURCES}) endif() if(NOT HAVE_SDL_LOADSO) - set(SDL_LOADSO_DUMMY 1) + set(SDL_LOADSO_DISABLED 1) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dummy/*.c) - list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) endif() if(NOT HAVE_SDL_FILESYSTEM) - set(SDL_FILESYSTEM_DUMMY 1) + set(SDL_FILESYSTEM_DISABLED 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) endif() if(NOT HAVE_SDL_LOCALE) - set(SDL_LOCALE_DUMMY 1) + set(SDL_LOCALE_DISABLED 1) file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) endif() if(NOT HAVE_SDL_MISC) - set(SDL_MISC_DUMMY 1) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c) - list(APPEND SOURCE_FILES ${MISC_SOURCES}) + set(SDL_MISC_DISABLED 1) + file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${LOCALE_SOURCES}) endif() # We always need to have threads and timers around if(NOT HAVE_SDL_THREADS) set(SDL_THREADS_DISABLED 1) file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c) - list(APPEND SOURCE_FILES ${THREADS_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${THREADS_SOURCES}) endif() if(NOT HAVE_SDL_TIMERS) - set(SDL_TIMER_DUMMY 1) + set(SDL_TIMERS_DISABLED 1) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/dummy/*.c) - list(APPEND SOURCE_FILES ${TIMER_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) endif() if(NOT SDLMAIN_SOURCES) @@ -2744,12 +2558,11 @@ configure_file("${SDL2_SOURCE_DIR}/include/SDL_revision.h.cmake" if(NOT WINDOWS OR CYGWIN OR MINGW) set(prefix ${CMAKE_INSTALL_PREFIX}) - file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}") set(exec_prefix "\${prefix}") - set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") - set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") - set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") + set(bindir "${CMAKE_INSTALL_FULL_BINDIR}") + set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") if(SDL_STATIC) set(ENABLE_STATIC_TRUE "") set(ENABLE_STATIC_FALSE "#") @@ -2786,8 +2599,6 @@ Libs.private:") listtostr(SDL_LIBS _SDL_LIBS) set(SDL_LIBS ${_SDL_LIBS}) endif() - listtostr(SDL_CFLAGS _SDL_CFLAGS "") - set(SDL_CFLAGS ${_SDL_CFLAGS}) # MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}") # MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}") @@ -2899,7 +2710,7 @@ endif() message(STATUS "") message(STATUS " CFLAGS: ${CMAKE_C_FLAGS}") message(STATUS " EXTRA_CFLAGS: ${EXTRA_CFLAGS}") -message(STATUS " EXTRA_LDFLAGS: ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD}") +message(STATUS " EXTRA_LDFLAGS: ${EXTRA_LDFLAGS}") message(STATUS " EXTRA_LIBS: ${EXTRA_LIBS}") message(STATUS "") message(STATUS " Build Shared Library: ${SDL_SHARED}") @@ -2936,24 +2747,13 @@ endif() # Ensure that the extra cflags are used at compile time set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") -if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - # Build SDLmain +# Always build SDLmain +if(NOT WINDOWS_STORE) add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) # alias target for in-tree builds add_library(SDL2::SDL2main ALIAS SDL2main) target_include_directories(SDL2main BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") target_include_directories(SDL2main PUBLIC "$" $ $) - if (WIN32) - target_link_libraries(SDL2main PRIVATE shell32) - endif() - if(MINGW OR CYGWIN) - cmake_minimum_required(VERSION 3.13) - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - target_link_options(SDL2main PUBLIC "-Wl,--undefined=_WinMain@16") - else() - target_link_options(SDL2main PUBLIC "-Wl,--undefined=WinMain") - endif() - endif() if (NOT ANDROID) set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() @@ -2963,7 +2763,7 @@ if(ANDROID) target_include_directories(sdl-build-options INTERFACE "${ANDROID_NDK}/sources/android/cpufeatures") endif() -if(APPLE) +if(IOS OR TVOS) target_compile_options(sdl-build-options INTERFACE "-fobjc-arc") endif() @@ -2971,7 +2771,6 @@ if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) # alias target for in-tree builds add_library(SDL2::SDL2 ALIAS SDL2) - set_target_properties(SDL2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) if(APPLE) set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1 @@ -2985,9 +2784,6 @@ if(SDL_SHARED) if(WINDOWS OR CYGWIN) set_target_properties(SDL2 PROPERTIES DEFINE_SYMBOL DLL_EXPORT) - elseif(OS2) - set_target_properties(SDL2 PROPERTIES - DEFINE_SYMBOL BUILD_SDL) endif() set_target_properties(SDL2 PROPERTIES VERSION ${SDL_VERSION} @@ -2995,7 +2791,7 @@ if(SDL_SHARED) OUTPUT_NAME "SDL2") endif() # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. - if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") + if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG) # Don't try to link with the default set of libraries. if(NOT WINDOWS_STORE) set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") @@ -3003,23 +2799,14 @@ if(SDL_SHARED) endif() set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") endif() - # FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS - target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD}) + target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) target_include_directories(SDL2 BEFORE PRIVATE "${SDL2_BINARY_DIR}/include") target_include_directories(SDL2 PUBLIC "$;$;$") # This picks up all the compiler options and such we've accumulated up to here. target_link_libraries(SDL2 PRIVATE $) - if(MINGW OR CYGWIN) - if(NOT CMAKE_VERSION VERSION_LESS "3.13") - target_link_options(SDL2 PRIVATE -static-libgcc) - endif() - endif() if(NOT ANDROID) set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() - # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library - set_property(TARGET SDL2 PROPERTY INTERFACE_SDL2_SHARED TRUE) - set_property(TARGET SDL2 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED) endif() if(SDL_STATIC) @@ -3027,15 +2814,16 @@ if(SDL_STATIC) add_library(SDL2-static STATIC ${SOURCE_FILES}) # alias target for in-tree builds add_library(SDL2::SDL2-static ALIAS SDL2-static) - if(MSVC OR (WATCOM AND (WIN32 OR OS2))) - # Avoid conflict between the dll import library and the static library - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2-static") - else() + if (NOT SDL_SHARED OR NOT WIN32 OR MINGW) set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") + # Note: Apparently, OUTPUT_NAME must really be unique; even when + # CMAKE_IMPORT_LIBRARY_SUFFIX or the like are given. Otherwise + # the static build may race with the import lib and one will get + # clobbered, when the suffix is realized via subsequent rename. endif() - set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE "${SDL_STATIC_PIC}") + set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC}) # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. - if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") + if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG) set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") @@ -3050,15 +2838,8 @@ if(SDL_STATIC) if(NOT ANDROID) set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() - # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library - set_property(TARGET SDL2-static PROPERTY INTERFACE_SDL2_SHARED FALSE) - set_property(TARGET SDL2-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED) endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MAJOR_VERSION=${SDL_MAJOR_VERSION}") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MINOR_VERSION=${SDL_MINOR_VERSION}") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MICRO_VERSION=${SDL_MICRO_VERSION}") - ##### Tests ##### if(SDL_TEST) @@ -3066,167 +2847,124 @@ if(SDL_TEST) include_directories(AFTER "${SDL2_SOURCE_DIR}/include") file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c) add_library(SDL2_test STATIC ${TEST_SOURCES}) - add_library(SDL2::SDL2test ALIAS SDL2_test) - set_target_properties(SDL2_test PROPERTIES - EXPORT_NAME SDL2test) - target_include_directories(SDL2_test PUBLIC "$" $ $) - target_link_libraries(SDL2_test PRIVATE ${EXTRA_TEST_LIBS}) + add_subdirectory(test) endif() ##### Installation targets ##### -if(NOT SDL2_DISABLE_INSTALL) - if(SDL_SHARED) - install(TARGETS SDL2 EXPORT SDL2Targets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - endif() +if(SDL_SHARED) + install(TARGETS SDL2 EXPORT SDL2Targets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +endif() - if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - install(TARGETS SDL2main EXPORT SDL2mainTargets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - endif() +if(NOT WINDOWS_STORE) + install(TARGETS SDL2main EXPORT SDL2mainTargets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +endif() - if(SDL_STATIC) - install(TARGETS SDL2-static EXPORT SDL2staticTargets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - endif() +if(SDL_STATIC) + install(TARGETS SDL2-static EXPORT SDL2staticTargets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +endif() - if(SDL_TEST) - install(TARGETS SDL2_test EXPORT SDL2testTargets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - endif() +##### Export files ##### +if (WINDOWS AND NOT MINGW) + set(PKG_PREFIX "cmake") +else () + set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") +endif () - ##### Export files ##### - if (WINDOWS AND NOT MINGW) - set(PKG_PREFIX "cmake") - else () - set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") - endif () +include(CMakePackageConfigHelpers) +write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" + VERSION ${SDL_VERSION} + COMPATIBILITY AnyNewerVersion +) - include(CMakePackageConfigHelpers) - configure_package_config_file(SDL2Config.cmake.in "${CMAKE_BINARY_DIR}/SDL2Config.cmake" - PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR - INSTALL_DESTINATION ${PKG_PREFIX} - ) - write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" - VERSION ${SDL_VERSION} - COMPATIBILITY AnyNewerVersion - ) - - if(SDL_SHARED) - install(EXPORT SDL2Targets - FILE SDL2Targets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} - ) - endif() - - if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - install(EXPORT SDL2mainTargets - FILE SDL2mainTargets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} - ) - endif() - - if(SDL_STATIC) - install(EXPORT SDL2staticTargets - FILE SDL2staticTargets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} - ) - endif() - - if(SDL_TEST) - install(EXPORT SDL2testTargets - FILE SDL2testTargets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} - ) - endif() - - install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake - ${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake +if(SDL_SHARED) + install(EXPORT SDL2Targets + FILE SDL2Targets.cmake + NAMESPACE SDL2:: DESTINATION ${PKG_PREFIX} - COMPONENT Devel ) +endif() - file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) - file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h) - foreach(_FNAME ${BIN_INCLUDE_FILES}) - get_filename_component(_INCNAME ${_FNAME} NAME) - list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME}) - endforeach() - list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) - install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) +if(NOT WINDOWS_STORE) + install(EXPORT SDL2mainTargets + FILE SDL2mainTargets.cmake + NAMESPACE SDL2:: + DESTINATION ${PKG_PREFIX} + ) +endif() - string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) - if (UPPER_BUILD_TYPE MATCHES DEBUG) - set(SOPOSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") +if(SDL_STATIC) + install(EXPORT SDL2staticTargets + FILE SDL2staticTargets.cmake + NAMESPACE SDL2:: + DESTINATION ${PKG_PREFIX} + ) +endif() + +install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake + ${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake + DESTINATION ${PKG_PREFIX} + COMPONENT Devel +) + +file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) +file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h) +foreach(_FNAME ${BIN_INCLUDE_FILES}) + get_filename_component(_INCNAME ${_FNAME} NAME) + list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME}) +endforeach() +list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) +install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) + +string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) +if (UPPER_BUILD_TYPE MATCHES DEBUG) + set(SOPOSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") +else() + set(SOPOSTFIX "") +endif() + +if(NOT (WINDOWS OR CYGWIN) OR MINGW) + if(SDL_SHARED) + set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. + get_target_property(SONAME SDL2 OUTPUT_NAME) + if(NOT ANDROID AND NOT MINGW) + install(CODE " + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\" + WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")") + install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + if(FREEBSD) + # FreeBSD uses ${PREFIX}/libdata/pkgconfig + install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") else() - set(SOPOSTFIX "") - endif() - - if(NOT (WINDOWS OR CYGWIN) OR MINGW) - if(SDL_SHARED) - set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. - get_target_property(SONAME SDL2 OUTPUT_NAME) - if(NOT ANDROID AND NOT MINGW AND NOT OS2) - install(CODE " - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\" - WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") - endif() - endif() - if(FREEBSD) - # FreeBSD uses ${PREFIX}/libdata/pkgconfig - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") - else() - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endif() - install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}") - # TODO: what about the .spec file? Is it only needed for RPM creation? - install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal") - install(FILES "LICENSE.txt" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}") + install(FILES ${SDL2_BINARY_DIR}/sdl2.pc + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() + install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}") + # TODO: what about the .spec file? Is it only needed for RPM creation? + install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal") endif() ##### Uninstall target ##### -if(NOT SDL2_DISABLE_UNINSTALL) - if(NOT TARGET uninstall) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) - add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) - endif() -endif() - -##### Tests subproject (must appear after the install/uninstall targets) ##### - -if(SDL_TESTS) - enable_testing() - add_subdirectory(test) -endif() - -##### Fix Objective C builds ##### -set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} ${CMAKE_C_FLAGS}") - -# Make sure SDL2::SDL2 always exists -if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 ALIAS SDL2-static) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) endif() diff --git a/externals/SDL/INSTALL.txt b/externals/SDL/INSTALL.txt index 5856e2875..e5fa585a0 100755 --- a/externals/SDL/INSTALL.txt +++ b/externals/SDL/INSTALL.txt @@ -8,10 +8,10 @@ To compile and install SDL: * Read the FAQ at https://wiki.libsdl.org/FAQWindows * Run './configure; make; make install' - macOS with Xcode: + Mac OS X with Xcode: * Read docs/README-macosx.md - macOS from the command line: + Mac OS X from the command line: * Run './configure; make; make install' Linux and other UNIX systems: diff --git a/externals/SDL/Makefile.in b/externals/SDL/Makefile.in index 5b063568f..f72ef2f4d 100755 --- a/externals/SDL/Makefile.in +++ b/externals/SDL/Makefile.in @@ -19,7 +19,6 @@ distfile = $(distdir).tar.gz @SET_MAKE@ SHELL = @SHELL@ CC = @CC@ -CXX = @CXX@ INCLUDE = @INCLUDE@ CFLAGS = @BUILD_CFLAGS@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ @@ -50,7 +49,7 @@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@ INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@ -SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols +SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac debian docs include Makefile.* sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols GEN_DIST = SDL2.spec ifneq ($V,1) @@ -80,7 +79,6 @@ HDRS = \ SDL_filesystem.h \ SDL_gamecontroller.h \ SDL_gesture.h \ - SDL_guid.h \ SDL_haptic.h \ SDL_hidapi.h \ SDL_hints.h \ diff --git a/externals/SDL/Makefile.os2 b/externals/SDL/Makefile.os2 index 31cd03a74..6af282d52 100755 --- a/externals/SDL/Makefile.os2 +++ b/externals/SDL/Makefile.os2 @@ -11,10 +11,7 @@ # wmake -f Makefile.os2 HIDAPI=1 LIBNAME = SDL2 -MAJOR_VERSION = 2 -MINOR_VERSION = 23 -MICRO_VERSION = 1 -VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) +VERSION = 2.0.20 DESCRIPTION = Simple DirectMedia Layer 2 LIBICONV=0 @@ -31,13 +28,7 @@ INCPATH+= -Iinclude LIBM = SDL2libm.lib TLIB = SDL2test.lib LIBS = mmpm2.lib $(LIBM) -CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei -# Debug options: -# - debug messages from OS/2 related code to stdout: -#CFLAGS+= -DOS2DEBUG -# - debug messages from OS/2 code via SDL_LogDebug(): -#CFLAGS+= -DOS2DEBUG=2 - +CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei # max warnings: CFLAGS+= -wx # newer OpenWatcom versions enable W303 by default @@ -63,19 +54,21 @@ CFLAGS_DLL+= -DHAVE_LIBUSB_H=1 # building SDL itself (for DECLSPEC): CFLAGS_DLL+= -DBUILD_SDL -CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) +# Debug options: +# - debug messages from OS/2 related code to stdout: +#CFLAGS+= -DOS2DEBUG +# - debug messages from OS/2 code via SDL_LogDebug(): +#CFLAGS+= -DOS2DEBUG=2 -SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_memcpy.c SDL_memset.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c +SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c +SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c SRCS+= SDL_rwops.c SDL_power.c SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & SDL_sensor.c SDL_touch.c -SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c +SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & SDL_render_sw.c SDL_rotate.c SDL_triangle.c @@ -147,11 +140,9 @@ SDL_blendpoint.obj: SDL_blendpoint.c wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< SDL_RLEaccel.obj: SDL_RLEaccel.c wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< -!ifeq HIDAPI 1 # c99 mode needed because of structs with flexible array members in libusb.h SDL_hidapi.obj: SDL_hidapi.c wcc386 $(CFLAGS_DLL) -za99 -fo=$^@ $< -!endif $(LIBICONV_LIB): "src/core/os2/iconv2.lbc" @echo * Creating: $@ diff --git a/externals/SDL/Makefile.psp b/externals/SDL/Makefile.psp index 20c22d664..8e826dce0 100755 --- a/externals/SDL/Makefile.psp +++ b/externals/SDL/Makefile.psp @@ -1,3 +1,6 @@ +# The threads code require a rather new PSP SDK with SceLwMutexWorkarea: +# https://github.com/pspdev/pspsdk/commit/276d9e3ca6fb26479ad050c21431b2a40f518365 +# TARGET_LIB = libSDL2.a EXTRA_TARGETS = libSDL2main.a OBJS= src/SDL.o \ @@ -36,7 +39,7 @@ OBJS= src/SDL.o \ src/joystick/virtual/SDL_virtualjoystick.o \ src/power/SDL_power.o \ src/power/psp/SDL_syspower.o \ - src/filesystem/dummy/SDL_sysfilesystem.o \ + src/filesystem/psp/SDL_sysfilesystem.o \ src/locale/SDL_locale.o \ src/locale/dummy/SDL_syslocale.o \ src/misc/SDL_url.o \ diff --git a/externals/SDL/SDL2Config.cmake b/externals/SDL/SDL2Config.cmake index 7c31469f1..3e4ebe1e8 100755 --- a/externals/SDL/SDL2Config.cmake +++ b/externals/SDL/SDL2Config.cmake @@ -1,4 +1,12 @@ -include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") +endif() # on static-only builds create an alias if(NOT TARGET SDL2::SDL2 AND TARGET SDL2::SDL2-static) diff --git a/externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj b/externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj index 580cbd6ee..675ecb1d2 100755 --- a/externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj +++ b/externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj @@ -45,7 +45,6 @@ - @@ -115,7 +114,6 @@ - @@ -146,8 +144,6 @@ - - @@ -252,7 +248,6 @@ - @@ -300,9 +295,7 @@ - - @@ -311,8 +304,6 @@ - - @@ -423,9 +414,10 @@ true Windows Store 8.2 - 10.0.16299.0 - 10.0.16299.0 - 10.0 + 10.0.10069.0 + 10.0.10069.0 + 10.0.10240.0 + 10.0.10240.0 diff --git a/externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters b/externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters index b6006c8c3..eb9999571 100755 --- a/externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters +++ b/externals/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters @@ -63,9 +63,6 @@ Header Files - - Header Files - Header Files @@ -333,9 +330,6 @@ Source Files - - Source Files - Source Files @@ -417,9 +411,6 @@ Source Files - - Source Files - Source Files @@ -636,9 +627,6 @@ Source Files - - Source Files - Source Files @@ -792,9 +780,6 @@ Source Files - - Source Files - Source Files @@ -828,16 +813,10 @@ Source Files - - Source Files - Source Files - - Source Files - \ No newline at end of file diff --git a/externals/SDL/VisualC/SDL/SDL.vcxproj b/externals/SDL/VisualC/SDL/SDL.vcxproj index 013ca0202..0e9062b56 100755 --- a/externals/SDL/VisualC/SDL/SDL.vcxproj +++ b/externals/SDL/VisualC/SDL/SDL.vcxproj @@ -234,7 +234,6 @@ - @@ -348,7 +347,6 @@ - @@ -369,11 +367,8 @@ - - - @@ -479,7 +474,6 @@ - @@ -528,8 +522,6 @@ - - @@ -551,7 +543,6 @@ - @@ -562,8 +553,6 @@ - - @@ -622,4 +611,4 @@ - \ No newline at end of file + diff --git a/externals/SDL/VisualC/SDL/SDL.vcxproj.filters b/externals/SDL/VisualC/SDL/SDL.vcxproj.filters index a093f4dd6..da002cd3c 100755 --- a/externals/SDL/VisualC/SDL/SDL.vcxproj.filters +++ b/externals/SDL/VisualC/SDL/SDL.vcxproj.filters @@ -169,9 +169,6 @@ {4755f3a6-49ac-46d6-86be-21f5c21f2197} - - {f48c2b17-1bee-4fec-a7c8-24cf619abe08} - @@ -234,9 +231,6 @@ API Headers - - API Headers - API Headers @@ -407,7 +401,6 @@ - API Headers @@ -831,10 +824,6 @@ - - - render\direct3d12 - @@ -842,9 +831,7 @@ - - audio @@ -926,9 +913,6 @@ hidapi - - joystick - joystick @@ -1217,7 +1201,7 @@ thread - + thread\windows @@ -1332,14 +1316,8 @@ power\windows - - render\direct3d12 - - - render\direct3d12 - - \ No newline at end of file + diff --git a/externals/SDL/VisualC/tests/controllermap/controllermap.vcxproj b/externals/SDL/VisualC/tests/controllermap/controllermap.vcxproj index 6f6f6d283..ab331ba50 100755 --- a/externals/SDL/VisualC/tests/controllermap/controllermap.vcxproj +++ b/externals/SDL/VisualC/tests/controllermap/controllermap.vcxproj @@ -271,7 +271,6 @@ - diff --git a/externals/SDL/VisualC/tests/loopwave/loopwave.vcxproj b/externals/SDL/VisualC/tests/loopwave/loopwave.vcxproj index 24c376f45..bb53ef6d4 100755 --- a/externals/SDL/VisualC/tests/loopwave/loopwave.vcxproj +++ b/externals/SDL/VisualC/tests/loopwave/loopwave.vcxproj @@ -203,7 +203,6 @@ - @@ -228,4 +227,4 @@ - + \ No newline at end of file diff --git a/externals/SDL/VisualC/tests/testautomation/testautomation.vcxproj b/externals/SDL/VisualC/tests/testautomation/testautomation.vcxproj index 06a519883..5680b999f 100755 --- a/externals/SDL/VisualC/tests/testautomation/testautomation.vcxproj +++ b/externals/SDL/VisualC/tests/testautomation/testautomation.vcxproj @@ -209,7 +209,6 @@ - diff --git a/externals/SDL/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj b/externals/SDL/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj index 505ff94b1..b7f461f33 100755 --- a/externals/SDL/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj +++ b/externals/SDL/VisualC/tests/testgamecontroller/testgamecontroller.vcxproj @@ -271,7 +271,6 @@ - diff --git a/externals/SDL/VisualC/tests/testoverlay2/testoverlay2.vcxproj b/externals/SDL/VisualC/tests/testoverlay2/testoverlay2.vcxproj index 86c31c1ed..5646e7894 100755 --- a/externals/SDL/VisualC/tests/testoverlay2/testoverlay2.vcxproj +++ b/externals/SDL/VisualC/tests/testoverlay2/testoverlay2.vcxproj @@ -217,7 +217,6 @@ - diff --git a/externals/SDL/VisualC/tests/testrendertarget/testrendertarget.vcxproj b/externals/SDL/VisualC/tests/testrendertarget/testrendertarget.vcxproj index 4c5cb44ca..2f4f6710e 100755 --- a/externals/SDL/VisualC/tests/testrendertarget/testrendertarget.vcxproj +++ b/externals/SDL/VisualC/tests/testrendertarget/testrendertarget.vcxproj @@ -241,9 +241,8 @@ - - + \ No newline at end of file diff --git a/externals/SDL/VisualC/tests/testscale/testscale.vcxproj b/externals/SDL/VisualC/tests/testscale/testscale.vcxproj index e2aa43a75..d6f48db97 100755 --- a/externals/SDL/VisualC/tests/testscale/testscale.vcxproj +++ b/externals/SDL/VisualC/tests/testscale/testscale.vcxproj @@ -241,9 +241,8 @@ - - + \ No newline at end of file diff --git a/externals/SDL/VisualC/tests/testsprite2/testsprite2.vcxproj b/externals/SDL/VisualC/tests/testsprite2/testsprite2.vcxproj index 884473ec6..7c30770cf 100755 --- a/externals/SDL/VisualC/tests/testsprite2/testsprite2.vcxproj +++ b/externals/SDL/VisualC/tests/testsprite2/testsprite2.vcxproj @@ -223,9 +223,8 @@ - - + \ No newline at end of file diff --git a/externals/SDL/WhatsNew.txt b/externals/SDL/WhatsNew.txt index f0e8ff37e..1a6156533 100755 --- a/externals/SDL/WhatsNew.txt +++ b/externals/SDL/WhatsNew.txt @@ -1,84 +1,6 @@ This is a list of major changes in SDL's version history. ---------------------------------------------------------------------------- -2.24.0: ---------------------------------------------------------------------------- - -General: -* New version numbering scheme, similar to GLib and Flatpak. - * An even number in the minor version (second component) indicates - a production-ready stable release such as 2.24.0, which would have - been 2.0.24 under the old system. - * The patchlevel (micro version, third component) indicates a - bugfix-only update: for example, 2.24.1 would be a bugfix-only - release to fix bugs in 2.24.0, without adding new features. - * An odd number in the minor version indicates a prerelease such - as 2.23.0. Stable distributions should not use these prereleases. - * The patchlevel indicates successive prereleases, for example - 2.23.1 and 2.23.2 would be prereleases during development of - the SDL 2.24.0 stable release. -* Added SDL_bsearch() and SDL_utf8strnlen() to the stdlib routines -* Added SDL_size_mul_overflow() and SDL_size_add_overflow() for better size overflow protection -* Added functions to get the platform dependent name for a joystick or game controller: - * SDL_JoystickPathForIndex() - * SDL_JoystickPath() - * SDL_GameControllerPathForIndex() - * SDL_GameControllerPath() -* Added SDL_GameControllerGetFirmwareVersion() and SDL_JoystickGetFirmwareVersion(), currently implemented for DualSense(tm) Wireless Controllers using HIDAPI -* Added SDL_JoystickAttachVirtualEx() for extended virtual controller support -* Added joystick event SDL_JOYBATTERYUPDATED for when battery status changes. -* Added SDL_GUIDToString() and SDL_GUIDFromString() to convert between SDL GUID and string -* Added SDL_HasLSX() and SDL_HasLASX() to detect LoongArch SIMD support - -Windows: -* Added a D3D12 renderer implementation and SDL_RenderGetD3D12Device() to retrieve the D3D12 device associated with it -* Added the hint SDL_HINT_WINDOWS_DPI_AWARENESS to set whether the application is DPI-aware. This hint must be set before initializing the video subsystem. -* Added the hint SDL_HINT_WINDOWS_DPI_SCALING to control whether the SDL coordinates are in DPI-scaled points or pixels. - -Linux: -* Added the hint SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION to control whether to expose a set of emulated modes in addition to the native resolution modes available on Wayland -* Added the hint SDL_HINT_LINUX_DIGITAL_HATS to control whether to treat hats as digital rather than checking to see if they may be analog -* Added the hint SDL_HINT_LINUX_HAT_DEADZONES to control whether to use deadzones on analog hats - ---------------------------------------------------------------------------- -2.0.22: ---------------------------------------------------------------------------- - -General: -* Added SDL_RenderGetWindow() to get the window associated with a renderer -* Added floating point rectangle functions: - * SDL_PointInFRect() - * SDL_FRectEmpty() - * SDL_FRectEquals() - * SDL_FRectEqualsEpsilon() - * SDL_HasIntersectionF() - * SDL_IntersectFRect() - * SDL_UnionFRect() - * SDL_EncloseFPoints() - * SDL_IntersectFRectAndLine() -* Added SDL_IsTextInputShown() which returns whether the IME window is currently shown -* Added SDL_ClearComposition() to dismiss the composition window without disabling IME input -* Added SDL_TEXTEDITING_EXT event for handling long composition text, and a hint SDL_HINT_IME_SUPPORT_EXTENDED_TEXT to enable it -* Added the hint SDL_HINT_MOUSE_RELATIVE_MODE_CENTER to control whether the mouse should be constrained to the whole window or the center of the window when relative mode is enabled -* The mouse is now automatically captured when mouse buttons are pressed, and the hint SDL_HINT_MOUSE_AUTO_CAPTURE allows you to control this behavior -* Added the hint SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL to let SDL know that a foreign window will be used with OpenGL -* Added the hint SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN to let SDL know that a foreign window will be used with Vulkan -* Added the hint SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE to specify whether an SDL_QUIT event will be delivered when the last application window is closed -* Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks - -Windows: -* Added support for SDL_BLENDOPERATION_MINIMUM and SDL_BLENDOPERATION_MAXIMUM to the D3D9 renderer - -Linux: -* Compiling with Wayland support requires libwayland-client version 1.18.0 or later -* Added the hint SDL_HINT_X11_WINDOW_TYPE to specify the _NET_WM_WINDOW_TYPE of SDL windows -* Added the hint SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR to allow using libdecor with compositors that support xdg-decoration - -Android: -* Added SDL_AndroidSendMessage() to send a custom command to the SDL java activity - - --------------------------------------------------------------------------- 2.0.20: --------------------------------------------------------------------------- diff --git a/externals/SDL/Xcode/SDL/Info-Framework.plist b/externals/SDL/Xcode/SDL/Info-Framework.plist index 9a7cfd361..5f9ace084 100755 --- a/externals/SDL/Xcode/SDL/Info-Framework.plist +++ b/externals/SDL/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.23.1 + 2.0.20 CFBundleSignature SDLX CFBundleVersion - 2.23.1 + 2.0.20 diff --git a/externals/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/externals/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj index c46915a47..b23a394b9 100755 --- a/externals/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/externals/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -111,24 +111,6 @@ A1626A582617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; }; A1626A592617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; }; A1626A5A2617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; }; - A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6427F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6527F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6627F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6727F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6827F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6927F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6A27F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6B27F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; }; - A1BB8B6C27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A1BB8B6D27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A1BB8B6E27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A1BB8B6F27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A1BB8B7027F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A1BB8B7127F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A1BB8B7227F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A1BB8B7327F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; - A1BB8B7427F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; }; A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; A75FCCFD23E25AB700529352 /* SDL_shaders_metal_tvos.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8E323E2514000DCD162 /* SDL_shaders_metal_tvos.h */; }; @@ -3382,24 +3364,6 @@ DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; - F3249B1E285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B1F285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B20285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B21285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B22285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B23285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B24285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B25285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B26285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; }; - F3249B27285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; - F3249B28285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; - F3249B29285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; - F3249B2A285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; - F3249B2B285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; - F3249B2C285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; - F3249B2D285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; - F3249B2E285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; - F3249B2F285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; }; F3631C6424884ACF004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3631C652488534E004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F376F6192559B29300CFC0BC /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6182559B29300CFC0BC /* OpenGLES.framework */; platformFilter = ios; }; @@ -3431,38 +3395,8 @@ F376F7262559B76800CFC0BC /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F7252559B76800CFC0BC /* CoreFoundation.framework */; }; F376F7282559B77100CFC0BC /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F7272559B77100CFC0BC /* CoreAudio.framework */; }; F376F7332559B79B00CFC0BC /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6DE2559B5BA00CFC0BC /* GameController.framework */; }; - F37A8E1A28405AA100C38E95 /* CMake in Resources */ = {isa = PBXBuildFile; fileRef = F37A8E1928405AA100C38E95 /* CMake */; }; - F37A8E1B28405AA100C38E95 /* CMake in Resources */ = {isa = PBXBuildFile; fileRef = F37A8E1928405AA100C38E95 /* CMake */; }; - F37A8E1C28405AA100C38E95 /* CMake in Resources */ = {isa = PBXBuildFile; fileRef = F37A8E1928405AA100C38E95 /* CMake */; }; F37DC5F325350EBC0002E6F7 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; F37DC5F525350ECC0002E6F7 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F37DC5F425350ECC0002E6F7 /* CoreHaptics.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - F3820713284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F3820714284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F3820715284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F3820716284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F3820717284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F3820718284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F3820719284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F382071A284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F382071B284F3609004DD584 /* controller_type.c in Sources */ = {isa = PBXBuildFile; fileRef = F3820712284F3609004DD584 /* controller_type.c */; }; - F382071D284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F382071E284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F382071F284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F3820720284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F3820721284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F3820722284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F3820723284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F3820724284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F3820725284F362F004DD584 /* SDL_guid.c in Sources */ = {isa = PBXBuildFile; fileRef = F382071C284F362F004DD584 /* SDL_guid.c */; }; - F3820727284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F3820728284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F3820729284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F382072A284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; }; - F382072B284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; }; - F382072C284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; }; - F382072D284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F382072E284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F382072F284F3643004DD584 /* SDL_guid.h in Headers */ = {isa = PBXBuildFile; fileRef = F3820726284F3643004DD584 /* SDL_guid.h */; settings = {ATTRIBUTES = (Public, ); }; }; F38233852738EB8600F7F527 /* SDL_hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = F38233842738EB8600F7F527 /* SDL_hidapi.h */; settings = {ATTRIBUTES = (Public, ); }; }; F38233862738EB8600F7F527 /* SDL_hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = F38233842738EB8600F7F527 /* SDL_hidapi.h */; settings = {ATTRIBUTES = (Public, ); }; }; F38233872738EB8600F7F527 /* SDL_hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = F38233842738EB8600F7F527 /* SDL_hidapi.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -3517,13 +3451,13 @@ F395C1A22569C68F00942BFF /* SDL_iokitjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F395C1922569C68E00942BFF /* SDL_iokitjoystick.c */; }; F395C1A32569C68F00942BFF /* SDL_iokitjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F395C1922569C68E00942BFF /* SDL_iokitjoystick.c */; }; F395C1A42569C68F00942BFF /* SDL_iokitjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F395C1922569C68E00942BFF /* SDL_iokitjoystick.c */; }; - F395C1B12569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; + F395C1B12569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; F395C1B22569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B32569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; - F395C1B42569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; + F395C1B42569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; F395C1B52569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B62569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; - F395C1B72569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; + F395C1B72569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; F395C1B82569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1B92569C6A000942BFF /* SDL_mfijoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = F395C1AF2569C6A000942BFF /* SDL_mfijoystick.m */; }; F395C1BA2569C6A000942BFF /* SDL_mfijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F395C1B02569C6A000942BFF /* SDL_mfijoystick_c.h */; }; @@ -3640,8 +3574,6 @@ 75E09159241EA924004729E1 /* SDL_virtualjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_virtualjoystick_c.h; sourceTree = ""; }; A1626A3D2617006A003F1973 /* SDL_triangle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_triangle.c; sourceTree = ""; }; A1626A512617008C003F1973 /* SDL_triangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_triangle.h; sourceTree = ""; }; - A1BB8B6127F6CF320057CFA8 /* SDL_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_list.c; sourceTree = ""; }; - A1BB8B6227F6CF330057CFA8 /* SDL_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_list.h; sourceTree = ""; }; A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; A75FCEB323E25AB700529352 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -4045,8 +3977,6 @@ BECDF6B30761BA81005FE872 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; BECDF6BE0761BA81005FE872 /* SDL2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SDL2; sourceTree = BUILT_PRODUCTS_DIR; }; DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - F3249B1C285A85FF00DB9B5C /* SDL_memset.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memset.c; sourceTree = ""; }; - F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memcpy.c; sourceTree = ""; }; F376F6182559B29300CFC0BC /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; }; F376F61A2559B2AF00CFC0BC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; F376F6312559B31D00CFC0BC /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/iOSSupport/System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; @@ -4061,12 +3991,8 @@ F376F7212559B74900CFC0BC /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/Metal.framework; sourceTree = DEVELOPER_DIR; }; F376F7252559B76800CFC0BC /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = DEVELOPER_DIR; }; F376F7272559B77100CFC0BC /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/CoreAudio.framework; sourceTree = DEVELOPER_DIR; }; - F37A8E1928405AA100C38E95 /* CMake */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CMake; sourceTree = ""; }; F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = System/Library/Frameworks/CoreHaptics.framework; sourceTree = SDKROOT; }; F37DC5F425350ECC0002E6F7 /* CoreHaptics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreHaptics.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS14.0.sdk/System/Library/Frameworks/CoreHaptics.framework; sourceTree = DEVELOPER_DIR; }; - F3820712284F3609004DD584 /* controller_type.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = controller_type.c; sourceTree = ""; }; - F382071C284F362F004DD584 /* SDL_guid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_guid.c; sourceTree = ""; }; - F3820726284F3643004DD584 /* SDL_guid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_guid.h; sourceTree = ""; }; F38233842738EB8600F7F527 /* SDL_hidapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi.h; sourceTree = ""; }; F382339B2738ED6600F7F527 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS15.0.sdk/System/Library/Frameworks/CoreBluetooth.framework; sourceTree = DEVELOPER_DIR; }; F3950CD7212BC88D00F51292 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor.h; sourceTree = ""; }; @@ -4256,7 +4182,6 @@ 567E2F2017C44C35005F1892 /* SDL_filesystem.h */, A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */, AA7557D51595D4D800BBD41B /* SDL_gesture.h */, - F3820726284F3643004DD584 /* SDL_guid.h */, AA7557D61595D4D800BBD41B /* SDL_haptic.h */, F38233842738EB8600F7F527 /* SDL_hidapi.h */, AA7557D71595D4D800BBD41B /* SDL_hints.h */, @@ -4375,13 +4300,10 @@ A7D8A57023E2513D00DCD162 /* SDL_dataqueue.h */, A7D8A57523E2513D00DCD162 /* SDL_error_c.h */, A7D8A8BF23E2513F00DCD162 /* SDL_error.c */, - F382071C284F362F004DD584 /* SDL_guid.c */, A7D8A8D123E2514000DCD162 /* SDL_hints_c.h */, A7D8A5AB23E2513D00DCD162 /* SDL_hints.c */, A7D8A58323E2513D00DCD162 /* SDL_internal.h */, A7D8A5DD23E2513D00DCD162 /* SDL_log.c */, - A1BB8B6127F6CF320057CFA8 /* SDL_list.c */, - A1BB8B6227F6CF330057CFA8 /* SDL_list.h */, A7D8A57123E2513D00DCD162 /* SDL.c */, ); name = "Library Source"; @@ -4873,7 +4795,6 @@ 75E09157241EA924004729E1 /* virtual */, A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */, A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */, - F3820712284F3609004DD584 /* controller_type.c */, A7D8A7D923E2513E00DCD162 /* controller_type.h */, A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */, A7D8A7D023E2513E00DCD162 /* SDL_joystick_c.h */, @@ -5105,8 +5026,6 @@ A7D8A8D423E2514000DCD162 /* SDL_getenv.c */, A7D8A8D323E2514000DCD162 /* SDL_iconv.c */, A7D8A8D923E2514000DCD162 /* SDL_malloc.c */, - F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */, - F3249B1C285A85FF00DB9B5C /* SDL_memset.c */, A7D8A8D723E2514000DCD162 /* SDL_qsort.c */, A7D8A8D823E2514000DCD162 /* SDL_stdlib.c */, A7D8A8D523E2514000DCD162 /* SDL_string.c */, @@ -5282,7 +5201,6 @@ F59C710100D5CB5801000001 /* resources */ = { isa = PBXGroup; children = ( - F37A8E1928405AA100C38E95 /* CMake */, 00794D3F09D0C461003FC8A1 /* License.txt */, F59C710300D5CB5801000001 /* ReadMe.txt */, ); @@ -5309,7 +5227,6 @@ A75FCD0823E25AB700529352 /* SDL_atomic.h in Headers */, A75FCD0923E25AB700529352 /* SDL_rect_c.h in Headers */, A75FCD0B23E25AB700529352 /* SDL_shaders_metal_osx.h in Headers */, - F382072E284F3643004DD584 /* SDL_guid.h in Headers */, A75FCD0C23E25AB700529352 /* SDL_shaders_metal_ios.h in Headers */, A75FCD0D23E25AB700529352 /* SDL_offscreenwindow.h in Headers */, A75FCD0E23E25AB700529352 /* SDL_audio.h in Headers */, @@ -5367,7 +5284,6 @@ A75FCD4523E25AB700529352 /* SDL_gesture_c.h in Headers */, A75FCD4623E25AB700529352 /* SDL_shaders_gl.h in Headers */, A75FCD4723E25AB700529352 /* SDL_systhread_c.h in Headers */, - A1BB8B7327F6CF330057CFA8 /* SDL_list.h in Headers */, A75FCD4823E25AB700529352 /* SDL_keycode.h in Headers */, 5616CA63252BB35F005D5928 /* SDL_sysurl.h in Headers */, A75FCD4A23E25AB700529352 /* SDL_cocoakeyboard.h in Headers */, @@ -5539,7 +5455,6 @@ A75FCEC523E25AC700529352 /* SDL_shaders_metal_ios.h in Headers */, A75FCEC623E25AC700529352 /* SDL_offscreenwindow.h in Headers */, A75FCEC723E25AC700529352 /* SDL_audio.h in Headers */, - F382072F284F3643004DD584 /* SDL_guid.h in Headers */, A75FCEC823E25AC700529352 /* SDL_coremotionsensor.h in Headers */, A75FCEC923E25AC700529352 /* SDL_uikitview.h in Headers */, A75FCECA23E25AC700529352 /* SDL_bits.h in Headers */, @@ -5594,7 +5509,6 @@ A75FCEFE23E25AC700529352 /* SDL_gesture_c.h in Headers */, A75FCEFF23E25AC700529352 /* SDL_shaders_gl.h in Headers */, A75FCF0023E25AC700529352 /* SDL_systhread_c.h in Headers */, - A1BB8B7427F6CF330057CFA8 /* SDL_list.h in Headers */, A75FCF0123E25AC700529352 /* SDL_keycode.h in Headers */, 5616CA66252BB361005D5928 /* SDL_sysurl.h in Headers */, A75FCF0323E25AC700529352 /* SDL_cocoakeyboard.h in Headers */, @@ -5793,7 +5707,6 @@ A769B0C623E259AE00872273 /* SDL_windowevents_c.h in Headers */, A769B0C823E259AE00872273 /* SDL_cocoavideo.h in Headers */, 5605721C2473688D00B46B66 /* SDL_syslocale.h in Headers */, - A1BB8B7127F6CF330057CFA8 /* SDL_list.h in Headers */, A769B0CA23E259AE00872273 /* SDL_uikitevents.h in Headers */, A769B0CB23E259AE00872273 /* SDL_gesture_c.h in Headers */, A769B0CC23E259AE00872273 /* SDL_shaders_gl.h in Headers */, @@ -5889,7 +5802,6 @@ A769B14623E259AE00872273 /* SDL_syspower.h in Headers */, A769B14723E259AE00872273 /* vulkan_macos.h in Headers */, A769B14823E259AE00872273 /* vulkan_xcb.h in Headers */, - F382072C284F3643004DD584 /* SDL_guid.h in Headers */, A769B14923E259AE00872273 /* vulkan_ios.h in Headers */, A769B14A23E259AE00872273 /* SDL_internal.h in Headers */, A769B14E23E259AE00872273 /* vulkan.h in Headers */, @@ -5932,7 +5844,6 @@ A7D8BA0E23E2514400DCD162 /* SDL_blendpoint.h in Headers */, A7D8B3B723E2514200DCD162 /* SDL_blit.h in Headers */, A7D8B2BB23E2514200DCD162 /* SDL_blit_auto.h in Headers */, - F3820728284F3643004DD584 /* SDL_guid.h in Headers */, A7D8B39923E2514200DCD162 /* SDL_blit_copy.h in Headers */, A7D8ADED23E2514100DCD162 /* SDL_blit_slow.h in Headers */, A7D88A2123E2437C00DCD162 /* SDL_clipboard.h in Headers */, @@ -6044,7 +5955,6 @@ A7D8A98E23E2514000DCD162 /* SDL_sensor_c.h in Headers */, A7D8BA7423E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8BA5023E2514400DCD162 /* SDL_shaders_gles2.h in Headers */, - A1BB8B6D27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8B98D23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, A7D8B99C23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B9A223E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */, @@ -6165,7 +6075,6 @@ A7D8B3B823E2514200DCD162 /* SDL_blit.h in Headers */, A7D8B2BC23E2514200DCD162 /* SDL_blit_auto.h in Headers */, A7D8B39A23E2514200DCD162 /* SDL_blit_copy.h in Headers */, - F3820729284F3643004DD584 /* SDL_guid.h in Headers */, A7D8ADEE23E2514100DCD162 /* SDL_blit_slow.h in Headers */, A7D88BD823E24BED00DCD162 /* SDL_clipboard.h in Headers */, A7D8BB7123E2514500DCD162 /* SDL_clipboardevents_c.h in Headers */, @@ -6276,7 +6185,6 @@ A7D8A98F23E2514000DCD162 /* SDL_sensor_c.h in Headers */, A7D8BA7523E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8BA5123E2514400DCD162 /* SDL_shaders_gles2.h in Headers */, - A1BB8B6E27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8B98E23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, A7D8B99D23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B9A323E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */, @@ -6424,7 +6332,6 @@ A7D8BBAF23E2514500DCD162 /* SDL_windowevents_c.h in Headers */, A7D8AF0423E2514100DCD162 /* SDL_cocoavideo.h in Headers */, 5605721A2473688C00B46B66 /* SDL_syslocale.h in Headers */, - A1BB8B7027F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8ACC123E2514100DCD162 /* SDL_uikitevents.h in Headers */, A7D8BB3D23E2514500DCD162 /* SDL_gesture_c.h in Headers */, A7D8BA7723E2514400DCD162 /* SDL_shaders_gl.h in Headers */, @@ -6520,7 +6427,6 @@ A7D8B61523E2514300DCD162 /* SDL_syspower.h in Headers */, A7D8B28823E2514200DCD162 /* vulkan_macos.h in Headers */, A7D8B29423E2514200DCD162 /* vulkan_xcb.h in Headers */, - F382072B284F3643004DD584 /* SDL_guid.h in Headers */, A7D8B2A623E2514200DCD162 /* vulkan_ios.h in Headers */, A7D8A99D23E2514000DCD162 /* SDL_internal.h in Headers */, A7D8B26423E2514200DCD162 /* vulkan.h in Headers */, @@ -6565,7 +6471,6 @@ A7D8B2BA23E2514200DCD162 /* SDL_blit_auto.h in Headers */, A7D8B39823E2514200DCD162 /* SDL_blit_copy.h in Headers */, A7D8ADEC23E2514100DCD162 /* SDL_blit_slow.h in Headers */, - F3820727284F3643004DD584 /* SDL_guid.h in Headers */, AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */, A7D8BB6F23E2514500DCD162 /* SDL_clipboardevents_c.h in Headers */, A7D8AECA23E2514100DCD162 /* SDL_cocoaclipboard.h in Headers */, @@ -6675,7 +6580,6 @@ A7D8A98D23E2514000DCD162 /* SDL_sensor_c.h in Headers */, A7D8BA7323E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8BA4F23E2514400DCD162 /* SDL_shaders_gles2.h in Headers */, - A1BB8B6C27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8B98C23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, A7D8B99B23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B9A123E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */, @@ -6892,7 +6796,6 @@ A7D8B29F23E2514200DCD162 /* vulkan_xlib.h in Headers */, A7D8B25D23E2514200DCD162 /* vulkan_vi.h in Headers */, A7D8B29923E2514200DCD162 /* vulkan_mir.h in Headers */, - A1BB8B6F27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8BB4E23E2514500DCD162 /* default_cursor.h in Headers */, A7D8B9FE23E2514400DCD162 /* SDL_render_sw_c.h in Headers */, A7D8BBED23E2574800DCD162 /* SDL_uikitappdelegate.h in Headers */, @@ -6929,7 +6832,6 @@ A7D8AF1523E2514100DCD162 /* SDL_cocoaevents.h in Headers */, A7D8B25723E2514200DCD162 /* vk_icd.h in Headers */, A7D8ABE823E2514100DCD162 /* SDL_nullframebuffer_c.h in Headers */, - F382072A284F3643004DD584 /* SDL_guid.h in Headers */, A7D8AB1F23E2514100DCD162 /* SDL_dynapi_procs.h in Headers */, A7D8B27523E2514200DCD162 /* vulkan_fuchsia.h in Headers */, 5616CA57252BB35C005D5928 /* SDL_sysurl.h in Headers */, @@ -6961,7 +6863,6 @@ A7D8AC0823E2514100DCD162 /* SDL_rect_c.h in Headers */, A7D8B9A023E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B99123E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, - F382072D284F3643004DD584 /* SDL_guid.h in Headers */, A7D8AB8A23E2514100DCD162 /* SDL_offscreenwindow.h in Headers */, DB313FCC17554B71006C0E22 /* SDL_audio.h in Headers */, A7D8A97423E2514000DCD162 /* SDL_coremotionsensor.h in Headers */, @@ -7017,7 +6918,6 @@ A7D8BB3E23E2514500DCD162 /* SDL_gesture_c.h in Headers */, A7D8BA7823E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8B42D23E2514300DCD162 /* SDL_systhread_c.h in Headers */, - A1BB8B7227F6CF330057CFA8 /* SDL_list.h in Headers */, DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */, A7D8AE9323E2514100DCD162 /* SDL_cocoakeyboard.h in Headers */, A7D8ACE623E2514100DCD162 /* SDL_uikitvulkan.h in Headers */, @@ -7241,7 +7141,6 @@ A7D88ABF23E2437C00DCD162 /* Sources */, A7D88B4623E2437C00DCD162 /* Frameworks */, A75FDB9F23E4CAFA00529352 /* Embed Frameworks */, - F3ED8107281DB8E600C33C5B /* Convert SDL includes to SDL Framework includes */, ); buildRules = ( ); @@ -7263,7 +7162,6 @@ A7D88C7823E24BED00DCD162 /* Sources */, A7D88D0423E24BED00DCD162 /* Frameworks */, A75FDBA223E4CAFF00529352 /* Embed Frameworks */, - F3ED8108281DB8F200C33C5B /* Convert SDL includes to SDL Framework includes */, ); buildRules = ( ); @@ -7305,7 +7203,6 @@ BECDF62C0761BA81005FE872 /* Sources */, BECDF6680761BA81005FE872 /* Frameworks */, A75FDB9C23E4CAEF00529352 /* Embed Frameworks */, - F3ED8106281DB8A500C33C5B /* Convert SDL includes to SDL Framework includes */, ); buildRules = ( ); @@ -7416,7 +7313,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - F37A8E1B28405AA100C38E95 /* CMake in Resources */, A75FDBBA23E4CBC700529352 /* ReadMe.txt in Resources */, A75FDBB923E4CBC700529352 /* License.txt in Resources */, ); @@ -7426,7 +7322,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - F37A8E1C28405AA100C38E95 /* CMake in Resources */, A75FDBBC23E4CBC800529352 /* ReadMe.txt in Resources */, A75FDBBB23E4CBC800529352 /* License.txt in Resources */, ); @@ -7436,7 +7331,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - F37A8E1A28405AA100C38E95 /* CMake in Resources */, A75FDBB823E4CBC700529352 /* ReadMe.txt in Resources */, A75FDBB723E4CBC700529352 /* License.txt in Resources */, ); @@ -7499,60 +7393,6 @@ shellPath = /bin/sh; shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; }; - F3ED8106281DB8A500C33C5B /* Convert SDL includes to SDL Framework includes */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Convert SDL includes to SDL Framework includes"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; - }; - F3ED8107281DB8E600C33C5B /* Convert SDL includes to SDL Framework includes */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Convert SDL includes to SDL Framework includes"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; - }; - F3ED8108281DB8F200C33C5B /* Convert SDL includes to SDL Framework includes */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Convert SDL includes to SDL Framework includes"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -7619,12 +7459,10 @@ A75FCE2023E25AB700529352 /* SDL_haptic.c in Sources */, A75FCE2123E25AB700529352 /* SDL_uikitvulkan.m in Sources */, F3984CD725BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, - F382071A284F3609004DD584 /* controller_type.c in Sources */, 75E09161241EA924004729E1 /* SDL_virtualjoystick.c in Sources */, A75FCE2323E25AB700529352 /* SDL_cocoametalview.m in Sources */, A75FCE2423E25AB700529352 /* SDL_audiotypecvt.c in Sources */, A75FCE2523E25AB700529352 /* SDL_uikitevents.m in Sources */, - F3820724284F362F004DD584 /* SDL_guid.c in Sources */, A75FCE2623E25AB700529352 /* SDL_uikitmodes.m in Sources */, A75FCE2723E25AB700529352 /* SDL_blit_N.c in Sources */, A75FCE2823E25AB700529352 /* SDL_dropevents.c in Sources */, @@ -7668,7 +7506,6 @@ A75FCE5023E25AB700529352 /* SDL_syspower.m in Sources */, A75FCE5123E25AB700529352 /* e_log10.c in Sources */, A75FCE5223E25AB700529352 /* SDL_uikitopenglview.m in Sources */, - F3249B2E285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A75FCE5323E25AB700529352 /* SDL_mixer.c in Sources */, 5616CA64252BB35F005D5928 /* SDL_url.c in Sources */, A75FCE5423E25AB700529352 /* SDL_events.c in Sources */, @@ -7717,13 +7554,11 @@ A75FCE8423E25AB700529352 /* e_exp.c in Sources */, A75FCE8523E25AB700529352 /* SDL_quit.c in Sources */, A75FCE8623E25AB700529352 /* SDL_cocoawindow.m in Sources */, - A1BB8B6A27F6CF330057CFA8 /* SDL_list.c in Sources */, A75FCE8723E25AB700529352 /* SDL_sysmutex.c in Sources */, A75FCE8823E25AB700529352 /* SDL_syshaptic.c in Sources */, F3F07D61269640160074468B /* SDL_hidapi_luna.c in Sources */, A75FCE8923E25AB700529352 /* SDL_rwopsbundlesupport.m in Sources */, A75FCE8A23E25AB700529352 /* SDL_video.c in Sources */, - F3249B25285A85FF00DB9B5C /* SDL_memset.c in Sources */, A75FCE8B23E25AB700529352 /* SDL_offscreenopengl.c in Sources */, A75FCE8C23E25AB700529352 /* SDL_uikitmetalview.m in Sources */, A75FCE8D23E25AB700529352 /* SDL_steamcontroller.c in Sources */, @@ -7811,12 +7646,10 @@ A75FCFD923E25AC700529352 /* SDL_haptic.c in Sources */, A75FCFDA23E25AC700529352 /* SDL_uikitvulkan.m in Sources */, F3984CD825BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, - F382071B284F3609004DD584 /* controller_type.c in Sources */, 75E09162241EA924004729E1 /* SDL_virtualjoystick.c in Sources */, A75FCFDC23E25AC700529352 /* SDL_cocoametalview.m in Sources */, A75FCFDD23E25AC700529352 /* SDL_audiotypecvt.c in Sources */, A75FCFDE23E25AC700529352 /* SDL_uikitevents.m in Sources */, - F3820725284F362F004DD584 /* SDL_guid.c in Sources */, A75FCFDF23E25AC700529352 /* SDL_uikitmodes.m in Sources */, A75FCFE023E25AC700529352 /* SDL_blit_N.c in Sources */, A75FCFE123E25AC700529352 /* SDL_dropevents.c in Sources */, @@ -7860,7 +7693,6 @@ A75FD00923E25AC700529352 /* SDL_syspower.m in Sources */, A75FD00A23E25AC700529352 /* e_log10.c in Sources */, A75FD00B23E25AC700529352 /* SDL_uikitopenglview.m in Sources */, - F3249B2F285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A75FD00C23E25AC700529352 /* SDL_mixer.c in Sources */, 5616CA67252BB361005D5928 /* SDL_url.c in Sources */, A75FD00D23E25AC700529352 /* SDL_events.c in Sources */, @@ -7909,13 +7741,11 @@ A75FD03D23E25AC700529352 /* e_exp.c in Sources */, A75FD03E23E25AC700529352 /* SDL_quit.c in Sources */, A75FD03F23E25AC700529352 /* SDL_cocoawindow.m in Sources */, - A1BB8B6B27F6CF330057CFA8 /* SDL_list.c in Sources */, A75FD04023E25AC700529352 /* SDL_sysmutex.c in Sources */, A75FD04123E25AC700529352 /* SDL_syshaptic.c in Sources */, F3F07D62269640160074468B /* SDL_hidapi_luna.c in Sources */, A75FD04223E25AC700529352 /* SDL_rwopsbundlesupport.m in Sources */, A75FD04323E25AC700529352 /* SDL_video.c in Sources */, - F3249B26285A85FF00DB9B5C /* SDL_memset.c in Sources */, A75FD04423E25AC700529352 /* SDL_offscreenopengl.c in Sources */, A75FD04523E25AC700529352 /* SDL_uikitmetalview.m in Sources */, A75FD04623E25AC700529352 /* SDL_steamcontroller.c in Sources */, @@ -8014,7 +7844,6 @@ A769B1B823E259AE00872273 /* e_log.c in Sources */, A769B1B923E259AE00872273 /* SDL_cocoamessagebox.m in Sources */, A769B1BA23E259AE00872273 /* SDL_blendfillrect.c in Sources */, - F3820722284F362F004DD584 /* SDL_guid.c in Sources */, A769B1BB23E259AE00872273 /* SDL_uikitvideo.m in Sources */, A769B1BC23E259AE00872273 /* SDL_cocoashape.m in Sources */, A769B1BD23E259AE00872273 /* SDL_cocoamouse.m in Sources */, @@ -8041,7 +7870,6 @@ A769B1D523E259AE00872273 /* SDL_render.c in Sources */, A769B1D623E259AE00872273 /* SDL_stretch.c in Sources */, A769B1D723E259AE00872273 /* s_floor.c in Sources */, - F3249B23285A85FF00DB9B5C /* SDL_memset.c in Sources */, A769B1D823E259AE00872273 /* SDL_blit_copy.c in Sources */, A769B1D923E259AE00872273 /* e_fmod.c in Sources */, A769B1DA23E259AE00872273 /* SDL_syspower.m in Sources */, @@ -8087,7 +7915,6 @@ F3984CD525BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A769B20523E259AE00872273 /* SDL_strtokr.c in Sources */, 5605720B2473687A00B46B66 /* SDL_syslocale.m in Sources */, - F3820718284F3609004DD584 /* controller_type.c in Sources */, A769B20623E259AE00872273 /* SDL_clipboardevents.c in Sources */, A769B20823E259AE00872273 /* k_cos.c in Sources */, A769B20923E259AE00872273 /* SDL_hidapijoystick.c in Sources */, @@ -8100,11 +7927,9 @@ A769B20F23E259AE00872273 /* SDL_syshaptic.c in Sources */, A769B21023E259AE00872273 /* e_exp.c in Sources */, F395C1A12569C68F00942BFF /* SDL_iokitjoystick.c in Sources */, - A1BB8B6827F6CF330057CFA8 /* SDL_list.c in Sources */, A769B21123E259AE00872273 /* SDL_quit.c in Sources */, A769B21223E259AE00872273 /* SDL_cocoawindow.m in Sources */, A769B21323E259AE00872273 /* SDL_sysmutex.c in Sources */, - F3249B2C285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A769B21423E259AE00872273 /* SDL_syshaptic.c in Sources */, A769B21523E259AE00872273 /* SDL_rwopsbundlesupport.m in Sources */, A769B21623E259AE00872273 /* SDL_video.c in Sources */, @@ -8196,12 +8021,10 @@ A7D8AF2523E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86123E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, F3984CD125BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, - F3820714284F3609004DD584 /* controller_type.c in Sources */, A7D8AC5823E2514100DCD162 /* SDL_uikitevents.m in Sources */, A7D8ACB823E2514100DCD162 /* SDL_uikitmodes.m in Sources */, A7D8AD3323E2514100DCD162 /* SDL_blit_N.c in Sources */, A7D8BB7C23E2514500DCD162 /* SDL_dropevents.c in Sources */, - F382071E284F362F004DD584 /* SDL_guid.c in Sources */, A7D8BACE23E2514500DCD162 /* e_atan2.c in Sources */, A7D8BA8C23E2514400DCD162 /* s_sin.c in Sources */, A7D8B5E823E2514300DCD162 /* SDL_power.c in Sources */, @@ -8245,7 +8068,6 @@ A7D8AC7023E2514100DCD162 /* SDL_uikitopenglview.m in Sources */, A7D8B76523E2514300DCD162 /* SDL_mixer.c in Sources */, A7D8BB5823E2514500DCD162 /* SDL_events.c in Sources */, - F3249B28285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8ADE723E2514100DCD162 /* SDL_blit_0.c in Sources */, A7D8BB0A23E2514500DCD162 /* k_tan.c in Sources */, A75FDBCF23EA380300529352 /* SDL_hidapi_rumble.c in Sources */, @@ -8294,13 +8116,11 @@ A7D8B43B23E2514300DCD162 /* SDL_sysmutex.c in Sources */, A7D8AAB123E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8B5CA23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */, - A1BB8B6427F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8AC1023E2514100DCD162 /* SDL_video.c in Sources */, 560572062473687700B46B66 /* SDL_syslocale.m in Sources */, F3F07D5B269640160074468B /* SDL_hidapi_luna.c in Sources */, A7D8AB5623E2514100DCD162 /* SDL_offscreenopengl.c in Sources */, A7D8ACC423E2514100DCD162 /* SDL_uikitmetalview.m in Sources */, - F3249B1F285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8BA5C23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */, A7D8B14123E2514200DCD162 /* SDL_blit_1.c in Sources */, 5605720F2473688000B46B66 /* SDL_locale.c in Sources */, @@ -8388,12 +8208,10 @@ A7D8AF2623E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86223E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, F3984CD225BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, - F3820715284F3609004DD584 /* controller_type.c in Sources */, A7D8AC5923E2514100DCD162 /* SDL_uikitevents.m in Sources */, A7D8ACB923E2514100DCD162 /* SDL_uikitmodes.m in Sources */, A7D8AD3423E2514100DCD162 /* SDL_blit_N.c in Sources */, A7D8BB7D23E2514500DCD162 /* SDL_dropevents.c in Sources */, - F382071F284F362F004DD584 /* SDL_guid.c in Sources */, A7D8BACF23E2514500DCD162 /* e_atan2.c in Sources */, A7D8BA8D23E2514400DCD162 /* s_sin.c in Sources */, A7D8B5E923E2514300DCD162 /* SDL_power.c in Sources */, @@ -8437,7 +8255,6 @@ A7D8AC7123E2514100DCD162 /* SDL_uikitopenglview.m in Sources */, A7D8B76623E2514300DCD162 /* SDL_mixer.c in Sources */, A7D8BB5923E2514500DCD162 /* SDL_events.c in Sources */, - F3249B29285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8ADE823E2514100DCD162 /* SDL_blit_0.c in Sources */, A7D8BB0B23E2514500DCD162 /* k_tan.c in Sources */, A75FDBD023EA380300529352 /* SDL_hidapi_rumble.c in Sources */, @@ -8486,13 +8303,11 @@ A7D8B43C23E2514300DCD162 /* SDL_sysmutex.c in Sources */, A7D8AAB223E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8B5CB23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */, - A1BB8B6527F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8AC1123E2514100DCD162 /* SDL_video.c in Sources */, 560572072473687800B46B66 /* SDL_syslocale.m in Sources */, F3F07D5C269640160074468B /* SDL_hidapi_luna.c in Sources */, A7D8AB5723E2514100DCD162 /* SDL_offscreenopengl.c in Sources */, A7D8ACC523E2514100DCD162 /* SDL_uikitmetalview.m in Sources */, - F3249B20285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8BA5D23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */, A7D8B14223E2514200DCD162 /* SDL_blit_1.c in Sources */, 560572102473688000B46B66 /* SDL_locale.c in Sources */, @@ -8591,7 +8406,6 @@ A7D8BAF523E2514500DCD162 /* e_log.c in Sources */, A7D8AED423E2514100DCD162 /* SDL_cocoamessagebox.m in Sources */, A7D8BA2F23E2514400DCD162 /* SDL_blendfillrect.c in Sources */, - F3820721284F362F004DD584 /* SDL_guid.c in Sources */, A7D8ACDF23E2514100DCD162 /* SDL_uikitvideo.m in Sources */, A7D8AEE623E2514100DCD162 /* SDL_cocoashape.m in Sources */, A7D8AEBC23E2514100DCD162 /* SDL_cocoamouse.m in Sources */, @@ -8618,7 +8432,6 @@ A7D8B97E23E2514400DCD162 /* SDL_render.c in Sources */, A7D8ABD723E2514100DCD162 /* SDL_stretch.c in Sources */, A7D8BB0123E2514500DCD162 /* s_floor.c in Sources */, - F3249B22285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8AC3D23E2514100DCD162 /* SDL_blit_copy.c in Sources */, A7D8BAE323E2514500DCD162 /* e_fmod.c in Sources */, A7D8B5D323E2514300DCD162 /* SDL_syspower.m in Sources */, @@ -8664,7 +8477,6 @@ F3984CD425BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A7D8B96623E2514400DCD162 /* SDL_strtokr.c in Sources */, 560572092473687900B46B66 /* SDL_syslocale.m in Sources */, - F3820717284F3609004DD584 /* controller_type.c in Sources */, A7D8BB7923E2514500DCD162 /* SDL_clipboardevents.c in Sources */, A7D8BAB923E2514400DCD162 /* k_cos.c in Sources */, A7D8B54923E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, @@ -8677,11 +8489,9 @@ A7D8AADE23E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8BAE923E2514500DCD162 /* e_exp.c in Sources */, F395C1A02569C68F00942BFF /* SDL_iokitjoystick.c in Sources */, - A1BB8B6727F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8BB8523E2514500DCD162 /* SDL_quit.c in Sources */, A7D8AEAA23E2514100DCD162 /* SDL_cocoawindow.m in Sources */, A7D8B43E23E2514300DCD162 /* SDL_sysmutex.c in Sources */, - F3249B2B285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8AAB423E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8B5CD23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */, A7D8AC1323E2514100DCD162 /* SDL_video.c in Sources */, @@ -8734,7 +8544,6 @@ A7D8BBE323E2574800DCD162 /* SDL_uikitvideo.m in Sources */, 5616CA4E252BB2A6005D5928 /* SDL_sysurl.m in Sources */, A7D8A97523E2514000DCD162 /* SDL_coremotionsensor.m in Sources */, - F382071D284F362F004DD584 /* SDL_guid.c in Sources */, A7D8BB8D23E2514500DCD162 /* SDL_touch.c in Sources */, A1626A3E2617006A003F1973 /* SDL_triangle.c in Sources */, A7D8B3F223E2514300DCD162 /* SDL_thread.c in Sources */, @@ -8776,7 +8585,6 @@ F3984CD025BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A7D8AAB623E2514100DCD162 /* SDL_haptic.c in Sources */, A7D8AF2423E2514100DCD162 /* SDL_cocoametalview.m in Sources */, - F3249B1E285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8B86023E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, A7D8BBC523E2561500DCD162 /* SDL_steamcontroller.c in Sources */, A7D8AD3223E2514100DCD162 /* SDL_blit_N.c in Sources */, @@ -8847,7 +8655,6 @@ A7D8B4DC23E2514300DCD162 /* SDL_joystick.c in Sources */, A7D8BA4923E2514400DCD162 /* SDL_render_gles2.c in Sources */, A7D8AC2D23E2514100DCD162 /* SDL_surface.c in Sources */, - F3249B27285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8B54B23E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */, A7D8AD2323E2514100DCD162 /* SDL_blit_auto.c in Sources */, F3A4909E2554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */, @@ -8858,13 +8665,11 @@ A7D8B55123E2514300DCD162 /* SDL_hidapi_switch.c in Sources */, A7D8B96223E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7523E2514500DCD162 /* SDL_clipboardevents.c in Sources */, - A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8BAB523E2514400DCD162 /* k_cos.c in Sources */, A7D8B54523E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, A7D8B97423E2514400DCD162 /* SDL_malloc.c in Sources */, A7D8B8C623E2514400DCD162 /* SDL_audio.c in Sources */, A7D8B61D23E2514300DCD162 /* SDL_sysfilesystem.c in Sources */, - F3820713284F3609004DD584 /* controller_type.c in Sources */, A7D8AB8B23E2514100DCD162 /* SDL_offscreenvideo.c in Sources */, A7D8B42E23E2514300DCD162 /* SDL_syscond.c in Sources */, A7D8AADA23E2514100DCD162 /* SDL_syshaptic.c in Sources */, @@ -8924,7 +8729,6 @@ A7D8A97823E2514000DCD162 /* SDL_coremotionsensor.m in Sources */, A7D8BB9023E2514500DCD162 /* SDL_touch.c in Sources */, A7D8B3F523E2514300DCD162 /* SDL_thread.c in Sources */, - F3820720284F362F004DD584 /* SDL_guid.c in Sources */, A7D8B56023E2514300DCD162 /* SDL_hidapi_xbox360w.c in Sources */, A1626A412617006A003F1973 /* SDL_triangle.c in Sources */, 5616CA59252BB35C005D5928 /* SDL_sysurl.m in Sources */, @@ -8966,7 +8770,6 @@ A7D8AF2723E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86323E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, A7D8AD3523E2514100DCD162 /* SDL_blit_N.c in Sources */, - F3249B21285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8BB7E23E2514500DCD162 /* SDL_dropevents.c in Sources */, A7D8BBFA23E2574800DCD162 /* SDL_uikitopengles.m in Sources */, A7D8BAD023E2514500DCD162 /* e_atan2.c in Sources */, @@ -9037,7 +8840,6 @@ A7D8BA4C23E2514400DCD162 /* SDL_render_gles2.c in Sources */, A7D8AC3023E2514100DCD162 /* SDL_surface.c in Sources */, A7D8B54E23E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */, - F3249B2A285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8AD2623E2514100DCD162 /* SDL_blit_auto.c in Sources */, A7D8BB6C23E2514500DCD162 /* SDL_keyboard.c in Sources */, A7D8ACEA23E2514100DCD162 /* SDL_rect.c in Sources */, @@ -9048,13 +8850,11 @@ A7D8B96523E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7823E2514500DCD162 /* SDL_clipboardevents.c in Sources */, A7D8BAB823E2514400DCD162 /* k_cos.c in Sources */, - A1BB8B6627F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8B54823E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, A7D8B97723E2514400DCD162 /* SDL_malloc.c in Sources */, A7D8BBF023E2574800DCD162 /* SDL_uikitclipboard.m in Sources */, A7D8B8C923E2514400DCD162 /* SDL_audio.c in Sources */, A7D8B62023E2514300DCD162 /* SDL_sysfilesystem.c in Sources */, - F3820716284F3609004DD584 /* controller_type.c in Sources */, A7D8AB8E23E2514100DCD162 /* SDL_offscreenvideo.c in Sources */, A7D8B43123E2514300DCD162 /* SDL_syscond.c in Sources */, A7D8AADD23E2514100DCD162 /* SDL_syshaptic.c in Sources */, @@ -9114,7 +8914,6 @@ A7D8BB9223E2514500DCD162 /* SDL_touch.c in Sources */, A7D8AC5623E2514100DCD162 /* SDL_uikitmessagebox.m in Sources */, A7D8B3F723E2514300DCD162 /* SDL_thread.c in Sources */, - F3820723284F362F004DD584 /* SDL_guid.c in Sources */, A7D8B56223E2514300DCD162 /* SDL_hidapi_xbox360w.c in Sources */, A1626A442617006A003F1973 /* SDL_triangle.c in Sources */, 5616CA62252BB35E005D5928 /* SDL_sysurl.m in Sources */, @@ -9156,7 +8955,6 @@ A7D8AF2923E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86523E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, A7D8AC5C23E2514100DCD162 /* SDL_uikitevents.m in Sources */, - F3249B24285A85FF00DB9B5C /* SDL_memset.c in Sources */, A7D8ACBC23E2514100DCD162 /* SDL_uikitmodes.m in Sources */, A7D8AD3723E2514100DCD162 /* SDL_blit_N.c in Sources */, A7D8BB8023E2514500DCD162 /* SDL_dropevents.c in Sources */, @@ -9227,7 +9025,6 @@ A7D8B4E123E2514300DCD162 /* SDL_joystick.c in Sources */, A7D8BA4E23E2514400DCD162 /* SDL_render_gles2.c in Sources */, A7D8AC3223E2514100DCD162 /* SDL_surface.c in Sources */, - F3249B2D285A85FF00DB9B5C /* SDL_memcpy.c in Sources */, A7D8B55023E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */, A7D8AD2823E2514100DCD162 /* SDL_blit_auto.c in Sources */, A7D8BB6E23E2514500DCD162 /* SDL_keyboard.c in Sources */, @@ -9238,13 +9035,11 @@ A7D8B96723E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7A23E2514500DCD162 /* SDL_clipboardevents.c in Sources */, A7D8BABA23E2514400DCD162 /* k_cos.c in Sources */, - A1BB8B6927F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8B54A23E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, A7D8B97923E2514400DCD162 /* SDL_malloc.c in Sources */, A7D8B8CB23E2514400DCD162 /* SDL_audio.c in Sources */, A7D8B62223E2514300DCD162 /* SDL_sysfilesystem.c in Sources */, A7D8AB9023E2514100DCD162 /* SDL_offscreenvideo.c in Sources */, - F3820719284F3609004DD584 /* controller_type.c in Sources */, A7D8B43323E2514300DCD162 /* SDL_syscond.c in Sources */, A7D8AADF23E2514100DCD162 /* SDL_syshaptic.c in Sources */, A7D8BAEA23E2514500DCD162 /* e_exp.c in Sources */, @@ -9296,7 +9091,6 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -9317,7 +9111,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 2302.0.0; + DYLIB_CURRENT_VERSION = 19.2.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9346,7 +9140,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.6; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_NAME = SDL2; STRIP_STYLE = "non-global"; @@ -9382,7 +9176,6 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -9402,7 +9195,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 2302.0.0; + DYLIB_CURRENT_VERSION = 19.2.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9431,7 +9224,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_NAME = SDL2; @@ -9594,7 +9387,6 @@ buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; CLANG_LINK_OBJC_RUNTIME = NO; - GCC_PREPROCESSOR_DEFINITIONS = GLES_SILENCE_DEPRECATION; GCC_SYMBOLS_PRIVATE_EXTERN = YES; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -9606,7 +9398,6 @@ buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; CLANG_LINK_OBJC_RUNTIME = NO; - GCC_PREPROCESSOR_DEFINITIONS = GLES_SILENCE_DEPRECATION; GCC_SYMBOLS_PRIVATE_EXTERN = YES; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; diff --git a/externals/SDL/Xcode/SDL/pkg-support/resources/ReadMe.txt b/externals/SDL/Xcode/SDL/pkg-support/resources/ReadMe.txt index 9f495913c..40ac3a14c 100755 --- a/externals/SDL/Xcode/SDL/pkg-support/resources/ReadMe.txt +++ b/externals/SDL/Xcode/SDL/pkg-support/resources/ReadMe.txt @@ -18,19 +18,7 @@ To Install: Copy the SDL2.framework to /Library/Frameworks You may alternatively install it in /Library/Frameworks -if your access privileges are not high enough. - - -Use in CMake projects: -SDL2.framework can be used in CMake projects using the following pattern: -``` -find_package(SDL2 REQUIRED COMPONENTS SDL2) -add_executable(my_game ${MY_SOURCES}) -target_link_libraries(my_game PRIVATE SDL2::SDL2) -``` -If SDL2.framework is installed in a non-standard location, -please refer to the following link for ways to configure CMake: -https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure +if your access privileges are not high enough. Additional References: diff --git a/externals/SDL/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/externals/SDL/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index e7e1d23bc..8c524cc54 100755 --- a/externals/SDL/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/externals/SDL/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -4041,7 +4041,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_OBJC_ARC = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", "$(HOME)/Library/Frameworks", @@ -4049,7 +4048,7 @@ ); GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.6; }; name = Debug; }; @@ -4169,7 +4168,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_OBJC_ARC = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", "$(HOME)/Library/Frameworks", @@ -4177,7 +4175,7 @@ ); GCC_GENERATE_DEBUGGING_SYMBOLS = NO; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.6; }; name = Release; }; diff --git a/externals/SDL/Xcode/SDLTest/TestDropFile-Info.plist b/externals/SDL/Xcode/SDLTest/TestDropFile-Info.plist index c9f6cb835..03e46b33b 100755 --- a/externals/SDL/Xcode/SDLTest/TestDropFile-Info.plist +++ b/externals/SDL/Xcode/SDLTest/TestDropFile-Info.plist @@ -30,6 +30,6 @@ CFBundleVersion 1.0 LSMinimumSystemVersion - 10.7 + 10.6 diff --git a/externals/SDL/acinclude/libtool.m4 b/externals/SDL/acinclude/libtool.m4 index 3236ddab0..df6496ee7 100755 --- a/externals/SDL/acinclude/libtool.m4 +++ b/externals/SDL/acinclude/libtool.m4 @@ -1068,7 +1068,7 @@ _LT_EOF darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) - case $MACOSX_DEPLOYMENT_TARGET,$host in + case ${MACOSX_DEPLOYMENT_TARGET},$host in 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) diff --git a/externals/SDL/android-project-ant/src/org/libsdl/app/SDLActivity.java b/externals/SDL/android-project-ant/src/org/libsdl/app/SDLActivity.java index d2873ff6c..8641ccf80 100755 --- a/externals/SDL/android-project-ant/src/org/libsdl/app/SDLActivity.java +++ b/externals/SDL/android-project-ant/src/org/libsdl/app/SDLActivity.java @@ -63,112 +63,6 @@ import java.util.Locale; */ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; -/* - // Display InputType.SOURCE/CLASS of events and devices - // - // SDLActivity.debugSource(device.getSources(), "device[" + device.getName() + "]"); - // SDLActivity.debugSource(event.getSource(), "event"); - public static void debugSource(int sources, String prefix) { - int s = sources; - int s_copy = sources; - String cls = ""; - String src = ""; - int tst = 0; - int FLAG_TAINTED = 0x80000000; - - if ((s & InputDevice.SOURCE_CLASS_BUTTON) != 0) cls += " BUTTON"; - if ((s & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) cls += " JOYSTICK"; - if ((s & InputDevice.SOURCE_CLASS_POINTER) != 0) cls += " POINTER"; - if ((s & InputDevice.SOURCE_CLASS_POSITION) != 0) cls += " POSITION"; - if ((s & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) cls += " TRACKBALL"; - - - int s2 = s_copy & ~InputDevice.SOURCE_ANY; // keep class bits - s2 &= ~( InputDevice.SOURCE_CLASS_BUTTON - | InputDevice.SOURCE_CLASS_JOYSTICK - | InputDevice.SOURCE_CLASS_POINTER - | InputDevice.SOURCE_CLASS_POSITION - | InputDevice.SOURCE_CLASS_TRACKBALL); - - if (s2 != 0) cls += "Some_Unkown"; - - s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class; - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - tst = InputDevice.SOURCE_BLUETOOTH_STYLUS; - if ((s & tst) == tst) src += " BLUETOOTH_STYLUS"; - s2 &= ~tst; - } - - tst = InputDevice.SOURCE_DPAD; - if ((s & tst) == tst) src += " DPAD"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_GAMEPAD; - if ((s & tst) == tst) src += " GAMEPAD"; - s2 &= ~tst; - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - tst = InputDevice.SOURCE_HDMI; - if ((s & tst) == tst) src += " HDMI"; - s2 &= ~tst; - } - - tst = InputDevice.SOURCE_JOYSTICK; - if ((s & tst) == tst) src += " JOYSTICK"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_KEYBOARD; - if ((s & tst) == tst) src += " KEYBOARD"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_MOUSE; - if ((s & tst) == tst) src += " MOUSE"; - s2 &= ~tst; - - if (Build.VERSION.SDK_INT >= 26) { - tst = InputDevice.SOURCE_MOUSE_RELATIVE; - if ((s & tst) == tst) src += " MOUSE_RELATIVE"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_ROTARY_ENCODER; - if ((s & tst) == tst) src += " ROTARY_ENCODER"; - s2 &= ~tst; - } - tst = InputDevice.SOURCE_STYLUS; - if ((s & tst) == tst) src += " STYLUS"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_TOUCHPAD; - if ((s & tst) == tst) src += " TOUCHPAD"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_TOUCHSCREEN; - if ((s & tst) == tst) src += " TOUCHSCREEN"; - s2 &= ~tst; - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - tst = InputDevice.SOURCE_TOUCH_NAVIGATION; - if ((s & tst) == tst) src += " TOUCH_NAVIGATION"; - s2 &= ~tst; - } - - tst = InputDevice.SOURCE_TRACKBALL; - if ((s & tst) == tst) src += " TRACKBALL"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_ANY; - if ((s & tst) == tst) src += " ANY"; - s2 &= ~tst; - - if (s == FLAG_TAINTED) src += " FLAG_TAINTED"; - s2 &= ~FLAG_TAINTED; - - if (s2 != 0) src += " Some_Unkown"; - - Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src); - } -*/ public static boolean mIsResumedCalled, mHasFocus; public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24); @@ -1310,21 +1204,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh for (int id : ids) { InputDevice device = InputDevice.getDevice(id); - /* Allow SOURCE_TOUCHSCREEN and also Virtual InputDevices because they can send TOUCHSCREEN events */ - if (device != null && ((device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN - || device.isVirtual())) { - - int touchDevId = device.getId(); - /* - * Prevent id to be -1, since it's used in SDL internal for synthetic events - * Appears when using Android emulator, eg: - * adb shell input mouse tap 100 100 - * adb shell input touchscreen tap 100 100 - */ - if (touchDevId < 0) { - touchDevId -= 1; - } - nativeAddTouch(touchDevId, device.getName()); + if (device != null && (device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0) { + nativeAddTouch(device.getId(), device.getName()); } } } @@ -2014,7 +1895,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } - if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { + if ((source & InputDevice.SOURCE_KEYBOARD) != 0) { if (event.getAction() == KeyEvent.ACTION_DOWN) { if (SDLActivity.isTextInputEvent(event)) { SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); @@ -2027,7 +1908,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } - if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { + if ((source & InputDevice.SOURCE_MOUSE) != 0) { // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses // they are ignored here because sending them as mouse input to SDL is messy if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { diff --git a/externals/SDL/android-project-ant/src/org/libsdl/app/SDLControllerManager.java b/externals/SDL/android-project-ant/src/org/libsdl/app/SDLControllerManager.java index 82373d9d6..05e0f0cac 100755 --- a/externals/SDL/android-project-ant/src/org/libsdl/app/SDLControllerManager.java +++ b/externals/SDL/android-project-ant/src/org/libsdl/app/SDLControllerManager.java @@ -255,21 +255,23 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler { @Override public boolean handleMotionEvent(MotionEvent event) { - int actionPointerIndex = event.getActionIndex(); - int action = event.getActionMasked(); - if (action == MotionEvent.ACTION_MOVE) { - SDLJoystick joystick = getJoystick(event.getDeviceId()); - if (joystick != null) { - for (int i = 0; i < joystick.axes.size(); i++) { - InputDevice.MotionRange range = joystick.axes.get(i); - /* Normalize the value to -1...1 */ - float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f; - SDLControllerManager.onNativeJoy(joystick.device_id, i, value); - } - for (int i = 0; i < joystick.hats.size() / 2; i++) { - int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex)); - int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex)); - SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY); + if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) { + int actionPointerIndex = event.getActionIndex(); + int action = event.getActionMasked(); + if (action == MotionEvent.ACTION_MOVE) { + SDLJoystick joystick = getJoystick(event.getDeviceId()); + if (joystick != null) { + for (int i = 0; i < joystick.axes.size(); i++) { + InputDevice.MotionRange range = joystick.axes.get(i); + /* Normalize the value to -1...1 */ + float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f; + SDLControllerManager.onNativeJoy(joystick.device_id, i, value); + } + for (int i = 0; i < joystick.hats.size() / 2; i++) { + int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex)); + int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex)); + SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY); + } } } } @@ -317,7 +319,6 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 { KeyEvent.KEYCODE_BUTTON_X, KeyEvent.KEYCODE_BUTTON_Y, KeyEvent.KEYCODE_BACK, - KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_BUTTON_MODE, KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_BUTTON_THUMBL, @@ -359,7 +360,6 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 { (1 << 2), // X -> X (1 << 3), // Y -> Y (1 << 4), // BACK -> BACK - (1 << 6), // MENU -> START (1 << 5), // MODE -> GUIDE (1 << 6), // START -> START (1 << 7), // THUMBL -> LEFTSTICK @@ -560,6 +560,8 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener { switch ( event.getSource() ) { case InputDevice.SOURCE_JOYSTICK: + case InputDevice.SOURCE_GAMEPAD: + case InputDevice.SOURCE_DPAD: return SDLControllerManager.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: @@ -689,6 +691,8 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 { switch ( event.getSource() ) { case InputDevice.SOURCE_JOYSTICK: + case InputDevice.SOURCE_GAMEPAD: + case InputDevice.SOURCE_DPAD: return SDLControllerManager.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: diff --git a/externals/SDL/android-project/app/build.gradle b/externals/SDL/android-project/app/build.gradle index baa0edc8d..8e59d9eb4 100755 --- a/externals/SDL/android-project/app/build.gradle +++ b/externals/SDL/android-project/app/build.gradle @@ -35,10 +35,6 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - applicationVariants.all { variant -> - tasks["merge${variant.name.capitalize()}Assets"] - .dependsOn("externalNativeBuild${variant.name.capitalize()}") - } if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { sourceSets.main { jniLibs.srcDir 'libs' diff --git a/externals/SDL/android-project/app/jni/src/Android.mk b/externals/SDL/android-project/app/jni/src/Android.mk index 04e006ae9..1adcb6e9a 100755 --- a/externals/SDL/android-project/app/jni/src/Android.mk +++ b/externals/SDL/android-project/app/jni/src/Android.mk @@ -13,6 +13,6 @@ LOCAL_SRC_FILES := YourSourceHere.c LOCAL_SHARED_LIBRARIES := SDL2 -LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid +LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog include $(BUILD_SHARED_LIBRARY) diff --git a/externals/SDL/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/externals/SDL/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index d2873ff6c..8641ccf80 100755 --- a/externals/SDL/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/externals/SDL/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -63,112 +63,6 @@ import java.util.Locale; */ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; -/* - // Display InputType.SOURCE/CLASS of events and devices - // - // SDLActivity.debugSource(device.getSources(), "device[" + device.getName() + "]"); - // SDLActivity.debugSource(event.getSource(), "event"); - public static void debugSource(int sources, String prefix) { - int s = sources; - int s_copy = sources; - String cls = ""; - String src = ""; - int tst = 0; - int FLAG_TAINTED = 0x80000000; - - if ((s & InputDevice.SOURCE_CLASS_BUTTON) != 0) cls += " BUTTON"; - if ((s & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) cls += " JOYSTICK"; - if ((s & InputDevice.SOURCE_CLASS_POINTER) != 0) cls += " POINTER"; - if ((s & InputDevice.SOURCE_CLASS_POSITION) != 0) cls += " POSITION"; - if ((s & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) cls += " TRACKBALL"; - - - int s2 = s_copy & ~InputDevice.SOURCE_ANY; // keep class bits - s2 &= ~( InputDevice.SOURCE_CLASS_BUTTON - | InputDevice.SOURCE_CLASS_JOYSTICK - | InputDevice.SOURCE_CLASS_POINTER - | InputDevice.SOURCE_CLASS_POSITION - | InputDevice.SOURCE_CLASS_TRACKBALL); - - if (s2 != 0) cls += "Some_Unkown"; - - s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class; - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - tst = InputDevice.SOURCE_BLUETOOTH_STYLUS; - if ((s & tst) == tst) src += " BLUETOOTH_STYLUS"; - s2 &= ~tst; - } - - tst = InputDevice.SOURCE_DPAD; - if ((s & tst) == tst) src += " DPAD"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_GAMEPAD; - if ((s & tst) == tst) src += " GAMEPAD"; - s2 &= ~tst; - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - tst = InputDevice.SOURCE_HDMI; - if ((s & tst) == tst) src += " HDMI"; - s2 &= ~tst; - } - - tst = InputDevice.SOURCE_JOYSTICK; - if ((s & tst) == tst) src += " JOYSTICK"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_KEYBOARD; - if ((s & tst) == tst) src += " KEYBOARD"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_MOUSE; - if ((s & tst) == tst) src += " MOUSE"; - s2 &= ~tst; - - if (Build.VERSION.SDK_INT >= 26) { - tst = InputDevice.SOURCE_MOUSE_RELATIVE; - if ((s & tst) == tst) src += " MOUSE_RELATIVE"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_ROTARY_ENCODER; - if ((s & tst) == tst) src += " ROTARY_ENCODER"; - s2 &= ~tst; - } - tst = InputDevice.SOURCE_STYLUS; - if ((s & tst) == tst) src += " STYLUS"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_TOUCHPAD; - if ((s & tst) == tst) src += " TOUCHPAD"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_TOUCHSCREEN; - if ((s & tst) == tst) src += " TOUCHSCREEN"; - s2 &= ~tst; - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - tst = InputDevice.SOURCE_TOUCH_NAVIGATION; - if ((s & tst) == tst) src += " TOUCH_NAVIGATION"; - s2 &= ~tst; - } - - tst = InputDevice.SOURCE_TRACKBALL; - if ((s & tst) == tst) src += " TRACKBALL"; - s2 &= ~tst; - - tst = InputDevice.SOURCE_ANY; - if ((s & tst) == tst) src += " ANY"; - s2 &= ~tst; - - if (s == FLAG_TAINTED) src += " FLAG_TAINTED"; - s2 &= ~FLAG_TAINTED; - - if (s2 != 0) src += " Some_Unkown"; - - Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src); - } -*/ public static boolean mIsResumedCalled, mHasFocus; public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24); @@ -1310,21 +1204,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh for (int id : ids) { InputDevice device = InputDevice.getDevice(id); - /* Allow SOURCE_TOUCHSCREEN and also Virtual InputDevices because they can send TOUCHSCREEN events */ - if (device != null && ((device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN - || device.isVirtual())) { - - int touchDevId = device.getId(); - /* - * Prevent id to be -1, since it's used in SDL internal for synthetic events - * Appears when using Android emulator, eg: - * adb shell input mouse tap 100 100 - * adb shell input touchscreen tap 100 100 - */ - if (touchDevId < 0) { - touchDevId -= 1; - } - nativeAddTouch(touchDevId, device.getName()); + if (device != null && (device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0) { + nativeAddTouch(device.getId(), device.getName()); } } } @@ -2014,7 +1895,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } - if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { + if ((source & InputDevice.SOURCE_KEYBOARD) != 0) { if (event.getAction() == KeyEvent.ACTION_DOWN) { if (SDLActivity.isTextInputEvent(event)) { SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); @@ -2027,7 +1908,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, } } - if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { + if ((source & InputDevice.SOURCE_MOUSE) != 0) { // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses // they are ignored here because sending them as mouse input to SDL is messy if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { diff --git a/externals/SDL/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/externals/SDL/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java index 82373d9d6..05e0f0cac 100755 --- a/externals/SDL/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java +++ b/externals/SDL/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java @@ -255,21 +255,23 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler { @Override public boolean handleMotionEvent(MotionEvent event) { - int actionPointerIndex = event.getActionIndex(); - int action = event.getActionMasked(); - if (action == MotionEvent.ACTION_MOVE) { - SDLJoystick joystick = getJoystick(event.getDeviceId()); - if (joystick != null) { - for (int i = 0; i < joystick.axes.size(); i++) { - InputDevice.MotionRange range = joystick.axes.get(i); - /* Normalize the value to -1...1 */ - float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f; - SDLControllerManager.onNativeJoy(joystick.device_id, i, value); - } - for (int i = 0; i < joystick.hats.size() / 2; i++) { - int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex)); - int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex)); - SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY); + if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) { + int actionPointerIndex = event.getActionIndex(); + int action = event.getActionMasked(); + if (action == MotionEvent.ACTION_MOVE) { + SDLJoystick joystick = getJoystick(event.getDeviceId()); + if (joystick != null) { + for (int i = 0; i < joystick.axes.size(); i++) { + InputDevice.MotionRange range = joystick.axes.get(i); + /* Normalize the value to -1...1 */ + float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f; + SDLControllerManager.onNativeJoy(joystick.device_id, i, value); + } + for (int i = 0; i < joystick.hats.size() / 2; i++) { + int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex)); + int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex)); + SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY); + } } } } @@ -317,7 +319,6 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 { KeyEvent.KEYCODE_BUTTON_X, KeyEvent.KEYCODE_BUTTON_Y, KeyEvent.KEYCODE_BACK, - KeyEvent.KEYCODE_MENU, KeyEvent.KEYCODE_BUTTON_MODE, KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_BUTTON_THUMBL, @@ -359,7 +360,6 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 { (1 << 2), // X -> X (1 << 3), // Y -> Y (1 << 4), // BACK -> BACK - (1 << 6), // MENU -> START (1 << 5), // MODE -> GUIDE (1 << 6), // START -> START (1 << 7), // THUMBL -> LEFTSTICK @@ -560,6 +560,8 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener { switch ( event.getSource() ) { case InputDevice.SOURCE_JOYSTICK: + case InputDevice.SOURCE_GAMEPAD: + case InputDevice.SOURCE_DPAD: return SDLControllerManager.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: @@ -689,6 +691,8 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 { switch ( event.getSource() ) { case InputDevice.SOURCE_JOYSTICK: + case InputDevice.SOURCE_GAMEPAD: + case InputDevice.SOURCE_DPAD: return SDLControllerManager.handleJoystickMotionEvent(event); case InputDevice.SOURCE_MOUSE: diff --git a/externals/SDL/autogen.sh b/externals/SDL/autogen.sh index dffcf4152..daf160de5 100755 --- a/externals/SDL/autogen.sh +++ b/externals/SDL/autogen.sh @@ -1,7 +1,5 @@ #!/bin/sh -set -e - echo "Generating build information using autoconf" echo "This may take a while ..." @@ -12,7 +10,11 @@ cd "$srcdir" # Regenerate configuration files cat acinclude/* >aclocal.m4 -"${AUTOCONF:-autoconf}" +if test "$AUTOCONF"x = x; then + AUTOCONF=autoconf +fi + +$AUTOCONF || exit 1 rm aclocal.m4 rm -rf autom4te.cache diff --git a/externals/SDL/build-scripts/androidbuildlibs.sh b/externals/SDL/build-scripts/androidbuildlibs.sh index dc7217293..3e57b4710 100755 --- a/externals/SDL/build-scripts/androidbuildlibs.sh +++ b/externals/SDL/build-scripts/androidbuildlibs.sh @@ -33,21 +33,22 @@ lib= ndk_args= # Allow an external caller to specify locations. -for arg in $*; do - if [ "${arg:0:8}" == "NDK_OUT=" ]; then - obj=${arg#NDK_OUT=} - elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then - lib=${arg#NDK_LIBS_OUT=} - else - ndk_args="$ndk_args $arg" - fi +for arg in $* +do + if [ "${arg:0:8}" == "NDK_OUT=" ]; then + obj=${arg#NDK_OUT=} + elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then + lib=${arg#NDK_LIBS_OUT=} + else + ndk_args="$ndk_args $arg" + fi done if [ -z $obj ]; then - obj=$buildandroid/obj + obj=$buildandroid/obj fi if [ -z $lib ]; then - lib=$buildandroid/lib + lib=$buildandroid/lib fi for dir in $build $buildandroid $obj $lib; do @@ -63,11 +64,11 @@ done # ndk-build makefile segments that use them, e.g., default-application.mk. # For consistency, pass all values on the command line. ndk-build \ - NDK_PROJECT_PATH=null \ - NDK_OUT=$obj \ - NDK_LIBS_OUT=$lib \ - APP_BUILD_SCRIPT=Android.mk \ - APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \ - APP_PLATFORM=android-16 \ - APP_MODULES="SDL2 SDL2_main" \ - $ndk_args + NDK_PROJECT_PATH=null \ + NDK_OUT=$obj \ + NDK_LIBS_OUT=$lib \ + APP_BUILD_SCRIPT=Android.mk \ + APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \ + APP_PLATFORM=android-16 \ + APP_MODULES="SDL2 SDL2_main" \ + $ndk_args diff --git a/externals/SDL/build-scripts/clang++-fat.sh b/externals/SDL/build-scripts/clang++-fat.sh index 41fdf1c33..d337109f9 100755 --- a/externals/SDL/build-scripts/clang++-fat.sh +++ b/externals/SDL/build-scripts/clang++-fat.sh @@ -6,11 +6,11 @@ DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" -# Intel 64-bit compiler flags (10.7 runtime compatibility) -CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.7 \ +# Intel 64-bit compiler flags (10.6 runtime compatibility) +CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.6 \ -I/usr/local/include" -CLANG_LINK_X64="-mmacosx-version-min=10.7" +CLANG_LINK_X64="-mmacosx-version-min=10.6" # ARM 64-bit compiler flags (11.0 runtime compatibility) CLANG_COMPILE_ARM64="clang++ -arch arm64 -mmacosx-version-min=11.0 \ diff --git a/externals/SDL/build-scripts/clang-fat.sh b/externals/SDL/build-scripts/clang-fat.sh index 4d1d30a6f..38c07275d 100755 --- a/externals/SDL/build-scripts/clang-fat.sh +++ b/externals/SDL/build-scripts/clang-fat.sh @@ -6,12 +6,12 @@ DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" -# Intel 64-bit compiler flags (10.7 runtime compatibility) -CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.7 \ --DMAC_OS_X_VERSION_MIN_REQUIRED=1070 \ +# Intel 64-bit compiler flags (10.6 runtime compatibility) +CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.6 \ +-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \ -I/usr/local/include" -CLANG_LINK_X64="-mmacosx-version-min=10.7" +CLANG_LINK_X64="-mmacosx-version-min=10.6" # ARM 64-bit compiler flags (11.0 runtime compatibility) CLANG_COMPILE_ARM64="clang -arch arm64 -mmacosx-version-min=11.0 \ diff --git a/externals/SDL/build-scripts/config.guess b/externals/SDL/build-scripts/config.guess index 1817bdce9..b7806a8cb 100755 --- a/externals/SDL/build-scripts/config.guess +++ b/externals/SDL/build-scripts/config.guess @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2022-05-25' +timestamp='2022-01-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -929,9 +929,6 @@ EOF i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; - *:SerenityOS:*:*) - GUESS=$UNAME_MACHINE-pc-serenity - ;; *:Interix*:*) case $UNAME_MACHINE in x86) @@ -1151,27 +1148,16 @@ EOF ;; x86_64:Linux:*:*) set_cc_for_build - CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then - ABI=64 - sed 's/^ //' << EOF > "$dummy.c" - #ifdef __i386__ - ABI=x86 - #else - #ifdef __ILP32__ - ABI=x32 - #endif - #endif -EOF - cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` - eval "$cc_set_abi" - case $ABI in - x86) CPU=i686 ;; - x32) LIBCABI=${LIBC}x32 ;; - esac + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI=${LIBC}x32 + fi fi - GUESS=$CPU-pc-linux-$LIBCABI + GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC @@ -1378,11 +1364,8 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; - ppc:Haiku:*:*) # Haiku running on Apple PowerPC - GUESS=powerpc-apple-haiku - ;; - *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) - GUESS=$UNAME_MACHINE-unknown-haiku + x86_64:Haiku:*:*) + GUESS=x86_64-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE diff --git a/externals/SDL/build-scripts/fnsince.pl b/externals/SDL/build-scripts/fnsince.pl index fde65c862..6c69c5473 100755 --- a/externals/SDL/build-scripts/fnsince.pl +++ b/externals/SDL/build-scripts/fnsince.pl @@ -46,15 +46,9 @@ my @releases = sort { # this happens to work for how SDL versions things at the moment. my $current_release = $releases[-1]; -my $next_release; - -if ($current_release eq '2.0.22') { # Hack for our jump from 2.0.22 to 2.24.0... - $next_release = '2.24.0'; -} else { - my @current_release_segments = split /\./, $current_release; - @current_release_segments[1] = '' . ($current_release_segments[1] + 2); - $next_release = join('.', @current_release_segments); -} +my @current_release_segments = split /\./, $current_release; +@current_release_segments[2] = '' . ($current_release_segments[2] + 2); +my $next_release = join('.', @current_release_segments); #print("\n\nSORTED\n"); #foreach (@releases) { diff --git a/externals/SDL/build-scripts/ltmain.sh b/externals/SDL/build-scripts/ltmain.sh index 70a3e8253..c10d13d89 100755 --- a/externals/SDL/build-scripts/ltmain.sh +++ b/externals/SDL/build-scripts/ltmain.sh @@ -7081,20 +7081,8 @@ func_mode_link () prev=xcompiler continue ;; - # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. - -pthread) - case $host in - *solaris2*) ;; - *) - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - ;; - esac - continue - ;; - -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" diff --git a/externals/SDL/build-scripts/os2-buildbot.sh b/externals/SDL/build-scripts/os2-buildbot.sh index e0a53c8d0..ff4b5f64b 100755 --- a/externals/SDL/build-scripts/os2-buildbot.sh +++ b/externals/SDL/build-scripts/os2-buildbot.sh @@ -12,7 +12,6 @@ if [ -z "$WATCOM" ]; then echo "This is often something like '/usr/local/share/watcom'" 1>&2 exit 1 fi - export PATH="$WATCOM/binl:$PATH" ZIPFILE="$1" @@ -31,8 +30,8 @@ rm -f $ZIPFILE wmake -f Makefile.os2 rm -rf $ZIPDIR mkdir -p $ZIPDIR -chmod a+r SDL2.lib SDL2.dll -mv SDL2.lib SDL2.dll $ZIPDIR/ +chmod 644 SDL2.dll SDL2.lib SDL2test.lib +mv SDL2.dll SDL2.lib SDL2test.lib $ZIPDIR/ cp -R include $ZIPDIR/ zip -9r "buildbot/$ZIPFILE" $ZIPDIR diff --git a/externals/SDL/build-scripts/update-copyright.sh b/externals/SDL/build-scripts/update-copyright.sh index c69ec7293..ea1f79875 100755 --- a/externals/SDL/build-scripts/update-copyright.sh +++ b/externals/SDL/build-scripts/update-copyright.sh @@ -1,7 +1,8 @@ #!/bin/sh -find . -type f -exec grep -Il "Copyright" {} \; \ -| grep -v \.git \ -| while read file; do \ - LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ +find . -type f -exec grep -Il "Copyright" {} \; \ +| grep -v \.git \ +| while read file; \ +do \ + LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ done diff --git a/externals/SDL/build-scripts/wikiheaders.pl b/externals/SDL/build-scripts/wikiheaders.pl index 4a6387c14..2be760cac 100755 --- a/externals/SDL/build-scripts/wikiheaders.pl +++ b/externals/SDL/build-scripts/wikiheaders.pl @@ -4,27 +4,10 @@ use warnings; use strict; use Text::Wrap; -$Text::Wrap::huge = 'overflow'; - -my $projectfullname = 'Simple Directmedia Layer'; -my $projectshortname = 'SDL'; -my $wikisubdir = ''; -my $incsubdir = 'include'; -my $apiprefixregex = undef; -my $versionfname = 'include/SDL_version.h'; -my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z'; -my $versionminorregex = '\A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z'; -my $versionpatchregex = '\A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z'; -my $mainincludefname = 'SDL.h'; -my $selectheaderregex = '\ASDL.*?\.h\Z'; -my $projecturl = 'https://libsdl.org/'; -my $wikiurl = 'https://wiki.libsdl.org'; -my $bugreporturl = 'https://github.com/libsdl-org/sdlwiki/issues/new'; my $srcpath = undef; my $wikipath = undef; my $warn_about_missing = 0; my $copy_direction = 0; -my $optionsfname = undef; foreach (@ARGV) { $warn_about_missing = 1, next if $_ eq '--warn-about-missing'; @@ -32,73 +15,14 @@ foreach (@ARGV) { $copy_direction = 1, next if $_ eq '--copy-to-header'; $copy_direction = -1, next if $_ eq '--copy-to-wiki'; $copy_direction = -2, next if $_ eq '--copy-to-manpages'; - if (/\A--options=(.*)\Z/) { - $optionsfname = $1; - next; - } $srcpath = $_, next if not defined $srcpath; $wikipath = $_, next if not defined $wikipath; } -my $default_optionsfname = '.wikiheaders-options'; -$default_optionsfname = "$srcpath/$default_optionsfname" if defined $srcpath; - -if ((not defined $optionsfname) && (-f $default_optionsfname)) { - $optionsfname = $default_optionsfname; -} - -if (defined $optionsfname) { - open OPTIONS, '<', $optionsfname or die("Failed to open options file '$optionsfname': $!\n"); - while () { - chomp; - if (/\A(.*?)\=(.*)\Z/) { - my $key = $1; - my $val = $2; - $key =~ s/\A\s+//; - $key =~ s/\s+\Z//; - $val =~ s/\A\s+//; - $val =~ s/\s+\Z//; - $warn_about_missing = int($val), next if $key eq 'warn_about_missing'; - $srcpath = $val, next if $key eq 'srcpath'; - $wikipath = $val, next if $key eq 'wikipath'; - $apiprefixregex = $val, next if $key eq 'apiprefixregex'; - $projectfullname = $val, next if $key eq 'projectfullname'; - $projectshortname = $val, next if $key eq 'projectshortname'; - $wikisubdir = $val, next if $key eq 'wikisubdir'; - $incsubdir = $val, next if $key eq 'incsubdir'; - $versionmajorregex = $val, next if $key eq 'versionmajorregex'; - $versionminorregex = $val, next if $key eq 'versionminorregex'; - $versionpatchregex = $val, next if $key eq 'versionpatchregex'; - $versionfname = $val, next if $key eq 'versionfname'; - $mainincludefname = $val, next if $key eq 'mainincludefname'; - $selectheaderregex = $val, next if $key eq 'selectheaderregex'; - $projecturl = $val, next if $key eq 'projecturl'; - $wikiurl = $val, next if $key eq 'wikiurl'; - $bugreporturl = $val, next if $key eq 'bugreporturl'; - } - } - close(OPTIONS); -} - my $wordwrap_mode = 'mediawiki'; sub wordwrap_atom { # don't call this directly. my $str = shift; - my $retval = ''; - - # wordwrap but leave links intact, even if they overflow. - if ($wordwrap_mode eq 'mediawiki') { - while ($str =~ s/(.*?)\s*(\[https?\:\/\/.*?\s+.*?\])\s*//ms) { - $retval .= fill('', '', $1); # wrap it. - $retval .= "\n$2\n"; # don't wrap it. - } - } elsif ($wordwrap_mode eq 'md') { - while ($str =~ s/(.*?)\s*(\[.*?\]\(https?\:\/\/.*?\))\s*//ms) { - $retval .= fill('', '', $1); # wrap it. - $retval .= "\n$2\n"; # don't wrap it. - } - } - - return $retval . fill('', '', $str); + return fill('', '', $str); } sub wordwrap_with_bullet_indent { # don't call this directly. @@ -218,23 +142,16 @@ sub wikify_chunk { while ($str =~ s/\A(.*?)\`(.*?)\`//ms) { my $codeblock = $2; $codedstr .= wikify_chunk($wikitype, $1, undef, undef); - if (defined $apiprefixregex) { - # Convert obvious API things to wikilinks, even inside `code` blocks. - $codeblock =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[[$1]]/gms; - } + # Convert obvious SDL things to wikilinks, even inside `code` blocks. + $codeblock =~ s/\b(SDL_[a-zA-Z0-9_]+)/[[$1]]/gms; $codedstr .= "$codeblock"; } - # Convert obvious API things to wikilinks. - if (defined $apiprefixregex) { - $str =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[[$1]]/gms; - } + # Convert obvious SDL things to wikilinks. + $str =~ s/\b(SDL_[a-zA-Z0-9_]+)/[[$1]]/gms; # Make some Markdown things into MediaWiki... - # links - $str =~ s/\[(.*?)\]\((https?\:\/\/.*?)\)/\[$2 $1\]/g; - # bold+italic $str =~ s/\*\*\*(.*?)\*\*\*/'''''$1'''''/gms; @@ -253,10 +170,8 @@ sub wikify_chunk { $str .= "$code<\/syntaxhighlight>"; } } elsif ($wikitype eq 'md') { - # Convert obvious API things to wikilinks. - if (defined $apiprefixregex) { - $str =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[$1]($1)/gms; - } + # Convert obvious SDL things to wikilinks. + $str =~ s/\b(SDL_[a-zA-Z0-9_]+)/[$1]($1)/gms; if (defined $code) { $str .= "```$codelang$code```"; } @@ -301,13 +216,7 @@ sub dewikify_chunk { # Doxygen supports Markdown (and it just simply looks better than MediaWiki # when looking at the raw headers), so do some conversions here as necessary. - # Dump obvious wikilinks. - if (defined $apiprefixregex) { - $str =~ s/\[\[($apiprefixregex[a-zA-Z0-9_]+)\]\]/$1/gms; - } - - # links - $str =~ s/\[(https?\:\/\/.*?)\s+(.*?)\]/\[$2\]\($1\)/g; + $str =~ s/\[\[(SDL_[a-zA-Z0-9_]+)\]\]/$1/gms; # Dump obvious wikilinks. # is also popular. :/ $str =~ s/\(.*?)<\/code>/`$1`/gms; @@ -331,13 +240,7 @@ sub dewikify_chunk { } elsif ($dewikify_mode eq 'manpage') { $str =~ s/\./\\[char46]/gms; # make sure these can't become control codes. if ($wikitype eq 'mediawiki') { - # Dump obvious wikilinks. - if (defined $apiprefixregex) { - $str =~ s/\s*\[\[($apiprefixregex[a-zA-Z0-9_]+)\]\]\s*/\n.BR $1\n/gms; - } - - # links - $str =~ s/\[(https?\:\/\/.*?)\s+(.*?)\]/\n.URL "$1" "$2"\n/g; + $str =~ s/\s*\[\[(SDL_[a-zA-Z0-9_]+)\]\]\s*/\n.BR $1\n/gms; # Dump obvious wikilinks. # is also popular. :/ $str =~ s/\s*\(.*?)<\/code>\s*/\n.BR $1\n/gms; @@ -433,13 +336,11 @@ my %headerfuncslocation = (); # $headerfuncslocation{"SDL_OpenAudio"} -> name my %headerfuncschunk = (); # $headerfuncschunk{"SDL_OpenAudio"} -> offset in array in %headers that should be replaced for this function. my %headerfuncshasdoxygen = (); # $headerfuncschunk{"SDL_OpenAudio"} -> 1 if there was no existing doxygen for this function. -my $incpath = "$srcpath"; -$incpath .= "/$incsubdir" if $incsubdir ne ''; - +my $incpath = "$srcpath/include"; opendir(DH, $incpath) or die("Can't opendir '$incpath': $!\n"); while (readdir(DH)) { my $dent = $_; - next if not $dent =~ /$selectheaderregex/; # just selected headers. + next if not $dent =~ /\ASDL.*?\.h\Z/; # just SDL*.h headers. open(FH, '<', "$incpath/$dent") or die("Can't open '$incpath/$dent': $!\n"); my @contents = (); @@ -589,7 +490,7 @@ opendir(DH, $wikipath) or die("Can't opendir '$wikipath': $!\n"); while (readdir(DH)) { my $dent = $_; my $type = ''; - if ($dent =~ /\.(md|mediawiki)\Z/) { + if ($dent =~ /\ASDL.*?\.(md|mediawiki)\Z/) { $type = $1; } else { next; # only dealing with wiki pages. @@ -817,7 +718,6 @@ if ($copy_direction == 1) { # --copy-to-headers foreach (@desclines) { s/\A(\:|\* )//; s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func" - s/\A\/*//; $str .= "\\sa $_\n"; } } @@ -1026,7 +926,7 @@ if ($copy_direction == 1) { # --copy-to-headers if ($wikitype eq 'mediawiki') { $sections{'Related Functions'} .= ":[[$sa]]\n"; } elsif ($wikitype eq 'md') { - $sections{'Related Functions'} .= "* [$sa]($sa)\n"; + $sections{'Related Functions'} .= "* [$sa](/$sa)\n"; } else { die("Expected wikitype '$wikitype'\n"); } } } @@ -1176,23 +1076,22 @@ if ($copy_direction == 1) { # --copy-to-headers my $gitrev = `cd "$srcpath" ; git rev-list HEAD~..`; chomp($gitrev); - # !!! FIXME - open(FH, '<', "$srcpath/$versionfname") or die("Can't open '$srcpath/$versionfname': $!\n"); + open(FH, '<', "$srcpath/include/SDL_version.h") or die("Can't open '$srcpath/include/SDL_version.h': $!\n"); my $majorver = 0; my $minorver = 0; my $patchver = 0; while () { chomp; - if (/$versionmajorregex/) { + if (/\A\#define SDL_MAJOR_VERSION\s+(\d+)\Z/) { $majorver = int($1); - } elsif (/$versionminorregex/) { + } elsif (/\A\#define SDL_MINOR_VERSION\s+(\d+)\Z/) { $minorver = int($1); - } elsif (/$versionpatchregex/) { + } elsif (/\A\#define SDL_PATCHLEVEL\s+(\d+)\Z/) { $patchver = int($1); } } close(FH); - my $fullversion = "$majorver.$minorver.$patchver"; + my $sdlversion = "$majorver.$minorver.$patchver"; foreach (keys %headerfuncs) { my $fn = $_; @@ -1227,24 +1126,17 @@ if ($copy_direction == 1) { # --copy-to-headers $str .= ".\\\" This manpage content is licensed under Creative Commons\n"; $str .= ".\\\" Attribution 4.0 International (CC BY 4.0)\n"; $str .= ".\\\" https://creativecommons.org/licenses/by/4.0/\n"; - $str .= ".\\\" This manpage was generated from ${projectshortname}'s wiki page for $fn:\n"; - $str .= ".\\\" $wikiurl/$fn\n"; + $str .= ".\\\" This manpage was generated from SDL's wiki page for $fn:\n"; + $str .= ".\\\" https://wiki.libsdl.org/$fn\n"; $str .= ".\\\" Generated with SDL/build-scripts/wikiheaders.pl\n"; $str .= ".\\\" revision $gitrev\n" if $gitrev ne ''; $str .= ".\\\" Please report issues in this manpage's content at:\n"; - $str .= ".\\\" $bugreporturl\n"; + $str .= ".\\\" https://github.com/libsdl-org/sdlwiki/issues/new?title=Feedback%20on%20page%20$fn\n"; $str .= ".\\\" Please report issues in the generation of this manpage from the wiki at:\n"; $str .= ".\\\" https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20$fn\n"; - $str .= ".\\\" $projectshortname can be found at $projecturl\n"; + $str .= ".\\\" SDL can be found at https://libsdl.org/\n"; - # Define a .URL macro. The "www.tmac" thing decides if we're using GNU roff (which has a .URL macro already), and if so, overrides the macro we just created. - # This wizadry is from https://web.archive.org/web/20060102165607/http://people.debian.org/~branden/talks/wtfm/wtfm.pdf - $str .= ".de URL\n"; - $str .= '\\$2 \(laURL: \\$1 \(ra\\$3' . "\n"; - $str .= "..\n"; - $str .= '.if \n[.g] .mso www.tmac' . "\n"; - - $str .= ".TH $fn 3 \"$projectshortname $fullversion\" \"$projectfullname\" \"$projectshortname$majorver FUNCTIONS\"\n"; + $str .= ".TH $fn 3 \"SDL $sdlversion\" \"Simple Directmedia Layer\" \"SDL$majorver FUNCTIONS\"\n"; $str .= ".SH NAME\n"; $str .= "$fn"; @@ -1253,7 +1145,7 @@ if ($copy_direction == 1) { # --copy-to-headers $str .= ".SH SYNOPSIS\n"; $str .= ".nf\n"; - $str .= ".B #include \\(dq$mainincludefname\\(dq\n"; + $str .= ".B #include \\(dqSDL.h\\(dq\n"; $str .= ".PP\n"; my @decllines = split /\n/, $decl; @@ -1324,7 +1216,6 @@ if ($copy_direction == 1) { # --copy-to-headers foreach (@desclines) { s/\A(\:|\* )//; s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func" - s/\A\/*//; s/\A\.BR\s+//; # dewikify added this, but we want to handle it. s/\A\s+//; s/\s+\Z//; @@ -1343,14 +1234,14 @@ if ($copy_direction == 1) { # --copy-to-headers $str .= ".UE\n"; $str .= ".PP\n"; $str .= "This manpage was generated from\n"; - $str .= ".UR $wikiurl/$fn\n"; - $str .= "${projectshortname}'s wiki\n"; + $str .= ".UR https://wiki.libsdl.org/$fn\n"; + $str .= "SDL's wiki\n"; $str .= ".UE\n"; $str .= "using SDL/build-scripts/wikiheaders.pl"; $str .= " revision $gitrev" if $gitrev ne ''; $str .= ".\n"; $str .= "Please report issues in this manpage at\n"; - $str .= ".UR $bugreporturl\n"; + $str .= ".UR https://github.com/libsdl-org/sdlwiki/issues/new\n"; $str .= "our bugtracker!\n"; $str .= ".UE\n"; } diff --git a/externals/SDL/build-scripts/winrtbuild.ps1 b/externals/SDL/build-scripts/winrtbuild.ps1 index 1b4a223bd..edaf383e1 100755 --- a/externals/SDL/build-scripts/winrtbuild.ps1 +++ b/externals/SDL/build-scripts/winrtbuild.ps1 @@ -39,7 +39,7 @@ # # Base version of SDL, used for packaging purposes -$SDLVersion = "2.23.1" +$SDLVersion = "2.0.20" # Gets the .bat file that sets up an MSBuild environment, given one of # Visual Studio's, "PlatformToolset"s. diff --git a/externals/SDL/cmake/macros.cmake b/externals/SDL/cmake/macros.cmake index af7512257..84cb4c6dc 100755 --- a/externals/SDL/cmake/macros.cmake +++ b/externals/SDL/cmake/macros.cmake @@ -17,8 +17,8 @@ macro(SET_OPTION _NAME _DESC) endmacro() macro(DEP_OPTION _NAME _DESC _DEFLT _DEPTEST _FAILDFLT) - add_to_alloptions("${_NAME}") - cmake_dependent_option("${_NAME}" "${_DESC}" "${_DEFLT}" "${_DEPTEST}" "${_FAILDFLT}") + add_to_alloptions(${_NAME}) + cmake_dependent_option(${_NAME} ${_DESC} ${_DEFLT} ${_DEPTEST} ${_FAILDFLT}) endmacro() macro(OPTION_STRING _NAME _DESC _VALUE) @@ -92,19 +92,12 @@ macro(LISTTOSTRREV _LIST _OUTPUT) endforeach() endmacro() -if(${CMAKE_VERSION} VERSION_LESS "3.16.0") - macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR) - set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}") - set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}") - CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR}) - set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}") - endmacro() -else() - include(CheckOBJCSourceCompiles) - if (APPLE) - enable_language(OBJC) - endif() -endif() +macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR) + set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}") + CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR}) + set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}") +endmacro() if(CMAKE_VERSION VERSION_LESS 3.13.0) macro(target_link_directories _TARGET _SCOPE) diff --git a/externals/SDL/cmake/sdlchecks.cmake b/externals/SDL/cmake/sdlchecks.cmake index 57962e6c8..a5c0ec1a9 100755 --- a/externals/SDL/cmake/sdlchecks.cmake +++ b/externals/SDL/cmake/sdlchecks.cmake @@ -48,7 +48,6 @@ macro(CheckDLOPEN) int main(int argc, char **argv) { void *handle = dlopen(\"\", RTLD_NOW); const char *loaderror = (char *) dlerror(); - return 0; }" HAVE_DLOPEN) set(CMAKE_REQUIRED_LIBRARIES) endif() @@ -58,7 +57,8 @@ macro(CheckO_CLOEXEC) check_c_source_compiles(" #include int flag = O_CLOEXEC; - int main(int argc, char **argv) { return 0; }" HAVE_O_CLOEXEC) + int main(void) { + }" HAVE_O_CLOEXEC) endmacro() # Requires: @@ -68,12 +68,12 @@ macro(CheckOSS) set(OSS_HEADER_FILE "sys/soundcard.h") check_c_source_compiles(" #include - int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" OSS_FOUND) + int main() { int arg = SNDCTL_DSP_SETFRAGMENT; }" OSS_FOUND) if(NOT OSS_FOUND) set(OSS_HEADER_FILE "soundcard.h") check_c_source_compiles(" #include - int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" OSS_FOUND) + int main() { int arg = SNDCTL_DSP_SETFRAGMENT; }" OSS_FOUND) endif() if(OSS_FOUND) @@ -83,7 +83,7 @@ macro(CheckOSS) set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1) endif() set(SDL_AUDIO_DRIVER_OSS 1) - list(APPEND SOURCE_FILES ${OSS_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${OSS_SOURCES}) if(NETBSD OR OPENBSD) list(APPEND EXTRA_LIBS ossaudio) endif() @@ -106,13 +106,13 @@ macro(CheckALSA) if(HAVE_LIBASOUND) set(HAVE_ALSA TRUE) file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c) - list(APPEND SOURCE_FILES ${ALSA_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES}) set(SDL_AUDIO_DRIVER_ALSA 1) if(SDL_ALSA_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading") endif() - FindLibraryAndSONAME("asound") - if(SDL_ALSA_SHARED AND ASOUND_LIB AND HAVE_SDL_LOADSO) + if(SDL_ALSA_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("asound") set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"") set(HAVE_ALSA_SHARED TRUE) else() @@ -134,14 +134,14 @@ macro(CheckPipewire) if(PKG_PIPEWIRE_FOUND) set(HAVE_PIPEWIRE TRUE) file(GLOB PIPEWIRE_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pipewire/*.c) - list(APPEND SOURCE_FILES ${PIPEWIRE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PIPEWIRE_SOURCES}) set(SDL_AUDIO_DRIVER_PIPEWIRE 1) list(APPEND EXTRA_CFLAGS ${PKG_PIPEWIRE_CFLAGS}) if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading") endif() - FindLibraryAndSONAME("pipewire-0.3") - if(SDL_PIPEWIRE_SHARED AND PIPEWIRE_0.3_LIB AND HAVE_SDL_LOADSO) + if(SDL_PIPEWIRE_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("pipewire-0.3") set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"") set(HAVE_PIPEWIRE_SHARED TRUE) else() @@ -163,18 +163,18 @@ macro(CheckPulseAudio) if(PKG_PULSEAUDIO_FOUND) set(HAVE_PULSEAUDIO TRUE) file(GLOB PULSEAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pulseaudio/*.c) - list(APPEND SOURCE_FILES ${PULSEAUDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${PULSEAUDIO_SOURCES}) set(SDL_AUDIO_DRIVER_PULSEAUDIO 1) list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS}) if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading") endif() - FindLibraryAndSONAME("pulse-simple") - if(SDL_PULSEAUDIO_SHARED AND PULSE_SIMPLE_LIB AND HAVE_SDL_LOADSO) + if(SDL_PULSEAUDIO_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("pulse-simple") set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"") set(HAVE_PULSEAUDIO_SHARED TRUE) else() - list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS}) + list(APPEND EXTRA_LDFLAGS ${PKG_sPULSEAUDIO_LDFLAGS}) endif() set(HAVE_SDL_AUDIO TRUE) endif() @@ -192,14 +192,14 @@ macro(CheckJACK) if(PKG_JACK_FOUND) set(HAVE_JACK TRUE) file(GLOB JACK_SOURCES ${SDL2_SOURCE_DIR}/src/audio/jack/*.c) - list(APPEND SOURCE_FILES ${JACK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${JACK_SOURCES}) set(SDL_AUDIO_DRIVER_JACK 1) list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") endif() - FindLibraryAndSONAME("jack") - if(SDL_JACK_SHARED AND JACK_LIB AND HAVE_SDL_LOADSO) + if(SDL_JACK_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("jack") set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") set(HAVE_JACK_SHARED TRUE) else() @@ -221,14 +221,14 @@ macro(CheckESD) if(PKG_ESD_FOUND) set(HAVE_ESD TRUE) file(GLOB ESD_SOURCES ${SDL2_SOURCE_DIR}/src/audio/esd/*.c) - list(APPEND SOURCE_FILES ${ESD_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ESD_SOURCES}) set(SDL_AUDIO_DRIVER_ESD 1) list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS}) if(SDL_ESD_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic ESD loading") endif() - FindLibraryAndSONAME(esd) - if(SDL_ESD_SHARED AND ESD_LIB AND HAVE_SDL_LOADSO) + if(SDL_ESD_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME(esd) set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"") set(HAVE_ESD_SHARED TRUE) else() @@ -254,15 +254,15 @@ macro(CheckARTS) execute_process(CMD_ARTSLIBS ${ARTS_CONFIG} --libs OUTPUT_VARIABLE ARTS_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE) file(GLOB ARTS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/arts/*.c) - list(APPEND SOURCE_FILES ${ARTS_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ARTS_SOURCES}) set(SDL_AUDIO_DRIVER_ARTS 1) set(HAVE_ARTS TRUE) if(SDL_ARTS_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading") endif() - FindLibraryAndSONAME(artsc) - if(SDL_ARTS_SHARED AND ARTSC_LIB AND HAVE_SDL_LOADSO) + if(SDL_ARTS_SHARED AND HAVE_SDL_LOADSO) # TODO + FindLibraryAndSONAME(artsc) set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"") set(HAVE_ARTS_SHARED TRUE) else() @@ -286,13 +286,13 @@ macro(CheckNAS) if(HAVE_NAS_H AND D_NAS_LIB) set(HAVE_NAS TRUE) file(GLOB NAS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/nas/*.c) - list(APPEND SOURCE_FILES ${NAS_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${NAS_SOURCES}) set(SDL_AUDIO_DRIVER_NAS 1) if(SDL_NAS_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic NAS loading") endif() - FindLibraryAndSONAME("audio") - if(SDL_NAS_SHARED AND AUDIO_LIB AND HAVE_SDL_LOADSO) + if(SDL_NAS_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("audio") set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"") set(HAVE_NAS_SHARED TRUE) else() @@ -316,13 +316,13 @@ macro(CheckSNDIO) if(HAVE_SNDIO_H AND D_SNDIO_LIB) set(HAVE_SNDIO TRUE) file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c) - list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES}) set(SDL_AUDIO_DRIVER_SNDIO 1) if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic sndio loading") endif() - FindLibraryAndSONAME("sndio") - if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO) + if(SDL_SNDIO_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("sndio") set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"") set(HAVE_SNDIO_SHARED TRUE) else() @@ -344,14 +344,14 @@ macro(CheckFusionSound) if(PKG_FUSIONSOUND_FOUND) set(HAVE_FUSIONSOUND TRUE) file(GLOB FUSIONSOUND_SOURCES ${SDL2_SOURCE_DIR}/src/audio/fusionsound/*.c) - list(APPEND SOURCE_FILES ${FUSIONSOUND_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${FUSIONSOUND_SOURCES}) set(SDL_AUDIO_DRIVER_FUSIONSOUND 1) list(APPEND EXTRA_CFLAGS ${PKG_FUSIONSOUND_CFLAGS}) if(FUSIONSOUND_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading") endif() - FindLibraryAndSONAME("fusionsound") - if(FUSIONSOUND_SHARED AND FUSIONSOUND_LIB AND HAVE_SDL_LOADSO) + if(FUSIONSOUND_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("fusionsound") set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"") set(HAVE_FUSIONSOUND_SHARED TRUE) else() @@ -375,8 +375,8 @@ macro(CheckLibSampleRate) if(SDL_LIBSAMPLERATE_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") endif() - FindLibraryAndSONAME("samplerate") - if(SDL_LIBSAMPLERATE_SHARED AND SAMPLERATE_LIB AND HAVE_SDL_LOADSO) + if(SDL_LIBSAMPLERATE_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("samplerate") set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"") set(HAVE_LIBSAMPLERATE_SHARED TRUE) else() @@ -393,7 +393,7 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckX11) if(SDL_X11) - foreach(_LIB X11 Xext Xcursor Xi Xfixes Xrandr Xrender Xss) + foreach(_LIB X11 Xext Xcursor Xinerama Xi Xfixes Xrandr Xrender Xss Xxf86vm) FindLibraryAndSONAME("${_LIB}") endforeach() @@ -415,6 +415,7 @@ macro(CheckX11) endif() check_include_file(X11/Xcursor/Xcursor.h HAVE_XCURSOR_H) + check_include_file(X11/extensions/Xinerama.h HAVE_XINERAMA_H) check_include_file(X11/extensions/XInput2.h HAVE_XINPUT2_H) check_include_file(X11/extensions/Xrandr.h HAVE_XRANDR_H) check_include_file(X11/extensions/Xfixes.h HAVE_XFIXES_H_) @@ -422,6 +423,7 @@ macro(CheckX11) check_include_file(X11/extensions/scrnsaver.h HAVE_XSS_H) check_include_file(X11/extensions/shape.h HAVE_XSHAPE_H) check_include_files("X11/Xlib.h;X11/extensions/Xdbe.h" HAVE_XDBE_H) + check_include_files("X11/Xlib.h;X11/extensions/xf86vmode.h" HAVE_XF86VM_H) check_include_files("X11/Xlib.h;X11/Xproto.h;X11/extensions/Xext.h" HAVE_XEXT_H) if(X11_LIB) @@ -433,7 +435,7 @@ macro(CheckX11) set(HAVE_SDL_VIDEO TRUE) file(GLOB X11_SOURCES ${SDL2_SOURCE_DIR}/src/video/x11/*.c) - list(APPEND SOURCE_FILES ${X11_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${X11_SOURCES}) set(SDL_VIDEO_DRIVER_X11 1) # !!! FIXME: why is this disabled for Apple? @@ -459,14 +461,12 @@ macro(CheckX11) else() set(HAVE_X11_SHARED TRUE) endif() - if(HAVE_X11_SHARED AND X11_LIB AND XEXT_LIB) + if(HAVE_X11_SHARED) set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"") else() list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB}) endif() - else() - list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB}) endif() set(CMAKE_REQUIRED_LIBRARIES ${X11_LIB} ${X11_LIB}) @@ -479,8 +479,7 @@ macro(CheckX11) XGenericEventCookie *cookie = &event.xcookie; XNextEvent(display, &event); XGetEventData(display, cookie); - XFreeEventData(display, cookie); - return 0; }" HAVE_XGENERICEVENT) + XFreeEventData(display, cookie); }" HAVE_XGENERICEVENT) if(HAVE_XGENERICEVENT) set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1) endif() @@ -502,6 +501,16 @@ macro(CheckX11) set(SDL_VIDEO_DRIVER_X11_XDBE 1) endif() + if(SDL_X11_XINERAMA AND HAVE_XINERAMA_H) + set(HAVE_X11_XINERAMA TRUE) + if(HAVE_X11_SHARED AND XINERAMA_LIB) + set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "\"${XINERAMA_LIB_SONAME}\"") + else() + list(APPEND EXTRA_LIBS ${XINERAMA_LIB}) + endif() + set(SDL_VIDEO_DRIVER_X11_XINERAMA 1) + endif() + if(SDL_X11_XINPUT AND HAVE_XINPUT2_H) set(HAVE_X11_XINPUT TRUE) if(HAVE_X11_SHARED AND XI_LIB) @@ -518,10 +527,11 @@ macro(CheckX11) #include int event_type = XI_TouchBegin; XITouchClassInfo *t; - Status XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f) { + Status XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f) + { return (Status)0; } - int main(int argc, char **argv) { return 0; }" HAVE_XINPUT2_MULTITOUCH) + int main(int argc, char **argv) {}" HAVE_XINPUT2_MULTITOUCH) if(HAVE_XINPUT2_MULTITOUCH) set(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1) endif() @@ -535,7 +545,7 @@ macro(CheckX11) #include #include BarrierEventID b; - int main(int argc, char **argv) { return 0; }" HAVE_XFIXES_H) + int main(void) { }" HAVE_XFIXES_H) endif() if(SDL_X11_XFIXES AND HAVE_XFIXES_H AND HAVE_XINPUT2_H) if(HAVE_X11_SHARED AND XFIXES_LIB) @@ -572,6 +582,16 @@ macro(CheckX11) set(HAVE_X11_XSHAPE TRUE) endif() + if(SDL_X11_XVM AND HAVE_XF86VM_H) + if(HAVE_X11_SHARED AND XXF86VM_LIB) + set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "\"${XXF86VM_LIB_SONAME}\"") + else() + list(APPEND EXTRA_LIBS ${XXF86VM_LIB}) + endif() + set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1) + set(HAVE_X11_XVM TRUE) + endif() + set(CMAKE_REQUIRED_LIBRARIES) endif() endif() @@ -599,7 +619,7 @@ macro(WaylandProtocolGen _SCANNER _CODE_MODE _XML _PROTL) ARGS "${_CODE_MODE}" "${_XML}" "${_WAYLAND_PROT_C_CODE}" ) - list(APPEND SOURCE_FILES "${_WAYLAND_PROT_C_CODE}") + set(SOURCE_FILES ${SOURCE_FILES} "${_WAYLAND_PROT_C_CODE}") endmacro() # Requires: @@ -610,7 +630,7 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckWayland) if(SDL_WAYLAND) - pkg_check_modules(WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") + pkg_check_modules(WAYLAND wayland-client wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") if(WAYLAND_FOUND) find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED) @@ -642,7 +662,7 @@ macro(CheckWayland) set(HAVE_SDL_VIDEO TRUE) file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c) - list(APPEND SOURCE_FILES ${WAYLAND_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES}) # We have to generate some protocol interface code for some unstable Wayland features. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") @@ -662,18 +682,18 @@ macro(CheckWayland) if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading") endif() - FindLibraryAndSONAME(wayland-client) - FindLibraryAndSONAME(wayland-egl) - FindLibraryAndSONAME(wayland-cursor) - FindLibraryAndSONAME(xkbcommon) - if(SDL_WAYLAND_SHARED AND WAYLAND_CLIENT_LIB AND WAYLAND_EGL_LIB AND WAYLAND_CURSOR_LIB AND XKBCOMMON_LIB AND HAVE_SDL_LOADSO) + if(SDL_WAYLAND_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME(wayland-client) + FindLibraryAndSONAME(wayland-egl) + FindLibraryAndSONAME(wayland-cursor) + FindLibraryAndSONAME(xkbcommon) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "\"${WAYLAND_CURSOR_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"") set(HAVE_WAYLAND_SHARED TRUE) else() - list(APPEND EXTRA_LIBS ${WAYLAND_LIBRARIES}) + set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS}) endif() if(SDL_WAYLAND_LIBDECOR) @@ -686,12 +706,12 @@ macro(CheckWayland) if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading") endif() - FindLibraryAndSONAME(decor-0) - if(SDL_WAYLAND_LIBDECOR_SHARED AND DECOR_0_LIB AND HAVE_SDL_LOADSO) + if(SDL_WAYLAND_LIBDECOR_SHARED AND HAVE_SDL_LOADSO) set(HAVE_LIBDECOR_SHARED TRUE) + FindLibraryAndSONAME(decor-0) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"") else() - list(APPEND EXTRA_LIBS ${LIBDECOR_LIBRARIES}) + set(EXTRA_LIBS ${LIBDECOR_LIBRARIES} ${EXTRA_LIBS}) endif() endif() endif() @@ -711,7 +731,8 @@ macro(CheckCOCOA) endif() if(HAVE_COCOA) file(GLOB COCOA_SOURCES ${SDL2_SOURCE_DIR}/src/video/cocoa/*.m) - list(APPEND SOURCE_FILES ${COCOA_SOURCES}) + set_source_files_properties(${COCOA_SOURCES} PROPERTIES LANGUAGE C) + set(SOURCE_FILES ${SOURCE_FILES} ${COCOA_SOURCES}) set(SDL_VIDEO_DRIVER_COCOA 1) set(HAVE_SDL_VIDEO TRUE) endif() @@ -729,16 +750,15 @@ macro(CheckDirectFB) if(PKG_DIRECTFB_FOUND) set(HAVE_DIRECTFB TRUE) file(GLOB DIRECTFB_SOURCES ${SDL2_SOURCE_DIR}/src/video/directfb/*.c) - list(APPEND SOURCE_FILES ${DIRECTFB_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${DIRECTFB_SOURCES}) set(SDL_VIDEO_DRIVER_DIRECTFB 1) set(SDL_VIDEO_RENDER_DIRECTFB 1) list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS}) - list(APPEND SDL_CFLAGS ${PKG_DIRECTFB_CFLAGS}) if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading") endif() - FindLibraryAndSONAME("directfb") - if(SDL_DIRECTFB_SHARED AND DIRECTFB_LIB AND HAVE_SDL_LOADSO) + if(SDL_DIRECTFB_SHARED AND HAVE_SDL_LOADSO) + FindLibraryAndSONAME("directfb") set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"") set(HAVE_DIRECTFB_SHARED TRUE) else() @@ -755,26 +775,24 @@ macro(CheckVivante) if(SDL_VIVANTE) check_c_source_compiles(" #include - int main(int argc, char** argv) { return 0; }" HAVE_VIVANTE_VDK) + int main(int argc, char** argv) {}" HAVE_VIVANTE_VDK) check_c_source_compiles(" #define LINUX #define EGL_API_FB #include - int main(int argc, char** argv) { return 0; }" HAVE_VIVANTE_EGL_FB) + int main(int argc, char** argv) {}" HAVE_VIVANTE_EGL_FB) if(HAVE_VIVANTE_VDK OR HAVE_VIVANTE_EGL_FB) set(HAVE_VIVANTE TRUE) set(HAVE_SDL_VIDEO TRUE) file(GLOB VIVANTE_SOURCES ${SDL2_SOURCE_DIR}/src/video/vivante/*.c) - list(APPEND SOURCE_FILES ${VIVANTE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VIVANTE_SOURCES}) set(SDL_VIDEO_DRIVER_VIVANTE 1) if(HAVE_VIVANTE_VDK) set(SDL_VIDEO_DRIVER_VIVANTE_VDK 1) - find_library(VIVANTE_LIBRARY REQUIRED NAMES VIVANTE vivante drm_vivante) - find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED) - list(APPEND EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY}) + list(APPEND EXTRA_LIBS VDK VIVANTE) else() - list(APPEND SDL_CFLAGS -DLINUX -DEGL_API_FB) + set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB") list(APPEND EXTRA_LIBS EGL) endif(HAVE_VIVANTE_VDK) endif() @@ -787,7 +805,7 @@ macro(CheckGLX) if(SDL_OPENGL) check_c_source_compiles(" #include - int main(int argc, char** argv) { return 0; }" HAVE_OPENGL_GLX) + int main(int argc, char** argv) {}" HAVE_OPENGL_GLX) if(HAVE_OPENGL_GLX) set(SDL_VIDEO_OPENGL_GLX 1) endif() @@ -799,14 +817,15 @@ endmacro() macro(CheckEGL) if (SDL_OPENGL OR SDL_OPENGLES) pkg_check_modules(EGL egl) - set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${EGL_CFLAGS}") + string(REPLACE "-D_THREAD_SAFE;" "-D_THREAD_SAFE=1;" EGL_CFLAGS "${EGL_CFLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS}") check_c_source_compiles(" #define EGL_API_FB #define MESA_EGL_NO_X11_HEADERS #define EGL_NO_X11 #include #include - int main (int argc, char** argv) { return 0; }" HAVE_OPENGL_EGL) + int main (int argc, char** argv) {}" HAVE_OPENGL_EGL) if(HAVE_OPENGL_EGL) set(SDL_VIDEO_OPENGL_EGL 1) endif() @@ -820,7 +839,7 @@ macro(CheckOpenGL) check_c_source_compiles(" #include #include - int main(int argc, char** argv) { return 0; }" HAVE_OPENGL) + int main(int argc, char** argv) {}" HAVE_OPENGL) if(HAVE_OPENGL) set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_RENDER_OGL 1) @@ -835,7 +854,7 @@ macro(CheckOpenGLES) check_c_source_compiles(" #include #include - int main (int argc, char** argv) { return 0; }" HAVE_OPENGLES_V1) + int main (int argc, char** argv) {}" HAVE_OPENGLES_V1) if(HAVE_OPENGLES_V1) set(HAVE_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES 1) @@ -844,7 +863,7 @@ macro(CheckOpenGLES) check_c_source_compiles(" #include #include - int main (int argc, char** argv) { return 0; }" HAVE_OPENGLES_V2) + int main (int argc, char** argv) {}" HAVE_OPENGLES_V2) if(HAVE_OPENGLES_V2) set(HAVE_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES2 1) @@ -922,7 +941,8 @@ macro(CheckPTHREAD) set(SDL_THREAD_PTHREAD 1) list(APPEND EXTRA_CFLAGS ${PTHREAD_CFLAGS}) list(APPEND EXTRA_LDFLAGS ${PTHREAD_LDFLAGS}) - list(APPEND SDL_CFLAGS ${PTHREAD_CFLAGS}) + set(SDL_CFLAGS "${SDL_CFLAGS} ${PTHREAD_CFLAGS}") + list(APPEND SDL_LIBS ${PTHREAD_LDFLAGS}) check_c_source_compiles(" #define _GNU_SOURCE 1 @@ -1127,7 +1147,7 @@ macro(CheckUSBHID) endif() set(SDL_JOYSTICK_USBHID 1) file(GLOB BSD_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/bsd/*.c) - list(APPEND SOURCE_FILES ${BSD_JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${BSD_JOYSTICK_SOURCES}) list(APPEND EXTRA_CFLAGS ${USB_CFLAGS}) list(APPEND EXTRA_LIBS ${USB_LIBS}) set(HAVE_SDL_JOYSTICK TRUE) @@ -1150,14 +1170,10 @@ macro(CheckHIDAPI) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}") if(HIDAPI_ONLY_LIBUSB) list(APPEND EXTRA_LIBS ${LIBUSB_LIBS}) - elseif(OS2) - set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"") else() # libusb is loaded dynamically, so don't add it to EXTRA_LIBS FindLibraryAndSONAME("usb-1.0") - if(USB_1.0_LIB) - set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"") - endif() + set(SDL_LIBUSB_DYNAMIC "\"${USB_LIB_SONAME}\"") endif() endif() endif() @@ -1168,10 +1184,10 @@ macro(CheckHIDAPI) if(HAVE_HIDAPI) if(ANDROID) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) + set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) endif() if(IOS OR TVOS) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m) + set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m) set(SDL_FRAMEWORK_COREBLUETOOTH 1) endif() set(HAVE_SDL_HIDAPI TRUE) @@ -1181,7 +1197,7 @@ macro(CheckHIDAPI) set(HAVE_SDL_JOYSTICK TRUE) set(HAVE_HIDAPI_JOYSTICK TRUE) file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c) - list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${HIDAPI_JOYSTICK_SOURCES}) endif() endif() endmacro() @@ -1217,7 +1233,7 @@ macro(CheckRPI) set(HAVE_SDL_VIDEO TRUE) set(SDL_VIDEO_DRIVER_RPI 1) file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c) - list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES}) list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) # !!! FIXME: shouldn't be using CMAKE_C_FLAGS, right? set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") @@ -1244,7 +1260,7 @@ macro(CheckKMSDRM) set(HAVE_SDL_VIDEO TRUE) file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) - list(APPEND SOURCE_FILES ${KMSDRM_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES}) list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS}) @@ -1260,7 +1276,7 @@ macro(CheckKMSDRM) set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"") set(HAVE_KMSDRM_SHARED TRUE) else() - list(APPEND EXTRA_LIBS ${KMSDRM_LIBRARIES}) + set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS}) endif() endif() endif() diff --git a/externals/SDL/configure b/externals/SDL/configure index b6f9b7049..a02b8f93b 100755 --- a/externals/SDL/configure +++ b/externals/SDL/configure @@ -1,10 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71. +# Generated by GNU Autoconf 2.69. # # -# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, -# Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -15,16 +14,14 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop +else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -34,46 +31,46 @@ esac fi - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi # The user is always right. -if ${PATH_SEPARATOR+false} :; then +if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -82,6 +79,13 @@ if ${PATH_SEPARATOR+false} :; then fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -90,12 +94,8 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS @@ -107,10 +107,30 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -132,22 +152,20 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="as_nop=: -if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else \$as_nop +else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -167,15 +185,12 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ) -then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : -else \$as_nop +else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 -blah=\$(echo \$(echo blah)) -test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO @@ -190,38 +205,30 @@ test -x / || exit 1" test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null -then : + if (eval "$as_required") 2>/dev/null; then : as_have_required=yes -else $as_nop +else as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null -then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : -else $as_nop +else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir$as_base + as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes - if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null -then : + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi @@ -229,21 +236,14 @@ fi esac as_found=false done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes -fi -fi +fi; } +IFS=$as_save_IFS - if test "x$CONFIG_SHELL" != x -then : + if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -261,19 +261,18 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno -then : - printf "%s\n" "$0: This script requires a shell more modern than all" - printf "%s\n" "$0: the shells that I found on your system." - if test ${ZSH_VERSION+y} ; then - printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" - printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." @@ -300,7 +299,6 @@ as_fn_unset () } as_unset=as_fn_unset - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -318,14 +316,6 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -340,7 +330,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -349,7 +339,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | +$as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -388,13 +378,12 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' -else $as_nop +else as_fn_append () { eval $1=\$$1\$2 @@ -406,27 +395,18 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else $as_nop +else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -438,9 +418,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - printf "%s\n" "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -467,7 +447,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -511,7 +491,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -525,10 +505,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -542,13 +518,6 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -616,46 +585,50 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='' -PACKAGE_TARNAME='' -PACKAGE_VERSION='' -PACKAGE_STRING='' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= ac_unique_file="src/SDL.c" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_STDIO_H -# include +#include +#ifdef HAVE_SYS_TYPES_H +# include #endif -#ifdef HAVE_STDLIB_H +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS # include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif #endif #ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif #ifdef HAVE_UNISTD_H # include #endif" -ac_header_c_list= ac_subst_vars='LTLIBOBJS WAYLAND_SCANNER_CODE_MODE WAYLAND_SCANNER @@ -680,8 +653,6 @@ SDL_RLD_FLAGS SDL_STATIC_LIBS SDL_LIBS SDL_CFLAGS -bin_prefix_relpath -cmake_prefix_relpath INSTALL_SDL2_CONFIG LIBUSB_LIBS LIBUSB_CFLAGS @@ -702,8 +673,6 @@ X_CFLAGS XMKMF RPI_LIBS RPI_CFLAGS -DECOR_LIBS -DECOR_CFLAGS FUSIONSOUND_LIBS FUSIONSOUND_CFLAGS ARTSCONFIG @@ -721,7 +690,6 @@ ALSA_CFLAGS POW_LIB LIBOBJS ALLOCA -CPP LIBTOOLLINKERTAG LINKER PKG_CONFIG_LIBDIR @@ -740,6 +708,7 @@ LT_REVISION LT_CURRENT LT_RELEASE RC +CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL @@ -805,7 +774,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -836,7 +804,6 @@ with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock -enable_largefile enable_assertions enable_dependency_tracking enable_libc @@ -855,8 +822,6 @@ enable_filesystem enable_threads enable_timers enable_file -enable_misc -enable_locale enable_loadso enable_cpuinfo enable_assembly @@ -867,8 +832,6 @@ enable_sse enable_sse2 enable_sse3 enable_altivec -enable_lsx -enable_lasx enable_oss enable_alsa with_alsa_prefix @@ -911,11 +874,13 @@ with_x enable_x11_shared enable_video_x11_xcursor enable_video_x11_xdbe +enable_video_x11_xinerama enable_video_x11_xinput enable_video_x11_xfixes enable_video_x11_xrandr enable_video_x11_scrnsaver enable_video_x11_xshape +enable_video_x11_vm enable_video_vivante enable_video_cocoa enable_video_metal @@ -961,6 +926,7 @@ LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH +CPP CXX CXXFLAGS CCC @@ -968,7 +934,6 @@ CXXCPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR -CPP JACK_CFLAGS JACK_LIBS PIPEWIRE_CFLAGS @@ -977,8 +942,6 @@ PULSEAUDIO_CFLAGS PULSEAUDIO_LIBS FUSIONSOUND_CFLAGS FUSIONSOUND_LIBS -DECOR_CFLAGS -DECOR_LIBS RPI_CFLAGS RPI_LIBS XMKMF @@ -1032,7 +995,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1062,6 +1024,8 @@ do *) ac_optarg=yes ;; esac + # Accept the important Cygnus configure options, so we can diagnose typos. + case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -1102,9 +1066,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1128,9 +1092,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1283,15 +1247,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1341,9 +1296,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1357,9 +1312,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1403,9 +1358,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1421,7 +1376,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1429,7 +1384,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1485,7 +1440,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_myself" | +$as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1582,7 +1537,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1623,7 +1577,6 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) - --disable-largefile omit support for large files --enable-assertions Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [default=auto] @@ -1646,8 +1599,6 @@ Optional Features: --enable-threads Enable the threading subsystem [default=yes] --enable-timers Enable the timer subsystem [default=yes] --enable-file Enable the file 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 [default=yes] --enable-cpuinfo Enable the cpuinfo subsystem [default=yes] @@ -1660,8 +1611,6 @@ Optional Features: --enable-sse2 use SSE2 assembly routines [default=maybe] --enable-sse3 use SSE3 assembly routines [default=maybe] --enable-altivec use Altivec assembly routines [default=yes] - --enable-lsx use LSX assembly routines [default=yes] - --enable-lasx use LASX assembly routines [default=yes] --enable-oss support the OSS audio API [default=maybe] --enable-alsa support the ALSA audio API [default=yes] --disable-alsatest Do not try to compile and run a test Alsa program @@ -1711,6 +1660,8 @@ Optional Features: --enable-video-x11-xcursor enable X11 Xcursor support [default=yes] --enable-video-x11-xdbe enable X11 Xdbe support [default=yes] + --enable-video-x11-xinerama + enable X11 Xinerama support [default=yes] --enable-video-x11-xinput enable X11 XInput extension for manymouse, tablets, etc [default=yes] @@ -1723,6 +1674,7 @@ Optional Features: enable X11 screensaver extension [default=yes] --enable-video-x11-xshape enable X11 XShape support [default=yes] + --enable-video-x11-vm use X11 VM extension for fullscreen [default=yes] --enable-video-vivante use Vivante EGL video driver [default=yes] --enable-video-cocoa use Cocoa video driver [default=yes] --enable-video-metal include Metal support [default=yes] @@ -1800,6 +1752,7 @@ Some influential environment variables: you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. + CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor @@ -1808,7 +1761,6 @@ Some influential environment variables: directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path - CPP C preprocessor JACK_CFLAGS C compiler flags for JACK, overriding pkg-config JACK_LIBS linker flags for JACK, overriding pkg-config PIPEWIRE_CFLAGS @@ -1823,9 +1775,6 @@ Some influential environment variables: C compiler flags for FUSIONSOUND, overriding pkg-config FUSIONSOUND_LIBS linker flags for FUSIONSOUND, overriding pkg-config - DECOR_CFLAGS - C compiler flags for DECOR, overriding pkg-config - DECOR_LIBS linker flags for DECOR, overriding pkg-config RPI_CFLAGS C compiler flags for RPI, overriding pkg-config RPI_LIBS linker flags for RPI, overriding pkg-config XMKMF Path to xmkmf, Makefile generator for X Window System @@ -1866,9 +1815,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1896,8 +1845,7 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for configure.gnu first; this name is used for a wrapper for - # Metaconfig's "Configure" on case-insensitive file systems. + # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1905,7 +1853,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1915,9 +1863,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.71 +generated by GNU Autoconf 2.69 -Copyright (C) 2021 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1934,14 +1882,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam + rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1949,15 +1897,14 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext -then : + } && test -s conftest.$ac_objext; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1973,14 +1920,14 @@ fi ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1988,18 +1935,17 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - } -then : + }; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2021,44 +1967,120 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" -else $as_nop +else eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -2066,9 +2088,16 @@ else $as_nop #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. */ + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif -#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -2086,25 +2115,24 @@ choke me #endif int -main (void) +main () { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" -else $as_nop +else eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -2115,14 +2143,14 @@ printf "%s\n" "$ac_res" >&6; } ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam + rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2130,15 +2158,14 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext -then : + } && test -s conftest.$ac_objext; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2160,7 +2187,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2168,15 +2195,14 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err - } -then : + }; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2192,14 +2218,14 @@ fi ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2207,18 +2233,17 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - } -then : + }; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -2233,6 +2258,93 @@ fi } # ac_fn_cxx_try_link +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -2240,18 +2352,17 @@ fi ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main (void) +main () { if (sizeof ($2)) return 0; @@ -2259,13 +2370,12 @@ if (sizeof ($2)) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main (void) +main () { if (sizeof (($2))) return 0; @@ -2273,104 +2383,22 @@ if (sizeof (($2))) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -else $as_nop +else eval "$3=yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that -# executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: program exited with status $ac_status" >&5 - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including @@ -2378,17 +2406,16 @@ fi ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -printf %s "checking for $2.$3... " >&6; } -if eval test \${$4+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main (void) +main () { static $2 ac_aggr; if (ac_aggr.$3) @@ -2397,15 +2424,14 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" -else $as_nop +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main (void) +main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) @@ -2414,50 +2440,29 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" -else $as_nop +else eval "$4=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member -ac_configure_args_raw= -for ac_arg -do - case $ac_arg in - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_configure_args_raw " '$ac_arg'" -done - -case $ac_configure_args_raw in - *$as_nl*) - ac_safe_unquote= ;; - *) - ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. - ac_unsafe_a="$ac_unsafe_z#~" - ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" - ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; -esac - cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.71. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was - $ $0$ac_configure_args_raw + $ $0 $@ _ACEOF exec 5>>config.log @@ -2490,12 +2495,8 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - printf "%s\n" "PATH: $as_dir" + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" done IFS=$as_save_IFS @@ -2530,7 +2531,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2565,13 +2566,11 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? - # Sanitize IFS. - IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - printf "%s\n" "## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2582,8 +2581,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2607,7 +2606,7 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ) echo - printf "%s\n" "## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2615,14 +2614,14 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - printf "%s\n" "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - printf "%s\n" "## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2630,15 +2629,15 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - printf "%s\n" "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - printf "%s\n" "## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2646,8 +2645,8 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} echo fi test "$ac_signal" != 0 && - printf "%s\n" "$as_me: caught signal $ac_signal" - printf "%s\n" "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2661,48 +2660,63 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -printf "%s\n" "/* confdefs.h */" > confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF -printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF -printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF -printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF -printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF -printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_files="$CONFIG_SITE" + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then - ac_site_files="$prefix/share/config.site $prefix/etc/config.site" + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site else - ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi - -for ac_site_file in $ac_site_files +for ac_site_file in "$ac_site_file1" "$ac_site_file2" do - case $ac_site_file in #( - */*) : - ;; #( - *) : - ac_site_file=./$ac_site_file ;; -esac - if test -f "$ac_site_file" && test -r "$ac_site_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2712,650 +2726,19 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Test code for whether the C compiler supports C89 (global declarations) -ac_c_conftest_c89_globals=' -/* Does the compiler advertise C89 conformance? - Do not test the value of __STDC__, because some compilers set it to 0 - while being otherwise adequately conformant. */ -#if !defined __STDC__ -# error "Compiler does not advertise C89 conformance" -#endif - -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ -struct buf { int x; }; -struct buf * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not \xHH hex character constants. - These do not provoke an error unfortunately, instead are silently treated - as an "x". The following induces an error, until -std is added to get - proper ANSI mode. Curiously \x00 != x always comes out true, for an - array size at least. It is necessary to write \x00 == 0 to get something - that is true only with -std. */ -int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) '\''x'\'' -int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), - int, int);' - -# Test code for whether the C compiler supports C89 (body of main). -ac_c_conftest_c89_main=' -ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); -' - -# Test code for whether the C compiler supports C99 (global declarations) -ac_c_conftest_c99_globals=' -// Does the compiler advertise C99 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L -# error "Compiler does not advertise C99 conformance" -#endif - -#include -extern int puts (const char *); -extern int printf (const char *, ...); -extern int dprintf (int, const char *, ...); -extern void *malloc (size_t); - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -// dprintf is used instead of fprintf to avoid needing to declare -// FILE and stderr. -#define debug(...) dprintf (2, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - #error "your preprocessor is broken" -#endif -#if BIG_OK -#else - #error "your preprocessor is broken" -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static bool -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str = ""; - int number = 0; - float fnumber = 0; - - while (*format) - { - switch (*format++) - { - case '\''s'\'': // string - str = va_arg (args_copy, const char *); - break; - case '\''d'\'': // int - number = va_arg (args_copy, int); - break; - case '\''f'\'': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); - - return *str && number && fnumber; -} -' - -# Test code for whether the C compiler supports C99 (body of main). -ac_c_conftest_c99_main=' - // Check bool. - _Bool success = false; - success |= (argc != 0); - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[0] = argv[0][0]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' - || dynamic_array[ni.number - 1] != 543); -' - -# Test code for whether the C compiler supports C11 (global declarations) -ac_c_conftest_c11_globals=' -// Does the compiler advertise C11 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L -# error "Compiler does not advertise C11 conformance" -#endif - -// Check _Alignas. -char _Alignas (double) aligned_as_double; -char _Alignas (0) no_special_alignment; -extern char aligned_as_int; -char _Alignas (0) _Alignas (int) aligned_as_int; - -// Check _Alignof. -enum -{ - int_alignment = _Alignof (int), - int_array_alignment = _Alignof (int[100]), - char_alignment = _Alignof (char) -}; -_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); - -// Check _Noreturn. -int _Noreturn does_not_return (void) { for (;;) continue; } - -// Check _Static_assert. -struct test_static_assert -{ - int x; - _Static_assert (sizeof (int) <= sizeof (long int), - "_Static_assert does not work in struct"); - long int y; -}; - -// Check UTF-8 literals. -#define u8 syntax error! -char const utf8_literal[] = u8"happens to be ASCII" "another string"; - -// Check duplicate typedefs. -typedef long *long_ptr; -typedef long int *long_ptr; -typedef long_ptr long_ptr; - -// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. -struct anonymous -{ - union { - struct { int i; int j; }; - struct { int k; long int l; } w; - }; - int m; -} v1; -' - -# Test code for whether the C compiler supports C11 (body of main). -ac_c_conftest_c11_main=' - _Static_assert ((offsetof (struct anonymous, i) - == offsetof (struct anonymous, w.k)), - "Anonymous union alignment botch"); - v1.i = 2; - v1.w.k = 5; - ok |= v1.i != 5; -' - -# Test code for whether the C compiler supports C11 (complete). -ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} -${ac_c_conftest_c11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - ${ac_c_conftest_c11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C99 (complete). -ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - return ok; -} -" - -# Test code for whether the C compiler supports C89 (complete). -ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - return ok; -} -" - -as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" -as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" -as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" -as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" -as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" -as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" -as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" -as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" -as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" -# Test code for whether the C++ compiler supports C++98 (global declarations) -ac_cxx_conftest_cxx98_globals=' -// Does the compiler advertise C++98 conformance? -#if !defined __cplusplus || __cplusplus < 199711L -# error "Compiler does not advertise C++98 conformance" -#endif - -// These inclusions are to reject old compilers that -// lack the unsuffixed header files. -#include -#include - -// and are *not* freestanding headers in C++98. -extern void assert (int); -namespace std { - extern int strcmp (const char *, const char *); -} - -// Namespaces, exceptions, and templates were all added after "C++ 2.0". -using std::exception; -using std::strcmp; - -namespace { - -void test_exception_syntax() -{ - try { - throw "test"; - } catch (const char *s) { - // Extra parentheses suppress a warning when building autoconf itself, - // due to lint rules shared with more typical C programs. - assert (!(strcmp) (s, "test")); - } -} - -template struct test_template -{ - T const val; - explicit test_template(T t) : val(t) {} - template T add(U u) { return static_cast(u) + val; } -}; - -} // anonymous namespace -' - -# Test code for whether the C++ compiler supports C++98 (body of main) -ac_cxx_conftest_cxx98_main=' - assert (argc); - assert (! argv[0]); -{ - test_exception_syntax (); - test_template tt (2.0); - assert (tt.add (4) == 6.0); - assert (true && !false); -} -' - -# Test code for whether the C++ compiler supports C++11 (global declarations) -ac_cxx_conftest_cxx11_globals=' -// Does the compiler advertise C++ 2011 conformance? -#if !defined __cplusplus || __cplusplus < 201103L -# error "Compiler does not advertise C++11 conformance" -#endif - -namespace cxx11test -{ - constexpr int get_val() { return 20; } - - struct testinit - { - int i; - double d; - }; - - class delegate - { - public: - delegate(int n) : n(n) {} - delegate(): delegate(2354) {} - - virtual int getval() { return this->n; }; - protected: - int n; - }; - - class overridden : public delegate - { - public: - overridden(int n): delegate(n) {} - virtual int getval() override final { return this->n * 2; } - }; - - class nocopy - { - public: - nocopy(int i): i(i) {} - nocopy() = default; - nocopy(const nocopy&) = delete; - nocopy & operator=(const nocopy&) = delete; - private: - int i; - }; - - // for testing lambda expressions - template Ret eval(Fn f, Ret v) - { - return f(v); - } - - // for testing variadic templates and trailing return types - template auto sum(V first) -> V - { - return first; - } - template auto sum(V first, Args... rest) -> V - { - return first + sum(rest...); - } -} -' - -# Test code for whether the C++ compiler supports C++11 (body of main) -ac_cxx_conftest_cxx11_main=' -{ - // Test auto and decltype - auto a1 = 6538; - auto a2 = 48573953.4; - auto a3 = "String literal"; - - int total = 0; - for (auto i = a3; *i; ++i) { total += *i; } - - decltype(a2) a4 = 34895.034; -} -{ - // Test constexpr - short sa[cxx11test::get_val()] = { 0 }; -} -{ - // Test initializer lists - cxx11test::testinit il = { 4323, 435234.23544 }; -} -{ - // Test range-based for - int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, - 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - for (auto &x : array) { x += 23; } -} -{ - // Test lambda expressions - using cxx11test::eval; - assert (eval ([](int x) { return x*2; }, 21) == 42); - double d = 2.0; - assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); - assert (d == 5.0); - assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); - assert (d == 5.0); -} -{ - // Test use of variadic templates - using cxx11test::sum; - auto a = sum(1); - auto b = sum(1, 2); - auto c = sum(1.0, 2.0, 3.0); -} -{ - // Test constructor delegation - cxx11test::delegate d1; - cxx11test::delegate d2(); - cxx11test::delegate d3(45); -} -{ - // Test override and final - cxx11test::overridden o1(55464); -} -{ - // Test nullptr - char *c = nullptr; -} -{ - // Test template brackets - test_template<::test_template> v(test_template(12)); -} -{ - // Unicode literals - char const *utf8 = u8"UTF-8 string \u2500"; - char16_t const *utf16 = u"UTF-8 string \u2500"; - char32_t const *utf32 = U"UTF-32 string \u2500"; -} -' - -# Test code for whether the C compiler supports C++11 (complete). -ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} -${ac_cxx_conftest_cxx11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - ${ac_cxx_conftest_cxx11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C++98 (complete). -ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - return ok; -} -" - - -# Auxiliary files required by this configure script. -ac_aux_files="install-sh config.guess config.sub ltmain.sh" - -# Locations in which to look for auxiliary files. -ac_aux_dir_candidates="${srcdir}/build-scripts" - -# Search for a directory containing all of the required auxiliary files, -# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. -# If we don't find one directory that contains all the files we need, -# we report the set of missing files from the *first* directory in -# $ac_aux_dir_candidates and give up. -ac_missing_aux_files="" -ac_first_candidate=: -printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in $ac_aux_dir_candidates -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - - printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 - ac_aux_dir_found=yes - ac_install_sh= - for ac_aux in $ac_aux_files - do - # As a special case, if "install-sh" is required, that requirement - # can be satisfied by any of "install-sh", "install.sh", or "shtool", - # and $ac_install_sh is set appropriately for whichever one is found. - if test x"$ac_aux" = x"install-sh" - then - if test -f "${as_dir}install-sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 - ac_install_sh="${as_dir}install-sh -c" - elif test -f "${as_dir}install.sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 - ac_install_sh="${as_dir}install.sh -c" - elif test -f "${as_dir}shtool"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 - ac_install_sh="${as_dir}shtool install -c" - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} install-sh" - else - break - fi - fi - else - if test -f "${as_dir}${ac_aux}"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" - else - break - fi - fi - fi - done - if test "$ac_aux_dir_found" = yes; then - ac_aux_dir="$as_dir" - break - fi - ac_first_candidate=false - - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 -fi - - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -if test -f "${ac_aux_dir}config.guess"; then - ac_config_guess="$SHELL ${ac_aux_dir}config.guess" -fi -if test -f "${ac_aux_dir}config.sub"; then - ac_config_sub="$SHELL ${ac_aux_dir}config.sub" -fi -if test -f "$ac_aux_dir/configure"; then - ac_configure="$SHELL ${ac_aux_dir}configure" -fi - # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -3366,12 +2749,12 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -3380,24 +2763,24 @@ printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -3407,12 +2790,11 @@ printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' - and start over" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -3428,27 +2810,56 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers include/SDL_config.h" +ac_aux_dir= +for ac_dir in build-scripts "$srcdir"/build-scripts; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-scripts \"$srcdir\"/build-scripts" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + orig_CFLAGS="$CFLAGS" -# See docs/release_checklist.md +# +# Making releases: +# Edit include/SDL_version.h and change the version, then: +# SDL_MICRO_VERSION += 1; +# SDL_INTERFACE_AGE += 1; +# SDL_BINARY_AGE += 1; +# if any functions have been added, set SDL_INTERFACE_AGE to 0. +# if backwards compatibility has been broken, +# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. +# SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=23 -SDL_MICRO_VERSION=1 +SDL_MINOR_VERSION=0 +SDL_MICRO_VERSION=20 +SDL_INTERFACE_AGE=2 +SDL_BINARY_AGE=20 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION -SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` -case "$SDL_MINOR_VERSION" in #( - *[02468]) : - SDL_INTERFACE_AGE="$SDL_MICRO_VERSION" ;; #( - *) : - SDL_INTERFACE_AGE=0 ;; #( - *) : - ;; -esac - @@ -3457,12 +2868,10 @@ esac # libtool versioning - - case `pwd` in *\ * | *\ *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac @@ -3482,32 +2891,28 @@ macro_revision='2.4.6' - ltmain=$ac_aux_dir/ltmain.sh +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - - # Make sure we can run config.sub. -$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -printf %s "checking build system type... " >&6; } -if test ${ac_cv_build+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_build_alias=$build_alias test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -printf "%s\n" "$ac_cv_build" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; @@ -3526,22 +2931,21 @@ IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -printf %s "checking host system type... " >&6; } -if test ${ac_cv_host+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -printf "%s\n" "$ac_cv_host" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -3581,8 +2985,8 @@ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -printf %s "checking how to print strings... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then @@ -3608,12 +3012,12 @@ func_echo_all () } case $ECHO in - printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -printf "%s\n" "printf" >&6; } ;; - print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -printf "%s\n" "print -r" >&6; } ;; - *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -printf "%s\n" "cat" >&6; } ;; + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; esac @@ -3626,15 +3030,6 @@ esac - - - - - - - - - @@ -3646,12 +3041,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3659,15 +3053,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3678,11 +3068,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3691,12 +3081,11 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3704,15 +3093,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3723,11 +3108,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -3735,8 +3120,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3749,12 +3134,11 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3762,15 +3146,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3781,11 +3161,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3794,12 +3174,11 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3808,19 +3187,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3836,18 +3211,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3858,12 +3233,11 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3871,15 +3245,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3890,11 +3260,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3907,12 +3277,11 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3920,15 +3289,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3939,11 +3304,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3955,8 +3320,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3964,129 +3329,25 @@ esac fi fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -fi - - -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do +for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -4096,7 +3357,7 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -4104,7 +3365,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; @@ -4116,9 +3377,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -printf %s "checking whether the C compiler works... " >&6; } -ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -4139,12 +3400,11 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -4161,7 +3421,7 @@ do # certainly right. break;; *.* ) - if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -4177,46 +3437,44 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else $as_nop +else ac_file='' fi -if test -z "$ac_file" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -printf "%s\n" "$as_me: failed program was:" >&5 +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -printf %s "checking for C compiler default output file name... " >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -printf "%s\n" "$ac_file" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -printf %s "checking for suffix of executables... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -4230,15 +3488,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -printf "%s\n" "$ac_cv_exeext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -4247,7 +3505,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -4259,8 +3517,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -printf %s "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -4268,10 +3526,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -4279,40 +3537,39 @@ printf "%s\n" "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot run C compiled programs. + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -printf "%s\n" "$cross_compiling" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -printf %s "checking for suffix of object files... " >&6; } -if test ${ac_cv_objext+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; @@ -4326,12 +3583,11 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -4340,32 +3596,31 @@ then : break;; esac done -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -printf "%s\n" "$ac_cv_objext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -4375,33 +3630,29 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes -else $as_nop +else ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+y} +ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -printf %s "checking whether $CC accepts -g... " >&6; } -if test ${ac_cv_prog_cc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -4410,60 +3661,57 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes -else $as_nop +else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -else $as_nop +else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -4478,144 +3726,94 @@ else CFLAGS= fi fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -printf %s "checking for $CC option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c11=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c99" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -printf %s "checking for $CC option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_c_conftest_c89_program +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext conftest.beam +rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC -fi -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c89" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + fi ac_ext=c @@ -4624,12 +3822,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -printf %s "checking for a sed that does not truncate output... " >&6; } -if test ${ac_cv_path_SED+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" @@ -4643,15 +3840,10 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in sed gsed - do + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir$ac_prog$ac_exec_ext" + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED @@ -4660,13 +3852,13 @@ case `"$ac_path_SED" --version 2>&1` in ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 - printf %s 0123456789 >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - printf "%s\n" '' >> "conftest.nl" + $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -4694,8 +3886,8 @@ else fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -printf "%s\n" "$ac_cv_path_SED" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed @@ -4712,12 +3904,11 @@ Xsed="$SED -e 1s/^X//" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST @@ -4725,15 +3916,10 @@ else $as_nop for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP @@ -4742,13 +3928,13 @@ case `"$ac_path_GREP" --version 2>&1` in ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - printf %s 0123456789 >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -4776,17 +3962,16 @@ else fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else @@ -4797,15 +3982,10 @@ else $as_nop for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP @@ -4814,13 +3994,13 @@ case `"$ac_path_EGREP" --version 2>&1` in ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - printf %s 0123456789 >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -4849,17 +4029,16 @@ fi fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -printf %s "checking for fgrep... " >&6; } -if test ${ac_cv_path_FGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else @@ -4870,15 +4049,10 @@ else $as_nop for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in fgrep - do + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP @@ -4887,13 +4061,13 @@ case `"$ac_path_FGREP" --version 2>&1` in ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 - printf %s 0123456789 >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - printf "%s\n" 'FGREP' >> "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -4922,8 +4096,8 @@ fi fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -printf "%s\n" "$ac_cv_path_FGREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" @@ -4948,18 +4122,17 @@ test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. -if test ${with_gnu_ld+y} -then : +if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else $as_nop +else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -printf %s "checking for ld used by $CC... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw @@ -4988,16 +4161,15 @@ printf %s "checking for ld used by $CC... " >&6; } ;; esac elif test yes = "$with_gnu_ld"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -printf %s "checking for GNU ld... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -printf %s "checking for non-GNU ld... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } fi -if test ${lt_cv_path_LD+y} -then : - printf %s "(cached) " >&6 -else $as_nop +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do @@ -5026,19 +4198,18 @@ fi LD=$lt_cv_path_LD if test -n "$LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -printf "%s\n" "$LD" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -printf %s "checking if the linker ($LD) is GNU ld... " >&6; } -if test ${lt_cv_prog_gnu_ld+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &1 &5 -printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld @@ -5061,12 +4232,11 @@ with_gnu_ld=$lt_cv_prog_gnu_ld -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test ${lt_cv_path_NM+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM @@ -5116,8 +4286,8 @@ else : ${lt_cv_path_NM=no} fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -printf "%s\n" "$lt_cv_path_NM" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else @@ -5130,12 +4300,11 @@ else do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_DUMPBIN+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else @@ -5143,15 +4312,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5162,11 +4327,11 @@ fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -printf "%s\n" "$DUMPBIN" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -5179,12 +4344,11 @@ if test -z "$DUMPBIN"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_DUMPBIN+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else @@ -5192,15 +4356,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5211,11 +4371,11 @@ fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -printf "%s\n" "$ac_ct_DUMPBIN" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -5227,8 +4387,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN @@ -5256,12 +4416,11 @@ test -z "$NM" && NM=nm -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -printf %s "checking the name lister ($NM) interface... " >&6; } -if test ${lt_cv_nm_interface+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) @@ -5277,27 +4436,26 @@ else $as_nop fi rm -f conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -printf "%s\n" "$lt_cv_nm_interface" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -printf %s "checking whether ln -s works... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -printf "%s\n" "no, using $LN_S" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -printf %s "checking the maximum length of command line arguments... " >&6; } -if test ${lt_cv_sys_max_cmd_len+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else i=0 teststring=ABCD @@ -5424,11 +4582,11 @@ else $as_nop fi if test -n "$lt_cv_sys_max_cmd_len"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 -printf "%s\n" "none" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len @@ -5472,12 +4630,11 @@ esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -printf %s "checking how to convert $build file names to $host format... " >&6; } -if test ${lt_cv_to_host_file_cmd+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else case $host in *-*-mingw* ) case $build in @@ -5513,19 +4670,18 @@ esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -printf %s "checking how to convert $build file names to toolchain format... " >&6; } -if test ${lt_cv_to_tool_file_cmd+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in @@ -5541,23 +4697,22 @@ esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -printf %s "checking for $LD option to reload object files... " >&6; } -if test ${lt_cv_ld_reload_flag+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_ld_reload_flag='-r' fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; @@ -5590,12 +4745,11 @@ esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OBJDUMP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else @@ -5603,15 +4757,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5622,11 +4772,11 @@ fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -printf "%s\n" "$OBJDUMP" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -5635,12 +4785,11 @@ if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OBJDUMP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else @@ -5648,15 +4797,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5667,11 +4812,11 @@ fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -printf "%s\n" "$ac_ct_OBJDUMP" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then @@ -5679,8 +4824,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -5696,12 +4841,11 @@ test -z "$OBJDUMP" && OBJDUMP=objdump -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -printf %s "checking how to recognize dependent libraries... " >&6; } -if test ${lt_cv_deplibs_check_method+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' @@ -5899,8 +5043,8 @@ os2*) esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no @@ -5944,12 +5088,11 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_DLLTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else @@ -5957,15 +5100,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5976,11 +5115,11 @@ fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -printf "%s\n" "$DLLTOOL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -5989,12 +5128,11 @@ if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_DLLTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else @@ -6002,15 +5140,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6021,11 +5155,11 @@ fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -printf "%s\n" "$ac_ct_DLLTOOL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then @@ -6033,8 +5167,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -6051,12 +5185,11 @@ test -z "$DLLTOOL" && DLLTOOL=dlltool -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -printf %s "checking how to associate runtime and link libraries... " >&6; } -if test ${lt_cv_sharedlib_from_linklib_cmd+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in @@ -6079,8 +5212,8 @@ cygwin* | mingw* | pw32* | cegcc*) esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO @@ -6096,12 +5229,11 @@ if test -n "$ac_tool_prefix"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AR+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else @@ -6109,15 +5241,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6128,11 +5256,11 @@ fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -printf "%s\n" "$AR" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -6145,12 +5273,11 @@ if test -z "$AR"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_AR+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else @@ -6158,15 +5285,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6177,11 +5300,11 @@ fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -printf "%s\n" "$ac_ct_AR" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -6193,8 +5316,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR @@ -6214,32 +5337,30 @@ fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -printf %s "checking for archiver @FILE support... " >&6; } -if test ${lt_cv_ar_at_file+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. @@ -6247,7 +5368,7 @@ then : { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ @@ -6256,11 +5377,11 @@ then : rm -f conftest.* libconftest.a fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -printf "%s\n" "$lt_cv_ar_at_file" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= @@ -6277,12 +5398,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -6290,15 +5410,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6309,11 +5425,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -printf "%s\n" "$STRIP" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -6322,12 +5438,11 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_STRIP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -6335,15 +5450,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6354,11 +5465,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -printf "%s\n" "$ac_ct_STRIP" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -6366,8 +5477,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -6386,12 +5497,11 @@ test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RANLIB+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -6399,15 +5509,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6418,11 +5524,11 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -printf "%s\n" "$RANLIB" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -6431,12 +5537,11 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_RANLIB+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -6444,15 +5549,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6463,11 +5564,11 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -printf "%s\n" "$ac_ct_RANLIB" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -6475,8 +5576,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -6540,12 +5641,11 @@ for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AWK+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -6553,15 +5653,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6572,11 +5668,11 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -printf "%s\n" "$AWK" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -6612,12 +5708,11 @@ compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -printf %s "checking command to parse $NM output from $compiler object... " >&6; } -if test ${lt_cv_sys_global_symbol_pipe+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] @@ -6769,14 +5864,14 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then @@ -6845,7 +5940,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi @@ -6880,11 +5975,11 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -printf "%s\n" "failed" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -printf "%s\n" "ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } fi # Response file support. @@ -6930,14 +6025,13 @@ fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -printf %s "checking for sysroot... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. -if test ${with_sysroot+y} -then : +if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; -else $as_nop +else with_sysroot=no fi @@ -6955,25 +6049,24 @@ case $with_sysroot in #( no|'') ;; #( *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 -printf "%s\n" "$with_sysroot" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +$as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -printf "%s\n" "${lt_sysroot:-no}" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 -printf %s "checking for a working dd... " >&6; } -if test ${ac_cv_path_lt_DD+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +$as_echo_n "checking for a working dd... " >&6; } +if ${ac_cv_path_lt_DD+:} false; then : + $as_echo_n "(cached) " >&6 +else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} @@ -6984,15 +6077,10 @@ if test -z "$lt_DD"; then for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in dd - do + test -z "$as_dir" && as_dir=. + for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" + ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ @@ -7012,16 +6100,15 @@ fi rm -f conftest.i conftest2.i conftest.out fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 -printf "%s\n" "$ac_cv_path_lt_DD" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +$as_echo "$ac_cv_path_lt_DD" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 -printf %s "checking how to truncate binary pipes... " >&6; } -if test ${lt_cv_truncate_bin+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +$as_echo_n "checking how to truncate binary pipes... " >&6; } +if ${lt_cv_truncate_bin+:} false; then : + $as_echo_n "(cached) " >&6 +else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= @@ -7032,8 +6119,8 @@ fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 -printf "%s\n" "$lt_cv_truncate_bin" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +$as_echo "$lt_cv_truncate_bin" >&6; } @@ -7056,8 +6143,7 @@ func_cc_basename () } # Check whether --enable-libtool-lock was given. -if test ${enable_libtool_lock+y} -then : +if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi @@ -7073,7 +6159,7 @@ ia64-*-hpux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) @@ -7093,7 +6179,7 @@ ia64-*-hpux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in @@ -7131,7 +6217,7 @@ mips64*-*linux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in @@ -7172,7 +6258,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) @@ -7235,12 +6321,11 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -printf %s "checking whether the C compiler needs -belf... " >&6; } -if test ${lt_cv_cc_needs_belf+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -7251,20 +6336,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes -else $as_nop +else lt_cv_cc_needs_belf=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -7273,8 +6357,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS @@ -7287,7 +6371,7 @@ printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) @@ -7324,12 +6408,11 @@ need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_MANIFEST_TOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else @@ -7337,15 +6420,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7356,11 +6435,11 @@ fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -printf "%s\n" "$MANIFEST_TOOL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -7369,12 +6448,11 @@ if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else @@ -7382,15 +6460,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7401,11 +6475,11 @@ fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then @@ -7413,8 +6487,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL @@ -7424,12 +6498,11 @@ else fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if test ${lt_cv_path_mainfest_tool+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out @@ -7439,8 +6512,8 @@ else $as_nop fi rm -f conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi @@ -7455,12 +6528,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_DSYMUTIL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else @@ -7468,15 +6540,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7487,11 +6555,11 @@ fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -printf "%s\n" "$DSYMUTIL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -7500,12 +6568,11 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else @@ -7513,15 +6580,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7532,11 +6595,11 @@ fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then @@ -7544,8 +6607,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL @@ -7557,12 +6620,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_NMEDIT+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else @@ -7570,15 +6632,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7589,11 +6647,11 @@ fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -printf "%s\n" "$NMEDIT" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -7602,12 +6660,11 @@ if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_NMEDIT+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else @@ -7615,15 +6672,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7634,11 +6687,11 @@ fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -printf "%s\n" "$ac_ct_NMEDIT" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then @@ -7646,8 +6699,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT @@ -7659,12 +6712,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_LIPO+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else @@ -7672,15 +6724,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7691,11 +6739,11 @@ fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -printf "%s\n" "$LIPO" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -7704,12 +6752,11 @@ if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_LIPO+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else @@ -7717,15 +6764,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7736,11 +6779,11 @@ fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -printf "%s\n" "$ac_ct_LIPO" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then @@ -7748,8 +6791,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO @@ -7761,12 +6804,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else @@ -7774,15 +6816,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7793,11 +6831,11 @@ fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -printf "%s\n" "$OTOOL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -7806,12 +6844,11 @@ if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else @@ -7819,15 +6856,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7838,11 +6871,11 @@ fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -printf "%s\n" "$ac_ct_OTOOL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then @@ -7850,8 +6883,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL @@ -7863,12 +6896,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OTOOL64+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else @@ -7876,15 +6908,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7895,11 +6923,11 @@ fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -printf "%s\n" "$OTOOL64" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -7908,12 +6936,11 @@ if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OTOOL64+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else @@ -7921,15 +6948,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7940,11 +6963,11 @@ fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -printf "%s\n" "$ac_ct_OTOOL64" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then @@ -7952,8 +6975,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 @@ -7988,12 +7011,11 @@ fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -printf %s "checking for -single_module linker flag... " >&6; } -if test ${lt_cv_apple_cc_single_mod+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override @@ -8022,15 +7044,14 @@ else $as_nop rm -f conftest.* fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -printf %s "checking for -exported_symbols_list linker flag... " >&6; } -if test ${lt_cv_ld_exported_symbols_list+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym @@ -8039,33 +7060,31 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes -else $as_nop +else lt_cv_ld_exported_symbols_list=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -printf %s "checking for -force_load linker flag... " >&6; } -if test ${lt_cv_ld_force_load+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} @@ -8093,15 +7112,15 @@ _LT_EOF rm -rf conftest.dSYM fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -printf "%s\n" "$lt_cv_ld_force_load" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) - case $MACOSX_DEPLOYMENT_TARGET,$host in + case ${MACOSX_DEPLOYMENT_TARGET},$host in 10.[012],*|,*powerpc*-darwin[5-8]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; *) @@ -8160,43 +7179,286 @@ func_munge_path_list () esac } -ac_header= ac_cache= -for ac_item in $ac_header_c_list +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes do - if test $ac_cache; then - ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" - if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then - printf "%s\n" "#define $ac_item 1" >> confdefs.h - fi - ac_header= ac_cache= - elif test $ac_header; then - ac_cache=$ac_item - else - ac_header=$ac_item - fi + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done - - - - - - -if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes -then : - -printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " -if test "x$ac_cv_header_dlfcn_h" = xyes -then : - printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF fi +done + @@ -8209,12 +7471,11 @@ case $host in if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AS+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else @@ -8222,15 +7483,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8241,11 +7498,11 @@ fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -printf "%s\n" "$AS" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +$as_echo "$AS" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -8254,12 +7511,11 @@ if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_AS+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else @@ -8267,15 +7523,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8286,11 +7538,11 @@ fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -printf "%s\n" "$ac_ct_AS" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +$as_echo "$ac_ct_AS" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then @@ -8298,8 +7550,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS @@ -8311,12 +7563,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_DLLTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else @@ -8324,15 +7575,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8343,11 +7590,11 @@ fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -printf "%s\n" "$DLLTOOL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -8356,12 +7603,11 @@ if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_DLLTOOL+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else @@ -8369,15 +7615,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8388,11 +7630,11 @@ fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -printf "%s\n" "$ac_ct_DLLTOOL" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then @@ -8400,8 +7642,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -8413,12 +7655,11 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_OBJDUMP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else @@ -8426,15 +7667,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8445,11 +7682,11 @@ fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -printf "%s\n" "$OBJDUMP" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -8458,12 +7695,11 @@ if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_OBJDUMP+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else @@ -8471,15 +7707,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8490,11 +7722,11 @@ fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -printf "%s\n" "$ac_ct_OBJDUMP" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then @@ -8502,8 +7734,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -8540,8 +7772,7 @@ test -z "$OBJDUMP" && OBJDUMP=objdump # Check whether --enable-shared was given. -if test ${enable_shared+y} -then : +if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; @@ -8559,7 +7790,7 @@ then : IFS=$lt_save_ifs ;; esac -else $as_nop +else enable_shared=yes fi @@ -8572,8 +7803,7 @@ fi # Check whether --enable-static was given. -if test ${enable_static+y} -then : +if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; @@ -8591,7 +7821,7 @@ then : IFS=$lt_save_ifs ;; esac -else $as_nop +else enable_static=yes fi @@ -8605,8 +7835,7 @@ fi # Check whether --with-pic was given. -if test ${with_pic+y} -then : +if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; @@ -8623,7 +7852,7 @@ then : IFS=$lt_save_ifs ;; esac -else $as_nop +else pic_mode=default fi @@ -8635,8 +7864,7 @@ fi # Check whether --enable-fast-install was given. -if test ${enable_fast_install+y} -then : +if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; @@ -8654,7 +7882,7 @@ then : IFS=$lt_save_ifs ;; esac -else $as_nop +else enable_fast_install=yes fi @@ -8668,12 +7896,11 @@ fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 -printf %s "checking which variant of shared library versioning to provide... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. -if test ${with_aix_soname+y} -then : +if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; @@ -8682,19 +7909,18 @@ then : ;; esac lt_cv_with_aix_soname=$with_aix_soname -else $as_nop - if test ${lt_cv_with_aix_soname+y} -then : - printf %s "(cached) " >&6 -else $as_nop +else + if ${lt_cv_with_aix_soname+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 -printf "%s\n" "$with_aix_soname" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +$as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', @@ -8776,12 +8002,11 @@ if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -printf %s "checking for objdir... " >&6; } -if test ${lt_cv_objdir+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then @@ -8792,15 +8017,17 @@ else fi rmdir .libs 2>/dev/null fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -printf "%s\n" "$lt_cv_objdir" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir -printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF @@ -8846,12 +8073,11 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -printf %s "checking for ${ac_tool_prefix}file... " >&6; } -if test ${lt_cv_path_MAGIC_CMD+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. @@ -8900,11 +8126,11 @@ fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -printf "%s\n" "$MAGIC_CMD" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -8913,12 +8139,11 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -printf %s "checking for file... " >&6; } -if test ${lt_cv_path_MAGIC_CMD+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. @@ -8967,11 +8192,11 @@ fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -printf "%s\n" "$MAGIC_CMD" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -9056,12 +8281,11 @@ if test yes = "$GCC"; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test ${lt_cv_prog_compiler_rtti_exceptions+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -9092,8 +8316,8 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" @@ -9450,28 +8674,26 @@ case $host_os in ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -printf %s "checking for $compiler option to produce PIC... " >&6; } -if test ${lt_cv_prog_compiler_pic+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if test ${lt_cv_prog_compiler_pic_works+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -9502,8 +8724,8 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in @@ -9531,12 +8753,11 @@ fi # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test ${lt_cv_prog_compiler_static_works+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" @@ -9560,8 +8781,8 @@ else $as_nop LDFLAGS=$save_LDFLAGS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : @@ -9575,12 +8796,11 @@ fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test ${lt_cv_prog_compiler_c_o+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest @@ -9623,20 +8843,19 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test ${lt_cv_prog_compiler_c_o+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest @@ -9679,8 +8898,8 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } @@ -9688,19 +8907,19 @@ printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -printf %s "checking if we can lock with hard links... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -printf "%s\n" "$hard_links" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } if test no = "$hard_links"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -9712,8 +8931,8 @@ fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= @@ -10269,23 +9488,21 @@ _LT_EOF if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if test ${lt_cv_aix_libpath_+y} -then : - printf %s "(cached) " >&6 -else $as_nop + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -10300,7 +9517,7 @@ then : lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib @@ -10324,23 +9541,21 @@ fi if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if test ${lt_cv_aix_libpath_+y} -then : - printf %s "(cached) " >&6 -else $as_nop + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -10355,7 +9570,7 @@ then : lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib @@ -10606,12 +9821,11 @@ fi # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -printf %s "checking if $CC understands -b... " >&6; } -if test ${lt_cv_prog_compiler__b+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" @@ -10635,8 +9849,8 @@ else $as_nop LDFLAGS=$save_LDFLAGS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' @@ -10676,30 +9890,28 @@ fi # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if test ${lt_cv_irix_exported_symbol+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes -else $as_nop +else lt_cv_irix_exported_symbol=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi @@ -10980,8 +10192,8 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -printf "%s\n" "$ld_shlibs" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld @@ -11017,19 +10229,18 @@ x|xyes) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -printf %s "checking whether -lc should be explicitly linked in... " >&6; } -if test ${lt_cv_archive_cmds_need_lc+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest @@ -11047,7 +10258,7 @@ else $as_nop if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no @@ -11061,8 +10272,8 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac @@ -11221,8 +10432,8 @@ esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -printf %s "checking dynamic linker characteristics... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in @@ -11785,10 +10996,9 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if test ${lt_cv_shlibpath_overrides_runpath+y} -then : - printf %s "(cached) " >&6 -else $as_nop + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir @@ -11798,21 +11008,19 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null -then : +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -12049,8 +11257,8 @@ uts4*) dynamic_linker=no ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -printf "%s\n" "$dynamic_linker" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" @@ -12171,8 +11379,8 @@ configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -printf %s "checking how to hardcode library paths into programs... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || @@ -12196,8 +11404,8 @@ else # directories. hardcode_action=unsupported fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -printf "%s\n" "$hardcode_action" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then @@ -12241,12 +11449,11 @@ else darwin*) # if libdl is installed we need to link against it - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -printf %s "checking for dlopen in -ldl... " >&6; } -if test ${ac_cv_lib_dl_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12255,31 +11462,32 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char dlopen (); int -main (void) +main () { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes -else $as_nop +else ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else $as_nop +else lt_cv_dlopen=dyld lt_cv_dlopen_libs= @@ -12299,16 +11507,14 @@ fi *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes -then : +if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -printf %s "checking for shl_load in -ldld... " >&6; } -if test ${ac_cv_lib_dld_shl_load+y} -then : - printf %s "(cached) " >&6 -else $as_nop +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12317,42 +11523,41 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char shl_load (); int -main (void) +main () { return shl_load (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes -else $as_nop +else ac_cv_lib_dld_shl_load=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld -else $as_nop +else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes -then : +if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -printf %s "checking for dlopen in -ldl... " >&6; } -if test ${ac_cv_lib_dl_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12361,37 +11566,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char dlopen (); int -main (void) +main () { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes -else $as_nop +else ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -printf %s "checking for dlopen in -lsvld... " >&6; } -if test ${ac_cv_lib_svld_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12400,37 +11605,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char dlopen (); int -main (void) +main () { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes -else $as_nop +else ac_cv_lib_svld_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -printf %s "checking for dld_link in -ldld... " >&6; } -if test ${ac_cv_lib_dld_dld_link+y} -then : - printf %s "(cached) " >&6 -else $as_nop +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12439,29 +11644,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char dld_link (); int -main (void) +main () { return dld_link (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes -else $as_nop +else ac_cv_lib_dld_dld_link=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi @@ -12500,12 +11706,11 @@ fi save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -printf %s "checking whether a program can dlopen itself... " >&6; } -if test ${lt_cv_dlopen_self+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else @@ -12584,7 +11789,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? @@ -12602,17 +11807,16 @@ rm -fr conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -printf "%s\n" "$lt_cv_dlopen_self" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -printf %s "checking whether a statically linked program can dlopen itself... " >&6; } -if test ${lt_cv_dlopen_self_static+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else @@ -12691,7 +11895,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? @@ -12709,8 +11913,8 @@ rm -fr conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS @@ -12748,40 +11952,40 @@ fi striplib= old_striplib= -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -printf %s "checking whether stripping libraries is possible... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -z "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } else if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else case $host_os in darwin*) # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } ;; freebsd*) if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then old_striplib="$STRIP --strip-debug" striplib="$STRIP --strip-unneeded" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi ;; *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } ;; esac fi @@ -12799,13 +12003,13 @@ fi # Report what library types will actually be built - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -printf %s "checking if libtool supports shared libraries... " >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -printf "%s\n" "$can_build_shared" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -printf %s "checking whether to build shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and @@ -12829,15 +12033,15 @@ printf %s "checking whether to build shared libraries... " >&6; } fi ;; esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -printf "%s\n" "$enable_shared" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -printf %s "checking whether to build static libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -printf "%s\n" "$enable_static" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } @@ -12876,12 +12080,11 @@ CC=$lt_save_CC if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$RC"; then ac_cv_prog_RC="$RC" # Let the user override the test. else @@ -12889,15 +12092,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RC="${ac_tool_prefix}windres" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12908,11 +12107,11 @@ fi fi RC=$ac_cv_prog_RC if test -n "$RC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 -printf "%s\n" "$RC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 +$as_echo "$RC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -12921,12 +12120,11 @@ if test -z "$ac_cv_prog_RC"; then ac_ct_RC=$RC # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_RC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_RC"; then ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test. else @@ -12934,15 +12132,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RC="windres" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -12953,11 +12147,11 @@ fi fi ac_ct_RC=$ac_cv_prog_ac_ct_RC if test -n "$ac_ct_RC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 -printf "%s\n" "$ac_ct_RC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 +$as_echo "$ac_ct_RC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_RC" = x; then @@ -12965,8 +12159,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RC=$ac_ct_RC @@ -13054,17 +12248,10 @@ CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS -# For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. -# TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0 -LT_RELEASE=2.0 -# Increment this if there is an incompatible change - but if that happens, -# we should rename the library from SDL2 to SDL3, at which point this would -# reset to 0 anyway. -LT_MAJOR=0 -LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` -LT_CURRENT=`expr $LT_MAJOR + $LT_AGE` +LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION +LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE` LT_REVISION=$SDL_INTERFACE_AGE +LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` @@ -13081,12 +12268,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -13094,15 +12280,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13113,11 +12295,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -13126,12 +12308,11 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -13139,15 +12320,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13158,11 +12335,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -13170,8 +12347,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -13184,12 +12361,11 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -13197,15 +12373,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13216,11 +12388,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -13229,12 +12401,11 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -13243,19 +12414,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13271,18 +12438,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -13293,12 +12460,11 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -13306,15 +12472,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13325,11 +12487,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -13342,12 +12504,11 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -13355,15 +12516,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13374,11 +12531,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -13390,8 +12547,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -13399,129 +12556,25 @@ esac fi fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -fi - - -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do +for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -13531,21 +12584,20 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -13555,33 +12607,29 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes -else $as_nop +else ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+y} +ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -printf %s "checking whether $CC accepts -g... " >&6; } -if test ${ac_cv_prog_cc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -13590,60 +12638,57 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes -else $as_nop +else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -else $as_nop +else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -13658,144 +12703,94 @@ else CFLAGS= fi fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -printf %s "checking for $CC option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c11=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c99" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -printf %s "checking for $CC option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_c_conftest_c89_program +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext conftest.beam +rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC -fi -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c89" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + fi ac_ext=c @@ -13804,12 +12799,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -13820,16 +12809,15 @@ if test -z "$CXX"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -13837,15 +12825,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13856,11 +12840,11 @@ fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -printf "%s\n" "$CXX" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -13869,16 +12853,15 @@ fi fi if test -z "$CXX"; then ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -13886,15 +12869,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13905,11 +12884,11 @@ fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -printf "%s\n" "$ac_ct_CXX" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -13921,8 +12900,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -13932,7 +12911,7 @@ fi fi fi # Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -13942,7 +12921,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -13952,21 +12931,20 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 -printf %s "checking whether the compiler supports GNU C++... " >&6; } -if test ${ac_cv_cxx_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -13976,33 +12954,29 @@ main (void) return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : +if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes -else $as_nop +else ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -printf %s "checking whether $CXX accepts -g... " >&6; } -if test ${ac_cv_prog_cxx_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -14011,60 +12985,57 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : +if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes -else $as_nop +else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : +if ac_fn_cxx_try_compile "$LINENO"; then : -else $as_nop +else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : +if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } -if test $ac_test_CXXFLAGS; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -14079,100 +13050,6 @@ else CXXFLAGS= fi fi -ac_prog_cxx_stdcxx=no -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 -printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_11=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx11_program -_ACEOF -for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx11" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx11" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_prog_cxx_stdcxx=cxx11 -fi -fi -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 -printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_98+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cxx_98=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx98_program -_ACEOF -for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx98=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx98" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX -fi - -if test "x$ac_cv_prog_cxx_cxx98" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cxx_cxx98" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx98" -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 - ac_prog_cxx_stdcxx=cxx98 -fi -fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -14197,32 +13074,36 @@ ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -printf %s "checking how to run the C++ preprocessor... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +$as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then - if test ${ac_cv_prog_CXXCPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CXX needs to be expanded - for CXXCPP in "$CXX -E" cpp /lib/cpp + if ${ac_cv_prog_CXXCPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#ifdef __STDC__ +# include +#else +# include +#endif Syntax error _ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : +if ac_fn_cxx_try_cpp "$LINENO"; then : -else $as_nop +else # Broken: fails on valid input. continue fi @@ -14234,11 +13115,10 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : +if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue -else $as_nop +else # Passes both tests. ac_preproc_ok=: break @@ -14248,8 +13128,7 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : +if $ac_preproc_ok; then : break fi @@ -14261,24 +13140,29 @@ fi else ac_cv_prog_CXXCPP=$CXXCPP fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -printf "%s\n" "$CXXCPP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#ifdef __STDC__ +# include +#else +# include +#endif Syntax error _ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : +if ac_fn_cxx_try_cpp "$LINENO"; then : -else $as_nop +else # Broken: fails on valid input. continue fi @@ -14290,11 +13174,10 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_cxx_try_cpp "$LINENO" -then : +if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue -else $as_nop +else # Passes both tests. ac_preproc_ok=: break @@ -14304,12 +13187,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : +if $ac_preproc_ok; then : -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi @@ -14445,18 +13327,17 @@ cc_basename=$func_cc_basename_result # Check whether --with-gnu-ld was given. -if test ${with_gnu_ld+y} -then : +if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else $as_nop +else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -printf %s "checking for ld used by $CC... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw @@ -14485,16 +13366,15 @@ printf %s "checking for ld used by $CC... " >&6; } ;; esac elif test yes = "$with_gnu_ld"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -printf %s "checking for GNU ld... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -printf %s "checking for non-GNU ld... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } fi -if test ${lt_cv_path_LD+y} -then : - printf %s "(cached) " >&6 -else $as_nop +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do @@ -14523,19 +13403,18 @@ fi LD=$lt_cv_path_LD if test -n "$LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -printf "%s\n" "$LD" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -printf %s "checking if the linker ($LD) is GNU ld... " >&6; } -if test ${lt_cv_prog_gnu_ld+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &1 &5 -printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld @@ -14601,8 +13480,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld fi # PORTME: fill in a description of your system's C++ link characteristics - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) @@ -14740,23 +13619,21 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if test ${lt_cv_aix_libpath__CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : +if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -14771,7 +13648,7 @@ then : lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib @@ -14796,23 +13673,21 @@ fi if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if test ${lt_cv_aix_libpath__CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : +if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -14827,7 +13702,7 @@ then : lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib @@ -15679,8 +14554,8 @@ fi ;; esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -printf "%s\n" "$ld_shlibs_CXX" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX @@ -15718,7 +14593,7 @@ esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. @@ -16200,28 +15075,26 @@ case $host_os in ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -printf %s "checking for $compiler option to produce PIC... " >&6; } -if test ${lt_cv_prog_compiler_pic_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if test ${lt_cv_prog_compiler_pic_works_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -16252,8 +15125,8 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in @@ -16275,12 +15148,11 @@ fi # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test ${lt_cv_prog_compiler_static_works_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" @@ -16304,8 +15176,8 @@ else $as_nop LDFLAGS=$save_LDFLAGS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : @@ -16316,12 +15188,11 @@ fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test ${lt_cv_prog_compiler_c_o_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest @@ -16364,17 +15235,16 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test ${lt_cv_prog_compiler_c_o_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest @@ -16417,8 +15287,8 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } @@ -16426,19 +15296,19 @@ printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -printf %s "checking if we can lock with hard links... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -printf "%s\n" "$hard_links" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } if test no = "$hard_links"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -16447,8 +15317,8 @@ fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' @@ -16487,8 +15357,8 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -printf "%s\n" "$ld_shlibs_CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld @@ -16515,19 +15385,18 @@ x|xyes) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -printf %s "checking whether -lc should be explicitly linked in... " >&6; } -if test ${lt_cv_archive_cmds_need_lc_CXX+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest @@ -16545,7 +15414,7 @@ else $as_nop if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no @@ -16559,8 +15428,8 @@ else $as_nop $RM conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 -printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac @@ -16629,8 +15498,8 @@ esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -printf %s "checking dynamic linker characteristics... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' @@ -17120,10 +15989,9 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if test ${lt_cv_shlibpath_overrides_runpath+y} -then : - printf %s "(cached) " >&6 -else $as_nop + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir @@ -17133,21 +16001,19 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO" -then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null -then : +if ac_fn_cxx_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -17384,8 +16250,8 @@ uts4*) dynamic_linker=no ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -printf "%s\n" "$dynamic_linker" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" @@ -17449,8 +16315,8 @@ configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -printf %s "checking how to hardcode library paths into programs... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || @@ -17474,8 +16340,8 @@ else # directories. hardcode_action_CXX=unsupported fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 -printf "%s\n" "$hardcode_action_CXX" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +$as_echo "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then @@ -17514,81 +16380,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - - - # Find a good install program. We prefer a C program (faster), +# Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -17602,25 +16394,20 @@ printf "%s\n" "$ac_cv_path_EGREP" >&6; } # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -printf %s "checking for a BSD-compatible install... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test ${ac_cv_path_install+y} -then : - printf %s "(cached) " >&6 -else $as_nop +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - # Account for fact that we put trailing slashes in our PATH walk. -case $as_dir in #(( - ./ | /[cC]/* | \ + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -17630,13 +16417,13 @@ case $as_dir in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -17644,12 +16431,12 @@ case $as_dir in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -17665,7 +16452,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test ${ac_cv_path_install+y}; then + if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -17675,8 +16462,8 @@ fi INSTALL=$ac_install_sh fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -printf "%s\n" "$INSTALL" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -17686,14 +16473,13 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval test \${ac_cv_prog_make_${ac_make}_set+y} -then : - printf %s "(cached) " >&6 -else $as_nop +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -17709,12 +16495,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } SET_MAKE= else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -17729,12 +16515,11 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. @@ -17744,15 +16529,11 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -17764,11 +16545,11 @@ esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -printf "%s\n" "$PKG_CONFIG" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -17777,12 +16558,11 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. @@ -17792,15 +16572,11 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -17812,11 +16588,11 @@ esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then @@ -17824,8 +16600,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG @@ -17837,223 +16613,18 @@ fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } PKG_CONFIG="" fi fi -# Check whether --enable-largefile was given. -if test ${enable_largefile+y} -then : - enableval=$enable_largefile; -fi - -if test "$enable_largefile" != no; then - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -printf %s "checking for special C compiler options needed for large files... " >&6; } -if test ${ac_cv_sys_largefile_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_sys_largefile_CC=no - if test "$GCC" != yes; then - ac_save_CC=$CC - while :; do - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF - if ac_fn_c_try_compile "$LINENO" -then : - break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - CC="$CC -n32" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_largefile_CC=' -n32'; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - break - done - CC=$ac_save_CC - rm -f conftest.$ac_ext - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if test ${ac_cv_sys_file_offset_bits+y} -then : - printf %s "(cached) " >&6 -else $as_nop - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_file_offset_bits=no; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _FILE_OFFSET_BITS 64 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_file_offset_bits=64; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cv_sys_file_offset_bits=unknown - break -done -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } -case $ac_cv_sys_file_offset_bits in #( - no | unknown) ;; - *) -printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h -;; -esac -rm -rf conftest* - if test $ac_cv_sys_file_offset_bits = unknown; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } -if test ${ac_cv_sys_large_files+y} -then : - printf %s "(cached) " >&6 -else $as_nop - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_large_files=no; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _LARGE_FILES 1 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_large_files=1; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cv_sys_large_files=unknown - break -done -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -printf "%s\n" "$ac_cv_sys_large_files" >&6; } -case $ac_cv_sys_large_files in #( - no | unknown) ;; - *) -printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h -;; -esac -rm -rf conftest* - fi -fi - - case "$host" in *-*-mingw*) # Except on msys, where make can't handle full pathnames (bug 1972) @@ -18101,28 +16672,27 @@ case "$host" in # We build SDL on cygwin without the UNIX emulation layer save_CFLAGS="$CFLAGS" have_no_cygwin=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mno-cygwin option" >&5 -printf %s "checking for GCC -mno-cygwin option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -mno-cygwin option" >&5 +$as_echo_n "checking for GCC -mno-cygwin option... " >&6; } CFLAGS="$save_CFLAGS -mno-cygwin" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_no_cygwin=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_no_cygwin" >&5 -printf "%s\n" "$have_no_cygwin" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_no_cygwin" >&5 +$as_echo "$have_no_cygwin" >&6; } CFLAGS="$save_CFLAGS" if test x$have_no_cygwin = xyes; then @@ -18194,17 +16764,16 @@ find_lib() done } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -printf %s "checking for an ANSI C-conforming const... " >&6; } -if test ${ac_cv_c_const+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { #ifndef __cplusplus @@ -18217,7 +16786,7 @@ main (void) /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; - /* IBM XL C 1.02.0.0 rejects this. + /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ @@ -18245,7 +16814,7 @@ main (void) iptr p = 0; ++p; } - { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; @@ -18261,50 +16830,47 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes -else $as_nop +else ac_cv_c_const=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -printf "%s\n" "$ac_cv_c_const" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -printf "%s\n" "#define const /**/" >>confdefs.h +$as_echo "#define const /**/" >>confdefs.h fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -printf %s "checking for inline... " >&6; } -if test ${ac_cv_c_inline+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; -static $ac_kw foo_t static_foo (void) {return 0; } -$ac_kw foo_t foo (void) {return 0; } +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } #endif _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -printf "%s\n" "$ac_cv_c_inline" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; @@ -18321,17 +16887,16 @@ _ACEOF ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 -printf %s "checking for working volatile... " >&6; } -if test ${ac_cv_c_volatile+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 +$as_echo_n "checking for working volatile... " >&6; } +if ${ac_cv_c_volatile+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { volatile int x; @@ -18341,28 +16906,26 @@ return !x && !y; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_volatile=yes -else $as_nop +else ac_cv_c_volatile=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 -printf "%s\n" "$ac_cv_c_volatile" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 +$as_echo "$ac_cv_c_volatile" >&6; } if test $ac_cv_c_volatile = no; then -printf "%s\n" "#define volatile /**/" >>confdefs.h +$as_echo "#define volatile /**/" >>confdefs.h fi # Check whether --enable-assertions was given. -if test ${enable_assertions+y} -then : +if test "${enable_assertions+set}" = set; then : enableval=$enable_assertions; -else $as_nop +else enable_assertions=auto fi @@ -18371,22 +16934,22 @@ case "$enable_assertions" in ;; disabled) -printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 0" >>confdefs.h +$as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 0" >>confdefs.h ;; release) -printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 1" >>confdefs.h +$as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 1" >>confdefs.h ;; enabled) -printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 2" >>confdefs.h +$as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 2" >>confdefs.h ;; paranoid) -printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 3" >>confdefs.h +$as_echo "#define SDL_DEFAULT_ASSERT_LEVEL 3" >>confdefs.h ;; *) @@ -18394,28 +16957,17 @@ printf "%s\n" "#define SDL_DEFAULT_ASSERT_LEVEL 3" >>confdefs.h ;; esac - -printf "%s\n" "#define SDL_BUILD_MAJOR_VERSION $SDL_MAJOR_VERSION" >>confdefs.h - - -printf "%s\n" "#define SDL_BUILD_MINOR_VERSION $SDL_MINOR_VERSION" >>confdefs.h - - -printf "%s\n" "#define SDL_BUILD_MICRO_VERSION $SDL_MICRO_VERSION" >>confdefs.h - - # Check whether --enable-dependency-tracking was given. -if test ${enable_dependency_tracking+y} -then : +if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; -else $as_nop +else enable_dependency_tracking=yes fi if test x$enable_dependency_tracking = xyes; then have_gcc_mmd_mt=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -MMD -MT option" >&5 -printf %s "checking for GCC -MMD -MT option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -MMD -MT option" >&5 +$as_echo_n "checking for GCC -MMD -MT option... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -18424,32 +16976,32 @@ printf %s "checking for GCC -MMD -MT option... " >&6; } #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_mmd_mt=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_mmd_mt" >&5 -printf "%s\n" "$have_gcc_mmd_mt" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_mmd_mt" >&5 +$as_echo "$have_gcc_mmd_mt" >&6; } if test x$have_gcc_mmd_mt = xyes; then DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@" fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --no-undefined" >&5 -printf %s "checking for linker option --no-undefined... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --no-undefined" >&5 +$as_echo_n "checking for linker option --no-undefined... " >&6; } have_no_undefined=no case "$host" in - *-*-openbsd*) + *-*-openbsd*) ;; + *) save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--no-undefined" @@ -18457,30 +17009,29 @@ case "$host" in /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_no_undefined=yes BUILD_LDFLAGS="$BUILD_LDFLAGS -Wl,--no-undefined" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_no_undefined" >&5 -printf "%s\n" "$have_no_undefined" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_no_undefined" >&5 +$as_echo "$have_no_undefined" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --dynamicbase" >&5 -printf %s "checking for linker option --dynamicbase... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --dynamicbase" >&5 +$as_echo_n "checking for linker option --dynamicbase... " >&6; } have_dynamicbase=no case "$host" in *) @@ -18490,30 +17041,29 @@ case "$host" in /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_dynamicbase=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--dynamicbase" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_dynamicbase" >&5 -printf "%s\n" "$have_dynamicbase" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dynamicbase" >&5 +$as_echo "$have_dynamicbase" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --nxcompat" >&5 -printf %s "checking for linker option --nxcompat... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --nxcompat" >&5 +$as_echo_n "checking for linker option --nxcompat... " >&6; } have_nxcompat=no case "$host" in *) @@ -18523,30 +17073,29 @@ case "$host" in /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_nxcompat=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--nxcompat" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nxcompat" >&5 -printf "%s\n" "$have_nxcompat" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_nxcompat" >&5 +$as_echo "$have_nxcompat" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --high-entropy-va" >&5 -printf %s "checking for linker option --high-entropy-va... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --high-entropy-va" >&5 +$as_echo_n "checking for linker option --high-entropy-va... " >&6; } have_high_entropy_va=no case "$host" in *) @@ -18556,303 +17105,183 @@ case "$host" in /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_high_entropy_va=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--high-entropy-va" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" ;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_high_entropy_va" >&5 -printf "%s\n" "$have_high_entropy_va" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_high_entropy_va" >&5 +$as_echo "$have_high_entropy_va" >&6; } # Check whether --enable-libc was given. -if test ${enable_libc+y} -then : +if test "${enable_libc+set}" = set; then : enableval=$enable_libc; -else $as_nop +else enable_libc=yes fi if test x$enable_libc = xyes; then -printf "%s\n" "#define HAVE_LIBC 1" >>confdefs.h +$as_echo "#define HAVE_LIBC 1" >>confdefs.h - - ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_types_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default" -if test "x$ac_cv_header_stdio_h" = xyes -then : - printf "%s\n" "#define HAVE_STDIO_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes -then : - printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" -if test "x$ac_cv_header_stddef_h" = xyes -then : - printf "%s\n" "#define HAVE_STDDEF_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" -if test "x$ac_cv_header_stdarg_h" = xyes -then : - printf "%s\n" "#define HAVE_STDARG_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" -if test "x$ac_cv_header_malloc_h" = xyes -then : - printf "%s\n" "#define HAVE_MALLOC_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "memory.h" "ac_cv_header_memory_h" "$ac_includes_default" -if test "x$ac_cv_header_memory_h" = xyes -then : - printf "%s\n" "#define HAVE_MEMORY_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" -if test "x$ac_cv_header_string_h" = xyes -then : - printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" -if test "x$ac_cv_header_strings_h" = xyes -then : - printf "%s\n" "#define HAVE_STRINGS_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" -if test "x$ac_cv_header_wchar_h" = xyes -then : - printf "%s\n" "#define HAVE_WCHAR_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" -if test "x$ac_cv_header_inttypes_h" = xyes -then : - printf "%s\n" "#define HAVE_INTTYPES_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = xyes -then : - printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" -if test "x$ac_cv_header_limits_h" = xyes -then : - printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default" -if test "x$ac_cv_header_ctype_h" = xyes -then : - printf "%s\n" "#define HAVE_CTYPE_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default" -if test "x$ac_cv_header_math_h" = xyes -then : - printf "%s\n" "#define HAVE_MATH_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" -if test "x$ac_cv_header_float_h" = xyes -then : - printf "%s\n" "#define HAVE_FLOAT_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" -if test "x$ac_cv_header_iconv_h" = xyes -then : - printf "%s\n" "#define HAVE_ICONV_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" -if test "x$ac_cv_header_signal_h" = xyes -then : - printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h - -fi - - - ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes -then : - -else $as_nop - -printf "%s\n" "#define size_t unsigned int" >>confdefs.h - -fi - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -printf %s "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test ${ac_cv_prog_CPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CC needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_prog_CPP=$CPP -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -printf "%s\n" "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - Syntax error +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include + _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + + for ac_header in sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi -rm -f conftest.err conftest.i conftest.$ac_ext done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } + + ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for M_PI in math.h" >&5 -printf %s "checking for M_PI in math.h... " >&6; } -if test ${ac_cv_define_M_PI+y} -then : - printf %s "(cached) " >&6 -else $as_nop - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for M_PI in math.h" >&5 +$as_echo_n "checking for M_PI in math.h... " >&6; } +if ${ac_cv_define_M_PI+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -18862,38 +17291,40 @@ YES_IS_DEFINED _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "YES_IS_DEFINED" >/dev/null 2>&1 -then : + $EGREP "YES_IS_DEFINED" >/dev/null 2>&1; then : ac_cv_define_M_PI=yes -else $as_nop +else ac_cv_define_M_PI=no fi -rm -rf conftest* +rm -f conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_define_M_PI" >&5 -printf "%s\n" "$ac_cv_define_M_PI" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_define_M_PI" >&5 +$as_echo "$ac_cv_define_M_PI" >&6; } if test "$ac_cv_define_M_PI" = "yes" ; then -printf "%s\n" "#define HAVE_M_PI /**/" >>confdefs.h +$as_echo "#define HAVE_M_PI /**/" >>confdefs.h fi - # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works + case "$host" in + *-*-cygwin* | *-*-mingw*) + ;; + *) + # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 -printf %s "checking for working alloca.h... " >&6; } -if test ${ac_cv_working_alloca_h+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } +if ${ac_cv_working_alloca_h+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; @@ -18901,52 +17332,52 @@ char *p = (char *) alloca (2 * sizeof (int)); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes -else $as_nop +else ac_cv_working_alloca_h=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 -printf "%s\n" "$ac_cv_working_alloca_h" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then -printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 -printf %s "checking for alloca... " >&6; } -if test ${ac_cv_func_alloca_works+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test $ac_cv_working_alloca_h = yes; then - ac_cv_func_alloca_works=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } +if ${ac_cv_func_alloca_works+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# elif defined _MSC_VER +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER # include # define alloca _alloca # else -# ifdef __cplusplus -extern "C" -# endif +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); +# endif +# endif +# endif # endif #endif int -main (void) +main () { char *p = (char *) alloca (1); if (p) return 0; @@ -18954,22 +17385,20 @@ char *p = (char *) alloca (1); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes -else $as_nop +else ac_cv_func_alloca_works=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 -printf "%s\n" "$ac_cv_func_alloca_works" >&6; } -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then -printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions @@ -18979,19 +17408,58 @@ else ALLOCA=\${LIBOBJDIR}alloca.$ac_objext -printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h +$as_echo "#define C_ALLOCA 1" >>confdefs.h -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 -printf %s "checking stack direction for C alloca... " >&6; } -if test ${ac_cv_c_stack_direction+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } +if ${ac_cv_os_cray+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then : + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 +$as_echo "$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + + done +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } +if ${ac_cv_c_stack_direction+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 -else $as_nop +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default @@ -19012,10 +17480,9 @@ main (int argc, char **argv) return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF -if ac_fn_c_try_run "$LINENO" -then : +if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 -else $as_nop +else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -19023,29 +17490,31 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 -printf "%s\n" "$ac_cv_c_stack_direction" >&6; } -printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF fi + ;; + esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 -printf %s "checking for working memcmp... " >&6; } -if test ${ac_cv_func_memcmp_working+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 +$as_echo_n "checking for working memcmp... " >&6; } +if ${ac_cv_func_memcmp_working+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no -else $as_nop +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main (void) +main () { /* Some versions of memcmp are not 8-bit clean. */ @@ -19076,10 +17545,9 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO" -then : +if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes -else $as_nop +else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -19087,8 +17555,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 -printf "%s\n" "$ac_cv_func_memcmp_working" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 +$as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" @@ -19098,19 +17566,17 @@ esac if test x$ac_cv_func_memcmp_working = xyes; then -printf "%s\n" "#define HAVE_MEMCMP 1" >>confdefs.h +$as_echo "#define HAVE_MEMCMP 1" >>confdefs.h fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 -printf %s "checking for working strtod... " >&6; } -if test ${ac_cv_func_strtod+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5 +$as_echo_n "checking for working strtod... " >&6; } +if ${ac_cv_func_strtod+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : ac_cv_func_strtod=no -else $as_nop +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19119,7 +17585,7 @@ $ac_includes_default double strtod (); #endif int -main (void) +main() { { /* Some versions of Linux strtod mis-parse strings with leading '+'. */ @@ -19144,10 +17610,9 @@ main (void) } _ACEOF -if ac_fn_c_try_run "$LINENO" -then : +if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strtod=yes -else $as_nop +else ac_cv_func_strtod=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -19155,8 +17620,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 -printf "%s\n" "$ac_cv_func_strtod" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5 +$as_echo "$ac_cv_func_strtod" >&6; } if test $ac_cv_func_strtod = no; then case " $LIBOBJS " in *" strtod.$ac_objext "* ) ;; @@ -19165,18 +17630,16 @@ if test $ac_cv_func_strtod = no; then esac ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" -if test "x$ac_cv_func_pow" = xyes -then : +if test "x$ac_cv_func_pow" = xyes; then : fi if test $ac_cv_func_pow = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 -printf %s "checking for pow in -lm... " >&6; } -if test ${ac_cv_lib_m_pow+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 +$as_echo_n "checking for pow in -lm... " >&6; } +if ${ac_cv_lib_m_pow+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19185,33 +17648,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char pow (); int -main (void) +main () { return pow (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_pow=yes -else $as_nop +else ac_cv_lib_m_pow=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 -printf "%s\n" "$ac_cv_lib_m_pow" >&6; } -if test "x$ac_cv_lib_m_pow" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 +$as_echo "$ac_cv_lib_m_pow" >&6; } +if test "x$ac_cv_lib_m_pow" = xyes; then : POW_LIB=-lm -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 -printf "%s\n" "$as_me: WARNING: cannot find library containing definition of pow" >&2;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5 +$as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;} fi fi @@ -19220,12 +17684,11 @@ fi if test x$ac_cv_func_strtod = xyes; then -printf "%s\n" "#define HAVE_STRTOD 1" >>confdefs.h +$as_echo "#define HAVE_STRTOD 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "mprotect" "ac_cv_func_mprotect" -if test "x$ac_cv_func_mprotect" = xyes -then : +if test "x$ac_cv_func_mprotect" = xyes; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19233,458 +17696,41 @@ then : #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -printf "%s\n" "#define HAVE_MPROTECT 1" >>confdefs.h +$as_echo "#define HAVE_MPROTECT 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - ac_fn_c_check_func "$LINENO" "malloc" "ac_cv_func_malloc" -if test "x$ac_cv_func_malloc" = xyes -then : - printf "%s\n" "#define HAVE_MALLOC 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "calloc" "ac_cv_func_calloc" -if test "x$ac_cv_func_calloc" = xyes -then : - printf "%s\n" "#define HAVE_CALLOC 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "realloc" "ac_cv_func_realloc" -if test "x$ac_cv_func_realloc" = xyes -then : - printf "%s\n" "#define HAVE_REALLOC 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "free" "ac_cv_func_free" -if test "x$ac_cv_func_free" = xyes -then : - printf "%s\n" "#define HAVE_FREE 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "getenv" "ac_cv_func_getenv" -if test "x$ac_cv_func_getenv" = xyes -then : - printf "%s\n" "#define HAVE_GETENV 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv" -if test "x$ac_cv_func_setenv" = xyes -then : - printf "%s\n" "#define HAVE_SETENV 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv" -if test "x$ac_cv_func_putenv" = xyes -then : - printf "%s\n" "#define HAVE_PUTENV 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv" -if test "x$ac_cv_func_unsetenv" = xyes -then : - printf "%s\n" "#define HAVE_UNSETENV 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "bsearch" "ac_cv_func_bsearch" -if test "x$ac_cv_func_bsearch" = xyes -then : - printf "%s\n" "#define HAVE_BSEARCH 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "qsort" "ac_cv_func_qsort" -if test "x$ac_cv_func_qsort" = xyes -then : - printf "%s\n" "#define HAVE_QSORT 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "abs" "ac_cv_func_abs" -if test "x$ac_cv_func_abs" = xyes -then : - printf "%s\n" "#define HAVE_ABS 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "bcopy" "ac_cv_func_bcopy" -if test "x$ac_cv_func_bcopy" = xyes -then : - printf "%s\n" "#define HAVE_BCOPY 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" -if test "x$ac_cv_func_memset" = xyes -then : - printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "memcpy" "ac_cv_func_memcpy" -if test "x$ac_cv_func_memcpy" = xyes -then : - printf "%s\n" "#define HAVE_MEMCPY 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes -then : - printf "%s\n" "#define HAVE_MEMMOVE 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcslen" "ac_cv_func_wcslen" -if test "x$ac_cv_func_wcslen" = xyes -then : - printf "%s\n" "#define HAVE_WCSLEN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcslcpy" "ac_cv_func_wcslcpy" -if test "x$ac_cv_func_wcslcpy" = xyes -then : - printf "%s\n" "#define HAVE_WCSLCPY 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcslcat" "ac_cv_func_wcslcat" -if test "x$ac_cv_func_wcslcat" = xyes -then : - printf "%s\n" "#define HAVE_WCSLCAT 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_wcsdup" "ac_cv_func__wcsdup" -if test "x$ac_cv_func__wcsdup" = xyes -then : - printf "%s\n" "#define HAVE__WCSDUP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcsdup" "ac_cv_func_wcsdup" -if test "x$ac_cv_func_wcsdup" = xyes -then : - printf "%s\n" "#define HAVE_WCSDUP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcsstr" "ac_cv_func_wcsstr" -if test "x$ac_cv_func_wcsstr" = xyes -then : - printf "%s\n" "#define HAVE_WCSSTR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcscmp" "ac_cv_func_wcscmp" -if test "x$ac_cv_func_wcscmp" = xyes -then : - printf "%s\n" "#define HAVE_WCSCMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcsncmp" "ac_cv_func_wcsncmp" -if test "x$ac_cv_func_wcsncmp" = xyes -then : - printf "%s\n" "#define HAVE_WCSNCMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcscasecmp" "ac_cv_func_wcscasecmp" -if test "x$ac_cv_func_wcscasecmp" = xyes -then : - printf "%s\n" "#define HAVE_WCSCASECMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_wcsicmp" "ac_cv_func__wcsicmp" -if test "x$ac_cv_func__wcsicmp" = xyes -then : - printf "%s\n" "#define HAVE__WCSICMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "wcsncasecmp" "ac_cv_func_wcsncasecmp" -if test "x$ac_cv_func_wcsncasecmp" = xyes -then : - printf "%s\n" "#define HAVE_WCSNCASECMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_wcsnicmp" "ac_cv_func__wcsnicmp" -if test "x$ac_cv_func__wcsnicmp" = xyes -then : - printf "%s\n" "#define HAVE__WCSNICMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strlen" "ac_cv_func_strlen" -if test "x$ac_cv_func_strlen" = xyes -then : - printf "%s\n" "#define HAVE_STRLEN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" -if test "x$ac_cv_func_strlcpy" = xyes -then : - printf "%s\n" "#define HAVE_STRLCPY 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat" -if test "x$ac_cv_func_strlcat" = xyes -then : - printf "%s\n" "#define HAVE_STRLCAT 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_strrev" "ac_cv_func__strrev" -if test "x$ac_cv_func__strrev" = xyes -then : - printf "%s\n" "#define HAVE__STRREV 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_strupr" "ac_cv_func__strupr" -if test "x$ac_cv_func__strupr" = xyes -then : - printf "%s\n" "#define HAVE__STRUPR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_strlwr" "ac_cv_func__strlwr" -if test "x$ac_cv_func__strlwr" = xyes -then : - printf "%s\n" "#define HAVE__STRLWR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "index" "ac_cv_func_index" -if test "x$ac_cv_func_index" = xyes -then : - printf "%s\n" "#define HAVE_INDEX 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "rindex" "ac_cv_func_rindex" -if test "x$ac_cv_func_rindex" = xyes -then : - printf "%s\n" "#define HAVE_RINDEX 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" -if test "x$ac_cv_func_strchr" = xyes -then : - printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" -if test "x$ac_cv_func_strrchr" = xyes -then : - printf "%s\n" "#define HAVE_STRRCHR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" -if test "x$ac_cv_func_strstr" = xyes -then : - printf "%s\n" "#define HAVE_STRSTR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strtok_r" "ac_cv_func_strtok_r" -if test "x$ac_cv_func_strtok_r" = xyes -then : - printf "%s\n" "#define HAVE_STRTOK_R 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "itoa" "ac_cv_func_itoa" -if test "x$ac_cv_func_itoa" = xyes -then : - printf "%s\n" "#define HAVE_ITOA 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_ltoa" "ac_cv_func__ltoa" -if test "x$ac_cv_func__ltoa" = xyes -then : - printf "%s\n" "#define HAVE__LTOA 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_uitoa" "ac_cv_func__uitoa" -if test "x$ac_cv_func__uitoa" = xyes -then : - printf "%s\n" "#define HAVE__UITOA 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_ultoa" "ac_cv_func__ultoa" -if test "x$ac_cv_func__ultoa" = xyes -then : - printf "%s\n" "#define HAVE__ULTOA 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" -if test "x$ac_cv_func_strtol" = xyes -then : - printf "%s\n" "#define HAVE_STRTOL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" -if test "x$ac_cv_func_strtoul" = xyes -then : - printf "%s\n" "#define HAVE_STRTOUL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_i64toa" "ac_cv_func__i64toa" -if test "x$ac_cv_func__i64toa" = xyes -then : - printf "%s\n" "#define HAVE__I64TOA 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_ui64toa" "ac_cv_func__ui64toa" -if test "x$ac_cv_func__ui64toa" = xyes -then : - printf "%s\n" "#define HAVE__UI64TOA 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strtoll" "ac_cv_func_strtoll" -if test "x$ac_cv_func_strtoll" = xyes -then : - printf "%s\n" "#define HAVE_STRTOLL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strtoull" "ac_cv_func_strtoull" -if test "x$ac_cv_func_strtoull" = xyes -then : - printf "%s\n" "#define HAVE_STRTOULL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "atoi" "ac_cv_func_atoi" -if test "x$ac_cv_func_atoi" = xyes -then : - printf "%s\n" "#define HAVE_ATOI 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "atof" "ac_cv_func_atof" -if test "x$ac_cv_func_atof" = xyes -then : - printf "%s\n" "#define HAVE_ATOF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strcmp" "ac_cv_func_strcmp" -if test "x$ac_cv_func_strcmp" = xyes -then : - printf "%s\n" "#define HAVE_STRCMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strncmp" "ac_cv_func_strncmp" -if test "x$ac_cv_func_strncmp" = xyes -then : - printf "%s\n" "#define HAVE_STRNCMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_stricmp" "ac_cv_func__stricmp" -if test "x$ac_cv_func__stricmp" = xyes -then : - printf "%s\n" "#define HAVE__STRICMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" -if test "x$ac_cv_func_strcasecmp" = xyes -then : - printf "%s\n" "#define HAVE_STRCASECMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_strnicmp" "ac_cv_func__strnicmp" -if test "x$ac_cv_func__strnicmp" = xyes -then : - printf "%s\n" "#define HAVE__STRNICMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "strncasecmp" "ac_cv_func_strncasecmp" -if test "x$ac_cv_func_strncasecmp" = xyes -then : - printf "%s\n" "#define HAVE_STRNCASECMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "vsscanf" "ac_cv_func_vsscanf" -if test "x$ac_cv_func_vsscanf" = xyes -then : - printf "%s\n" "#define HAVE_VSSCANF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" -if test "x$ac_cv_func_vsnprintf" = xyes -then : - printf "%s\n" "#define HAVE_VSNPRINTF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "fopen64" "ac_cv_func_fopen64" -if test "x$ac_cv_func_fopen64" = xyes -then : - printf "%s\n" "#define HAVE_FOPEN64 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "fseeko" "ac_cv_func_fseeko" -if test "x$ac_cv_func_fseeko" = xyes -then : - printf "%s\n" "#define HAVE_FSEEKO 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "fseeko64" "ac_cv_func_fseeko64" -if test "x$ac_cv_func_fseeko64" = xyes -then : - printf "%s\n" "#define HAVE_FSEEKO64 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sigaction" "ac_cv_func_sigaction" -if test "x$ac_cv_func_sigaction" = xyes -then : - printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "setjmp" "ac_cv_func_setjmp" -if test "x$ac_cv_func_setjmp" = xyes -then : - printf "%s\n" "#define HAVE_SETJMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep" -if test "x$ac_cv_func_nanosleep" = xyes -then : - printf "%s\n" "#define HAVE_NANOSLEEP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" -if test "x$ac_cv_func_sysconf" = xyes -then : - printf "%s\n" "#define HAVE_SYSCONF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sysctlbyname" "ac_cv_func_sysctlbyname" -if test "x$ac_cv_func_sysctlbyname" = xyes -then : - printf "%s\n" "#define HAVE_SYSCTLBYNAME 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "getauxval" "ac_cv_func_getauxval" -if test "x$ac_cv_func_getauxval" = xyes -then : - printf "%s\n" "#define HAVE_GETAUXVAL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "elf_aux_info" "ac_cv_func_elf_aux_info" -if test "x$ac_cv_func_elf_aux_info" = xyes -then : - printf "%s\n" "#define HAVE_ELF_AUX_INFO 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" -if test "x$ac_cv_func_poll" = xyes -then : - printf "%s\n" "#define HAVE_POLL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "_Exit" "ac_cv_func__Exit" -if test "x$ac_cv_func__Exit" = xyes -then : - printf "%s\n" "#define HAVE__EXIT 1" >>confdefs.h + for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF fi +done - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 -printf %s "checking for pow in -lm... " >&6; } -if test ${ac_cv_lib_m_pow+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 +$as_echo_n "checking for pow in -lm... " >&6; } +if ${ac_cv_lib_m_pow+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19693,292 +17739,51 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char pow (); int -main (void) +main () { return pow (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_pow=yes -else $as_nop +else ac_cv_lib_m_pow=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 -printf "%s\n" "$ac_cv_lib_m_pow" >&6; } -if test "x$ac_cv_lib_m_pow" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 +$as_echo "$ac_cv_lib_m_pow" >&6; } +if test "x$ac_cv_lib_m_pow" = xyes; then : LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" fi - ac_fn_c_check_func "$LINENO" "acos" "ac_cv_func_acos" -if test "x$ac_cv_func_acos" = xyes -then : - printf "%s\n" "#define HAVE_ACOS 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "acosf" "ac_cv_func_acosf" -if test "x$ac_cv_func_acosf" = xyes -then : - printf "%s\n" "#define HAVE_ACOSF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "asin" "ac_cv_func_asin" -if test "x$ac_cv_func_asin" = xyes -then : - printf "%s\n" "#define HAVE_ASIN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "asinf" "ac_cv_func_asinf" -if test "x$ac_cv_func_asinf" = xyes -then : - printf "%s\n" "#define HAVE_ASINF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "atan" "ac_cv_func_atan" -if test "x$ac_cv_func_atan" = xyes -then : - printf "%s\n" "#define HAVE_ATAN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "atanf" "ac_cv_func_atanf" -if test "x$ac_cv_func_atanf" = xyes -then : - printf "%s\n" "#define HAVE_ATANF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "atan2" "ac_cv_func_atan2" -if test "x$ac_cv_func_atan2" = xyes -then : - printf "%s\n" "#define HAVE_ATAN2 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "atan2f" "ac_cv_func_atan2f" -if test "x$ac_cv_func_atan2f" = xyes -then : - printf "%s\n" "#define HAVE_ATAN2F 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "ceil" "ac_cv_func_ceil" -if test "x$ac_cv_func_ceil" = xyes -then : - printf "%s\n" "#define HAVE_CEIL 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "ceilf" "ac_cv_func_ceilf" -if test "x$ac_cv_func_ceilf" = xyes -then : - printf "%s\n" "#define HAVE_CEILF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "copysign" "ac_cv_func_copysign" -if test "x$ac_cv_func_copysign" = xyes -then : - printf "%s\n" "#define HAVE_COPYSIGN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "copysignf" "ac_cv_func_copysignf" -if test "x$ac_cv_func_copysignf" = xyes -then : - printf "%s\n" "#define HAVE_COPYSIGNF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "cos" "ac_cv_func_cos" -if test "x$ac_cv_func_cos" = xyes -then : - printf "%s\n" "#define HAVE_COS 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "cosf" "ac_cv_func_cosf" -if test "x$ac_cv_func_cosf" = xyes -then : - printf "%s\n" "#define HAVE_COSF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "exp" "ac_cv_func_exp" -if test "x$ac_cv_func_exp" = xyes -then : - printf "%s\n" "#define HAVE_EXP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "expf" "ac_cv_func_expf" -if test "x$ac_cv_func_expf" = xyes -then : - printf "%s\n" "#define HAVE_EXPF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "fabs" "ac_cv_func_fabs" -if test "x$ac_cv_func_fabs" = xyes -then : - printf "%s\n" "#define HAVE_FABS 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "fabsf" "ac_cv_func_fabsf" -if test "x$ac_cv_func_fabsf" = xyes -then : - printf "%s\n" "#define HAVE_FABSF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "floor" "ac_cv_func_floor" -if test "x$ac_cv_func_floor" = xyes -then : - printf "%s\n" "#define HAVE_FLOOR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "floorf" "ac_cv_func_floorf" -if test "x$ac_cv_func_floorf" = xyes -then : - printf "%s\n" "#define HAVE_FLOORF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "trunc" "ac_cv_func_trunc" -if test "x$ac_cv_func_trunc" = xyes -then : - printf "%s\n" "#define HAVE_TRUNC 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "truncf" "ac_cv_func_truncf" -if test "x$ac_cv_func_truncf" = xyes -then : - printf "%s\n" "#define HAVE_TRUNCF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "fmod" "ac_cv_func_fmod" -if test "x$ac_cv_func_fmod" = xyes -then : - printf "%s\n" "#define HAVE_FMOD 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "fmodf" "ac_cv_func_fmodf" -if test "x$ac_cv_func_fmodf" = xyes -then : - printf "%s\n" "#define HAVE_FMODF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "log" "ac_cv_func_log" -if test "x$ac_cv_func_log" = xyes -then : - printf "%s\n" "#define HAVE_LOG 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "logf" "ac_cv_func_logf" -if test "x$ac_cv_func_logf" = xyes -then : - printf "%s\n" "#define HAVE_LOGF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "log10" "ac_cv_func_log10" -if test "x$ac_cv_func_log10" = xyes -then : - printf "%s\n" "#define HAVE_LOG10 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "log10f" "ac_cv_func_log10f" -if test "x$ac_cv_func_log10f" = xyes -then : - printf "%s\n" "#define HAVE_LOG10F 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "lround" "ac_cv_func_lround" -if test "x$ac_cv_func_lround" = xyes -then : - printf "%s\n" "#define HAVE_LROUND 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "lroundf" "ac_cv_func_lroundf" -if test "x$ac_cv_func_lroundf" = xyes -then : - printf "%s\n" "#define HAVE_LROUNDF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow" -if test "x$ac_cv_func_pow" = xyes -then : - printf "%s\n" "#define HAVE_POW 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "powf" "ac_cv_func_powf" -if test "x$ac_cv_func_powf" = xyes -then : - printf "%s\n" "#define HAVE_POWF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "round" "ac_cv_func_round" -if test "x$ac_cv_func_round" = xyes -then : - printf "%s\n" "#define HAVE_ROUND 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "roundf" "ac_cv_func_roundf" -if test "x$ac_cv_func_roundf" = xyes -then : - printf "%s\n" "#define HAVE_ROUNDF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "scalbn" "ac_cv_func_scalbn" -if test "x$ac_cv_func_scalbn" = xyes -then : - printf "%s\n" "#define HAVE_SCALBN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "scalbnf" "ac_cv_func_scalbnf" -if test "x$ac_cv_func_scalbnf" = xyes -then : - printf "%s\n" "#define HAVE_SCALBNF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sin" "ac_cv_func_sin" -if test "x$ac_cv_func_sin" = xyes -then : - printf "%s\n" "#define HAVE_SIN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sinf" "ac_cv_func_sinf" -if test "x$ac_cv_func_sinf" = xyes -then : - printf "%s\n" "#define HAVE_SINF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sqrt" "ac_cv_func_sqrt" -if test "x$ac_cv_func_sqrt" = xyes -then : - printf "%s\n" "#define HAVE_SQRT 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "sqrtf" "ac_cv_func_sqrtf" -if test "x$ac_cv_func_sqrtf" = xyes -then : - printf "%s\n" "#define HAVE_SQRTF 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "tan" "ac_cv_func_tan" -if test "x$ac_cv_func_tan" = xyes -then : - printf "%s\n" "#define HAVE_TAN 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "tanf" "ac_cv_func_tanf" -if test "x$ac_cv_func_tanf" = xyes -then : - printf "%s\n" "#define HAVE_TANF 1" >>confdefs.h + for ac_func in acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF fi +done - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 -printf %s "checking for iconv_open in -liconv... " >&6; } -if test ${ac_cv_lib_iconv_iconv_open+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 +$as_echo_n "checking for iconv_open in -liconv... " >&6; } +if ${ac_cv_lib_iconv_iconv_open+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-liconv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -19987,77 +17792,85 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char iconv_open (); int -main (void) +main () { return iconv_open (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iconv_iconv_open=yes -else $as_nop +else ac_cv_lib_iconv_iconv_open=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv_open" >&5 -printf "%s\n" "$ac_cv_lib_iconv_iconv_open" >&6; } -if test "x$ac_cv_lib_iconv_iconv_open" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv_open" >&5 +$as_echo "$ac_cv_lib_iconv_iconv_open" >&6; } +if test "x$ac_cv_lib_iconv_iconv_open" = xyes; then : LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" fi - ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" -if test "x$ac_cv_func_iconv" = xyes -then : - printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h + for ac_func in iconv +do : + ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" +if test "x$ac_cv_func_iconv" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ICONV 1 +_ACEOF fi +done ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include " -if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes -then : +if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes; then : -printf "%s\n" "#define HAVE_SA_SIGACTION 1" >>confdefs.h +$as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h fi - ac_fn_c_check_header_compile "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default" -if test "x$ac_cv_header_libunwind_h" = xyes -then : - printf "%s\n" "#define HAVE_LIBUNWIND_H 1" >>confdefs.h + for ac_header in libunwind.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default" +if test "x$ac_cv_header_libunwind_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUNWIND_H 1 +_ACEOF fi +done + fi # Check whether --enable-gcc-atomics was given. -if test ${enable_gcc_atomics+y} -then : +if test "${enable_gcc_atomics+set}" = set; then : enableval=$enable_gcc_atomics; -else $as_nop +else enable_gcc_atomics=yes fi if test x$enable_gcc_atomics = xyes; then have_gcc_atomics=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC builtin atomic operations" >&5 -printf %s "checking for GCC builtin atomic operations... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC builtin atomic operations" >&5 +$as_echo_n "checking for GCC builtin atomic operations... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { int a; @@ -20072,18 +17885,17 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_gcc_atomics=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_atomics" >&5 -printf "%s\n" "$have_gcc_atomics" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_atomics" >&5 +$as_echo "$have_gcc_atomics" >&6; } if test x$have_gcc_atomics = xyes; then -printf "%s\n" "#define HAVE_GCC_ATOMICS 1" >>confdefs.h +$as_echo "#define HAVE_GCC_ATOMICS 1" >>confdefs.h else # See if we have the minimum operation needed for GCC atomics @@ -20091,7 +17903,7 @@ printf "%s\n" "#define HAVE_GCC_ATOMICS 1" >>confdefs.h /* end confdefs.h. */ int -main (void) +main () { int a; @@ -20102,15 +17914,14 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_gcc_sync_lock_test_and_set=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test x$have_gcc_sync_lock_test_and_set = xyes; then -printf "%s\n" "#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1" >>confdefs.h +$as_echo "#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1" >>confdefs.h fi fi @@ -20142,296 +17953,244 @@ SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" SOURCES="$SOURCES $srcdir/src/locale/*.c" -case "$host" in - *-*-emscripten*) - default_atomic=no - ;; - *) - default_atomic=yes - ;; -esac - # Check whether --enable-atomic was given. -if test ${enable_atomic+y} -then : +if test "${enable_atomic+set}" = set; then : enableval=$enable_atomic; -else $as_nop - enable_atomic=$default_atomic +else + enable_atomic=yes fi if test x$enable_atomic != xyes; then -printf "%s\n" "#define SDL_ATOMIC_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_ATOMIC_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} atomic" fi # Check whether --enable-audio was given. -if test ${enable_audio+y} -then : +if test "${enable_audio+set}" = set; then : enableval=$enable_audio; -else $as_nop +else enable_audio=yes fi if test x$enable_audio != xyes; then -printf "%s\n" "#define SDL_AUDIO_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} audio" fi # Check whether --enable-video was given. -if test ${enable_video+y} -then : +if test "${enable_video+set}" = set; then : enableval=$enable_video; -else $as_nop +else enable_video=yes fi if test x$enable_video != xyes; then -printf "%s\n" "#define SDL_VIDEO_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} video" fi # Check whether --enable-render was given. -if test ${enable_render+y} -then : +if test "${enable_render+set}" = set; then : enableval=$enable_render; -else $as_nop +else enable_render=yes fi if test x$enable_render != xyes; then -printf "%s\n" "#define SDL_RENDER_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_RENDER_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} render" fi # Check whether --enable-events was given. -if test ${enable_events+y} -then : +if test "${enable_events+set}" = set; then : enableval=$enable_events; -else $as_nop +else enable_events=yes fi if test x$enable_events != xyes; then -printf "%s\n" "#define SDL_EVENTS_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_EVENTS_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} events" fi # Check whether --enable-joystick was given. -if test ${enable_joystick+y} -then : +if test "${enable_joystick+set}" = set; then : enableval=$enable_joystick; -else $as_nop +else enable_joystick=yes fi if test x$enable_joystick != xyes; then -printf "%s\n" "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} joystick" fi # Check whether --enable-haptic was given. -if test ${enable_haptic+y} -then : +if test "${enable_haptic+set}" = set; then : enableval=$enable_haptic; -else $as_nop +else enable_haptic=yes fi if test x$enable_haptic != xyes; then -printf "%s\n" "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} haptic" fi # Check whether --enable-hidapi was given. -if test ${enable_hidapi+y} -then : +if test "${enable_hidapi+set}" = set; then : enableval=$enable_hidapi; -else $as_nop +else enable_hidapi=yes fi if test x$enable_hidapi != xyes; then -printf "%s\n" "#define SDL_HIDAPI_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_HIDAPI_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} hidapi" fi # Check whether --enable-sensor was given. -if test ${enable_sensor+y} -then : +if test "${enable_sensor+set}" = set; then : enableval=$enable_sensor; -else $as_nop +else enable_sensor=yes fi if test x$enable_sensor != xyes; then -printf "%s\n" "#define SDL_SENSOR_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_SENSOR_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} sensor" fi # Check whether --enable-power was given. -if test ${enable_power+y} -then : +if test "${enable_power+set}" = set; then : enableval=$enable_power; -else $as_nop +else enable_power=yes fi if test x$enable_power != xyes; then -printf "%s\n" "#define SDL_POWER_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_POWER_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} power" fi # Check whether --enable-filesystem was given. -if test ${enable_filesystem+y} -then : +if test "${enable_filesystem+set}" = set; then : enableval=$enable_filesystem; -else $as_nop +else enable_filesystem=yes fi if test x$enable_filesystem != xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} filesystem" fi # Check whether --enable-threads was given. -if test ${enable_threads+y} -then : +if test "${enable_threads+set}" = set; then : enableval=$enable_threads; -else $as_nop +else enable_threads=yes fi if test x$enable_threads != xyes; then -printf "%s\n" "#define SDL_THREADS_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_THREADS_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} threads" fi # Check whether --enable-timers was given. -if test ${enable_timers+y} -then : +if test "${enable_timers+set}" = set; then : enableval=$enable_timers; -else $as_nop +else enable_timers=yes fi if test x$enable_timers != xyes; then -printf "%s\n" "#define SDL_TIMERS_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_TIMERS_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} timers" fi # Check whether --enable-file was given. -if test ${enable_file+y} -then : +if test "${enable_file+set}" = set; then : enableval=$enable_file; -else $as_nop +else enable_file=yes fi if test x$enable_file != xyes; then -printf "%s\n" "#define SDL_FILE_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_FILE_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} file" fi -# Check whether --enable-misc was given. -if test ${enable_misc+y} -then : - enableval=$enable_misc; -else $as_nop - enable_misc=yes -fi - -if test x$enable_misc != xyes; then - -printf "%s\n" "#define SDL_MISC_DISABLED 1" >>confdefs.h - -else - SUMMARY_modules="${SUMMARY_modules} misc" -fi -# Check whether --enable-locale was given. -if test ${enable_locale+y} -then : - enableval=$enable_locale; -else $as_nop - enable_locale=yes -fi - -if test x$enable_locale != xyes; then - -printf "%s\n" "#define SDL_LOCALE_DISABLED 1" >>confdefs.h - -else - SUMMARY_modules="${SUMMARY_modules} locale" -fi # Check whether --enable-loadso was given. -if test ${enable_loadso+y} -then : +if test "${enable_loadso+set}" = set; then : enableval=$enable_loadso; -else $as_nop +else enable_loadso=yes fi if test x$enable_loadso != xyes; then -printf "%s\n" "#define SDL_LOADSO_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_LOADSO_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} loadso" fi # Check whether --enable-cpuinfo was given. -if test ${enable_cpuinfo+y} -then : +if test "${enable_cpuinfo+set}" = set; then : enableval=$enable_cpuinfo; -else $as_nop +else enable_cpuinfo=yes fi if test x$enable_cpuinfo != xyes; then -printf "%s\n" "#define SDL_CPUINFO_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_CPUINFO_DISABLED 1" >>confdefs.h else SUMMARY_modules="${SUMMARY_modules} cpuinfo" fi # Check whether --enable-assembly was given. -if test ${enable_assembly+y} -then : +if test "${enable_assembly+set}" = set; then : enableval=$enable_assembly; -else $as_nop +else enable_assembly=yes fi if test x$enable_assembly = xyes; then SUMMARY_modules="${SUMMARY_modules} assembly" + +$as_echo "#define SDL_ASSEMBLY_ROUTINES 1" >>confdefs.h + + # Make sure that we don't generate floating point code that would # cause illegal instruction exceptions on older processors case "$host" in @@ -20448,10 +18207,9 @@ if test x$enable_assembly = xyes; then ;; esac # Check whether --enable-ssemath was given. -if test ${enable_ssemath+y} -then : +if test "${enable_ssemath+set}" = set; then : enableval=$enable_ssemath; -else $as_nop +else enable_ssemath=$default_ssemath fi @@ -20461,19 +18219,18 @@ fi fi fi - # Check whether --enable-mmx was given. -if test ${enable_mmx+y} -then : + # Check whether --enable-mmx was given. +if test "${enable_mmx+set}" = set; then : enableval=$enable_mmx; -else $as_nop +else enable_mmx=yes fi if test x$enable_mmx = xyes; then save_CFLAGS="$CFLAGS" have_gcc_mmx=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mmmx option" >&5 -printf %s "checking for GCC -mmmx option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -mmmx option" >&5 +$as_echo_n "checking for GCC -mmmx option... " >&6; } mmx_CFLAGS="-mmmx" CFLAGS="$save_CFLAGS $mmx_CFLAGS" @@ -20495,20 +18252,19 @@ printf %s "checking for GCC -mmmx option... " >&6; } #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_mmx=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_mmx" >&5 -printf "%s\n" "$have_gcc_mmx" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_mmx" >&5 +$as_echo "$have_gcc_mmx" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_mmx = xyes; then @@ -20518,18 +18274,17 @@ printf "%s\n" "$have_gcc_mmx" >&6; } fi # Check whether --enable-3dnow was given. -if test ${enable_3dnow+y} -then : +if test "${enable_3dnow+set}" = set; then : enableval=$enable_3dnow; -else $as_nop +else enable_3dnow=yes fi if test x$enable_3dnow = xyes; then save_CFLAGS="$CFLAGS" have_gcc_3dnow=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -m3dnow option" >&5 -printf %s "checking for GCC -m3dnow option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -m3dnow option" >&5 +$as_echo_n "checking for GCC -m3dnow option... " >&6; } amd3dnow_CFLAGS="-m3dnow" CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS" @@ -20542,7 +18297,7 @@ printf %s "checking for GCC -m3dnow option... " >&6; } #endif int -main (void) +main () { void *p = 0; @@ -20552,14 +18307,13 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_gcc_3dnow=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_3dnow" >&5 -printf "%s\n" "$have_gcc_3dnow" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_3dnow" >&5 +$as_echo "$have_gcc_3dnow" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_3dnow = xyes; then @@ -20569,18 +18323,17 @@ printf "%s\n" "$have_gcc_3dnow" >&6; } fi # Check whether --enable-sse was given. -if test ${enable_sse+y} -then : +if test "${enable_sse+set}" = set; then : enableval=$enable_sse; -else $as_nop +else enable_sse=yes fi if test x$enable_sse = xyes; then save_CFLAGS="$CFLAGS" have_gcc_sse=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -msse option" >&5 -printf %s "checking for GCC -msse option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse option" >&5 +$as_echo_n "checking for GCC -msse option... " >&6; } sse_CFLAGS="-msse" CFLAGS="$save_CFLAGS $sse_CFLAGS" @@ -20602,20 +18355,19 @@ printf %s "checking for GCC -msse option... " >&6; } #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_sse=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse" >&5 -printf "%s\n" "$have_gcc_sse" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse" >&5 +$as_echo "$have_gcc_sse" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_sse = xyes; then @@ -20625,18 +18377,17 @@ printf "%s\n" "$have_gcc_sse" >&6; } fi # Check whether --enable-sse2 was given. -if test ${enable_sse2+y} -then : +if test "${enable_sse2+set}" = set; then : enableval=$enable_sse2; -else $as_nop +else enable_sse2=$default_ssemath fi if test x$enable_sse2 = xyes; then save_CFLAGS="$CFLAGS" have_gcc_sse2=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -msse2 option" >&5 -printf %s "checking for GCC -msse2 option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse2 option" >&5 +$as_echo_n "checking for GCC -msse2 option... " >&6; } sse2_CFLAGS="-msse2" CFLAGS="$save_CFLAGS $sse2_CFLAGS" @@ -20658,20 +18409,19 @@ printf %s "checking for GCC -msse2 option... " >&6; } #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_sse2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse2" >&5 -printf "%s\n" "$have_gcc_sse2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse2" >&5 +$as_echo "$have_gcc_sse2" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_sse2 = xyes; then @@ -20681,18 +18431,17 @@ printf "%s\n" "$have_gcc_sse2" >&6; } fi # Check whether --enable-sse3 was given. -if test ${enable_sse3+y} -then : +if test "${enable_sse3+set}" = set; then : enableval=$enable_sse3; -else $as_nop +else enable_sse3=$default_ssemath fi if test x$enable_sse3 = xyes; then save_CFLAGS="$CFLAGS" have_gcc_sse3=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -msse3 option" >&5 -printf %s "checking for GCC -msse3 option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse3 option" >&5 +$as_echo_n "checking for GCC -msse3 option... " >&6; } sse3_CFLAGS="-msse3" CFLAGS="$save_CFLAGS $sse3_CFLAGS" @@ -20714,20 +18463,19 @@ printf %s "checking for GCC -msse3 option... " >&6; } #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_sse3=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse3" >&5 -printf "%s\n" "$have_gcc_sse3" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse3" >&5 +$as_echo "$have_gcc_sse3" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_sse3 = xyes; then @@ -20736,39 +18484,37 @@ printf "%s\n" "$have_gcc_sse3" >&6; } fi fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for immintrin.h" >&5 -printf %s "checking for immintrin.h... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for immintrin.h" >&5 +$as_echo_n "checking for immintrin.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_immintrin_h_hdr=yes -else $as_nop +else have_immintrin_h_hdr=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_immintrin_h_hdr" >&5 -printf "%s\n" "$have_immintrin_h_hdr" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_immintrin_h_hdr" >&5 +$as_echo "$have_immintrin_h_hdr" >&6; } if test x$have_immintrin_h_hdr = xyes; then -printf "%s\n" "#define HAVE_IMMINTRIN_H 1" >>confdefs.h +$as_echo "#define HAVE_IMMINTRIN_H 1" >>confdefs.h fi # Check whether --enable-altivec was given. -if test ${enable_altivec+y} -then : +if test "${enable_altivec+set}" = set; then : enableval=$enable_altivec; -else $as_nop +else enable_altivec=yes fi @@ -20779,8 +18525,8 @@ fi altivec_CFLAGS="-maltivec" CFLAGS="$save_CFLAGS $altivec_CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC altivec.h and -maltivec option" >&5 -printf %s "checking for Altivec with GCC altivec.h and -maltivec option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC altivec.h and -maltivec option" >&5 +$as_echo_n "checking for Altivec with GCC altivec.h and -maltivec option... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20790,27 +18536,26 @@ printf %s "checking for Altivec with GCC altivec.h and -maltivec option... " >&6 } int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_altivec=yes have_altivec_h_hdr=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 -printf "%s\n" "$have_gcc_altivec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 +$as_echo "$have_gcc_altivec" >&6; } if test x$have_gcc_altivec = xno; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC -maltivec option" >&5 -printf %s "checking for Altivec with GCC -maltivec option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC -maltivec option" >&5 +$as_echo_n "checking for Altivec with GCC -maltivec option... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20819,25 +18564,24 @@ printf %s "checking for Altivec with GCC -maltivec option... " >&6; } } int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_altivec=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 -printf "%s\n" "$have_gcc_altivec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 +$as_echo "$have_gcc_altivec" >&6; } fi if test x$have_gcc_altivec = xno; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC altivec.h and -faltivec option" >&5 -printf %s "checking for Altivec with GCC altivec.h and -faltivec option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC altivec.h and -faltivec option" >&5 +$as_echo_n "checking for Altivec with GCC altivec.h and -faltivec option... " >&6; } altivec_CFLAGS="-faltivec" CFLAGS="$save_CFLAGS $altivec_CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20849,28 +18593,27 @@ printf %s "checking for Altivec with GCC altivec.h and -faltivec option... " >&6 } int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_altivec=yes have_altivec_h_hdr=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 -printf "%s\n" "$have_gcc_altivec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 +$as_echo "$have_gcc_altivec" >&6; } fi if test x$have_gcc_altivec = xno; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC -faltivec option" >&5 -printf %s "checking for Altivec with GCC -faltivec option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Altivec with GCC -faltivec option" >&5 +$as_echo_n "checking for Altivec with GCC -faltivec option... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20879,30 +18622,29 @@ printf %s "checking for Altivec with GCC -faltivec option... " >&6; } } int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_altivec=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 -printf "%s\n" "$have_gcc_altivec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_altivec" >&5 +$as_echo "$have_gcc_altivec" >&6; } fi CFLAGS="$save_CFLAGS" if test x$have_gcc_altivec = xyes; then -printf "%s\n" "#define SDL_ALTIVEC_BLITTERS 1" >>confdefs.h +$as_echo "#define SDL_ALTIVEC_BLITTERS 1" >>confdefs.h if test x$have_altivec_h_hdr = xyes; then -printf "%s\n" "#define HAVE_ALTIVEC_H 1" >>confdefs.h +$as_echo "#define HAVE_ALTIVEC_H 1" >>confdefs.h fi EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS" @@ -20911,161 +18653,12 @@ printf "%s\n" "#define HAVE_ALTIVEC_H 1" >>confdefs.h fi fi - # Check whether --enable-lsx was given. -if test ${enable_lsx+y} -then : - enableval=$enable_lsx; -else $as_nop - enable_lsx=yes -fi - - if test x$enable_lsx = xyes; then - save_CFLAGS="$CFLAGS" - have_gcc_lsx=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mlsx option" >&5 -printf %s "checking for GCC -mlsx option... " >&6; } - lsx_CFLAGS="-mlsx" - CFLAGS="$save_CFLAGS $lsx_CFLAGS" - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #ifndef __loongarch_sx - #error Assembler CPP flag not enabled - #endif - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_gcc_lsx=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_lsx" >&5 -printf "%s\n" "$have_gcc_lsx" >&6; } - CFLAGS="$save_CFLAGS" - - if test x$have_gcc_lsx = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS" - SUMMARY_math="${SUMMARY_math} lsx" - fi - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lsxintrin.h" >&5 -printf %s "checking for lsxintrin.h... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_lsxintrin_h_hdr=yes -else $as_nop - have_lsxintrin_h_hdr=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lsxintrin_h_hdr" >&5 -printf "%s\n" "$have_lsxintrin_h_hdr" >&6; } - if test x$have_lsxintrin_h_hdr = xyes; then - -printf "%s\n" "#define HAVE_LSXINTRIN_H 1" >>confdefs.h - - fi - - # Check whether --enable-lasx was given. -if test ${enable_lasx+y} -then : - enableval=$enable_lasx; -else $as_nop - enable_LASX=yes -fi - - if test x$enable_LASX = xyes; then - save_CFLAGS="$CFLAGS" - have_gcc_lasx=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mlasx option" >&5 -printf %s "checking for GCC -mlasx option... " >&6; } - lasx_CFLAGS="-mlasx" - CFLAGS="$save_CFLAGS $lasx_CFLAGS" - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #ifndef __loongarch_asx - #error Assembler CPP flag not enabled - #endif - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_gcc_lasx=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_lasx" >&5 -printf "%s\n" "$have_gcc_lasx" >&6; } - CFLAGS="$save_CFLAGS" - - if test x$have_gcc_lasx = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS $lasx_CFLAGS" - SUMMARY_math="${SUMMARY_math} lasx" - fi - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lasxintrin.h" >&5 -printf %s "checking for lasxintrin.h... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_lasxintrin_h_hdr=yes -else $as_nop - have_lasxintrin_h_hdr=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lasxintrin_h_hdr" >&5 -printf "%s\n" "$have_lasxintrin_h_hdr" >&6; } - if test x$have_lasxintrin_h_hdr = xyes; then - -printf "%s\n" "#define HAVE_LASXINTRIN_H 1" >>confdefs.h - - fi - CheckOSS() { # Check whether --enable-oss was given. -if test ${enable_oss+y} -then : +if test "${enable_oss+set}" = set; then : enableval=$enable_oss; -else $as_nop +else enable_oss=maybe fi @@ -21082,8 +18675,8 @@ fi fi if test x$enable_audio = xyes -a x$enable_oss = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OSS audio support" >&5 -printf %s "checking for OSS audio support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSS audio support" >&5 +$as_echo_n "checking for OSS audio support... " >&6; } have_oss=no if test x$have_oss != xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21092,7 +18685,7 @@ printf %s "checking for OSS audio support... " >&6; } #include int -main (void) +main () { int arg = SNDCTL_DSP_SETFRAGMENT; @@ -21101,11 +18694,10 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_oss=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test x$have_oss != xyes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21114,7 +18706,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext #include int -main (void) +main () { int arg = SNDCTL_DSP_SETFRAGMENT; @@ -21123,23 +18715,22 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_oss=yes -printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_oss" >&5 -printf "%s\n" "$have_oss" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_oss" >&5 +$as_echo "$have_oss" >&6; } if test x$have_oss = xyes; then SUMMARY_audio="${SUMMARY_audio} oss" -printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c" have_audio=yes @@ -21156,10 +18747,9 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h CheckALSA() { # Check whether --enable-alsa was given. -if test ${enable_alsa+y} -then : +if test "${enable_alsa+set}" = set; then : enableval=$enable_alsa; -else $as_nop +else enable_alsa=yes fi @@ -21171,44 +18761,41 @@ alsa_found=yes # Check whether --with-alsa-prefix was given. -if test ${with_alsa_prefix+y} -then : +if test "${with_alsa_prefix+set}" = set; then : withval=$with_alsa_prefix; alsa_prefix="$withval" -else $as_nop +else alsa_prefix="" fi # Check whether --with-alsa-inc-prefix was given. -if test ${with_alsa_inc_prefix+y} -then : +if test "${with_alsa_inc_prefix+set}" = set; then : withval=$with_alsa_inc_prefix; alsa_inc_prefix="$withval" -else $as_nop +else alsa_inc_prefix="" fi # Check whether --enable-alsatest was given. -if test ${enable_alsatest+y} -then : +if test "${enable_alsatest+set}" = set; then : enableval=$enable_alsatest; enable_alsatest="$enableval" -else $as_nop +else enable_alsatest=yes fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ALSA CFLAGS" >&5 -printf %s "checking for ALSA CFLAGS... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA CFLAGS" >&5 +$as_echo_n "checking for ALSA CFLAGS... " >&6; } if test "$alsa_inc_prefix" != "" ; then ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" CFLAGS="$CFLAGS -I$alsa_inc_prefix" fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ALSA_CFLAGS" >&5 -printf "%s\n" "$ALSA_CFLAGS" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_CFLAGS" >&5 +$as_echo "$ALSA_CFLAGS" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ALSA LDFLAGS" >&5 -printf %s "checking for ALSA LDFLAGS... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA LDFLAGS" >&5 +$as_echo_n "checking for ALSA LDFLAGS... " >&6; } if test "$alsa_prefix" != "" ; then ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" LDFLAGS="$LDFLAGS $ALSA_LIBS" @@ -21220,12 +18807,12 @@ LIBS=`echo $LIBS | sed 's/-ldl//'` LIBS=`echo $LIBS | sed 's/-lpthread//'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="$ALSA_LIBS $LIBS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5 -printf "%s\n" "$ALSA_LIBS" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5 +$as_echo "$ALSA_LIBS" >&6; } min_alsa_version=1.0.11 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5 -printf %s "checking for libasound headers version >= $min_alsa_version... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5 +$as_echo_n "checking for libasound headers version >= $min_alsa_version... " >&6; } no_alsa="" alsa_min_major_version=`echo $min_alsa_version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` @@ -21246,7 +18833,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #include int -main (void) +main () { /* ensure backward compatibility */ @@ -21285,18 +18872,17 @@ exit(0); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found." >&5 -printf "%s\n" "found." >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not present." >&5 -printf "%s\n" "not present." >&6; } +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found." >&5 +$as_echo "found." >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present." >&5 +$as_echo "not present." >&6; } alsa_found=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21305,12 +18891,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "x$enable_alsatest" = "xyes"; then -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for snd_ctl_open in -lasound" >&5 -printf %s "checking for snd_ctl_open in -lasound... " >&6; } -if test ${ac_cv_lib_asound_snd_ctl_open+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_ctl_open in -lasound" >&5 +$as_echo_n "checking for snd_ctl_open in -lasound... " >&6; } +if ${ac_cv_lib_asound_snd_ctl_open+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lasound $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21319,34 +18904,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char snd_ctl_open (); int -main (void) +main () { return snd_ctl_open (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_asound_snd_ctl_open=yes -else $as_nop +else ac_cv_lib_asound_snd_ctl_open=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_ctl_open" >&5 -printf "%s\n" "$ac_cv_lib_asound_snd_ctl_open" >&6; } -if test "x$ac_cv_lib_asound_snd_ctl_open" = xyes -then : - printf "%s\n" "#define HAVE_LIBASOUND 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_ctl_open" >&5 +$as_echo "$ac_cv_lib_asound_snd_ctl_open" >&6; } +if test "x$ac_cv_lib_asound_snd_ctl_open" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBASOUND 1 +_ACEOF LIBS="-lasound $LIBS" -else $as_nop +else alsa_found=no @@ -21378,30 +18966,31 @@ fi LIBS="$alsa_save_LIBS" if test x$have_alsa = xyes; then # Check whether --enable-alsa-shared was given. -if test ${enable_alsa_shared+y} -then : +if test "${enable_alsa_shared+set}" = set; then : enableval=$enable_alsa_shared; -else $as_nop +else enable_alsa_shared=yes fi alsa_lib=`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -printf "%s\n" "#define SDL_AUDIO_DRIVER_ALSA 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_ALSA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_alsa_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ALSA loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ALSA loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ALSA loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ALSA loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then echo "-- dynamic libasound -> $alsa_lib" -printf "%s\n" "#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC \"$alsa_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "$alsa_lib" +_ACEOF SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)" else @@ -21416,27 +19005,26 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC \"$alsa_lib\"" >>confdefs.h CheckJACK() { # Check whether --enable-jack was given. -if test ${enable_jack+y} -then : +if test "${enable_jack+set}" = set; then : enableval=$enable_jack; -else $as_nop +else enable_jack=yes fi if test x$enable_audio = xyes -a x$enable_jack = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for jack >= 0.125" >&5 -printf %s "checking for jack >= 0.125... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jack >= 0.125" >&5 +$as_echo_n "checking for jack >= 0.125... " >&6; } if test -n "$JACK_CFLAGS"; then pkg_cv_JACK_CFLAGS="$JACK_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 ($PKG_CONFIG --exists --print-errors "jack >= 0.125") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JACK_CFLAGS=`$PKG_CONFIG --cflags "jack >= 0.125" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -21450,10 +19038,10 @@ if test -n "$JACK_LIBS"; then pkg_cv_JACK_LIBS="$JACK_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jack >= 0.125\""; } >&5 ($PKG_CONFIG --exists --print-errors "jack >= 0.125") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JACK_LIBS=`$PKG_CONFIG --libs "jack >= 0.125" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -21467,8 +19055,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -21485,43 +19073,44 @@ fi audio_jack=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } audio_jack=no else JACK_CFLAGS=$pkg_cv_JACK_CFLAGS JACK_LIBS=$pkg_cv_JACK_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } audio_jack=yes fi if test x$audio_jack = xyes; then # Check whether --enable-jack-shared was given. -if test ${enable_jack_shared+y} -then : +if test "${enable_jack_shared+set}" = set; then : enableval=$enable_jack_shared; -else $as_nop +else enable_jack_shared=yes fi jack_lib=`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -printf "%s\n" "#define SDL_AUDIO_DRIVER_JACK 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_JACK 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_jack_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_jack_shared = xyes && test x$jack_lib != x; then echo "-- dynamic libjack -> $jack_lib" -printf "%s\n" "#define SDL_AUDIO_DRIVER_JACK_DYNAMIC \"$jack_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_JACK_DYNAMIC "$jack_lib" +_ACEOF SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" @@ -21544,37 +19133,33 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_JACK_DYNAMIC \"$jack_lib\"" >>confdefs.h CheckESD() { # Check whether --enable-esd was given. -if test ${enable_esd+y} -then : +if test "${enable_esd+set}" = set; then : enableval=$enable_esd; -else $as_nop +else enable_esd=yes fi if test x$enable_audio = xyes -a x$enable_esd = xyes; then # Check whether --with-esd-prefix was given. -if test ${with_esd_prefix+y} -then : +if test "${with_esd_prefix+set}" = set; then : withval=$with_esd_prefix; esd_prefix="$withval" -else $as_nop +else esd_prefix="" fi # Check whether --with-esd-exec-prefix was given. -if test ${with_esd_exec_prefix+y} -then : +if test "${with_esd_exec_prefix+set}" = set; then : withval=$with_esd_exec_prefix; esd_exec_prefix="$withval" -else $as_nop +else esd_exec_prefix="" fi # Check whether --enable-esdtest was given. -if test ${enable_esdtest+y} -then : +if test "${enable_esdtest+set}" = set; then : enableval=$enable_esdtest; -else $as_nop +else enable_esdtest=yes fi @@ -21594,12 +19179,11 @@ fi # Extract the first word of "esd-config", so it can be a program name with args. set dummy esd-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ESD_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ESD_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else case $ESD_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ESD_CONFIG="$ESD_CONFIG" # Let the user override the test with a path. @@ -21609,15 +19193,11 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ESD_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ESD_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -21630,17 +19210,17 @@ esac fi ESD_CONFIG=$ac_cv_path_ESD_CONFIG if test -n "$ESD_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ESD_CONFIG" >&5 -printf "%s\n" "$ESD_CONFIG" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ESD_CONFIG" >&5 +$as_echo "$ESD_CONFIG" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi min_esd_version=0.2.8 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ESD - version >= $min_esd_version" >&5 -printf %s "checking for ESD - version >= $min_esd_version... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ESD - version >= $min_esd_version" >&5 +$as_echo_n "checking for ESD - version >= $min_esd_version... " >&6; } no_esd="" if test "$ESD_CONFIG" = "no" ; then no_esd=yes @@ -21666,10 +19246,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CFLAGS="$CFLAGS $ESD_CFLAGS" LIBS="$LIBS $ESD_LIBS" rm -f conf.esdtest - if test "$cross_compiling" = yes -then : + if test "$cross_compiling" = yes; then : echo $ac_n "cross compiling; assumed OK... $ac_c" -else $as_nop +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21708,10 +19287,9 @@ int main (void) } _ACEOF -if ac_fn_c_try_run "$LINENO" -then : +if ac_fn_c_try_run "$LINENO"; then : -else $as_nop +else no_esd=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -21729,12 +19307,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi fi if test "x$no_esd" = x ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } have_esd=yes else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if test "$ESD_CONFIG" = "no" ; then echo "*** The esd-config script installed by ESD could not be found" echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" @@ -21760,15 +19338,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu #include int -main (void) +main () { return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding ESD or finding the wrong" echo "*** version of ESD. If it is not finding ESD, you'll need to set your" @@ -21778,13 +19355,13 @@ then : echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else $as_nop +else echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means ESD was incorrectly installed" echo "*** or that you have moved ESD since it was installed. In the latter case, you" echo "*** may want to edit the esd-config script: $ESD_CONFIG" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" @@ -21806,30 +19383,31 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x$have_esd = xyes; then # Check whether --enable-esd-shared was given. -if test ${enable_esd_shared+y} -then : +if test "${enable_esd_shared+set}" = set; then : enableval=$enable_esd_shared; -else $as_nop +else enable_esd_shared=yes fi esd_lib=`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_ESD 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_esd_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_esd_shared = xyes && test x$esd_lib != x; then echo "-- dynamic libesd -> $esd_lib" -printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD_DYNAMIC \"$esd_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_ESD_DYNAMIC "$esd_lib" +_ACEOF SUMMARY_audio="${SUMMARY_audio} esd(dynamic)" else @@ -21844,27 +19422,26 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD_DYNAMIC \"$esd_lib\"" >>confdefs.h CheckPipewire() { # Check whether --enable-pipewire was given. -if test ${enable_pipewire+y} -then : +if test "${enable_pipewire+set}" = set; then : enableval=$enable_pipewire; -else $as_nop +else enable_pipewire=yes fi if test x$enable_audio = xyes -a x$enable_pipewire = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpipewire-0.3 >= 0.3.20" >&5 -printf %s "checking for libpipewire-0.3 >= 0.3.20... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpipewire-0.3 >= 0.3.20" >&5 +$as_echo_n "checking for libpipewire-0.3 >= 0.3.20... " >&6; } if test -n "$PIPEWIRE_CFLAGS"; then pkg_cv_PIPEWIRE_CFLAGS="$PIPEWIRE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpipewire-0.3 >= 0.3.20\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpipewire-0.3 >= 0.3.20\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpipewire-0.3 >= 0.3.20") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PIPEWIRE_CFLAGS=`$PKG_CONFIG --cflags "libpipewire-0.3 >= 0.3.20" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -21878,10 +19455,10 @@ if test -n "$PIPEWIRE_LIBS"; then pkg_cv_PIPEWIRE_LIBS="$PIPEWIRE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpipewire-0.3 >= 0.3.20\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpipewire-0.3 >= 0.3.20\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpipewire-0.3 >= 0.3.20") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PIPEWIRE_LIBS=`$PKG_CONFIG --libs "libpipewire-0.3 >= 0.3.20" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -21895,8 +19472,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -21913,43 +19490,44 @@ fi audio_pipewire=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } audio_pipewire=no else PIPEWIRE_CFLAGS=$pkg_cv_PIPEWIRE_CFLAGS PIPEWIRE_LIBS=$pkg_cv_PIPEWIRE_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } audio_pipewire=yes fi if test x$audio_pipewire = xyes; then # Check whether --enable-pipewire-shared was given. -if test ${enable_pipewire_shared+y} -then : +if test "${enable_pipewire_shared+set}" = set; then : enableval=$enable_pipewire_shared; -else $as_nop +else enable_pipewire_shared=yes fi pipewire_lib=`find_lib "libpipewire-0.3.so.*" "$PIPEWIRE_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -printf "%s\n" "#define SDL_AUDIO_DRIVER_PIPEWIRE 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_PIPEWIRE 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/pipewire/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $PIPEWIRE_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_pipewire_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Pipewire loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Pipewire loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Pipewire loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Pipewire loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_pipewire_shared = xyes && test x$pipewire_lib != x; then echo "-- dynamic libpipewire-0.3 -> $pipewire_lib" -printf "%s\n" "#define SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC \"$pipewire_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "$pipewire_lib" +_ACEOF SUMMARY_audio="${SUMMARY_audio} pipewire(dynamic)" else @@ -21964,27 +19542,26 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC \"$pipewire_lib\"" >>co CheckPulseAudio() { # Check whether --enable-pulseaudio was given. -if test ${enable_pulseaudio+y} -then : +if test "${enable_pulseaudio+set}" = set; then : enableval=$enable_pulseaudio; -else $as_nop +else enable_pulseaudio=yes fi if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpulse-simple >= 0.9" >&5 -printf %s "checking for libpulse-simple >= 0.9... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpulse-simple >= 0.9" >&5 +$as_echo_n "checking for libpulse-simple >= 0.9... " >&6; } if test -n "$PULSEAUDIO_CFLAGS"; then pkg_cv_PULSEAUDIO_CFLAGS="$PULSEAUDIO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-simple >= 0.9" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -21998,10 +19575,10 @@ if test -n "$PULSEAUDIO_LIBS"; then pkg_cv_PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-simple >= 0.9" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -22015,8 +19592,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -22033,43 +19610,44 @@ fi audio_pulseaudio=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } audio_pulseaudio=no else PULSEAUDIO_CFLAGS=$pkg_cv_PULSEAUDIO_CFLAGS PULSEAUDIO_LIBS=$pkg_cv_PULSEAUDIO_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } audio_pulseaudio=yes fi if test x$audio_pulseaudio = xyes; then # Check whether --enable-pulseaudio-shared was given. -if test ${enable_pulseaudio_shared+y} -then : +if test "${enable_pulseaudio_shared+set}" = set; then : enableval=$enable_pulseaudio_shared; -else $as_nop +else enable_pulseaudio_shared=yes fi pulseaudio_lib=`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_PULSEAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_pulseaudio_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic PulseAudio loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic PulseAudio loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic PulseAudio loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic PulseAudio loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then echo "-- dynamic libpulse-simple -> $pulseaudio_lib" -printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC \"$pulseaudio_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "$pulseaudio_lib" +_ACEOF SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)" @@ -22092,22 +19670,20 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC \"$pulseaudio_lib\"" CheckARTSC() { # Check whether --enable-arts was given. -if test ${enable_arts+y} -then : +if test "${enable_arts+set}" = set; then : enableval=$enable_arts; -else $as_nop +else enable_arts=yes fi if test x$enable_audio = xyes -a x$enable_arts = xyes; then # Extract the first word of "artsc-config", so it can be a program name with args. set dummy artsc-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ARTSCONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ARTSCONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else case $ARTSCONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ARTSCONFIG="$ARTSCONFIG" # Let the user override the test with a path. @@ -22117,15 +19693,11 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ARTSCONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ARTSCONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -22137,11 +19709,11 @@ esac fi ARTSCONFIG=$ac_cv_path_ARTSCONFIG if test -n "$ARTSCONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ARTSCONFIG" >&5 -printf "%s\n" "$ARTSCONFIG" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ARTSCONFIG" >&5 +$as_echo "$ARTSCONFIG" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -22150,8 +19722,8 @@ fi else ARTS_CFLAGS=`$ARTSCONFIG --cflags` ARTS_LIBS=`$ARTSCONFIG --libs` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for aRts development environment" >&5 -printf %s "checking for aRts development environment... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aRts development environment" >&5 +$as_echo_n "checking for aRts development environment... " >&6; } audio_arts=no save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $ARTS_CFLAGS" @@ -22161,7 +19733,7 @@ printf %s "checking for aRts development environment... " >&6; } #include int -main (void) +main () { arts_stream_t stream; @@ -22170,40 +19742,40 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : audio_arts=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $audio_arts" >&5 -printf "%s\n" "$audio_arts" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $audio_arts" >&5 +$as_echo "$audio_arts" >&6; } if test x$audio_arts = xyes; then # Check whether --enable-arts-shared was given. -if test ${enable_arts_shared+y} -then : +if test "${enable_arts_shared+set}" = set; then : enableval=$enable_arts_shared; -else $as_nop +else enable_arts_shared=yes fi arts_lib=`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` -printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_ARTS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" if test x$have_loadso != xyes && \ test x$enable_arts_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_arts_shared = xyes && test x$arts_lib != x; then echo "-- dynamic libartsc -> $arts_lib" -printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS_DYNAMIC \"$arts_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_ARTS_DYNAMIC "$arts_lib" +_ACEOF SUMMARY_audio="${SUMMARY_audio} arts(dynamic)" else @@ -22219,26 +19791,24 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS_DYNAMIC \"$arts_lib\"" >>confdefs.h CheckNAS() { # Check whether --enable-nas was given. -if test ${enable_nas+y} -then : +if test "${enable_nas+set}" = set; then : enableval=$enable_nas; -else $as_nop +else enable_nas=yes fi if test x$enable_audio = xyes -a x$enable_nas = xyes; then - ac_fn_c_check_header_compile "$LINENO" "audio/audiolib.h" "ac_cv_header_audio_audiolib_h" "$ac_includes_default" -if test "x$ac_cv_header_audio_audiolib_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "audio/audiolib.h" "ac_cv_header_audio_audiolib_h" "$ac_includes_default" +if test "x$ac_cv_header_audio_audiolib_h" = xyes; then : have_nas_hdr=yes fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for AuOpenServer in -laudio" >&5 -printf %s "checking for AuOpenServer in -laudio... " >&6; } -if test ${ac_cv_lib_audio_AuOpenServer+y} -then : - printf %s "(cached) " >&6 -else $as_nop + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AuOpenServer in -laudio" >&5 +$as_echo_n "checking for AuOpenServer in -laudio... " >&6; } +if ${ac_cv_lib_audio_AuOpenServer+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-laudio $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -22247,35 +19817,36 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char AuOpenServer (); int -main (void) +main () { return AuOpenServer (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_audio_AuOpenServer=yes -else $as_nop +else ac_cv_lib_audio_AuOpenServer=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_audio_AuOpenServer" >&5 -printf "%s\n" "$ac_cv_lib_audio_AuOpenServer" >&6; } -if test "x$ac_cv_lib_audio_AuOpenServer" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_audio_AuOpenServer" >&5 +$as_echo "$ac_cv_lib_audio_AuOpenServer" >&6; } +if test "x$ac_cv_lib_audio_AuOpenServer" = xyes; then : have_nas_lib=yes fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for NAS audio support" >&5 -printf %s "checking for NAS audio support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NAS audio support" >&5 +$as_echo_n "checking for NAS audio support... " >&6; } have_nas=no if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then @@ -22289,15 +19860,14 @@ printf %s "checking for NAS audio support... " >&6; } fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5 -printf "%s\n" "$have_nas" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5 +$as_echo "$have_nas" >&6; } if test x$have_nas = xyes; then # Check whether --enable-nas-shared was given. -if test ${enable_nas_shared+y} -then : +if test "${enable_nas_shared+set}" = set; then : enableval=$enable_nas_shared; -else $as_nop +else enable_nas_shared=yes fi @@ -22305,14 +19875,16 @@ fi if test x$have_loadso != xyes && \ test x$enable_nas_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_nas_shared = xyes && test x$nas_lib != x; then echo "-- dynamic libaudio -> $nas_lib" -printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS_DYNAMIC \"$nas_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_NAS_DYNAMIC "$nas_lib" +_ACEOF SUMMARY_audio="${SUMMARY_audio} nas(dynamic)" else @@ -22321,7 +19893,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS_DYNAMIC \"$nas_lib\"" >>confdefs.h fi -printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_NAS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" @@ -22333,26 +19905,24 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS 1" >>confdefs.h CheckSNDIO() { # Check whether --enable-sndio was given. -if test ${enable_sndio+y} -then : +if test "${enable_sndio+set}" = set; then : enableval=$enable_sndio; -else $as_nop +else enable_sndio=yes fi if test x$enable_audio = xyes -a x$enable_sndio = xyes; then - ac_fn_c_check_header_compile "$LINENO" "sndio.h" "ac_cv_header_sndio_h" "$ac_includes_default" -if test "x$ac_cv_header_sndio_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "sndio.h" "ac_cv_header_sndio_h" "$ac_includes_default" +if test "x$ac_cv_header_sndio_h" = xyes; then : have_sndio_hdr=yes fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sio_open in -lsndio" >&5 -printf %s "checking for sio_open in -lsndio... " >&6; } -if test ${ac_cv_lib_sndio_sio_open+y} -then : - printf %s "(cached) " >&6 -else $as_nop + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sio_open in -lsndio" >&5 +$as_echo_n "checking for sio_open in -lsndio... " >&6; } +if ${ac_cv_lib_sndio_sio_open+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lsndio $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -22361,35 +19931,36 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char sio_open (); int -main (void) +main () { return sio_open (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sndio_sio_open=yes -else $as_nop +else ac_cv_lib_sndio_sio_open=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sndio_sio_open" >&5 -printf "%s\n" "$ac_cv_lib_sndio_sio_open" >&6; } -if test "x$ac_cv_lib_sndio_sio_open" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sndio_sio_open" >&5 +$as_echo "$ac_cv_lib_sndio_sio_open" >&6; } +if test "x$ac_cv_lib_sndio_sio_open" = xyes; then : have_sndio_lib=yes fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sndio audio support" >&5 -printf %s "checking for sndio audio support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sndio audio support" >&5 +$as_echo_n "checking for sndio audio support... " >&6; } have_sndio=no if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then @@ -22397,15 +19968,14 @@ printf %s "checking for sndio audio support... " >&6; } SNDIO_LIBS="-lsndio" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_sndio" >&5 -printf "%s\n" "$have_sndio" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sndio" >&5 +$as_echo "$have_sndio" >&6; } if test x$have_sndio = xyes; then # Check whether --enable-sndio-shared was given. -if test ${enable_sndio_shared+y} -then : +if test "${enable_sndio_shared+set}" = set; then : enableval=$enable_sndio_shared; -else $as_nop +else enable_sndio_shared=yes fi @@ -22413,14 +19983,16 @@ fi if test x$have_loadso != xyes && \ test x$enable_sndio_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic sndio loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then echo "-- dynamic libsndio -> $sndio_lib" -printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO_DYNAMIC \"$sndio_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "$sndio_lib" +_ACEOF SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)" else @@ -22429,7 +20001,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO_DYNAMIC \"$sndio_lib\"" >>confdefs fi -printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS" @@ -22441,27 +20013,26 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h CheckFusionSound() { # Check whether --enable-fusionsound was given. -if test ${enable_fusionsound+y} -then : +if test "${enable_fusionsound+set}" = set; then : enableval=$enable_fusionsound; -else $as_nop +else enable_fusionsound=no fi if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fusionsound >= 1.1.1" >&5 -printf %s "checking for fusionsound >= 1.1.1... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fusionsound >= 1.1.1" >&5 +$as_echo_n "checking for fusionsound >= 1.1.1... " >&6; } if test -n "$FUSIONSOUND_CFLAGS"; then pkg_cv_FUSIONSOUND_CFLAGS="$FUSIONSOUND_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags "fusionsound >= 1.1.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -22475,10 +20046,10 @@ if test -n "$FUSIONSOUND_LIBS"; then pkg_cv_FUSIONSOUND_LIBS="$FUSIONSOUND_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FUSIONSOUND_LIBS=`$PKG_CONFIG --libs "fusionsound >= 1.1.1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -22492,8 +20063,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -22510,44 +20081,45 @@ fi fusionsound=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fusionsound=no else FUSIONSOUND_CFLAGS=$pkg_cv_FUSIONSOUND_CFLAGS FUSIONSOUND_LIBS=$pkg_cv_FUSIONSOUND_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fusionsound=yes fi if test x$fusionsound = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" # Check whether --enable-fusionsound-shared was given. -if test ${enable_fusionsound_shared+y} -then : +if test "${enable_fusionsound_shared+set}" = set; then : enableval=$enable_fusionsound_shared; -else $as_nop +else enable_fusionsound_shared=yes fi fusionsound_shared=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 -printf %s "checking for FusionSound dynamic loading support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 +$as_echo_n "checking for FusionSound dynamic loading support... " >&6; } if test x$have_loadso != xyes && \ test x$enable_fusionsound_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_fusionsound_shared = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC \"libfusionsound.so\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" +_ACEOF fusionsound_shared=yes SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" @@ -22555,8 +20127,8 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC \"libfusionsound.so\ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" SUMMARY_audio="${SUMMARY_audio} fusionsound" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 -printf "%s\n" "$fusionsound_shared" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 +$as_echo "$fusionsound_shared" >&6; } have_audio=yes fi @@ -22566,72 +20138,66 @@ printf "%s\n" "$fusionsound_shared" >&6; } CheckDiskAudio() { # Check whether --enable-diskaudio was given. -if test ${enable_diskaudio+y} -then : +if test "${enable_diskaudio+set}" = set; then : enableval=$enable_diskaudio; -else $as_nop +else enable_diskaudio=yes fi if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_DISK 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_DISK 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" SUMMARY_audio="${SUMMARY_audio} disk" - have_audio=yes fi } CheckDummyAudio() { # Check whether --enable-dummyaudio was given. -if test ${enable_dummyaudio+y} -then : +if test "${enable_dummyaudio+set}" = set; then : enableval=$enable_dummyaudio; -else $as_nop +else enable_dummyaudio=yes fi if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" SUMMARY_audio="${SUMMARY_audio} dummy" - have_audio=yes fi } CheckLibSampleRate() { # Check whether --enable-libsamplerate was given. -if test ${enable_libsamplerate+y} -then : +if test "${enable_libsamplerate+set}" = set; then : enableval=$enable_libsamplerate; -else $as_nop +else enable_libsamplerate=yes fi if test x$enable_libsamplerate = xyes; then - ac_fn_c_check_header_compile "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "$ac_includes_default" -if test "x$ac_cv_header_samplerate_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "$ac_includes_default" +if test "x$ac_cv_header_samplerate_h" = xyes; then : have_samplerate_h_hdr=yes -else $as_nop +else have_samplerate_h_hdr=no fi + if test x$have_samplerate_h_hdr = xyes; then -printf "%s\n" "#define HAVE_LIBSAMPLERATE_H 1" >>confdefs.h +$as_echo "#define HAVE_LIBSAMPLERATE_H 1" >>confdefs.h # Check whether --enable-libsamplerate-shared was given. -if test ${enable_libsamplerate_shared+y} -then : +if test "${enable_libsamplerate_shared+set}" = set; then : enableval=$enable_libsamplerate_shared; -else $as_nop +else enable_libsamplerate_shared=yes fi @@ -22640,14 +20206,16 @@ fi if test x$have_loadso != xyes && \ test x$enable_libsamplerate_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then echo "-- dynamic libsamplerate -> $samplerate_lib" -printf "%s\n" "#define SDL_LIBSAMPLERATE_DYNAMIC \"$samplerate_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_LIBSAMPLERATE_DYNAMIC "$samplerate_lib" +_ACEOF else EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" @@ -22659,10 +20227,9 @@ printf "%s\n" "#define SDL_LIBSAMPLERATE_DYNAMIC \"$samplerate_lib\"" >>confdefs CheckARM() { # Check whether --enable-arm-simd was given. -if test ${enable_arm_simd+y} -then : +if test "${enable_arm_simd+set}" = set; then : enableval=$enable_arm_simd; enable_arm_simd=$enableval -else $as_nop +else enable_arm_simd=no fi @@ -22671,8 +20238,8 @@ fi have_arm_simd=no CFLAGS="-x assembler-with-cpp $CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM SIMD" >&5 -printf %s "checking for ARM SIMD... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM SIMD" >&5 +$as_echo_n "checking for ARM SIMD... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22688,19 +20255,18 @@ printf %s "checking for ARM SIMD... " >&6; } uqadd8 r0, r0, r0 _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_arm_simd=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_arm_simd" >&5 -printf "%s\n" "$have_arm_simd" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_arm_simd" >&5 +$as_echo "$have_arm_simd" >&6; } CFLAGS="$save_CFLAGS" if test x$have_arm_simd = xyes; then -printf "%s\n" "#define SDL_ARM_SIMD_BLITTERS 1" >>confdefs.h +$as_echo "#define SDL_ARM_SIMD_BLITTERS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.S" WARN_ABOUT_ARM_SIMD_ASM_MIT="yes" @@ -22711,10 +20277,9 @@ printf "%s\n" "#define SDL_ARM_SIMD_BLITTERS 1" >>confdefs.h CheckNEON() { # Check whether --enable-arm-neon was given. -if test ${enable_arm_neon+y} -then : +if test "${enable_arm_neon+set}" = set; then : enableval=$enable_arm_neon; enable_arm_neon=$enableval -else $as_nop +else enable_arm_neon=no fi @@ -22723,8 +20288,8 @@ fi have_arm_neon=no CFLAGS="-x assembler-with-cpp $CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM NEON" >&5 -printf %s "checking for ARM NEON... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARM NEON" >&5 +$as_echo_n "checking for ARM NEON... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -22742,18 +20307,17 @@ printf %s "checking for ARM NEON... " >&6; } vmovn.u16 d0, q0 _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_arm_neon=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_arm_neon" >&5 -printf "%s\n" "$have_arm_neon" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_arm_neon" >&5 +$as_echo "$have_arm_neon" >&6; } CFLAGS="$save_CFLAGS" if test x$have_arm_neon = xyes; then -printf "%s\n" "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h +$as_echo "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.S" WARN_ABOUT_ARM_NEON_ASM_MIT="yes" @@ -22761,45 +20325,10 @@ printf "%s\n" "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h fi } -CheckObjectiveCARC() -{ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clang -fobjc-arc option" >&5 -printf %s "checking for clang -fobjc-arc option... " >&6; } - have_clang_objc_arc=no - - save_CFLAGS="$CFLAGS" - CFLAGS="$save_CFLAGS -fobjc-arc" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - int x = 0; - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_clang_objc_arc=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_clang_objc_arc" >&5 -printf "%s\n" "$have_clang_objc_arc" >&6; } - CFLAGS="$save_CFLAGS" - - if test x$have_clang_objc_arc = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-arc" - fi -} - CheckVisibilityHidden() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 -printf %s "checking for GCC -fvisibility=hidden option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 +$as_echo_n "checking for GCC -fvisibility=hidden option... " >&6; } have_gcc_fvisibility=no visibility_CFLAGS="-fvisibility=hidden" @@ -22813,20 +20342,19 @@ printf %s "checking for GCC -fvisibility=hidden option... " >&6; } #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_fvisibility=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_fvisibility" >&5 -printf "%s\n" "$have_gcc_fvisibility" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_fvisibility" >&5 +$as_echo "$have_gcc_fvisibility" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_fvisibility = xyes; then @@ -22836,8 +20364,8 @@ printf "%s\n" "$have_gcc_fvisibility" >&6; } CheckNoStrictAliasing() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -fno-strict-aliasing option" >&5 -printf %s "checking for GCC -fno-strict-aliasing option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fno-strict-aliasing option" >&5 +$as_echo_n "checking for GCC -fno-strict-aliasing option... " >&6; } have_gcc_no_strict_aliasing=no save_CFLAGS="$CFLAGS" @@ -22848,20 +20376,19 @@ printf %s "checking for GCC -fno-strict-aliasing option... " >&6; } int x = 0; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_no_strict_aliasing=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_no_strict_aliasing" >&5 -printf "%s\n" "$have_gcc_no_strict_aliasing" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_no_strict_aliasing" >&5 +$as_echo "$have_gcc_no_strict_aliasing" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_no_strict_aliasing = xyes; then @@ -22871,8 +20398,8 @@ printf "%s\n" "$have_gcc_no_strict_aliasing" >&6; } CheckStackBoundary() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mpreferred-stack-boundary option" >&5 -printf %s "checking for GCC -mpreferred-stack-boundary option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -mpreferred-stack-boundary option" >&5 +$as_echo_n "checking for GCC -mpreferred-stack-boundary option... " >&6; } have_gcc_preferred_stack_boundary=no save_CFLAGS="$CFLAGS" @@ -22883,20 +20410,19 @@ printf %s "checking for GCC -mpreferred-stack-boundary option... " >&6; } int x = 0; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_preferred_stack_boundary=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_preferred_stack_boundary" >&5 -printf "%s\n" "$have_gcc_preferred_stack_boundary" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_preferred_stack_boundary" >&5 +$as_echo "$have_gcc_preferred_stack_boundary" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_preferred_stack_boundary = xyes; then @@ -22906,8 +20432,8 @@ printf "%s\n" "$have_gcc_preferred_stack_boundary" >&6; } CheckDeclarationAfterStatement() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 -printf %s "checking for GCC -Wdeclaration-after-statement option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 +$as_echo_n "checking for GCC -Wdeclaration-after-statement option... " >&6; } have_gcc_declaration_after_statement=no save_CFLAGS="$CFLAGS" @@ -22918,20 +20444,19 @@ printf %s "checking for GCC -Wdeclaration-after-statement option... " >&6; } int x = 0; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_declaration_after_statement=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_declaration_after_statement" >&5 -printf "%s\n" "$have_gcc_declaration_after_statement" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_declaration_after_statement" >&5 +$as_echo "$have_gcc_declaration_after_statement" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_declaration_after_statement = xyes; then @@ -22941,8 +20466,8 @@ printf "%s\n" "$have_gcc_declaration_after_statement" >&6; } CheckWarnAll() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5 -printf %s "checking for GCC -Wall option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5 +$as_echo_n "checking for GCC -Wall option... " >&6; } have_gcc_Wall=no save_CFLAGS="$CFLAGS" @@ -22953,35 +20478,34 @@ printf %s "checking for GCC -Wall option... " >&6; } int x = 0; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_gcc_Wall=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_Wall" >&5 -printf "%s\n" "$have_gcc_Wall" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_Wall" >&5 +$as_echo "$have_gcc_Wall" >&6; } CFLAGS="$save_CFLAGS" if test x$have_gcc_Wall = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for necessary GCC -Wno-multichar option" >&5 -printf %s "checking for necessary GCC -Wno-multichar option... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for necessary GCC -Wno-multichar option" >&5 +$as_echo_n "checking for necessary GCC -Wno-multichar option... " >&6; } need_gcc_Wno_multichar=no case "$host" in *-*-haiku*) need_gcc_Wno_multichar=yes ;; esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $need_gcc_Wno_multichar" >&5 -printf "%s\n" "$need_gcc_Wno_multichar" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $need_gcc_Wno_multichar" >&5 +$as_echo "$need_gcc_Wno_multichar" >&6; } if test x$need_gcc_Wno_multichar = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar" fi @@ -22991,52 +20515,49 @@ printf "%s\n" "$need_gcc_Wno_multichar" >&6; } CheckWayland() { # Check whether --enable-video-wayland was given. -if test ${enable_video_wayland+y} -then : +if test "${enable_video_wayland+set}" = set; then : enableval=$enable_video_wayland; -else $as_nop +else enable_video_wayland=yes fi # Check whether --enable-video-wayland-qt-touch was given. -if test ${enable_video_wayland_qt_touch+y} -then : +if test "${enable_video_wayland_qt_touch+set}" = set; then : enableval=$enable_video_wayland_qt_touch; -else $as_nop +else enable_video_wayland_qt_touch=yes fi if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Wayland support" >&5 -printf %s "checking for Wayland support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Wayland support" >&5 +$as_echo_n "checking for Wayland support... " >&6; } video_wayland=no if test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists 'wayland-client >= 1.18' wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then + if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` - if $PKG_CONFIG --exists 'wayland-scanner >= 1.15' -then : + if $PKG_CONFIG --exists 'wayland-scanner >= 1.15'; then : WAYLAND_SCANNER_CODE_MODE=private-code -else $as_nop +else WAYLAND_SCANNER_CODE_MODE=code fi video_wayland=yes fi fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_wayland" >&5 -printf "%s\n" "$video_wayland" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_wayland" >&5 +$as_echo "$video_wayland" >&6; } if test x$video_wayland = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_WAYLAND 1" >>confdefs.h if test x$enable_video_wayland_qt_touch = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h fi @@ -23044,10 +20565,9 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h SOURCES="$SOURCES $WAYLAND_SOURCES" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" # Check whether --enable-wayland-shared was given. -if test ${enable_wayland_shared+y} -then : +if test "${enable_wayland_shared+set}" = set; then : enableval=$enable_wayland_shared; -else $as_nop +else enable_wayland_shared=maybe fi @@ -23057,8 +20577,7 @@ fi wayland_client_lib=`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` wayland_egl_lib=`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` if test x$wayland_egl_lib = x; then - # This works in Ubuntu 13.10, maybe others - wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` + wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` fi wayland_cursor_lib=`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` @@ -23070,8 +20589,8 @@ fi fi if test x$have_loadso != xyes && \ test x$enable_wayland_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Wayland loading" >&2;} enable_wayland_shared=no fi if test x$have_loadso = xyes && \ @@ -23085,16 +20604,24 @@ printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynam echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib" echo "-- dynamic libxkbcommon -> $xkbcommon_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC \"$wayland_client_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "$wayland_client_lib" +_ACEOF -printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL \"$wayland_egl_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "$wayland_egl_lib" +_ACEOF -printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR \"$wayland_cursor_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "$wayland_cursor_lib" +_ACEOF -printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON \"$xkbcommon_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "$xkbcommon_lib" +_ACEOF SUMMARY_video="${SUMMARY_video} wayland(dynamic)" else @@ -23105,118 +20632,58 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON \"$xkbcommon_l have_video=yes # Check whether --enable-libdecor was given. -if test ${enable_libdecor+y} -then : +if test "${enable_libdecor+set}" = set; then : enableval=$enable_libdecor; -else $as_nop +else enable_libdecor=yes fi if test x$enable_libdecor = xyes; then - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libdecor-0" >&5 -printf %s "checking for libdecor-0... " >&6; } - -if test -n "$DECOR_CFLAGS"; then - pkg_cv_DECOR_CFLAGS="$DECOR_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libdecor-0") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_DECOR_CFLAGS=`$PKG_CONFIG --cflags "libdecor-0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdecor support" >&5 +$as_echo_n "checking for libdecor support... " >&6; } + if $PKG_CONFIG --exists libdecor-0; then : + video_libdecor=yes else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$DECOR_LIBS"; then - pkg_cv_DECOR_LIBS="$DECOR_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libdecor-0") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_DECOR_LIBS=`$PKG_CONFIG --libs "libdecor-0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - DECOR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdecor-0" 2>&1` - else - DECOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdecor-0" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$DECOR_PKG_ERRORS" >&5 - - video_libdecor=no -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - video_libdecor=no -else - DECOR_CFLAGS=$pkg_cv_DECOR_CFLAGS - DECOR_LIBS=$pkg_cv_DECOR_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - video_libdecor=yes + video_libdecor=no fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_libdecor" >&5 +$as_echo "$video_libdecor" >&6; } if test x$video_libdecor = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`" -printf "%s\n" "#define HAVE_LIBDECOR_H 1" >>confdefs.h +$as_echo "#define HAVE_LIBDECOR_H 1" >>confdefs.h # Check whether --enable-libdecor-shared was given. -if test ${enable_libdecor_shared+y} -then : +if test "${enable_libdecor_shared+set}" = set; then : enableval=$enable_libdecor_shared; -else $as_nop +else enable_libdecor_shared=yes fi - decor_lib=`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - if test x$enable_wayland_shared != xyes; then enable_libdecor_shared=no fi + + decor_lib=`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` + if test x$have_loadso != xyes && \ test x$enable_libdecor_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&2;} fi + if test x$have_loadso = xyes && \ test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then echo "-- dynamic libdecor -> $decor_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR \"$decor_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "$decor_lib" +_ACEOF else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`" fi fi fi @@ -23234,33 +20701,32 @@ CheckNativeClient() #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -printf "%s\n" "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h -printf "%s\n" "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h -printf "%s\n" "#define HAVE_POW 1" >>confdefs.h +$as_echo "#define HAVE_POW 1" >>confdefs.h -printf "%s\n" "#define HAVE_OPENGLES2 1" >>confdefs.h +$as_echo "#define HAVE_OPENGLES2 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS" @@ -23268,39 +20734,36 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c" SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c" SUMMARY_audio="${SUMMARY_audio} nacl" - have_audio=yes SOURCES="$SOURCES $srcdir/src/video/nacl/*.c" SUMMARY_video="${SUMMARY_video} nacl opengles2" - have_video=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext } CheckRPI() { # Check whether --enable-video-rpi was given. -if test ${enable_video_rpi+y} -then : +if test "${enable_video_rpi+set}" = set; then : enableval=$enable_video_rpi; -else $as_nop +else enable_video_rpi=yes fi if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bcm_host brcmegl" >&5 -printf %s "checking for bcm_host brcmegl... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bcm_host brcmegl" >&5 +$as_echo_n "checking for bcm_host brcmegl... " >&6; } if test -n "$RPI_CFLAGS"; then pkg_cv_RPI_CFLAGS="$RPI_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 ($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_RPI_CFLAGS=`$PKG_CONFIG --cflags "bcm_host brcmegl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -23314,10 +20777,10 @@ if test -n "$RPI_LIBS"; then pkg_cv_RPI_LIBS="$RPI_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5 ($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_RPI_LIBS=`$PKG_CONFIG --libs "bcm_host brcmegl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -23331,8 +20794,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -23349,14 +20812,14 @@ fi video_rpi=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } video_rpi=no else RPI_CFLAGS=$pkg_cv_RPI_CFLAGS RPI_LIBS=$pkg_cv_RPI_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } video_rpi=yes fi @@ -23376,8 +20839,8 @@ fi # Add the Raspberry Pi compiler flags and libraries CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi 2/3" >&5 -printf %s "checking for Raspberry Pi 2/3... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi 2/3" >&5 +$as_echo_n "checking for Raspberry Pi 2/3... " >&6; } have_video_rpi=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23386,7 +20849,7 @@ printf %s "checking for Raspberry Pi 2/3... " >&6; } #include int -main (void) +main () { EGL_DISPMANX_WINDOW_T window; @@ -23396,14 +20859,13 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_video_rpi=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5 -printf "%s\n" "$have_video_rpi" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5 +$as_echo "$have_video_rpi" >&6; } # Restore the compiler flags and libraries CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" @@ -23415,10 +20877,9 @@ printf "%s\n" "$have_video_rpi" >&6; } EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS" SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" -printf "%s\n" "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} rpi" - have_video=yes fi fi } @@ -23426,10 +20887,9 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h CheckX11() { # Check whether --enable-video-x11 was given. -if test ${enable_video_x11+y} -then : +if test "${enable_video_x11+set}" = set; then : enableval=$enable_video_x11; -else $as_nop +else enable_video_x11=yes fi @@ -23446,13 +20906,12 @@ fi fi ;; esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X" >&5 -printf %s "checking for X... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +$as_echo_n "checking for X... " >&6; } # Check whether --with-x was given. -if test ${with_x+y} -then : +if test "${with_x+set}" = set; then : withval=$with_x; fi @@ -23463,10 +20922,9 @@ if test "x$with_x" = xno; then else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( - *,NONE | NONE,*) if test ${ac_cv_have_x+y} -then : - printf %s "(cached) " >&6 -else $as_nop + *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : + $as_echo_n "(cached) " >&6 +else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no @@ -23477,26 +20935,24 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : # We can compile and link X programs with no special options. ac_x_includes= ac_x_libraries= fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" -# If that didn't work, only try xmkmf and file system searches +# If that didn't work, only try xmkmf and filesystem searches # for native compilation. -if test x"$ac_x_includes" = xno && test "$cross_compiling" = no -then : +if test x"$ac_x_includes" = xno && test "$cross_compiling" = no; then : rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir @@ -23586,11 +21042,10 @@ if test "$ac_x_includes" = no; then /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : # We can compile using X headers with no special include directory. ac_x_includes= -else $as_nop +else for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir @@ -23611,21 +21066,20 @@ if test "$ac_x_libraries" = no; then /* end confdefs.h. */ #include int -main (void) +main () { XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= -else $as_nop +else LIBS=$ac_save_LIBS -for ac_dir in `printf "%s\n" "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do @@ -23636,7 +21090,7 @@ do done done fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no @@ -23660,8 +21114,8 @@ fi fi # $with_x != no if test "$have_x" != yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 -printf "%s\n" "$have_x" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +$as_echo "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. @@ -23671,14 +21125,14 @@ else ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 -printf "%s\n" "libraries $x_libraries, headers $x_includes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +$as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. -printf "%s\n" "#define X_DISPLAY_MISSING 1" >>confdefs.h +$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else @@ -23691,8 +21145,8 @@ else X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 -printf %s "checking whether -R must be followed by a space... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 +$as_echo_n "checking whether -R must be followed by a space... " >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" ac_xsave_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes @@ -23700,44 +21154,42 @@ printf %s "checking whether -R must be followed by a space... " >&6; } /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" -else $as_nop +else LIBS="$ac_xsave_LIBS -R $x_libraries" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 -printf "%s\n" "neither works" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 +$as_echo "neither works" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_c_werror_flag=$ac_xsave_c_werror_flag LIBS=$ac_xsave_LIBS @@ -23760,25 +21212,26 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char XOpenDisplay (); int -main (void) +main () { return XOpenDisplay (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 -printf %s "checking for dnet_ntoa in -ldnet... " >&6; } -if test ${ac_cv_lib_dnet_dnet_ntoa+y} -then : - printf %s "(cached) " >&6 -else $as_nop +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 +$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } +if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -23787,39 +21240,39 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char dnet_ntoa (); int -main (void) +main () { return dnet_ntoa (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dnet_dnet_ntoa=yes -else $as_nop +else ac_cv_lib_dnet_dnet_ntoa=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 -printf "%s\n" "$ac_cv_lib_dnet_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } +if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 -printf %s "checking for dnet_ntoa in -ldnet_stub... " >&6; } -if test ${ac_cv_lib_dnet_stub_dnet_ntoa+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 +$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } +if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -23828,35 +21281,36 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char dnet_ntoa (); int -main (void) +main () { return dnet_ntoa (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dnet_stub_dnet_ntoa=yes -else $as_nop +else ac_cv_lib_dnet_stub_dnet_ntoa=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 -printf "%s\n" "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } +if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" @@ -23869,18 +21323,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes -then : +if test "x$ac_cv_func_gethostbyname" = xyes; then : fi if test $ac_cv_func_gethostbyname = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 -printf %s "checking for gethostbyname in -lnsl... " >&6; } -if test ${ac_cv_lib_nsl_gethostbyname+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 +$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } +if ${ac_cv_lib_nsl_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -23889,39 +21341,39 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char gethostbyname (); int -main (void) +main () { return gethostbyname (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes -else $as_nop +else ac_cv_lib_nsl_gethostbyname=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 -printf "%s\n" "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 +$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } +if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 -printf %s "checking for gethostbyname in -lbsd... " >&6; } -if test ${ac_cv_lib_bsd_gethostbyname+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 +$as_echo_n "checking for gethostbyname in -lbsd... " >&6; } +if ${ac_cv_lib_bsd_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -23930,29 +21382,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char gethostbyname (); int -main (void) +main () { return gethostbyname (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bsd_gethostbyname=yes -else $as_nop +else ac_cv_lib_bsd_gethostbyname=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 -printf "%s\n" "$ac_cv_lib_bsd_gethostbyname" >&6; } -if test "x$ac_cv_lib_bsd_gethostbyname" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 +$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } +if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi @@ -23967,18 +21420,16 @@ fi # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = xyes -then : +if test "x$ac_cv_func_connect" = xyes; then : fi if test $ac_cv_func_connect = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 -printf %s "checking for connect in -lsocket... " >&6; } -if test ${ac_cv_lib_socket_connect+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 +$as_echo_n "checking for connect in -lsocket... " >&6; } +if ${ac_cv_lib_socket_connect+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -23987,29 +21438,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char connect (); int -main (void) +main () { return connect (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_connect=yes -else $as_nop +else ac_cv_lib_socket_connect=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 -printf "%s\n" "$ac_cv_lib_socket_connect" >&6; } -if test "x$ac_cv_lib_socket_connect" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 +$as_echo "$ac_cv_lib_socket_connect" >&6; } +if test "x$ac_cv_lib_socket_connect" = xyes; then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi @@ -24017,18 +21469,16 @@ fi # Guillermo Gomez says -lposix is necessary on A/UX. ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" -if test "x$ac_cv_func_remove" = xyes -then : +if test "x$ac_cv_func_remove" = xyes; then : fi if test $ac_cv_func_remove = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 -printf %s "checking for remove in -lposix... " >&6; } -if test ${ac_cv_lib_posix_remove+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 +$as_echo_n "checking for remove in -lposix... " >&6; } +if ${ac_cv_lib_posix_remove+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24037,29 +21487,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char remove (); int -main (void) +main () { return remove (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_posix_remove=yes -else $as_nop +else ac_cv_lib_posix_remove=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 -printf "%s\n" "$ac_cv_lib_posix_remove" >&6; } -if test "x$ac_cv_lib_posix_remove" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 +$as_echo "$ac_cv_lib_posix_remove" >&6; } +if test "x$ac_cv_lib_posix_remove" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi @@ -24067,18 +21518,16 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" -if test "x$ac_cv_func_shmat" = xyes -then : +if test "x$ac_cv_func_shmat" = xyes; then : fi if test $ac_cv_func_shmat = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 -printf %s "checking for shmat in -lipc... " >&6; } -if test ${ac_cv_lib_ipc_shmat+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 +$as_echo_n "checking for shmat in -lipc... " >&6; } +if ${ac_cv_lib_ipc_shmat+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24087,29 +21536,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char shmat (); int -main (void) +main () { return shmat (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ipc_shmat=yes -else $as_nop +else ac_cv_lib_ipc_shmat=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 -printf "%s\n" "$ac_cv_lib_ipc_shmat" >&6; } -if test "x$ac_cv_lib_ipc_shmat" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 +$as_echo "$ac_cv_lib_ipc_shmat" >&6; } +if test "x$ac_cv_lib_ipc_shmat" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi @@ -24125,12 +21575,11 @@ fi # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 -printf %s "checking for IceConnectionNumber in -lICE... " >&6; } -if test ${ac_cv_lib_ICE_IceConnectionNumber+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 +$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } +if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24139,29 +21588,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char IceConnectionNumber (); int -main (void) +main () { return IceConnectionNumber (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ICE_IceConnectionNumber=yes -else $as_nop +else ac_cv_lib_ICE_IceConnectionNumber=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 -printf "%s\n" "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } -if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } +if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi @@ -24171,10 +21621,9 @@ fi if test x$have_x = xyes; then # Check whether --enable-x11-shared was given. -if test ${enable_x11_shared+y} -then : +if test "${enable_x11_shared+set}" = set; then : enableval=$enable_x11_shared; -else $as_nop +else enable_x11_shared=maybe fi @@ -24185,31 +21634,37 @@ fi x11_lib='/opt/X11/lib/libX11.6.dylib' x11ext_lib='/opt/X11/lib/libXext.6.dylib' xcursor_lib='/opt/X11/lib/libXcursor.1.dylib' + xinerama_lib='/opt/X11/lib/libXinerama.1.dylib' xinput_lib='/opt/X11/lib/libXi.6.dylib' xfixes_lib='/opt/X11/lib/libXfixes.3.dylib' xrandr_lib='/opt/X11/lib/libXrandr.2.dylib' xrender_lib='/opt/X11/lib/libXrender.1.dylib' xss_lib='/opt/X11/lib/libXss.1.dylib' + xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib' ;; *-*-openbsd*) x11_lib='libX11.so' x11ext_lib='libXext.so' xcursor_lib='libXcursor.so' + xinerama_lib='libXinerama.so' xinput_lib='libXi.so' xfixes_lib='libXfixes.so' xrandr_lib='libXrandr.so' xrender_lib='libXrender.so' xss_lib='libXss.so' + xvidmode_lib='libXxf86vm.so' ;; *) x11_lib=`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` x11ext_lib=`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xcursor_lib=`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` + xinerama_lib=`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xinput_lib=`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xfixes_lib=`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xrandr_lib=`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xrender_lib=`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` xss_lib=`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` + xvidmode_lib=`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'` ;; esac @@ -24223,13 +21678,13 @@ fi #include " -if test "x$ac_cv_header_X11_extensions_Xext_h" = xyes -then : +if test "x$ac_cv_header_X11_extensions_Xext_h" = xyes; then : have_xext_h_hdr=yes -else $as_nop +else have_xext_h_hdr=no fi + if test x$have_xext_h_hdr != xyes; then as_fn_error $? " *** Missing Xext.h, maybe you need to install the libxext-dev package? @@ -24237,7 +21692,7 @@ fi fi -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/x11/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS" @@ -24250,8 +21705,8 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_X11 1" >>confdefs.h fi if test x$have_loadso != xyes && \ test x$enable_x11_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic X11 loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic X11 loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic X11 loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic X11 loading" >&2;} enable_x11_shared=no fi if test x$have_loadso = xyes && \ @@ -24259,10 +21714,14 @@ printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynam echo "-- dynamic libX11 -> $x11_lib" echo "-- dynamic libX11ext -> $x11ext_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC \"$x11_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC "$x11_lib" +_ACEOF -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT \"$x11ext_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "$x11ext_lib" +_ACEOF SUMMARY_video="${SUMMARY_video} x11(dynamic)" else @@ -24272,8 +21731,8 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT \"$x11ext_lib\"" >>conf fi have_video=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5 -printf %s "checking for XGenericEvent... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5 +$as_echo_n "checking for XGenericEvent... " >&6; } have_XGenericEvent=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24281,7 +21740,7 @@ printf %s "checking for XGenericEvent... " >&6; } #include int -main (void) +main () { Display *display; @@ -24295,25 +21754,23 @@ XFreeEventData(display, cookie); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_XGenericEvent=yes -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_XGenericEvent" >&5 -printf "%s\n" "$have_XGenericEvent" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_XGenericEvent" >&5 +$as_echo "$have_XGenericEvent" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XkbKeycodeToKeysym in -lX11" >&5 -printf %s "checking for XkbKeycodeToKeysym in -lX11... " >&6; } -if test ${ac_cv_lib_X11_XkbKeycodeToKeysym+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XkbKeycodeToKeysym in -lX11" >&5 +$as_echo_n "checking for XkbKeycodeToKeysym in -lX11... " >&6; } +if ${ac_cv_lib_X11_XkbKeycodeToKeysym+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24322,40 +21779,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char XkbKeycodeToKeysym (); int -main (void) +main () { return XkbKeycodeToKeysym (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_X11_XkbKeycodeToKeysym=yes -else $as_nop +else ac_cv_lib_X11_XkbKeycodeToKeysym=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_XkbKeycodeToKeysym" >&5 -printf "%s\n" "$ac_cv_lib_X11_XkbKeycodeToKeysym" >&6; } -if test "x$ac_cv_lib_X11_XkbKeycodeToKeysym" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_XkbKeycodeToKeysym" >&5 +$as_echo "$ac_cv_lib_X11_XkbKeycodeToKeysym" >&6; } +if test "x$ac_cv_lib_X11_XkbKeycodeToKeysym" = xyes; then : -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1" >>confdefs.h fi # Check whether --enable-video-x11-xcursor was given. -if test ${enable_video_x11_xcursor+y} -then : +if test "${enable_video_x11_xcursor+set}" = set; then : enableval=$enable_video_x11_xcursor; -else $as_nop +else enable_video_x11_xcursor=yes fi @@ -24364,27 +21821,28 @@ fi ac_fn_c_check_header_compile "$LINENO" "X11/Xcursor/Xcursor.h" "ac_cv_header_X11_Xcursor_Xcursor_h" "#include " -if test "x$ac_cv_header_X11_Xcursor_Xcursor_h" = xyes -then : +if test "x$ac_cv_header_X11_Xcursor_Xcursor_h" = xyes; then : have_xcursor_h_hdr=yes -else $as_nop +else have_xcursor_h_hdr=no fi + if test x$have_xcursor_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then echo "-- dynamic libXcursor -> $xcursor_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR \"$xcursor_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "$xcursor_lib" +_ACEOF definitely_enable_video_x11_xcursor=yes else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XcursorImageCreate in -lXcursor" >&5 -printf %s "checking for XcursorImageCreate in -lXcursor... " >&6; } -if test ${ac_cv_lib_Xcursor_XcursorImageCreate+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XcursorImageCreate in -lXcursor" >&5 +$as_echo_n "checking for XcursorImageCreate in -lXcursor... " >&6; } +if ${ac_cv_lib_Xcursor_XcursorImageCreate+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lXcursor $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24393,29 +21851,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char XcursorImageCreate (); int -main (void) +main () { return XcursorImageCreate (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xcursor_XcursorImageCreate=yes -else $as_nop +else ac_cv_lib_Xcursor_XcursorImageCreate=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xcursor_XcursorImageCreate" >&5 -printf "%s\n" "$ac_cv_lib_Xcursor_XcursorImageCreate" >&6; } -if test "x$ac_cv_lib_Xcursor_XcursorImageCreate" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xcursor_XcursorImageCreate" >&5 +$as_echo "$ac_cv_lib_Xcursor_XcursorImageCreate" >&6; } +if test "x$ac_cv_lib_Xcursor_XcursorImageCreate" = xyes; then : have_xcursor_lib=yes fi @@ -24428,15 +21887,14 @@ fi fi if test x$definitely_enable_video_x11_xcursor = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XCURSOR 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_XCURSOR 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xcursor" fi # Check whether --enable-video-x11-xdbe was given. -if test ${enable_video_x11_xdbe+y} -then : +if test "${enable_video_x11_xdbe+set}" = set; then : enableval=$enable_video_x11_xdbe; -else $as_nop +else enable_video_x11_xdbe=yes fi @@ -24444,25 +21902,106 @@ fi ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xdbe.h" "ac_cv_header_X11_extensions_Xdbe_h" "#include " -if test "x$ac_cv_header_X11_extensions_Xdbe_h" = xyes -then : +if test "x$ac_cv_header_X11_extensions_Xdbe_h" = xyes; then : have_dbe_h_hdr=yes -else $as_nop +else have_dbe_h_hdr=no fi + if test x$have_dbe_h_hdr = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XDBE 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_XDBE 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xdbe" fi fi + # Check whether --enable-video-x11-xinerama was given. +if test "${enable_video_x11_xinerama+set}" = set; then : + enableval=$enable_video_x11_xinerama; +else + enable_video_x11_xinerama=yes +fi + + if test x$enable_video_x11_xinerama = xyes; then + definitely_enable_video_x11_xinerama=no + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xinerama.h" "ac_cv_header_X11_extensions_Xinerama_h" "#include + +" +if test "x$ac_cv_header_X11_extensions_Xinerama_h" = xyes; then : + have_xinerama_h_hdr=yes +else + have_xinerama_h_hdr=no +fi + + + if test x$have_xinerama_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then + echo "-- dynamic libXinerama -> $xinerama_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "$xinerama_lib" +_ACEOF + + definitely_enable_video_x11_xinerama=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryExtension in -lXinerama" >&5 +$as_echo_n "checking for XineramaQueryExtension in -lXinerama... " >&6; } +if ${ac_cv_lib_Xinerama_XineramaQueryExtension+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXinerama $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XineramaQueryExtension (); +int +main () +{ +return XineramaQueryExtension (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_Xinerama_XineramaQueryExtension=yes +else + ac_cv_lib_Xinerama_XineramaQueryExtension=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xinerama_XineramaQueryExtension" >&5 +$as_echo "$ac_cv_lib_Xinerama_XineramaQueryExtension" >&6; } +if test "x$ac_cv_lib_Xinerama_XineramaQueryExtension" = xyes; then : + have_xinerama_lib=yes +fi + + if test x$have_xinerama_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama" + definitely_enable_video_x11_xinerama=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_xinerama = xyes; then + +$as_echo "#define SDL_VIDEO_DRIVER_X11_XINERAMA 1" >>confdefs.h + + SUMMARY_video_x11="${SUMMARY_video_x11} xinerama" + fi # Check whether --enable-video-x11-xinput was given. -if test ${enable_video_x11_xinput+y} -then : +if test "${enable_video_x11_xinput+set}" = set; then : enableval=$enable_video_x11_xinput; -else $as_nop +else enable_video_x11_xinput=yes fi @@ -24471,27 +22010,28 @@ fi ac_fn_c_check_header_compile "$LINENO" "X11/extensions/XInput2.h" "ac_cv_header_X11_extensions_XInput2_h" "#include " -if test "x$ac_cv_header_X11_extensions_XInput2_h" = xyes -then : +if test "x$ac_cv_header_X11_extensions_XInput2_h" = xyes; then : have_xinput_h_hdr=yes -else $as_nop +else have_xinput_h_hdr=no fi + if test x$have_xinput_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then echo "-- dynamic libXi -> $xinput_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 \"$xinput_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "$xinput_lib" +_ACEOF definitely_enable_video_x11_xinput=yes else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XOpenDevice in -lXi" >&5 -printf %s "checking for XOpenDevice in -lXi... " >&6; } -if test ${ac_cv_lib_Xi_XOpenDevice+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XOpenDevice in -lXi" >&5 +$as_echo_n "checking for XOpenDevice in -lXi... " >&6; } +if ${ac_cv_lib_Xi_XOpenDevice+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lXi $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24500,29 +22040,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char XOpenDevice (); int -main (void) +main () { return XOpenDevice (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xi_XOpenDevice=yes -else $as_nop +else ac_cv_lib_Xi_XOpenDevice=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xi_XOpenDevice" >&5 -printf "%s\n" "$ac_cv_lib_Xi_XOpenDevice" >&6; } -if test "x$ac_cv_lib_Xi_XOpenDevice" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xi_XOpenDevice" >&5 +$as_echo "$ac_cv_lib_Xi_XOpenDevice" >&6; } +if test "x$ac_cv_lib_Xi_XOpenDevice" = xyes; then : have_xinput_lib=yes fi @@ -24536,10 +22077,10 @@ fi if test x$definitely_enable_video_x11_xinput = xyes; then SUMMARY_video_x11="${SUMMARY_video_x11} xinput2" -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XINPUT2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for xinput2 multitouch" >&5 -printf %s "checking for xinput2 multitouch... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xinput2 multitouch" >&5 +$as_echo_n "checking for xinput2 multitouch... " >&6; } have_xinput2_multitouch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24549,7 +22090,7 @@ printf %s "checking for xinput2 multitouch... " >&6; } #include int -main (void) +main () { int event_type = XI_TouchBegin; @@ -24559,33 +22100,31 @@ XITouchClassInfo *t; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_xinput2_multitouch=yes -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput2_multitouch" >&5 -printf "%s\n" "$have_xinput2_multitouch" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput2_multitouch" >&5 +$as_echo "$have_xinput2_multitouch" >&6; } fi # Check whether --enable-video-x11-xfixes was given. -if test ${enable_video_x11_xfixes+y} -then : +if test "${enable_video_x11_xfixes+set}" = set; then : enableval=$enable_video_x11_xfixes; -else $as_nop +else enable_video_x11_xfixes=yes fi if test x$enable_video_x11_xfixes = xyes; then definitely_enable_video_x11_xfixes=no # check along with XInput2.h because we use Xfixes with XIBarrierReleasePointer - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X11/extensions/Xfixes.h" >&5 -printf %s "checking for X11/extensions/Xfixes.h... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X11/extensions/Xfixes.h" >&5 +$as_echo_n "checking for X11/extensions/Xfixes.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24594,36 +22133,36 @@ printf %s "checking for X11/extensions/Xfixes.h... " >&6; } #include #include int -main (void) +main () { BarrierEventID b; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_xfixes_h_hdr=yes -else $as_nop +else have_xfixes_h_hdr=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xfixes_h_hdr" >&5 -printf "%s\n" "$have_xfixes_h_hdr" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xfixes_h_hdr" >&5 +$as_echo "$have_xfixes_h_hdr" >&6; } if test x$have_xfixes_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xfixes_lib != x ; then echo "-- dynamic libXfixes -> $xfixes_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES \"$xfixes_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES "$xfixes_lib" +_ACEOF definitely_enable_video_x11_xfixes=yes else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XFixesCreatePointerBarrier in -lXfixes" >&5 -printf %s "checking for XFixesCreatePointerBarrier in -lXfixes... " >&6; } -if test ${ac_cv_lib_Xfixes_XFixesCreatePointerBarrier+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XFixesCreatePointerBarrier in -lXfixes" >&5 +$as_echo_n "checking for XFixesCreatePointerBarrier in -lXfixes... " >&6; } +if ${ac_cv_lib_Xfixes_XFixesCreatePointerBarrier+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lXfixes $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24632,29 +22171,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char XFixesCreatePointerBarrier (); int -main (void) +main () { return XFixesCreatePointerBarrier (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xfixes_XFixesCreatePointerBarrier=yes -else $as_nop +else ac_cv_lib_Xfixes_XFixesCreatePointerBarrier=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" >&5 -printf "%s\n" "$ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" >&6; } -if test "x$ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" >&5 +$as_echo "$ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" >&6; } +if test "x$ac_cv_lib_Xfixes_XFixesCreatePointerBarrier" = xyes; then : have_xfixes_lib=yes fi @@ -24667,20 +22207,19 @@ fi fi if test x$definitely_enable_video_x11_xfixes = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XFIXES 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_XFIXES 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xfixes" fi # Check whether --enable-video-x11-xrandr was given. -if test ${enable_video_x11_xrandr+y} -then : +if test "${enable_video_x11_xrandr+set}" = set; then : enableval=$enable_video_x11_xrandr; -else $as_nop +else enable_video_x11_xrandr=yes fi if test x$enable_video_x11_xrandr = xyes; then - definitely_enable_video_x11_xrandr=no + definitely_enable_video_x11_xrandr=no have_xrandr_h_hdr=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24689,7 +22228,7 @@ fi #include int -main (void) +main () { XRRScreenResources *res = NULL; @@ -24698,25 +22237,25 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_xrandr_h_hdr=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test x$have_xrandr_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then echo "-- dynamic libXrandr -> $xrandr_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR \"$xrandr_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "$xrandr_lib" +_ACEOF definitely_enable_video_x11_xrandr=yes else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XRRQueryExtension in -lXrandr" >&5 -printf %s "checking for XRRQueryExtension in -lXrandr... " >&6; } -if test ${ac_cv_lib_Xrandr_XRRQueryExtension+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRQueryExtension in -lXrandr" >&5 +$as_echo_n "checking for XRRQueryExtension in -lXrandr... " >&6; } +if ${ac_cv_lib_Xrandr_XRRQueryExtension+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lXrandr $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24725,29 +22264,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char XRRQueryExtension (); int -main (void) +main () { return XRRQueryExtension (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xrandr_XRRQueryExtension=yes -else $as_nop +else ac_cv_lib_Xrandr_XRRQueryExtension=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrandr_XRRQueryExtension" >&5 -printf "%s\n" "$ac_cv_lib_Xrandr_XRRQueryExtension" >&6; } -if test "x$ac_cv_lib_Xrandr_XRRQueryExtension" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrandr_XRRQueryExtension" >&5 +$as_echo "$ac_cv_lib_Xrandr_XRRQueryExtension" >&6; } +if test "x$ac_cv_lib_Xrandr_XRRQueryExtension" = xyes; then : have_xrandr_lib=yes fi @@ -24760,15 +22300,14 @@ fi fi if test x$definitely_enable_video_x11_xrandr = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XRANDR 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_XRANDR 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xrandr" fi # Check whether --enable-video-x11-scrnsaver was given. -if test ${enable_video_x11_scrnsaver+y} -then : +if test "${enable_video_x11_scrnsaver+set}" = set; then : enableval=$enable_video_x11_scrnsaver; -else $as_nop +else enable_video_x11_scrnsaver=yes fi @@ -24776,27 +22315,28 @@ fi ac_fn_c_check_header_compile "$LINENO" "X11/extensions/scrnsaver.h" "ac_cv_header_X11_extensions_scrnsaver_h" "#include " -if test "x$ac_cv_header_X11_extensions_scrnsaver_h" = xyes -then : +if test "x$ac_cv_header_X11_extensions_scrnsaver_h" = xyes; then : have_scrnsaver_h_hdr=yes -else $as_nop +else have_scrnsaver_h_hdr=no fi + if test x$have_scrnsaver_h_hdr = xyes; then if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then echo "-- dynamic libXss -> $xss_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS \"$xss_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "$xss_lib" +_ACEOF definitely_enable_video_x11_scrnsaver=yes else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverSuspend in -lXss" >&5 -printf %s "checking for XScreenSaverSuspend in -lXss... " >&6; } -if test ${ac_cv_lib_Xss_XScreenSaverSuspend+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverSuspend in -lXss" >&5 +$as_echo_n "checking for XScreenSaverSuspend in -lXss... " >&6; } +if ${ac_cv_lib_Xss_XScreenSaverSuspend+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lXss $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24805,29 +22345,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char XScreenSaverSuspend (); int -main (void) +main () { return XScreenSaverSuspend (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xss_XScreenSaverSuspend=yes -else $as_nop +else ac_cv_lib_Xss_XScreenSaverSuspend=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xss_XScreenSaverSuspend" >&5 -printf "%s\n" "$ac_cv_lib_Xss_XScreenSaverSuspend" >&6; } -if test "x$ac_cv_lib_Xss_XScreenSaverSuspend" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xss_XScreenSaverSuspend" >&5 +$as_echo "$ac_cv_lib_Xss_XScreenSaverSuspend" >&6; } +if test "x$ac_cv_lib_Xss_XScreenSaverSuspend" = xyes; then : have_xss_lib=yes fi @@ -24840,15 +22381,14 @@ fi fi if test x$definitely_enable_video_x11_scrnsaver = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver" fi # Check whether --enable-video-x11-xshape was given. -if test ${enable_video_x11_xshape+y} -then : +if test "${enable_video_x11_xshape+set}" = set; then : enableval=$enable_video_x11_xshape; -else $as_nop +else enable_video_x11_xshape=yes fi @@ -24856,20 +22396,102 @@ fi ac_fn_c_check_header_compile "$LINENO" "X11/extensions/shape.h" "ac_cv_header_X11_extensions_shape_h" "#include " -if test "x$ac_cv_header_X11_extensions_shape_h" = xyes -then : +if test "x$ac_cv_header_X11_extensions_shape_h" = xyes; then : have_shape_h_hdr=yes -else $as_nop +else have_shape_h_hdr=no fi + if test x$have_shape_h_hdr = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XSHAPE 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_X11_XSHAPE 1" >>confdefs.h SUMMARY_video_x11="${SUMMARY_video_x11} xshape" fi fi + # Check whether --enable-video-x11-vm was given. +if test "${enable_video_x11_vm+set}" = set; then : + enableval=$enable_video_x11_vm; +else + enable_video_x11_vm=yes +fi + + if test x$enable_video_x11_vm = xyes; then + definitely_enable_video_x11_vm=no + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "#include + +" +if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then : + have_vm_h_hdr=yes +else + have_vm_h_hdr=no +fi + + + if test x$have_vm_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then + echo "-- dynamic libXxf86vm -> $xvidmode_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "$xvidmode_lib" +_ACEOF + + definitely_enable_video_x11_vm=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeQueryVersion in -lXxf86vm" >&5 +$as_echo_n "checking for XF86VidModeQueryVersion in -lXxf86vm... " >&6; } +if ${ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXxf86vm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XF86VidModeQueryVersion (); +int +main () +{ +return XF86VidModeQueryVersion (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion=yes +else + ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" >&5 +$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" >&6; } +if test "x$ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" = xyes; then : + have_vm_lib=yes +fi + + if test x$have_vm_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm" + definitely_enable_video_x11_vm=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_vm = xyes; then + +$as_echo "#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1" >>confdefs.h + + SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode" + fi fi fi if test x$have_x != xyes; then @@ -24881,16 +22503,15 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_X11_XSHAPE 1" >>confdefs.h CheckVivanteVideo() { # Check whether --enable-video-vivante was given. -if test ${enable_video_vivante+y} -then : +if test "${enable_video_vivante+set}" = set; then : enableval=$enable_video_vivante; -else $as_nop +else enable_video_vivante=yes fi if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Vivante VDK API" >&5 -printf %s "checking for Vivante VDK API... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Vivante VDK API" >&5 +$as_echo_n "checking for Vivante VDK API... " >&6; } have_vivante_vdk=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24900,23 +22521,22 @@ printf %s "checking for Vivante VDK API... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_vivante_vdk=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_vivante_vdk" >&5 -printf "%s\n" "$have_vivante_vdk" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_vivante_vdk" >&5 +$as_echo "$have_vivante_vdk" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Vivante FB API" >&5 -printf %s "checking for Vivante FB API... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Vivante FB API" >&5 +$as_echo_n "checking for Vivante FB API... " >&6; } have_vivante_egl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24926,29 +22546,28 @@ printf %s "checking for Vivante FB API... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_vivante_egl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_vivante_egl" >&5 -printf "%s\n" "$have_vivante_egl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_vivante_egl" >&5 +$as_echo "$have_vivante_egl" >&6; } if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_VIVANTE 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_VIVANTE 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB" if test x$have_vivante_vdk = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_VIVANTE_VDK 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_VIVANTE_VDK 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK" fi @@ -24963,7 +22582,7 @@ CheckHaikuVideo() { if test x$enable_video = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_HAIKU 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc" have_video=yes @@ -24974,18 +22593,17 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_HAIKU 1" >>confdefs.h CheckCOCOA() { # Check whether --enable-video-cocoa was given. -if test ${enable_video_cocoa+y} -then : +if test "${enable_video_cocoa+set}" = set; then : enableval=$enable_video_cocoa; -else $as_nop +else enable_video_cocoa=yes fi if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -x objective-c" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Cocoa framework" >&5 -printf %s "checking for Cocoa framework... " >&6; } + CFLAGS="$CFLAGS -x objective-c" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cocoa framework" >&5 +$as_echo_n "checking for Cocoa framework... " >&6; } have_cocoa=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24993,24 +22611,23 @@ printf %s "checking for Cocoa framework... " >&6; } #import int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_cocoa=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_cocoa" >&5 -printf "%s\n" "$have_cocoa" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_cocoa" >&5 +$as_echo "$have_cocoa" >&6; } CFLAGS="$save_CFLAGS" if test x$have_cocoa = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m" SUMMARY_video="${SUMMARY_video} cocoa" @@ -25022,26 +22639,24 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h CheckMETAL() { # Check whether --enable-video-metal was given. -if test ${enable_video_metal+y} -then : +if test "${enable_video_metal+set}" = set; then : enableval=$enable_video_metal; -else $as_nop +else enable_video_metal=yes fi # Check whether --enable-render-metal was given. -if test ${enable_render_metal+y} -then : +if test "${enable_render_metal+set}" = set; then : enableval=$enable_render_metal; -else $as_nop +else enable_render_metal=yes fi if test x$enable_video = xyes -a x$enable_video_metal = xyes; then save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -x objective-c" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5 -printf %s "checking for Metal framework... " >&6; } + CFLAGS="$CFLAGS -x objective-c" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5 +$as_echo_n "checking for Metal framework... " >&6; } have_metal=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25055,28 +22670,27 @@ printf %s "checking for Metal framework... " >&6; } #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_metal=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_metal" >&5 -printf "%s\n" "$have_metal" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_metal" >&5 +$as_echo "$have_metal" >&6; } if test x$have_metal = xyes; then -printf "%s\n" "#define SDL_VIDEO_METAL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_METAL 1" >>confdefs.h if test x$enable_render = xyes -a x$enable_render_metal = xyes; then -printf "%s\n" "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/render/metal/*.m" fi @@ -25091,27 +22705,26 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h CheckDirectFB() { # Check whether --enable-video-directfb was given. -if test ${enable_video_directfb+y} -then : +if test "${enable_video_directfb+set}" = set; then : enableval=$enable_video_directfb; -else $as_nop +else enable_video_directfb=no fi if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for directfb >= 1.0.0" >&5 -printf %s "checking for directfb >= 1.0.0... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for directfb >= 1.0.0" >&5 +$as_echo_n "checking for directfb >= 1.0.0... " >&6; } if test -n "$DIRECTFB_CFLAGS"; then pkg_cv_DIRECTFB_CFLAGS="$DIRECTFB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags "directfb >= 1.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -25125,10 +22738,10 @@ if test -n "$DIRECTFB_LIBS"; then pkg_cv_DIRECTFB_LIBS="$DIRECTFB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DIRECTFB_LIBS=`$PKG_CONFIG --libs "directfb >= 1.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -25142,8 +22755,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -25160,14 +22773,14 @@ fi video_directfb=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } video_directfb=no else DIRECTFB_CFLAGS=$pkg_cv_DIRECTFB_CFLAGS DIRECTFB_LIBS=$pkg_cv_DIRECTFB_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } video_directfb=yes fi @@ -25175,33 +22788,32 @@ fi # SuSE 11.1 installs directfb-config without directfb-devel save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS" - ac_fn_c_check_header_compile "$LINENO" "directfb.h" "ac_cv_header_directfb_h" "$ac_includes_default" -if test "x$ac_cv_header_directfb_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "directfb.h" "ac_cv_header_directfb_h" "$ac_includes_default" +if test "x$ac_cv_header_directfb_h" = xyes; then : have_directfb_hdr=yes -else $as_nop +else have_directfb_hdr=no fi + CPPFLAGS="$save_CPPFLAGS" video_directfb=$have_directfb_hdr fi if test x$video_directfb = xyes; then # Check whether --enable-directfb-shared was given. -if test ${enable_directfb_shared+y} -then : +if test "${enable_directfb_shared+set}" = set; then : enableval=$enable_directfb_shared; -else $as_nop +else enable_directfb_shared=yes fi -printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_DIRECTFB 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" @@ -25210,15 +22822,17 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h directfb_lib=`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` if test x$have_loadso != xyes && \ test x$enable_directfb_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then directfb_shared=yes echo "-- dynamic libdirectfb -> $directfb_lib" -printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC \"$directfb_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "$directfb_lib" +_ACEOF SUMMARY_video="${SUMMARY_video} directfb(dynamic)" else @@ -25234,10 +22848,9 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC \"$directfb_lib\"" >>co CheckKMSDRM() { # Check whether --enable-video-kmsdrm was given. -if test ${enable_video_kmsdrm+y} -then : +if test "${enable_video_kmsdrm+set}" = set; then : enableval=$enable_video_kmsdrm; -else $as_nop +else enable_video_kmsdrm=yes fi @@ -25250,17 +22863,17 @@ fi pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libdrm >= 1.4.82" >&5 -printf %s "checking for libdrm >= 1.4.82... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm >= 1.4.82" >&5 +$as_echo_n "checking for libdrm >= 1.4.82... " >&6; } if test -n "$LIBDRM_CFLAGS"; then pkg_cv_LIBDRM_CFLAGS="$LIBDRM_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5 ($PKG_CONFIG --exists --print-errors "libdrm >= 1.4.82") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBDRM_CFLAGS=`$PKG_CONFIG --cflags "libdrm >= 1.4.82" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -25274,10 +22887,10 @@ if test -n "$LIBDRM_LIBS"; then pkg_cv_LIBDRM_LIBS="$LIBDRM_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 1.4.82\""; } >&5 ($PKG_CONFIG --exists --print-errors "libdrm >= 1.4.82") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBDRM_LIBS=`$PKG_CONFIG --libs "libdrm >= 1.4.82" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -25291,8 +22904,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -25309,29 +22922,29 @@ fi libdrm_avail=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } libdrm_avail=no else LIBDRM_CFLAGS=$pkg_cv_LIBDRM_CFLAGS LIBDRM_LIBS=$pkg_cv_LIBDRM_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } libdrm_avail=yes fi pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gbm >= 11.1.0" >&5 -printf %s "checking for gbm >= 11.1.0... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gbm >= 11.1.0" >&5 +$as_echo_n "checking for gbm >= 11.1.0... " >&6; } if test -n "$LIBGBM_CFLAGS"; then pkg_cv_LIBGBM_CFLAGS="$LIBGBM_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gbm >= 11.1.0") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBGBM_CFLAGS=`$PKG_CONFIG --cflags "gbm >= 11.1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -25345,10 +22958,10 @@ if test -n "$LIBGBM_LIBS"; then pkg_cv_LIBGBM_LIBS="$LIBGBM_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gbm >= 11.1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gbm >= 11.1.0") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBGBM_LIBS=`$PKG_CONFIG --libs "gbm >= 11.1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -25362,8 +22975,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -25380,14 +22993,14 @@ fi libgbm_avail=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } libgbm_avail=no else LIBGBM_CFLAGS=$pkg_cv_LIBGBM_CFLAGS LIBGBM_LIBS=$pkg_cv_LIBGBM_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } libgbm_avail=yes fi @@ -25397,49 +23010,54 @@ fi if test x$video_kmsdrm = xyes; then # Check whether --enable-kmsdrm-shared was given. -if test ${enable_kmsdrm_shared+y} -then : +if test "${enable_kmsdrm_shared+set}" = set; then : enableval=$enable_kmsdrm_shared; -else $as_nop +else enable_kmsdrm_shared=yes fi -printf "%s\n" "#define SDL_VIDEO_DRIVER_KMSDRM 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_KMSDRM 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 -printf %s "checking for kmsdrm dynamic loading support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 +$as_echo_n "checking for kmsdrm dynamic loading support... " >&6; } kmsdrm_shared=no drm_lib=`find_lib "libdrm.so.*" "$LIBDRM_LIBS"` gbm_lib=`find_lib "libgbm.so.*" "$LIBGBM_LIBS"` if test x$have_loadso != xyes && \ test x$enable_kmsdrm_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&2;} fi if test x$have_loadso = xyes && \ test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then kmsdrm_shared=yes -printf "%s\n" "#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC \"$drm_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "$drm_lib" +_ACEOF -printf "%s\n" "#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM \"$gbm_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "$gbm_lib" +_ACEOF -printf "%s\n" "#define HAVE_KMSDRM_SHARED \"TRUE\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define HAVE_KMSDRM_SHARED "TRUE" +_ACEOF SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" else EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" SUMMARY_video="${SUMMARY_video} kmsdrm" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 -printf "%s\n" "$kmsdrm_shared" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 +$as_echo "$kmsdrm_shared" >&6; } if test x$kmsdrm_shared = xyes; then echo "-- dynamic libdrm -> $drm_lib" echo "-- dynamic libgbm -> $gbm_lib" @@ -25452,16 +23070,15 @@ printf "%s\n" "$kmsdrm_shared" >&6; } CheckDummyVideo() { # Check whether --enable-video-dummy was given. -if test ${enable_video_dummy+y} -then : +if test "${enable_video_dummy+set}" = set; then : enableval=$enable_video_dummy; -else $as_nop +else enable_video_dummy=yes fi if test x$enable_video_dummy = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" have_video=yes @@ -25472,16 +23089,15 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h CheckOffscreenVideo() { # Check whether --enable-video-offscreen was given. -if test ${enable_video_offscreen+y} -then : +if test "${enable_video_offscreen+set}" = set; then : enableval=$enable_video_offscreen; -else $as_nop +else enable_video_offscreen=no fi if test x$enable_video_offscreen = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_OFFSCREEN 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_OFFSCREEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/offscreen/*.c" have_video=yes @@ -25493,7 +23109,7 @@ CheckQNXVideo() { if test x$enable_video = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" have_video=yes @@ -25506,7 +23122,7 @@ CheckQNXAudio() { if test x$enable_audio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" have_audio=yes @@ -25516,10 +23132,9 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h } # Check whether --enable-video-opengl was given. -if test ${enable_video_opengl+y} -then : +if test "${enable_video_opengl+set}" = set; then : enableval=$enable_video_opengl; -else $as_nop +else enable_video_opengl=yes fi @@ -25527,8 +23142,8 @@ fi CheckGLX() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GLX support" >&5 -printf %s "checking for GLX support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLX support" >&5 +$as_echo_n "checking for GLX support... " >&6; } video_opengl_glx=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25536,52 +23151,48 @@ printf %s "checking for GLX support... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengl_glx=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl_glx" >&5 -printf "%s\n" "$video_opengl_glx" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_glx" >&5 +$as_echo "$video_opengl_glx" >&6; } if test x$video_opengl_glx = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_GLX 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_GLX 1" >>confdefs.h fi fi } # Check whether --enable-video-opengles was given. -if test ${enable_video_opengles+y} -then : +if test "${enable_video_opengles+set}" = set; then : enableval=$enable_video_opengles; -else $as_nop +else enable_video_opengles=yes fi # Check whether --enable-video-opengles1 was given. -if test ${enable_video_opengles1+y} -then : +if test "${enable_video_opengles1+set}" = set; then : enableval=$enable_video_opengles1; -else $as_nop +else enable_video_opengles1=yes fi # Check whether --enable-video-opengles2 was given. -if test ${enable_video_opengles2+y} -then : +if test "${enable_video_opengles2+set}" = set; then : enableval=$enable_video_opengles2; -else $as_nop +else enable_video_opengles2=yes fi @@ -25589,8 +23200,8 @@ fi CheckEGL() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes || test x$enable_video = xyes -a x$enable_video_opengles = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 -printf %s "checking for EGL support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 +$as_echo_n "checking for EGL support... " >&6; } video_opengl_egl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25603,23 +23214,22 @@ printf %s "checking for EGL support... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengl_egl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 -printf "%s\n" "$video_opengl_egl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 +$as_echo "$video_opengl_egl" >&6; } if test x$video_opengl_egl = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h fi fi @@ -25628,8 +23238,8 @@ printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h CheckOpenGL() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL headers" >&5 -printf %s "checking for OpenGL headers... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL headers" >&5 +$as_echo_n "checking for OpenGL headers... " >&6; } video_opengl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25638,26 +23248,25 @@ printf %s "checking for OpenGL headers... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl" >&5 -printf "%s\n" "$video_opengl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl" >&5 +$as_echo "$video_opengl" >&6; } if test x$video_opengl = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl" fi @@ -25668,8 +23277,8 @@ CheckOpenGLES() { if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then if test x$enable_video_opengles1 = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v1 headers" >&5 -printf %s "checking for OpenGL ES v1 headers... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v1 headers" >&5 +$as_echo_n "checking for OpenGL ES v1 headers... " >&6; } video_opengles_v1=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25678,34 +23287,33 @@ printf %s "checking for OpenGL ES v1 headers... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengles_v1=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v1" >&5 -printf "%s\n" "$video_opengles_v1" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v1" >&5 +$as_echo "$video_opengles_v1" >&6; } if test x$video_opengles_v1 = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es1" fi fi if test x$enable_video_opengles2 = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 -printf %s "checking for OpenGL ES v2 headers... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 +$as_echo_n "checking for OpenGL ES v2 headers... " >&6; } video_opengles_v2=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25714,26 +23322,25 @@ printf %s "checking for OpenGL ES v2 headers... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengles_v2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 -printf "%s\n" "$video_opengles_v2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 +$as_echo "$video_opengles_v2" >&6; } if test x$video_opengles_v2 = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es2" fi @@ -25745,13 +23352,13 @@ CheckWINDOWSGL() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_WGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_WGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl" fi @@ -25761,8 +23368,8 @@ CheckWINDOWSGLES() { if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 -printf %s "checking for EGL support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 +$as_echo_n "checking for EGL support... " >&6; } video_opengl_egl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25770,32 +23377,31 @@ printf %s "checking for EGL support... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengl_egl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 -printf "%s\n" "$video_opengl_egl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 +$as_echo "$video_opengl_egl" >&6; } if test x$video_opengl_egl = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es1" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 -printf %s "checking for OpenGL ES v2 headers... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 +$as_echo_n "checking for OpenGL ES v2 headers... " >&6; } video_opengles_v2=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25804,29 +23410,28 @@ printf %s "checking for OpenGL ES v2 headers... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengles_v2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 -printf "%s\n" "$video_opengles_v2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 +$as_echo "$video_opengles_v2" >&6; } if test x$video_opengles_v2 = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es2" fi @@ -25837,13 +23442,13 @@ CheckHaikuGL() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_HAIKU 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_HAIKU 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" SUMMARY_video="${SUMMARY_video} opengl" @@ -25854,13 +23459,13 @@ CheckMacGL() { if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_CGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_CGL 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl" fi @@ -25871,14 +23476,14 @@ CheckMacGLES() if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then video_opengl_egl=yes -printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h video_opengles_v2=yes -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es2" fi @@ -25887,8 +23492,8 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h CheckEmscriptenGLES() { if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 -printf %s "checking for EGL support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 +$as_echo_n "checking for EGL support... " >&6; } video_opengl_egl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25896,28 +23501,27 @@ printf %s "checking for EGL support... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengl_egl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 -printf "%s\n" "$video_opengl_egl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5 +$as_echo "$video_opengl_egl" >&6; } if test x$video_opengl_egl = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 -printf %s "checking for OpenGL ES v2 headers... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v2 headers" >&5 +$as_echo_n "checking for OpenGL ES v2 headers... " >&6; } video_opengles_v2=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25926,26 +23530,25 @@ printf %s "checking for OpenGL ES v2 headers... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : video_opengles_v2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 -printf "%s\n" "$video_opengles_v2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengles_v2" >&5 +$as_echo "$video_opengles_v2" >&6; } if test x$video_opengles_v2 = xyes; then -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} opengl_es2" fi @@ -25953,10 +23556,9 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h } # Check whether --enable-video-vulkan was given. -if test ${enable_video_vulkan+y} -then : +if test "${enable_video_vulkan+set}" = set; then : enableval=$enable_video_vulkan; -else $as_nop +else enable_video_vulkan=yes fi @@ -25974,24 +23576,23 @@ CheckVulkan() #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -else $as_nop +else enable_video_vulkan=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; *-*-darwin*) save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -x objective-c" + CFLAGS="$CFLAGS -x objective-c" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26004,20 +23605,19 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -else $as_nop +else enable_video_vulkan=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" ;; *) @@ -26026,18 +23626,18 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test x$enable_video_vulkan = xno; then # For reasons I am totally unable to see, I get an undefined macro error if # I put this in the AC_TRY_COMPILE. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5 -printf "%s\n" "$as_me: WARNING: Vulkan does not work on this configuration." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5 +$as_echo "$as_me: WARNING: Vulkan does not work on this configuration." >&2;} fi fi if test x$have_loadso != xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan support is available, but disabled because there's no loadso." >&5 -printf "%s\n" "$as_me: WARNING: Vulkan support is available, but disabled because there's no loadso." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan support is available, but disabled because there's no loadso." >&5 +$as_echo "$as_me: WARNING: Vulkan support is available, but disabled because there's no loadso." >&2;} enable_video_vulkan=no fi if test x$enable_video_vulkan = xyes; then -printf "%s\n" "#define SDL_VIDEO_VULKAN 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} vulkan" fi @@ -26045,8 +23645,8 @@ printf "%s\n" "#define SDL_VIDEO_VULKAN 1" >>confdefs.h CheckInputEvents() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5 -printf %s "checking for Linux 2.4 unified input interface... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5 +$as_echo_n "checking for Linux 2.4 unified input interface... " >&6; } use_input_events=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26054,7 +23654,7 @@ printf %s "checking for Linux 2.4 unified input interface... " >&6; } #include int -main (void) +main () { #ifndef EVIOCGNAME @@ -26065,16 +23665,15 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : use_input_events=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_input_events" >&5 -printf "%s\n" "$use_input_events" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_events" >&5 +$as_echo "$use_input_events" >&6; } if test x$use_input_events = xyes; then -printf "%s\n" "#define SDL_INPUT_LINUXEV 1" >>confdefs.h +$as_echo "#define SDL_INPUT_LINUXEV 1" >>confdefs.h SUMMARY_input="${SUMMARY_input} linuxev" fi @@ -26082,8 +23681,9 @@ printf "%s\n" "#define SDL_INPUT_LINUXEV 1" >>confdefs.h CheckInputKD() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Linux kd.h" >&5 -printf %s "checking for Linux kd.h... " >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux kd.h" >&5 +$as_echo_n "checking for Linux kd.h... " >&6; } use_input_kd=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26092,7 +23692,7 @@ printf %s "checking for Linux kd.h... " >&6; } #include int -main (void) +main () { struct kbentry kbe; @@ -26103,16 +23703,15 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : use_input_kd=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_input_kd" >&5 -printf "%s\n" "$use_input_kd" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_kd" >&5 +$as_echo "$use_input_kd" >&6; } if test x$use_input_kd = xyes; then -printf "%s\n" "#define SDL_INPUT_LINUXKD 1" >>confdefs.h +$as_echo "#define SDL_INPUT_LINUXKD 1" >>confdefs.h SUMMARY_input="${SUMMARY_input} linuxkd" fi @@ -26120,8 +23719,8 @@ printf "%s\n" "#define SDL_INPUT_LINUXKD 1" >>confdefs.h CheckInputKBIO() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FreeBSD kbio.h" >&5 -printf %s "checking for FreeBSD kbio.h... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD kbio.h" >&5 +$as_echo_n "checking for FreeBSD kbio.h... " >&6; } use_input_kbio=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26130,7 +23729,7 @@ printf %s "checking for FreeBSD kbio.h... " >&6; } #include int -main (void) +main () { accentmap_t accTable; @@ -26140,16 +23739,15 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : use_input_kbio=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_input_kbio" >&5 -printf "%s\n" "$use_input_kbio" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_kbio" >&5 +$as_echo "$use_input_kbio" >&6; } if test x$use_input_kbio = xyes; then -printf "%s\n" "#define SDL_INPUT_FBSDKBIO 1" >>confdefs.h +$as_echo "#define SDL_INPUT_FBSDKBIO 1" >>confdefs.h SUMMARY_input="${SUMMARY_input} fbsdkbio" fi @@ -26157,8 +23755,8 @@ printf "%s\n" "#define SDL_INPUT_FBSDKBIO 1" >>confdefs.h CheckInputWSCONS() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenBSD wscons" >&5 -printf %s "checking for OpenBSD wscons... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenBSD wscons" >&5 +$as_echo_n "checking for OpenBSD wscons... " >&6; } use_input_wscons=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26170,7 +23768,7 @@ printf %s "checking for OpenBSD wscons... " >&6; } #include int -main (void) +main () { struct wskbd_map_data data; @@ -26180,16 +23778,15 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : use_input_wscons=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_input_wscons" >&5 -printf "%s\n" "$use_input_wscons" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_input_wscons" >&5 +$as_echo "$use_input_wscons" >&6; } if test x$use_input_wscons = xyes; then -printf "%s\n" "#define SDL_INPUT_WSCONS 1" >>confdefs.h +$as_echo "#define SDL_INPUT_WSCONS 1" >>confdefs.h SUMMARY_input="${SUMMARY_input} wscons" fi @@ -26198,32 +23795,33 @@ printf "%s\n" "#define SDL_INPUT_WSCONS 1" >>confdefs.h CheckLibUDev() { # Check whether --enable-libudev was given. -if test ${enable_libudev+y} -then : +if test "${enable_libudev+set}" = set; then : enableval=$enable_libudev; -else $as_nop +else enable_libudev=yes fi if test x$enable_libudev = xyes; then - ac_fn_c_check_header_compile "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default" -if test "x$ac_cv_header_libudev_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default" +if test "x$ac_cv_header_libudev_h" = xyes; then : have_libudev_h_hdr=yes -else $as_nop +else have_libudev_h_hdr=no fi + if test x$have_libudev_h_hdr = xyes; then -printf "%s\n" "#define HAVE_LIBUDEV_H 1" >>confdefs.h +$as_echo "#define HAVE_LIBUDEV_H 1" >>confdefs.h udev_lib=`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` if test x$udev_lib != x; then echo "-- dynamic udev -> $udev_lib" -printf "%s\n" "#define SDL_UDEV_DYNAMIC \"$udev_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_UDEV_DYNAMIC "$udev_lib" +_ACEOF fi fi @@ -26233,27 +23831,26 @@ printf "%s\n" "#define SDL_UDEV_DYNAMIC \"$udev_lib\"" >>confdefs.h CheckDBus() { # Check whether --enable-dbus was given. -if test ${enable_dbus+y} -then : +if test "${enable_dbus+set}" = set; then : enableval=$enable_dbus; -else $as_nop +else enable_dbus=yes fi if test x$enable_dbus = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dbus-1" >&5 -printf %s "checking for dbus-1... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbus-1" >&5 +$as_echo_n "checking for dbus-1... " >&6; } if test -n "$DBUS_CFLAGS"; then pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -26267,10 +23864,10 @@ if test -n "$DBUS_LIBS"; then pkg_cv_DBUS_LIBS="$DBUS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-1\""; } >&5 ($PKG_CONFIG --exists --print-errors "dbus-1") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -26284,8 +23881,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -26302,30 +23899,30 @@ fi have_dbus=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } have_dbus=no else DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS DBUS_LIBS=$pkg_cv_DBUS_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } have_dbus=yes fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$save_CPPFLAGS $DBUS_CFLAGS" - ac_fn_c_check_header_compile "$LINENO" "dbus/dbus.h" "ac_cv_header_dbus_dbus_h" "$ac_includes_default" -if test "x$ac_cv_header_dbus_dbus_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "dbus/dbus.h" "ac_cv_header_dbus_dbus_h" "$ac_includes_default" +if test "x$ac_cv_header_dbus_dbus_h" = xyes; then : have_dbus_dbus_h_hdr=yes -else $as_nop +else have_dbus_dbus_h_hdr=no fi + CPPFLAGS="$save_CPPFLAGS" if test x$have_dbus_dbus_h_hdr = xyes; then -printf "%s\n" "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h +$as_echo "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS" SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c" @@ -26336,16 +23933,15 @@ printf "%s\n" "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h CheckIME() { # Check whether --enable-ime was given. -if test ${enable_ime+y} -then : +if test "${enable_ime+set}" = set; then : enableval=$enable_ime; -else $as_nop +else enable_ime=yes fi if test x$enable_ime = xyes; then -printf "%s\n" "#define SDL_USE_IME 1" >>confdefs.h +$as_echo "#define SDL_USE_IME 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c" fi @@ -26358,37 +23954,43 @@ CheckInotify() *-*-freebsd*) LIBS="$LIBS -linotify" ;; esac - for ac_header in sys/inotify.h + for ac_header in sys/inotify.h do : - ac_fn_c_check_header_compile "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_inotify_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_INOTIFY_H 1" >>confdefs.h + ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_inotify_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_INOTIFY_H 1 +_ACEOF have_inotify_inotify_h_hdr=yes fi done - for ac_func in inotify_init + for ac_func in inotify_init do : ac_fn_c_check_func "$LINENO" "inotify_init" "ac_cv_func_inotify_init" -if test "x$ac_cv_func_inotify_init" = xyes -then : - printf "%s\n" "#define HAVE_INOTIFY_INIT 1" >>confdefs.h +if test "x$ac_cv_func_inotify_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_INOTIFY_INIT 1 +_ACEOF have_inotify=yes fi - done - ac_fn_c_check_func "$LINENO" "inotify_init1" "ac_cv_func_inotify_init1" -if test "x$ac_cv_func_inotify_init1" = xyes -then : - printf "%s\n" "#define HAVE_INOTIFY_INIT1 1" >>confdefs.h + + for ac_func in inotify_init1 +do : + ac_fn_c_check_func "$LINENO" "inotify_init1" "ac_cv_func_inotify_init1" +if test "x$ac_cv_func_inotify_init1" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_INOTIFY_INIT1 1 +_ACEOF fi +done if test x$have_inotify_inotify_h_hdr = xyes -a x$have_inotify = xyes; then -printf "%s\n" "#define HAVE_INOTIFY 1" >>confdefs.h +$as_echo "#define HAVE_INOTIFY 1" >>confdefs.h case "$host" in *-*-freebsd*) @@ -26402,27 +24004,26 @@ printf "%s\n" "#define HAVE_INOTIFY 1" >>confdefs.h CheckIBus() { # Check whether --enable-ibus was given. -if test ${enable_ibus+y} -then : +if test "${enable_ibus+set}" = set; then : enableval=$enable_ibus; -else $as_nop +else enable_ibus=yes fi if test x$enable_ibus = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ibus-1.0" >&5 -printf %s "checking for ibus-1.0... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ibus-1.0" >&5 +$as_echo_n "checking for ibus-1.0... " >&6; } if test -n "$IBUS_CFLAGS"; then pkg_cv_IBUS_CFLAGS="$IBUS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "ibus-1.0") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_IBUS_CFLAGS=`$PKG_CONFIG --cflags "ibus-1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -26436,10 +24037,10 @@ if test -n "$IBUS_LIBS"; then pkg_cv_IBUS_LIBS="$IBUS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ibus-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "ibus-1.0") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_IBUS_LIBS=`$PKG_CONFIG --libs "ibus-1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -26453,8 +24054,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -26471,43 +24072,43 @@ fi have_ibus=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } have_ibus=no else IBUS_CFLAGS=$pkg_cv_IBUS_CFLAGS IBUS_LIBS=$pkg_cv_IBUS_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } have_ibus=yes fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$save_CPPFLAGS $IBUS_CFLAGS" - ac_fn_c_check_header_compile "$LINENO" "ibus-1.0/ibus.h" "ac_cv_header_ibus_1_0_ibus_h" "$ac_includes_default" -if test "x$ac_cv_header_ibus_1_0_ibus_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "ibus-1.0/ibus.h" "ac_cv_header_ibus_1_0_ibus_h" "$ac_includes_default" +if test "x$ac_cv_header_ibus_1_0_ibus_h" = xyes; then : have_ibus_ibus_h_hdr=yes -else $as_nop +else have_ibus_ibus_h_hdr=no fi + CPPFLAGS="$save_CPPFLAGS" if test x$have_ibus_ibus_h_hdr = xyes; then if test x$enable_ime != xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5 -printf "%s\n" "$as_me: WARNING: IME support is required for IBus." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5 +$as_echo "$as_me: WARNING: IME support is required for IBus." >&2;} have_ibus_ibus_h_hdr=no elif test x$enable_dbus != xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5 -printf "%s\n" "$as_me: WARNING: DBus support is required for IBus." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5 +$as_echo "$as_me: WARNING: DBus support is required for IBus." >&2;} have_ibus_ibus_h_hdr=no elif test x$have_inotify_inotify_h_hdr != xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: INotify support is required for IBus." >&5 -printf "%s\n" "$as_me: WARNING: INotify support is required for IBus." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: INotify support is required for IBus." >&5 +$as_echo "$as_me: WARNING: INotify support is required for IBus." >&2;} have_ibus_ibus_h_hdr=no else -printf "%s\n" "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h +$as_echo "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS" SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c" @@ -26519,42 +24120,40 @@ printf "%s\n" "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h CheckFcitx() { # Check whether --enable-fcitx was given. -if test ${enable_fcitx+y} -then : +if test "${enable_fcitx+set}" = set; then : enableval=$enable_fcitx; -else $as_nop +else enable_fcitx=yes fi if test x$enable_fcitx = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fcitx support" >&5 -printf %s "checking for fcitx support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fcitx support" >&5 +$as_echo_n "checking for fcitx support... " >&6; } have_fcitx=no if test x$enable_ime != xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5 -printf "%s\n" "$as_me: WARNING: IME support is required for fcitx." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5 +$as_echo "$as_me: WARNING: IME support is required for fcitx." >&2;} elif test x$have_dbus_dbus_h_hdr != xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5 -printf "%s\n" "$as_me: WARNING: DBus support is required for fcitx." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5 +$as_echo "$as_me: WARNING: DBus support is required for fcitx." >&2;} else have_fcitx=yes -printf "%s\n" "#define HAVE_FCITX 1" >>confdefs.h +$as_echo "#define HAVE_FCITX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_fcitx" >&5 -printf "%s\n" "$have_fcitx" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_fcitx" >&5 +$as_echo "$have_fcitx" >&6; } fi } CheckJoystickMFI() { # Check whether --enable-joystick-mfi was given. -if test ${enable_joystick_mfi+y} -then : +if test "${enable_joystick_mfi+set}" = set; then : enableval=$enable_joystick_mfi; -else $as_nop +else enable_joystick_mfi=yes fi @@ -26562,10 +24161,10 @@ fi if test x$enable_joystick_mfi = xyes; then save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" - CFLAGS="$CFLAGS -x objective-c -fobjc-weak" + CFLAGS="$CFLAGS -x objective-c -fobjc-weak" LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GameController framework" >&5 -printf %s "checking for GameController framework... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GameController framework" >&5 +$as_echo_n "checking for GameController framework... " >&6; } enable_joystick_mfi=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26575,7 +24174,7 @@ printf %s "checking for GameController framework... " >&6; } #import int -main (void) +main () { #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 @@ -26589,20 +24188,19 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : enable_joystick_mfi=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$save_CFLAGS" LDFLAGS="$save_LDFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_joystick_mfi" >&5 -printf "%s\n" "$enable_joystick_mfi" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_joystick_mfi" >&5 +$as_echo "$enable_joystick_mfi" >&6; } if test x$enable_joystick_mfi = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_MFI 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-weak -Wno-unused-command-line-argument" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController" @@ -26624,18 +24222,16 @@ CheckPTHREAD() esac # Check whether --enable-pthreads was given. -if test ${enable_pthreads+y} -then : +if test "${enable_pthreads+set}" = set; then : enableval=$enable_pthreads; -else $as_nop +else enable_pthreads=maybe fi - # Check whether --enable-pthread-sem was given. -if test ${enable_pthread_sem+y} -then : + # Check whether --enable-pthread-sem was given. +if test "${enable_pthread_sem+set}" = set; then : enableval=$enable_pthread_sem; -else $as_nop +else enable_pthread_sem=maybe fi @@ -26727,8 +24323,8 @@ fi # Add the pthread compiler flags and libraries CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" # Check to see if we have pthread support on this system - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthreads" >&5 -printf %s "checking for pthreads... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthreads" >&5 +$as_echo_n "checking for pthreads... " >&6; } use_pthreads=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26736,7 +24332,7 @@ printf %s "checking for pthreads... " >&6; } #include int -main (void) +main () { pthread_attr_t type; @@ -26746,21 +24342,20 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : use_pthreads=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $use_pthreads" >&5 -printf "%s\n" "$use_pthreads" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_pthreads" >&5 +$as_echo "$use_pthreads" >&6; } # Restore the compiler flags and libraries CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" # Do futher testing if we have pthread support... if test x$use_pthreads = xyes; then -printf "%s\n" "#define SDL_THREAD_PTHREAD 1" >>confdefs.h +$as_echo "#define SDL_THREAD_PTHREAD 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib" @@ -26772,8 +24367,8 @@ printf "%s\n" "#define SDL_THREAD_PTHREAD 1" >>confdefs.h CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib" # Check to see if recursive mutexes are available - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for recursive mutexes" >&5 -printf %s "checking for recursive mutexes... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recursive mutexes" >&5 +$as_echo_n "checking for recursive mutexes... " >&6; } has_recursive_mutexes=no if test x$has_recursive_mutexes = xno; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -26783,7 +24378,7 @@ printf %s "checking for recursive mutexes... " >&6; } #include int -main (void) +main () { pthread_mutexattr_t attr; @@ -26793,16 +24388,15 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : has_recursive_mutexes=yes -printf "%s\n" "#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1" >>confdefs.h +$as_echo "#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test x$has_recursive_mutexes = xno; then @@ -26813,7 +24407,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ #include int -main (void) +main () { pthread_mutexattr_t attr; @@ -26823,25 +24417,24 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : has_recursive_mutexes=yes -printf "%s\n" "#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1" >>confdefs.h +$as_echo "#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $has_recursive_mutexes" >&5 -printf "%s\n" "$has_recursive_mutexes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_recursive_mutexes" >&5 +$as_echo "$has_recursive_mutexes" >&6; } # Check to see if pthread semaphore support is missing if test x$enable_pthread_sem = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread semaphores" >&5 -printf %s "checking for pthread semaphores... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread semaphores" >&5 +$as_echo_n "checking for pthread semaphores... " >&6; } have_pthread_sem=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26850,24 +24443,23 @@ printf %s "checking for pthread semaphores... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_pthread_sem=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_pthread_sem" >&5 -printf "%s\n" "$have_pthread_sem" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_pthread_sem" >&5 +$as_echo "$have_pthread_sem" >&6; } fi if test x$have_pthread_sem = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sem_timedwait" >&5 -printf %s "checking for sem_timedwait... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sem_timedwait" >&5 +$as_echo_n "checking for sem_timedwait... " >&6; } have_sem_timedwait=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -26876,7 +24468,7 @@ printf %s "checking for sem_timedwait... " >&6; } #include int -main (void) +main () { sem_timedwait(NULL, NULL); @@ -26885,106 +24477,109 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_sem_timedwait=yes -printf "%s\n" "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h +$as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_sem_timedwait" >&5 -printf "%s\n" "$have_sem_timedwait" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sem_timedwait" >&5 +$as_echo "$have_sem_timedwait" >&6; } fi ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" " #include " -if test "x$ac_cv_header_pthread_np_h" = xyes -then : +if test "x$ac_cv_header_pthread_np_h" = xyes; then : have_pthread_np_h=yes -else $as_nop +else have_pthread_np_h=no fi + if test x$have_pthread_np_h = xyes; then -printf "%s\n" "#define HAVE_PTHREAD_NP_H 1" >>confdefs.h +$as_echo "#define HAVE_PTHREAD_NP_H 1" >>confdefs.h fi # Check to see if pthread naming is available - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np" >&5 -printf %s "checking for pthread_setname_np... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np" >&5 +$as_echo_n "checking for pthread_setname_np... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char pthread_setname_np (); int -main (void) +main () { return pthread_setname_np (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : has_pthread_setname_np=yes -printf "%s\n" "#define HAVE_PTHREAD_SETNAME_NP 1" >>confdefs.h +$as_echo "#define HAVE_PTHREAD_SETNAME_NP 1" >>confdefs.h -else $as_nop +else has_pthread_setname_np=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $has_pthread_setname_np" >&5 -printf "%s\n" "$has_pthread_setname_np" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_pthread_setname_np" >&5 +$as_echo "$has_pthread_setname_np" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_set_name_np" >&5 -printf %s "checking for pthread_set_name_np... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_set_name_np" >&5 +$as_echo_n "checking for pthread_set_name_np... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char pthread_set_name_np (); int -main (void) +main () { return pthread_set_name_np (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : has_pthread_set_name_np=yes -printf "%s\n" "#define HAVE_PTHREAD_SET_NAME_NP 1" >>confdefs.h +$as_echo "#define HAVE_PTHREAD_SET_NAME_NP 1" >>confdefs.h -else $as_nop +else has_pthread_set_name_np=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $has_pthread_set_name_np" >&5 -printf "%s\n" "$has_pthread_set_name_np" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_pthread_set_name_np" >&5 +$as_echo "$has_pthread_set_name_np" >&6; } # Restore the compiler flags and libraries CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" @@ -27018,8 +24613,8 @@ printf "%s\n" "$has_pthread_set_name_np" >&6; } CheckWINDOWS() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Windows compiler" >&5 -printf %s "checking Windows compiler... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Windows compiler" >&5 +$as_echo_n "checking Windows compiler... " >&6; } have_win32_gcc=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27027,28 +24622,27 @@ printf %s "checking Windows compiler... " >&6; } #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_win32_gcc=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_win32_gcc" >&5 -printf "%s\n" "$have_win32_gcc" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_win32_gcc" >&5 +$as_echo "$have_win32_gcc" >&6; } if test x$have_win32_gcc != xyes; then as_fn_error $? " *** Your compiler ($CC) does not produce Windows executables! " "$LINENO" 5 fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Windows CE" >&5 -printf %s "checking Windows CE... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Windows CE" >&5 +$as_echo_n "checking Windows CE... " >&6; } have_wince=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27058,15 +24652,14 @@ printf %s "checking Windows CE... " >&6; } #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_wince=yes as_fn_error $? " @@ -27074,61 +24667,36 @@ then : " "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wince" >&5 -printf "%s\n" "$have_wince" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_wince" >&5 +$as_echo "$have_wince" >&6; } # This fixes Windows stack alignment with newer GCC CheckStackBoundary - - # headers needed elsewhere - ac_fn_c_check_header_compile "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default" -if test "x$ac_cv_header_tpcshrd_h" = xyes -then : - have_tpcshrd_h=yes -fi - - if test x$have_tpcshrd_h = xyes; then - -printf "%s\n" "#define HAVE_TPCSHRD_H 1" >>confdefs.h - - fi - ac_fn_c_check_header_compile "$LINENO" "roapi.h" "ac_cv_header_roapi_h" "$ac_includes_default" -if test "x$ac_cv_header_roapi_h" = xyes -then : - have_roapi_h=yes -fi - - if test x$have_roapi_h = xyes; then - -printf "%s\n" "#define HAVE_ROAPI_H 1" >>confdefs.h - - fi } CheckOS2() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OS/2 compiler" >&5 -printf %s "checking OS/2 compiler... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking OS/2 compiler" >&5 +$as_echo_n "checking OS/2 compiler... " >&6; } have_os2_gcc=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_os2_gcc=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_os2_gcc" >&5 -printf "%s\n" "$have_os2_gcc" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_os2_gcc" >&5 +$as_echo "$have_os2_gcc" >&6; } if test x$have_os2_gcc != xyes; then as_fn_error $? " *** Your compiler ($CC) does not produce OS/2 executables! @@ -27139,99 +24707,68 @@ printf "%s\n" "$have_os2_gcc" >&6; } CheckDIRECTX() { # Check whether --enable-directx was given. -if test ${enable_directx+y} -then : +if test "${enable_directx+set}" = set; then : enableval=$enable_directx; -else $as_nop +else enable_directx=yes fi if test x$enable_directx = xyes; then - ac_fn_c_check_header_compile "$LINENO" "d3d9.h" "ac_cv_header_d3d9_h" "$ac_includes_default" -if test "x$ac_cv_header_d3d9_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "d3d9.h" "ac_cv_header_d3d9_h" "$ac_includes_default" +if test "x$ac_cv_header_d3d9_h" = xyes; then : have_d3d=yes fi - ac_fn_c_check_header_compile "$LINENO" "d3d11_1.h" "ac_cv_header_d3d11_1_h" "$ac_includes_default" -if test "x$ac_cv_header_d3d11_1_h" = xyes -then : + + ac_fn_c_check_header_mongrel "$LINENO" "d3d11_1.h" "ac_cv_header_d3d11_1_h" "$ac_includes_default" +if test "x$ac_cv_header_d3d11_1_h" = xyes; then : have_d3d11=yes fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for d3d12 Windows SDK version" >&5 -printf %s "checking for d3d12 Windows SDK version... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -ID3D12Device1 *device; -#if WDK_NTDDI_VERSION <= 0x0A000008 -asdf -#endif - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_d3d12=yes -else $as_nop - have_d3d12=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_d3d12" >&5 -printf "%s\n" "$have_d3d12" >&6; } - ac_fn_c_check_header_compile "$LINENO" "ddraw.h" "ac_cv_header_ddraw_h" "$ac_includes_default" -if test "x$ac_cv_header_ddraw_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "ddraw.h" "ac_cv_header_ddraw_h" "$ac_includes_default" +if test "x$ac_cv_header_ddraw_h" = xyes; then : have_ddraw=yes fi - ac_fn_c_check_header_compile "$LINENO" "dsound.h" "ac_cv_header_dsound_h" "$ac_includes_default" -if test "x$ac_cv_header_dsound_h" = xyes -then : + + ac_fn_c_check_header_mongrel "$LINENO" "dsound.h" "ac_cv_header_dsound_h" "$ac_includes_default" +if test "x$ac_cv_header_dsound_h" = xyes; then : have_dsound=yes fi - ac_fn_c_check_header_compile "$LINENO" "dinput.h" "ac_cv_header_dinput_h" "$ac_includes_default" -if test "x$ac_cv_header_dinput_h" = xyes -then : + + ac_fn_c_check_header_mongrel "$LINENO" "dinput.h" "ac_cv_header_dinput_h" "$ac_includes_default" +if test "x$ac_cv_header_dinput_h" = xyes; then : have_dinput=yes fi - ac_fn_c_check_header_compile "$LINENO" "dxgi.h" "ac_cv_header_dxgi_h" "$ac_includes_default" -if test "x$ac_cv_header_dxgi_h" = xyes -then : + + ac_fn_c_check_header_mongrel "$LINENO" "dxgi.h" "ac_cv_header_dxgi_h" "$ac_includes_default" +if test "x$ac_cv_header_dxgi_h" = xyes; then : have_dxgi=yes fi + if test x$have_ddraw = xyes; then -printf "%s\n" "#define HAVE_DDRAW_H 1" >>confdefs.h +$as_echo "#define HAVE_DDRAW_H 1" >>confdefs.h fi if test x$have_dinput = xyes; then -printf "%s\n" "#define HAVE_DINPUT_H 1" >>confdefs.h +$as_echo "#define HAVE_DINPUT_H 1" >>confdefs.h fi if test x$have_dsound = xyes; then -printf "%s\n" "#define HAVE_DSOUND_H 1" >>confdefs.h +$as_echo "#define HAVE_DSOUND_H 1" >>confdefs.h fi if test x$have_dxgi = xyes; then -printf "%s\n" "#define HAVE_DXGI_H 1" >>confdefs.h +$as_echo "#define HAVE_DXGI_H 1" >>confdefs.h fi @@ -27245,24 +24782,23 @@ printf "%s\n" "#define HAVE_DXGI_H 1" >>confdefs.h fi # Check whether --enable-xinput was given. -if test ${enable_xinput+y} -then : +if test "${enable_xinput+set}" = set; then : enableval=$enable_xinput; -else $as_nop +else enable_xinput=yes fi if test x$enable_xinput = xyes; then have_xinput_gamepadex=no have_xinput_stateex=no - ac_fn_c_check_header_compile "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" -if test "x$ac_cv_header_xinput_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" +if test "x$ac_cv_header_xinput_h" = xyes; then : have_xinput=yes fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_GAMEPAD_EX" >&5 -printf %s "checking for struct XINPUT_GAMEPAD_EX... " >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_GAMEPAD_EX" >&5 +$as_echo_n "checking for struct XINPUT_GAMEPAD_EX... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27271,22 +24807,21 @@ printf %s "checking for struct XINPUT_GAMEPAD_EX... " >&6; } XINPUT_GAMEPAD_EX x1; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_xinput_gamepadex=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput_gamepadex" >&5 -printf "%s\n" "$have_xinput_gamepadex" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_STATE_EX" >&5 -printf %s "checking for struct XINPUT_STATE_EX... " >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput_gamepadex" >&5 +$as_echo "$have_xinput_gamepadex" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_STATE_EX" >&5 +$as_echo_n "checking for struct XINPUT_STATE_EX... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27295,40 +24830,39 @@ printf %s "checking for struct XINPUT_STATE_EX... " >&6; } XINPUT_STATE_EX s1; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_xinput_stateex=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput_stateex" >&5 -printf "%s\n" "$have_xinput_stateex" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_xinput_stateex" >&5 +$as_echo "$have_xinput_stateex" >&6; } if test x$have_xinput = xyes; then -printf "%s\n" "#define HAVE_XINPUT_H 1" >>confdefs.h +$as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h fi if test x$have_xinput_gamepadex = xyes; then -printf "%s\n" "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h +$as_echo "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h fi if test x$have_xinput_stateex = xyes; then -printf "%s\n" "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h +$as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h fi fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for windows.gaming.input.h" >&5 -printf %s "checking for windows.gaming.input.h... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.gaming.input.h" >&5 +$as_echo_n "checking for windows.gaming.input.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27337,59 +24871,57 @@ printf %s "checking for windows.gaming.input.h... " >&6; } __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_wgi=yes -else $as_nop +else have_wgi=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wgi" >&5 -printf "%s\n" "$have_wgi" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_wgi" >&5 +$as_echo "$have_wgi" >&6; } if test x$have_wgi = xyes; then -printf "%s\n" "#define HAVE_WINDOWS_GAMING_INPUT_H 1" >>confdefs.h +$as_echo "#define HAVE_WINDOWS_GAMING_INPUT_H 1" >>confdefs.h fi - ac_fn_c_check_header_compile "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default" -if test "x$ac_cv_header_mmdeviceapi_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default" +if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then : have_wasapi=yes fi + if test x$have_wasapi = xyes; then -printf "%s\n" "#define HAVE_MMDEVICEAPI_H 1" >>confdefs.h +$as_echo "#define HAVE_MMDEVICEAPI_H 1" >>confdefs.h fi - ac_fn_c_check_header_compile "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default" -if test "x$ac_cv_header_audioclient_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default" +if test "x$ac_cv_header_audioclient_h" = xyes; then : -else $as_nop +else have_wasapi=no fi + if test x$have_wasapi = xyes; then -printf "%s\n" "#define HAVE_AUDIOCLIENT_H 1" >>confdefs.h +$as_echo "#define HAVE_AUDIOCLIENT_H 1" >>confdefs.h fi # Check whether --enable-wasapi was given. -if test ${enable_wasapi+y} -then : +if test "${enable_wasapi+set}" = set; then : enableval=$enable_wasapi; -else $as_nop +else enable_wasapi=yes fi @@ -27398,25 +24930,24 @@ fi CheckDLOPEN() { -printf "%s\n" "#define DYNAPI_NEEDS_DLOPEN 1" >>confdefs.h +$as_echo "#define DYNAPI_NEEDS_DLOPEN 1" >>confdefs.h - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" -if test "x$ac_cv_header_dlfcn_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : have_dlfcn_h=yes -else $as_nop +else have_dlfcn_h=no fi + have_dlopen=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lc" >&5 -printf %s "checking for dlopen in -lc... " >&6; } -if test ${ac_cv_lib_c_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lc" >&5 +$as_echo_n "checking for dlopen in -lc... " >&6; } +if ${ac_cv_lib_c_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -27425,37 +24956,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char dlopen (); int -main (void) +main () { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_dlopen=yes -else $as_nop +else ac_cv_lib_c_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_dlopen" >&5 -printf "%s\n" "$ac_cv_lib_c_dlopen" >&6; } -if test "x$ac_cv_lib_c_dlopen" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_dlopen" >&5 +$as_echo "$ac_cv_lib_c_dlopen" >&6; } +if test "x$ac_cv_lib_c_dlopen" = xyes; then : have_dlopen=yes -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -printf %s "checking for dlopen in -ldl... " >&6; } -if test ${ac_cv_lib_dl_dlopen+y} -then : - printf %s "(cached) " >&6 -else $as_nop +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -27464,46 +24995,47 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char dlopen (); int -main (void) +main () { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes -else $as_nop +else ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : have_dlopen=yes; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl" fi fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen" >&5 -printf %s "checking for dlopen... " >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_dlopen" >&5 -printf "%s\n" "$have_dlopen" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen" >&5 +$as_echo_n "checking for dlopen... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dlopen" >&5 +$as_echo "$have_dlopen" >&6; } if test x$have_dlfcn_h = xyes -a x$have_dlopen = xyes; then -printf "%s\n" "#define HAVE_DLOPEN 1" >>confdefs.h +$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h if test x$enable_loadso = xyes; then -printf "%s\n" "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h +$as_echo "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c" have_loadso=yes @@ -27513,8 +25045,8 @@ printf "%s\n" "#define SDL_LOADSO_DLOPEN 1" >>confdefs.h CheckO_CLOEXEC() { - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 -printf %s "checking for O_CLOEXEC... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 +$as_echo_n "checking for O_CLOEXEC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27522,25 +25054,24 @@ printf %s "checking for O_CLOEXEC... " >&6; } int flag = O_CLOEXEC; int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_o_cloexec=yes -else $as_nop +else have_o_cloexec=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_o_cloexec" >&5 -printf "%s\n" "$have_o_cloexec" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_o_cloexec" >&5 +$as_echo "$have_o_cloexec" >&6; } if test $have_o_cloexec = yes; then -printf "%s\n" "#define HAVE_O_CLOEXEC 1" >>confdefs.h +$as_echo "#define HAVE_O_CLOEXEC 1" >>confdefs.h fi } @@ -27550,12 +25081,11 @@ CheckUSBHID() case "$host" in *-*-*bsd*|*-*-dragonfly*) if test x$enable_joystick = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5 -printf %s "checking for hid_init in -lusbhid... " >&6; } -if test ${ac_cv_lib_usbhid_hid_init+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusbhid" >&5 +$as_echo_n "checking for hid_init in -lusbhid... " >&6; } +if ${ac_cv_lib_usbhid_hid_init+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lusbhid $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -27564,65 +25094,65 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char hid_init (); int -main (void) +main () { return hid_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_usbhid_hid_init=yes -else $as_nop +else ac_cv_lib_usbhid_hid_init=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usbhid_hid_init" >&5 -printf "%s\n" "$ac_cv_lib_usbhid_hid_init" >&6; } -if test "x$ac_cv_lib_usbhid_hid_init" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usbhid_hid_init" >&5 +$as_echo "$ac_cv_lib_usbhid_hid_init" >&6; } +if test "x$ac_cv_lib_usbhid_hid_init" = xyes; then : have_libusbhid=yes fi if test x$have_libusbhid = xyes; then - ac_fn_c_check_header_compile "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default" -if test "x$ac_cv_header_usbhid_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "usbhid.h" "ac_cv_header_usbhid_h" "$ac_includes_default" +if test "x$ac_cv_header_usbhid_h" = xyes; then : USB_CFLAGS="-DHAVE_USBHID_H" fi - ac_fn_c_check_header_compile "$LINENO" "libusbhid.h" "ac_cv_header_libusbhid_h" "$ac_includes_default" -if test "x$ac_cv_header_libusbhid_h" = xyes -then : + + ac_fn_c_check_header_mongrel "$LINENO" "libusbhid.h" "ac_cv_header_libusbhid_h" "$ac_includes_default" +if test "x$ac_cv_header_libusbhid_h" = xyes; then : USB_CFLAGS="-DHAVE_LIBUSBHID_H" fi + USB_LIBS="$USB_LIBS -lusbhid" else - ac_fn_c_check_header_compile "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default" -if test "x$ac_cv_header_usb_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default" +if test "x$ac_cv_header_usb_h" = xyes; then : USB_CFLAGS="-DHAVE_USB_H" fi - ac_fn_c_check_header_compile "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" -if test "x$ac_cv_header_libusb_h" = xyes -then : + + ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" +if test "x$ac_cv_header_libusb_h" = xyes; then : USB_CFLAGS="-DHAVE_LIBUSB_H" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusb" >&5 -printf %s "checking for hid_init in -lusb... " >&6; } -if test ${ac_cv_lib_usb_hid_init+y} -then : - printf %s "(cached) " >&6 -else $as_nop + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hid_init in -lusb" >&5 +$as_echo_n "checking for hid_init in -lusb... " >&6; } +if ${ac_cv_lib_usb_hid_init+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lusb $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -27631,29 +25161,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char hid_init (); int -main (void) +main () { return hid_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_usb_hid_init=yes -else $as_nop +else ac_cv_lib_usb_hid_init=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usb_hid_init" >&5 -printf "%s\n" "$ac_cv_lib_usb_hid_init" >&6; } -if test "x$ac_cv_lib_usb_hid_init" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usb_hid_init" >&5 +$as_echo "$ac_cv_lib_usb_hid_init" >&6; } +if test "x$ac_cv_lib_usb_hid_init" = xyes; then : USB_LIBS="$USB_LIBS -lusb" fi @@ -27662,8 +25193,8 @@ fi save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $USB_CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for usbhid" >&5 -printf %s "checking for usbhid... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usbhid" >&5 +$as_echo_n "checking for usbhid... " >&6; } have_usbhid=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27688,7 +25219,7 @@ printf %s "checking for usbhid... " >&6; } #endif int -main (void) +main () { struct report_desc *repdesc; @@ -27699,17 +25230,16 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_usbhid=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_usbhid" >&5 -printf "%s\n" "$have_usbhid" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid" >&5 +$as_echo "$have_usbhid" >&6; } if test x$have_usbhid = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5 -printf %s "checking for ucr_data member of usb_ctl_report... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ucr_data member of usb_ctl_report" >&5 +$as_echo_n "checking for ucr_data member of usb_ctl_report... " >&6; } have_usbhid_ucr_data=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27734,7 +25264,7 @@ printf %s "checking for ucr_data member of usb_ctl_report... " >&6; } #endif int -main (void) +main () { struct usb_ctl_report buf; @@ -27744,19 +25274,18 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_usbhid_ucr_data=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test x$have_usbhid_ucr_data = xyes; then USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5 -printf "%s\n" "$have_usbhid_ucr_data" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_ucr_data" >&5 +$as_echo "$have_usbhid_ucr_data" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for new usbhid API" >&5 -printf %s "checking for new usbhid API... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for new usbhid API" >&5 +$as_echo_n "checking for new usbhid API... " >&6; } have_usbhid_new=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27781,7 +25310,7 @@ printf %s "checking for new usbhid API... " >&6; } #endif int -main (void) +main () { report_desc_t d; @@ -27791,19 +25320,18 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_usbhid_new=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test x$have_usbhid_new = xyes; then USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5 -printf "%s\n" "$have_usbhid_new" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_usbhid_new" >&5 +$as_echo "$have_usbhid_new" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct joystick in machine/joystick.h" >&5 -printf %s "checking for struct joystick in machine/joystick.h... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct joystick in machine/joystick.h" >&5 +$as_echo_n "checking for struct joystick in machine/joystick.h... " >&6; } have_machine_joystick=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27811,7 +25339,7 @@ printf %s "checking for struct joystick in machine/joystick.h... " >&6; } #include int -main (void) +main () { struct joystick t; @@ -27820,21 +25348,20 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_machine_joystick=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test x$have_machine_joystick = xyes; then -printf "%s\n" "#define SDL_HAVE_MACHINE_JOYSTICK_H 1" >>confdefs.h +$as_echo "#define SDL_HAVE_MACHINE_JOYSTICK_H 1" >>confdefs.h fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5 -printf "%s\n" "$have_machine_joystick" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_machine_joystick" >&5 +$as_echo "$have_machine_joystick" >&6; } -printf "%s\n" "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS" @@ -27851,18 +25378,16 @@ printf "%s\n" "#define SDL_JOYSTICK_USBHID 1" >>confdefs.h CheckHIDAPI() { # Check whether --enable-hidapi-joystick was given. -if test ${enable_hidapi_joystick+y} -then : +if test "${enable_hidapi_joystick+set}" = set; then : enableval=$enable_hidapi_joystick; -else $as_nop +else enable_hidapi_joystick=yes fi # Check whether --enable-hidapi-libusb was given. -if test ${enable_hidapi_libusb+y} -then : +if test "${enable_hidapi_libusb+set}" = set; then : enableval=$enable_hidapi_libusb; -else $as_nop +else enable_hidapi_libusb=maybe fi @@ -27887,17 +25412,17 @@ fi if test x$enable_hidapi_libusb = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libusb-1.0" >&5 -printf %s "checking for libusb-1.0... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb-1.0" >&5 +$as_echo_n "checking for libusb-1.0... " >&6; } if test -n "$LIBUSB_CFLAGS"; then pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb-1.0") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb-1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -27911,10 +25436,10 @@ if test -n "$LIBUSB_LIBS"; then pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb-1.0") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb-1.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -27928,8 +25453,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -27946,26 +25471,26 @@ fi have_libusb=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } have_libusb=no else LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } have_libusb=yes fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$save_CPPFLAGS $LIBUSB_CFLAGS" - ac_fn_c_check_header_compile "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" -if test "x$ac_cv_header_libusb_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default" +if test "x$ac_cv_header_libusb_h" = xyes; then : have_libusb_h=yes -else $as_nop +else have_libusb_h=no fi + CPPFLAGS="$save_CPPFLAGS" if test x$have_libusb_h = xno && test x$require_hidapi_libusb = xyes; then hidapi_support=no @@ -27979,8 +25504,8 @@ fi EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS" else if test x$have_loadso != xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libusb loading" >&2;} fi # libusb is loaded dynamically, so don't add it to LDFLAGS libusb_lib="" @@ -27999,21 +25524,23 @@ printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynam libusb_lib=`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` fi -printf "%s\n" "#define SDL_LIBUSB_DYNAMIC \"$libusb_lib\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SDL_LIBUSB_DYNAMIC "$libusb_lib" +_ACEOF fi fi fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for hidapi joystick support" >&5 -printf %s "checking for hidapi joystick support... " >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5 -printf "%s\n" "$hidapi_support" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hidapi joystick support" >&5 +$as_echo_n "checking for hidapi joystick support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hidapi_support" >&5 +$as_echo "$hidapi_support" >&6; } fi if test x$enable_joystick = xyes -a x$hidapi_support = xyes -a x$enable_hidapi_joystick = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c" fi @@ -28022,20 +25549,18 @@ printf "%s\n" "#define SDL_JOYSTICK_HIDAPI 1" >>confdefs.h CheckClockGettime() { # Check whether --enable-clock_gettime was given. -if test ${enable_clock_gettime+y} -then : +if test "${enable_clock_gettime+set}" = set; then : enableval=$enable_clock_gettime; -else $as_nop +else enable_clock_gettime=yes fi if test x$enable_clock_gettime = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 -printf %s "checking for clock_gettime in -lrt... " >&6; } -if test ${ac_cv_lib_rt_clock_gettime+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +$as_echo_n "checking for clock_gettime in -lrt... " >&6; } +if ${ac_cv_lib_rt_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -28044,44 +25569,44 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char clock_gettime (); int -main (void) +main () { return clock_gettime (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_rt_clock_gettime=yes -else $as_nop +else ac_cv_lib_rt_clock_gettime=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 -printf "%s\n" "$ac_cv_lib_rt_clock_gettime" >&6; } -if test "x$ac_cv_lib_rt_clock_gettime" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : have_clock_gettime=yes fi if test x$have_clock_gettime = xyes; then -printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h +$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt" else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5 -printf %s "checking for clock_gettime in -lc... " >&6; } -if test ${ac_cv_lib_c_clock_gettime+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5 +$as_echo_n "checking for clock_gettime in -lc... " >&6; } +if ${ac_cv_lib_c_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -28090,35 +25615,36 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char clock_gettime (); int -main (void) +main () { return clock_gettime (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_clock_gettime=yes -else $as_nop +else ac_cv_lib_c_clock_gettime=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5 -printf "%s\n" "$ac_cv_lib_c_clock_gettime" >&6; } -if test "x$ac_cv_lib_c_clock_gettime" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5 +$as_echo "$ac_cv_lib_c_clock_gettime" >&6; } +if test "x$ac_cv_lib_c_clock_gettime" = xyes; then : have_clock_gettime=yes fi if test x$have_clock_gettime = xyes; then -printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h +$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS" fi @@ -28128,12 +25654,12 @@ printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h CheckLinuxVersion() { - ac_fn_c_check_header_compile "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_version_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_version_h" = xyes; then : have_linux_version_h=yes fi + if test x$have_linux_version_h = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H" fi @@ -28142,10 +25668,9 @@ fi CheckRPATH() { # Check whether --enable-rpath was given. -if test ${enable_rpath+y} -then : +if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; -else $as_nop +else enable_rpath=yes fi @@ -28154,10 +25679,9 @@ fi CheckEventSignals() { # Check whether --enable-backgrounding-signal was given. -if test ${enable_backgrounding_signal+y} -then : +if test "${enable_backgrounding_signal+set}" = set; then : enableval=$enable_backgrounding_signal; -else $as_nop +else enable_backgrounding_signal=no fi @@ -28166,10 +25690,9 @@ fi fi # Check whether --enable-foregrounding-signal was given. -if test ${enable_foregrounding_signal+y} -then : +if test "${enable_foregrounding_signal+set}" = set; then : enableval=$enable_foregrounding_signal; -else $as_nop +else enable_foregrounding_signal=no fi @@ -28181,16 +25704,15 @@ fi CheckVirtualJoystick() { # Check whether --enable-joystick-virtual was given. -if test ${enable_joystick_virtual+y} -then : +if test "${enable_joystick_virtual+set}" = set; then : enableval=$enable_joystick_virtual; -else $as_nop +else enable_joystick_virtual=yes fi if test x$enable_joystick = xyes -a x$enable_joystick_virtual = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_VIRTUAL 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_VIRTUAL 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/virtual/*.c" have_joystick_virtual=yes @@ -28219,10 +25741,9 @@ case "$host" in if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" -printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} android" - have_video=yes fi ;; *-*-linux*) ARCH=linux ;; @@ -28304,22 +25825,18 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h CheckRPATH CheckVivanteVideo - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" - have_misc=yes - fi - # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" + have_misc=yes + + SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" + have_locale=yes + # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in sysv5|solaris|hpux) -printf "%s\n" "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" SUMMARY_audio="${SUMMARY_audio} sun" @@ -28327,7 +25844,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h ;; netbsd) # Don't use this on OpenBSD, it's busted. -printf "%s\n" "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" SUMMARY_audio="${SUMMARY_audio} netbsd" @@ -28335,7 +25852,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h ;; aix) -printf "%s\n" "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" SUMMARY_audio="${SUMMARY_audio} paudio" @@ -28343,19 +25860,19 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h ;; android) -printf "%s\n" "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/android/*.c" SUMMARY_audio="${SUMMARY_audio} android" -printf "%s\n" "#define SDL_AUDIO_DRIVER_OPENSLES 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_OPENSLES 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/openslES/*.c" SUMMARY_audio="${SUMMARY_audio} openslES" -printf "%s\n" "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/aaudio/*.c" SUMMARY_audio="${SUMMARY_audio} aaudio" @@ -28372,7 +25889,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h case $ARCH in linux) -printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -28381,7 +25898,7 @@ printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h freebsd) if test x$use_input_events = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -28390,7 +25907,7 @@ printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h ;; android) -printf "%s\n" "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -28404,7 +25921,7 @@ printf "%s\n" "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h linux|freebsd) if test x$use_input_events = xyes; then -printf "%s\n" "#define SDL_HAPTIC_LINUX 1" >>confdefs.h +$as_echo "#define SDL_HAPTIC_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" have_haptic=yes @@ -28412,7 +25929,7 @@ printf "%s\n" "#define SDL_HAPTIC_LINUX 1" >>confdefs.h ;; android) -printf "%s\n" "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h +$as_echo "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" have_haptic=yes @@ -28424,7 +25941,7 @@ printf "%s\n" "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h case $ARCH in android) -printf "%s\n" "#define SDL_SENSOR_ANDROID 1" >>confdefs.h +$as_echo "#define SDL_SENSOR_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/sensor/android/*.c" have_sensor=yes @@ -28436,14 +25953,14 @@ printf "%s\n" "#define SDL_SENSOR_ANDROID 1" >>confdefs.h case $ARCH in linux) -printf "%s\n" "#define SDL_POWER_LINUX 1" >>confdefs.h +$as_echo "#define SDL_POWER_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/linux/*.c" have_power=yes ;; android) -printf "%s\n" "#define SDL_POWER_ANDROID 1" >>confdefs.h +$as_echo "#define SDL_POWER_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/android/*.c" have_power=yes @@ -28455,14 +25972,14 @@ printf "%s\n" "#define SDL_POWER_ANDROID 1" >>confdefs.h case $ARCH in android) -printf "%s\n" "#define SDL_FILESYSTEM_ANDROID 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c" have_filesystem=yes ;; *) -printf "%s\n" "#define SDL_FILESYSTEM_UNIX 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c" have_filesystem=yes @@ -28472,7 +25989,7 @@ printf "%s\n" "#define SDL_FILESYSTEM_UNIX 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -28525,67 +26042,56 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/windows/*.c" - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/windows/*.c" - have_misc=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/windows/*.c" + have_misc=yes # Use the Windows locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" + have_locale=yes + # Set up files for the video library if test x$enable_video = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_WINDOWS 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/windows/*.c" have_video=yes # Check whether --enable-render-d3d was given. -if test ${enable_render_d3d+y} -then : +if test "${enable_render_d3d+set}" = set; then : enableval=$enable_render_d3d; -else $as_nop +else enable_render_d3d=yes fi if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then -printf "%s\n" "#define SDL_VIDEO_RENDER_D3D 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_D3D 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} d3d9" fi if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then -printf "%s\n" "#define SDL_VIDEO_RENDER_D3D11 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_D3D11 1" >>confdefs.h SUMMARY_video="${SUMMARY_video} d3d11" fi - if test x$enable_render_d3d = xyes -a x$have_d3d12 = xyes; then - -printf "%s\n" "#define SDL_VIDEO_RENDER_D3D12 1" >>confdefs.h - - SUMMARY_video="${SUMMARY_video} d3d12" - fi fi # Set up files for the audio library if test x$enable_audio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_WINMM 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_WINMM 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} winmm" SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" if test x$have_dsound = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} directsound" SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} wasapi" SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" @@ -28595,22 +26101,22 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h # Set up files for the joystick library if test x$enable_joystick = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_RAWINPUT 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_RAWINPUT 1" >>confdefs.h if test x$have_dinput = xyes -o x$have_xinput = xyes -o x$have_wgi = xyes; then if test x$have_xinput = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_XINPUT 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_XINPUT 1" >>confdefs.h fi if test x$have_wgi = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_WGI 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_WGI 1" >>confdefs.h fi if test x$have_dinput = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8" fi @@ -28622,35 +26128,46 @@ printf "%s\n" "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h if test x$have_dinput = xyes -o x$have_xinput = xyes; then if test x$have_xinput = xyes; then -printf "%s\n" "#define SDL_HAPTIC_XINPUT 1" >>confdefs.h +$as_echo "#define SDL_HAPTIC_XINPUT 1" >>confdefs.h fi if test x$have_dinput = xyes; then -printf "%s\n" "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h +$as_echo "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c" have_haptic=yes fi fi + ac_fn_c_check_header_mongrel "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default" +if test "x$ac_cv_header_tpcshrd_h" = xyes; then : + have_tpcshrd_h=yes +fi + + + if test x$have_tpcshrd_h = xyes; then + +$as_echo "#define HAVE_TPCSHRD_H 1" >>confdefs.h + + fi # Set up files for the sensor library - ac_fn_c_check_header_compile "$LINENO" "sensorsapi.h" "ac_cv_header_sensorsapi_h" "$ac_includes_default" -if test "x$ac_cv_header_sensorsapi_h" = xyes -then : + ac_fn_c_check_header_mongrel "$LINENO" "sensorsapi.h" "ac_cv_header_sensorsapi_h" "$ac_includes_default" +if test "x$ac_cv_header_sensorsapi_h" = xyes; then : have_winsensors=yes -else $as_nop +else have_winsensors=no fi + if test x$have_winsensors = xyes; then -printf "%s\n" "#define HAVE_SENSORSAPI_H 1" >>confdefs.h +$as_echo "#define HAVE_SENSORSAPI_H 1" >>confdefs.h fi if test x$enable_sensor = xyes -a x$have_winsensors = xyes; then -printf "%s\n" "#define SDL_SENSOR_WINDOWS 1" >>confdefs.h +$as_echo "#define SDL_SENSOR_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/sensor/windows/*.c" have_sensor=yes @@ -28658,7 +26175,7 @@ printf "%s\n" "#define SDL_SENSOR_WINDOWS 1" >>confdefs.h # Set up files for the power library if test x$enable_power = xyes; then -printf "%s\n" "#define SDL_POWER_WINDOWS 1" >>confdefs.h +$as_echo "#define SDL_POWER_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c" have_power=yes @@ -28666,7 +26183,7 @@ printf "%s\n" "#define SDL_POWER_WINDOWS 1" >>confdefs.h # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_WINDOWS 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c" have_filesystem=yes @@ -28674,10 +26191,10 @@ printf "%s\n" "#define SDL_FILESYSTEM_WINDOWS 1" >>confdefs.h # Set up files for the thread library if test x$enable_threads = xyes; then -printf "%s\n" "#define SDL_THREAD_GENERIC_COND_SUFFIX 1" >>confdefs.h +$as_echo "#define SDL_THREAD_GENERIC_COND_SUFFIX 1" >>confdefs.h -printf "%s\n" "#define SDL_THREAD_WINDOWS 1" >>confdefs.h +$as_echo "#define SDL_THREAD_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/thread/windows/*.c" SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" @@ -28686,7 +26203,7 @@ printf "%s\n" "#define SDL_THREAD_WINDOWS 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_WINDOWS 1" >>confdefs.h +$as_echo "#define SDL_TIMER_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/windows/*.c" have_timers=yes @@ -28694,7 +26211,7 @@ printf "%s\n" "#define SDL_TIMER_WINDOWS 1" >>confdefs.h # Set up files for the shared object loading library if test x$enable_loadso = xyes; then -printf "%s\n" "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h +$as_echo "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c" fi @@ -28714,12 +26231,11 @@ printf "%s\n" "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h # Check to see if this is a mingw or cygwin build have_mingw32= - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -lmingw32" >&5 -printf %s "checking for main in -lmingw32... " >&6; } -if test ${ac_cv_lib_mingw32_main+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmingw32" >&5 +$as_echo_n "checking for main in -lmingw32... " >&6; } +if ${ac_cv_lib_mingw32_main+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lmingw32 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -28727,27 +26243,25 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext int -main (void) +main () { return main (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_mingw32_main=yes -else $as_nop +else ac_cv_lib_mingw32_main=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mingw32_main" >&5 -printf "%s\n" "$ac_cv_lib_mingw32_main" >&6; } -if test "x$ac_cv_lib_mingw32_main" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mingw32_main" >&5 +$as_echo "$ac_cv_lib_mingw32_main" >&6; } +if test "x$ac_cv_lib_mingw32_main" = xyes; then : have_mingw32=yes fi @@ -28757,11 +26271,13 @@ fi SDL_LIBS="-lcygwin $SDL_LIBS" fi ;; - *-*-beos*) + + *-*-beos*) as_fn_error $? " *** BeOS support has been removed as of SDL 2.0.2. " "$LINENO" 5 ;; + *-*-haiku*) ARCH=haiku ac_default_prefix=/boot/system @@ -28778,7 +26294,7 @@ fi # Set up files for the audio library if test x$enable_audio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" SUMMARY_audio="${SUMMARY_audio} haiku" @@ -28787,7 +26303,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h # Set up files for the joystick library if test x$enable_joystick = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_HAIKU 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc" have_joystick=yes @@ -28795,7 +26311,7 @@ printf "%s\n" "#define SDL_JOYSTICK_HAIKU 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_HAIKU 1" >>confdefs.h +$as_echo "#define SDL_TIMER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" have_timers=yes @@ -28803,7 +26319,7 @@ printf "%s\n" "#define SDL_TIMER_HAIKU 1" >>confdefs.h # Set up files for the system power library if test x$enable_power = xyes; then -printf "%s\n" "#define SDL_POWER_HAIKU 1" >>confdefs.h +$as_echo "#define SDL_POWER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/haiku/*.c" have_power=yes @@ -28811,21 +26327,19 @@ printf "%s\n" "#define SDL_POWER_HAIKU 1" >>confdefs.h # Set up files for the system filesystem library if test x$enable_filesystem = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc" have_filesystem=yes fi - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc" - have_misc=yes - fi + + SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc" + have_misc=yes + # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" + have_locale=yes + # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" @@ -28845,20 +26359,17 @@ printf "%s\n" "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h CheckVulkan CheckPTHREAD - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/ios/*.m" - have_misc=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/ios/*.m" + have_misc=yes + # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" + have_locale=yes + # Set up files for the audio library if test x$enable_audio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" @@ -28867,7 +26378,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h # Set up files for the joystick library if test x$enable_joystick = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_MFI 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -28885,7 +26396,7 @@ printf "%s\n" "#define SDL_JOYSTICK_MFI 1" >>confdefs.h # Set up files for the sensor library if test x$enable_sensor = xyes; then -printf "%s\n" "#define SDL_SENSOR_COREMOTION 1" >>confdefs.h +$as_echo "#define SDL_SENSOR_COREMOTION 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/sensor/coremotion/*.m" have_sensor=yes @@ -28893,7 +26404,7 @@ printf "%s\n" "#define SDL_SENSOR_COREMOTION 1" >>confdefs.h # Set up files for the power library if test x$enable_power = xyes; then -printf "%s\n" "#define SDL_POWER_UIKIT 1" >>confdefs.h +$as_echo "#define SDL_POWER_UIKIT 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" have_power=yes @@ -28906,14 +26417,14 @@ printf "%s\n" "#define SDL_POWER_UIKIT 1" >>confdefs.h # Set up additional files for the file library if test x$enable_file = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" fi # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -28922,23 +26433,21 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The iOS platform requires special setup. -printf "%s\n" "#define SDL_VIDEO_DRIVER_UIKIT 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_UIKIT 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" - SUMMARY_video="${SUMMARY_video} uikit" - have_video=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" @@ -28965,7 +26474,6 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" - CheckObjectiveCARC CheckVisibilityHidden CheckDeclarationAfterStatement CheckDummyVideo @@ -28985,20 +26493,17 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h CheckPTHREAD CheckHIDAPI - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m" - have_misc=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m" + have_misc=yes + # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" + have_locale=yes + # Set up files for the audio library if test x$enable_audio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox" @@ -29008,7 +26513,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h # Set up files for the joystick library if test x$enable_joystick = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c" SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" @@ -29018,7 +26523,7 @@ printf "%s\n" "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h # Set up files for the haptic library if test x$enable_haptic = xyes; then -printf "%s\n" "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h +$as_echo "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback" @@ -29027,7 +26532,7 @@ printf "%s\n" "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h # Set up files for the power library if test x$enable_power = xyes; then -printf "%s\n" "#define SDL_POWER_MACOSX 1" >>confdefs.h +$as_echo "#define SDL_POWER_MACOSX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/macosx/*.c" have_power=yes @@ -29035,7 +26540,7 @@ printf "%s\n" "#define SDL_POWER_MACOSX 1" >>confdefs.h # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" have_filesystem=yes @@ -29043,7 +26548,7 @@ printf "%s\n" "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -29078,7 +26583,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -29086,7 +26591,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h if test x$enable_filesystem = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_NACL 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_NACL 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c" have_filesystem=yes @@ -29095,7 +26600,7 @@ printf "%s\n" "#define SDL_FILESYSTEM_NACL 1" >>confdefs.h *-*-emscripten* ) if test x$enable_video = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c" have_video=yes @@ -29104,7 +26609,7 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1" >>confdefs.h if test x$enable_audio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c" have_audio=yes @@ -29122,25 +26627,19 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h CheckClockGettime CheckEmscriptenGLES - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/emscripten/*.c" - have_misc=yes - fi - # Set up files for the power library if test x$enable_power = xyes; then -printf "%s\n" "#define SDL_POWER_EMSCRIPTEN 1" >>confdefs.h +$as_echo "#define SDL_POWER_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c" have_power=yes fi - # Set up files for the joystick library + # Set up files for the power library if test x$enable_joystick = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_EMSCRIPTEN 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c" have_joystick=yes @@ -29149,7 +26648,7 @@ printf "%s\n" "#define SDL_JOYSTICK_EMSCRIPTEN 1" >>confdefs.h # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_EMSCRIPTEN 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_EMSCRIPTEN 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c" have_filesystem=yes @@ -29157,16 +26656,14 @@ printf "%s\n" "#define SDL_FILESYSTEM_EMSCRIPTEN 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" + have_locale=yes ;; *-*-riscos*) ARCH=riscos @@ -29182,15 +26679,13 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h CheckPTHREAD CheckClockGettime - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c" - have_misc=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c" + have_misc=yes + # Set up files for the video library if test x$enable_video = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_RISCOS 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_RISCOS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/riscos/*.c" have_video=yes @@ -29199,7 +26694,7 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_RISCOS 1" >>confdefs.h # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_RISCOS 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_RISCOS 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/riscos/*.c" have_filesystem=yes @@ -29207,7 +26702,7 @@ printf "%s\n" "#define SDL_FILESYSTEM_RISCOS 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -29239,14 +26734,12 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" fi # Use the Unix locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" + have_locale=yes # Set up files for the video library if test x$enable_video = xyes; then -printf "%s\n" "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/os2/*.c" have_video=yes @@ -29255,7 +26748,7 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h # Set up files for the audio library if test x$enable_audio = xyes; then -printf "%s\n" "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" have_audio=yes @@ -29265,7 +26758,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h # Set up files for the thread library if test x$enable_threads = xyes; then -printf "%s\n" "#define SDL_THREAD_OS2 1" >>confdefs.h +$as_echo "#define SDL_THREAD_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/thread/os2/*.c" SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" @@ -29274,7 +26767,7 @@ printf "%s\n" "#define SDL_THREAD_OS2 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_OS2 1" >>confdefs.h +$as_echo "#define SDL_TIMER_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/os2/*.c" have_timers=yes @@ -29282,7 +26775,7 @@ printf "%s\n" "#define SDL_TIMER_OS2 1" >>confdefs.h # Set up files for the shared object loading library if test x$enable_loadso = xyes; then -printf "%s\n" "#define SDL_LOADSO_OS2 1" >>confdefs.h +$as_echo "#define SDL_LOADSO_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c" have_loadso=yes @@ -29290,7 +26783,7 @@ printf "%s\n" "#define SDL_LOADSO_OS2 1" >>confdefs.h # Set up files for the filesystem library if test x$enable_filesystem = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c" have_filesystem=yes @@ -29298,7 +26791,7 @@ printf "%s\n" "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h # Set up files for the joystick library if test x$enable_joystick = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_OS2 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_OS2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c" have_joystick=yes @@ -29314,68 +26807,41 @@ esac CheckVirtualJoystick # Check whether to install sdl2-config -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5 -printf %s "checking whether to install sdl2-config... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5 +$as_echo_n "checking whether to install sdl2-config... " >&6; } # Check whether --enable-sdl2-config was given. -if test ${enable_sdl2_config+y} -then : +if test "${enable_sdl2_config+set}" = set; then : enableval=$enable_sdl2_config; case "${enableval}" in yes) enable_sdl2_config="TRUE" ;; no) enable_sdl2_config="FALSE" ;; *) as_fn_error $? "bad value '${enableval}' for --enable-sdl2-config" "$LINENO" 5 ;; esac -else $as_nop +else enable_sdl2_config="TRUE" fi if test "$enable_sdl2_config" = "TRUE"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi INSTALL_SDL2_CONFIG=$enable_sdl2_config # Verify that we have all the platform specific files we need -if test x$have_audio != xyes; then - if test x$enable_audio = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h - - fi - SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" -fi -if test x$have_video != xyes; then - if test x$enable_video = xyes; then - -printf "%s\n" "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h - - fi - SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" -fi if test x$have_misc != xyes; then - if test x$enable_misc = xyes; then - -printf "%s\n" "#define SDL_MISC_DUMMY 1" >>confdefs.h - - fi SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c" fi if test x$have_locale != xyes; then - if test x$enable_locale = xyes; then - -printf "%s\n" "#define SDL_LOCALE_DUMMY 1" >>confdefs.h - - fi SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c" fi if test x$have_joystick != xyes; then if test x$enable_joystick = xyes; then -printf "%s\n" "#define SDL_JOYSTICK_DUMMY 1" >>confdefs.h +$as_echo "#define SDL_JOYSTICK_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c" @@ -29383,7 +26849,7 @@ fi if test x$have_haptic != xyes; then if test x$enable_haptic = xyes; then -printf "%s\n" "#define SDL_HAPTIC_DUMMY 1" >>confdefs.h +$as_echo "#define SDL_HAPTIC_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c" @@ -29391,7 +26857,7 @@ fi if test x$have_sensor != xyes; then if test x$enable_sensor = xyes; then -printf "%s\n" "#define SDL_SENSOR_DUMMY 1" >>confdefs.h +$as_echo "#define SDL_SENSOR_DUMMY 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c" @@ -29399,7 +26865,7 @@ fi if test x$have_threads != xyes; then if test x$enable_threads = xyes; then -printf "%s\n" "#define SDL_THREADS_DISABLED 1" >>confdefs.h +$as_echo "#define SDL_THREADS_DISABLED 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/thread/generic/*.c" @@ -29407,7 +26873,7 @@ fi if test x$have_timers != xyes; then if test x$enable_timers = xyes; then -printf "%s\n" "#define SDL_TIMER_DUMMY 1" >>confdefs.h +$as_echo "#define SDL_TIMERS_DISABLED 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c" @@ -29415,7 +26881,7 @@ fi if test x$have_filesystem != xyes; then if test x$enable_filesystem = xyes; then -printf "%s\n" "#define SDL_FILESYSTEM_DUMMY 1" >>confdefs.h +$as_echo "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c" @@ -29423,7 +26889,7 @@ fi if test x$have_loadso != xyes; then if test x$enable_loadso = xyes; then -printf "%s\n" "#define SDL_LOADSO_DUMMY 1" >>confdefs.h +$as_echo "#define SDL_LOADSO_DISABLED 1" >>confdefs.h fi SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c" @@ -29496,8 +26962,8 @@ if test "x$enable_rpath" = "xyes" -a "x$enable_shared" = "xyes"; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5 -printf %s "checking for linker option --enable-new-dtags... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5 +$as_echo_n "checking for linker option --enable-new-dtags... " >&6; } have_enable_new_dtags=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" @@ -29505,25 +26971,24 @@ printf %s "checking for linker option --enable-new-dtags... " >&6; } /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : have_enable_new_dtags=yes SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5 -printf "%s\n" "$have_enable_new_dtags" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5 +$as_echo "$have_enable_new_dtags" >&6; } fi if test $ARCH = solaris; then SDL_RLD_FLAGS="-R\${libdir}" @@ -29534,15 +26999,6 @@ fi SDL_STATIC_LIBS="$EXTRA_LDFLAGS" -eval pkg_prefix=$prefix -eval pkg_cmakedir=$libdir/cmake/SDL2 -cmake_prefix_relpath="$(echo -n "$pkg_cmakedir" | sed -E "s#^$pkg_prefix##" | sed -E "s#[A-Za-z0-9_ .-]+#..#g" )" - - -eval pkg_bindir=$bindir -bin_prefix_relpath="$(echo -n "pkg_bindir" | sed -E "s#^$pkg_prefix##" | sed -E "s#[A-Za-z0-9_ .-]+#..#g" )" - - @@ -29700,8 +27156,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -29731,15 +27187,15 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -29753,8 +27209,8 @@ printf "%s\n" "$as_me: updating cache $cache_file" >&6;} fi fi else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -29771,7 +27227,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -29787,8 +27243,8 @@ LTLIBOBJS=$ac_ltlibobjs ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -29811,16 +27267,14 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop +else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -29830,46 +27284,46 @@ esac fi - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi # The user is always right. -if ${PATH_SEPARATOR+false} :; then +if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -29878,6 +27332,13 @@ if ${PATH_SEPARATOR+false} :; then fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -29886,12 +27347,8 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS @@ -29903,10 +27360,30 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -29919,14 +27396,13 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - printf "%s\n" "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -29953,20 +27429,18 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset - # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' -else $as_nop +else as_fn_append () { eval $1=\$$1\$2 @@ -29978,13 +27452,12 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else $as_nop +else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -30015,7 +27488,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -30037,10 +27510,6 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -30054,12 +27523,6 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -30101,7 +27564,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -30110,7 +27573,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | +$as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -30173,7 +27636,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.71. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -30235,16 +27698,14 @@ $config_commands Report bugs to the package provider." _ACEOF -ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` -ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config='$ac_cs_config_escaped' +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.71, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2021 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -30283,15 +27744,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - printf "%s\n" "$ac_cs_version"; exit ;; + $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - printf "%s\n" "$ac_cs_config"; exit ;; + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -30299,7 +27760,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -30308,7 +27769,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - printf "%s\n" "$ac_cs_usage"; exit ;; + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -30336,7 +27797,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -30350,7 +27811,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - printf "%s\n" "$ac_log" + $as_echo "$ac_log" } >&5 _ACEOF @@ -30858,9 +28319,9 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files - test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers - test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -31196,7 +28657,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -31204,17 +28665,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -printf "%s\n" "$as_me: creating $ac_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`printf "%s\n" "$configure_input" | + ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -31231,7 +28692,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$ac_file" | +$as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -31255,9 +28716,9 @@ printf "%s\n" X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -31314,8 +28775,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -31358,9 +28819,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -31376,27 +28837,27 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - printf "%s\n" "/* $configure_input */" >&1 \ + $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - printf "%s\n" "/* $configure_input */" >&1 \ + $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; - :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -31947,7 +29408,6 @@ _LT_EOF esac - ltmain=$ac_aux_dir/ltmain.sh @@ -32305,8 +29765,7 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/externals/SDL/configure.ac b/externals/SDL/configure.ac index ee8a41ebf..3c1c6c858 100755 --- a/externals/SDL/configure.ac +++ b/externals/SDL/configure.ac @@ -10,21 +10,23 @@ dnl Save the CFLAGS to see whether they were passed in or generated orig_CFLAGS="$CFLAGS" dnl Set various version strings - taken gratefully from the GTk sources -# See docs/release_checklist.md +# +# Making releases: +# Edit include/SDL_version.h and change the version, then: +# SDL_MICRO_VERSION += 1; +# SDL_INTERFACE_AGE += 1; +# SDL_BINARY_AGE += 1; +# if any functions have been added, set SDL_INTERFACE_AGE to 0. +# if backwards compatibility has been broken, +# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. +# SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=23 -SDL_MICRO_VERSION=1 +SDL_MINOR_VERSION=0 +SDL_MICRO_VERSION=20 +SDL_INTERFACE_AGE=2 +SDL_BINARY_AGE=20 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION -SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` -AS_CASE(["$SDL_MINOR_VERSION"], - [*@<:@02468@:>@], - dnl Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1 - [SDL_INTERFACE_AGE="$SDL_MICRO_VERSION"], - [*], - dnl Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0 - [SDL_INTERFACE_AGE=0]) - AC_SUBST(SDL_MAJOR_VERSION) AC_SUBST(SDL_MINOR_VERSION) AC_SUBST(SDL_MICRO_VERSION) @@ -36,17 +38,10 @@ AC_SUBST(SDL_VERSION) LT_INIT([win32-dll]) LT_LANG([Windows Resource]) -# For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. -# TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0 -LT_RELEASE=2.0 -# Increment this if there is an incompatible change - but if that happens, -# we should rename the library from SDL2 to SDL3, at which point this would -# reset to 0 anyway. -LT_MAJOR=0 -LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` -LT_CURRENT=`expr $LT_MAJOR + $LT_AGE` +LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION +LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE` LT_REVISION=$SDL_INTERFACE_AGE +LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` m4_pattern_allow([^LT_]) AC_SUBST(LT_RELEASE) @@ -60,14 +55,10 @@ dnl AC_CANONICAL_HOST dnl Check for tools AC_PROG_CC AC_PROG_CXX -AC_PROG_EGREP AC_PROG_INSTALL AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG -dnl 64-bit file offsets if possible unless --disable-largefile is specified -AC_SYS_LARGEFILE - dnl Make sure that srcdir is a full pathname case "$host" in *-*-mingw*) @@ -227,10 +218,6 @@ case "$enable_assertions" in ;; esac -AC_DEFINE_UNQUOTED([SDL_BUILD_MAJOR_VERSION], $SDL_MAJOR_VERSION, [ ]) -AC_DEFINE_UNQUOTED([SDL_BUILD_MINOR_VERSION], $SDL_MINOR_VERSION, [ ]) -AC_DEFINE_UNQUOTED([SDL_BUILD_MICRO_VERSION], $SDL_MICRO_VERSION, [ ]) - dnl See whether we can use gcc style dependency tracking AC_ARG_ENABLE(dependency-tracking, [AS_HELP_STRING([--enable-dependency-tracking], @@ -254,9 +241,10 @@ fi AC_MSG_CHECKING(for linker option --no-undefined) have_no_undefined=no case "$host" in -dnl Skip this on platforms where it is just simply busted. + dnl Skip this on platforms where it is just simply busted. *-*-openbsd*) ;; + *) save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--no-undefined" @@ -321,20 +309,25 @@ AC_ARG_ENABLE(libc, if test x$enable_libc = xyes; then AC_DEFINE(HAVE_LIBC, 1, [ ]) -dnl Check for C library headers -dnl AC_CHECK_INCLUDES_DEFAULT is an autoconf-2.7x thing where AC_HEADER_STDC is deprecated. - m4_ifdef([AC_CHECK_INCLUDES_DEFAULT], [AC_CHECK_INCLUDES_DEFAULT], [AC_HEADER_STDC]) + dnl Check for C library headers + AC_HEADER_STDC AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) -dnl Check for typedefs, structures, etc. + dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T -dnl Check for defines + dnl Check for defines AC_CHECK_DEFINE(M_PI, math.h) - AC_FUNC_ALLOCA + dnl Checks for library functions. + case "$host" in + *-*-cygwin* | *-*-mingw*) + ;; + *) + AC_FUNC_ALLOCA + ;; + esac -dnl Checks for library functions. AC_FUNC_MEMCMP if test x$ac_cv_func_memcmp_working = xyes; then AC_DEFINE(HAVE_MEMCMP, 1, [ ]) @@ -351,7 +344,7 @@ dnl Checks for library functions. AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ],[]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) @@ -361,7 +354,7 @@ dnl Checks for library functions. AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) -dnl Check for additional non-standard headers + dnl Check for additional non-standard headers AC_CHECK_HEADERS(libunwind.h) fi @@ -429,18 +422,9 @@ SOURCES="$SOURCES $srcdir/src/locale/*.c" dnl Enable/disable various subsystems of the SDL library -case "$host" in - *-*-emscripten*) - default_atomic=no - ;; - *) - default_atomic=yes - ;; -esac - AC_ARG_ENABLE(atomic, [AS_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [default=yes]])], - , enable_atomic=$default_atomic) + , enable_atomic=yes) if test x$enable_atomic != xyes; then AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ]) else @@ -550,22 +534,6 @@ if test x$enable_file != xyes; then else SUMMARY_modules="${SUMMARY_modules} file" fi -AC_ARG_ENABLE(misc, -[AS_HELP_STRING([--enable-misc], [Enable the misc subsystem [default=yes]])], - , enable_misc=yes) -if test x$enable_misc != xyes; then - AC_DEFINE(SDL_MISC_DISABLED, 1, [ ]) -else - SUMMARY_modules="${SUMMARY_modules} misc" -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, [AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]])], , enable_loadso=yes) @@ -588,6 +556,8 @@ AC_ARG_ENABLE(assembly, if test x$enable_assembly = xyes; then SUMMARY_modules="${SUMMARY_modules} assembly" + AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ]) + # Make sure that we don't generate floating point code that would # cause illegal instruction exceptions on older processors case "$host" in @@ -612,7 +582,7 @@ if test x$enable_assembly = xyes; then fi fi -dnl Check for various instruction support + dnl Check for various instruction support AC_ARG_ENABLE(mmx, [AS_HELP_STRING([--enable-mmx], [use MMX assembly routines [default=yes]])], , enable_mmx=yes) @@ -856,70 +826,6 @@ dnl Check for various instruction support fi fi - AC_ARG_ENABLE(lsx, -[AS_HELP_STRING([--enable-lsx], [use LSX assembly routines [default=yes]])], - , enable_lsx=yes) - if test x$enable_lsx = xyes; then - save_CFLAGS="$CFLAGS" - have_gcc_lsx=no - AC_MSG_CHECKING(for GCC -mlsx option) - lsx_CFLAGS="-mlsx" - CFLAGS="$save_CFLAGS $lsx_CFLAGS" - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #ifndef __loongarch_sx - #error Assembler CPP flag not enabled - #endif - ]], [])], [have_gcc_lsx=yes], []) - AC_MSG_RESULT($have_gcc_lsx) - CFLAGS="$save_CFLAGS" - - if test x$have_gcc_lsx = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS" - SUMMARY_math="${SUMMARY_math} lsx" - fi - fi - - AC_MSG_CHECKING(for lsxintrin.h) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]])], - [have_lsxintrin_h_hdr=yes],[have_lsxintrin_h_hdr=no]) - AC_MSG_RESULT($have_lsxintrin_h_hdr) - if test x$have_lsxintrin_h_hdr = xyes; then - AC_DEFINE(HAVE_LSXINTRIN_H, 1, [ ]) - fi - - AC_ARG_ENABLE(lasx, -[AS_HELP_STRING([--enable-lasx], [use LASX assembly routines [default=yes]])], - , enable_LASX=yes) - if test x$enable_LASX = xyes; then - save_CFLAGS="$CFLAGS" - have_gcc_lasx=no - AC_MSG_CHECKING(for GCC -mlasx option) - lasx_CFLAGS="-mlasx" - CFLAGS="$save_CFLAGS $lasx_CFLAGS" - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #ifndef __loongarch_asx - #error Assembler CPP flag not enabled - #endif - ]], [])], [have_gcc_lasx=yes], []) - AC_MSG_RESULT($have_gcc_lasx) - CFLAGS="$save_CFLAGS" - - if test x$have_gcc_lasx = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS $lasx_CFLAGS" - SUMMARY_math="${SUMMARY_math} lasx" - fi - fi - - AC_MSG_CHECKING(for lasxintrin.h) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]])], - [have_lasxintrin_h_hdr=yes],[have_lasxintrin_h_hdr=no]) - AC_MSG_RESULT($have_lasxintrin_h_hdr) - if test x$have_lasxintrin_h_hdr = xyes; then - AC_DEFINE(HAVE_LASXINTRIN_H, 1, [ ]) - fi - dnl See if the OSS audio interface is supported CheckOSS() { @@ -1374,7 +1280,6 @@ CheckDiskAudio() AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/disk/*.c" SUMMARY_audio="${SUMMARY_audio} disk" - have_audio=yes fi } @@ -1388,7 +1293,6 @@ CheckDummyAudio() AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" SUMMARY_audio="${SUMMARY_audio} dummy" - have_audio=yes fi } @@ -1499,26 +1403,6 @@ CheckNEON() fi } -dnl See if clang's -fobjc-arc supported. -dnl Reference: https://github.com/libsdl-org/SDL/pull/5632 -CheckObjectiveCARC() -{ - AC_MSG_CHECKING(for clang -fobjc-arc option) - have_clang_objc_arc=no - - save_CFLAGS="$CFLAGS" - CFLAGS="$save_CFLAGS -fobjc-arc" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - int x = 0; - ]],[])], [have_clang_objc_arc=yes],[]) - AC_MSG_RESULT($have_clang_objc_arc) - CFLAGS="$save_CFLAGS" - - if test x$have_clang_objc_arc = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-arc" - fi -} - dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility CheckVisibilityHidden() @@ -1620,7 +1504,7 @@ CheckWarnAll() if test x$have_gcc_Wall = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" -dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall. + dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall. AC_MSG_CHECKING(for necessary GCC -Wno-multichar option) need_gcc_Wno_multichar=no case "$host" in @@ -1651,7 +1535,7 @@ CheckWayland() video_wayland=no if test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists 'wayland-client >= 1.18' wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then + if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` @@ -1682,7 +1566,7 @@ dnl FIXME: Do BSD and OS X need special cases? wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] if test x$wayland_egl_lib = x; then - # This works in Ubuntu 13.10, maybe others + dnl This works in Ubuntu 13.10, maybe others wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] fi wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -1722,31 +1606,39 @@ dnl FIXME: Do BSD and OS X need special cases? dnl See if libdecor is available AC_ARG_ENABLE(libdecor, -[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],, enable_libdecor=yes) +[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])], + , enable_libdecor=yes) if test x$enable_libdecor = xyes; then - PKG_CHECK_MODULES([DECOR], [libdecor-0], video_libdecor=yes, video_libdecor=no) + AC_MSG_CHECKING(for libdecor support) + AS_IF([$PKG_CONFIG --exists libdecor-0], + [video_libdecor=yes], + [video_libdecor=no]) + AC_MSG_RESULT($video_libdecor) if test x$video_libdecor = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`" AC_DEFINE(HAVE_LIBDECOR_H, 1, [ ]) AC_ARG_ENABLE(libdecor-shared, -[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],, enable_libdecor_shared=yes) - - decor_lib=[`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] +[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])], + , enable_libdecor_shared=yes) if test x$enable_wayland_shared != xyes; then enable_libdecor_shared=no fi + + decor_lib=[`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + if test x$have_loadso != xyes && \ test x$enable_libdecor_shared = xyes; then AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading]) fi + if test x$have_loadso = xyes && \ test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then echo "-- dynamic libdecor -> $decor_lib" AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ]) else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`" fi fi fi @@ -1774,10 +1666,8 @@ CheckNativeClient() SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c" SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c" SUMMARY_audio="${SUMMARY_audio} nacl" - have_audio=yes SOURCES="$SOURCES $srcdir/src/video/nacl/*.c" SUMMARY_video="${SUMMARY_video} nacl opengles2" - have_video=yes ],[]) } @@ -1827,7 +1717,6 @@ CheckRPI() SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ]) SUMMARY_video="${SUMMARY_video} rpi" - have_video=yes fi fi } @@ -1864,31 +1753,37 @@ CheckX11() x11_lib='/opt/X11/lib/libX11.6.dylib' x11ext_lib='/opt/X11/lib/libXext.6.dylib' xcursor_lib='/opt/X11/lib/libXcursor.1.dylib' + xinerama_lib='/opt/X11/lib/libXinerama.1.dylib' xinput_lib='/opt/X11/lib/libXi.6.dylib' xfixes_lib='/opt/X11/lib/libXfixes.3.dylib' xrandr_lib='/opt/X11/lib/libXrandr.2.dylib' xrender_lib='/opt/X11/lib/libXrender.1.dylib' xss_lib='/opt/X11/lib/libXss.1.dylib' + xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib' ;; *-*-openbsd*) x11_lib='libX11.so' x11ext_lib='libXext.so' xcursor_lib='libXcursor.so' + xinerama_lib='libXinerama.so' xinput_lib='libXi.so' xfixes_lib='libXfixes.so' xrandr_lib='libXrandr.so' xrender_lib='libXrender.so' xss_lib='libXss.so' + xvidmode_lib='libXxf86vm.so' ;; *) x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] + xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`] ;; esac @@ -1939,6 +1834,7 @@ CheckX11() fi have_video=yes + dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent])) AC_MSG_CHECKING([for XGenericEvent]) have_XGenericEvent=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -2000,6 +1896,34 @@ XFreeEventData(display, cookie); SUMMARY_video_x11="${SUMMARY_video_x11} xdbe" fi fi + AC_ARG_ENABLE(video-x11-xinerama, +[AS_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [default=yes]])], + , enable_video_x11_xinerama=yes) + if test x$enable_video_x11_xinerama = xyes; then + definitely_enable_video_x11_xinerama=no + AC_CHECK_HEADER(X11/extensions/Xinerama.h, + have_xinerama_h_hdr=yes, + have_xinerama_h_hdr=no, + [#include + ]) + if test x$have_xinerama_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then + echo "-- dynamic libXinerama -> $xinerama_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ]) + definitely_enable_video_x11_xinerama=yes + else + AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes) + if test x$have_xinerama_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama" + definitely_enable_video_x11_xinerama=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_xinerama = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xinerama" + fi AC_ARG_ENABLE(video-x11-xinput, [AS_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [default=yes]])], , enable_video_x11_xinput=yes) @@ -2081,7 +2005,7 @@ XITouchClassInfo *t; [AS_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [default=yes]])], , enable_video_x11_xrandr=yes) if test x$enable_video_x11_xrandr = xyes; then -dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test. + dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test. definitely_enable_video_x11_xrandr=no have_xrandr_h_hdr=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -2149,6 +2073,34 @@ dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that SUMMARY_video_x11="${SUMMARY_video_x11} xshape" fi fi + AC_ARG_ENABLE(video-x11-vm, +[AS_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [default=yes]])], + , enable_video_x11_vm=yes) + if test x$enable_video_x11_vm = xyes; then + definitely_enable_video_x11_vm=no + AC_CHECK_HEADER(X11/extensions/xf86vmode.h, + have_vm_h_hdr=yes, + have_vm_h_hdr=no, + [#include + ]) + if test x$have_vm_h_hdr = xyes; then + if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then + echo "-- dynamic libXxf86vm -> $xvidmode_lib" + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ]) + definitely_enable_video_x11_vm=yes + else + AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes) + if test x$have_vm_lib = xyes ; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm" + definitely_enable_video_x11_vm=yes + fi + fi + fi + fi + if test x$definitely_enable_video_x11_vm = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ]) + SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode" + fi fi fi if test x$have_x != xyes; then @@ -2215,7 +2167,7 @@ CheckCOCOA() , enable_video_cocoa=yes) if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then save_CFLAGS="$CFLAGS" -dnl Work around that we don't have Objective-C support in autoconf + dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_MSG_CHECKING(for Cocoa framework) have_cocoa=no @@ -2243,7 +2195,7 @@ CheckMETAL() , enable_render_metal=yes) if test x$enable_video = xyes -a x$enable_video_metal = xyes; then save_CFLAGS="$CFLAGS" -dnl Work around that we don't have Objective-C support in autoconf + dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_MSG_CHECKING(for Metal framework) have_metal=no @@ -2667,7 +2619,7 @@ CheckVulkan() ;; *-*-darwin*) save_CFLAGS="$CFLAGS" -dnl Work around that we don't have Objective-C support in autoconf + dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include @@ -2702,7 +2654,7 @@ dnl Work around that we don't have Objective-C support in autoconf dnl See if we can use the new unified event interface in Linux 2.4 CheckInputEvents() { -dnl Check for Linux 2.4 unified input event interface support + dnl Check for Linux 2.4 unified input event interface support AC_MSG_CHECKING(for Linux 2.4 unified input interface) use_input_events=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -2722,6 +2674,7 @@ dnl Check for Linux 2.4 unified input event interface support dnl See if we can use the kernel kd.h header CheckInputKD() { + AC_MSG_CHECKING(for Linux kd.h) use_input_kd=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -2923,7 +2876,7 @@ CheckJoystickMFI() if test x$enable_joystick_mfi = xyes; then save_CFLAGS="$CFLAGS" save_LDFLAGS="$LDFLAGS" -dnl Work around that we don't have Objective-C support in autoconf + dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c -fobjc-weak" LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController" AC_MSG_CHECKING(for GameController framework) @@ -2955,15 +2908,15 @@ dnl Work around that we don't have Objective-C support in autoconf dnl See what type of thread model to use on Linux and Solaris CheckPTHREAD() { -dnl Check for pthread support + dnl Check for pthread support -dnl Emscripten pthreads work, but you need to have a non-pthread fallback build -dnl for systems without support. It's not currently enough to not use -dnl pthread functions in a pthread-build; it won't start up on unsupported -dnl browsers. As such, you have to explicitly enable it on Emscripten builds -dnl for the time being. This default with change to ON once this becomes -dnl commonly supported in browsers or the Emscripten teams makes a single -dnl binary work everywhere. + dnl Emscripten pthreads work, but you need to have a non-pthread fallback build + dnl for systems without support. It's not currently enough to not use + dnl pthread functions in a pthread-build; it won't start up on unsupported + dnl browsers. As such, you have to explicitly enable it on Emscripten builds + dnl for the time being. This default with change to ON once this becomes + dnl commonly supported in browsers or the Emscripten teams makes a single + dnl binary work everywhere. case "$host" in *-*-emscripten*) @@ -2977,7 +2930,7 @@ dnl binary work everywhere. AC_ARG_ENABLE(pthreads, [AS_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=maybe]])], , enable_pthreads=maybe) -dnl This is used on Linux for glibc binary compatibility (Doh!) + dnl This is used on Linux for glibc binary compatibility (Doh!) AC_ARG_ENABLE(pthread-sem, [AS_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=maybe]])], , enable_pthread_sem=maybe) @@ -3232,16 +3185,6 @@ CheckWINDOWS() # This fixes Windows stack alignment with newer GCC CheckStackBoundary - - # headers needed elsewhere - AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes) - if test x$have_tpcshrd_h = xyes; then - AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ]) - fi - AC_CHECK_HEADER(roapi.h,have_roapi_h=yes) - if test x$have_roapi_h = xyes; then - AC_DEFINE(HAVE_ROAPI_H, 1, [ ]) - fi } dnl Determine whether the compiler can produce OS/2 executables @@ -3268,17 +3211,6 @@ CheckDIRECTX() if test x$enable_directx = xyes; then AC_CHECK_HEADER(d3d9.h, have_d3d=yes) AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes) - AC_MSG_CHECKING(for d3d12 Windows SDK version) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -#include -ID3D12Device1 *device; -#if WDK_NTDDI_VERSION <= 0x0A000008 -asdf -#endif - ]])], [have_d3d12=yes],[have_d3d12=no]) - AC_MSG_RESULT($have_d3d12) AC_CHECK_HEADER(ddraw.h, have_ddraw=yes) AC_CHECK_HEADER(dsound.h, have_dsound=yes) AC_CHECK_HEADER(dinput.h, have_dinput=yes) @@ -3711,7 +3643,6 @@ case "$host" in SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" AC_DEFINE(SDL_VIDEO_DRIVER_ANDROID, 1, [ ]) SUMMARY_video="${SUMMARY_video} android" - have_video=yes fi ;; *-*-linux*) ARCH=linux ;; @@ -3793,16 +3724,12 @@ case "$host" in CheckRPATH CheckVivanteVideo - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" - have_misc=yes - fi - # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/unix/*.c" + have_misc=yes + + SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" + have_locale=yes + # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in @@ -3980,16 +3907,12 @@ case "$host" in # Set up the core platform files SOURCES="$SOURCES $srcdir/src/core/windows/*.c" - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/windows/*.c" - have_misc=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/windows/*.c" + have_misc=yes # Use the Windows locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/windows/*.c" + have_locale=yes + # Set up files for the video library if test x$enable_video = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ]) @@ -4006,10 +3929,6 @@ case "$host" in AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ]) SUMMARY_video="${SUMMARY_video} d3d11" fi - if test x$enable_render_d3d = xyes -a x$have_d3d12 = xyes; then - AC_DEFINE(SDL_VIDEO_RENDER_D3D12, 1, [ ]) - SUMMARY_video="${SUMMARY_video} d3d12" - fi fi # Set up files for the audio library if test x$enable_audio = xyes; then @@ -4058,6 +3977,10 @@ case "$host" in have_haptic=yes fi fi + AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes) + if test x$have_tpcshrd_h = xyes; then + AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ]) + fi # Set up files for the sensor library AC_CHECK_HEADER(sensorsapi.h,have_winsensors=yes,have_winsensors=no) if test x$have_winsensors = xyes; then @@ -4122,12 +4045,14 @@ case "$host" in SDL_LIBS="-lcygwin $SDL_LIBS" fi ;; -dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. + + dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. *-*-beos*) AC_MSG_ERROR([ *** BeOS support has been removed as of SDL 2.0.2. ]) ;; + *-*-haiku*) ARCH=haiku ac_default_prefix=/boot/system @@ -4172,16 +4097,14 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc" have_filesystem=yes fi - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc" - have_misc=yes - fi + + SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc" + have_misc=yes + # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc" + have_locale=yes + # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" @@ -4201,16 +4124,13 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. CheckVulkan CheckPTHREAD - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/ios/*.m" - have_misc=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/ios/*.m" + have_misc=yes + # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" + have_locale=yes + # Set up files for the audio library if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) @@ -4271,8 +4191,6 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ]) AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" - SUMMARY_video="${SUMMARY_video} uikit" - have_video=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" @@ -4299,7 +4217,6 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" - CheckObjectiveCARC CheckVisibilityHidden CheckDeclarationAfterStatement CheckDummyVideo @@ -4319,16 +4236,13 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. CheckPTHREAD CheckHIDAPI - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m" - have_misc=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m" + have_misc=yes + # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m" + have_locale=yes + # Set up files for the audio library if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) @@ -4436,12 +4350,6 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. CheckClockGettime CheckEmscriptenGLES - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/emscripten/*.c" - have_misc=yes - fi - # Set up files for the power library if test x$enable_power = xyes; then AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ]) @@ -4449,7 +4357,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. have_power=yes fi - # Set up files for the joystick library + # Set up files for the power library if test x$enable_joystick = xyes; then AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c" @@ -4469,10 +4377,8 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. have_timers=yes fi # Set up files for the locale library - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c" + have_locale=yes ;; *-*-riscos*) ARCH=riscos @@ -4488,11 +4394,9 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. CheckPTHREAD CheckClockGettime - # Set up files for the misc library - if test x$enable_misc = xyes; then - SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c" - have_misc=yes - fi + SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c" + have_misc=yes + # Set up files for the video library if test x$enable_video = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS, 1, [ ]) @@ -4539,10 +4443,8 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" fi # Use the Unix locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi + SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" + have_locale=yes # Set up files for the video library if test x$enable_video = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ]) @@ -4618,28 +4520,10 @@ AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config]) # Verify that we have all the platform specific files we need -if test x$have_audio != xyes; then - if test x$enable_audio = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ]) - fi - SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c" -fi -if test x$have_video != xyes; then - if test x$enable_video = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ]) - fi - SOURCES="$SOURCES $srcdir/src/video/dummy/*.c" -fi 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" fi 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" fi if test x$have_joystick != xyes; then @@ -4668,19 +4552,19 @@ if test x$have_threads != xyes; then fi if test x$have_timers != xyes; then if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMER_DUMMY, 1, [ ]) + AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ]) fi SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c" fi if test x$have_filesystem != xyes; then if test x$enable_filesystem = xyes; then - AC_DEFINE(SDL_FILESYSTEM_DUMMY, 1, [ ]) + AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ]) fi SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c" fi if test x$have_loadso != xyes; then if test x$enable_loadso = xyes; then - AC_DEFINE(SDL_LOADSO_DUMMY, 1, [ ]) + AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ]) fi SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c" fi @@ -4772,17 +4656,6 @@ fi SDL_STATIC_LIBS="$EXTRA_LDFLAGS" -dnl Calculate the location of the prefix, relative to the cmake folder -eval pkg_prefix=$prefix -eval pkg_cmakedir=$libdir/cmake/SDL2 -cmake_prefix_relpath="$(echo -n "$pkg_cmakedir" | sed -E "s#^$pkg_prefix##" | sed -E "s#[A-Za-z0-9_ .-]+#..#g" )" -AC_SUBST([cmake_prefix_relpath]) - -dnl Calculate the location of the prefix, relative to bindir -eval pkg_bindir=$bindir -bin_prefix_relpath="$(echo -n "pkg_bindir" | sed -E "s#^$pkg_prefix##" | sed -E "s#[A-Za-z0-9_ .-]+#..#g" )" -AC_SUBST([bin_prefix_relpath]) - dnl Expand the cflags and libraries needed by apps using SDL AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) diff --git a/externals/SDL/debian/changelog b/externals/SDL/debian/changelog index 5cd96e6f9..85d815852 100755 --- a/externals/SDL/debian/changelog +++ b/externals/SDL/debian/changelog @@ -1,3 +1,9 @@ +libsdl2 (2.0.20) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.20 + + -- Sam Lantinga Fri, 7 Jan 2022 18:24:41 -0800 + libsdl2 (2.0.19) UNRELEASED; urgency=low * Updated SDL to version 2.0.19 diff --git a/externals/SDL/debian/copyright b/externals/SDL/debian/copyright index ea7c2f01b..ffc41afc1 100755 --- a/externals/SDL/debian/copyright +++ b/externals/SDL/debian/copyright @@ -4,7 +4,7 @@ Upstream-Contact: Sam Lantinga Source: http://www.libsdl.org/ Files: * -Copyright: 1997-2021 Sam Lantinga +Copyright: 1997-2022 Sam Lantinga License: zlib/libpng Files: src/libm/* @@ -12,7 +12,7 @@ Copyright: 1993 by Sun Microsystems, Inc. All rights reserved. License: SunPro Files: src/main/windows/SDL_windows_main.c -Copyright: 2021 Sam Lantinga +Copyright: 2022 Sam Lantinga License: PublicDomain_Sam_Lantinga Comment: SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98 @@ -32,7 +32,7 @@ Copyright: 1995 Erik Corry License: BrownUn_UnCalifornia_ErikCorry Files: src/test/SDL_test_md5.c -Copyright: 1997-2021 Sam Lantinga +Copyright: 1997-2022 Sam Lantinga 1990 RSA Data Security, Inc. License: zlib/libpng and RSA_Data_Security @@ -46,12 +46,12 @@ Copyright: 1994-2003 The XFree86 Project, Inc. License: MIT/X11 Files: test/testhaptic.c -Copyright: 1997-2021 Sam Lantinga +Copyright: 1997-2022 Sam Lantinga 2008 Edgar Simo Serra License: BSD_3_clause Files: test/testrumble.c -Copyright: 1997-2021 Sam Lantinga +Copyright: 1997-2022 Sam Lantinga 2011 Edgar Simo Serra License: BSD_3_clause @@ -169,7 +169,7 @@ License: BSD_3_clause (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Comment: - Copyright (C) 1997-2021 Sam Lantinga + Copyright (C) 1997-2022 Sam Lantinga . This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/externals/SDL/docs/README-android.md b/externals/SDL/docs/README-android.md index 0b112f04e..fb835a5aa 100755 --- a/externals/SDL/docs/README-android.md +++ b/externals/SDL/docs/README-android.md @@ -206,9 +206,6 @@ You should not use the SDL renderer API while the app going in background: after you read this message, GL context gets backed-up and you should not use the SDL renderer API. - When this event is received, you have to set the render target to NULL, if you're using it. - (eg call SDL_SetRenderTarget(renderer, NULL)) - - SDL_APP_DIDENTERFOREGROUND: GL context is restored, and the SDL renderer API is available (unless you receive SDL_RENDER_DEVICE_RESET). diff --git a/externals/SDL/docs/README-cmake.md b/externals/SDL/docs/README-cmake.md index e7216d771..0eeb6d7dd 100755 --- a/externals/SDL/docs/README-cmake.md +++ b/externals/SDL/docs/README-cmake.md @@ -73,7 +73,7 @@ To use, set the following CMake variables when running CMake's configuration sta - for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles): - `cmake ~/sdl -DSDL_TESTS=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64` + `cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64` - for tvOS-Simulator, using the latest, installed SDK: diff --git a/externals/SDL/docs/README-directfb.md b/externals/SDL/docs/README-directfb.md index 6672fa40e..67b64fb61 100755 --- a/externals/SDL/docs/README-directfb.md +++ b/externals/SDL/docs/README-directfb.md @@ -15,34 +15,29 @@ What you need: * Kernel-Framebuffer support: required: vesafb, radeonfb .... * Mesa 7.0.x - optional for OpenGL -The `/etc/directfbrc` file should contain the following lines to make -your joystick work and avoid crashes: +/etc/directfbrc -``` +This file should contain the following lines to make +your joystick work and avoid crashes: +------------------------ disable-module=joystick disable-module=cle266 disable-module=cyber5k no-linux-input-grab -``` +------------------------ To disable to use x11 backend when DISPLAY variable is found use -``` export SDL_DIRECTFB_X11_CHECK=0 -``` To disable the use of linux input devices, i.e. multimice/multikeyboard support, use -``` export SDL_DIRECTFB_LINUX_INPUT=0 -``` To use hardware accelerated YUV-overlays for YUV-textures, use: -``` export SDL_DIRECTFB_YUV_DIRECT=1 -``` This is disabled by default. It will only support one YUV texture, namely the first. Every other YUV texture will be @@ -50,9 +45,7 @@ rendered in software. In addition, you may use (directfb-1.2.x) -``` export SDL_DIRECTFB_YUV_UNDERLAY=1 -``` to make the YUV texture an underlay. This will make the cursor to be shown. @@ -61,18 +54,14 @@ Simple Window Manager ===================== The driver has support for a very, very basic window manager you may -want to use when running with `wm=default`. Use +want to use when running with "wm=default". Use -``` export SDL_DIRECTFB_WM=1 -``` to enable basic window borders. In order to have the window title rendered, you need to have the following font installed: -``` /usr/share/fonts/truetype/freefont/FreeSans.ttf -``` OpenGL Support ============== @@ -82,25 +71,21 @@ works at least on all directfb supported platforms. As of this writing 20100802 you need to pull Mesa from git and do the following: -``` +------------------------ git clone git://anongit.freedesktop.org/git/mesa/mesa cd mesa git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a -``` +------------------------ -Edit `configs/linux-directfb` so that the Directories-section looks like this: - -``` +Edit configs/linux-directfb so that the Directories-section looks like +------------------------ # Directories SRC_DIRS = mesa glu GLU_DIRS = sgi DRIVER_DIRS = directfb PROGRAM_DIRS = -``` +------------------------ -Then do the following: - -``` make linux-directfb make @@ -110,14 +95,13 @@ sudo make install INSTALL_DIR=/usr/local/dfb_GL cd src/mesa/drivers/directfb make sudo make install INSTALL_DIR=/usr/local/dfb_GL -``` +------------------------ To run the SDL - testprograms: -``` export SDL_VIDEODRIVER=directfb export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7 ./testgl -``` + diff --git a/externals/SDL/docs/README-linux.md b/externals/SDL/docs/README-linux.md index 342130f1f..230bad963 100755 --- a/externals/SDL/docs/README-linux.md +++ b/externals/SDL/docs/README-linux.md @@ -3,8 +3,8 @@ Linux By default SDL will only link against glibc, the rest of the features will be enabled dynamically at runtime depending on the available features on the target -system. So, for example if you built SDL with XRandR support and the target -system does not have the XRandR libraries installed, it will be disabled +system. So, for example if you built SDL with Xinerama support and the target +system does not have the Xinerama libraries installed, it will be disabled at runtime, and you won't get a missing library error, at least with the default configuration parameters. @@ -17,7 +17,7 @@ Ubuntu 20.04, all available features enabled: sudo apt-get install build-essential git make cmake autoconf automake \ libtool pkg-config libasound2-dev libpulse-dev libaudio-dev libjack-dev \ libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \ - libxss-dev libgl1-mesa-dev libdbus-1-dev \ + libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libdbus-1-dev \ libudev-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \ fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \ libxkbcommon-dev libdrm-dev libgbm-dev @@ -27,11 +27,12 @@ Fedora 35, all available features enabled: sudo yum install gcc git-core make cmake autoconf automake libtool \ alsa-lib-devel pulseaudio-libs-devel nas-devel pipewire-devel \ libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \ - libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \ - systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \ - mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \ - libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \ - libsamplerate-devel pipewire-jack-audio-connection-kit-devel \ + libXi-devel libXinerama-devel libXxf86vm-devel libXScrnSaver-devel \ + dbus-devel ibus-devel fcitx-devel systemd-devel mesa-libGL-devel \ + libxkbcommon-devel mesa-libGLES-devel mesa-libEGL-devel vulkan-devel \ + wayland-devel wayland-protocols-devel libdrm-devel mesa-libgbm-devel \ + libusb-devel pipewire-jack-audio-connection-kit-devel libdecor-devel \ + libsamplerate-devel NOTES: - This includes all the audio targets except arts and esd, because Ubuntu diff --git a/externals/SDL/docs/README-macos.md b/externals/SDL/docs/README-macos.md index 2f9067917..d7bc98afd 100755 --- a/externals/SDL/docs/README-macos.md +++ b/externals/SDL/docs/README-macos.md @@ -43,14 +43,15 @@ make sudo make install ``` -This script builds SDL with 10.7 ABI compatibility on 64-bit Intel and 11.0 +This script builds SDL with 10.6 ABI compatibility on 64-bit Intel and 11.0 ABI compatibility on ARM64 architectures. For best compatibility you should compile your application the same way. -Please note that building SDL requires at least Xcode 4.6 and the 10.7 SDK. -PowerPC support for macOS has been officially dropped as of SDL 2.0.2. -32-bit Intel and macOS 10.6 runtime support has been officially dropped as -of SDL 2.24.0. +Please note that building SDL requires at least Xcode 4.6 and the 10.7 SDK +(even if you target back to 10.6 systems). PowerPC support for Mac OS X has +been officially dropped as of SDL 2.0.2. 32-bit Intel, using an older Xcode +release, is still supported at the time of this writing, but current Xcode +releases no longer support it, and eventually neither will SDL. To use the library once it's built, you essential have two possibilities: use the traditional autoconf/automake/make method, or use Xcode. diff --git a/externals/SDL/docs/README-psp.md b/externals/SDL/docs/README-psp.md index 798a37b65..f2b0fb869 100755 --- a/externals/SDL/docs/README-psp.md +++ b/externals/SDL/docs/README-psp.md @@ -1,36 +1,31 @@ PSP ====== -SDL2 port for the Sony PSP contributed by: -- Captian Lex -- Francisco Javier Trujillo Mata -- Wouter Wijsman - +SDL port for the Sony PSP contributed by + Captian Lex Credit to Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP Geecko for his PSP GU lib "Glib2d" -## Building -To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run: -```bash -cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake -cmake --build build -cmake --install build -``` +Building +-------- +To build SDL2 library for the PSP, make sure psp-config is in the path and run: + make -f Makefile.psp -## Getting PSP Dev -[Installing PSP Dev](https://github.com/pspdev/pspdev) +Getting PSP toolchain +--------------------- +https://github.com/pspdev/psptoolchain -## Running on PPSSPP Emulator -[PPSSPP](https://github.com/hrydgard/ppsspp) +Running on PPSSPP Emulator +-------------------------- +https://github.com/hrydgard/ppsspp +( https://github.com/hrydgard/ppsspp/wiki/Build-instructions ) -[Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions) +Compiling an HelloWorld +----------------------- +https://psp-dev.org/doku.php?id=tutorial:hello_world - -## Compiling a HelloWorld -[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world) - -## To Do -- PSP Screen Keyboard -- Dialogs \ No newline at end of file +To Do +------ +PSP Screen Keyboard diff --git a/externals/SDL/docs/README-raspberrypi.md b/externals/SDL/docs/README-raspberrypi.md index 762dd38c0..6a85c3cf4 100755 --- a/externals/SDL/docs/README-raspberrypi.md +++ b/externals/SDL/docs/README-raspberrypi.md @@ -63,7 +63,7 @@ Now, before chrooting into the ARM sysroot, you'll need to apply a workaround, edit $SYSROOT/etc/ld.so.preload and comment out all lines in it. sudo chroot $SYSROOT - apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev + apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev libxss-dev exit sudo umount $SYSROOT/dev sudo umount $SYSROOT/proc diff --git a/externals/SDL/docs/README-visualc.md b/externals/SDL/docs/README-visualc.md index 759752a56..ea2bc1852 100755 --- a/externals/SDL/docs/README-visualc.md +++ b/externals/SDL/docs/README-visualc.md @@ -1,7 +1,7 @@ Using SDL with Microsoft Visual C++ =================================== -### by Lion Kimbro with additions by James Turk +### by [Lion Kimbro](mailto:snowlion@sprynet.com) with additions by [James Turk](mailto:james@conceptofzero.net) You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL yourself. diff --git a/externals/SDL/docs/README-vita.md b/externals/SDL/docs/README-vita.md index 503fef7d5..aefa19703 100755 --- a/externals/SDL/docs/README-vita.md +++ b/externals/SDL/docs/README-vita.md @@ -3,7 +3,7 @@ PS Vita SDL port for the Sony Playstation Vita and Sony Playstation TV Credit to -* xerpi, cpasjuste and rsn8887 for initial (vita2d) port +* xerpi and rsn8887 for initial (vita2d) port * vitasdk/dolcesdk devs * CBPS discord (Namely Graphene and SonicMastr) @@ -22,9 +22,6 @@ Notes * gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON` These renderers support 720p and 1080i resolutions. These can be specified with: `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);` -* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK. - They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);` - anytime before video subsystem initialization. * gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON` * By default SDL emits mouse events for touch events on every touchscreen. Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead. diff --git a/externals/SDL/docs/README-windows.md b/externals/SDL/docs/README-windows.md index ed0c93e2c..71f968eeb 100755 --- a/externals/SDL/docs/README-windows.md +++ b/externals/SDL/docs/README-windows.md @@ -1,58 +1,45 @@ -# Windows +Windows +================================================================================ -## LLVM and Intel C++ compiler support +================================================================================ +OpenGL ES 2.x support +================================================================================ -SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++ -compiler, but you'll have to manually add the "-msse3" command line option -to at least the SDL_audiocvt.c source file, and possibly others. This may -not be necessary if you build SDL with CMake instead of the included Visual -Studio solution. - -Details are here: https://github.com/libsdl-org/SDL/issues/5186 - - -## OpenGL ES 2.x support - -SDL has support for OpenGL ES 2.x under Windows via two alternative -implementations. - -The most straightforward method consists in running your app in a system with -a graphic card paired with a relatively recent (as of November of 2013) driver -which supports the WGL_EXT_create_context_es2_profile extension. Vendors known +SDL has support for OpenGL ES 2.x under Windows via two alternative +implementations. +The most straightforward method consists in running your app in a system with +a graphic card paired with a relatively recent (as of November of 2013) driver +which supports the WGL_EXT_create_context_es2_profile extension. Vendors known to ship said extension on Windows currently include nVidia and Intel. -The other method involves using the -[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x -context is requested and no WGL_EXT_create_context_es2_profile extension is -found, SDL will try to load the libEGL.dll library provided by ANGLE. - +The other method involves using the ANGLE library (https://code.google.com/p/angleproject/) +If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile +extension is found, SDL will try to load the libEGL.dll library provided by +ANGLE. To obtain the ANGLE binaries, you can either compile from source from -https://chromium.googlesource.com/angle/angle or copy the relevant binaries -from a recent Chrome/Chromium install for Windows. The files you need are: - -- libEGL.dll -- libGLESv2.dll -- d3dcompiler_46.dll (supports Windows Vista or later, better shader - compiler) *or* d3dcompiler_43.dll (supports Windows XP or later) +https://chromium.googlesource.com/angle/angle or copy the relevant binaries from +a recent Chrome/Chromium install for Windows. The files you need are: + + * libEGL.dll + * libGLESv2.dll + * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler) + or... + * d3dcompiler_43.dll (supports Windows XP or later) If you compile ANGLE from source, you can configure it so it does not need the -d3dcompiler_* DLL at all (for details on this, see their documentation). +d3dcompiler_* DLL at all (for details on this, see their documentation). However, by default SDL will try to preload the d3dcompiler_46.dll to -comply with ANGLE's requirements. If you wish SDL to preload -d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you -can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more -details). +comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to +support Windows XP) or to skip this step at all, you can use the +SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details). Known Bugs: + + * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears + that there's a bug in the library which prevents the window contents from + refreshing if this is set to anything other than the default value. + +Vulkan Surface Support +============== -- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears - that there's a bug in the library which prevents the window contents from - refreshing if this is set to anything other than the default value. - -## Vulkan Surface Support - -Support for creating Vulkan surfaces is configured on by default. To disable -it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You -must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to -use Vulkan graphics in your application. - +Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to use Vulkan graphics in your application. diff --git a/externals/SDL/docs/README.md b/externals/SDL/docs/README.md index 209f1cc12..635290822 100755 --- a/externals/SDL/docs/README.md +++ b/externals/SDL/docs/README.md @@ -14,7 +14,7 @@ hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games. -SDL officially supports Windows, macOS, Linux, iOS, and Android. +SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source code. SDL is written in C, works natively with C++, and there are bindings @@ -38,22 +38,19 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [Git](README-git.md) - [iOS](README-ios.md) - [Linux](README-linux.md) -- [macOS](README-macos.md) +- [OS X](README-macosx.md) - [OS/2](README-os2.md) - [Native Client](README-nacl.md) - [Pandora](README-pandora.md) - [Supported Platforms](README-platforms.md) - [Porting information](README-porting.md) - [PSP](README-psp.md) -- [PS2](README-ps2.md) - [Raspberry Pi](README-raspberrypi.md) - [Touch](README-touch.md) -- [Versions](README-versions.md) - [WinCE](README-wince.md) - [Windows](README-windows.md) - [WinRT](README-winrt.md) - [PSVita](README-vita.md) -- [Nokia N-Gage](README-ngage.md) If you need help with the library, or just want to discuss SDL related issues, you can join the [SDL Discourse](https://discourse.libsdl.org/), diff --git a/externals/SDL/docs/doxyfile b/externals/SDL/docs/doxyfile index 7b80a3a8d..baf1c98de 100755 --- a/externals/SDL/docs/doxyfile +++ b/externals/SDL/docs/doxyfile @@ -640,7 +640,6 @@ EXCLUDE = ../include/SDL_opengles2_gl2ext.h \ ../include/SDL_opengles.h \ ../include/SDL_opengl.h \ ../include/SDL_egl.h \ - ./release_checklist.md \ # The EXCLUDE_SYMLINKS tag can be used select whether or not files or diff --git a/externals/SDL/include/SDL_assert.h b/externals/SDL/include/SDL_assert.h index 427c4c633..defadf137 100755 --- a/externals/SDL/include/SDL_assert.h +++ b/externals/SDL/include/SDL_assert.h @@ -22,7 +22,7 @@ #ifndef SDL_assert_h_ #define SDL_assert_h_ -#include "SDL_stdinc.h" +#include "SDL_config.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -51,8 +51,6 @@ assert can have unique static variables associated with it. /* Don't include intrin.h here because it contains C++ code */ extern void __cdecl __debugbreak(void); #define SDL_TriggerBreakpoint() __debugbreak() -#elif _SDL_HAS_BUILTIN(__builtin_debugtrap) - #define SDL_TriggerBreakpoint() __builtin_debugtrap() #elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) #elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */ diff --git a/externals/SDL/include/SDL_audio.h b/externals/SDL/include/SDL_audio.h index 01d197878..181f66c57 100755 --- a/externals/SDL/include/SDL_audio.h +++ b/externals/SDL/include/SDL_audio.h @@ -500,7 +500,9 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, * hardware. * * `spec` will be filled with the sample rate, sample format, and channel - * count. + * count. All other values in the structure are filled with 0. When the + * supported struct members are 0, SDL was unable to get the property from the + * backend. * * \param index the index of the audio device; valid values range from 0 to * SDL_GetNumAudioDevices() - 1 @@ -584,7 +586,6 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index, * - `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE` * - `SDL_AUDIO_ALLOW_FORMAT_CHANGE` * - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE` - * - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE` * - `SDL_AUDIO_ALLOW_ANY_CHANGE` * * These flags specify how SDL should behave when a device cannot offer a diff --git a/externals/SDL/include/SDL_blendmode.h b/externals/SDL/include/SDL_blendmode.h index 08c9f9dd6..b6d140dbb 100755 --- a/externals/SDL/include/SDL_blendmode.h +++ b/externals/SDL/include/SDL_blendmode.h @@ -67,8 +67,9 @@ typedef enum SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ - SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */ - SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */ + SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */ + SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */ + } SDL_BlendOperation; /** @@ -86,6 +87,7 @@ typedef enum SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ + } SDL_BlendFactor; /** @@ -133,10 +135,10 @@ typedef enum * SDL 2.0.6. All renderers support the four blend modes listed in the * SDL_BlendMode enumeration. * - * - **direct3d**: Supports all operations with all factors. However, some + * - **direct3d**: Supports `SDL_BLENDOPERATION_ADD` with all factors. + * - **direct3d11**: Supports all operations with all factors. However, some * factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and * `SDL_BLENDOPERATION_MAXIMUM`. - * - **direct3d11**: Same as Direct3D 9. * - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all * factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly with SDL * 2.0.6. diff --git a/externals/SDL/include/SDL_config.h b/externals/SDL/include/SDL_config.h index 749988515..13014df8f 100755 --- a/externals/SDL/include/SDL_config.h +++ b/externals/SDL/include/SDL_config.h @@ -39,12 +39,12 @@ #include "SDL_config_iphoneos.h" #elif defined(__ANDROID__) #include "SDL_config_android.h" +#elif defined(__PSP__) +#include "SDL_config_psp.h" #elif defined(__OS2__) #include "SDL_config_os2.h" #elif defined(__EMSCRIPTEN__) #include "SDL_config_emscripten.h" -#elif defined(__NGAGE__) -#include "SDL_config_ngage.h" #else /* This is a minimal configuration just to get SDL running on new platforms. */ #include "SDL_config_minimal.h" diff --git a/externals/SDL/include/SDL_config.h.cmake b/externals/SDL/include/SDL_config.h.cmake index 6f448c068..7f96bbe2f 100755 --- a/externals/SDL/include/SDL_config.h.cmake +++ b/externals/SDL/include/SDL_config.h.cmake @@ -88,7 +88,6 @@ #cmakedefine HAVE_UNSETENV 1 #endif #cmakedefine HAVE_QSORT 1 -#cmakedefine HAVE_BSEARCH 1 #cmakedefine HAVE_ABS 1 #cmakedefine HAVE_BCOPY 1 #cmakedefine HAVE_MEMSET 1 @@ -243,7 +242,6 @@ #cmakedefine HAVE_D3D_H @HAVE_D3D_H@ #cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ -#cmakedefine HAVE_D3D12_H @HAVE_D3D12_H@ #cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ #cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ #cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ @@ -255,15 +253,12 @@ #cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@ #cmakedefine HAVE_TPCSHRD_H @HAVE_TPCSHRD_H@ #cmakedefine HAVE_SENSORSAPI_H @HAVE_SENSORSAPI_H@ -#cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@ #cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ #cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ /* SDL internal assertion support */ -#if @SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED@ #cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@ -#endif /* Allow disabling of core subsystems */ #cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@ @@ -282,8 +277,6 @@ #cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@ #cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@ #cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ -#cmakedefine SDL_LOCALE_DISABLED @SDL_LOCALE_DISABLED@ -#cmakedefine SDL_MISC_DISABLED @SDL_MISC_DISABLED@ /* Enable various audio drivers */ #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ @@ -378,7 +371,6 @@ #cmakedefine SDL_THREAD_OS2 @SDL_THREAD_OS2@ #cmakedefine SDL_THREAD_VITA @SDL_THREAD_VITA@ #cmakedefine SDL_THREAD_PSP @SDL_THREAD_PSP@ -#cmakedefine SDL_THREAD_PS2 @SDL_THREAD_PS2@ /* Enable various timer systems */ #cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@ @@ -388,7 +380,6 @@ #cmakedefine SDL_TIMER_OS2 @SDL_TIMER_OS2@ #cmakedefine SDL_TIMER_VITA @SDL_TIMER_VITA@ #cmakedefine SDL_TIMER_PSP @SDL_TIMER_PSP@ -#cmakedefine SDL_TIMER_PS2 @SDL_TIMER_PS2@ /* Enable various video drivers */ #cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@ @@ -426,25 +417,28 @@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES @SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@ #cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@ #cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@ #cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@ #cmakedefine SDL_VIDEO_DRIVER_X11_XFIXES @SDL_VIDEO_DRIVER_X11_XFIXES@ #cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR @SDL_VIDEO_DRIVER_X11_XRANDR@ #cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER @SDL_VIDEO_DRIVER_X11_XSCRNSAVER@ #cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@ #cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ #cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ #cmakedefine SDL_VIDEO_DRIVER_VITA @SDL_VIDEO_DRIVER_VITA@ #cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@ #cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@ -#cmakedefine SDL_VIDEO_RENDER_D3D12 @SDL_VIDEO_RENDER_D3D12@ #cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ @@ -496,15 +490,9 @@ #cmakedefine SDL_FILESYSTEM_OS2 @SDL_FILESYSTEM_OS2@ #cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@ #cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@ -#cmakedefine SDL_FILESYSTEM_PS2 @SDL_FILESYSTEM_PS2@ - -/* Enable misc subsystem */ -#cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@ - -/* Enable locale subsystem */ -#cmakedefine SDL_LOCALE_DUMMY @SDL_LOCALE_DUMMY@ /* Enable assembly routines */ +#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ #cmakedefine SDL_ARM_SIMD_BLITTERS @SDL_ARM_SIMD_BLITTERS@ #cmakedefine SDL_ARM_NEON_BLITTERS @SDL_ARM_NEON_BLITTERS@ @@ -524,7 +512,6 @@ #cmakedefine SDL_VIDEO_VITA_PIB @SDL_VIDEO_VITA_PIB@ #cmakedefine SDL_VIDEO_VITA_PVR @SDL_VIDEO_VITA_PVR@ -#cmakedefine SDL_VIDEO_VITA_PVR_OGL @SDL_VIDEO_VITA_PVR_OGL@ #if !defined(__WIN32__) && !defined(__WINRT__) # if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H) diff --git a/externals/SDL/include/SDL_config.h.in b/externals/SDL/include/SDL_config.h.in index c758b4528..0d981b410 100755 --- a/externals/SDL/include/SDL_config.h.in +++ b/externals/SDL/include/SDL_config.h.in @@ -92,7 +92,6 @@ #undef HAVE_UNSETENV #endif #undef HAVE_QSORT -#undef HAVE_BSEARCH #undef HAVE_ABS #undef HAVE_BCOPY #undef HAVE_MEMSET @@ -229,8 +228,6 @@ #undef HAVE_LIBUDEV_H #undef HAVE_LIBSAMPLERATE_H #undef HAVE_LIBDECOR_H -#undef HAVE_LSXINTRIN_H -#undef HAVE_LASXINTRIN_H #undef HAVE_DDRAW_H #undef HAVE_DINPUT_H @@ -245,7 +242,6 @@ #undef HAVE_AUDIOCLIENT_H #undef HAVE_TPCSHRD_H #undef HAVE_SENSORSAPI_H -#undef HAVE_ROAPI_H /* SDL internal assertion support */ #undef SDL_DEFAULT_ASSERT_LEVEL @@ -267,8 +263,6 @@ #undef SDL_VIDEO_DISABLED #undef SDL_POWER_DISABLED #undef SDL_FILESYSTEM_DISABLED -#undef SDL_LOCALE_DISABLED -#undef SDL_MISC_DISABLED /* Enable various audio drivers */ #undef SDL_AUDIO_DRIVER_AAUDIO @@ -390,18 +384,22 @@ #undef SDL_VIDEO_DRIVER_X11_DYNAMIC #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE #undef SDL_VIDEO_DRIVER_X11_XCURSOR #undef SDL_VIDEO_DRIVER_X11_XDBE +#undef SDL_VIDEO_DRIVER_X11_XINERAMA #undef SDL_VIDEO_DRIVER_X11_XINPUT2 #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH #undef SDL_VIDEO_DRIVER_X11_XFIXES #undef SDL_VIDEO_DRIVER_X11_XRANDR #undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER #undef SDL_VIDEO_DRIVER_X11_XSHAPE +#undef SDL_VIDEO_DRIVER_X11_XVIDMODE #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM #undef SDL_VIDEO_DRIVER_NACL @@ -413,7 +411,6 @@ #undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_D3D11 -#undef SDL_VIDEO_RENDER_D3D12 #undef SDL_VIDEO_RENDER_OGL #undef SDL_VIDEO_RENDER_OGL_ES #undef SDL_VIDEO_RENDER_OGL_ES2 @@ -448,27 +445,19 @@ #undef SDL_POWER_HARDWIRED /* Enable system filesystem support */ -#undef SDL_FILESYSTEM_ANDROID #undef SDL_FILESYSTEM_HAIKU #undef SDL_FILESYSTEM_COCOA #undef SDL_FILESYSTEM_DUMMY -#undef SDL_FILESYSTEM_RISCOS #undef SDL_FILESYSTEM_UNIX #undef SDL_FILESYSTEM_WINDOWS #undef SDL_FILESYSTEM_NACL +#undef SDL_FILESYSTEM_ANDROID #undef SDL_FILESYSTEM_EMSCRIPTEN #undef SDL_FILESYSTEM_OS2 -#undef SDL_FILESYSTEM_VITA -#undef SDL_FILESYSTEM_PSP -#undef SDL_FILESYSTEM_PS2 - -/* Enable misc subsystem */ -#undef SDL_MISC_DUMMY - -/* Enable locale subsystem */ -#undef SDL_LOCALE_DUMMY +#undef SDL_FILESYSTEM_RISCOS /* Enable assembly routines */ +#undef SDL_ASSEMBLY_ROUTINES #undef SDL_ALTIVEC_BLITTERS #undef SDL_ARM_SIMD_BLITTERS #undef SDL_ARM_NEON_BLITTERS diff --git a/externals/SDL/include/SDL_config_android.h b/externals/SDL/include/SDL_config_android.h index 5a9cfc045..4a13a3a53 100755 --- a/externals/SDL/include/SDL_config_android.h +++ b/externals/SDL/include/SDL_config_android.h @@ -60,7 +60,6 @@ #define HAVE_SETENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 diff --git a/externals/SDL/include/SDL_config_emscripten.h b/externals/SDL/include/SDL_config_emscripten.h index 989e1243a..7efe32373 100755 --- a/externals/SDL/include/SDL_config_emscripten.h +++ b/externals/SDL/include/SDL_config_emscripten.h @@ -69,7 +69,6 @@ #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 @@ -186,7 +185,6 @@ /* Enable various threading systems */ #ifdef __EMSCRIPTEN_PTHREADS__ #define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 #endif /* Enable various timer systems */ diff --git a/externals/SDL/include/SDL_config_iphoneos.h b/externals/SDL/include/SDL_config_iphoneos.h index 48f9f9f9b..0aa242563 100755 --- a/externals/SDL/include/SDL_config_iphoneos.h +++ b/externals/SDL/include/SDL_config_iphoneos.h @@ -60,7 +60,6 @@ #define HAVE_SETENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 @@ -118,7 +117,7 @@ #define HAVE_LROUNDF 1 #define HAVE_POW 1 #define HAVE_POWF 1 -#define HAVE_ROUND 1 +#define HAVE_ROUND 1 #define HAVE_ROUNDF 1 #define HAVE_SCALBN 1 #define HAVE_SCALBNF 1 diff --git a/externals/SDL/include/SDL_config_macosx.h b/externals/SDL/include/SDL_config_macosx.h index 023ecaae3..ff42e3d5f 100755 --- a/externals/SDL/include/SDL_config_macosx.h +++ b/externals/SDL/include/SDL_config_macosx.h @@ -63,7 +63,6 @@ #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 @@ -121,7 +120,7 @@ #define HAVE_LROUNDF 1 #define HAVE_POW 1 #define HAVE_POWF 1 -#define HAVE_ROUND 1 +#define HAVE_ROUND 1 #define HAVE_ROUNDF 1 #define HAVE_SCALBN 1 #define HAVE_SCALBNF 1 @@ -186,13 +185,17 @@ #undef SDL_VIDEO_DRIVER_X11 #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib" #define SDL_VIDEO_DRIVER_X11_XDBE 1 +#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 +#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 #ifdef MAC_OS_X_VERSION_10_8 @@ -269,6 +272,7 @@ #define SDL_FILESYSTEM_COCOA 1 /* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 #ifdef __ppc__ #define SDL_ALTIVEC_BLITTERS 1 #endif diff --git a/externals/SDL/include/SDL_config_os2.h b/externals/SDL/include/SDL_config_os2.h index 1583245ee..1728bd772 100755 --- a/externals/SDL/include/SDL_config_os2.h +++ b/externals/SDL/include/SDL_config_os2.h @@ -56,6 +56,9 @@ #define SDL_TIMER_OS2 1 #define SDL_FILESYSTEM_OS2 1 +/* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 + /* use libsamplerate for audio rate conversion. */ /*#define HAVE_LIBSAMPLERATE_H 1 */ @@ -102,11 +105,7 @@ #define HAVE_GETENV 1 #define HAVE_SETENV 1 #define HAVE_PUTENV 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ #define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#endif #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 diff --git a/externals/SDL/include/SDL_config_pandora.h b/externals/SDL/include/SDL_config_pandora.h index 01bbf49b0..e0be390bc 100755 --- a/externals/SDL/include/SDL_config_pandora.h +++ b/externals/SDL/include/SDL_config_pandora.h @@ -65,7 +65,6 @@ #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 diff --git a/externals/SDL/include/SDL_config_psp.h b/externals/SDL/include/SDL_config_psp.h index cdd85030a..72c1eb668 100755 --- a/externals/SDL/include/SDL_config_psp.h +++ b/externals/SDL/include/SDL_config_psp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2021 Sam Lantinga + Copyright (C) 1997-2022 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,6 @@ #include "SDL_platform.h" - - #ifdef __GNUC__ #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 #endif @@ -34,7 +32,7 @@ #define HAVE_GCC_ATOMICS 1 #define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_LIMITS_H 1 @@ -152,8 +150,8 @@ #define SDL_POWER_PSP 1 -/* !!! FIXME: what does PSP do for filesystem stuff? */ -#define SDL_FILESYSTEM_DUMMY 1 +/* Enable the PSP filesystem support (src/filesystem/psp/\*.c) */ +#define SDL_FILESYSTEM_PSP 1 /* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */ #define SDL_HAPTIC_DISABLED 1 @@ -164,5 +162,4 @@ /* PSP can't load shared object (src/loadso/dummy/\*.c) */ #define SDL_LOADSO_DISABLED 1 - #endif /* SDL_config_psp_h_ */ diff --git a/externals/SDL/include/SDL_config_windows.h b/externals/SDL/include/SDL_config_windows.h index 076bea410..c9ed1cfea 100755 --- a/externals/SDL/include/SDL_config_windows.h +++ b/externals/SDL/include/SDL_config_windows.h @@ -38,18 +38,6 @@ #include #endif -/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the - * Windows 10 SDK have broken declarations for the C API for DirectX 12. */ -#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include) -#if __has_include() -#define HAVE_SDKDDKVER_H 1 -#endif -#endif - -#ifdef HAVE_SDKDDKVER_H -#include -#endif - /* This is a set of defines to configure the SDL features */ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) @@ -102,14 +90,9 @@ typedef unsigned int uintptr_t; # define SIZEOF_VOIDP 4 #endif -#ifdef __clang__ -# define HAVE_GCC_ATOMICS 1 -#endif - #define HAVE_DDRAW_H 1 #define HAVE_DINPUT_H 1 #define HAVE_DSOUND_H 1 -#ifndef __WATCOMC__ #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */ @@ -117,16 +100,11 @@ typedef unsigned int uintptr_t; #endif #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */ #define HAVE_D3D11_H 1 -#define HAVE_ROAPI_H 1 -#endif -#if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */ -#define HAVE_D3D12_H 1 #endif #define HAVE_MMDEVICEAPI_H 1 #define HAVE_AUDIOCLIENT_H 1 #define HAVE_TPCSHRD_H 1 #define HAVE_SENSORSAPI_H 1 -#endif #if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) #define HAVE_IMMINTRIN_H 1 #elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) @@ -153,11 +131,7 @@ typedef unsigned int uintptr_t; #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ #define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#endif #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 @@ -188,40 +162,37 @@ typedef unsigned int uintptr_t; #define HAVE__WCSNICMP 1 #define HAVE__WCSDUP 1 #define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_EXP 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_FMOD 1 -#define HAVE_LOG 1 -#define HAVE_LOG10 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SQRT 1 -#define HAVE_TAN 1 -#ifndef __WATCOMC__ #define HAVE_ACOSF 1 +#define HAVE_ASIN 1 #define HAVE_ASINF 1 +#define HAVE_ATAN 1 #define HAVE_ATANF 1 +#define HAVE_ATAN2 1 #define HAVE_ATAN2F 1 #define HAVE_CEILF 1 #define HAVE__COPYSIGN 1 +#define HAVE_COS 1 #define HAVE_COSF 1 +#define HAVE_EXP 1 #define HAVE_EXPF 1 +#define HAVE_FABS 1 #define HAVE_FABSF 1 +#define HAVE_FLOOR 1 #define HAVE_FLOORF 1 +#define HAVE_FMOD 1 #define HAVE_FMODF 1 +#define HAVE_LOG 1 #define HAVE_LOGF 1 +#define HAVE_LOG10 1 #define HAVE_LOG10F 1 +#define HAVE_POW 1 #define HAVE_POWF 1 +#define HAVE_SIN 1 #define HAVE_SINF 1 +#define HAVE_SQRT 1 #define HAVE_SQRTF 1 +#define HAVE_TAN 1 #define HAVE_TANF 1 -#endif #if defined(_MSC_VER) /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 @@ -241,18 +212,8 @@ typedef unsigned int uintptr_t; #if _MSC_VER >= 1400 #define HAVE__FSEEKI64 1 #endif -#ifdef _USE_MATH_DEFINES -#define HAVE_M_PI 1 #endif -#elif defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_VSSCANF 1 -#define HAVE_ROUND 1 -#define HAVE_SCALBN 1 -#define HAVE_TRUNC 1 -#else +#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) #define HAVE_M_PI 1 #endif #else @@ -261,9 +222,7 @@ typedef unsigned int uintptr_t; #endif /* Enable various audio drivers */ -#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H) #define SDL_AUDIO_DRIVER_WASAPI 1 -#endif #define SDL_AUDIO_DRIVER_DSOUND 1 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 @@ -284,11 +243,7 @@ typedef unsigned int uintptr_t; #define SDL_HAPTIC_XINPUT 1 /* Enable the sensor driver */ -#ifdef HAVE_SENSORSAPI_H #define SDL_SENSOR_WINDOWS 1 -#else -#define SDL_SENSOR_DUMMY 1 -#endif /* Enable various shared object loading systems */ #define SDL_LOADSO_WINDOWS 1 @@ -310,9 +265,6 @@ typedef unsigned int uintptr_t; #if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) #define SDL_VIDEO_RENDER_D3D11 1 #endif -#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) -#define SDL_VIDEO_RENDER_D3D12 1 -#endif /* Enable OpenGL support */ #ifndef SDL_VIDEO_OPENGL @@ -343,6 +295,11 @@ typedef unsigned int uintptr_t; /* Enable filesystem support */ #define SDL_FILESYSTEM_WINDOWS 1 +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + #endif /* SDL_config_windows_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/include/SDL_config_winrt.h b/externals/SDL/include/SDL_config_winrt.h index 556940369..690ffe159 100755 --- a/externals/SDL/include/SDL_config_winrt.h +++ b/externals/SDL/include/SDL_config_winrt.h @@ -92,10 +92,6 @@ typedef unsigned int uintptr_t; # define SIZEOF_VOIDP 4 #endif -#ifdef __clang__ -# define HAVE_GCC_ATOMICS 1 -#endif - /* Useful headers */ #define HAVE_DXGI_H 1 #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP @@ -123,7 +119,6 @@ typedef unsigned int uintptr_t; #define HAVE_FREE 1 #define HAVE_ALLOCA 1 #define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 @@ -196,8 +191,6 @@ typedef unsigned int uintptr_t; #define HAVE_TRUNCF 1 #define HAVE__FSEEKI64 1 -#define HAVE_ROAPI_H 1 - /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DISK 1 @@ -250,9 +243,6 @@ typedef unsigned int uintptr_t; /* Enable appropriate renderer(s) */ #define SDL_VIDEO_RENDER_D3D11 1 -/* Disable D3D12 as it's not implemented for WinRT */ -#define SDL_VIDEO_RENDER_D3D12 0 - #if SDL_VIDEO_OPENGL_ES2 #define SDL_VIDEO_RENDER_OGL_ES2 1 #endif @@ -260,4 +250,9 @@ typedef unsigned int uintptr_t; /* Enable system power support */ #define SDL_POWER_WINRT 1 +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + #endif /* SDL_config_winrt_h_ */ diff --git a/externals/SDL/include/SDL_config_wiz.h b/externals/SDL/include/SDL_config_wiz.h index 53d8792e1..29b8242ec 100755 --- a/externals/SDL/include/SDL_config_wiz.h +++ b/externals/SDL/include/SDL_config_wiz.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2021 Sam Lantinga + Copyright (C) 1997-2022 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/externals/SDL/include/SDL_cpuinfo.h b/externals/SDL/include/SDL_cpuinfo.h index fa22f3aa3..1fc40991d 100755 --- a/externals/SDL/include/SDL_cpuinfo.h +++ b/externals/SDL/include/SDL_cpuinfo.h @@ -98,14 +98,6 @@ _m_prefetch(void *__P) #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif -#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H) -#include -#define __LSX__ -#endif -#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H) -#include -#define __LASX__ -#endif #if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) #include #else @@ -441,32 +433,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); -/** - * Determine whether the CPU has LSX (LOONGARCH SIMD) features. - * - * This always returns false on CPUs that aren't using LOONGARCH instruction - * sets. - * - * \returns SDL_TRUE if the CPU has LOONGARCH LSX features or SDL_FALSE if - * not. - * - * \since This function is available since SDL 2.24.0. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void); - -/** - * Determine whether the CPU has LASX (LOONGARCH SIMD) features. - * - * This always returns false on CPUs that aren't using LOONGARCH instruction - * sets. - * - * \returns SDL_TRUE if the CPU has LOONGARCH LASX features or SDL_FALSE if - * not. - * - * \since This function is available since SDL 2.24.0. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void); - /** * Get the amount of RAM configured in the system. * @@ -528,7 +494,7 @@ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void); * * \since This function is available since SDL 2.0.10. * - * \sa SDL_SIMDGetAlignment + * \sa SDL_SIMDAlignment * \sa SDL_SIMDRealloc * \sa SDL_SIMDFree */ @@ -552,7 +518,7 @@ extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len); * * \since This function is available since SDL 2.0.14. * - * \sa SDL_SIMDGetAlignment + * \sa SDL_SIMDAlignment * \sa SDL_SIMDAlloc * \sa SDL_SIMDFree */ diff --git a/externals/SDL/include/SDL_endian.h b/externals/SDL/include/SDL_endian.h index e1c6b5ef4..46c296253 100755 --- a/externals/SDL/include/SDL_endian.h +++ b/externals/SDL/include/SDL_endian.h @@ -65,15 +65,6 @@ _m_prefetch(void *__P) #elif defined(__FreeBSD__) || defined(__NetBSD__) #include #define SDL_BYTEORDER BYTE_ORDER -/* predefs from newer gcc and clang versions: */ -#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__) -#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) -#define SDL_BYTEORDER SDL_LIL_ENDIAN -#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) -#define SDL_BYTEORDER SDL_BIG_ENDIAN -#else -#error Unsupported endianness -#endif /**/ #else #if defined(__hppa__) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ @@ -87,28 +78,6 @@ _m_prefetch(void *__P) #endif /* __linux__ */ #endif /* !SDL_BYTEORDER */ -#ifndef SDL_FLOATWORDORDER /* Not defined in SDL_config.h? */ -/* 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__) -#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN -#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__) -#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN -#else -#error Unsupported endianness -#endif /**/ -#elif defined(__MAVERICK__) -/* For Maverick, float words are always little-endian. */ -#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN -#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__) -/* For FPA, float words are always big-endian. */ -#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN -#else -/* By default, assume that floats words follow the memory system mode. */ -#define SDL_FLOATWORDORDER SDL_BYTEORDER -#endif /* __FLOAT_WORD_ORDER__ */ -#endif /* !SDL_FLOATWORDORDER */ - #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ diff --git a/externals/SDL/include/SDL_events.h b/externals/SDL/include/SDL_events.h index c0fc9bb1a..3722a6311 100755 --- a/externals/SDL/include/SDL_events.h +++ b/externals/SDL/include/SDL_events.h @@ -102,7 +102,6 @@ typedef enum SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an input language or keyboard layout change. */ - SDL_TEXTEDITING_EXT, /**< Extended keyboard text editing (composition) */ /* Mouse events */ SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ @@ -118,7 +117,6 @@ typedef enum SDL_JOYBUTTONUP, /**< Joystick button released */ SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */ SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */ - SDL_JOYBATTERYUPDATED, /**< Joystick battery level change */ /* Game controller events */ SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */ @@ -245,19 +243,6 @@ typedef struct SDL_TextEditingEvent Sint32 length; /**< The length of selected editing text */ } SDL_TextEditingEvent; -/** - * \brief Extended keyboard text editing event structure (event.editExt.*) when text would be - * truncated if stored in the text buffer SDL_TextEditingEvent - */ -typedef struct SDL_TextEditingExtEvent -{ - Uint32 type; /**< ::SDL_TEXTEDITING_EXT */ - Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ - Uint32 windowID; /**< The window with keyboard focus, if any */ - char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */ - Sint32 start; /**< The start cursor of selected editing text */ - Sint32 length; /**< The length of selected editing text */ -} SDL_TextEditingExtEvent; #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) /** @@ -396,16 +381,6 @@ typedef struct SDL_JoyDeviceEvent Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; -/** - * \brief Joysick battery level change event structure (event.jbattery.*) - */ -typedef struct SDL_JoyBatteryEvent -{ - Uint32 type; /**< ::SDL_JOYBATTERYUPDATED */ - Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ - SDL_JoystickID which; /**< The joystick instance id */ - SDL_JoystickPowerLevel level; /**< The joystick battery level */ -} SDL_JoyBatteryEvent; /** * \brief Game controller axis motion event structure (event.caxis.*) @@ -626,7 +601,6 @@ typedef union SDL_Event SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ - SDL_TextEditingExtEvent editExt; /**< Extended text editing event data */ SDL_TextInputEvent text; /**< Text input event data */ SDL_MouseMotionEvent motion; /**< Mouse motion event data */ SDL_MouseButtonEvent button; /**< Mouse button event data */ @@ -636,7 +610,6 @@ typedef union SDL_Event SDL_JoyHatEvent jhat; /**< Joystick hat event data */ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ - SDL_JoyBatteryEvent jbattery; /**< Joystick battery event data */ SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ diff --git a/externals/SDL/include/SDL_gamecontroller.h b/externals/SDL/include/SDL_gamecontroller.h index 0f3ce583a..bdd9b8993 100755 --- a/externals/SDL/include/SDL_gamecontroller.h +++ b/externals/SDL/include/SDL_gamecontroller.h @@ -289,25 +289,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); -/** - * Get the implementation dependent path for the game controller. - * - * This function can be called before any controllers are opened. - * - * `joystick_index` is the same as the `device_index` passed to - * SDL_JoystickOpen(). - * - * \param joystick_index the device_index of a device, from zero to - * SDL_NumJoysticks()-1 - * \returns the implementation-dependent path for the game controller, or NULL - * if there is no path or the index is invalid. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GameControllerPath - */ -extern DECLSPEC const char *SDLCALL SDL_GameControllerPathForIndex(int joystick_index); - /** * Get the type of a game controller. * @@ -405,23 +386,6 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(in */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); -/** - * Get the implementation-dependent path for an opened game controller. - * - * This is the same path as returned by SDL_GameControllerNameForIndex(), but - * it takes a controller identifier instead of the (unstable) device index. - * - * \param gamecontroller a game controller identifier previously returned by - * SDL_GameControllerOpen() - * \returns the implementation dependent path for the game controller, or NULL - * if there is no path or the identifier passed is invalid. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GameControllerPathForIndex - */ -extern DECLSPEC const char *SDLCALL SDL_GameControllerPath(SDL_GameController *gamecontroller); - /** * Get the type of this currently opened controller * @@ -493,18 +457,6 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller); -/** - * Get the firmware version of an opened controller, if available. - * - * If the firmware version isn't available this function returns 0. - * - * \param gamecontroller the game controller object to query. - * \return the controller firmware version, or zero if unavailable. - * - * \since This function is available since SDL 2.24.0. - */ -extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller); - /** * Get the serial number of an opened controller, if available. * @@ -917,9 +869,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon * calling it with 0 intensity stops any rumbling. * * Note that this is rumbling of the _triggers_ and not the game controller as - * a whole. This is currently only supported on Xbox One controllers. If you - * want the (more common) whole-controller rumble, use - * SDL_GameControllerRumble() instead. + * a whole. The first controller to offer this feature was the PlayStation 5's + * DualShock 5. * * \param gamecontroller The controller to vibrate * \param left_rumble The intensity of the left trigger rumble motor, from 0 diff --git a/externals/SDL/include/SDL_hints.h b/externals/SDL/include/SDL_hints.h index 781998236..1185f4222 100755 --- a/externals/SDL/include/SDL_hints.h +++ b/externals/SDL/include/SDL_hints.h @@ -392,14 +392,13 @@ extern "C" { #define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS" /** - * \brief A variable controlling verbosity of the logging of SDL events pushed onto the internal queue. + * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. * - * This variable can be set to the following values, from least to most verbose: + * This variable can be set to the following values: * * "0" - Don't log any events (default) - * "1" - Log most events (other than the really spammy ones). - * "2" - Include mouse and finger motion events. - * "3" - Include SDL_SysWMEvent events. + * "1" - Log all events except mouse and finger motion, which are pretty spammy. + * "2" - Log all events. * * This is generally meant to be used to debug SDL itself, but can be useful * for application developers that need better visibility into what is going @@ -413,19 +412,6 @@ extern "C" { */ #define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING" -/** - * \brief A variable controlling whether raising the window should be done more forcefully - * - * This variable can be set to the following values: - * "0" - No forcing (the default) - * "1" - Extra level of forcing - * - * At present, this is only an issue under MS Windows, which makes it nearly impossible to - * programmatically move a window to the foreground, for "security" reasons. See - * http://stackoverflow.com/a/34414846 for a discussion. - */ -#define SDL_HINT_FORCE_RAISEWINDOW "SDL_HINT_FORCE_RAISEWINDOW" - /** * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. * @@ -580,17 +566,6 @@ extern "C" { */ #define SDL_HINT_IME_SHOW_UI "SDL_IME_SHOW_UI" -/** - * \brief A variable to control if extended IME text support is enabled. - * If enabled then SDL_TextEditingExtEvent will be issued if the text would be truncated otherwise. - * Additionally SDL_TextInputEvent will be dispatched multiple times so that it is not truncated. - * - * The variable can be set to the following values: - * "0" - Legacy behavior. Text can be truncated, no heap allocations. (default) - * "1" - Modern behavior. - */ -#define SDL_HINT_IME_SUPPORT_EXTENDED_TEXT "SDL_IME_SUPPORT_EXTENDED_TEXT" - /** * \brief A variable controlling whether the home indicator bar on iPhone X * should be hidden. @@ -637,22 +612,7 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE" -/** - * \brief A variable controlling whether "low_frequency_rumble" and "high_frequency_rumble" is used to implement - * the GameCube controller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2) - * this is useful for applications that need full compatibility for things like ADSR envelopes. - * Stop is implemented by setting "low_frequency_rumble" to "0" and "high_frequency_rumble" ">0" - * Rumble is both at any arbitrary value, - * StopHard is implemented by setting both "low_frequency_rumble" and "high_frequency_rumble" to "0" - * - * This variable can be set to the following values: - * "0" - Normal rumble behavior is behavior is used (default) - * "1" - Proper GameCube controller rumble behavior is used - * - */ -#define SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE "SDL_JOYSTICK_GAMECUBE_RUMBLE_BRAKE" - -/** + /** * \brief A variable controlling whether Switch Joy-Cons should be treated the same as Switch Pro Controllers when using the HIDAPI driver. * * This variable can be set to the following values: @@ -663,7 +623,7 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS "SDL_JOYSTICK_HIDAPI_JOY_CONS" -/** + /** * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. * * This variable can be set to the following values: @@ -800,16 +760,17 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" -/** + /** * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * * This variable can be set to the following values: * "0" - RAWINPUT drivers are not used * "1" - RAWINPUT drivers are used (the default) + * */ #define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" -/** + /** * \brief A variable controlling whether the RAWINPUT driver should pull correlated data from XInput. * * This variable can be set to the following values: @@ -822,16 +783,7 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT" -/** - * \brief A variable controlling whether the ROG Chakram mice should show up as joysticks - * - * This variable can be set to the following values: - * "0" - ROG Chakram mice do not show up as joysticks (the default) - * "1" - ROG Chakram mice show up as joysticks - */ -#define SDL_HINT_JOYSTICK_ROG_CHAKRAM "SDL_JOYSTICK_ROG_CHAKRAM" - -/** + /** * \brief A variable controlling whether a separate thread should be used * for handling joystick detection and raw input messages on Windows * @@ -865,32 +817,14 @@ extern "C" { */ #define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER "SDL_KMSDRM_REQUIRE_DRM_MASTER" -/** + /** * \brief A comma separated list of devices to open as joysticks * * This variable is currently only used by the Linux joystick driver. */ #define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE" -/** - * \brief A variable controlling whether joysticks on Linux will always treat 'hat' axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking whether they may be analog. - * - * This variable can be set to the following values: - * "0" - Only map hat axis inputs to digital hat outputs if the input axes appear to actually be digital (the default) - * "1" - Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as digital hats - */ -#define SDL_HINT_LINUX_DIGITAL_HATS "SDL_LINUX_DIGITAL_HATS" - -/** - * \brief A variable controlling whether digital hats on Linux will apply deadzones to their underlying input axes or use unfiltered values. - * - * This variable can be set to the following values: - * "0" - Return digital hat values based on unfiltered input axis values - * "1" - Return digital hat values with deadzones on the input axes taken into account (the default) - */ -#define SDL_HINT_LINUX_HAT_DEADZONES "SDL_LINUX_HAT_DEADZONES" - -/** + /** * \brief A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux * * This variable can be set to the following values: @@ -901,7 +835,7 @@ extern "C" { */ #define SDL_HINT_LINUX_JOYSTICK_CLASSIC "SDL_LINUX_JOYSTICK_CLASSIC" -/** + /** * \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values. * * This variable can be set to the following values: @@ -952,22 +886,6 @@ extern "C" { */ #define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" -/** - * \brief A variable controlling whether relative mouse mode constrains the mouse to the center of the window - * - * This variable can be set to the following values: - * "0" - Relative mouse mode constrains the mouse to the window - * "1" - Relative mouse mode constrains the mouse to the center of the window - * - * Constraining to the center of the window works better for FPS games and when the - * application is running over RDP. Constraining to the whole window works better - * for 2D games and increases the chance that the mouse will be in the correct - * position when using high DPI mice. - * - * By default SDL will constrain the mouse to the center of the window - */ -#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER "SDL_MOUSE_RELATIVE_MODE_CENTER" - /** * \brief A variable controlling whether relative mouse mode is implemented using mouse warping * @@ -1004,19 +922,6 @@ extern "C" { */ #define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" -/** - * \brief A variable controlling whether the mouse is captured while mouse buttons are pressed - * - * This variable can be set to the following values: - * "0" - The mouse is not captured while mouse buttons are pressed - * "1" - The mouse is captured while mouse buttons are pressed - * - * By default the mouse is captured while mouse buttons are pressed so if the mouse is dragged - * outside the window, the application continues to receive mouse events until the button is - * released. - */ -#define SDL_HINT_MOUSE_AUTO_CAPTURE "SDL_MOUSE_AUTO_CAPTURE" - /** * \brief Tell SDL not to catch the SIGINT or SIGTERM signals. * @@ -1200,8 +1105,6 @@ extern "C" { * * This variable is case insensitive and can be set to the following values: * "direct3d" - * "direct3d11" - * "direct3d12" * "opengl" * "opengles2" * "opengles" @@ -1258,7 +1161,7 @@ extern "C" { */ #define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" -/** + /** * \brief A variable to control whether the return key on the soft keyboard * should hide the soft keyboard on Android and iOS. * @@ -1375,18 +1278,6 @@ extern "C" { */ #define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" -/** - * \brief A variable controlling which touchpad should generate synthetic mouse events - * - * This variable can be set to the following values: - * "0" - Only front touchpad should generate mouse events. Default - * "1" - Only back touchpad should generate mouse events. - * "2" - Both touchpads should generate mouse events. - * - * By default SDL will generate mouse events for all touch devices - */ -#define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE "SDL_HINT_VITA_TOUCH_MOUSE_DEVICE" - /** * \brief A variable controlling whether the Android / tvOS remotes * should be listed as joystick devices, instead of sending keyboard events. @@ -1471,7 +1362,9 @@ extern "C" { * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" * button on their titlebars). * - * The default value is "1". This hint must be set before any windows are created. + * The default value is "1". Spaces are disabled regardless of this hint if + * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before + * any windows are created. */ #define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" @@ -1494,35 +1387,6 @@ extern "C" { */ #define SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR" -/** - * \brief A variable controlling whether the libdecor Wayland backend is preferred over native decrations. - * - * When this hint is set, libdecor will be used to provide window decorations, even if xdg-decoration is - * available. (Note that, by default, libdecor will use xdg-decoration itself if available). - * - * This variable can be set to the following values: - * "0" - libdecor is enabled only if server-side decorations are unavailable. - * "1" - libdecor is always enabled if available. - * - * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. - */ -#define SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR "SDL_VIDEO_WAYLAND_PREFER_LIBDECOR" - -/** - * \brief A variable controlling whether video mode emulation is enabled under Wayland. - * - * When this hint is set, a standard set of emulated CVT video modes will be exposed for use by the application. - * If it is disabled, the only modes exposed will be the logical desktop size and, in the case of a scaled - * desktop, the native display resolution. - * - * This variable can be set to the following values: - * "0" - Video mode emulation is disabled. - * "1" - Video mode emulation is enabled. - * - * By default video mode emulation is enabled. - */ -#define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION "SDL_VIDEO_WAYLAND_MODE_EMULATION" - /** * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). * @@ -1542,28 +1406,6 @@ extern "C" { */ #define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" -/** - * \brief When calling SDL_CreateWindowFrom(), make the window compatible with OpenGL. - * - * This variable can be set to the following values: - * "0" - Don't add any graphics flags to the SDL_WindowFlags - * "1" - Add SDL_WINDOW_OPENGL to the SDL_WindowFlags - * - * By default SDL will not make the foreign window compatible with OpenGL. - */ -#define SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL "SDL_VIDEO_FOREIGN_WINDOW_OPENGL" - -/** - * \brief When calling SDL_CreateWindowFrom(), make the window compatible with Vulkan. - * - * This variable can be set to the following values: - * "0" - Don't add any graphics flags to the SDL_WindowFlags - * "1" - Add SDL_WINDOW_VULKAN to the SDL_WindowFlags - * - * By default SDL will not make the foreign window compatible with Vulkan. - */ -#define SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN "SDL_VIDEO_FOREIGN_WINDOW_VULKAN" - /** * \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries * @@ -1624,11 +1466,13 @@ extern "C" { #define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID" /** - * \brief A no-longer-used variable controlling whether the X11 Xinerama extension should be used. + * \brief A variable controlling whether the X11 Xinerama extension should be used. * - * Before SDL 2.0.24, this would let apps and users disable Xinerama support on X11. - * Now SDL never uses Xinerama, and does not check for this hint at all. - * The preprocessor define is left here for source compatibility. + * This variable can be set to the following values: + * "0" - Disable Xinerama + * "1" - Enable Xinerama + * + * By default SDL will use Xinerama if it is available. */ #define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" @@ -1639,16 +1483,18 @@ extern "C" { * "0" - Disable XRandR * "1" - Enable XRandR * - * By default SDL will use XRandR. + * By default SDL will not use XRandR because of window manager issues. */ #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" /** - * \brief A no-longer-used variable controlling whether the X11 VidMode extension should be used. + * \brief A variable controlling whether the X11 VidMode extension should be used. * - * Before SDL 2.0.24, this would let apps and users disable XVidMode support on X11. - * Now SDL never uses XVidMode, and does not check for this hint at all. - * The preprocessor define is left here for source compatibility. + * This variable can be set to the following values: + * "0" - Disable XVidMode + * "1" - Enable XVidMode + * + * By default SDL will use XVidMode if it is available. */ #define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" @@ -1808,57 +1654,6 @@ extern "C" { */ #define SDL_HINT_WINDOWS_USE_D3D9EX "SDL_WINDOWS_USE_D3D9EX" -/** - * \brief Controls whether SDL will declare the process to be DPI aware. - * - * This hint must be set before initializing the video subsystem. - * - * The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with - * a DPI scale factor. - * - * This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext) - * and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel - * even on high-DPI displays. - * - * For more information, see: - * https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows - * - * This variable can be set to the following values: - * "" - Do not change the DPI awareness (default). - * "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later). - * "system" - Request system DPI awareness. (Vista and later). - * "permonitor" - Request per-monitor DPI awareness. (Windows 8.1 and later). - * "permonitorv2" - Request per-monitor V2 DPI awareness. (Windows 10, version 1607 and later). - * The most visible difference from "permonitor" is that window title bar will be scaled - * to the visually correct size when dragging between monitors with different scale factors. - * This is the preferred DPI awareness level. - * - * If the requested DPI awareness is not available on the currently running OS, SDL will try to request the best - * available match. - */ -#define SDL_HINT_WINDOWS_DPI_AWARENESS "SDL_WINDOWS_DPI_AWARENESS" - -/** - * \brief Uses DPI-scaled points as the SDL coordinate system on Windows. - * - * This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. - * This means windows will be appropriately sized, even when created on high-DPI displays with scaling. - * - * e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, - * will create a window with an 800x600 client area (in pixels). - * - * Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), - * and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows. - * - * This variable can be set to the following values: - * "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging - * between monitors with different scale factors (unless this is performed by - * Windows itself, which is the case when the process is DPI unaware). - * "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on - * displays with non-100% scale factors. - */ -#define SDL_HINT_WINDOWS_DPI_SCALING "SDL_WINDOWS_DPI_SCALING" - /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * @@ -2029,97 +1824,6 @@ extern "C" { */ #define SDL_HINT_AUDIO_INCLUDE_MONITORS "SDL_AUDIO_INCLUDE_MONITORS" -/** - * \brief A variable that forces X11 windows to create as a custom type. - * - * This is currently only used for X11 and ignored elsewhere. - * - * During SDL_CreateWindow, SDL uses the _NET_WM_WINDOW_TYPE X11 property - * to report to the window manager the type of window it wants to create. - * This might be set to various things if SDL_WINDOW_TOOLTIP or - * SDL_WINDOW_POPUP_MENU, etc, were specified. For "normal" windows that - * haven't set a specific type, this hint can be used to specify a custom - * type. For example, a dock window might set this to - * "_NET_WM_WINDOW_TYPE_DOCK". - * - * If not set or set to "", this hint is ignored. This hint must be set - * before the SDL_CreateWindow() call that it is intended to affect. - * - * This hint is available since SDL 2.0.22. - */ -#define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE" - -/** - * \brief A variable that decides whether to send SDL_QUIT when closing the final window. - * - * By default, SDL sends an SDL_QUIT event when there is only one window - * and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most - * apps would also take the loss of this window as a signal to terminate the - * program. - * - * However, it's not unreasonable in some cases to have the program continue - * to live on, perhaps to create new windows later. - * - * Changing this hint to "0" will cause SDL to not send an SDL_QUIT event - * when the final window is requesting to close. Note that in this case, - * there are still other legitimate reasons one might get an SDL_QUIT - * event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c) - * on Unix, etc. - * - * The default value is "1". This hint can be changed at any time. - * - * This hint is available since SDL 2.0.22. Before then, you always get - * an SDL_QUIT event when closing the final window. - */ -#define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE "SDL_QUIT_ON_LAST_WINDOW_CLOSE" - - -/** - * \brief A variable that decides what video backend to use. - * - * By default, SDL will try all available video backends in a reasonable - * order until it finds one that can work, but this hint allows the app - * or user to force a specific target, such as "x11" if, say, you are - * on Wayland but want to try talking to the X server instead. - * - * This functionality has existed since SDL 2.0.0 (indeed, before that) - * but before 2.0.22 this was an environment variable only. In 2.0.22, - * it was upgraded to a full SDL hint, so you can set the environment - * variable as usual or programatically set the hint with SDL_SetHint, - * which won't propagate to child processes. - * - * The default value is unset, in which case SDL will try to figure out - * the best video backend on your behalf. This hint needs to be set - * before SDL_Init() is called to be useful. - * - * This hint is available since SDL 2.0.22. Before then, you could set - * the environment variable to get the same effect. - */ -#define SDL_HINT_VIDEODRIVER "SDL_VIDEODRIVER" - -/** - * \brief A variable that decides what audio backend to use. - * - * By default, SDL will try all available audio backends in a reasonable - * order until it finds one that can work, but this hint allows the app - * or user to force a specific target, such as "alsa" if, say, you are - * on PulseAudio but want to try talking to the lower level instead. - * - * This functionality has existed since SDL 2.0.0 (indeed, before that) - * but before 2.0.22 this was an environment variable only. In 2.0.22, - * it was upgraded to a full SDL hint, so you can set the environment - * variable as usual or programatically set the hint with SDL_SetHint, - * which won't propagate to child processes. - * - * The default value is unset, in which case SDL will try to figure out - * the best audio backend on your behalf. This hint needs to be set - * before SDL_Init() is called to be useful. - * - * This hint is available since SDL 2.0.22. Before then, you could set - * the environment variable to get the same effect. - */ -#define SDL_HINT_AUDIODRIVER "SDL_AUDIODRIVER" - /** * \brief An enumeration of hint priorities diff --git a/externals/SDL/include/SDL_joystick.h b/externals/SDL/include/SDL_joystick.h index 60bd470f8..e80c0057f 100755 --- a/externals/SDL/include/SDL_joystick.h +++ b/externals/SDL/include/SDL_joystick.h @@ -43,7 +43,6 @@ #include "SDL_stdinc.h" #include "SDL_error.h" -#include "SDL_guid.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -70,7 +69,9 @@ struct _SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick; /* A structure that encodes the stable unique id for a joystick device */ -typedef SDL_GUID SDL_JoystickGUID; +typedef struct { + Uint8 data[16]; +} SDL_JoystickGUID; /** * This is a unique ID for a joystick for the time it is connected to the system, @@ -152,7 +153,6 @@ extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); * \since This function is available since SDL 2.0.0. * * \sa SDL_JoystickName - * \sa SDL_JoystickPath * \sa SDL_JoystickOpen */ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); @@ -174,23 +174,6 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); -/** - * Get the implementation dependent path of a joystick. - * - * This can be called before any joysticks are opened. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system) - * \returns the path of the selected joystick. If no path can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_JoystickPath - * \sa SDL_JoystickOpen - */ -extern DECLSPEC const char *SDLCALL SDL_JoystickPathForIndex(int device_index); - /** * Get the player index of a joystick, or -1 if it's not available This can be * called before any joysticks are opened. @@ -347,54 +330,6 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int nbuttons, int nhats); -/** - * The structure that defines an extended virtual joystick description - * - * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx() - * All other elements of this structure are optional and can be left 0. - * - * \sa SDL_JoystickAttachVirtualEx - */ -typedef struct SDL_VirtualJoystickDesc -{ - Uint16 version; /**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` */ - Uint16 type; /**< `SDL_JoystickType` */ - Uint16 naxes; /**< the number of axes on this joystick */ - Uint16 nbuttons; /**< the number of buttons on this joystick */ - Uint16 nhats; /**< the number of hats on this joystick */ - Uint16 vendor_id; /**< the USB vendor ID of this joystick */ - Uint16 product_id; /**< the USB product ID of this joystick */ - Uint16 padding; /**< unused */ - Uint32 button_mask; /**< A mask of which buttons are valid for this controller - e.g. (1 << SDL_CONTROLLER_BUTTON_A) */ - Uint32 axis_mask; /**< A mask of which axes are valid for this controller - e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) */ - const char *name; /**< the name of the joystick */ - - void *userdata; /**< User data pointer passed to callbacks */ - void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */ - void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */ - int (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_JoystickRumble() */ - int (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_JoystickRumbleTriggers() */ - int (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_JoystickSetLED() */ - int (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_JoystickSendEffect() */ - -} SDL_VirtualJoystickDesc; - -/** - * \brief The current version of the SDL_VirtualJoystickDesc structure - */ -#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1 - -/** - * Attach a new virtual joystick with extended properties. - * - * \returns the joystick's device index, or -1 if an error occurred. - * - * \since This function is available since SDL 2.24.0. - */ -extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc); - /** * Detach a virtual joystick. * @@ -484,19 +419,6 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, in */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick); -/** - * Get the implementation dependent path of a joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the path of the selected joystick. If no path can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_JoystickPathForIndex - */ -extern DECLSPEC const char *SDLCALL SDL_JoystickPath(SDL_Joystick *joystick); - /** * Get the player index of an opened joystick. * @@ -573,19 +495,6 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick); */ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick); -/** - * Get the firmware version of an opened joystick, if available. - * - * If the firmware version isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the firmware version of the selected joystick, or 0 if - * unavailable. - * - * \since This function is available since SDL 2.24.0. - */ -extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joystick); - /** * Get the serial number of an opened joystick, if available. * @@ -920,9 +829,9 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo * Each call to this function cancels any previous trigger rumble effect, and * calling it with 0 intensity stops any rumbling. * - * Note that this is rumbling of the _triggers_ and not the game controller as - * a whole. This is currently only supported on Xbox One controllers. If you - * want the (more common) whole-controller rumble, use SDL_JoystickRumble() + * Note that this function is for _trigger_ rumble; the first joystick to + * support this was the PlayStation 5's DualShock 5 controller. If you want + * the (more common) whole-controller rumble, use SDL_JoystickRumble() * instead. * * \param joystick The joystick to vibrate diff --git a/externals/SDL/include/SDL_keyboard.h b/externals/SDL/include/SDL_keyboard.h index 0aa599076..a53dde68e 100755 --- a/externals/SDL/include/SDL_keyboard.h +++ b/externals/SDL/include/SDL_keyboard.h @@ -268,30 +268,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); */ extern DECLSPEC void SDLCALL SDL_StopTextInput(void); -/** - * Dismiss the composition window/IME without disabling the subsystem. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_StartTextInput - * \sa SDL_StopTextInput - */ -extern DECLSPEC void SDLCALL SDL_ClearComposition(void); - -/** - * Returns if an IME Composite or Candidate window is currently shown. - * - * \since This function is available since SDL 2.0.22. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); - /** * Set the rectangle used to type Unicode text inputs. * - * Note: If you want use system native IME window, try to set hint - * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you - * any feedback. - * * \param rect the SDL_Rect structure representing the rectangle to receive * text (ignored if NULL) * diff --git a/externals/SDL/include/SDL_keycode.h b/externals/SDL/include/SDL_keycode.h index 65420f29f..35602541a 100755 --- a/externals/SDL/include/SDL_keycode.h +++ b/externals/SDL/include/SDL_keycode.h @@ -318,12 +318,7 @@ typedef enum SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), - SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD), - - SDLK_SOFTLEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT), - SDLK_SOFTRIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT), - SDLK_CALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL), - SDLK_ENDCALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL) + SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) } SDL_KeyCode; /** diff --git a/externals/SDL/include/SDL_log.h b/externals/SDL/include/SDL_log.h index 1d8b20b62..dbbcb1e6f 100755 --- a/externals/SDL/include/SDL_log.h +++ b/externals/SDL/include/SDL_log.h @@ -47,9 +47,9 @@ extern "C" { /** - * \brief The maximum size of a log message prior to SDL 2.0.24 + * \brief The maximum size of a log message * - * As of 2.0.24 there is no limit to the length of SDL log messages. + * Messages longer than the maximum size will be truncated */ #define SDL_MAX_LOG_MESSAGE 4096 diff --git a/externals/SDL/include/SDL_metal.h b/externals/SDL/include/SDL_metal.h index eb3082879..9ecaa8151 100755 --- a/externals/SDL/include/SDL_metal.h +++ b/externals/SDL/include/SDL_metal.h @@ -92,7 +92,6 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); * * \param window SDL_Window from which the drawable size should be queried * \param w Pointer to variable for storing the width in pixels, may be NULL - * \param h Pointer to variable for storing the height in pixels, may be NULL * * \since This function is available since SDL 2.0.14. * diff --git a/externals/SDL/include/SDL_platform.h b/externals/SDL/include/SDL_platform.h index b70fb02fd..79b8b6f45 100755 --- a/externals/SDL/include/SDL_platform.h +++ b/externals/SDL/include/SDL_platform.h @@ -65,15 +65,11 @@ #undef __LINUX__ /* do we need to do this? */ #define __ANDROID__ 1 #endif -#if defined(__NGAGE__) -#undef __NGAGE__ -#define __NGAGE__ 1 -#endif #if defined(__APPLE__) /* lets us know what version of Mac OS X we're compiling on */ -#include -#include +#include "AvailabilityMacros.h" +#include "TargetConditionals.h" /* Fix building with older SDKs that don't define these See this for more information: @@ -108,9 +104,9 @@ /* if not compiling for iOS */ #undef __MACOSX__ #define __MACOSX__ 1 -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 -# error SDL for Mac OS X only supports deploying on 10.7 and above. -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# error SDL for Mac OS X only supports deploying on 10.6 and above. +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ #endif /* TARGET_OS_IPHONE */ #endif /* defined(__APPLE__) */ @@ -183,9 +179,6 @@ #undef __PSP__ #define __PSP__ 1 #endif -#if defined(PS2) -#define __PS2__ 1 -#endif /* The NACL compiler defines __native_client__ and __pnacl__ * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi diff --git a/externals/SDL/include/SDL_rect.h b/externals/SDL/include/SDL_rect.h index 6c641c581..6616ba6a2 100755 --- a/externals/SDL/include/SDL_rect.h +++ b/externals/SDL/include/SDL_rect.h @@ -54,8 +54,8 @@ typedef struct SDL_Point /** * The structure that defines a point (floating point) * - * \sa SDL_EncloseFPoints - * \sa SDL_PointInFRect + * \sa SDL_EnclosePoints + * \sa SDL_PointInRect */ typedef struct SDL_FPoint { @@ -71,7 +71,6 @@ typedef struct SDL_FPoint * \sa SDL_RectEquals * \sa SDL_HasIntersection * \sa SDL_IntersectRect - * \sa SDL_IntersectRectAndLine * \sa SDL_UnionRect * \sa SDL_EnclosePoints */ @@ -84,16 +83,6 @@ typedef struct SDL_Rect /** * A rectangle, with the origin at the upper left (floating point). - * - * \sa SDL_FRectEmpty - * \sa SDL_FRectEquals - * \sa SDL_FRectEqualsEpsilon - * \sa SDL_HasIntersectionF - * \sa SDL_IntersectFRect - * \sa SDL_IntersectFRectAndLine - * \sa SDL_UnionFRect - * \sa SDL_EncloseFPoints - * \sa SDL_PointInFRect */ typedef struct SDL_FRect { @@ -224,147 +213,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * int *Y1, int *X2, int *Y2); - -/* SDL_FRect versions... */ - -/** - * Returns true if point resides inside a rectangle. - */ -SDL_FORCE_INLINE SDL_bool SDL_PointInFRect(const SDL_FPoint *p, const SDL_FRect *r) -{ - return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && - (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; -} - -/** - * Returns true if the rectangle has no area. - */ -SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r) -{ - return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE; -} - -/** - * Returns true if the two rectangles are equal, within some given epsilon. - * - * \since This function is available since SDL 2.0.22. - */ -SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) -{ - return (a && b && ((a == b) || - ((SDL_fabsf(a->x - b->x) <= epsilon) && - (SDL_fabsf(a->y - b->y) <= epsilon) && - (SDL_fabsf(a->w - b->w) <= epsilon) && - (SDL_fabsf(a->h - b->h) <= epsilon)))) - ? SDL_TRUE : SDL_FALSE; -} - -/** - * Returns true if the two rectangles are equal, using a default epsilon. - * - * \since This function is available since SDL 2.0.22. - */ -SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b) -{ - return SDL_FRectEqualsEpsilon(a, b, SDL_FLT_EPSILON); -} - -/** - * Determine whether two rectangles intersect with float precision. - * - * If either pointer is NULL the function will return SDL_FALSE. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_IntersectRect - */ -extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A, - const SDL_FRect * B); - -/** - * Calculate the intersection of two rectangles with float precision. - * - * If `result` is NULL then this function will return SDL_FALSE. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \param result an SDL_FRect structure filled in with the intersection of - * rectangles `A` and `B` - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_HasIntersectionF - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A, - const SDL_FRect * B, - SDL_FRect * result); - -/** - * Calculate the union of two rectangles with float precision. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \param result an SDL_FRect structure filled in with the union of rectangles - * `A` and `B` - * - * \since This function is available since SDL 2.0.22. - */ -extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A, - const SDL_FRect * B, - SDL_FRect * result); - -/** - * Calculate a minimal rectangle enclosing a set of points with float - * precision. - * - * If `clip` is not NULL then only points inside of the clipping rectangle are - * considered. - * - * \param points an array of SDL_FPoint structures representing points to be - * enclosed - * \param count the number of structures in the `points` array - * \param clip an SDL_FRect used for clipping or NULL to enclose all points - * \param result an SDL_FRect structure filled in with the minimal enclosing - * rectangle - * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the - * points were outside of the clipping rectangle. - * - * \since This function is available since SDL 2.0.22. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points, - int count, - const SDL_FRect * clip, - SDL_FRect * result); - -/** - * Calculate the intersection of a rectangle and line segment with float - * precision. - * - * This function is used to clip a line segment to a rectangle. A line segment - * contained entirely within the rectangle or that does not intersect will - * remain unchanged. A line segment that crosses the rectangle at either or - * both ends will be clipped to the boundary of the rectangle and the new - * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. - * - * \param rect an SDL_FRect structure representing the rectangle to intersect - * \param X1 a pointer to the starting X-coordinate of the line - * \param Y1 a pointer to the starting Y-coordinate of the line - * \param X2 a pointer to the ending X-coordinate of the line - * \param Y2 a pointer to the ending Y-coordinate of the line - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRectAndLine(const SDL_FRect * - rect, float *X1, - float *Y1, float *X2, - float *Y2); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/externals/SDL/include/SDL_render.h b/externals/SDL/include/SDL_render.h index 3ff625e0e..a7e4908a6 100755 --- a/externals/SDL/include/SDL_render.h +++ b/externals/SDL/include/SDL_render.h @@ -261,17 +261,6 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window); -/** - * Get the window associated with a renderer. - * - * \param renderer the renderer to query - * \returns the window on success or NULL on failure; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.22. - */ -extern DECLSPEC SDL_Window * SDLCALL SDL_RenderGetWindow(SDL_Renderer *renderer); - /** * Get information about a rendering context. * @@ -367,15 +356,11 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * \param texture the texture to query * \param format a pointer filled in with the raw format of the texture; the * actual format may differ, but pixel transfers will use this - * format (one of the SDL_PixelFormatEnum values). This argument - * can be NULL if you don't need this information. + * format (one of the SDL_PixelFormatEnum values) * \param access a pointer filled in with the actual access to the texture - * (one of the SDL_TextureAccess values). This argument can be - * NULL if you don't need this information. - * \param w a pointer filled in with the width of the texture in pixels. This - * argument can be NULL if you don't need this information. - * \param h a pointer filled in with the height of the texture in pixels. This - * argument can be NULL if you don't need this information. + * (one of the SDL_TextureAccess values) + * \param w a pointer filled in with the width of the texture in pixels + * \param h a pointer filled in with the height of the texture in pixels * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * @@ -825,13 +810,9 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in /** * Get device independent resolution for rendering. * - * When using the main rendering target (eg no target texture is set): this - * may return 0 for `w` and `h` if the SDL_Renderer has never had its logical - * size set by SDL_RenderSetLogicalSize(). Otherwise it returns the logical - * width and height. - * - * When using a target texture: Never return 0 for `w` and `h` at first. Then - * it returns the logical width and height that are set. + * This may return 0 for `w` and `h` if the SDL_Renderer has never had its + * logical size set by SDL_RenderSetLogicalSize() and never had a render + * target set. * * \param renderer a rendering context * \param w an int to be filled with the width @@ -1021,23 +1002,19 @@ extern DECLSPEC void SDLCALL SDL_RenderWindowToLogical(SDL_Renderer * renderer, int windowX, int windowY, float *logicalX, float *logicalY); - -/** - * Get real coordinates of point in window when given logical coordinates of - * point in renderer. - * - * Logical coordinates will differ from real coordinates when render is scaled - * and logical renderer size set - * - * \param renderer the renderer from which the window coordinates should be - * calculated + /** + * Get real coordinates of point in window when given logical coordinates of point in renderer. + * Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set + * + * \param renderer the renderer from which the window coordinates should be calculated * \param logicalX the logical x coordinate * \param logicalY the logical y coordinate * \param windowX the pointer filled with the real X coordinate in the window * \param windowY the pointer filled with the real Y coordinate in the window - * + + * * \since This function is available since SDL 2.0.18. - * + * * \sa SDL_RenderGetScale * \sa SDL_RenderSetScale * \sa SDL_RenderGetLogicalSize @@ -1626,7 +1603,6 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer, * vertex array Color and alpha modulation is done per vertex * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). * - * \param renderer The rendering context. * \param texture (optional) The SDL texture to use. * \param vertices Vertices. * \param num_vertices Number of vertices. @@ -1651,7 +1627,6 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer, * vertex arrays Color and alpha modulation is done per vertex * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). * - * \param renderer The rendering context. * \param texture (optional) The SDL texture to use. * \param xy Vertex positions * \param xy_stride Byte size to move from one element to the next element @@ -1683,8 +1658,7 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer, * Read pixels from the current rendering target to an array of pixels. * * **WARNING**: This is a very slow operation, and should not be used - * frequently. If you're using this on the main rendering target, it should be - * called after rendering and before SDL_RenderPresent(). + * frequently. * * `pitch` specifies the number of bytes between rows in the destination * `pixels` data. This allows you to write to a subrectangle or have padded diff --git a/externals/SDL/include/SDL_rwops.h b/externals/SDL/include/SDL_rwops.h index 30b69a806..71e5c8db8 100755 --- a/externals/SDL/include/SDL_rwops.h +++ b/externals/SDL/include/SDL_rwops.h @@ -45,6 +45,9 @@ extern "C" { #define SDL_RWOPS_JNIFILE 3U /**< Android asset */ #define SDL_RWOPS_MEMORY 4U /**< Memory stream */ #define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ +#if defined(__VITA__) +#define SDL_RWOPS_VITAFILE 6U /**< Vita file */ +#endif /** * This is the read/write operation structure -- very basic. @@ -110,6 +113,17 @@ typedef struct SDL_RWops size_t left; } buffer; } windowsio; +#elif defined(__VITA__) + struct + { + int h; + struct + { + void *data; + size_t size; + size_t left; + } buffer; + } vitaio; #endif #ifdef HAVE_STDIO_H diff --git a/externals/SDL/include/SDL_scancode.h b/externals/SDL/include/SDL_scancode.h index aaa782f8d..5b2c67c8f 100755 --- a/externals/SDL/include/SDL_scancode.h +++ b/externals/SDL/include/SDL_scancode.h @@ -402,26 +402,6 @@ typedef enum /* @} *//* Usage page 0x0C (additional media keys) */ - /** - * \name Mobile keys - * - * These are values that are often used on mobile phones. - */ - /* @{ */ - - SDL_SCANCODE_SOFTLEFT = 287, /**< Usually situated below the display on phones and - used as a multi-function feature key for selecting - a software defined function shown on the bottom left - of the display. */ - SDL_SCANCODE_SOFTRIGHT = 288, /**< Usually situated below the display on phones and - used as a multi-function feature key for selecting - a software defined function shown on the bottom right - of the display. */ - SDL_SCANCODE_CALL = 289, /**< Used for accepting phone calls. */ - SDL_SCANCODE_ENDCALL = 290, /**< Used for rejecting phone calls. */ - - /* @} *//* Mobile keys */ - /* Add any other keys here. */ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes diff --git a/externals/SDL/include/SDL_stdinc.h b/externals/SDL/include/SDL_stdinc.h index c21e54c06..c0d194c4a 100755 --- a/externals/SDL/include/SDL_stdinc.h +++ b/externals/SDL/include/SDL_stdinc.h @@ -115,12 +115,6 @@ char *alloca(); # endif #endif -#ifdef SIZE_MAX -# define SDL_SIZE_MAX SIZE_MAX -#else -# define SDL_SIZE_MAX ((size_t) -1) -#endif - /** * Check if the compiler supports a given builtin. * Supported by virtually all clang versions and recent gcc. Use this @@ -240,19 +234,6 @@ typedef uint64_t Uint64; /* @} *//* Basic data types */ -/** - * \name Floating-point constants - */ -/* @{ */ - -#ifdef FLT_EPSILON -#define SDL_FLT_EPSILON FLT_EPSILON -#else -#define SDL_FLT_EPSILON 1.1920928955078125e-07F /* 0x0.000002p0 */ -#endif - -/* @} *//* Floating-point constants */ - /* Make sure we have macros for printing width-based integers. * should define these but this is not true all platforms. * (for example win32) */ @@ -373,14 +354,8 @@ typedef uint64_t Uint64; #endif #endif /* SDL_DISABLE_ANALYZE_MACROS */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) -#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x) -#elif defined(__cplusplus) && (__cplusplus >= 201103L) -#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x) -#else /* universal, but may trigger -Wunused-local-typedefs */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] -#endif /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); @@ -468,8 +443,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); -extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *)); -extern DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *)); +extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); extern DECLSPEC int SDLCALL SDL_abs(int x); @@ -561,7 +535,6 @@ extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr); extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); -extern DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes); extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); @@ -735,65 +708,6 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B return SDL_memcpy(dst, src, dwords * 4); } -/** - * If a * b would overflow, return -1. Otherwise store a * b via ret - * and return 0. - * - * \since This function is available since SDL 2.24.0. - */ -SDL_FORCE_INLINE int SDL_size_mul_overflow (size_t a, - size_t b, - size_t *ret) -{ - if (a != 0 && b > SDL_SIZE_MAX / a) { - return -1; - } - *ret = a * b; - return 0; -} - -#if _SDL_HAS_BUILTIN(__builtin_mul_overflow) -/* This needs to be wrapped in an inline rather than being a direct #define, - * because __builtin_mul_overflow() is type-generic, but we want to be - * consistent about interpreting a and b as size_t. */ -SDL_FORCE_INLINE int _SDL_size_mul_overflow_builtin (size_t a, - size_t b, - size_t *ret) -{ - return __builtin_mul_overflow(a, b, ret) == 0 ? 0 : -1; -} -#define SDL_size_mul_overflow(a, b, ret) (_SDL_size_mul_overflow_builtin(a, b, ret)) -#endif - -/** - * If a + b would overflow, return -1. Otherwise store a + b via ret - * and return 0. - * - * \since This function is available since SDL 2.24.0. - */ -SDL_FORCE_INLINE int SDL_size_add_overflow (size_t a, - size_t b, - size_t *ret) -{ - if (b > SDL_SIZE_MAX - a) { - return -1; - } - *ret = a + b; - return 0; -} - -#if _SDL_HAS_BUILTIN(__builtin_add_overflow) -/* This needs to be wrapped in an inline rather than being a direct #define, - * the same as the call to __builtin_mul_overflow() above. */ -SDL_FORCE_INLINE int _SDL_size_add_overflow_builtin (size_t a, - size_t b, - size_t *ret) -{ - return __builtin_add_overflow(a, b, ret) == 0 ? 0 : -1; -} -#define SDL_size_add_overflow(a, b, ret) (_SDL_size_add_overflow_builtin(a, b, ret)) -#endif - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/externals/SDL/include/SDL_system.h b/externals/SDL/include/SDL_system.h index cf5c320f7..e2fa7b5fe 100755 --- a/externals/SDL/include/SDL_system.h +++ b/externals/SDL/include/SDL_system.h @@ -102,22 +102,6 @@ typedef struct ID3D11Device ID3D11Device; */ extern DECLSPEC ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * renderer); -typedef struct ID3D12Device ID3D12Device; - -/** - * Get the D3D12 device associated with a renderer. - * - * Once you are done using the device, you should release it to avoid a - * resource leak. - * - * \param renderer the renderer from which to get the associated D3D12 device - * \returns the D3D12 device associated with given renderer or NULL if it is - * not a D3D12 renderer; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - */ -extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* renderer); - /** * Get the DXGI Adapter and Output indices for the specified display index. * @@ -194,7 +178,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, * This function is only available on Apple iOS. * * For more information see: - * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md + * [README-ios.md](https://hg.libsdl.org/SDL/file/default/docs/README-ios.md) * * This functions is also accessible using the macro * SDL_iOSSetAnimationCallback() since SDL 2.0.4. @@ -211,7 +195,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, * * \sa SDL_iPhoneSetEventPump */ -extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam); +extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); #define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled) @@ -441,18 +425,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis */ extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset); -/** - * Send a user command to SDLActivity. - * - * Override "boolean onUnhandledMessage(Message msg)" to handle the message. - * - * \param command user command that must be greater or equal to 0x8000 - * \param param user parameter - * - * \since This function is available since SDL 2.0.22. - */ -extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param); - #endif /* __ANDROID__ */ /* Platform specific functions for WinRT */ @@ -548,7 +520,7 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); /** - * Detects the device family of WinRT platform at runtime. + * Detects the device family of WinRT plattform at runtime. * * \returns a value from the SDL_WinRT_DeviceFamily enum. * diff --git a/externals/SDL/include/SDL_syswm.h b/externals/SDL/include/SDL_syswm.h index 45f8e7540..f7cd670cd 100755 --- a/externals/SDL/include/SDL_syswm.h +++ b/externals/SDL/include/SDL_syswm.h @@ -298,8 +298,6 @@ struct SDL_SysWMinfo struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */ struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */ struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */ - struct xdg_popup *xdg_popup; /**< Wayland xdg popup role */ - struct xdg_positioner *xdg_positioner; /**< Wayland xdg positioner, for popup */ } wl; #endif #if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ diff --git a/externals/SDL/include/SDL_thread.h b/externals/SDL/include/SDL_thread.h index 1e04a4f8f..35e680ddf 100755 --- a/externals/SDL/include/SDL_thread.h +++ b/externals/SDL/include/SDL_thread.h @@ -129,7 +129,7 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentEndThread pfnEndThread); extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), const char *name, const size_t stacksize, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); diff --git a/externals/SDL/include/SDL_touch.h b/externals/SDL/include/SDL_touch.h index 95924135e..9b00716b2 100755 --- a/externals/SDL/include/SDL_touch.h +++ b/externals/SDL/include/SDL_touch.h @@ -95,14 +95,6 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); */ extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); -/** - * Get the touch device name as reported from the driver or NULL if the index - * is invalid. - * - * \since This function is available since SDL 2.0.22. - */ -extern DECLSPEC const char* SDLCALL SDL_GetTouchName(int index); - /** * Get the type of the given touch device. * diff --git a/externals/SDL/include/SDL_version.h b/externals/SDL/include/SDL_version.h index 562c5fa10..2716eba7b 100755 --- a/externals/SDL/include/SDL_version.h +++ b/externals/SDL/include/SDL_version.h @@ -58,8 +58,8 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ #define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 23 -#define SDL_PATCHLEVEL 1 +#define SDL_MINOR_VERSION 0 +#define SDL_PATCHLEVEL 20 /** * Macro to determine SDL version program was compiled against. @@ -83,8 +83,6 @@ typedef struct SDL_version (x)->patch = SDL_PATCHLEVEL; \ } -/* TODO: Remove this whole block in SDL 3 */ -#if SDL_MAJOR_VERSION < 3 /** * This macro turns the version numbers into a numeric value: * \verbatim @@ -92,35 +90,21 @@ typedef struct SDL_version \endverbatim * * This assumes that there will never be more than 100 patchlevels. - * - * In versions higher than 2.9.0, the minor version overflows into - * the thousands digit: for example, 2.23.0 is encoded as 4300, - * and 2.255.99 would be encoded as 25799. - * This macro will not be available in SDL 3.x. */ #define SDL_VERSIONNUM(X, Y, Z) \ ((X)*1000 + (Y)*100 + (Z)) /** * This is the version number macro for the current SDL version. - * - * In versions higher than 2.9.0, the minor version overflows into - * the thousands digit: for example, 2.23.0 is encoded as 4300. - * This macro will not be available in SDL 3.x. - * - * Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead. */ #define SDL_COMPILEDVERSION \ SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) -#endif /* SDL_MAJOR_VERSION < 3 */ /** * This macro will evaluate to true if compiled with SDL at least X.Y.Z. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ - ((SDL_MAJOR_VERSION >= X) && \ - (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION >= Y) && \ - (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION > Y || SDL_PATCHLEVEL >= Z)) + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) /** * Get the version of SDL that is linked against your program. diff --git a/externals/SDL/include/SDL_video.h b/externals/SDL/include/SDL_video.h index 856560af3..e43cb27ec 100755 --- a/externals/SDL/include/SDL_video.h +++ b/externals/SDL/include/SDL_video.h @@ -1337,7 +1337,6 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window * window, * Mouse grab confines the mouse cursor to the window. * * \param window The window for which the mouse grab mode should be set. - * \param grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release. * * \since This function is available since SDL 2.0.16. * @@ -2009,8 +2008,13 @@ extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, * retry the call with 1 for the interval. * * Adaptive vsync is implemented for some glX drivers with - * GLX_EXT_swap_control_tear, and for some Windows drivers with - * WGL_EXT_swap_control_tear. + * GLX_EXT_swap_control_tear: + * + * https://www.opengl.org/registry/specs/EXT/glx_swap_control_tear.txt + * + * and for some Windows drivers with WGL_EXT_swap_control_tear: + * + * https://www.opengl.org/registry/specs/EXT/wgl_swap_control_tear.txt * * Read more on the Khronos wiki: * https://www.khronos.org/opengl/wiki/Swap_Interval#Adaptive_Vsync diff --git a/externals/SDL/include/begin_code.h b/externals/SDL/include/begin_code.h index b1b1a3a9b..63f064b6f 100755 --- a/externals/SDL/include/begin_code.h +++ b/externals/SDL/include/begin_code.h @@ -107,7 +107,7 @@ #ifdef __BORLANDC__ #pragma nopackwarning #endif -#ifdef _WIN64 +#ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else diff --git a/externals/SDL/sdl2-config-version.cmake.in b/externals/SDL/sdl2-config-version.cmake.in index 5c6aee44d..c987bc1a0 100755 --- a/externals/SDL/sdl2-config-version.cmake.in +++ b/externals/SDL/sdl2-config-version.cmake.in @@ -1,5 +1,3 @@ -# sdl2 cmake project-config-version input for ./configure scripts - set(PACKAGE_VERSION "@SDL_VERSION@") if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) @@ -10,3 +8,4 @@ else() set(PACKAGE_VERSION_EXACT TRUE) endif() endif() + diff --git a/externals/SDL/sdl2-config.cmake.in b/externals/SDL/sdl2-config.cmake.in index 37610ba23..c570511fa 100755 --- a/externals/SDL/sdl2-config.cmake.in +++ b/externals/SDL/sdl2-config.cmake.in @@ -1,205 +1,81 @@ -# sdl2 cmake project-config input for ./configure script +# sdl2 cmake project-config input for ./configure scripts -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -# Copied from `configure_package_config_file` -macro(set_and_check _var _file) - set(${_var} "${_file}") - if(NOT EXISTS "${_file}") - message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") - endif() -endmacro() - -# Copied from `configure_package_config_file` -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}@cmake_prefix_relpath@" ABSOLUTE) +set(prefix "@prefix@") set(exec_prefix "@exec_prefix@") -set(bindir "@bindir@") set(libdir "@libdir@") set(includedir "@includedir@") +set(SDL2_PREFIX "${prefix}") +set(SDL2_EXEC_PREFIX "${exec_prefix}") +set(SDL2_LIBDIR "${libdir}") +set(SDL2_INCLUDE_DIRS "${includedir}/SDL2") +set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@") +string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) -set_and_check(SDL2_PREFIX "${prefix}") -set_and_check(SDL2_EXEC_PREFIX "${exec_prefix}") -set_and_check(SDL2_BINDIR "${bindir}") -set_and_check(SDL2_INCLUDE_DIR "${includedir}/SDL2") -set_and_check(SDL2_LIBDIR "${libdir}") -set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}") +if(NOT TARGET SDL2::SDL2) + # provide SDL2::SDL2, SDL2::SDL2main and SDL2::SDL2-static targets, like SDL2Config.cmake does, for compatibility -set(SDL2_LIBRARIES SDL2::SDL2) -set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) -set(SDL2MAIN_LIBRARY) -set(SDL2TEST_LIBRARY SDL2::SDL2test) + # Remove -lSDL2 as that is handled by CMake, note the space at the end so it does not replace e.g. -lSDL2main + # This may require "libdir" beeing set (from above) + string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS "@SDL_RLD_FLAGS@ @SDL_LIBS@ ") + # also get rid of -lSDL2main, if you want to link against that use both SDL2::SDL2main and SDL2::SDL2 (in that order) + # (SDL2Config.cmake has the same behavior) + string(REPLACE "-lSDL2main" "" SDL2_EXTRA_LINK_FLAGS ${SDL2_EXTRA_LINK_FLAGS}) + string(STRIP "${SDL2_EXTRA_LINK_FLAGS}" SDL2_EXTRA_LINK_FLAGS) + string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ") + string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC) -unset(prefix) -unset(exec_prefix) -unset(bindir) -unset(libdir) -unset(includedir) +if(WIN32 AND NOT MSVC) + # MINGW needs very special handling, because the link order must be exactly -lmingw32 -lSDL2main -lSDL2 + # for it to work at all (and -mwindows somewhere); a normal SHARED IMPORTED or STATIC IMPORTED library always puts itself first + # so handle this like a header-only lib and put everything in INTERFACE_LINK_LIBRARIES -set(_sdl2_libraries "@SDL_LIBS@") -set(_sdl2_static_private_libs "@SDL_STATIC_LIBS@") + add_library(SDL2::SDL2 INTERFACE IMPORTED) + set_target_properties(SDL2::SDL2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2") -# Convert _sdl2_libraries to list and keep only libraries -string(REGEX MATCHALL "-[lm]([-a-zA-Z0-9._]+)" _sdl2_libraries "${_sdl2_libraries}") -string(REGEX REPLACE "^-l" "" _sdl2_libraries "${_sdl2_libraries}") -string(REGEX REPLACE ";-l" ";" _sdl2_libraries "${_sdl2_libraries}") + add_library(SDL2::SDL2main INTERFACE IMPORTED) + set_target_properties(SDL2::SDL2main PROPERTIES + INTERFACE_LINK_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -mwindows") -# Convert _sdl2_static_private_libs to list and keep only libraries -string(REGEX MATCHALL "(-[lm]([-a-zA-Z0-9._]+))|(-Wl,[^ ]*framework[^ ]*)" _sdl2_static_private_libs "${_sdl2_static_private_libs}") -string(REGEX REPLACE "^-l" "" _sdl2_static_private_libs "${_sdl2_static_private_libs}") -string(REGEX REPLACE ";-l" ";" _sdl2_static_private_libs "${_sdl2_static_private_libs}") +else() # (not WIN32) or MSVC -if(_sdl2_libraries MATCHES ".*SDL2main.*") - list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main) - list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main) - set(_sdl2main_library ${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}) - if(EXISTS "${_sdl2main_library}") - set(SDL2MAIN_LIBRARY SDL2::SDL2main) - if(NOT TARGET SDL2::SDL2main) - add_library(SDL2::SDL2main STATIC IMPORTED) - set_target_properties(SDL2::SDL2main - PROPERTIES - IMPORTED_LOCATION "${_sdl2main_library}" - ) - if(WIN32) - # INTERFACE_LINK_OPTIONS needs CMake 3.13 - cmake_minimum_required(VERSION 3.13) - # Mark WinMain/WinMain@16 as undefined, such that it will be withheld by the linker. - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set_target_properties(SDL2::SDL2main - PROPERTIES - INTERFACE_LINK_OPTIONS "-Wl,--undefined=_WinMain@16" - ) - else() - set_target_properties(SDL2::SDL2main - PROPERTIES - INTERFACE_LINK_OPTIONS "-Wl,--undefined=WinMain" - ) - endif() - endif() - endif() - set(SDL2_SDL2main_FOUND TRUE) + add_library(SDL2::SDL2 SHARED IMPORTED) + set_target_properties(SDL2::SDL2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") + + if(MSVC) + # This file is generated when building SDL2 with autotools and MinGW, and MinGW/dlltool + # isn't able to generate .lib files that are usable by recent MSVC versions + # (something about "module unsafe for SAFESEH"; SAFESEH is enabled by default in MSVC). + # The .lib file for SDL2.dll *could* be generated with `gendef SDL2.dll` and then + # `lib.exe /machine:x86 /def:SDL2.def /out:SDL2.lib` (or /machine:amd64) + # but that requires lib.exe from a Visual Studio installation - and that still doesn't + # give you a static SDL2main.lib with SAFESEH support that you'll need (unless you don't use SDL2main) + # Note that when building SDL2 with CMake and MSVC, the result works with both MinGW and MSVC. + + message(FATAL_ERROR, "This build of libSDL2 only supports MinGW, not MSVC (Visual C++), because it lacks .lib files!") + # MSVC needs SDL2.lib set as IMPORTED_IMPLIB to link against (comment out message() call above if you added SDL2.lib yourself) + set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB "${SDL2_LIBDIR}/SDL2.lib") else() - set(SDL2_SDL2main_FOUND FALSE) + # this mustn't be set for MSVC, so do it here in an extra call here + set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") endif() - unset(_sdl2main_library) -endif() -# Remove SDL2 since this is the "central" library -# Remove SDL2main since this will be provided by SDL2::SDL2main (if available) -# Remove mingw32 and cygwin since these are not needed when using `-Wl,--undefined,WinMain` -set(_sdl2_link_libraries ${_sdl2_libraries}) -list(REMOVE_ITEM _sdl2_link_libraries SDL2 SDL2main mingw32 cygwin) + add_library(SDL2::SDL2main STATIC IMPORTED) + set_target_properties(SDL2::SDL2main PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}") -if(WIN32) - set(_sdl2_implib "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(_sdl2_dll "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - if(EXISTS "${_sdl2_implib}" AND EXISTS "${_sdl2_dll}") - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_IMPLIB "${_sdl2_implib}" - IMPORTED_LOCATION "${_sdl2_dll}" - ) - endif() - set(SDL2_SDL2_FOUND TRUE) - else() - set(SDL2_SDL2_FOUND FALSE) - endif() - unset(_sdl2_implib) - unset(_sdl2_dll) -else() - set(_sdl2_shared "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") - if(EXISTS "${_sdl2_shared}") - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${_sdl2_shared}" - ) - endif() - set(SDL2_SDL2_FOUND TRUE) - else() - set(SDL2_SDL2_FOUND FALSE) - endif() - unset(_sdl2_shared) -endif() +endif() # (not WIN32) or MSVC -set(_sdl2_static "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}") -if(EXISTS "${_sdl2_static}") - if(NOT TARGET SDL2::SDL2-static) - add_library(SDL2::SDL2-static STATIC IMPORTED) - set_target_properties(SDL2::SDL2-static - PROPERTIES - IMPORTED_LOCATION "${_sdl2_static}" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries};${_sdl2_static_private_libs}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif() - set(SDL2_SDL2-static_FOUND TRUE) -else() - set(SDL2_SDL2-static_FOUND FALSE) -endif() -unset(_sdl2_static) + add_library(SDL2::SDL2-static STATIC IMPORTED) + set_target_properties(SDL2::SDL2-static PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}") -unset(_sdl2_link_libraries) - -set(_sdl2test_library "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_test${CMAKE_STATIC_LIBRARY_SUFFIX}") -if(EXISTS "${_sdl2test_library}") - if(NOT TARGET SDL2::SDL2test) - add_library(SDL2::SDL2test STATIC IMPORTED) - set_target_properties(SDL2::SDL2test - PROPERTIES - IMPORTED_LOCATION "_sdl2test_library" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif() - set(SDL2_SDL2test_FOUND TRUE) -else() - set(SDL2_SDL2test_FOUND FALSE) -endif() -unset(_sdl2test_library) - -# Copied from `configure_package_config_file` -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -check_required_components(SDL2) - -# Create SDL2::SDL2 alias for static-only builds -if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) - if(CMAKE_VERSION VERSION_LESS "3.18") - # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. - add_library(SDL2::SDL2 INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static") - else() - add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) - endif() -endif() +endif() # NOT TARGET SDL2::SDL2 diff --git a/externals/SDL/sdl2-config.in b/externals/SDL/sdl2-config.in index 3a87ab85b..5a2aed292 100755 --- a/externals/SDL/sdl2-config.in +++ b/externals/SDL/sdl2-config.in @@ -1,10 +1,6 @@ #!/bin/sh -# Get the canonical path of the folder containing this script -bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") - -# Calculate the canonical path of the prefix, relative to the folder of this script -prefix=$(cd -P -- "$bindir/@bin_prefix_relpath@" && printf '%s\n' "$(pwd -P)") +prefix=@prefix@ exec_prefix=@exec_prefix@ exec_prefix_set=no libdir=@libdir@ @@ -53,8 +49,7 @@ while test $# -gt 0; do @ENABLE_SHARED_TRUE@ ;; @ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs) @ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs) -@ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL2[ $]#-Wl,-Bstatic -lSDL2 -Wl,-Bdynamic #g") -@ENABLE_STATIC_TRUE@ echo -L@libdir@ $sdl_static_libs +@ENABLE_STATIC_TRUE@ echo -L@libdir@ @SDL_LIBS@ @SDL_STATIC_LIBS@ @ENABLE_STATIC_TRUE@ ;; *) echo "${usage}" 1>&2 diff --git a/externals/SDL/src/SDL.c b/externals/SDL/src/SDL.c index 0afaeb18c..67afa67aa 100755 --- a/externals/SDL/src/SDL.c +++ b/externals/SDL/src/SDL.c @@ -47,7 +47,6 @@ #include "SDL_bits.h" #include "SDL_revision.h" #include "SDL_assert_c.h" -#include "SDL_log_c.h" #include "events/SDL_events_c.h" #include "haptic/SDL_haptic_c.h" #include "joystick/SDL_joystick_c.h" @@ -62,26 +61,6 @@ extern int SDL_HelperWindowCreate(void); extern int SDL_HelperWindowDestroy(void); #endif -#ifdef SDL_BUILD_MAJOR_VERSION -SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MAJOR_VERSION, - SDL_MAJOR_VERSION == SDL_BUILD_MAJOR_VERSION); -SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MINOR_VERSION, - SDL_MINOR_VERSION == SDL_BUILD_MINOR_VERSION); -SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MICRO_VERSION, - SDL_PATCHLEVEL == SDL_BUILD_MICRO_VERSION); -#endif - -SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_min, SDL_MAJOR_VERSION >= 0); -/* Limited only by the need to fit in SDL_version */ -SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_max, SDL_MAJOR_VERSION <= 255); - -SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_min, SDL_MINOR_VERSION >= 0); -/* Limited only by the need to fit in SDL_version */ -SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_max, SDL_MINOR_VERSION <= 255); - -SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_min, SDL_PATCHLEVEL >= 0); -/* Limited by its encoding in SDL_VERSIONNUM and in the ABI versions */ -SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_max, SDL_PATCHLEVEL <= 99); /* This is not declared in any header, although it is shared between some parts of SDL, because we don't want anything calling it without an @@ -174,11 +153,10 @@ SDL_InitSubSystem(Uint32 flags) Uint32 flags_initialized = 0; if (!SDL_MainIsReady) { - return SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?"); + SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?"); + return -1; } - SDL_LogInit(); - /* Clear the error message */ SDL_ClearError(); @@ -230,7 +208,7 @@ SDL_InitSubSystem(Uint32 flags) /* Initialize the timer subsystem */ if ((flags & SDL_INIT_TIMER)){ -#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY +#if !SDL_TIMERS_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) { if (SDL_TimerInit() < 0) { goto quit_and_error; @@ -339,8 +317,6 @@ SDL_InitSubSystem(Uint32 flags) #endif } - (void) flags_initialized; /* make static analysis happy, since this only gets used in error cases. */ - return (0); quit_and_error: @@ -426,7 +402,7 @@ SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY +#if !SDL_TIMERS_DISABLED if ((flags & SDL_INIT_TIMER)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) { SDL_TimerQuit(); @@ -493,13 +469,12 @@ SDL_Quit(void) SDL_ClearHints(); SDL_AssertionsQuit(); + SDL_LogResetPriorities(); #if SDL_USE_LIBDBUS SDL_DBus_Quit(); #endif - SDL_LogQuit(); - /* Now that every subsystem has been quit, we reset the subsystem refcount * and the list of initialized subsystems. */ @@ -583,14 +558,10 @@ SDL_GetPlatform(void) return "tvOS"; #elif __IPHONEOS__ return "iOS"; -#elif __PS2__ - return "PlayStation 2"; #elif __PSP__ return "PlayStation Portable"; #elif __VITA__ return "PlayStation Vita"; -#elif __NGAGE__ - return "Nokia N-Gage"; #else return "Unknown (see SDL_platform.h)"; #endif diff --git a/externals/SDL/src/SDL_assert.c b/externals/SDL/src/SDL_assert.c index 02cd6b3fd..9c7acac55 100755 --- a/externals/SDL/src/SDL_assert.c +++ b/externals/SDL/src/SDL_assert.c @@ -45,8 +45,6 @@ #include #endif -/* The size of the stack buffer to use for rendering assert messages. */ -#define SDL_MAX_ASSERT_MESSAGE_STACK 256 static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); @@ -90,20 +88,6 @@ static void SDL_AddAssertionToReport(SDL_assert_data *data) } } -#ifdef __WIN32__ - #define ENDLINE "\r\n" -#else - #define ENDLINE "\n" -#endif - -static int SDL_RenderAssertMessage(char *buf, size_t buf_len, const SDL_assert_data *data) { - return SDL_snprintf(buf, buf_len, - "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE " '%s'", - data->function, data->filename, data->linenum, - data->trigger_count, (data->trigger_count == 1) ? "time" : "times", - data->condition - ); -} static void SDL_GenerateAssertionReport(void) { @@ -153,9 +137,16 @@ static SDL_NORETURN void SDL_AbortAssertion(void) SDL_ExitProcess(42); } + static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { +#ifdef __WIN32__ + #define ENDLINE "\r\n" +#else + #define ENDLINE "\n" +#endif + const char *envr; SDL_assert_state state = SDL_ASSERTION_ABORT; SDL_Window *window; @@ -169,46 +160,30 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, SDL_ASSERTION_ALWAYS_IGNORE, "Always Ignore" } }; + char *message; int selected; - char stack_buf[SDL_MAX_ASSERT_MESSAGE_STACK]; - char *message = stack_buf; - size_t buf_len = sizeof(stack_buf); - int len; - (void) userdata; /* unused in default handler. */ - /* Assume the output will fit... */ - len = SDL_RenderAssertMessage(message, buf_len, data); - - /* .. and if it didn't, try to allocate as much room as we actually need. */ - if (len >= (int)buf_len) { - if (SDL_size_add_overflow(len, 1, &buf_len) == 0) { - message = (char *)SDL_malloc(buf_len); - if (message) { - len = SDL_RenderAssertMessage(message, buf_len, data); - } else { - message = stack_buf; - } - } - } - - /* Something went very wrong */ - if (len < 0) { - if (message != stack_buf) { - SDL_free(message); - } + /* !!! FIXME: why is this using SDL_stack_alloc and not just "char message[SDL_MAX_LOG_MESSAGE];" ? */ + message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); + if (!message) { + /* Uh oh, we're in real trouble now... */ return SDL_ASSERTION_ABORT; } + SDL_snprintf(message, SDL_MAX_LOG_MESSAGE, + "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE + " '%s'", + data->function, data->filename, data->linenum, + data->trigger_count, (data->trigger_count == 1) ? "time" : "times", + data->condition); debug_print("\n\n%s\n\n", message); /* let env. variable override, so unit tests won't block in a GUI. */ envr = SDL_getenv("SDL_ASSERT"); if (envr != NULL) { - if (message != stack_buf) { - SDL_free(message); - } + SDL_stack_free(message); if (SDL_strcmp(envr, "abort") == 0) { return SDL_ASSERTION_ABORT; @@ -326,9 +301,7 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) SDL_RestoreWindow(window); } - if (message != stack_buf) { - SDL_free(message); - } + SDL_stack_free(message); return state; } diff --git a/externals/SDL/src/SDL_error.c b/externals/SDL/src/SDL_error.c index 68b518d8e..4d25999a3 100755 --- a/externals/SDL/src/SDL_error.c +++ b/externals/SDL/src/SDL_error.c @@ -25,6 +25,8 @@ #include "SDL_error.h" #include "SDL_error_c.h" +#define SDL_ERRBUFIZE 1024 + int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { diff --git a/externals/SDL/src/SDL_hints.c b/externals/SDL/src/SDL_hints.c index 96869f676..2eea5501e 100755 --- a/externals/SDL/src/SDL_hints.c +++ b/externals/SDL/src/SDL_hints.c @@ -52,7 +52,7 @@ SDL_SetHintWithPriority(const char *name, const char *value, SDL_Hint *hint; SDL_HintWatch *entry; - if (!name) { + if (!name || !value) { return SDL_FALSE; } @@ -66,7 +66,7 @@ SDL_SetHintWithPriority(const char *name, const char *value, if (priority < hint->priority) { return SDL_FALSE; } - if (((hint->value == NULL) != (value == NULL)) || (value && (SDL_strcmp(hint->value, value) != 0))) { + if (!hint->value || !value || SDL_strcmp(hint->value, value) != 0) { for (entry = hint->callbacks; entry; ) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; @@ -178,12 +178,6 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata) return; } hint->name = SDL_strdup(name); - if (!hint->name) { - SDL_free(entry); - SDL_free(hint); - SDL_OutOfMemory(); - return; - } hint->value = NULL; hint->priority = SDL_HINT_DEFAULT; hint->callbacks = NULL; diff --git a/externals/SDL/src/SDL_internal.h b/externals/SDL/src/SDL_internal.h index 43e407f87..69da271c6 100755 --- a/externals/SDL/src/SDL_internal.h +++ b/externals/SDL/src/SDL_internal.h @@ -43,9 +43,10 @@ #if SDL_DYNAMIC_API #include "dynapi/SDL_dynapi_overrides.h" -/* force DECLSPEC off...it's all internal symbols now. +/* force DECLSPEC and SDLCALL off...it's all internal symbols now. These will have actual #defines during SDL_dynapi.c only */ #define DECLSPEC +#define SDLCALL #endif #include "SDL_config.h" diff --git a/externals/SDL/src/SDL_log.c b/externals/SDL/src/SDL_log.c index 88dd6af66..4f820ffa7 100755 --- a/externals/SDL/src/SDL_log.c +++ b/externals/SDL/src/SDL_log.c @@ -28,8 +28,6 @@ #include "SDL_error.h" #include "SDL_log.h" -#include "SDL_mutex.h" -#include "SDL_log_c.h" #if HAVE_STDIO_H #include @@ -39,12 +37,6 @@ #include #endif -#include "stdlib/SDL_vacopy.h" - - -/* The size of the stack buffer to use for rendering log messages. */ -#define SDL_MAX_LOG_MESSAGE_STACK 256 - #define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL #define DEFAULT_ASSERT_PRIORITY SDL_LOG_PRIORITY_WARN #define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO @@ -67,7 +59,6 @@ static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY; static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY; static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput; static void *SDL_log_userdata = NULL; -static SDL_mutex *log_function_mutex = NULL; static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = { NULL, @@ -101,24 +92,6 @@ static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = { }; #endif /* __ANDROID__ */ -void -SDL_LogInit(void) -{ - if (!log_function_mutex) { - /* if this fails we'll try to continue without it. */ - log_function_mutex = SDL_CreateMutex(); - } -} - -void -SDL_LogQuit(void) -{ - SDL_LogResetPriorities(); - if (log_function_mutex) { - SDL_DestroyMutex(log_function_mutex); - log_function_mutex = NULL; - } -} void SDL_LogSetAllPriority(SDL_LogPriority priority) @@ -291,11 +264,8 @@ GetCategoryPrefix(int category) void SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap) { - char *message = NULL; - char stack_buf[SDL_MAX_LOG_MESSAGE_STACK]; - size_t len_plus_term; - int len; - va_list aq; + char *message; + size_t len; /* Nothing to do if we don't have an output function */ if (!SDL_log_function) { @@ -312,33 +282,16 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list return; } - if (!log_function_mutex) { - /* this mutex creation can race if you log from two threads at startup. You should have called SDL_Init first! */ - log_function_mutex = SDL_CreateMutex(); - } - - /* Render into stack buffer */ - va_copy(aq, ap); - len = SDL_vsnprintf(stack_buf, sizeof(stack_buf), fmt, aq); - va_end(aq); - - if (len < 0) + /* !!! FIXME: why not just "char message[SDL_MAX_LOG_MESSAGE];" ? */ + message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); + if (!message) { return; - - /* If message truncated, allocate and re-render */ - if (len >= sizeof(stack_buf) && SDL_size_add_overflow(len, 1, &len_plus_term) == 0) { - /* Allocate exactly what we need, including the zero-terminator */ - message = (char *)SDL_malloc(len_plus_term); - if (!message) - return; - va_copy(aq, ap); - len = SDL_vsnprintf(message, len_plus_term, fmt, aq); - va_end(aq); - } else { - message = stack_buf; } + SDL_vsnprintf(message, SDL_MAX_LOG_MESSAGE, fmt, ap); + /* Chop off final endline. */ + len = SDL_strlen(message); if ((len > 0) && (message[len-1] == '\n')) { message[--len] = '\0'; if ((len > 0) && (message[len-1] == '\r')) { /* catch "\r\n", too. */ @@ -346,20 +299,8 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list } } - if (log_function_mutex) { - SDL_LockMutex(log_function_mutex); - } - SDL_log_function(SDL_log_userdata, category, priority, message); - - if (log_function_mutex) { - SDL_UnlockMutex(log_function_mutex); - } - - /* Free only if dynamically allocated */ - if (message != stack_buf) { - SDL_free(message); - } + SDL_stack_free(message); } #if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) @@ -462,12 +403,19 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, #elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)) /* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now. */ - extern void SDL_NSLog(const char *prefix, const char *text); + extern void SDL_NSLog(const char *text); { - SDL_NSLog(SDL_priority_prefixes[priority], message); - return; + char *text; + /* !!! FIXME: why not just "char text[SDL_MAX_LOG_MESSAGE];" ? */ + text = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); + if (text) { + SDL_snprintf(text, SDL_MAX_LOG_MESSAGE, "%s: %s", SDL_priority_prefixes[priority], message); + SDL_NSLog(text); + SDL_stack_free(text); + return; + } } -#elif defined(__PSP__) || defined(__PS2__) +#elif defined(__PSP__) { FILE* pFile; pFile = fopen ("SDL_Log.txt", "a"); diff --git a/externals/SDL/src/atomic/SDL_spinlock.c b/externals/SDL/src/atomic/SDL_spinlock.c index f9877c3fe..bdd347e41 100755 --- a/externals/SDL/src/atomic/SDL_spinlock.c +++ b/externals/SDL/src/atomic/SDL_spinlock.c @@ -40,10 +40,6 @@ #include #endif -#if defined(PS2) -#include -#endif - #if defined(__WATCOMC__) && defined(__386__) SDL_COMPILE_TIME_ASSERT(locksize, 4==sizeof(SDL_SpinLock)); extern __inline int _SDL_xchg_watcom(volatile int *a, int v); @@ -135,19 +131,7 @@ SDL_AtomicTryLock(SDL_SpinLock *lock) #elif defined(__SOLARIS__) && !defined(_LP64) /* Used for Solaris with non-gcc compilers. */ return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)lock, 0, 1) == 0); -#elif defined(PS2) - uint32_t oldintr; - SDL_bool res = SDL_FALSE; - // disable interuption - oldintr = DIntr(); - if (*lock == 0) { - *lock = 1; - res = SDL_TRUE; - } - // enable interuption - if(oldintr) { EIntr(); } - return res; #else #error Please implement for your platform. return SDL_FALSE; diff --git a/externals/SDL/src/audio/SDL_audio.c b/externals/SDL/src/audio/SDL_audio.c index ac3ac1fc2..849416c83 100755 --- a/externals/SDL/src/audio/SDL_audio.c +++ b/externals/SDL/src/audio/SDL_audio.c @@ -245,6 +245,11 @@ SDL_AudioThreadDeinit_Default(_THIS) { /* no-op. */ } +static void +SDL_AudioBeginLoopIteration_Default(_THIS) +{ /* no-op. */ +} + static void SDL_AudioWaitDevice_Default(_THIS) { /* no-op. */ @@ -272,6 +277,11 @@ SDL_AudioFlushCapture_Default(_THIS) { /* no-op. */ } +static void +SDL_AudioPrepareToClose_Default(_THIS) +{ /* no-op. */ +} + static void SDL_AudioCloseDevice_Default(_THIS) { /* no-op. */ @@ -289,7 +299,7 @@ SDL_AudioFreeDeviceHandle_Default(void *handle) static int -SDL_AudioOpenDevice_Default(_THIS, const char *devname) +SDL_AudioOpenDevice_Default(_THIS, void *handle, const char *devname, int iscapture) { return SDL_Unsupported(); } @@ -324,6 +334,11 @@ SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device) } } +static void +SDL_AudioLockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device) +{ +} + static void finish_audio_entry_points_init(void) { @@ -332,6 +347,14 @@ finish_audio_entry_points_init(void) * blindly call them without having to check for validity first. */ + if (current_audio.impl.SkipMixerLock) { + if (current_audio.impl.LockDevice == NULL) { + current_audio.impl.LockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock; + } + if (current_audio.impl.UnlockDevice == NULL) { + current_audio.impl.UnlockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock; + } + } #define FILL_STUB(x) \ if (current_audio.impl.x == NULL) { \ @@ -341,11 +364,13 @@ finish_audio_entry_points_init(void) FILL_STUB(OpenDevice); FILL_STUB(ThreadInit); FILL_STUB(ThreadDeinit); + FILL_STUB(BeginLoopIteration); FILL_STUB(WaitDevice); FILL_STUB(PlayDevice); FILL_STUB(GetDeviceBuf); FILL_STUB(CaptureFromDevice); FILL_STUB(FlushCapture); + FILL_STUB(PrepareToClose); FILL_STUB(CloseDevice); FILL_STUB(LockDevice); FILL_STUB(UnlockDevice); @@ -404,7 +429,8 @@ add_audio_device(const char *name, SDL_AudioSpec *spec, void *handle, SDL_AudioD SDL_UnlockMutex(current_audio.detectionLock); SDL_free(item->original_name); SDL_free(item); - return SDL_OutOfMemory(); + SDL_OutOfMemory(); + return -1; } SDL_snprintf(replacement, len, "%s (%d)", name, dupenum + 1); @@ -457,7 +483,7 @@ free_device_list(SDL_AudioDeviceItem **devices, int *devCount) /* The audio backends call this when a new device is plugged in. */ void -SDL_AddAudioDevice(const SDL_bool iscapture, const char *name, SDL_AudioSpec *spec, void *handle) +SDL_AddAudioDevice(const int iscapture, const char *name, SDL_AudioSpec *spec, void *handle) { const int device_index = iscapture ? add_capture_device(name, spec, handle) : add_output_device(name, spec, handle); if (device_index != -1) { @@ -519,7 +545,7 @@ mark_device_removed(void *handle, SDL_AudioDeviceItem *devices, SDL_bool *remove /* The audio backends call this when a device is removed from the system. */ void -SDL_RemoveAudioDevice(const SDL_bool iscapture, void *handle) +SDL_RemoveAudioDevice(const int iscapture, void *handle) { int device_index; SDL_AudioDevice *device = NULL; @@ -697,6 +723,7 @@ SDL_RunAudio(void *devicep) /* Loop, filling the audio buffers */ while (!SDL_AtomicGet(&device->shutdown)) { + current_audio.impl.BeginLoopIteration(device); data_len = device->callbackspec.size; /* Fill the current buffer with sound */ @@ -759,6 +786,8 @@ SDL_RunAudio(void *devicep) } } + current_audio.impl.PrepareToClose(device); + /* Wait for the audio to drain. */ SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2); @@ -802,6 +831,8 @@ SDL_CaptureAudio(void *devicep) int still_need; Uint8 *ptr; + current_audio.impl.BeginLoopIteration(device); + if (SDL_AtomicGet(&device->paused)) { SDL_Delay(delay); /* just so we don't cook the CPU. */ if (device->stream) { @@ -925,18 +956,20 @@ SDL_GetAudioDriver(int index) int SDL_AudioInit(const char *driver_name) { - int i; - SDL_bool initialized = SDL_FALSE, tried_to_init = SDL_FALSE; + int i = 0; + int initialized = 0; + int tried_to_init = 0; if (SDL_GetCurrentAudioDriver()) { SDL_AudioQuit(); /* shutdown driver if already running. */ } + SDL_zero(current_audio); SDL_zeroa(open_devices); /* Select the proper audio driver */ if (driver_name == NULL) { - driver_name = SDL_GetHint(SDL_HINT_AUDIODRIVER); + driver_name = SDL_getenv("SDL_AUDIODRIVER"); } if (driver_name != NULL && *driver_name != 0) { @@ -957,7 +990,7 @@ SDL_AudioInit(const char *driver_name) for (i = 0; bootstrap[i]; ++i) { if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) && (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) { - tried_to_init = SDL_TRUE; + tried_to_init = 1; SDL_zero(current_audio); current_audio.name = bootstrap[i]->name; current_audio.desc = bootstrap[i]->desc; @@ -974,7 +1007,7 @@ SDL_AudioInit(const char *driver_name) continue; } - tried_to_init = SDL_TRUE; + tried_to_init = 1; SDL_zero(current_audio); current_audio.name = bootstrap[i]->name; current_audio.desc = bootstrap[i]->desc; @@ -1081,29 +1114,38 @@ SDL_GetNumAudioDevices(int iscapture) const char * SDL_GetAudioDeviceName(int index, int iscapture) { - SDL_AudioDeviceItem *item; - int i; - const char *retval; + const char *retval = NULL; if (!SDL_GetCurrentAudioDriver()) { SDL_SetError("Audio subsystem is not initialized"); return NULL; } - SDL_LockMutex(current_audio.detectionLock); - item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; - i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; - if (index >= 0 && index < i) { - for (i--; i > index; i--, item = item->next) { - SDL_assert(item != NULL); - } - SDL_assert(item != NULL); - retval = item->name; - } else { - SDL_InvalidParamError("index"); - retval = NULL; + if (iscapture && !current_audio.impl.HasCaptureSupport) { + SDL_SetError("No capture support"); + return NULL; + } + + if (index >= 0) { + SDL_AudioDeviceItem *item; + int i; + + SDL_LockMutex(current_audio.detectionLock); + item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; + i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; + if (index < i) { + for (i--; i > index; i--, item = item->next) { + SDL_assert(item != NULL); + } + SDL_assert(item != NULL); + retval = item->name; + } + SDL_UnlockMutex(current_audio.detectionLock); + } + + if (retval == NULL) { + SDL_SetError("No such device"); } - SDL_UnlockMutex(current_audio.detectionLock); return retval; } @@ -1112,33 +1154,38 @@ SDL_GetAudioDeviceName(int index, int iscapture) int SDL_GetAudioDeviceSpec(int index, int iscapture, SDL_AudioSpec *spec) { - SDL_AudioDeviceItem *item; - int i, retval; - if (spec == NULL) { return SDL_InvalidParamError("spec"); } + SDL_zerop(spec); + if (!SDL_GetCurrentAudioDriver()) { return SDL_SetError("Audio subsystem is not initialized"); } - SDL_LockMutex(current_audio.detectionLock); - item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; - i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; - if (index >= 0 && index < i) { - for (i--; i > index; i--, item = item->next) { - SDL_assert(item != NULL); - } - SDL_assert(item != NULL); - SDL_memcpy(spec, &item->spec, sizeof(SDL_AudioSpec)); - retval = 0; - } else { - retval = SDL_InvalidParamError("index"); + if (iscapture && !current_audio.impl.HasCaptureSupport) { + return SDL_SetError("No capture support"); } - SDL_UnlockMutex(current_audio.detectionLock); - return retval; + if (index >= 0) { + SDL_AudioDeviceItem *item; + int i; + + SDL_LockMutex(current_audio.detectionLock); + item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; + i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount; + if (index < i) { + for (i--; i > index; i--, item = item->next) { + SDL_assert(item != NULL); + } + SDL_assert(item != NULL); + SDL_memcpy(spec, &item->spec, sizeof(SDL_AudioSpec)); + } + SDL_UnlockMutex(current_audio.detectionLock); + } + + return 0; } @@ -1374,7 +1421,7 @@ open_audio_device(const char *devname, int iscapture, SDL_AtomicSet(&device->enabled, 1); /* Create a mutex for locking the sound buffers */ - if (current_audio.impl.LockDevice == SDL_AudioLockDevice_Default) { + if (!current_audio.impl.SkipMixerLock) { device->mixer_lock = SDL_CreateMutex(); if (device->mixer_lock == NULL) { close_audio_device(device); @@ -1383,7 +1430,7 @@ open_audio_device(const char *devname, int iscapture, } } - if (current_audio.impl.OpenDevice(device, devname) < 0) { + if (current_audio.impl.OpenDevice(device, handle, devname, iscapture) < 0) { close_audio_device(device); return 0; } @@ -1508,7 +1555,8 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained) /* SDL_OpenAudio() is legacy and can only act on Device ID #1. */ if (open_devices[0] != NULL) { - return SDL_SetError("Audio device is already opened"); + SDL_SetError("Audio device is already opened"); + return -1; } if (obtained) { @@ -1649,6 +1697,8 @@ SDL_AudioQuit(void) #ifdef HAVE_LIBSAMPLERATE_H UnloadLibSampleRate(); #endif + + SDL_FreeResampleFilter(); } #define NUM_FORMATS 10 diff --git a/externals/SDL/src/audio/SDL_audio_c.h b/externals/SDL/src/audio/SDL_audio_c.h index bfa0760de..cddaecef0 100755 --- a/externals/SDL/src/audio/SDL_audio_c.h +++ b/externals/SDL/src/audio/SDL_audio_c.h @@ -70,6 +70,11 @@ extern SDL_AudioFilter SDL_Convert_F32_to_S16; extern SDL_AudioFilter SDL_Convert_F32_to_U16; extern SDL_AudioFilter SDL_Convert_F32_to_S32; +/* You need to call SDL_PrepareResampleFilter() before using the internal resampler. + SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */ +extern int SDL_PrepareResampleFilter(void); +extern void SDL_FreeResampleFilter(void); + #endif /* SDL_audio_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/audio/SDL_audiocvt.c b/externals/SDL/src/audio/SDL_audiocvt.c index 0b95b417c..31e4e224d 100755 --- a/externals/SDL/src/audio/SDL_audiocvt.c +++ b/externals/SDL/src/audio/SDL_audiocvt.c @@ -80,7 +80,7 @@ SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT * cvt, SDL_AudioFormat format) Just use unaligned load/stores, if the memory at runtime is aligned it'll be just as fast on modern processors */ while (i >= 4) { /* 4 * float32 */ - _mm_storeu_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_loadu_ps(src), _mm_loadu_ps(src+4)), divby2)); + _mm_storeu_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_load_ps(src), _mm_loadu_ps(src+4)), divby2)); i -= 4; src += 8; dst += 4; } @@ -369,11 +369,11 @@ SDL_Convert71To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) const float surround_left_distributed = src[6] * 0.5f; const float surround_right_distributed = src[7] * 0.5f; dst[0] = (src[0] + surround_left_distributed) * two_thirds; /* FL */ - dst[1] = (src[1] + surround_right_distributed) * two_thirds; /* FR */ + dst[1] = (src[1] + surround_right_distributed) * two_thirds; /* FR */ dst[2] = src[2] * two_thirds; /* CC */ dst[3] = src[3] * two_thirds; /* LFE */ dst[4] = (src[4] + surround_left_distributed) * two_thirds; /* BL */ - dst[5] = (src[5] + surround_right_distributed) * two_thirds; /* BR */ + dst[5] = (src[5] + surround_right_distributed) * two_thirds; /* BR */ } cvt->len_cvt /= 8; @@ -398,12 +398,12 @@ SDL_Convert71To61(SDL_AudioCVT * cvt, SDL_AudioFormat format) for (i = cvt->len_cvt / (sizeof (float) * 8); i; --i, src += 8, dst += 7) { dst[0] = src[3]; /* LFE */ - dst[1] = src[2]; /* FC */ + dst[1] = src[2]; /* FC */ dst[2] = src[1]; /* FR */ dst[3] = src[7]; /* SR */ dst[4] = (src[4] + src[5]) / 0.2f; /* BackSurround */ dst[5] = src[6]; /* SL */ - dst[6] = src[0]; /* FL */ + dst[6] = src[0]; /* FL */ } cvt->len_cvt /= 8; @@ -428,13 +428,13 @@ SDL_Convert61To71(SDL_AudioCVT * cvt, SDL_AudioFormat format) for (i = cvt->len_cvt / (sizeof (float) * 7); i; --i, src += 7, dst += 8) { dst[0] = src[6]; /* FL */ - dst[1] = src[2]; /* FR */ + dst[1] = src[2]; /* FR */ dst[2] = src[1]; /* FC */ dst[3] = src[0]; /* LFE */ dst[4] = src[4]; /* BL */ dst[5] = src[4]; /* BR */ - dst[6] = src[5]; /* SL */ - dst[7] = src[3]; /* SR */ + dst[6] = src[5]; /* SL */ + dst[7] = src[3]; /* SR */ } cvt->len_cvt /= 7; @@ -459,12 +459,12 @@ SDL_Convert51To61(SDL_AudioCVT * cvt, SDL_AudioFormat format) for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 7) { dst[0] = src[3]; /* LFE */ - dst[1] = src[2]; /* FC */ + dst[1] = src[2]; /* FC */ dst[2] = src[1]; /* FR */ dst[3] = src[5]; /* SR */ dst[4] = (src[4] + src[5]) / 0.2f; /* BackSurround */ dst[5] = src[4]; /* SL */ - dst[6] = src[0]; /* FL */ + dst[6] = src[0]; /* FL */ } cvt->len_cvt /= 6; @@ -489,7 +489,7 @@ SDL_Convert61To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) for (i = cvt->len_cvt / (sizeof (float) * 7); i; --i, src += 7, dst += 6) { dst[0] = src[6]; /* FL */ - dst[1] = src[2]; /* FR */ + dst[1] = src[2]; /* FR */ dst[2] = src[1]; /* FC */ dst[3] = src[0]; /* LFE */ dst[4] = src[5]; /* BL */ @@ -614,7 +614,7 @@ SDL_ConvertQuadTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) ce = (lf + rf) * 0.5f; /* Constant 0.571f is approx 4/7 not to saturate */ dst[0] = 0.571f * (lf + (lf - 0.5f * ce)); /* FL */ - dst[1] = 0.571f * (rf + (rf - 0.5f * ce)); /* FR */ + dst[1] = 0.571f * (rf + (rf - 0.5f * ce)); /* FR */ dst[2] = ce; /* FC */ dst[3] = 0; /* LFE (only meant for special LFE effects) */ dst[4] = lb; /* BL */ @@ -704,16 +704,105 @@ SDL_Convert51To71(SDL_AudioCVT * cvt, SDL_AudioFormat format) /* SDL's resampler uses a "bandlimited interpolation" algorithm: https://ccrma.stanford.edu/~jos/resample/ */ -#include "SDL_audio_resampler_filter.h" +#define RESAMPLER_ZERO_CROSSINGS 5 +#define RESAMPLER_BITS_PER_SAMPLE 16 +#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1)) +#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1) + +/* This is a "modified" bessel function, so you can't use POSIX j0() */ +static double +bessel(const double x) +{ + const double xdiv2 = x / 2.0; + double i0 = 1.0f; + double f = 1.0f; + int i = 1; + + while (SDL_TRUE) { + const double diff = SDL_pow(xdiv2, i * 2) / SDL_pow(f, 2); + if (diff < 1.0e-21f) { + break; + } + i0 += diff; + i++; + f *= (double) i; + } + + return i0; +} + +/* build kaiser table with cardinal sine applied to it, and array of differences between elements. */ +static void +kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double beta) +{ + const int lenm1 = tablelen - 1; + const int lenm1div2 = lenm1 / 2; + int i; + + table[0] = 1.0f; + for (i = 1; i < tablelen; i++) { + const double kaiser = bessel(beta * SDL_sqrt(1.0 - SDL_pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel(beta); + table[tablelen - i] = (float) kaiser; + } + + for (i = 1; i < tablelen; i++) { + const float x = (((float) i) / ((float) RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) * ((float) M_PI); + table[i] *= SDL_sinf(x) / x; + diffs[i - 1] = table[i] - table[i - 1]; + } + diffs[lenm1] = 0.0f; +} + + +static SDL_SpinLock ResampleFilterSpinlock = 0; +static float *ResamplerFilter = NULL; +static float *ResamplerFilterDifference = NULL; + +int +SDL_PrepareResampleFilter(void) +{ + SDL_AtomicLock(&ResampleFilterSpinlock); + if (!ResamplerFilter) { + /* if dB > 50, beta=(0.1102 * (dB - 8.7)), according to Matlab. */ + const double dB = 80.0; + const double beta = 0.1102 * (dB - 8.7); + const size_t alloclen = RESAMPLER_FILTER_SIZE * sizeof (float); + + ResamplerFilter = (float *) SDL_malloc(alloclen); + if (!ResamplerFilter) { + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return SDL_OutOfMemory(); + } + + ResamplerFilterDifference = (float *) SDL_malloc(alloclen); + if (!ResamplerFilterDifference) { + SDL_free(ResamplerFilter); + ResamplerFilter = NULL; + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return SDL_OutOfMemory(); + } + kaiser_and_sinc(ResamplerFilter, ResamplerFilterDifference, RESAMPLER_FILTER_SIZE, beta); + } + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return 0; +} + +void +SDL_FreeResampleFilter(void) +{ + SDL_free(ResamplerFilter); + SDL_free(ResamplerFilterDifference); + ResamplerFilter = NULL; + ResamplerFilterDifference = NULL; +} static int ResamplerPadding(const int inrate, const int outrate) { if (inrate == outrate) { return 0; - } - if (inrate > outrate) { - return (int) SDL_ceilf(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); + } else if (inrate > outrate) { + return (int) SDL_ceil(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); } return RESAMPLER_SAMPLES_PER_ZERO_CROSSING; } @@ -725,38 +814,33 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate, const float *inbuf, const int inbuflen, float *outbuf, const int outbuflen) { - /* Note that this used to be double, but it looks like we can get by with float in most cases at - almost twice the speed on Intel processors, and orders of magnitude more - on CPUs that need a software fallback for double calculations. */ - typedef float ResampleFloatType; - - const ResampleFloatType finrate = (ResampleFloatType) inrate; - const ResampleFloatType outtimeincr = ((ResampleFloatType) 1.0f) / ((ResampleFloatType) outrate); - const ResampleFloatType ratio = ((float) outrate) / ((float) inrate); + const double finrate = (double) inrate; + const double outtimeincr = 1.0 / ((float) outrate); + const double ratio = ((float) outrate) / ((float) inrate); const int paddinglen = ResamplerPadding(inrate, outrate); const int framelen = chans * (int)sizeof (float); const int inframes = inbuflen / framelen; const int wantedoutframes = (int) ((inbuflen / framelen) * ratio); /* outbuflen isn't total to write, it's total available. */ const int maxoutframes = outbuflen / framelen; const int outframes = SDL_min(wantedoutframes, maxoutframes); - ResampleFloatType outtime = 0.0f; float *dst = outbuf; + double outtime = 0.0; int i, j, chan; for (i = 0; i < outframes; i++) { const int srcindex = (int) (outtime * inrate); - const ResampleFloatType intime = ((ResampleFloatType) srcindex) / finrate; - const ResampleFloatType innexttime = ((ResampleFloatType) (srcindex + 1)) / finrate; - const ResampleFloatType indeltatime = innexttime - intime; - const ResampleFloatType interpolation1 = (indeltatime == 0.0f) ? 1.0f : (1.0f - ((innexttime - outtime) / indeltatime)); + const double intime = ((double) srcindex) / finrate; + const double innexttime = ((double) (srcindex + 1)) / finrate; + const double interpolation1 = 1.0 - ((innexttime - outtime) / (innexttime - intime)); const int filterindex1 = (int) (interpolation1 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); - const ResampleFloatType interpolation2 = 1.0f - interpolation1; + const double interpolation2 = 1.0 - interpolation1; const int filterindex2 = (int) (interpolation2 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); for (chan = 0; chan < chans; chan++) { float outsample = 0.0f; /* do this twice to calculate the sample, once for the "left wing" and then same for the right. */ + /* !!! FIXME: do both wings in one loop */ for (j = 0; (filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { const int srcframe = srcindex - j; /* !!! FIXME: we can bubble this conditional out of here by doing a pre loop. */ @@ -764,15 +848,12 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate, outsample += (float)(insample * (ResamplerFilter[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation1 * ResamplerFilterDifference[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); } - /* Do the right wing! */ for (j = 0; (filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { - const int jsamples = j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING; const int srcframe = srcindex + 1 + j; /* !!! FIXME: we can bubble this conditional out of here by doing a post loop. */ const float insample = (srcframe >= inframes) ? rpadding[((srcframe - inframes) * chans) + chan] : inbuf[(srcframe * chans) + chan]; - outsample += (float)(insample * (ResamplerFilter[filterindex2 + jsamples] + (interpolation2 * ResamplerFilterDifference[filterindex2 + jsamples]))); + outsample += (float)(insample * (ResamplerFilter[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation2 * ResamplerFilterDifference[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); } - *(dst++) = outsample; } @@ -849,7 +930,9 @@ SDL_AddAudioCVTFilter(SDL_AudioCVT *cvt, const SDL_AudioFilter filter) if (cvt->filter_index >= SDL_AUDIOCVT_MAX_FILTERS) { return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS); } - SDL_assert(filter != NULL); + if (filter == NULL) { + return SDL_SetError("Audio filter pointer is NULL"); + } cvt->filters[cvt->filter_index++] = filter; cvt->filters[cvt->filter_index] = NULL; /* Moving terminator */ return 0; @@ -860,7 +943,7 @@ SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt) { int retval = 0; /* 0 == no conversion necessary. */ - if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN) && SDL_AUDIO_BITSIZE(src_fmt) > 8) { + if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { return -1; } @@ -937,7 +1020,7 @@ SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) retval = 1; /* added a converter. */ } - if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN) && SDL_AUDIO_BITSIZE(dst_fmt) > 8) { + if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { return -1; } @@ -1037,6 +1120,10 @@ SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, const int dst_channels, return SDL_SetError("No conversion available for these rates"); } + if (SDL_PrepareResampleFilter() < 0) { + return -1; + } + /* Update (cvt) with filter details... */ if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { return -1; @@ -1130,26 +1217,19 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, if (!SDL_SupportedAudioFormat(src_fmt)) { return SDL_SetError("Invalid source format"); - } - if (!SDL_SupportedAudioFormat(dst_fmt)) { + } else if (!SDL_SupportedAudioFormat(dst_fmt)) { return SDL_SetError("Invalid destination format"); - } - if (!SDL_SupportedChannelCount(src_channels)) { + } else if (!SDL_SupportedChannelCount(src_channels)) { return SDL_SetError("Invalid source channels"); - } - if (!SDL_SupportedChannelCount(dst_channels)) { + } else if (!SDL_SupportedChannelCount(dst_channels)) { return SDL_SetError("Invalid destination channels"); - } - if (src_rate <= 0) { + } else if (src_rate <= 0) { return SDL_SetError("Source rate is equal to or less than zero"); - } - if (dst_rate <= 0) { + } else if (dst_rate <= 0) { return SDL_SetError("Destination rate is equal to or less than zero"); - } - if (src_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { + } else if (src_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { return SDL_SetError("Source rate is too high"); - } - if (dst_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { + } else if (dst_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) { return SDL_SetError("Destination rate is too high"); } @@ -1193,9 +1273,6 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, /* just a byteswap needed? */ if ((src_fmt & ~SDL_AUDIO_MASK_ENDIAN) == (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN)) { - if (SDL_AUDIO_BITSIZE(dst_fmt) == 8) { - return 0; - } if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { return -1; } @@ -1589,7 +1666,6 @@ SDL_NewAudioStream(const SDL_AudioFormat src_format, retval = (SDL_AudioStream *) SDL_calloc(1, sizeof (SDL_AudioStream)); if (!retval) { - SDL_OutOfMemory(); return NULL; } @@ -1657,6 +1733,13 @@ SDL_NewAudioStream(const SDL_AudioFormat src_format, return NULL; } + if (SDL_PrepareResampleFilter() < 0) { + SDL_free(retval->resampler_state); + retval->resampler_state = NULL; + SDL_FreeAudioStream(retval); + return NULL; + } + retval->resampler_func = SDL_ResampleAudioStream; retval->reset_resampler_func = SDL_ResetAudioStreamResampler; retval->cleanup_resampler_func = SDL_CleanupAudioStreamResampler; @@ -1824,14 +1907,11 @@ SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len) if (!stream) { return SDL_InvalidParamError("stream"); - } - if (!buf) { + } else if (!buf) { return SDL_InvalidParamError("buf"); - } - if (len == 0) { + } else if (len == 0) { return 0; /* nothing to do. */ - } - if ((len % stream->src_sample_frame_size) != 0) { + } else if ((len % stream->src_sample_frame_size) != 0) { return SDL_SetError("Can't add partial sample frames"); } @@ -1937,14 +2017,11 @@ SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len) if (!stream) { return SDL_InvalidParamError("stream"); - } - if (!buf) { + } else if (!buf) { return SDL_InvalidParamError("buf"); - } - if (len <= 0) { + } else if (len <= 0) { return 0; /* nothing to do. */ - } - if ((len % stream->dst_sample_frame_size) != 0) { + } else if ((len % stream->dst_sample_frame_size) != 0) { return SDL_SetError("Can't request partial sample frames"); } @@ -1990,3 +2067,4 @@ SDL_FreeAudioStream(SDL_AudioStream *stream) } /* vi: set ts=4 sw=4 expandtab: */ + diff --git a/externals/SDL/src/audio/SDL_mixer.c b/externals/SDL/src/audio/SDL_mixer.c index 9c9e5df21..23adec056 100755 --- a/externals/SDL/src/audio/SDL_mixer.c +++ b/externals/SDL/src/audio/SDL_mixer.c @@ -29,6 +29,7 @@ /* This table is used to add two sound values together and pin * the value to avoid overflow. (used with permission from ARDI) + * Changed to use 0xFE instead of 0xFF for better sound quality. */ static const Uint8 mix8[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -65,25 +66,24 @@ static const Uint8 mix8[] = { 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, - 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE }; /* The volume ranges from 0 - 128 */ #define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME) #define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128) -#define ADJUST_VOLUME_U16(s, v) (s = (((s-32768)*v)/SDL_MIX_MAXVOLUME)+32768) void @@ -115,8 +115,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Sint8 *dst8, *src8; Sint8 src_sample; int dst_sample; - const int max_audioval = SDL_MAX_SINT8; - const int min_audioval = SDL_MIN_SINT8; + const int max_audioval = ((1 << (8 - 1)) - 1); + const int min_audioval = -(1 << (8 - 1)); src8 = (Sint8 *) src; dst8 = (Sint8 *) dst; @@ -125,11 +125,12 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, ADJUST_VOLUME(src_sample, volume); dst_sample = *dst8 + src_sample; if (dst_sample > max_audioval) { - dst_sample = max_audioval; + *dst8 = max_audioval; } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; + *dst8 = min_audioval; + } else { + *dst8 = dst_sample; } - *dst8 = dst_sample; ++dst8; ++src8; } @@ -140,14 +141,14 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, { Sint16 src1, src2; int dst_sample; - const int max_audioval = SDL_MAX_SINT16; - const int min_audioval = SDL_MIN_SINT16; + const int max_audioval = ((1 << (16 - 1)) - 1); + const int min_audioval = -(1 << (16 - 1)); len /= 2; while (len--) { - src1 = SDL_SwapLE16(*(Sint16 *)src); + src1 = ((src[1]) << 8 | src[0]); ADJUST_VOLUME(src1, volume); - src2 = SDL_SwapLE16(*(Sint16 *)dst); + src2 = ((dst[1]) << 8 | dst[0]); src += 2; dst_sample = src1 + src2; if (dst_sample > max_audioval) { @@ -155,7 +156,9 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, } else if (dst_sample < min_audioval) { dst_sample = min_audioval; } - *(Sint16 *)dst = SDL_SwapLE16(dst_sample); + dst[0] = dst_sample & 0xFF; + dst_sample >>= 8; + dst[1] = dst_sample & 0xFF; dst += 2; } } @@ -165,14 +168,14 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, { Sint16 src1, src2; int dst_sample; - const int max_audioval = SDL_MAX_SINT16; - const int min_audioval = SDL_MIN_SINT16; + const int max_audioval = ((1 << (16 - 1)) - 1); + const int min_audioval = -(1 << (16 - 1)); len /= 2; while (len--) { - src1 = SDL_SwapBE16(*(Sint16 *)src); + src1 = ((src[0]) << 8 | src[1]); ADJUST_VOLUME(src1, volume); - src2 = SDL_SwapBE16(*(Sint16 *)dst); + src2 = ((dst[0]) << 8 | dst[1]); src += 2; dst_sample = src1 + src2; if (dst_sample > max_audioval) { @@ -180,7 +183,9 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, } else if (dst_sample < min_audioval) { dst_sample = min_audioval; } - *(Sint16 *)dst = SDL_SwapBE16(dst_sample); + dst[1] = dst_sample & 0xFF; + dst_sample >>= 8; + dst[0] = dst_sample & 0xFF; dst += 2; } } @@ -190,23 +195,21 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, { Uint16 src1, src2; int dst_sample; - const int max_audioval = SDL_MAX_SINT16; - const int min_audioval = SDL_MIN_SINT16; + const int max_audioval = 0xFFFF; len /= 2; while (len--) { - src1 = SDL_SwapLE16(*(Uint16 *)src); - ADJUST_VOLUME_U16(src1, volume); - src2 = SDL_SwapLE16(*(Uint16 *)dst); + src1 = ((src[1]) << 8 | src[0]); + ADJUST_VOLUME(src1, volume); + src2 = ((dst[1]) << 8 | dst[0]); src += 2; - dst_sample = src1 + src2 - 32768 * 2; + dst_sample = src1 + src2; if (dst_sample > max_audioval) { dst_sample = max_audioval; - } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; } - dst_sample += 32768; - *(Uint16 *)dst = SDL_SwapLE16(dst_sample); + dst[0] = dst_sample & 0xFF; + dst_sample >>= 8; + dst[1] = dst_sample & 0xFF; dst += 2; } } @@ -216,23 +219,21 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, { Uint16 src1, src2; int dst_sample; - const int max_audioval = SDL_MAX_SINT16; - const int min_audioval = SDL_MIN_SINT16; + const int max_audioval = 0xFFFF; len /= 2; while (len--) { - src1 = SDL_SwapBE16(*(Uint16 *)src); - ADJUST_VOLUME_U16(src1, volume); - src2 = SDL_SwapBE16(*(Uint16 *)dst); + src1 = ((src[0]) << 8 | src[1]); + ADJUST_VOLUME(src1, volume); + src2 = ((dst[0]) << 8 | dst[1]); src += 2; - dst_sample = src1 + src2 - 32768 * 2; + dst_sample = src1 + src2; if (dst_sample > max_audioval) { dst_sample = max_audioval; - } else if (dst_sample < min_audioval) { - dst_sample = min_audioval; } - dst_sample += 32768; - *(Uint16 *)dst = SDL_SwapBE16(dst_sample); + dst[1] = dst_sample & 0xFF; + dst_sample >>= 8; + dst[0] = dst_sample & 0xFF; dst += 2; } } @@ -244,8 +245,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Uint32 *dst32 = (Uint32 *) dst; Sint64 src1, src2; Sint64 dst_sample; - const Sint64 max_audioval = SDL_MAX_SINT32; - const Sint64 min_audioval = SDL_MIN_SINT32; + const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1); + const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1)); len /= 4; while (len--) { @@ -270,8 +271,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Uint32 *dst32 = (Uint32 *) dst; Sint64 src1, src2; Sint64 dst_sample; - const Sint64 max_audioval = SDL_MAX_SINT32; - const Sint64 min_audioval = SDL_MIN_SINT32; + const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1); + const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1)); len /= 4; while (len--) { diff --git a/externals/SDL/src/audio/SDL_sysaudio.h b/externals/SDL/src/audio/SDL_sysaudio.h index 8aa729817..6c602f07b 100755 --- a/externals/SDL/src/audio/SDL_sysaudio.h +++ b/externals/SDL/src/audio/SDL_sysaudio.h @@ -39,11 +39,11 @@ typedef struct SDL_AudioDevice SDL_AudioDevice; /* Audio targets should call this as devices are added to the system (such as a USB headset being plugged in), and should also be called for for every device found during DetectDevices(). */ -extern void SDL_AddAudioDevice(const SDL_bool iscapture, const char *name, SDL_AudioSpec *spec, void *handle); +extern void SDL_AddAudioDevice(const int iscapture, const char *name, SDL_AudioSpec *spec, void *handle); /* Audio targets should call this as devices are removed, so SDL can update its list of available devices. */ -extern void SDL_RemoveAudioDevice(const SDL_bool iscapture, void *handle); +extern void SDL_RemoveAudioDevice(const int iscapture, void *handle); /* Audio targets should call this if an opened audio device is lost while being used. This can happen due to i/o errors, or a device being unplugged, @@ -65,14 +65,16 @@ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device); typedef struct SDL_AudioDriverImpl { void (*DetectDevices) (void); - int (*OpenDevice) (_THIS, const char *devname); + int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture); void (*ThreadInit) (_THIS); /* Called by audio thread at start */ void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */ + void (*BeginLoopIteration)(_THIS); /* Called by audio thread at top of loop */ void (*WaitDevice) (_THIS); void (*PlayDevice) (_THIS); Uint8 *(*GetDeviceBuf) (_THIS); int (*CaptureFromDevice) (_THIS, void *buffer, int buflen); void (*FlushCapture) (_THIS); + void (*PrepareToClose) (_THIS); /**< Called between run and draining wait for playback devices */ void (*CloseDevice) (_THIS); void (*LockDevice) (_THIS); void (*UnlockDevice) (_THIS); @@ -82,11 +84,13 @@ typedef struct SDL_AudioDriverImpl /* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */ /* Some flags to push duplicate code into the core and reduce #ifdefs. */ - SDL_bool ProvidesOwnCallbackThread; - SDL_bool HasCaptureSupport; - SDL_bool OnlyHasDefaultOutputDevice; - SDL_bool OnlyHasDefaultCaptureDevice; - SDL_bool AllowsArbitraryDeviceNames; + /* !!! FIXME: these should be SDL_bool */ + int ProvidesOwnCallbackThread; + int SkipMixerLock; + int HasCaptureSupport; + int OnlyHasDefaultOutputDevice; + int OnlyHasDefaultCaptureDevice; + int AllowsArbitraryDeviceNames; } SDL_AudioDriverImpl; @@ -174,8 +178,8 @@ typedef struct AudioBootStrap { const char *name; const char *desc; - SDL_bool (*init) (SDL_AudioDriverImpl * impl); - SDL_bool demand_only; /* 1==request explicitly, or it won't be available. */ + int (*init) (SDL_AudioDriverImpl * impl); + int demand_only; /* 1==request explicitly, or it won't be available. */ } AudioBootStrap; /* Not all of these are available in a given build. Use #ifdefs, etc. */ diff --git a/externals/SDL/src/audio/SDL_wave.c b/externals/SDL/src/audio/SDL_wave.c index e49b55068..07eb10147 100755 --- a/externals/SDL/src/audio/SDL_wave.c +++ b/externals/SDL/src/audio/SDL_wave.c @@ -685,7 +685,7 @@ MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) state.output.pos = 0; state.output.size = outputsize / sizeof(Sint16); - state.output.data = (Sint16 *)SDL_calloc(1, outputsize); + state.output.data = (Sint16 *)SDL_malloc(outputsize); if (state.output.data == NULL) { return SDL_OutOfMemory(); } diff --git a/externals/SDL/src/audio/aaudio/SDL_aaudio.c b/externals/SDL/src/audio/aaudio/SDL_aaudio.c index 1d1553ba7..4e728b5c1 100755 --- a/externals/SDL/src/audio/aaudio/SDL_aaudio.c +++ b/externals/SDL/src/audio/aaudio/SDL_aaudio.c @@ -71,10 +71,9 @@ void aaudio_errorCallback( AAudioStream *stream, void *userData, aaudio_result_t #define LIB_AAUDIO_SO "libaaudio.so" static int -aaudio_OpenDevice(_THIS, const char *devname) +aaudio_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { struct SDL_PrivateAudioData *private; - SDL_bool iscapture = this->iscapture; aaudio_result_t res; LOGI(__func__); @@ -269,7 +268,7 @@ aaudio_Deinitialize(void) LOGI("End AAUDIO %s", SDL_GetError()); } -static SDL_bool +static int aaudio_Init(SDL_AudioDriverImpl *impl) { aaudio_result_t res; @@ -281,7 +280,7 @@ aaudio_Init(SDL_AudioDriverImpl *impl) * See https://github.com/google/oboe/issues/40 for more information. */ if (SDL_GetAndroidSDKVersion() < 27) { - return SDL_FALSE; + return 0; } SDL_zero(ctx); @@ -316,12 +315,12 @@ aaudio_Init(SDL_AudioDriverImpl *impl) /* and the capabilities */ impl->HasCaptureSupport = SDL_TRUE; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; /* this audio target is available. */ LOGI("SDL aaudio_Init OK"); - return SDL_TRUE; + return 1; failure: if (ctx.handle) { @@ -332,11 +331,11 @@ failure: } ctx.handle = NULL; ctx.builder = NULL; - return SDL_FALSE; + return 0; } AudioBootStrap aaudio_bootstrap = { - "AAudio", "AAudio audio driver", aaudio_Init, SDL_FALSE + "AAudio", "AAudio audio driver", aaudio_Init, 0 }; /* Pause (block) all non already paused audio devices by taking their mixer lock */ diff --git a/externals/SDL/src/audio/alsa/SDL_alsa_audio.c b/externals/SDL/src/audio/alsa/SDL_alsa_audio.c index 3f990a2a0..78a491eda 100755 --- a/externals/SDL/src/audio/alsa/SDL_alsa_audio.c +++ b/externals/SDL/src/audio/alsa/SDL_alsa_audio.c @@ -543,10 +543,9 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params) } static int -ALSA_OpenDevice(_THIS, const char *devname) +ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { int status = 0; - SDL_bool iscapture = this->iscapture; snd_pcm_t *pcm_handle = NULL; snd_pcm_hw_params_t *hwparams = NULL; snd_pcm_sw_params_t *swparams = NULL; @@ -570,7 +569,7 @@ ALSA_OpenDevice(_THIS, const char *devname) /* Open the audio device */ /* Name of device should depend on # channels in spec */ status = ALSA_snd_pcm_open(&pcm_handle, - get_audio_device(this->handle, this->spec.channels), + get_audio_device(handle, this->spec.channels), iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); @@ -598,7 +597,10 @@ ALSA_OpenDevice(_THIS, const char *devname) } /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + status = -1; + for (test_format = SDL_FirstAudioFormat(this->spec.format); + test_format && (status < 0);) { + status = 0; /* if we can't support a format, it'll become -1. */ switch (test_format) { case AUDIO_U8: format = SND_PCM_FORMAT_U8; @@ -631,14 +633,19 @@ ALSA_OpenDevice(_THIS, const char *devname) format = SND_PCM_FORMAT_FLOAT_BE; break; default: - continue; - } - if (ALSA_snd_pcm_hw_params_set_format(pcm_handle, hwparams, format) >= 0) { + status = -1; break; } + if (status >= 0) { + status = ALSA_snd_pcm_hw_params_set_format(pcm_handle, + hwparams, format); + } + if (status < 0) { + test_format = SDL_NextAudioFormat(); + } } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "alsa"); + if (status < 0) { + return SDL_SetError("ALSA: Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -990,11 +997,11 @@ ALSA_Deinitialize(void) UnloadALSALibrary(); } -static SDL_bool +static int ALSA_Init(SDL_AudioDriverImpl * impl) { if (LoadALSALibrary() < 0) { - return SDL_FALSE; + return 0; } /* Set the function pointers */ @@ -1010,12 +1017,12 @@ ALSA_Init(SDL_AudioDriverImpl * impl) impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap ALSA_bootstrap = { - "alsa", "ALSA PCM audio", ALSA_Init, SDL_FALSE + "alsa", "ALSA PCM audio", ALSA_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_ALSA */ diff --git a/externals/SDL/src/audio/android/SDL_androidaudio.c b/externals/SDL/src/audio/android/SDL_androidaudio.c index aa0d44242..3efa2d630 100755 --- a/externals/SDL/src/audio/android/SDL_androidaudio.c +++ b/externals/SDL/src/audio/android/SDL_androidaudio.c @@ -36,10 +36,9 @@ static SDL_AudioDevice* audioDevice = NULL; static SDL_AudioDevice* captureDevice = NULL; static int -ANDROIDAUDIO_OpenDevice(_THIS, const char *devname) +ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { SDL_AudioFormat test_format; - SDL_bool iscapture = this->iscapture; SDL_assert((captureDevice == NULL) || !iscapture); SDL_assert((audioDevice == NULL) || iscapture); @@ -55,18 +54,20 @@ ANDROIDAUDIO_OpenDevice(_THIS, const char *devname) return SDL_OutOfMemory(); } - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + test_format = SDL_FirstAudioFormat(this->spec.format); + while (test_format != 0) { /* no "UNKNOWN" constant */ if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16) || (test_format == AUDIO_F32)) { this->spec.format = test_format; break; } + test_format = SDL_NextAudioFormat(); } - if (!test_format) { + if (test_format == 0) { /* Didn't find a compatible format :( */ - return SDL_SetError("%s: Unsupported audio format", "android"); + return SDL_SetError("No compatible audio format!"); } if (Android_JNI_OpenAudioDevice(iscapture, &this->spec) < 0) { @@ -119,7 +120,7 @@ ANDROIDAUDIO_CloseDevice(_THIS) SDL_free(this->hidden); } -static SDL_bool +static int ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -132,14 +133,14 @@ ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl) /* and the capabilities */ impl->HasCaptureSupport = SDL_TRUE; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap ANDROIDAUDIO_bootstrap = { - "android", "SDL Android audio driver", ANDROIDAUDIO_Init, SDL_FALSE + "android", "SDL Android audio driver", ANDROIDAUDIO_Init, 0 }; /* Pause (block) all non already paused audio devices by taking their mixer lock */ diff --git a/externals/SDL/src/audio/arts/SDL_artsaudio.c b/externals/SDL/src/audio/arts/SDL_artsaudio.c index ce74b7d4d..040d93669 100755 --- a/externals/SDL/src/audio/arts/SDL_artsaudio.c +++ b/externals/SDL/src/audio/arts/SDL_artsaudio.c @@ -216,11 +216,11 @@ ARTS_Suspend(void) } static int -ARTS_OpenDevice(_THIS, const char *devname) +ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { int rc = 0; - int bits, frag_spec = 0; - SDL_AudioFormat test_format = 0; + int bits = 0, frag_spec = 0; + SDL_AudioFormat test_format = 0, format = 0; /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -231,24 +231,32 @@ ARTS_OpenDevice(_THIS, const char *devname) SDL_zerop(this->hidden); /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); + !format && test_format;) { #ifdef DEBUG_AUDIO fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { case AUDIO_U8: + bits = 8; + format = 1; + break; case AUDIO_S16LSB: + bits = 16; + format = 1; break; default: - continue; + format = 0; + break; + } + if (!format) { + test_format = SDL_NextAudioFormat(); } - break; } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "arts"); + if (format == 0) { + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; - bits = SDL_AUDIO_BITSIZE(test_format); if ((rc = SDL_NAME(arts_init) ()) != 0) { return SDL_SetError("Unable to initialize ARTS: %s", @@ -312,16 +320,16 @@ ARTS_Deinitialize(void) } -static SDL_bool +static int ARTS_Init(SDL_AudioDriverImpl * impl) { if (LoadARTSLibrary() < 0) { - return SDL_FALSE; + return 0; } else { if (SDL_NAME(arts_init) () != 0) { UnloadARTSLibrary(); SDL_SetError("ARTS: arts_init failed (no audio server?)"); - return SDL_FALSE; + return 0; } /* Play a stream so aRts doesn't crash */ @@ -342,14 +350,14 @@ ARTS_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = ARTS_GetDeviceBuf; impl->CloseDevice = ARTS_CloseDevice; impl->Deinitialize = ARTS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap ARTS_bootstrap = { - "arts", "Analog RealTime Synthesizer", ARTS_Init, SDL_FALSE + "arts", "Analog RealTime Synthesizer", ARTS_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_ARTS */ diff --git a/externals/SDL/src/audio/coreaudio/SDL_coreaudio.m b/externals/SDL/src/audio/coreaudio/SDL_coreaudio.m index 5c267fb36..67d838fdd 100755 --- a/externals/SDL/src/audio/coreaudio/SDL_coreaudio.m +++ b/externals/SDL/src/audio/coreaudio/SDL_coreaudio.m @@ -522,12 +522,8 @@ static void outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; - - SDL_LockMutex(this->mixer_lock); - if (SDL_AtomicGet(&this->hidden->shutdown)) { - SDL_UnlockMutex(this->mixer_lock); - return; /* don't do anything, since we don't even want to enqueue this buffer again. */ + return; /* don't do anything. */ } if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { @@ -540,8 +536,10 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe while (remaining > 0) { if (SDL_AudioStreamAvailable(this->stream) == 0) { /* Generate the data */ + SDL_LockMutex(this->mixer_lock); (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); + SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; SDL_AudioStreamPut(this->stream, this->hidden->buffer, this->hidden->bufferSize); } @@ -567,8 +565,10 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe UInt32 len; if (this->hidden->bufferOffset >= this->hidden->bufferSize) { /* Generate the data */ + SDL_LockMutex(this->mixer_lock); (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); + SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; } @@ -587,8 +587,6 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity; - - SDL_UnlockMutex(this->mixer_lock); } static void @@ -743,10 +741,8 @@ COREAUDIO_CloseDevice(_THIS) #if MACOSX_COREAUDIO static int -prepare_device(_THIS) +prepare_device(_THIS, void *handle, int iscapture) { - void *handle = this->handle; - SDL_bool iscapture = this->iscapture; AudioDeviceID devid = (AudioDeviceID) ((size_t) handle); OSStatus result = noErr; UInt32 size = 0; @@ -987,7 +983,7 @@ audioqueue_thread(void *arg) and quits (flagging the audioqueue for shutdown), or toggles to some other system output device (in which case we'll try again). */ const AudioDeviceID prev_devid = this->hidden->deviceID; - if (prepare_device(this) && (prev_devid != this->hidden->deviceID)) { + if (prepare_device(this, this->handle, this->iscapture) && (prev_devid != this->hidden->deviceID)) { AudioQueueStop(this->hidden->audioQueue, 1); if (assign_device_to_audioqueue(this)) { int i; @@ -1019,11 +1015,11 @@ audioqueue_thread(void *arg) } static int -COREAUDIO_OpenDevice(_THIS, const char *devname) +COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { AudioStreamBasicDescription *strdesc; - SDL_AudioFormat test_format; - SDL_bool iscapture = this->iscapture; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + int valid_datatype = 0; SDL_AudioDevice **new_open_devices; /* Initialize all variables that we clean on shutdown */ @@ -1080,7 +1076,8 @@ COREAUDIO_OpenDevice(_THIS, const char *devname) strdesc->mSampleRate = this->spec.freq; strdesc->mFramesPerPacket = 1; - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + while ((!valid_datatype) && (test_format)) { + this->spec.format = test_format; /* CoreAudio handles most of SDL's formats natively, but not U16, apparently. */ switch (test_format) { case AUDIO_U8: @@ -1091,32 +1088,32 @@ COREAUDIO_OpenDevice(_THIS, const char *devname) case AUDIO_S32MSB: case AUDIO_F32LSB: case AUDIO_F32MSB: + valid_datatype = 1; + strdesc->mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format); + if (SDL_AUDIO_ISBIGENDIAN(this->spec.format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; + + if (SDL_AUDIO_ISFLOAT(this->spec.format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsFloat; + else if (SDL_AUDIO_ISSIGNED(this->spec.format)) + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; break; default: - continue; + test_format = SDL_NextAudioFormat(); + break; } - break; } - if (!test_format) { /* shouldn't happen, but just in case... */ - return SDL_SetError("%s: Unsupported audio format", "coreaudio"); + if (!valid_datatype) { /* shouldn't happen, but just in case... */ + return SDL_SetError("Unsupported audio format"); } - this->spec.format = test_format; - strdesc->mBitsPerChannel = SDL_AUDIO_BITSIZE(test_format); - if (SDL_AUDIO_ISBIGENDIAN(test_format)) - strdesc->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; - - if (SDL_AUDIO_ISFLOAT(test_format)) - strdesc->mFormatFlags |= kLinearPCMFormatFlagIsFloat; - else if (SDL_AUDIO_ISSIGNED(test_format)) - strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8; strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket; #if MACOSX_COREAUDIO - if (!prepare_device(this)) { + if (!prepare_device(this, handle, iscapture)) { return -1; } #endif @@ -1138,7 +1135,8 @@ COREAUDIO_OpenDevice(_THIS, const char *devname) this->hidden->ready_semaphore = NULL; if ((this->hidden->thread != NULL) && (this->hidden->thread_error != NULL)) { - return SDL_SetError("%s", this->hidden->thread_error); + SDL_SetError("%s", this->hidden->thread_error); + return -1; } return (this->hidden->thread != NULL) ? 0 : -1; @@ -1154,7 +1152,7 @@ COREAUDIO_Deinitialize(void) #endif } -static SDL_bool +static int COREAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -1166,18 +1164,18 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl) impl->DetectDevices = COREAUDIO_DetectDevices; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); #else - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; #endif - impl->ProvidesOwnCallbackThread = SDL_TRUE; - impl->HasCaptureSupport = SDL_TRUE; + impl->ProvidesOwnCallbackThread = 1; + impl->HasCaptureSupport = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap COREAUDIO_bootstrap = { - "coreaudio", "CoreAudio", COREAUDIO_Init, SDL_FALSE + "coreaudio", "CoreAudio", COREAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_COREAUDIO */ diff --git a/externals/SDL/src/audio/directsound/SDL_directsound.c b/externals/SDL/src/audio/directsound/SDL_directsound.c index 0242b139d..b4e8ce252 100755 --- a/externals/SDL/src/audio/directsound/SDL_directsound.c +++ b/externals/SDL/src/audio/directsound/SDL_directsound.c @@ -98,8 +98,10 @@ DSOUND_Load(void) static int SetDSerror(const char *function, int code) { - const char *error; + static const char *error; + static char errbuf[1024]; + errbuf[0] = 0; switch (code) { case E_NOINTERFACE: error = "Unsupported interface -- Is DirectX 8.0 or later installed?"; @@ -135,11 +137,15 @@ SetDSerror(const char *function, int code) error = "Function not supported"; break; default: - error = "Unknown DirectSound error"; + SDL_snprintf(errbuf, SDL_arraysize(errbuf), + "%s: Unknown DirectSound error: 0x%x", function, code); break; } - - return SDL_SetError("%s: %s (0x%x)", function, error, code); + if (!errbuf[0]) { + SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, + error); + } + return SDL_SetError("%s", errbuf); } static void @@ -467,14 +473,14 @@ CreateCaptureBuffer(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt) } static int -DSOUND_OpenDevice(_THIS, const char *devname) +DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { const DWORD numchunks = 8; HRESULT result; + SDL_bool valid_format = SDL_FALSE; SDL_bool tried_format = SDL_FALSE; - SDL_bool iscapture = this->iscapture; - SDL_AudioFormat test_format; - LPGUID guid = (LPGUID) this->handle; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + LPGUID guid = (LPGUID) handle; DWORD bufsize; /* Initialize all variables that we clean on shutdown */ @@ -504,7 +510,7 @@ DSOUND_OpenDevice(_THIS, const char *devname) } } - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + while ((!valid_format) && (test_format)) { switch (test_format) { case AUDIO_U8: case AUDIO_S16: @@ -541,21 +547,19 @@ DSOUND_OpenDevice(_THIS, const char *devname) rc = iscapture ? CreateCaptureBuffer(this, bufsize, &wfmt) : CreateSecondary(this, bufsize, &wfmt); if (rc == 0) { this->hidden->num_buffers = numchunks; - break; + valid_format = SDL_TRUE; } } - continue; - default: - continue; + break; } - break; + test_format = SDL_NextAudioFormat(); } - if (!test_format) { + if (!valid_format) { if (tried_format) { return -1; /* CreateSecondary() should have called SDL_SetError(). */ } - return SDL_SetError("%s: Unsupported audio format", "directsound"); + return SDL_SetError("DirectSound: Unsupported audio format"); } /* Playback buffers will auto-start playing in DSOUND_WaitDevice() */ @@ -571,11 +575,11 @@ DSOUND_Deinitialize(void) } -static SDL_bool +static int DSOUND_Init(SDL_AudioDriverImpl * impl) { if (!DSOUND_Load()) { - return SDL_FALSE; + return 0; } /* Set the function pointers */ @@ -592,11 +596,11 @@ DSOUND_Init(SDL_AudioDriverImpl * impl) impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap DSOUND_bootstrap = { - "directsound", "DirectSound", DSOUND_Init, SDL_FALSE + "directsound", "DirectSound", DSOUND_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_DSOUND */ diff --git a/externals/SDL/src/audio/disk/SDL_diskaudio.c b/externals/SDL/src/audio/disk/SDL_diskaudio.c index f1edf503e..56dfca503 100755 --- a/externals/SDL/src/audio/disk/SDL_diskaudio.c +++ b/externals/SDL/src/audio/disk/SDL_diskaudio.c @@ -114,7 +114,7 @@ DISKAUDIO_CloseDevice(_THIS) static const char * -get_filename(const SDL_bool iscapture, const char *devname) +get_filename(const int iscapture, const char *devname) { if (devname == NULL) { devname = SDL_getenv(iscapture ? DISKENVR_INFILE : DISKENVR_OUTFILE); @@ -126,11 +126,9 @@ get_filename(const SDL_bool iscapture, const char *devname) } static int -DISKAUDIO_OpenDevice(_THIS, const char *devname) +DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - void *handle = _this->handle; /* handle != NULL means "user specified the placeholder name on the fake detected device list" */ - SDL_bool iscapture = _this->iscapture; const char *fname = get_filename(iscapture, handle ? NULL : devname); const char *envr = SDL_getenv(DISKENVR_IODELAY); @@ -179,7 +177,7 @@ DISKAUDIO_DetectDevices(void) SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2); } -static SDL_bool +static int DISKAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -193,14 +191,14 @@ DISKAUDIO_Init(SDL_AudioDriverImpl * impl) impl->CloseDevice = DISKAUDIO_CloseDevice; impl->DetectDevices = DISKAUDIO_DetectDevices; - impl->AllowsArbitraryDeviceNames = SDL_TRUE; + impl->AllowsArbitraryDeviceNames = 1; impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap DISKAUDIO_bootstrap = { - "disk", "direct-to-disk audio", DISKAUDIO_Init, SDL_TRUE + "disk", "direct-to-disk audio", DISKAUDIO_Init, 1 }; #endif /* SDL_AUDIO_DRIVER_DISK */ diff --git a/externals/SDL/src/audio/dsp/SDL_dspaudio.c b/externals/SDL/src/audio/dsp/SDL_dspaudio.c index 531612a29..3c4b6aaf2 100755 --- a/externals/SDL/src/audio/dsp/SDL_dspaudio.c +++ b/externals/SDL/src/audio/dsp/SDL_dspaudio.c @@ -68,9 +68,8 @@ DSP_CloseDevice(_THIS) static int -DSP_OpenDevice(_THIS, const char *devname) +DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - SDL_bool iscapture = this->iscapture; const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); int format; int value; @@ -302,14 +301,13 @@ look_for_devices_test(int fd) return 0; } -static SDL_bool +static int DSP_Init(SDL_AudioDriverImpl * impl) { InitTimeDevicesExist = SDL_FALSE; SDL_EnumUnixAudioDevices(0, look_for_devices_test); if (!InitTimeDevicesExist) { - SDL_SetError("dsp: No such audio device"); - return SDL_FALSE; /* maybe try a different backend. */ + return 0; /* maybe try a different backend. */ } /* Set the function pointers */ @@ -321,15 +319,15 @@ DSP_Init(SDL_AudioDriverImpl * impl) impl->CaptureFromDevice = DSP_CaptureFromDevice; impl->FlushCapture = DSP_FlushCapture; - impl->AllowsArbitraryDeviceNames = SDL_TRUE; + impl->AllowsArbitraryDeviceNames = 1; impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap DSP_bootstrap = { - "dsp", "OSS /dev/dsp standard audio", DSP_Init, SDL_FALSE + "dsp", "OSS /dev/dsp standard audio", DSP_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_OSS */ diff --git a/externals/SDL/src/audio/dummy/SDL_dummyaudio.c b/externals/SDL/src/audio/dummy/SDL_dummyaudio.c index dab1edb59..e8b557a25 100755 --- a/externals/SDL/src/audio/dummy/SDL_dummyaudio.c +++ b/externals/SDL/src/audio/dummy/SDL_dummyaudio.c @@ -28,7 +28,7 @@ #include "SDL_dummyaudio.h" static int -DUMMYAUDIO_OpenDevice(_THIS, const char *devname) +DUMMYAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { _this->hidden = (void *) 0x1; /* just something non-NULL */ return 0; /* always succeeds. */ @@ -45,22 +45,22 @@ DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) return buflen; } -static SDL_bool +static int DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ impl->OpenDevice = DUMMYAUDIO_OpenDevice; impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap DUMMYAUDIO_bootstrap = { - "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE + "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, 1 }; /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/audio/emscripten/SDL_emscriptenaudio.c b/externals/SDL/src/audio/emscripten/SDL_emscriptenaudio.c index bfe42821a..c85d8d0fc 100755 --- a/externals/SDL/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/externals/SDL/src/audio/emscripten/SDL_emscriptenaudio.c @@ -28,16 +28,11 @@ #include -/* !!! FIXME: this currently expects that the audio callback runs in the main thread, - !!! FIXME: in intervals when the application isn't running, but that may not be - !!! FIXME: true always once pthread support becomes widespread. Revisit this code - !!! FIXME: at some point and see what needs to be done for that! */ - static void FeedAudioDevice(_THIS, const void *buf, const int buflen) { const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; - MAIN_THREAD_EM_ASM({ + EM_ASM_ARGS({ var SDL2 = Module['SDL2']; var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; for (var c = 0; c < numChannels; ++c) { @@ -106,7 +101,7 @@ HandleCaptureProcess(_THIS) return; } - MAIN_THREAD_EM_ASM({ + EM_ASM_ARGS({ var SDL2 = Module['SDL2']; var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; for (var c = 0; c < numChannels; ++c) { @@ -152,7 +147,7 @@ HandleCaptureProcess(_THIS) static void EMSCRIPTENAUDIO_CloseDevice(_THIS) { - MAIN_THREAD_EM_ASM({ + EM_ASM_({ var SDL2 = Module['SDL2']; if ($0) { if (SDL2.capture.silenceTimer !== undefined) { @@ -197,16 +192,16 @@ EMSCRIPTENAUDIO_CloseDevice(_THIS) } static int -EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) +EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { + SDL_bool valid_format = SDL_FALSE; SDL_AudioFormat test_format; - SDL_bool iscapture = this->iscapture; int result; /* based on parts of library_sdl.js */ /* create context */ - result = MAIN_THREAD_EM_ASM_INT({ + result = EM_ASM_INT({ if(typeof(Module['SDL2']) === 'undefined') { Module['SDL2'] = {}; } @@ -233,21 +228,22 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) return SDL_SetError("Web Audio API is not available!"); } - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + test_format = SDL_FirstAudioFormat(this->spec.format); + while ((!valid_format) && (test_format)) { switch (test_format) { case AUDIO_F32: /* web audio only supports floats */ + this->spec.format = test_format; + + valid_format = SDL_TRUE; break; - default: - continue; } - break; + test_format = SDL_NextAudioFormat(); } - if (!test_format) { + if (!valid_format) { /* Didn't find a compatible format :( */ - return SDL_SetError("%s: Unsupported audio format", "emscripten"); + return SDL_SetError("No compatible audio format!"); } - this->spec.format = test_format; /* Initialize all variables that we clean on shutdown */ #if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ @@ -285,7 +281,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) feels like it's a pretty inefficient tapdance in similar ways, to be honest. */ - MAIN_THREAD_EM_ASM({ + EM_ASM_({ var SDL2 = Module['SDL2']; var have_microphone = function(stream) { //console.log('SDL audio capture: we have a microphone! Replacing silence callback.'); @@ -328,7 +324,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) }, this->spec.channels, this->spec.samples, HandleCaptureProcess, this); } else { /* setup a ScriptProcessorNode */ - MAIN_THREAD_EM_ASM({ + EM_ASM_ARGS({ var SDL2 = Module['SDL2']; SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { @@ -343,47 +339,43 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) return 0; } -static void -EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device) -{ -} - -static SDL_bool +static int EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) { - SDL_bool available, capture_available; + int available; + int capture_available; /* Set the function pointers */ impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice; impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; /* no threads here */ - impl->LockDevice = impl->UnlockDevice = EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock; - impl->ProvidesOwnCallbackThread = SDL_TRUE; + impl->SkipMixerLock = 1; + impl->ProvidesOwnCallbackThread = 1; /* check availability */ - available = MAIN_THREAD_EM_ASM_INT({ + available = EM_ASM_INT_V({ if (typeof(AudioContext) !== 'undefined') { - return true; + return 1; } else if (typeof(webkitAudioContext) !== 'undefined') { - return true; + return 1; } - return false; + return 0; }); if (!available) { SDL_SetError("No audio context available"); } - capture_available = available && MAIN_THREAD_EM_ASM_INT({ + capture_available = available && EM_ASM_INT_V({ if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) { - return true; + return 1; } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') { - return true; + return 1; } - return false; + return 0; }); impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE; @@ -393,7 +385,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) } AudioBootStrap EMSCRIPTENAUDIO_bootstrap = { - "emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, SDL_FALSE + "emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */ diff --git a/externals/SDL/src/audio/esd/SDL_esdaudio.c b/externals/SDL/src/audio/esd/SDL_esdaudio.c index ccf07916c..b0b794d7b 100755 --- a/externals/SDL/src/audio/esd/SDL_esdaudio.c +++ b/externals/SDL/src/audio/esd/SDL_esdaudio.c @@ -208,7 +208,7 @@ get_progname(void) static int -ESD_OpenDevice(_THIS, const char *devname) +ESD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { esd_format_t format = (ESD_STREAM | ESD_PLAY); SDL_AudioFormat test_format = 0; @@ -293,11 +293,11 @@ ESD_Deinitialize(void) UnloadESDLibrary(); } -static SDL_bool +static int ESD_Init(SDL_AudioDriverImpl * impl) { if (LoadESDLibrary() < 0) { - return SDL_FALSE; + return 0; } else { int connection = 0; @@ -308,7 +308,7 @@ ESD_Init(SDL_AudioDriverImpl * impl) if (connection < 0) { UnloadESDLibrary(); SDL_SetError("ESD: esd_open_sound failed (no audio server?)"); - return SDL_FALSE; + return 0; } SDL_NAME(esd_close) (connection); } @@ -320,14 +320,14 @@ ESD_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = ESD_GetDeviceBuf; impl->CloseDevice = ESD_CloseDevice; impl->Deinitialize = ESD_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap ESD_bootstrap = { - "esd", "Enlightened Sound Daemon", ESD_Init, SDL_FALSE + "esd", "Enlightened Sound Daemon", ESD_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_ESD */ diff --git a/externals/SDL/src/audio/fusionsound/SDL_fsaudio.c b/externals/SDL/src/audio/fusionsound/SDL_fsaudio.c index fbe684de8..5f24cf440 100755 --- a/externals/SDL/src/audio/fusionsound/SDL_fsaudio.c +++ b/externals/SDL/src/audio/fusionsound/SDL_fsaudio.c @@ -174,10 +174,10 @@ SDL_FS_CloseDevice(_THIS) static int -SDL_FS_OpenDevice(_THIS, const char *devname) +SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { int bytes; - SDL_AudioFormat test_format; + SDL_AudioFormat test_format = 0, format = 0; FSSampleFormat fs_format; FSStreamDescription desc; DirectResult ret; @@ -191,34 +191,45 @@ SDL_FS_OpenDevice(_THIS, const char *devname) SDL_zerop(this->hidden); /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); + !format && test_format;) { #ifdef DEBUG_AUDIO fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { case AUDIO_U8: fs_format = FSSF_U8; + bytes = 1; + format = 1; break; case AUDIO_S16SYS: fs_format = FSSF_S16; + bytes = 2; + format = 1; break; case AUDIO_S32SYS: fs_format = FSSF_S32; + bytes = 4; + format = 1; break; case AUDIO_F32SYS: fs_format = FSSF_FLOAT; + bytes = 4; + format = 1; break; default: - continue; + format = 0; + break; + } + if (!format) { + test_format = SDL_NextAudioFormat(); } - break; } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "fusionsound"); + if (format == 0) { + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; - bytes = SDL_AUDIO_BITSIZE(test_format) / 8; /* Retrieve the main sound interface. */ ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs); @@ -277,11 +288,11 @@ SDL_FS_Deinitialize(void) } -static SDL_bool +static int SDL_FS_Init(SDL_AudioDriverImpl * impl) { if (LoadFusionSoundLibrary() < 0) { - return SDL_FALSE; + return 0; } else { DirectResult ret; @@ -291,7 +302,7 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl) SDL_SetError ("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)", ret); - return SDL_FALSE; + return 0; } } @@ -302,14 +313,14 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = SDL_FS_GetDeviceBuf; impl->CloseDevice = SDL_FS_CloseDevice; impl->Deinitialize = SDL_FS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap FUSIONSOUND_bootstrap = { - "fusionsound", "FusionSound", SDL_FS_Init, SDL_FALSE + "fusionsound", "FusionSound", SDL_FS_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */ diff --git a/externals/SDL/src/audio/haiku/SDL_haikuaudio.cc b/externals/SDL/src/audio/haiku/SDL_haikuaudio.cc index aec5f4a25..82da47827 100755 --- a/externals/SDL/src/audio/haiku/SDL_haikuaudio.cc +++ b/externals/SDL/src/audio/haiku/SDL_haikuaudio.cc @@ -49,40 +49,39 @@ FillSound(void *device, void *stream, size_t len, SDL_AudioDevice *audio = (SDL_AudioDevice *) device; SDL_AudioCallback callback = audio->callbackspec.callback; - SDL_LockMutex(audio->mixer_lock); - /* Only do something if audio is enabled */ if (!SDL_AtomicGet(&audio->enabled) || SDL_AtomicGet(&audio->paused)) { if (audio->stream) { SDL_AudioStreamClear(audio->stream); } SDL_memset(stream, audio->spec.silence, len); - } else { - SDL_assert(audio->spec.size == len); - - if (audio->stream == NULL) { /* no conversion necessary. */ - callback(audio->callbackspec.userdata, (Uint8 *) stream, len); - } else { /* streaming/converting */ - const int stream_len = audio->callbackspec.size; - const int ilen = (int) len; - while (SDL_AudioStreamAvailable(audio->stream) < ilen) { - callback(audio->callbackspec.userdata, audio->work_buffer, stream_len); - if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) { - SDL_AudioStreamClear(audio->stream); - SDL_AtomicSet(&audio->enabled, 0); - break; - } - } - - const int got = SDL_AudioStreamGet(audio->stream, stream, ilen); - SDL_assert((got < 0) || (got == ilen)); - if (got != ilen) { - SDL_memset(stream, audio->spec.silence, len); - } - } + return; } - SDL_UnlockMutex(audio->mixer_lock); + SDL_assert(audio->spec.size == len); + + if (audio->stream == NULL) { /* no conversion necessary. */ + SDL_LockMutex(audio->mixer_lock); + callback(audio->callbackspec.userdata, (Uint8 *) stream, len); + SDL_UnlockMutex(audio->mixer_lock); + } else { /* streaming/converting */ + const int stream_len = audio->callbackspec.size; + const int ilen = (int) len; + while (SDL_AudioStreamAvailable(audio->stream) < ilen) { + callback(audio->callbackspec.userdata, audio->work_buffer, stream_len); + if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(audio->stream); + SDL_AtomicSet(&audio->enabled, 0); + break; + } + } + + const int got = SDL_AudioStreamGet(audio->stream, stream, ilen); + SDL_assert((got < 0) || (got == ilen)); + if (got != ilen) { + SDL_memset(stream, audio->spec.silence, len); + } + } } static void @@ -121,10 +120,11 @@ UnmaskSignals(sigset_t * omask) static int -HAIKUAUDIO_OpenDevice(_THIS, const char *devname) +HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { + int valid_datatype = 0; media_raw_audio_format format; - SDL_AudioFormat test_format; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(_this->spec.format); /* Initialize all variables that we clean on shutdown */ _this->hidden = new SDL_PrivateAudioData; @@ -138,7 +138,9 @@ HAIKUAUDIO_OpenDevice(_THIS, const char *devname) format.byte_order = B_MEDIA_LITTLE_ENDIAN; format.frame_rate = (float) _this->spec.freq; format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */ - for (test_format = SDL_FirstAudioFormat(_this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + while ((!valid_datatype) && (test_format)) { + valid_datatype = 1; + _this->spec.format = test_format; switch (test_format) { case AUDIO_S8: format.format = media_raw_audio_format::B_AUDIO_CHAR; @@ -176,15 +178,15 @@ HAIKUAUDIO_OpenDevice(_THIS, const char *devname) break; default: - continue; + valid_datatype = 0; + test_format = SDL_NextAudioFormat(); + break; } - break; } - if (!test_format) { /* shouldn't happen, but just in case... */ - return SDL_SetError("%s: Unsupported audio format", "haiku"); + if (!valid_datatype) { /* shouldn't happen, but just in case... */ + return SDL_SetError("Unsupported audio format"); } - _this->spec.format = test_format; /* Calculate the final parameters for this audio specification */ SDL_CalculateAudioSpec(&_this->spec); @@ -214,22 +216,22 @@ HAIKUAUDIO_Deinitialize(void) SDL_QuitBeApp(); } -static SDL_bool +static int HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Initialize the Be Application, if it's not already started */ if (SDL_InitBeApp() < 0) { - return SDL_FALSE; + return 0; } /* Set the function pointers */ impl->OpenDevice = HAIKUAUDIO_OpenDevice; impl->CloseDevice = HAIKUAUDIO_CloseDevice; impl->Deinitialize = HAIKUAUDIO_Deinitialize; - impl->ProvidesOwnCallbackThread = SDL_TRUE; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->ProvidesOwnCallbackThread = 1; + impl->OnlyHasDefaultOutputDevice = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } extern "C" @@ -237,7 +239,7 @@ extern "C" extern AudioBootStrap HAIKUAUDIO_bootstrap; } AudioBootStrap HAIKUAUDIO_bootstrap = { - "haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, SDL_FALSE + "haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_HAIKU */ diff --git a/externals/SDL/src/audio/jack/SDL_jackaudio.c b/externals/SDL/src/audio/jack/SDL_jackaudio.c index f6e7e0cd3..1c8aa0ba7 100755 --- a/externals/SDL/src/audio/jack/SDL_jackaudio.c +++ b/externals/SDL/src/audio/jack/SDL_jackaudio.c @@ -280,13 +280,12 @@ JACK_CloseDevice(_THIS) } static int -JACK_OpenDevice(_THIS, const char *devname) +JACK_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { /* Note that JACK uses "output" for capture devices (they output audio data to us) and "input" for playback (we input audio data to them). Likewise, SDL's playback port will be "output" (we write data out) and capture will be "input" (we read data in). */ - SDL_bool iscapture = this->iscapture; const unsigned long sysportflags = iscapture ? JackPortIsOutput : JackPortIsInput; const unsigned long sdlportflags = iscapture ? JackPortIsInput : JackPortIsOutput; const JackProcessCallback callback = iscapture ? jackProcessCaptureCallback : jackProcessPlaybackCallback; @@ -406,18 +405,18 @@ JACK_Deinitialize(void) UnloadJackLibrary(); } -static SDL_bool +static int JACK_Init(SDL_AudioDriverImpl * impl) { if (LoadJackLibrary() < 0) { - return SDL_FALSE; + return 0; } else { /* Make sure a JACK server is running and available. */ jack_status_t status; jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); if (client == NULL) { UnloadJackLibrary(); - return SDL_FALSE; + return 0; } JACK_jack_client_close(client); } @@ -434,11 +433,11 @@ JACK_Init(SDL_AudioDriverImpl * impl) impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap JACK_bootstrap = { - "jack", "JACK Audio Connection Kit", JACK_Init, SDL_FALSE + "jack", "JACK Audio Connection Kit", JACK_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_JACK */ diff --git a/externals/SDL/src/audio/nacl/SDL_naclaudio.c b/externals/SDL/src/audio/nacl/SDL_naclaudio.c index c38070d8d..c651cfc6c 100755 --- a/externals/SDL/src/audio/nacl/SDL_naclaudio.c +++ b/externals/SDL/src/audio/nacl/SDL_naclaudio.c @@ -49,8 +49,8 @@ static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta const int len = (int) buffer_size; SDL_AudioDevice* _this = (SDL_AudioDevice*) data; SDL_AudioCallback callback = _this->callbackspec.callback; - - SDL_LockMutex(_this->mixer_lock); + + SDL_LockMutex(private->mutex); /* !!! FIXME: is this mutex necessary? */ /* Only do something if audio is enabled */ if (!SDL_AtomicGet(&_this->enabled) || SDL_AtomicGet(&_this->paused)) { @@ -58,31 +58,34 @@ static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta SDL_AudioStreamClear(_this->stream); } SDL_memset(stream, _this->spec.silence, len); - } else { - SDL_assert(_this->spec.size == len); + return; + } - if (_this->stream == NULL) { /* no conversion necessary. */ - callback(_this->callbackspec.userdata, stream, len); - } else { /* streaming/converting */ - const int stream_len = _this->callbackspec.size; - while (SDL_AudioStreamAvailable(_this->stream) < len) { - callback(_this->callbackspec.userdata, _this->work_buffer, stream_len); - if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) { - SDL_AudioStreamClear(_this->stream); - SDL_AtomicSet(&_this->enabled, 0); - break; - } - } + SDL_assert(_this->spec.size == len); - const int got = SDL_AudioStreamGet(_this->stream, stream, len); - SDL_assert((got < 0) || (got == len)); - if (got != len) { - SDL_memset(stream, _this->spec.silence, len); + if (_this->stream == NULL) { /* no conversion necessary. */ + SDL_LockMutex(_this->mixer_lock); + callback(_this->callbackspec.userdata, stream, len); + SDL_UnlockMutex(_this->mixer_lock); + } else { /* streaming/converting */ + const int stream_len = _this->callbackspec.size; + while (SDL_AudioStreamAvailable(_this->stream) < len) { + callback(_this->callbackspec.userdata, _this->work_buffer, stream_len); + if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(_this->stream); + SDL_AtomicSet(&_this->enabled, 0); + break; } } + + const int got = SDL_AudioStreamGet(_this->stream, stream, len); + SDL_assert((got < 0) || (got == len)); + if (got != len) { + SDL_memset(stream, _this->spec.silence, len); + } } - SDL_UnlockMutex(_this->mixer_lock); + SDL_UnlockMutex(private->mutex); } static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) { @@ -91,11 +94,12 @@ static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) { SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden; ppb_audio->StopPlayback(hidden->audio); + SDL_DestroyMutex(hidden->mutex); core->ReleaseResource(hidden->audio); } static int -NACLAUDIO_OpenDevice(_THIS, const char *devname) { +NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { PP_Instance instance = PSGetInstanceId(); const PPB_Audio *ppb_audio = PSInterfaceAudio(); const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig(); @@ -105,6 +109,7 @@ NACLAUDIO_OpenDevice(_THIS, const char *devname) { return SDL_OutOfMemory(); } + private->mutex = SDL_CreateMutex(); _this->spec.freq = 44100; _this->spec.format = AUDIO_S16LSB; _this->spec.channels = 2; @@ -128,18 +133,18 @@ NACLAUDIO_OpenDevice(_THIS, const char *devname) { return 0; } -static SDL_bool +static int NACLAUDIO_Init(SDL_AudioDriverImpl * impl) { if (PSGetInstanceId() == 0) { - return SDL_FALSE; + return 0; } /* Set the function pointers */ impl->OpenDevice = NACLAUDIO_OpenDevice; impl->CloseDevice = NACLAUDIO_CloseDevice; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->ProvidesOwnCallbackThread = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; + impl->ProvidesOwnCallbackThread = 1; /* * impl->WaitDevice = NACLAUDIO_WaitDevice; * impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf; @@ -147,12 +152,12 @@ NACLAUDIO_Init(SDL_AudioDriverImpl * impl) * impl->Deinitialize = NACLAUDIO_Deinitialize; */ - return SDL_TRUE; + return 1; } AudioBootStrap NACLAUDIO_bootstrap = { NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver", - NACLAUDIO_Init, SDL_FALSE + NACLAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_NACL */ diff --git a/externals/SDL/src/audio/nacl/SDL_naclaudio.h b/externals/SDL/src/audio/nacl/SDL_naclaudio.h index 13d8f8ca4..8348a34e8 100755 --- a/externals/SDL/src/audio/nacl/SDL_naclaudio.h +++ b/externals/SDL/src/audio/nacl/SDL_naclaudio.h @@ -34,7 +34,8 @@ #define private _this->hidden typedef struct SDL_PrivateAudioData { - PP_Resource audio; + SDL_mutex* mutex; + PP_Resource audio; } SDL_PrivateAudioData; #endif /* SDL_naclaudio_h_ */ diff --git a/externals/SDL/src/audio/nas/SDL_nasaudio.c b/externals/SDL/src/audio/nas/SDL_nasaudio.c index d6d863232..87cda5e88 100755 --- a/externals/SDL/src/audio/nas/SDL_nasaudio.c +++ b/externals/SDL/src/audio/nas/SDL_nasaudio.c @@ -237,6 +237,26 @@ NAS_CloseDevice(_THIS) SDL_free(this->hidden); } +static unsigned char +sdlformat_to_auformat(unsigned int fmt) +{ + switch (fmt) { + case AUDIO_U8: + return AuFormatLinearUnsigned8; + case AUDIO_S8: + return AuFormatLinearSigned8; + case AUDIO_U16LSB: + return AuFormatLinearUnsigned16LSB; + case AUDIO_U16MSB: + return AuFormatLinearUnsigned16MSB; + case AUDIO_S16LSB: + return AuFormatLinearSigned16LSB; + case AUDIO_S16MSB: + return AuFormatLinearSigned16MSB; + } + return AuNone; +} + static AuBool event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd) { @@ -311,12 +331,11 @@ find_device(_THIS) } static int -NAS_OpenDevice(_THIS, const char *devname) +NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { AuElement elms[3]; int buffer_size; - SDL_bool iscapture = this->iscapture; - SDL_AudioFormat test_format, format = 0; + SDL_AudioFormat test_format, format; /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -327,33 +346,16 @@ NAS_OpenDevice(_THIS, const char *devname) SDL_zerop(this->hidden); /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - switch (test_format) { - case AUDIO_U8: - format = AuFormatLinearUnsigned8; - break; - case AUDIO_S8: - format = AuFormatLinearSigned8; - break; - case AUDIO_U16LSB: - format = AuFormatLinearUnsigned16LSB; - break; - case AUDIO_U16MSB: - format = AuFormatLinearUnsigned16MSB; - break; - case AUDIO_S16LSB: - format = AuFormatLinearSigned16LSB; - break; - case AUDIO_S16MSB: - format = AuFormatLinearSigned16MSB; - break; - default: - continue; + format = 0; + for (test_format = SDL_FirstAudioFormat(this->spec.format); + !format && test_format;) { + format = sdlformat_to_auformat(test_format); + if (format == AuNone) { + test_format = SDL_NextAudioFormat(); } - break; } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "nas"); + if (format == 0) { + return SDL_SetError("NAS: Couldn't find any hardware audio formats"); } this->spec.format = test_format; @@ -421,16 +423,16 @@ NAS_Deinitialize(void) UnloadNASLibrary(); } -static SDL_bool +static int NAS_Init(SDL_AudioDriverImpl * impl) { if (LoadNASLibrary() < 0) { - return SDL_FALSE; + return 0; } else { AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); if (aud == NULL) { SDL_SetError("NAS: AuOpenServer() failed (no audio server?)"); - return SDL_FALSE; + return 0; } NAS_AuCloseServer(aud); } @@ -445,15 +447,15 @@ NAS_Init(SDL_AudioDriverImpl * impl) impl->CloseDevice = NAS_CloseDevice; impl->Deinitialize = NAS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap NAS_bootstrap = { - "nas", "Network Audio System", NAS_Init, SDL_FALSE + "nas", "Network Audio System", NAS_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_NAS */ diff --git a/externals/SDL/src/audio/netbsd/SDL_netbsdaudio.c b/externals/SDL/src/audio/netbsd/SDL_netbsdaudio.c index 5f021ea37..b061ce7f1 100755 --- a/externals/SDL/src/audio/netbsd/SDL_netbsdaudio.c +++ b/externals/SDL/src/audio/netbsd/SDL_netbsdaudio.c @@ -56,7 +56,7 @@ static void NETBSDAUDIO_Status(_THIS) { #ifdef DEBUG_AUDIO - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ audio_info_t info; const struct audio_prinfo *prinfo; @@ -118,7 +118,7 @@ NETBSDAUDIO_Status(_THIS) "", this->spec.format, this->spec.size); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #endif /* DEBUG_AUDIO */ } @@ -202,11 +202,9 @@ NETBSDAUDIO_CloseDevice(_THIS) } static int -NETBSDAUDIO_OpenDevice(_THIS, const char *devname) +NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - SDL_bool iscapture = this->iscapture; - SDL_AudioFormat test_format; - int encoding = AUDIO_ENCODING_NONE; + SDL_AudioFormat format = 0; audio_info_t info, hwinfo; struct audio_prinfo *prinfo = iscapture ? &info.record : &info.play; @@ -246,46 +244,54 @@ NETBSDAUDIO_OpenDevice(_THIS, const char *devname) } #endif + prinfo->encoding = AUDIO_ENCODING_NONE; prinfo->sample_rate = this->spec.freq; prinfo->channels = this->spec.channels; - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - switch (test_format) { + for (format = SDL_FirstAudioFormat(this->spec.format); format;) { + switch (format) { case AUDIO_U8: - encoding = AUDIO_ENCODING_ULINEAR; + prinfo->encoding = AUDIO_ENCODING_ULINEAR; + prinfo->precision = 8; break; case AUDIO_S8: - encoding = AUDIO_ENCODING_SLINEAR; + prinfo->encoding = AUDIO_ENCODING_SLINEAR; + prinfo->precision = 8; break; case AUDIO_S16LSB: - encoding = AUDIO_ENCODING_SLINEAR_LE; + prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE; + prinfo->precision = 16; break; case AUDIO_S16MSB: - encoding = AUDIO_ENCODING_SLINEAR_BE; + prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE; + prinfo->precision = 16; break; case AUDIO_U16LSB: - encoding = AUDIO_ENCODING_ULINEAR_LE; + prinfo->encoding = AUDIO_ENCODING_ULINEAR_LE; + prinfo->precision = 16; break; case AUDIO_U16MSB: - encoding = AUDIO_ENCODING_ULINEAR_BE; + prinfo->encoding = AUDIO_ENCODING_ULINEAR_BE; + prinfo->precision = 16; break; case AUDIO_S32LSB: - encoding = AUDIO_ENCODING_SLINEAR_LE; + prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE; + prinfo->precision = 32; break; case AUDIO_S32MSB: - encoding = AUDIO_ENCODING_SLINEAR_BE; + prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE; + prinfo->precision = 32; break; - default: - continue; } - break; + if (prinfo->encoding != AUDIO_ENCODING_NONE) { + break; + } + format = SDL_NextAudioFormat(); } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "netbsd"); + if (prinfo->encoding == AUDIO_ENCODING_NONE) { + return SDL_SetError("No supported encoding for 0x%x", this->spec.format); } - prinfo->encoding = encoding; - prinfo->precision = SDL_AUDIO_BITSIZE(test_format); info.hiwat = 5; info.lowat = 3; @@ -298,7 +304,7 @@ NETBSDAUDIO_OpenDevice(_THIS, const char *devname) } /* Final spec used for the device. */ - this->spec.format = test_format; + this->spec.format = format; this->spec.freq = prinfo->sample_rate; this->spec.channels = prinfo->channels; @@ -320,7 +326,7 @@ NETBSDAUDIO_OpenDevice(_THIS, const char *devname) return 0; } -static SDL_bool +static int NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -333,14 +339,14 @@ NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl) impl->FlushCapture = NETBSDAUDIO_FlushCapture; impl->HasCaptureSupport = SDL_TRUE; - impl->AllowsArbitraryDeviceNames = SDL_TRUE; + impl->AllowsArbitraryDeviceNames = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap NETBSDAUDIO_bootstrap = { - "netbsd", "NetBSD audio", NETBSDAUDIO_Init, SDL_FALSE + "netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_NETBSD */ diff --git a/externals/SDL/src/audio/openslES/SDL_openslES.c b/externals/SDL/src/audio/openslES/SDL_openslES.c index 39d64b2b6..ad0209037 100755 --- a/externals/SDL/src/audio/openslES/SDL_openslES.c +++ b/externals/SDL/src/audio/openslES/SDL_openslES.c @@ -407,7 +407,6 @@ openslES_CreatePCMPlayer(_THIS) { struct SDL_PrivateAudioData *audiodata = this->hidden; SLDataFormat_PCM format_pcm; - SLAndroidDataFormat_PCM_EX format_pcm_ex; SLresult result; int i; @@ -415,30 +414,31 @@ openslES_CreatePCMPlayer(_THIS) it can be done as described here: https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point */ - if(SDL_GetAndroidSDKVersion() >= 21) { - SDL_AudioFormat test_format; - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - if (SDL_AUDIO_ISSIGNED(test_format)) { - break; - } +#if 1 + /* Just go with signed 16-bit audio as it's the most compatible */ + this->spec.format = AUDIO_S16SYS; +#else + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + while (test_format != 0) { + if (SDL_AUDIO_ISSIGNED(test_format) && SDL_AUDIO_ISINT(test_format)) { + break; } - - if (!test_format) { - /* Didn't find a compatible format : */ - LOGI( "No compatible audio format, using signed 16-bit audio" ); - test_format = AUDIO_S16SYS; - } - this->spec.format = test_format; - } else { - /* Just go with signed 16-bit audio as it's the most compatible */ - this->spec.format = AUDIO_S16SYS; + test_format = SDL_NextAudioFormat(); } + if (test_format == 0) { + /* Didn't find a compatible format : */ + LOGI( "No compatible audio format, using signed 16-bit audio" ); + test_format = AUDIO_S16SYS; + } + this->spec.format = test_format; +#endif + /* Update the fragment size as size in bytes */ SDL_CalculateAudioSpec(&this->spec); - LOGI("Try to open %u hz %s %u bit chan %u %s samples %u", - this->spec.freq, SDL_AUDIO_ISFLOAT(this->spec.format) ? "float" : "pcm", SDL_AUDIO_BITSIZE(this->spec.format), + LOGI("Try to open %u hz %u bit chan %u %s samples %u", + this->spec.freq, SDL_AUDIO_BITSIZE(this->spec.format), this->spec.channels, (this->spec.format & 0x1000) ? "BE" : "LE", this->spec.samples); /* configure audio source */ @@ -489,19 +489,7 @@ openslES_CreatePCMPlayer(_THIS) break; } - if(SDL_AUDIO_ISFLOAT(this->spec.format)) { - /* Copy all setup into PCM EX structure */ - format_pcm_ex.formatType = SL_ANDROID_DATAFORMAT_PCM_EX; - format_pcm_ex.endianness = format_pcm.endianness; - format_pcm_ex.channelMask = format_pcm.channelMask; - format_pcm_ex.numChannels = format_pcm.numChannels; - format_pcm_ex.sampleRate = format_pcm.samplesPerSec; - format_pcm_ex.bitsPerSample = format_pcm.bitsPerSample; - format_pcm_ex.containerSize = format_pcm.containerSize; - format_pcm_ex.representation = SL_ANDROID_PCM_REPRESENTATION_FLOAT; - } - - SLDataSource audioSrc = { &loc_bufq, SDL_AUDIO_ISFLOAT(this->spec.format) ? (void*)&format_pcm_ex : (void*)&format_pcm }; + SLDataSource audioSrc = { &loc_bufq, &format_pcm }; /* configure audio sink */ SLDataLocator_OutputMix loc_outmix = { SL_DATALOCATOR_OUTPUTMIX, outputMixObject }; @@ -595,14 +583,14 @@ failed: } static int -openslES_OpenDevice(_THIS, const char *devname) +openslES_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *this->hidden)); if (this->hidden == NULL) { return SDL_OutOfMemory(); } - if (this->iscapture) { + if (iscapture) { LOGI("openslES_OpenDevice() %s for capture", devname); return openslES_CreatePCMRecorder(this); } else { @@ -726,13 +714,13 @@ openslES_CloseDevice(_THIS) SDL_free(this->hidden); } -static SDL_bool +static int openslES_Init(SDL_AudioDriverImpl * impl) { LOGI("openslES_Init() called"); if (!openslES_CreateEngine()) { - return SDL_FALSE; + return 0; } LOGI("openslES_Init() - set pointers"); @@ -748,18 +736,18 @@ openslES_Init(SDL_AudioDriverImpl * impl) impl->Deinitialize = openslES_DestroyEngine; /* and the capabilities */ - impl->HasCaptureSupport = SDL_TRUE; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->HasCaptureSupport = 1; + impl->OnlyHasDefaultOutputDevice = 1; + impl->OnlyHasDefaultCaptureDevice = 1; LOGI("openslES_Init() - success"); /* this audio target is available. */ - return SDL_TRUE; + return 1; } AudioBootStrap openslES_bootstrap = { - "openslES", "opensl ES audio driver", openslES_Init, SDL_FALSE + "openslES", "opensl ES audio driver", openslES_Init, 0 }; void openslES_ResumeDevices(void) diff --git a/externals/SDL/src/audio/os2/SDL_os2audio.c b/externals/SDL/src/audio/os2/SDL_os2audio.c index 9ddfb7607..5fa1ad4ed 100755 --- a/externals/SDL/src/audio/os2/SDL_os2audio.c +++ b/externals/SDL/src/audio/os2/SDL_os2audio.c @@ -248,28 +248,29 @@ static void OS2_CloseDevice(_THIS) SDL_free(pAData); } -static int OS2_OpenDevice(_THIS, const char *devname) +static int OS2_OpenDevice(_THIS, void *handle, const char *devname, + int iscapture) { SDL_PrivateAudioData *pAData; - SDL_AudioFormat test_format; + SDL_AudioFormat SDLAudioFmt; MCI_AMP_OPEN_PARMS stMCIAmpOpen; MCI_BUFFER_PARMS stMCIBuffer; ULONG ulRC; ULONG ulIdx; BOOL new_freq; - SDL_bool iscapture = _this->iscapture; new_freq = FALSE; SDL_zero(stMCIAmpOpen); SDL_zero(stMCIBuffer); - for (test_format = SDL_FirstAudioFormat(_this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - if (test_format == AUDIO_U8 || test_format == AUDIO_S16) + for (SDLAudioFmt = SDL_FirstAudioFormat(_this->spec.format); + SDLAudioFmt != 0; SDLAudioFmt = SDL_NextAudioFormat()) { + if (SDLAudioFmt == AUDIO_U8 || SDLAudioFmt == AUDIO_S16) break; } - if (!test_format) { + if (SDLAudioFmt == 0) { debug_os2("Unsupported audio format, AUDIO_S16 used"); - test_format = AUDIO_S16; + SDLAudioFmt = AUDIO_S16; } pAData = (SDL_PrivateAudioData *) SDL_calloc(1, sizeof(struct SDL_PrivateAudioData)); @@ -284,7 +285,7 @@ static int OS2_OpenDevice(_THIS, const char *devname) } /* Open audio device */ - stMCIAmpOpen.usDeviceID = (_this->handle != NULL) ? ((ULONG)_this->handle - 1) : 0; + stMCIAmpOpen.usDeviceID = (handle != NULL) ? ((ULONG)handle - 1) : 0; stMCIAmpOpen.pszDeviceType = (PSZ)MCI_DEVTYPE_AUDIO_AMPMIX; ulRC = mciSendCommand(0, MCI_OPEN, (_getEnvULong("SDL_AUDIO_SHARE", 1, 0) != 0)? @@ -297,7 +298,7 @@ static int OS2_OpenDevice(_THIS, const char *devname) } pAData->usDeviceId = stMCIAmpOpen.usDeviceID; - if (iscapture) { + if (iscapture != 0) { MCI_CONNECTOR_PARMS stMCIConnector; MCI_AMP_SET_PARMS stMCIAmpSet; BOOL fLineIn = _getEnvULong("SDL_AUDIO_LINEIN", 1, 0); @@ -329,7 +330,7 @@ static int OS2_OpenDevice(_THIS, const char *devname) &stMCIAmpSet, 0); } - _this->spec.format = test_format; + _this->spec.format = SDLAudioFmt; _this->spec.channels = _this->spec.channels > 1 ? 2 : 1; if (_this->spec.freq < 8000) { _this->spec.freq = 8000; @@ -341,11 +342,11 @@ static int OS2_OpenDevice(_THIS, const char *devname) /* Setup mixer. */ pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM; - pAData->stMCIMixSetup.ulBitsPerSample = SDL_AUDIO_BITSIZE(test_format); + pAData->stMCIMixSetup.ulBitsPerSample = SDL_AUDIO_BITSIZE(SDLAudioFmt); pAData->stMCIMixSetup.ulSamplesPerSec = _this->spec.freq; pAData->stMCIMixSetup.ulChannels = _this->spec.channels; pAData->stMCIMixSetup.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO; - if (!iscapture) { + if (iscapture == 0) { pAData->stMCIMixSetup.ulFormatMode= MCI_PLAY; pAData->stMCIMixSetup.pmixEvent = cbAudioWriteEvent; } else { @@ -422,7 +423,7 @@ static int OS2_OpenDevice(_THIS, const char *devname) } -static SDL_bool OS2_Init(SDL_AudioDriverImpl * impl) +static int OS2_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ impl->DetectDevices = OS2_DetectDevices; @@ -437,12 +438,12 @@ static SDL_bool OS2_Init(SDL_AudioDriverImpl * impl) impl->FlushCapture = ; impl->HasCaptureSupport = SDL_TRUE; */ - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap OS2AUDIO_bootstrap = { - "DART", "OS/2 DART", OS2_Init, SDL_FALSE + "DART", "OS/2 DART", OS2_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_OS2 */ diff --git a/externals/SDL/src/audio/paudio/SDL_paudio.c b/externals/SDL/src/audio/paudio/SDL_paudio.c index ae2fc2950..c4f40b35d 100755 --- a/externals/SDL/src/audio/paudio/SDL_paudio.c +++ b/externals/SDL/src/audio/paudio/SDL_paudio.c @@ -223,12 +223,12 @@ PAUDIO_CloseDevice(_THIS) } static int -PAUDIO_OpenDevice(_THIS, const char *devname) +PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { const char *workaround = SDL_getenv("SDL_DSP_NOSELECT"); char audiodev[1024]; const char *err = NULL; - int flags; + int format; int bytes_per_sample; SDL_AudioFormat test_format; audio_init paud_init; @@ -316,44 +316,63 @@ PAUDIO_OpenDevice(_THIS, const char *devname) paud_init.channels = this->spec.channels; /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + format = 0; + for (test_format = SDL_FirstAudioFormat(this->spec.format); + !format && test_format;) { #ifdef DEBUG_AUDIO fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { case AUDIO_U8: - flags = TWOS_COMPLEMENT | FIXED; + bytes_per_sample = 1; + paud_init.bits_per_sample = 8; + paud_init.flags = TWOS_COMPLEMENT | FIXED; + format = 1; break; case AUDIO_S8: - flags = SIGNED | TWOS_COMPLEMENT | FIXED; + bytes_per_sample = 1; + paud_init.bits_per_sample = 8; + paud_init.flags = SIGNED | TWOS_COMPLEMENT | FIXED; + format = 1; break; case AUDIO_S16LSB: - flags = SIGNED | TWOS_COMPLEMENT | FIXED; + bytes_per_sample = 2; + paud_init.bits_per_sample = 16; + paud_init.flags = SIGNED | TWOS_COMPLEMENT | FIXED; + format = 1; break; case AUDIO_S16MSB: - flags = BIG_ENDIAN | SIGNED | TWOS_COMPLEMENT | FIXED; + bytes_per_sample = 2; + paud_init.bits_per_sample = 16; + paud_init.flags = BIG_ENDIAN | SIGNED | TWOS_COMPLEMENT | FIXED; + format = 1; break; case AUDIO_U16LSB: - flags = TWOS_COMPLEMENT | FIXED; + bytes_per_sample = 2; + paud_init.bits_per_sample = 16; + paud_init.flags = TWOS_COMPLEMENT | FIXED; + format = 1; break; case AUDIO_U16MSB: - flags = BIG_ENDIAN | TWOS_COMPLEMENT | FIXED; + bytes_per_sample = 2; + paud_init.bits_per_sample = 16; + paud_init.flags = BIG_ENDIAN | TWOS_COMPLEMENT | FIXED; + format = 1; break; default: - continue; + break; + } + if (!format) { + test_format = SDL_NextAudioFormat(); } - break; } - if (!test_format) { + if (format == 0) { #ifdef DEBUG_AUDIO fprintf(stderr, "Couldn't find any hardware audio formats\n"); #endif - return SDL_SetError("%s: Unsupported audio format", "paud"); + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; - paud_init.bits_per_sample = SDL_AUDIO_BITSIZE(test_format); - bytes_per_sample = SDL_AUDIO_BITSIZE(test_format) / 8; - paud_init.flags = flags; /* * We know the buffer size and the max number of subsequent writes @@ -387,25 +406,28 @@ PAUDIO_OpenDevice(_THIS, const char *devname) if (ioctl(fd, AUDIO_INIT, &paud_init) < 0) { switch (paud_init.rc) { case 1: - err = "DSP can't do play requests"; + err = "Couldn't set audio format: DSP can't do play requests"; break; case 2: - err = "DSP can't do record requests"; + err = "Couldn't set audio format: DSP can't do record requests"; break; case 4: - err = "request was invalid"; + err = "Couldn't set audio format: request was invalid"; break; case 5: - err = "conflict with open's flags"; + err = "Couldn't set audio format: conflict with open's flags"; break; case 6: - err = "out of DSP MIPS or memory"; + err = "Couldn't set audio format: out of DSP MIPS or memory"; break; default: - err = "not documented in sys/audio.h"; + err = "Couldn't set audio format: not documented in sys/audio.h"; break; } - return SDL_SetError("paud: Couldn't set audio format (%s)", err); + } + + if (err != NULL) { + return SDL_SetError("Paudio: %s", err); } /* Allocate mixing buffer */ @@ -463,14 +485,14 @@ PAUDIO_OpenDevice(_THIS, const char *devname) return 0; } -static SDL_bool +static int PAUDIO_Init(SDL_AudioDriverImpl * impl) { /* !!! FIXME: not right for device enum? */ int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); if (fd < 0) { SDL_SetError("PAUDIO: Couldn't open audio device"); - return SDL_FALSE; + return 0; } close(fd); @@ -480,13 +502,13 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl) impl->PlayDevice = PAUDIO_WaitDevice; impl->GetDeviceBuf = PAUDIO_GetDeviceBuf; impl->CloseDevice = PAUDIO_CloseDevice; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; /* !!! FIXME: add device enum! */ + impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap PAUDIO_bootstrap = { - "paud", "AIX Paudio", PAUDIO_Init, SDL_FALSE + "paud", "AIX Paudio", PAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_PAUDIO */ diff --git a/externals/SDL/src/audio/pipewire/SDL_pipewire.c b/externals/SDL/src/audio/pipewire/SDL_pipewire.c index 387028edb..32d7d5a5a 100755 --- a/externals/SDL/src/audio/pipewire/SDL_pipewire.c +++ b/externals/SDL/src/audio/pipewire/SDL_pipewire.c @@ -31,22 +31,8 @@ #include #include -/* - * The following keys are defined for compatability when building against older versions of Pipewire - * prior to their introduction and can be removed if the minimum required Pipewire version is increased - * to or beyond their point of introduction. - */ - -/* - * Introduced in 0.3.22 - * Taken from /src/pipewire/keys.h - */ -#ifndef PW_KEY_CONFIG_NAME -#define PW_KEY_CONFIG_NAME "config.name" -#endif - -/* - * Introduced in 0.3.33 +/* Older versions of Pipewire may not define this, but it's safe to pass at + * runtime even if older installations don't recognize it. * Taken from src/pipewire/keys.h */ #ifndef PW_KEY_NODE_RATE @@ -54,22 +40,19 @@ #endif /* - * This seems to be a sane lower limit as Pipewire - * uses it in several of it's own modules. + * These seem to be sane limits as Pipewire + * uses them in several of it's own modules. + * + * NOTE: 8192 is a hard upper limit in Pipewire and + * increasing this value can lead to buffer overflows. */ -#define PW_MIN_SAMPLES 32 /* About 0.67ms at 48kHz */ +#define PW_MIN_SAMPLES 32 /* About 0.67ms at 48kHz */ +#define PW_MAX_SAMPLES 8192 /* About 170.6ms at 48kHz */ #define PW_BASE_CLOCK_RATE 48000 #define PW_POD_BUFFER_LENGTH 1024 #define PW_THREAD_NAME_BUFFER_LENGTH 128 -enum PW_READY_FLAGS -{ - PW_READY_FLAG_BUFFER_ADDED = 0x1, - PW_READY_FLAG_STREAM_READY = 0x2, - PW_READY_FLAG_ALL_BITS = 0x3 -}; - #define PW_ID_TO_HANDLE(x) (void *)((uintptr_t)x) #define PW_HANDLE_TO_ID(x) (uint32_t)((uintptr_t)x) @@ -103,13 +86,14 @@ static enum pw_stream_state (*PIPEWIRE_pw_stream_get_state)(struct pw_stream *st static struct pw_buffer *(*PIPEWIRE_pw_stream_dequeue_buffer)(struct pw_stream *); static int (*PIPEWIRE_pw_stream_queue_buffer)(struct pw_stream *, struct pw_buffer *); static struct pw_properties *(*PIPEWIRE_pw_properties_new)(const char *, ...)SPA_SENTINEL; +static void (*PIPEWIRE_pw_properties_free)(struct pw_properties *); static int (*PIPEWIRE_pw_properties_set)(struct pw_properties *, const char *, const char *); static int (*PIPEWIRE_pw_properties_setf)(struct pw_properties *, const char *, const char *, ...) SPA_PRINTF_FUNC(3, 4); #ifdef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC static const char *pipewire_library = SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC; -static void *pipewire_handle = NULL; +static void * pipewire_handle = NULL; static int pipewire_dlsym(const char *fn, void **addr) @@ -192,6 +176,7 @@ load_pipewire_syms() SDL_PIPEWIRE_SYM(pw_stream_dequeue_buffer); SDL_PIPEWIRE_SYM(pw_stream_queue_buffer); SDL_PIPEWIRE_SYM(pw_properties_new); + SDL_PIPEWIRE_SYM(pw_properties_free); SDL_PIPEWIRE_SYM(pw_properties_set); SDL_PIPEWIRE_SYM(pw_properties_setf); @@ -254,16 +239,16 @@ struct io_node /* The global hotplug thread and associated objects. */ static struct pw_thread_loop *hotplug_loop; -static struct pw_core *hotplug_core; -static struct pw_context *hotplug_context; -static struct pw_registry *hotplug_registry; +static struct pw_core * hotplug_core; +static struct pw_context * hotplug_context; +static struct pw_registry * hotplug_registry; static struct spa_hook hotplug_registry_listener; static struct spa_hook hotplug_core_listener; static struct spa_list hotplug_pending_list; static struct spa_list hotplug_io_list; static int hotplug_init_seq_val; -static SDL_bool hotplug_init_complete; -static SDL_bool hotplug_events_enabled; +static SDL_atomic_t hotplug_init_complete; +static SDL_atomic_t hotplug_events_enabled; static Uint32 pipewire_default_sink_id = SPA_ID_INVALID; static Uint32 pipewire_default_source_id = SPA_ID_INVALID; @@ -275,6 +260,8 @@ io_list_check_add(struct io_node *node) struct io_node *n; SDL_bool ret = SDL_TRUE; + PIPEWIRE_pw_thread_loop_lock(hotplug_loop); + /* See if the node is already in the list */ spa_list_for_each (n, &hotplug_io_list, link) { if (n->id == node->id) { @@ -286,12 +273,14 @@ io_list_check_add(struct io_node *node) /* Add to the list if the node doesn't already exist */ spa_list_append(&hotplug_io_list, &node->link); - if (hotplug_events_enabled) { + if (SDL_AtomicGet(&hotplug_events_enabled)) { SDL_AddAudioDevice(node->is_capture, node->name, &node->spec, PW_ID_TO_HANDLE(node->id)); } dup_found: + PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); + return ret; } @@ -300,12 +289,14 @@ io_list_remove(Uint32 id) { struct io_node *n, *temp; + PIPEWIRE_pw_thread_loop_lock(hotplug_loop); + /* Find and remove the node from the list */ spa_list_for_each_safe (n, temp, &hotplug_io_list, link) { if (n->id == id) { spa_list_remove(&n->link); - if (hotplug_events_enabled) { + if (SDL_AtomicGet(&hotplug_events_enabled)) { SDL_RemoveAudioDevice(n->is_capture, PW_ID_TO_HANDLE(id)); } @@ -314,6 +305,8 @@ io_list_remove(Uint32 id) break; } } + + PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); } static void @@ -322,6 +315,8 @@ io_list_sort() struct io_node *default_sink = NULL, *default_source = NULL; struct io_node *n, *temp; + PIPEWIRE_pw_thread_loop_lock(hotplug_loop); + /* Find and move the default nodes to the beginning of the list */ spa_list_for_each_safe (n, temp, &hotplug_io_list, link) { if (n->id == pipewire_default_sink_id) { @@ -340,6 +335,8 @@ io_list_sort() if (default_sink) { spa_list_prepend(&hotplug_io_list, &default_sink->link); } + + PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); } static void @@ -398,7 +395,7 @@ pending_list_clear() static void * node_object_new(Uint32 id, const char *type, Uint32 version, const void *funcs, const struct pw_core_events *core_events) { - struct pw_proxy *proxy; + struct pw_proxy * proxy; struct node_object *node; /* Create the proxy object */ @@ -433,7 +430,7 @@ core_events_hotplug_init_callback(void *object, uint32_t id, int seq) spa_hook_remove(&hotplug_core_listener); /* Signal that the initial I/O list is populated */ - hotplug_init_complete = SDL_TRUE; + SDL_AtomicSet(&hotplug_init_complete, 1); PIPEWIRE_pw_thread_loop_signal(hotplug_loop, false); } } @@ -442,7 +439,7 @@ static void core_events_interface_callback(void *object, uint32_t id, int seq) { struct node_object *node = object; - struct io_node *io = node->userdata; + struct io_node * io = node->userdata; if (id == PW_ID_CORE && seq == node->seq) { /* @@ -482,7 +479,7 @@ hotplug_core_sync(struct node_object *node) node->seq = pw_core_sync(hotplug_core, PW_ID_CORE, node->seq); } - if (!hotplug_init_complete) { + if (!SDL_AtomicGet(&hotplug_init_complete)) { hotplug_init_seq_val = pw_core_sync(hotplug_core, PW_ID_CORE, hotplug_init_seq_val); } } @@ -492,7 +489,7 @@ static SDL_bool get_range_param(const struct spa_pod *param, Uint32 key, int *def, int *min, int *max) { const struct spa_pod_prop *prop; - struct spa_pod *value; + struct spa_pod * value; Uint32 n_values, choice; prop = spa_pod_find_prop(param, NULL, key); @@ -546,8 +543,8 @@ static void node_event_info(void *object, const struct pw_node_info *info) { struct node_object *node = object; - struct io_node *io = node->userdata; - const char *prop_val; + struct io_node * io = node->userdata; + const char * prop_val; Uint32 i; if (info) { @@ -569,7 +566,7 @@ static void node_event_param(void *object, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param) { struct node_object *node = object; - struct io_node *io = node->userdata; + struct io_node * io = node->userdata; /* Get the default frequency */ if (io->spec.freq == 0) { @@ -622,7 +619,7 @@ registry_event_global_callback(void *object, uint32_t id, uint32_t permissions, const char *media_class = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS); if (media_class) { - const char *node_desc; + const char * node_desc; struct io_node *io; SDL_bool is_capture; int str_buffer_len; @@ -741,30 +738,23 @@ hotplug_loop_destroy() pending_list_clear(); io_list_clear(); - hotplug_init_complete = SDL_FALSE; - hotplug_events_enabled = SDL_FALSE; - - pipewire_default_sink_id = SPA_ID_INVALID; - pipewire_default_source_id = SPA_ID_INVALID; + SDL_AtomicSet(&hotplug_init_complete, 0); + SDL_AtomicSet(&hotplug_events_enabled, 0); if (hotplug_registry) { PIPEWIRE_pw_proxy_destroy((struct pw_proxy *)hotplug_registry); - hotplug_registry = NULL; } if (hotplug_core) { PIPEWIRE_pw_core_disconnect(hotplug_core); - hotplug_core = NULL; } if (hotplug_context) { PIPEWIRE_pw_context_destroy(hotplug_context); - hotplug_context = NULL; } if (hotplug_loop) { PIPEWIRE_pw_thread_loop_destroy(hotplug_loop); - hotplug_loop = NULL; } } @@ -776,7 +766,7 @@ PIPEWIRE_DetectDevices() PIPEWIRE_pw_thread_loop_lock(hotplug_loop); /* Wait until the initial registry enumeration is complete */ - if (!hotplug_init_complete) { + if (!SDL_AtomicGet(&hotplug_init_complete)) { PIPEWIRE_pw_thread_loop_wait(hotplug_loop); } @@ -787,7 +777,7 @@ PIPEWIRE_DetectDevices() SDL_AddAudioDevice(io->is_capture, io->name, &io->spec, PW_ID_TO_HANDLE(io->id)); } - hotplug_events_enabled = SDL_TRUE; + SDL_AtomicSet(&hotplug_events_enabled, 1); PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); } @@ -800,14 +790,14 @@ static const enum spa_audio_channel PIPEWIRE_channel_map_4[] = { SPA_AUDIO_CHANN SPA_AUDIO_CHANNEL_RR }; static const enum spa_audio_channel PIPEWIRE_channel_map_5[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR }; -static const enum spa_audio_channel PIPEWIRE_channel_map_6[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, +static const enum spa_audio_channel PIPEWIRE_channel_map_6[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR }; -static const enum spa_audio_channel PIPEWIRE_channel_map_7[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, +static const enum spa_audio_channel PIPEWIRE_channel_map_7[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, SPA_AUDIO_CHANNEL_RC, SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR }; -static const enum spa_audio_channel PIPEWIRE_channel_map_8[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, +static const enum spa_audio_channel PIPEWIRE_channel_map_8[] = { SPA_AUDIO_CHANNEL_FL, SPA_AUDIO_CHANNEL_FR, SPA_AUDIO_CHANNEL_FC, SPA_AUDIO_CHANNEL_LFE, SPA_AUDIO_CHANNEL_RL, SPA_AUDIO_CHANNEL_RR, - SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR }; + SPA_AUDIO_CHANNEL_SL, SPA_AUDIO_CHANNEL_SR }; #define COPY_CHANNEL_MAP(c) SDL_memcpy(info->position, PIPEWIRE_channel_map_##c, sizeof(PIPEWIRE_channel_map_##c)) @@ -882,9 +872,9 @@ initialize_spa_info(const SDL_AudioSpec *spec, struct spa_audio_info_raw *info) static void output_callback(void *data) { - struct pw_buffer *pw_buf; + struct pw_buffer * pw_buf; struct spa_buffer *spa_buf; - Uint8 *dst; + Uint8 * dst; _THIS = (SDL_AudioDevice *)data; struct pw_stream *stream = this->hidden->stream; @@ -910,7 +900,6 @@ output_callback(void *data) * and run the callback with the work buffer to keep the callback * firing regularly in case the audio is being used as a timer. */ - SDL_LockMutex(this->mixer_lock); if (!SDL_AtomicGet(&this->paused)) { if (SDL_AtomicGet(&this->enabled)) { dst = spa_buf->datas[0].data; @@ -920,13 +909,18 @@ output_callback(void *data) } if (!this->stream) { + SDL_LockMutex(this->mixer_lock); this->callbackspec.callback(this->callbackspec.userdata, dst, this->callbackspec.size); + SDL_UnlockMutex(this->mixer_lock); } else { int got; /* Fire the callback until we have enough to fill a buffer */ while (SDL_AudioStreamAvailable(this->stream) < this->spec.size) { + SDL_LockMutex(this->mixer_lock); this->callbackspec.callback(this->callbackspec.userdata, this->work_buffer, this->callbackspec.size); + SDL_UnlockMutex(this->mixer_lock); + SDL_AudioStreamPut(this->stream, this->work_buffer, this->callbackspec.size); } @@ -936,7 +930,6 @@ output_callback(void *data) } else { SDL_memset(spa_buf->datas[0].data, this->spec.silence, this->spec.size); } - SDL_UnlockMutex(this->mixer_lock); spa_buf->datas[0].chunk->offset = 0; spa_buf->datas[0].chunk->stride = this->hidden->stride; @@ -948,9 +941,9 @@ output_callback(void *data) static void input_callback(void *data) { - struct pw_buffer *pw_buf; + struct pw_buffer * pw_buf; struct spa_buffer *spa_buf; - Uint8 *src; + Uint8 * src; _THIS = (SDL_AudioDevice *)data; struct pw_stream *stream = this->hidden->stream; @@ -992,71 +985,35 @@ input_callback(void *data) this->callbackspec.callback(this->callbackspec.userdata, this->work_buffer, this->callbackspec.size); SDL_UnlockMutex(this->mixer_lock); } - } else if (this->hidden->buffer) { /* Flush the buffer when paused */ + } else { /* Flush the buffer when paused */ if (SDL_CountDataQueue(this->hidden->buffer) != 0) { - SDL_ClearDataQueue(this->hidden->buffer, this->hidden->input_buffer_packet_size); + SDL_ClearDataQueue(this->hidden->buffer, this->hidden->buffer_period_size * 2); } } PIPEWIRE_pw_stream_queue_buffer(stream, pw_buf); } -static void -stream_add_buffer_callback(void *data, struct pw_buffer *buffer) -{ - _THIS = data; - - if (this->iscapture == SDL_FALSE) { - /* - * Clamp the output spec samples and size to the max size of the Pipewire buffer. - * If they exceed the maximum size of the Pipewire buffer, double buffering will be used. - */ - if (this->spec.size > buffer->buffer->datas[0].maxsize) { - this->spec.samples = buffer->buffer->datas[0].maxsize / this->hidden->stride; - this->spec.size = buffer->buffer->datas[0].maxsize; - } - } else if (this->hidden->buffer == NULL) { - /* - * The latency of source nodes can change, so buffering is always required. - * - * Ensure that the intermediate input buffer is large enough to hold the requested - * application packet size or a full buffer of data from Pipewire, whichever is larger. - * - * A packet size of 2 periods should be more than is ever needed. - */ - this->hidden->input_buffer_packet_size = SPA_MAX(this->spec.size, buffer->buffer->datas[0].maxsize) * 2; - this->hidden->buffer = SDL_NewDataQueue(this->hidden->input_buffer_packet_size, this->hidden->input_buffer_packet_size); - } - - this->hidden->stream_init_status |= PW_READY_FLAG_BUFFER_ADDED; - PIPEWIRE_pw_thread_loop_signal(this->hidden->loop, false); -} - static void stream_state_changed_callback(void *data, enum pw_stream_state old, enum pw_stream_state state, const char *error) { _THIS = data; - if (state == PW_STREAM_STATE_STREAMING) { - this->hidden->stream_init_status |= PW_READY_FLAG_STREAM_READY; - } - if (state == PW_STREAM_STATE_STREAMING || state == PW_STREAM_STATE_ERROR) { + SDL_AtomicSet(&this->hidden->stream_initialized, 1); PIPEWIRE_pw_thread_loop_signal(this->hidden->loop, false); } } static const struct pw_stream_events stream_output_events = { PW_VERSION_STREAM_EVENTS, .state_changed = stream_state_changed_callback, - .add_buffer = stream_add_buffer_callback, .process = output_callback }; static const struct pw_stream_events stream_input_events = { PW_VERSION_STREAM_EVENTS, - .state_changed = stream_state_changed_callback, - .add_buffer = stream_add_buffer_callback, - .process = input_callback }; + .state_changed = stream_state_changed_callback, + .process = input_callback }; static int -PIPEWIRE_OpenDevice(_THIS, const char *devname) +PIPEWIRE_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { /* * NOTE: The PW_STREAM_FLAG_RT_PROCESS flag can be set to call the stream @@ -1071,22 +1028,23 @@ PIPEWIRE_OpenDevice(_THIS, const char *devname) Uint8 pod_buffer[PW_POD_BUFFER_LENGTH]; struct spa_pod_builder b = SPA_POD_BUILDER_INIT(pod_buffer, sizeof(pod_buffer)); struct spa_audio_info_raw spa_info = { 0 }; - const struct spa_pod *params = NULL; + const struct spa_pod * params = NULL; struct SDL_PrivateAudioData *priv; - struct pw_properties *props; - const char *app_name, *stream_name, *stream_role, *error; - const Uint32 node_id = this->handle == NULL ? PW_ID_ANY : PW_HANDLE_TO_ID(this->handle); - SDL_bool iscapture = this->iscapture; + struct pw_properties * props; + const char * app_name, *stream_name, *stream_role, *error; + const Uint32 node_id = this->handle == NULL ? PW_ID_ANY : PW_HANDLE_TO_ID(this->handle); + enum pw_stream_state state; int res; /* Clamp the period size to sane values */ - const int min_period = PW_MIN_SAMPLES * SPA_MAX(this->spec.freq / PW_BASE_CLOCK_RATE, 1); + const int min_period = PW_MIN_SAMPLES * SPA_MAX(this->spec.freq / PW_BASE_CLOCK_RATE, 1); + const int adjusted_samples = SPA_CLAMP(this->spec.samples, min_period, PW_MAX_SAMPLES); /* Get the hints for the application name, stream name and role */ app_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME); if (!app_name || *app_name == '\0') { app_name = SDL_GetHint(SDL_HINT_APP_NAME); - if (!app_name || *app_name == '\0') { + if (!app_name || *app_name == '\0') { app_name = "SDL Application"; } } @@ -1119,34 +1077,38 @@ PIPEWIRE_OpenDevice(_THIS, const char *devname) /* Size of a single audio frame in bytes */ priv->stride = (SDL_AUDIO_BITSIZE(this->spec.format) >> 3) * this->spec.channels; - if (this->spec.samples < min_period) { - this->spec.samples = min_period; + if (this->spec.samples != adjusted_samples && !iscapture) { + this->spec.samples = adjusted_samples; this->spec.size = this->spec.samples * priv->stride; } - SDL_snprintf(thread_name, sizeof(thread_name), "SDLAudio%c%ld", (iscapture) ? 'C' : 'P', (long)this->handle); + /* The latency of source nodes can change, so buffering is required. */ + if (iscapture) { + priv->buffer_period_size = SPA_MAX(this->spec.samples, adjusted_samples) * priv->stride; + + /* A packet size of 4 periods should be more than is ever needed (no more than 2 should be queued in practice). */ + priv->buffer = SDL_NewDataQueue(priv->buffer_period_size * 4, priv->buffer_period_size * 2); + if (priv->buffer == NULL) { + return SDL_SetError("Pipewire: Failed to allocate source buffer"); + } + } + + SDL_snprintf(thread_name, sizeof(thread_name), "SDLAudio%c%ld", (iscapture) ? 'C' : 'P', (long)handle); priv->loop = PIPEWIRE_pw_thread_loop_new(thread_name, NULL); if (priv->loop == NULL) { return SDL_SetError("Pipewire: Failed to create stream loop (%i)", errno); } - /* - * Load the realtime module so Pipewire can set the loop thread to the appropriate priority. - * - * NOTE: Pipewire versions 0.3.22 or higher require the PW_KEY_CONFIG_NAME property (with client-rt.conf), - * lower versions require explicitly specifying the 'rtkit' module. - * - * PW_KEY_CONTEXT_PROFILE_MODULES is deprecated and can be safely removed if the minimum required - * Pipewire version is increased to 0.3.22 or higher at some point. - */ - props = PIPEWIRE_pw_properties_new(PW_KEY_CONFIG_NAME, "client-rt.conf", - PW_KEY_CONTEXT_PROFILE_MODULES, "default,rtkit", NULL); + /* Load the rtkit module so Pipewire can set the loop thread to the appropriate priority */ + props = PIPEWIRE_pw_properties_new(PW_KEY_CONTEXT_PROFILE_MODULES, "default,rtkit", NULL); if (props == NULL) { return SDL_SetError("Pipewire: Failed to create stream context properties (%i)", errno); } + /* On success, the context owns the properties object and will free it at destruction time. */ priv->context = PIPEWIRE_pw_context_new(PIPEWIRE_pw_thread_loop_get_loop(priv->loop), props, 0); if (priv->context == NULL) { + PIPEWIRE_pw_properties_free(props); return SDL_SetError("Pipewire: Failed to create stream context (%i)", errno); } @@ -1161,14 +1123,18 @@ PIPEWIRE_OpenDevice(_THIS, const char *devname) PIPEWIRE_pw_properties_set(props, PW_KEY_APP_NAME, app_name); PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_NAME, stream_name); PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_DESCRIPTION, stream_name); - PIPEWIRE_pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%i", this->spec.samples, this->spec.freq); + PIPEWIRE_pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%i", adjusted_samples, this->spec.freq); PIPEWIRE_pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%u", this->spec.freq); PIPEWIRE_pw_properties_set(props, PW_KEY_NODE_ALWAYS_PROCESS, "true"); - /* Create the new stream */ + /* + * Create the new stream + * On success, the stream owns the properties object and will free it at destruction time. + */ priv->stream = PIPEWIRE_pw_stream_new_simple(PIPEWIRE_pw_thread_loop_get_loop(priv->loop), stream_name, props, iscapture ? &stream_input_events : &stream_output_events, this); if (priv->stream == NULL) { + PIPEWIRE_pw_properties_free(props); return SDL_SetError("Pipewire: Failed to create stream (%i)", errno); } @@ -1183,21 +1149,17 @@ PIPEWIRE_OpenDevice(_THIS, const char *devname) return SDL_SetError("Pipewire: Failed to start stream loop"); } - /* Wait until all init flags are set or the stream has failed. */ + /* Wait until the stream is either running or failed */ PIPEWIRE_pw_thread_loop_lock(priv->loop); - while (priv->stream_init_status != PW_READY_FLAG_ALL_BITS && - PIPEWIRE_pw_stream_get_state(priv->stream, NULL) != PW_STREAM_STATE_ERROR) { + if (!SDL_AtomicGet(&priv->stream_initialized)) { PIPEWIRE_pw_thread_loop_wait(priv->loop); } PIPEWIRE_pw_thread_loop_unlock(priv->loop); - if (PIPEWIRE_pw_stream_get_state(priv->stream, &error) == PW_STREAM_STATE_ERROR) { - return SDL_SetError("Pipewire: Stream error: %s", error); - } + state = PIPEWIRE_pw_stream_get_state(priv->stream, &error); - /* If this is a capture stream, make sure the intermediate buffer was successfully allocated. */ - if (iscapture && priv->buffer == NULL) { - return SDL_SetError("Pipewire: Failed to allocate source buffer"); + if (state == PW_STREAM_STATE_ERROR) { + return SDL_SetError("Pipewire: Stream error: %s", error); } return 0; @@ -1238,19 +1200,19 @@ PIPEWIRE_Deinitialize() } } -static SDL_bool +static int PIPEWIRE_Init(SDL_AudioDriverImpl *impl) { if (!pipewire_initialized) { if (init_pipewire_library() < 0) { - return SDL_FALSE; + return 0; } pipewire_initialized = SDL_TRUE; if (hotplug_loop_init() < 0) { PIPEWIRE_Deinitialize(); - return SDL_FALSE; + return 0; } } @@ -1260,13 +1222,13 @@ PIPEWIRE_Init(SDL_AudioDriverImpl *impl) impl->CloseDevice = PIPEWIRE_CloseDevice; impl->Deinitialize = PIPEWIRE_Deinitialize; - impl->HasCaptureSupport = SDL_TRUE; - impl->ProvidesOwnCallbackThread = SDL_TRUE; + impl->HasCaptureSupport = 1; + impl->ProvidesOwnCallbackThread = 1; - return SDL_TRUE; + return 1; } -AudioBootStrap PIPEWIRE_bootstrap = { "pipewire", "Pipewire", PIPEWIRE_Init, SDL_FALSE }; +AudioBootStrap PIPEWIRE_bootstrap = { "pipewire", "Pipewire", PIPEWIRE_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_PIPEWIRE */ diff --git a/externals/SDL/src/audio/pipewire/SDL_pipewire.h b/externals/SDL/src/audio/pipewire/SDL_pipewire.h index 767b8f10c..731a2027f 100755 --- a/externals/SDL/src/audio/pipewire/SDL_pipewire.h +++ b/externals/SDL/src/audio/pipewire/SDL_pipewire.h @@ -37,9 +37,9 @@ struct SDL_PrivateAudioData struct pw_context *context; struct SDL_DataQueue *buffer; - size_t input_buffer_packet_size; - Sint32 stride; /* Bytes-per-frame */ - int stream_init_status; + size_t buffer_period_size; + Sint32 stride; /* Bytes-per-frame */ + SDL_atomic_t stream_initialized; }; #endif /* SDL_pipewire_h_ */ diff --git a/externals/SDL/src/audio/psp/SDL_pspaudio.c b/externals/SDL/src/audio/psp/SDL_pspaudio.c index d908170c6..1966cafdf 100755 --- a/externals/SDL/src/audio/psp/SDL_pspaudio.c +++ b/externals/SDL/src/audio/psp/SDL_pspaudio.c @@ -42,7 +42,7 @@ #define PSPAUDIO_DRIVER_NAME "psp" static int -PSPAUDIO_OpenDevice(_THIS, const char *devname) +PSPAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { int format, mixlen, i; @@ -158,7 +158,7 @@ static void PSPAUDIO_ThreadInit(_THIS) } } -static SDL_bool +static int PSPAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -170,16 +170,16 @@ PSPAUDIO_Init(SDL_AudioDriverImpl * impl) impl->ThreadInit = PSPAUDIO_ThreadInit; /* PSP audio device */ - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultOutputDevice = 1; /* - impl->HasCaptureSupport = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->HasCaptureSupport = 1; + impl->OnlyHasDefaultCaptureDevice = 1; */ - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap PSPAUDIO_bootstrap = { - "psp", "PSP audio driver", PSPAUDIO_Init, SDL_FALSE + "psp", "PSP audio driver", PSPAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_PSP */ diff --git a/externals/SDL/src/audio/pulseaudio/SDL_pulseaudio.c b/externals/SDL/src/audio/pulseaudio/SDL_pulseaudio.c index 85e1386c2..bf16839b5 100755 --- a/externals/SDL/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/externals/SDL/src/audio/pulseaudio/SDL_pulseaudio.c @@ -107,6 +107,8 @@ static int (*PULSEAUDIO_pa_stream_connect_record) (pa_stream *, const char *, static pa_stream_state_t (*PULSEAUDIO_pa_stream_get_state) (const pa_stream *); static size_t (*PULSEAUDIO_pa_stream_writable_size) (const pa_stream *); static size_t (*PULSEAUDIO_pa_stream_readable_size) (const pa_stream *); +static int (*PULSEAUDIO_pa_stream_begin_write) (pa_stream *, void **, size_t*); +static int (*PULSEAUDIO_pa_stream_cancel_write) (pa_stream *); static int (*PULSEAUDIO_pa_stream_write) (pa_stream *, const void *, size_t, pa_free_cb_t, int64_t, pa_seek_mode_t); static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *, @@ -117,7 +119,6 @@ static pa_operation * (*PULSEAUDIO_pa_stream_flush) (pa_stream *, pa_stream_success_cb_t, void *); static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *); static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *); -static void (*PULSEAUDIO_pa_stream_set_write_callback)(pa_stream *, pa_stream_request_cb_t, void *); static int load_pulseaudio_syms(void); @@ -221,6 +222,8 @@ load_pulseaudio_syms(void) SDL_PULSEAUDIO_SYM(pa_stream_writable_size); SDL_PULSEAUDIO_SYM(pa_stream_readable_size); SDL_PULSEAUDIO_SYM(pa_stream_write); + SDL_PULSEAUDIO_SYM(pa_stream_begin_write); + SDL_PULSEAUDIO_SYM(pa_stream_cancel_write); SDL_PULSEAUDIO_SYM(pa_stream_drain); SDL_PULSEAUDIO_SYM(pa_stream_disconnect); SDL_PULSEAUDIO_SYM(pa_stream_peek); @@ -229,7 +232,6 @@ load_pulseaudio_syms(void) SDL_PULSEAUDIO_SYM(pa_stream_unref); SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto); SDL_PULSEAUDIO_SYM(pa_strerror); - SDL_PULSEAUDIO_SYM(pa_stream_set_write_callback); return 0; } @@ -356,57 +358,52 @@ ConnectToPulseServer(pa_mainloop **_mainloop, pa_context **_context) /* This function waits until it is possible to write a full sound buffer */ static void PULSEAUDIO_WaitDevice(_THIS) -{ - /* this is a no-op; we wait in PULSEAUDIO_PlayDevice now. */ -} - -static void WriteCallback(pa_stream *p, size_t nbytes, void *userdata) -{ - struct SDL_PrivateAudioData *h = (struct SDL_PrivateAudioData *) userdata; - /*printf("PULSEAUDIO WRITE CALLBACK! nbytes=%u\n", (unsigned int) nbytes);*/ - h->bytes_requested += nbytes; -} - -static void -PULSEAUDIO_PlayDevice(_THIS) { struct SDL_PrivateAudioData *h = this->hidden; - int available = h->mixlen; - int written = 0; - int cpy; - /*printf("PULSEAUDIO PLAYDEVICE START! mixlen=%d\n", available);*/ - - while (SDL_AtomicGet(&this->enabled) && (available > 0)) { - cpy = SDL_min(h->bytes_requested, available); - if (cpy) { - if (PULSEAUDIO_pa_stream_write(h->stream, h->mixbuf + written, cpy, NULL, 0LL, PA_SEEK_RELATIVE) < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - return; - } - /*printf("PULSEAUDIO FEED! nbytes=%u\n", (unsigned int) cpy);*/ - h->bytes_requested -= cpy; - written += cpy; - available -= cpy; - } - - /* let WriteCallback fire if necessary. */ - /*printf("PULSEAUDIO ITERATE!\n");*/ + while (SDL_AtomicGet(&this->enabled)) { if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { SDL_OpenedAudioDeviceDisconnected(this); return; } + if (PULSEAUDIO_pa_stream_writable_size(h->stream) >= (h->mixlen/8)) { + return; + } } +} - /*printf("PULSEAUDIO PLAYDEVICE END! written=%d\n", written);*/ +static void +PULSEAUDIO_PlayDevice(_THIS) +{ + /* Write the audio data */ + struct SDL_PrivateAudioData *h = this->hidden; + if (SDL_AtomicGet(&this->enabled)) { + if (PULSEAUDIO_pa_stream_write(h->stream, h->pabuf, h->mixlen, NULL, 0LL, PA_SEEK_RELATIVE) < 0) { + SDL_OpenedAudioDeviceDisconnected(this); + } + } } static Uint8 * PULSEAUDIO_GetDeviceBuf(_THIS) { - return this->hidden->mixbuf; + struct SDL_PrivateAudioData *h = this->hidden; + size_t nbytes = h->mixlen; + int ret; + + ret = PULSEAUDIO_pa_stream_begin_write(h->stream, &h->pabuf, &nbytes); + + if (ret != 0) { + /* fall back it intermediate buffer */ + h->pabuf = h->mixbuf; + } else if (nbytes < h->mixlen) { + PULSEAUDIO_pa_stream_cancel_write(h->stream); + h->pabuf = h->mixbuf; + } + + return (Uint8 *)h->pabuf; } @@ -525,7 +522,7 @@ SourceDeviceNameCallback(pa_context *c, const pa_source_info *i, int is_last, vo } static SDL_bool -FindDeviceName(struct SDL_PrivateAudioData *h, const SDL_bool iscapture, void *handle) +FindDeviceName(struct SDL_PrivateAudioData *h, const int iscapture, void *handle) { const uint32_t idx = ((uint32_t) ((size_t) handle)) - 1; @@ -547,17 +544,16 @@ FindDeviceName(struct SDL_PrivateAudioData *h, const SDL_bool iscapture, void *h } static int -PULSEAUDIO_OpenDevice(_THIS, const char *devname) +PULSEAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { struct SDL_PrivateAudioData *h = NULL; - SDL_AudioFormat test_format; + Uint16 test_format = 0; pa_sample_spec paspec; pa_buffer_attr paattr; pa_channel_map pacmap; pa_stream_flags_t flags = 0; const char *name = NULL; - SDL_bool iscapture = this->iscapture; - int state = 0, format = PA_SAMPLE_INVALID; + int state = 0; int rc = 0; /* Initialize all variables that we clean on shutdown */ @@ -568,45 +564,53 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname) } SDL_zerop(this->hidden); + paspec.format = PA_SAMPLE_INVALID; + /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + for (test_format = SDL_FirstAudioFormat(this->spec.format); + (paspec.format == PA_SAMPLE_INVALID) && test_format;) { #ifdef DEBUG_AUDIO fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { case AUDIO_U8: - format = PA_SAMPLE_U8; + paspec.format = PA_SAMPLE_U8; break; case AUDIO_S16LSB: - format = PA_SAMPLE_S16LE; + paspec.format = PA_SAMPLE_S16LE; break; case AUDIO_S16MSB: - format = PA_SAMPLE_S16BE; + paspec.format = PA_SAMPLE_S16BE; break; case AUDIO_S32LSB: - format = PA_SAMPLE_S32LE; + paspec.format = PA_SAMPLE_S32LE; break; case AUDIO_S32MSB: - format = PA_SAMPLE_S32BE; + paspec.format = PA_SAMPLE_S32BE; break; case AUDIO_F32LSB: - format = PA_SAMPLE_FLOAT32LE; + paspec.format = PA_SAMPLE_FLOAT32LE; break; case AUDIO_F32MSB: - format = PA_SAMPLE_FLOAT32BE; + paspec.format = PA_SAMPLE_FLOAT32BE; break; default: - continue; + paspec.format = PA_SAMPLE_INVALID; + break; + } + if (paspec.format == PA_SAMPLE_INVALID) { + test_format = SDL_NextAudioFormat(); } - break; } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "pulseaudio"); + if (paspec.format == PA_SAMPLE_INVALID) { + return SDL_SetError("Couldn't find any hardware audio formats"); } this->spec.format = test_format; - paspec.format = format; /* Calculate the final parameters for this audio specification */ +#ifdef PA_STREAM_ADJUST_LATENCY + this->spec.samples /= 2; /* Mix in smaller chunck to avoid underruns */ +#endif SDL_CalculateAudioSpec(&this->spec); /* Allocate mixing buffer */ @@ -623,18 +627,28 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname) paspec.rate = this->spec.freq; /* Reduced prebuffering compared to the defaults. */ +#ifdef PA_STREAM_ADJUST_LATENCY paattr.fragsize = this->spec.size; - paattr.tlength = h->mixlen; + /* 2x original requested bufsize */ + paattr.tlength = h->mixlen * 4; paattr.prebuf = -1; paattr.maxlength = -1; - paattr.minreq = -1; - flags |= PA_STREAM_ADJUST_LATENCY; + /* -1 can lead to pa_stream_writable_size() >= mixlen never being true */ + paattr.minreq = h->mixlen; + flags = PA_STREAM_ADJUST_LATENCY; +#else + paattr.fragsize = this->spec.size; + paattr.tlength = h->mixlen*2; + paattr.prebuf = h->mixlen*2; + paattr.maxlength = h->mixlen*2; + paattr.minreq = h->mixlen; +#endif if (ConnectToPulseServer(&h->mainloop, &h->context) < 0) { return SDL_SetError("Could not connect to PulseAudio server"); } - if (!FindDeviceName(h, iscapture, this->handle)) { + if (!FindDeviceName(h, iscapture, handle)) { return SDL_SetError("Requested PulseAudio sink/source missing?"); } @@ -665,7 +679,6 @@ PULSEAUDIO_OpenDevice(_THIS, const char *devname) if (iscapture) { rc = PULSEAUDIO_pa_stream_connect_record(h->stream, h->device_name, &paattr, flags); } else { - PULSEAUDIO_pa_stream_set_write_callback(h->stream, WriteCallback, h); rc = PULSEAUDIO_pa_stream_connect_playback(h->stream, h->device_name, &paattr, flags, NULL, NULL); } @@ -819,16 +832,16 @@ PULSEAUDIO_Deinitialize(void) UnloadPulseAudioLibrary(); } -static SDL_bool +static int PULSEAUDIO_Init(SDL_AudioDriverImpl * impl) { if (LoadPulseAudioLibrary() < 0) { - return SDL_FALSE; + return 0; } if (ConnectToPulseServer(&hotplug_mainloop, &hotplug_context) < 0) { UnloadPulseAudioLibrary(); - return SDL_FALSE; + return 0; } include_monitors = SDL_GetHintBoolean(SDL_HINT_AUDIO_INCLUDE_MONITORS, SDL_FALSE); @@ -846,11 +859,11 @@ PULSEAUDIO_Init(SDL_AudioDriverImpl * impl) impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap PULSEAUDIO_bootstrap = { - "pulseaudio", "PulseAudio", PULSEAUDIO_Init, SDL_FALSE + "pulseaudio", "PulseAudio", PULSEAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_PULSEAUDIO */ diff --git a/externals/SDL/src/audio/pulseaudio/SDL_pulseaudio.h b/externals/SDL/src/audio/pulseaudio/SDL_pulseaudio.h index 7ef45fe25..a0d0b0c98 100755 --- a/externals/SDL/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/externals/SDL/src/audio/pulseaudio/SDL_pulseaudio.h @@ -43,7 +43,11 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; int mixlen; - int bytes_requested; /* bytes of data the hardware wants _now_. */ + /* Pointer to the actual buffer in use in the current + GetDeviceBuf() -> PlayDevice() iteration. + Can be either the pointer returned by pa_stream_begin_write() + or mixbuf */ + void *pabuf; const Uint8 *capturebuf; int capturelen; diff --git a/externals/SDL/src/audio/qsa/SDL_qsa_audio.c b/externals/SDL/src/audio/qsa/SDL_qsa_audio.c index 5c4ab38ba..ca1539fdd 100755 --- a/externals/SDL/src/audio/qsa/SDL_qsa_audio.c +++ b/externals/SDL/src/audio/qsa/SDL_qsa_audio.c @@ -121,7 +121,7 @@ QSA_WaitDevice(_THIS) /* For example, Vortex 8820 audio driver stucks on second DAC because */ /* it doesn't exist ! */ result = SDL_IOReady(this->hidden->audio_fd, - this->iscapture ? SDL_IOR_READ : SDL_IOR_WRITE, + this->hidden->iscapture ? SDL_IOR_READ : SDL_IOR_WRITE, 2 * 1000); switch (result) { case -1: @@ -180,7 +180,7 @@ QSA_PlayDevice(_THIS) } else { if ((errno == EINVAL) || (errno == EIO)) { SDL_zero(cstatus); - if (!this->iscapture) { + if (!this->hidden->iscapture) { cstatus.channel = SND_PCM_CHANNEL_PLAYBACK; } else { cstatus.channel = SND_PCM_CHANNEL_CAPTURE; @@ -196,7 +196,7 @@ QSA_PlayDevice(_THIS) if ((cstatus.status == SND_PCM_STATUS_UNDERRUN) || (cstatus.status == SND_PCM_STATUS_READY)) { - if (!this->iscapture) { + if (!this->hidden->iscapture) { status = snd_pcm_plugin_prepare(this->hidden-> audio_handle, @@ -240,7 +240,7 @@ static void QSA_CloseDevice(_THIS) { if (this->hidden->audio_handle != NULL) { - if (!this->iscapture) { + if (!this->hidden->iscapture) { /* Finish playing available samples */ snd_pcm_plugin_flush(this->hidden->audio_handle, SND_PCM_CHANNEL_PLAYBACK); @@ -257,13 +257,13 @@ QSA_CloseDevice(_THIS) } static int -QSA_OpenDevice(_THIS, const char *devname) +QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - const QSA_Device *device = (const QSA_Device *) this->handle; - SDL_Bool iscapture = this->iscapture; + const QSA_Device *device = (const QSA_Device *) handle; int status = 0; int format = 0; - SDL_AudioFormat test_format; + SDL_AudioFormat test_format = 0; + int found = 0; snd_pcm_channel_setup_t csetup; snd_pcm_channel_params_t cparams; @@ -280,6 +280,9 @@ QSA_OpenDevice(_THIS, const char *devname) /* Initialize channel transfer parameters to default */ QSA_InitAudioParams(&cparams); + /* Initialize channel direction: capture or playback */ + this->hidden->iscapture = iscapture ? SDL_TRUE : SDL_FALSE; + if (device != NULL) { /* Open requested audio device */ this->hidden->deviceno = device->deviceno; @@ -302,49 +305,89 @@ QSA_OpenDevice(_THIS, const char *devname) } /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + format = 0; + /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */ + found = 0; + + for (test_format = SDL_FirstAudioFormat(this->spec.format); !found;) { /* if match found set format to equivalent QSA format */ switch (test_format) { case AUDIO_U8: - format = SND_PCM_SFMT_U8; + { + format = SND_PCM_SFMT_U8; + found = 1; + } break; case AUDIO_S8: - format = SND_PCM_SFMT_S8; + { + format = SND_PCM_SFMT_S8; + found = 1; + } break; case AUDIO_S16LSB: - format = SND_PCM_SFMT_S16_LE; + { + format = SND_PCM_SFMT_S16_LE; + found = 1; + } break; case AUDIO_S16MSB: - format = SND_PCM_SFMT_S16_BE; + { + format = SND_PCM_SFMT_S16_BE; + found = 1; + } break; case AUDIO_U16LSB: - format = SND_PCM_SFMT_U16_LE; + { + format = SND_PCM_SFMT_U16_LE; + found = 1; + } break; case AUDIO_U16MSB: - format = SND_PCM_SFMT_U16_BE; + { + format = SND_PCM_SFMT_U16_BE; + found = 1; + } break; case AUDIO_S32LSB: - format = SND_PCM_SFMT_S32_LE; + { + format = SND_PCM_SFMT_S32_LE; + found = 1; + } break; case AUDIO_S32MSB: - format = SND_PCM_SFMT_S32_BE; + { + format = SND_PCM_SFMT_S32_BE; + found = 1; + } break; case AUDIO_F32LSB: - format = SND_PCM_SFMT_FLOAT_LE; + { + format = SND_PCM_SFMT_FLOAT_LE; + found = 1; + } break; case AUDIO_F32MSB: - format = SND_PCM_SFMT_FLOAT_BE; + { + format = SND_PCM_SFMT_FLOAT_BE; + found = 1; + } break; default: - continue; + { + break; + } + } + + if (!found) { + test_format = SDL_NextAudioFormat(); } - break; } + /* assumes test_format not 0 on success */ - /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */ - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "qsa"); + if (test_format == 0) { + return SDL_SetError("QSA: Couldn't find any hardware audio formats"); } + this->spec.format = test_format; /* Set the audio format */ @@ -364,7 +407,7 @@ QSA_OpenDevice(_THIS, const char *devname) /* Make sure channel is setup right one last time */ SDL_zero(csetup); - if (!this->iscapture) { + if (!this->hidden->iscapture) { csetup.channel = SND_PCM_CHANNEL_PLAYBACK; } else { csetup.channel = SND_PCM_CHANNEL_CAPTURE; @@ -400,7 +443,7 @@ QSA_OpenDevice(_THIS, const char *devname) this->hidden->pcm_len); /* get the file descriptor */ - if (!this->iscapture) { + if (!this->hidden->iscapture) { this->hidden->audio_fd = snd_pcm_file_descriptor(this->hidden->audio_handle, SND_PCM_CHANNEL_PLAYBACK); @@ -415,7 +458,7 @@ QSA_OpenDevice(_THIS, const char *devname) } /* Prepare an audio channel */ - if (!this->iscapture) { + if (!this->hidden->iscapture) { /* Prepare audio playback */ status = snd_pcm_plugin_prepare(this->hidden->audio_handle, @@ -592,7 +635,7 @@ QSA_Deinitialize(void) qsa_capture_devices = 0; } -static SDL_bool +static int QSA_Init(SDL_AudioDriverImpl * impl) { /* Clear devices array */ @@ -612,14 +655,20 @@ QSA_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = QSA_GetDeviceBuf; impl->CloseDevice = QSA_CloseDevice; impl->Deinitialize = QSA_Deinitialize; + impl->LockDevice = NULL; + impl->UnlockDevice = NULL; - impl->HasCaptureSupport = SDL_TRUE; + impl->ProvidesOwnCallbackThread = 0; + impl->SkipMixerLock = 0; + impl->HasCaptureSupport = 1; + impl->OnlyHasDefaultOutputDevice = 0; + impl->OnlyHasDefaultCaptureDevice = 0; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap QSAAUDIO_bootstrap = { - "qsa", "QNX QSA Audio", QSA_Init, SDL_FALSE + "qsa", "QNX QSA Audio", QSA_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_QSA */ diff --git a/externals/SDL/src/audio/qsa/SDL_qsa_audio.h b/externals/SDL/src/audio/qsa/SDL_qsa_audio.h index e4845c9eb..7f5e9d3a4 100755 --- a/externals/SDL/src/audio/qsa/SDL_qsa_audio.h +++ b/externals/SDL/src/audio/qsa/SDL_qsa_audio.h @@ -33,6 +33,9 @@ struct SDL_PrivateAudioData { + /* SDL capture state */ + SDL_bool iscapture; + /* The audio device handle */ int cardno; int deviceno; diff --git a/externals/SDL/src/audio/sndio/SDL_sndioaudio.c b/externals/SDL/src/audio/sndio/SDL_sndioaudio.c index 29e5315b9..aa2f83acc 100755 --- a/externals/SDL/src/audio/sndio/SDL_sndioaudio.c +++ b/externals/SDL/src/audio/sndio/SDL_sndioaudio.c @@ -237,11 +237,11 @@ SNDIO_CloseDevice(_THIS) } static int -SNDIO_OpenDevice(_THIS, const char *devname) +SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - SDL_AudioFormat test_format; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); struct sio_par par; - SDL_bool iscapture = this->iscapture; + int status; this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); @@ -273,7 +273,8 @@ SNDIO_OpenDevice(_THIS, const char *devname) par.appbufsz = par.round * 2; /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + status = -1; + while (test_format && (status < 0)) { if (!SDL_AUDIO_ISFLOAT(test_format)) { par.le = SDL_AUDIO_ISLITTLEENDIAN(test_format) ? 1 : 0; par.sig = SDL_AUDIO_ISSIGNED(test_format) ? 1 : 0; @@ -289,13 +290,15 @@ SNDIO_OpenDevice(_THIS, const char *devname) continue; } if ((par.bits == 8 * par.bps) || (par.msb)) { + status = 0; break; } } + test_format = SDL_NextAudioFormat(); } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "sndio"); + if (status < 0) { + return SDL_SetError("sndio: Couldn't find any hardware audio formats"); } if ((par.bps == 4) && (par.sig) && (par.le)) @@ -354,11 +357,11 @@ SNDIO_DetectDevices(void) SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2); } -static SDL_bool +static int SNDIO_Init(SDL_AudioDriverImpl * impl) { if (LoadSNDIOLibrary() < 0) { - return SDL_FALSE; + return 0; } /* Set the function pointers */ @@ -372,14 +375,14 @@ SNDIO_Init(SDL_AudioDriverImpl * impl) impl->Deinitialize = SNDIO_Deinitialize; impl->DetectDevices = SNDIO_DetectDevices; - impl->AllowsArbitraryDeviceNames = SDL_TRUE; + impl->AllowsArbitraryDeviceNames = 1; impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap SNDIO_bootstrap = { - "sndio", "OpenBSD sndio", SNDIO_Init, SDL_FALSE + "sndio", "OpenBSD sndio", SNDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_SNDIO */ diff --git a/externals/SDL/src/audio/sun/SDL_sunaudio.c b/externals/SDL/src/audio/sun/SDL_sunaudio.c index 595692423..a78ec7412 100755 --- a/externals/SDL/src/audio/sun/SDL_sunaudio.c +++ b/externals/SDL/src/audio/sun/SDL_sunaudio.c @@ -188,12 +188,11 @@ SUNAUDIO_CloseDevice(_THIS) } static int -SUNAUDIO_OpenDevice(_THIS, const char *devname) +SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { #ifdef AUDIO_SETINFO int enc; #endif - SDL_bool iscapture = this->iscapture; int desired_freq = 0; const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); SDL_AudioFormat format = 0; @@ -395,7 +394,7 @@ snd2au(int sample) return (mask & sample); } -static SDL_bool +static int SUNAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -406,13 +405,13 @@ SUNAUDIO_Init(SDL_AudioDriverImpl * impl) impl->GetDeviceBuf = SUNAUDIO_GetDeviceBuf; impl->CloseDevice = SUNAUDIO_CloseDevice; - impl->AllowsArbitraryDeviceNames = SDL_TRUE; + impl->AllowsArbitraryDeviceNames = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap SUNAUDIO_bootstrap = { - "audio", "UNIX /dev/audio interface", SUNAUDIO_Init, SDL_FALSE + "audio", "UNIX /dev/audio interface", SUNAUDIO_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_SUNAUDIO */ diff --git a/externals/SDL/src/audio/vita/SDL_vitaaudio.c b/externals/SDL/src/audio/vita/SDL_vitaaudio.c index 88f4a3285..5433594bf 100755 --- a/externals/SDL/src/audio/vita/SDL_vitaaudio.c +++ b/externals/SDL/src/audio/vita/SDL_vitaaudio.c @@ -37,35 +37,18 @@ #include #include -#include #define SCE_AUDIO_SAMPLE_ALIGN(s) (((s) + 63) & ~63) #define SCE_AUDIO_MAX_VOLUME 0x8000 -static int -VITAAUD_OpenCaptureDevice(_THIS) -{ - this->spec.freq = 16000; - this->spec.samples = 512; - this->spec.channels = 1; - - SDL_CalculateAudioSpec(&this->spec); - - this->hidden->port = sceAudioInOpenPort(SCE_AUDIO_IN_PORT_TYPE_VOICE , 512, 16000, SCE_AUDIO_IN_PARAM_FORMAT_S16_MONO); - - if (this->hidden->port < 0) { - return SDL_SetError("Couldn't open audio in port: %x", this->hidden->port); - } - - return 0; -} +/* The tag name used by VITA audio */ +#define VITAAUD_DRIVER_NAME "vita" static int -VITAAUD_OpenDevice(_THIS, const char *devname) +VITAAUD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { int format, mixlen, i, port = SCE_AUDIO_OUT_PORT_TYPE_MAIN; int vols[2] = {SCE_AUDIO_MAX_VOLUME, SCE_AUDIO_MAX_VOLUME}; - SDL_AudioFormat test_format; this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); @@ -73,20 +56,13 @@ VITAAUD_OpenDevice(_THIS, const char *devname) return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, sizeof(*this->hidden)); - - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - if (test_format == AUDIO_S16LSB) { - this->spec.format = test_format; + switch (this->spec.format & 0xff) { + case 8: + case 16: + this->spec.format = AUDIO_S16LSB; break; - } - } - - if(!test_format) { - return SDL_SetError("Unsupported audio format"); - } - - if (this->iscapture) { - return VITAAUD_OpenCaptureDevice(this); + default: + return SDL_SetError("Unsupported audio format"); } /* The sample count must be a multiple of 64. */ @@ -115,14 +91,14 @@ VITAAUD_OpenDevice(_THIS, const char *devname) port = SCE_AUDIO_OUT_PORT_TYPE_BGM; } - this->hidden->port = sceAudioOutOpenPort(port, this->spec.samples, this->spec.freq, format); - if (this->hidden->port < 0) { + this->hidden->channel = sceAudioOutOpenPort(port, this->spec.samples, this->spec.freq, format); + if (this->hidden->channel < 0) { free(this->hidden->rawbuf); this->hidden->rawbuf = NULL; - return SDL_SetError("Couldn't open audio out port: %x", this->hidden->port); + return SDL_SetError("Couldn't reserve hardware channel"); } - sceAudioOutSetVolume(this->hidden->port, SCE_AUDIO_VOLUME_FLAG_L_CH|SCE_AUDIO_VOLUME_FLAG_R_CH, vols); + sceAudioOutSetVolume(this->hidden->channel, SCE_AUDIO_VOLUME_FLAG_L_CH|SCE_AUDIO_VOLUME_FLAG_R_CH, vols); SDL_memset(this->hidden->rawbuf, 0, mixlen); for (i = 0; i < NUM_BUFFERS; i++) { @@ -137,7 +113,7 @@ static void VITAAUD_PlayDevice(_THIS) { Uint8 *mixbuf = this->hidden->mixbufs[this->hidden->next_buffer]; - sceAudioOutOutput(this->hidden->port, mixbuf); + sceAudioOutOutput(this->hidden->channel, mixbuf); this->hidden->next_buffer = (this->hidden->next_buffer + 1) % NUM_BUFFERS; } @@ -147,7 +123,6 @@ static void VITAAUD_WaitDevice(_THIS) { /* Because we block when sending audio, there's no need for this function to do anything. */ } - static Uint8 *VITAAUD_GetDeviceBuf(_THIS) { return this->hidden->mixbufs[this->hidden->next_buffer]; @@ -155,32 +130,17 @@ static Uint8 *VITAAUD_GetDeviceBuf(_THIS) static void VITAAUD_CloseDevice(_THIS) { - if (this->hidden->port >= 0) { - if (this->iscapture) { - sceAudioInReleasePort(this->hidden->port); - } else { - sceAudioOutReleasePort(this->hidden->port); - } - this->hidden->port = -1; + if (this->hidden->channel >= 0) { + sceAudioOutReleasePort(this->hidden->channel); + this->hidden->channel = -1; } - if (!this->iscapture && this->hidden->rawbuf != NULL) { + if (this->hidden->rawbuf != NULL) { free(this->hidden->rawbuf); /* this uses memalign(), not SDL_malloc(). */ this->hidden->rawbuf = NULL; } } -static int VITAAUD_CaptureFromDevice(_THIS, void *buffer, int buflen) -{ - int ret; - SDL_assert(buflen == this->spec.size); - ret = sceAudioInInput(this->hidden->port, buffer); - if (ret < 0) { - return SDL_SetError("Failed to capture from device: %x", ret); - } - return this->spec.size; -} - static void VITAAUD_ThreadInit(_THIS) { /* Increase the priority of this audio thread by 1 to put it @@ -194,7 +154,7 @@ static void VITAAUD_ThreadInit(_THIS) } } -static SDL_bool +static int VITAAUD_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -205,18 +165,17 @@ VITAAUD_Init(SDL_AudioDriverImpl * impl) impl->CloseDevice = VITAAUD_CloseDevice; impl->ThreadInit = VITAAUD_ThreadInit; - impl->CaptureFromDevice = VITAAUD_CaptureFromDevice; - - /* and the capabilities */ - impl->HasCaptureSupport = SDL_TRUE; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ + /* VITA audio device */ + impl->OnlyHasDefaultOutputDevice = 1; + /* + impl->HasCaptureSupport = 1; + impl->OnlyHasDefaultInputDevice = 1; + */ + return 1; /* this audio target is available. */ } AudioBootStrap VITAAUD_bootstrap = { - "vita", "VITA audio driver", VITAAUD_Init, SDL_FALSE + "vita", "VITA audio driver", VITAAUD_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_VITA */ diff --git a/externals/SDL/src/audio/vita/SDL_vitaaudio.h b/externals/SDL/src/audio/vita/SDL_vitaaudio.h index a5601b28c..73870759b 100755 --- a/externals/SDL/src/audio/vita/SDL_vitaaudio.h +++ b/externals/SDL/src/audio/vita/SDL_vitaaudio.h @@ -30,8 +30,8 @@ #define NUM_BUFFERS 2 struct SDL_PrivateAudioData { - /* The hardware input/output port. */ - int port; + /* The hardware output channel. */ + int channel; /* The raw allocated mixing buffer. */ Uint8 *rawbuf; /* Individual mixing buffers. */ diff --git a/externals/SDL/src/audio/wasapi/SDL_wasapi.c b/externals/SDL/src/audio/wasapi/SDL_wasapi.c index 862ed9f5e..8f287cdb8 100755 --- a/externals/SDL/src/audio/wasapi/SDL_wasapi.c +++ b/externals/SDL/src/audio/wasapi/SDL_wasapi.c @@ -209,7 +209,7 @@ UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec) } if (!this->stream) { - return -1; /* SDL_NewAudioStream should have called SDL_SetError. */ + return -1; } } @@ -512,8 +512,9 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) IAudioRenderClient *render = NULL; IAudioCaptureClient *capture = NULL; WAVEFORMATEX *waveformat = NULL; - SDL_AudioFormat test_format; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); SDL_AudioFormat wasapi_format = 0; + SDL_bool valid_format = SDL_FALSE; HRESULT ret = S_OK; DWORD streamflags = 0; @@ -542,15 +543,17 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) /* Make sure we have a valid format that we can convert to whatever WASAPI wants. */ wasapi_format = WaveFormatToSDLFormat(waveformat); - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + while ((!valid_format) && (test_format)) { if (test_format == wasapi_format) { this->spec.format = test_format; + valid_format = SDL_TRUE; break; } + test_format = SDL_NextAudioFormat(); } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "wasapi"); + if (!valid_format) { + return SDL_SetError("WASAPI: Unsupported audio format"); } ret = IAudioClient_GetDevicePeriod(client, &default_period, NULL); @@ -558,16 +561,12 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret); } -#if 1 /* we're getting reports that WASAPI's resampler introduces distortions, so it's disabled for now. --ryan. */ - this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in, if necessary. */ -#else /* favor WASAPI's resampler over our own */ if (this->spec.freq != waveformat->nSamplesPerSec) { streamflags |= (AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY); waveformat->nSamplesPerSec = this->spec.freq; waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8); } -#endif streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK; ret = IAudioClient_Initialize(client, sharemode, streamflags, 0, 0, waveformat, NULL); @@ -632,7 +631,9 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) } if (updatestream) { - return UpdateAudioStream(this, &oldspec); + if (UpdateAudioStream(this, &oldspec) == -1) { + return -1; + } } return 0; /* good to go. */ @@ -640,9 +641,9 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) static int -WASAPI_OpenDevice(_THIS, const char *devname) +WASAPI_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - LPCWSTR devid = (LPCWSTR) this->handle; + LPCWSTR devid = (LPCWSTR) handle; /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -655,7 +656,7 @@ WASAPI_OpenDevice(_THIS, const char *devname) WASAPI_RefDevice(this); /* so CloseDevice() will unref to zero. */ if (!devid) { /* is default device? */ - this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + this->hidden->default_device_generation = SDL_AtomicGet(iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); } else { this->hidden->devid = SDL_wcsdup(devid); if (!this->hidden->devid) { @@ -690,6 +691,12 @@ WASAPI_ThreadDeinit(_THIS) WASAPI_PlatformThreadDeinit(this); } +void +WASAPI_BeginLoopIteration(_THIS) +{ + /* no-op. */ +} + static void WASAPI_Deinitialize(void) { @@ -706,20 +713,21 @@ WASAPI_Deinitialize(void) deviceid_list = NULL; } -static SDL_bool +static int WASAPI_Init(SDL_AudioDriverImpl * impl) { SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1); SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1); if (WASAPI_PlatformInit() == -1) { - return SDL_FALSE; + return 0; } /* Set the function pointers */ impl->DetectDevices = WASAPI_DetectDevices; impl->ThreadInit = WASAPI_ThreadInit; impl->ThreadDeinit = WASAPI_ThreadDeinit; + impl->BeginLoopIteration = WASAPI_BeginLoopIteration; impl->OpenDevice = WASAPI_OpenDevice; impl->PlayDevice = WASAPI_PlayDevice; impl->WaitDevice = WASAPI_WaitDevice; @@ -728,13 +736,13 @@ WASAPI_Init(SDL_AudioDriverImpl * impl) impl->FlushCapture = WASAPI_FlushCapture; impl->CloseDevice = WASAPI_CloseDevice; impl->Deinitialize = WASAPI_Deinitialize; - impl->HasCaptureSupport = SDL_TRUE; + impl->HasCaptureSupport = 1; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap WASAPI_bootstrap = { - "wasapi", "WASAPI", WASAPI_Init, SDL_FALSE + "wasapi", "WASAPI", WASAPI_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_WASAPI */ diff --git a/externals/SDL/src/audio/wasapi/SDL_wasapi.h b/externals/SDL/src/audio/wasapi/SDL_wasapi.h index af79637b7..7fd02b45f 100755 --- a/externals/SDL/src/audio/wasapi/SDL_wasapi.h +++ b/externals/SDL/src/audio/wasapi/SDL_wasapi.h @@ -74,6 +74,7 @@ int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery); void WASAPI_PlatformThreadInit(_THIS); void WASAPI_PlatformThreadDeinit(_THIS); void WASAPI_PlatformDeleteActivationHandler(void *handler); +void WASAPI_BeginLoopIteration(_THIS); #ifdef __cplusplus } diff --git a/externals/SDL/src/audio/wasapi/SDL_wasapi_win32.c b/externals/SDL/src/audio/wasapi/SDL_wasapi_win32.c index 137f37013..8e5c7e2a1 100755 --- a/externals/SDL/src/audio/wasapi/SDL_wasapi_win32.c +++ b/externals/SDL/src/audio/wasapi/SDL_wasapi_win32.c @@ -362,7 +362,7 @@ typedef struct WAVEFORMATEXTENSIBLE fmt; } EndpointItem; -static int SDLCALL sort_endpoints(const void *_a, const void *_b) +static int sort_endpoints(const void *_a, const void *_b) { LPWSTR a = ((const EndpointItem *) _a)->devid; LPWSTR b = ((const EndpointItem *) _b)->devid; diff --git a/externals/SDL/src/audio/winmm/SDL_winmm.c b/externals/SDL/src/audio/winmm/SDL_winmm.c index 444d21576..e79d6eeb7 100755 --- a/externals/SDL/src/audio/winmm/SDL_winmm.c +++ b/externals/SDL/src/audio/winmm/SDL_winmm.c @@ -283,11 +283,10 @@ PrepWaveFormat(_THIS, UINT devId, WAVEFORMATEX *pfmt, const int iscapture) } static int -WINMM_OpenDevice(_THIS, const char *devname) +WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { - SDL_AudioFormat test_format; - SDL_bool iscapture = this->iscapture; - void *handle = this->handle; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + int valid_datatype = 0; MMRESULT result; WAVEFORMATEX waveformat; UINT devId = WAVE_MAPPER; /* WAVE_MAPPER == choose system's default */ @@ -314,7 +313,7 @@ WINMM_OpenDevice(_THIS, const char *devname) if (this->spec.channels > 2) this->spec.channels = 2; /* !!! FIXME: is this right? */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { + while ((!valid_datatype) && (test_format)) { switch (test_format) { case AUDIO_U8: case AUDIO_S16: @@ -322,17 +321,20 @@ WINMM_OpenDevice(_THIS, const char *devname) case AUDIO_F32: this->spec.format = test_format; if (PrepWaveFormat(this, devId, &waveformat, iscapture)) { - break; + valid_datatype = 1; + } else { + test_format = SDL_NextAudioFormat(); } - continue; + break; + default: - continue; + test_format = SDL_NextAudioFormat(); + break; } - break; } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "winmm"); + if (!valid_datatype) { + return SDL_SetError("Unsupported audio format"); } /* Update the fragment size as size in bytes */ @@ -432,7 +434,7 @@ WINMM_OpenDevice(_THIS, const char *devname) return 0; /* Ready to go! */ } -static SDL_bool +static int WINMM_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ @@ -447,11 +449,11 @@ WINMM_Init(SDL_AudioDriverImpl * impl) impl->HasCaptureSupport = SDL_TRUE; - return SDL_TRUE; /* this audio target is available. */ + return 1; /* this audio target is available. */ } AudioBootStrap WINMM_bootstrap = { - "winmm", "Windows Waveform Audio", WINMM_Init, SDL_FALSE + "winmm", "Windows Waveform Audio", WINMM_Init, 0 }; #endif /* SDL_AUDIO_DRIVER_WINMM */ diff --git a/externals/SDL/src/core/android/SDL_android.c b/externals/SDL/src/core/android/SDL_android.c index 3c4112a0e..4236835cf 100755 --- a/externals/SDL/src/core/android/SDL_android.c +++ b/externals/SDL/src/core/android/SDL_android.c @@ -511,9 +511,8 @@ register_methods(JNIEnv *env, const char *classname, JNINativeMethod *methods, i /* Library init */ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { - JNIEnv *env = NULL; - mJavaVM = vm; + JNIEnv *env = NULL; if ((*mJavaVM)->GetEnv(mJavaVM, (void **)&env, JNI_VERSION_1_4) != JNI_OK) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to get JNI Env"); @@ -1010,7 +1009,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j { SDL_LockMutex(Android_ActivityMutex); -#if SDL_VIDEO_OPENGL_EGL if (Android_Window) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -1023,7 +1021,6 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j /* GL Context handling is done in the event loop because this function is run from the Java thread */ } -#endif SDL_UnlockMutex(Android_ActivityMutex); } @@ -1054,12 +1051,10 @@ retry: } } -#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } -#endif if (data->native_window) { ANativeWindow_release(data->native_window); @@ -2131,15 +2126,6 @@ void Android_JNI_HapticStop(int device_id) /* See SDLActivity.java for constants. */ #define COMMAND_SET_KEEP_SCREEN_ON 5 - -int SDL_AndroidSendMessage(Uint32 command, int param) -{ - if (command >= 0x8000) { - return Android_JNI_SendMessage(command, param); - } - return -1; -} - /* sends message to be handled on the UI event dispatch thread */ int Android_JNI_SendMessage(int command, int param) { @@ -2554,7 +2540,6 @@ SDL_bool Android_JNI_SetRelativeMouseEnabled(SDL_bool enabled) SDL_bool Android_JNI_RequestPermission(const char *permission) { JNIEnv *env = Android_JNI_GetEnv(); - jstring jpermission; const int requestCode = 1; /* Wait for any pending request on another thread */ @@ -2563,7 +2548,7 @@ SDL_bool Android_JNI_RequestPermission(const char *permission) } SDL_AtomicSet(&bPermissionRequestPending, SDL_TRUE); - jpermission = (*env)->NewStringUTF(env, permission); + jstring jpermission = (*env)->NewStringUTF(env, permission); (*env)->CallStaticVoidMethod(env, mActivityClass, midRequestPermission, jpermission, requestCode); (*env)->DeleteLocalRef(env, jpermission); diff --git a/externals/SDL/src/core/linux/SDL_dbus.c b/externals/SDL/src/core/linux/SDL_dbus.c index ecfbe6f4e..2fe12163e 100755 --- a/externals/SDL/src/core/linux/SDL_dbus.c +++ b/externals/SDL/src/core/linux/SDL_dbus.c @@ -22,7 +22,6 @@ #include "SDL_hints.h" #include "SDL_dbus.h" #include "SDL_atomic.h" -#include "../../stdlib/SDL_vacopy.h" #if SDL_USE_LIBDBUS /* we never link directly to libdbus. */ diff --git a/externals/SDL/src/core/linux/SDL_fcitx.c b/externals/SDL/src/core/linux/SDL_fcitx.c index b7a0cfacf..3f0794736 100755 --- a/externals/SDL/src/core/linux/SDL_fcitx.c +++ b/externals/SDL/src/core/linux/SDL_fcitx.c @@ -85,22 +85,14 @@ GetAppName() } static size_t -Fcitx_GetPreeditString(SDL_DBusContext *dbus, - DBusMessage *msg, - char **ret, - Sint32 *start_pos, - Sint32 *end_pos) -{ +Fcitx_GetPreeditString(SDL_DBusContext *dbus, DBusMessage *msg, char **ret) { char *text = NULL, *subtext; size_t text_bytes = 0; DBusMessageIter iter, array, sub; - Sint32 p_start_pos = -1; - Sint32 p_end_pos = -1; dbus->message_iter_init(msg, &iter); /* Message type is a(si)i, we only need string part */ if (dbus->message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) { - size_t pos = 0; /* First pass: calculate string length */ dbus->message_iter_recurse(&iter, &array); while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) { @@ -111,29 +103,7 @@ Fcitx_GetPreeditString(SDL_DBusContext *dbus, text_bytes += SDL_strlen(subtext); } } - dbus->message_iter_next(&sub); - if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_INT32 && p_end_pos == -1) { - /* Type is a bit field defined as follows: */ - /* bit 3: Underline, bit 4: HighLight, bit 5: DontCommit, */ - /* bit 6: Bold, bit 7: Strike, bit 8: Italic */ - Sint32 type; - dbus->message_iter_get_basic(&sub, &type); - /* We only consider highlight */ - if (type & (1 << 4)) { - if (p_start_pos == -1) { - p_start_pos = pos; - } - } else if (p_start_pos != -1 && p_end_pos == -1) { - p_end_pos = pos; - } - } dbus->message_iter_next(&array); - if (subtext && *subtext) { - pos += SDL_utf8strlen(subtext); - } - } - if (p_start_pos != -1 && p_end_pos == -1) { - p_end_pos = pos; } if (text_bytes) { text = SDL_malloc(text_bytes + 1); @@ -159,32 +129,10 @@ Fcitx_GetPreeditString(SDL_DBusContext *dbus, text_bytes = 0; } } - - *ret = text; - *start_pos = p_start_pos; - *end_pos = p_end_pos; + *ret= text; return text_bytes; } -static Sint32 -Fcitx_GetPreeditCursorByte(SDL_DBusContext *dbus, DBusMessage *msg) -{ - Sint32 byte = -1; - DBusMessageIter iter; - - dbus->message_iter_init(msg, &iter); - - dbus->message_iter_next(&iter); - - if (dbus->message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) { - return -1; - } - - dbus->message_iter_get_basic(&iter, &byte); - - return byte; -} - static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -214,28 +162,20 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) if (dbus->message_is_signal(msg, FCITX_IC_DBUS_INTERFACE, "UpdateFormattedPreedit")) { char *text = NULL; - Sint32 start_pos, end_pos; - size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text, &start_pos, &end_pos); + size_t text_bytes = Fcitx_GetPreeditString(dbus, msg, &text); if (text_bytes) { - if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE)) { - if (start_pos == -1) { - Sint32 byte_pos = Fcitx_GetPreeditCursorByte(dbus, msg); - start_pos = byte_pos >= 0 ? SDL_utf8strnlen(text, byte_pos) : -1; - } - SDL_SendEditingText(text, start_pos, end_pos >= 0 ? end_pos - start_pos : -1); - } else { - char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; - size_t i = 0; - size_t cursor = 0; - while (i < text_bytes) { - const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); - const size_t chars = SDL_utf8strlen(buf); + char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + size_t i = 0; + size_t cursor = 0; - SDL_SendEditingText(buf, cursor, chars); + while (i < text_bytes) { + const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); - i += sz; - cursor += chars; - } + SDL_SendEditingText(buf, cursor, chars); + + i += sz; + cursor += chars; } SDL_free(text); } else { @@ -399,11 +339,11 @@ SDL_Fcitx_Reset(void) } SDL_bool -SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) +SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { - Uint32 mod_state = Fcitx_ModState(); + Uint32 state = Fcitx_ModState(); Uint32 handled = SDL_FALSE; - Uint32 is_release = (state == SDL_RELEASED); + Uint32 is_release = SDL_FALSE; Uint32 event_time = 0; if (!fcitx_client.ic_path) { @@ -411,7 +351,7 @@ SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) } if (SDL_DBus_CallMethod(FCITX_DBUS_SERVICE, fcitx_client.ic_path, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent", - DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mod_state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_BOOLEAN, &is_release, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, DBUS_TYPE_BOOLEAN, &handled, DBUS_TYPE_INVALID)) { if (handled) { SDL_Fcitx_UpdateTextRect(NULL); diff --git a/externals/SDL/src/core/linux/SDL_fcitx.h b/externals/SDL/src/core/linux/SDL_fcitx.h index c3cea523d..f7884ea43 100755 --- a/externals/SDL/src/core/linux/SDL_fcitx.h +++ b/externals/SDL/src/core/linux/SDL_fcitx.h @@ -31,7 +31,7 @@ extern SDL_bool SDL_Fcitx_Init(void); extern void SDL_Fcitx_Quit(void); extern void SDL_Fcitx_SetFocus(SDL_bool focused); extern void SDL_Fcitx_Reset(void); -extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); +extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect); extern void SDL_Fcitx_PumpEvents(void); diff --git a/externals/SDL/src/core/linux/SDL_ibus.c b/externals/SDL/src/core/linux/SDL_ibus.c index dc0b928eb..a7bafda35 100755 --- a/externals/SDL/src/core/linux/SDL_ibus.c +++ b/externals/SDL/src/core/linux/SDL_ibus.c @@ -22,7 +22,6 @@ #ifdef HAVE_IBUS_IBUS_H #include "SDL.h" -#include "SDL_hints.h" #include "SDL_syswm.h" #include "SDL_ibus.h" #include "SDL_dbus.h" @@ -67,217 +66,107 @@ IBus_ModState(void) return ibus_mods; } -static SDL_bool -IBus_EnterVariant(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, - DBusMessageIter *inside, const char * struct_id, size_t id_size) -{ - DBusMessageIter sub; - if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) { - return SDL_FALSE; - } - - dbus->message_iter_recurse(iter, &sub); - - if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRUCT) { - return SDL_FALSE; - } - - dbus->message_iter_recurse(&sub, inside); - - if (dbus->message_iter_get_arg_type(inside) != DBUS_TYPE_STRING) { - return SDL_FALSE; - } - - dbus->message_iter_get_basic(inside, &struct_id); - if (!struct_id || SDL_strncmp(struct_id, struct_id, id_size) != 0) { - return SDL_FALSE; - } - return SDL_TRUE; -} - -static SDL_bool -IBus_GetDecorationPosition(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, - Uint32 *start_pos, Uint32 *end_pos) -{ - DBusMessageIter sub1, sub2, array; - - if (!IBus_EnterVariant(conn, iter, dbus, &sub1, "IBusText", sizeof("IBusText"))) { - return SDL_FALSE; - } - - dbus->message_iter_next(&sub1); - dbus->message_iter_next(&sub1); - dbus->message_iter_next(&sub1); - - if (!IBus_EnterVariant(conn, &sub1, dbus, &sub2, "IBusAttrList", sizeof("IBusAttrList"))) { - return SDL_FALSE; - } - - dbus->message_iter_next(&sub2); - dbus->message_iter_next(&sub2); - - if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_ARRAY) { - return SDL_FALSE; - } - - dbus->message_iter_recurse(&sub2, &array); - - while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_VARIANT) { - DBusMessageIter sub; - if (IBus_EnterVariant(conn, &array, dbus, &sub, "IBusAttribute", sizeof("IBusAttribute"))) { - Uint32 type; - - dbus->message_iter_next(&sub); - dbus->message_iter_next(&sub); - - /* From here on, the structure looks like this: */ - /* Uint32 type: 1=underline, 2=foreground, 3=background */ - /* Uint32 value: for underline it's 0=NONE, 1=SINGLE, 2=DOUBLE, */ - /* 3=LOW, 4=ERROR */ - /* for foreground and background it's a color */ - /* Uint32 start_index: starting position for the style (utf8-char) */ - /* Uint32 end_index: end position for the style (utf8-char) */ - - dbus->message_iter_get_basic(&sub, &type); - /* We only use the background type to determine the selection */ - if (type == 3) { - Uint32 start = -1; - dbus->message_iter_next(&sub); - dbus->message_iter_next(&sub); - if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_UINT32) { - dbus->message_iter_get_basic(&sub, &start); - dbus->message_iter_next(&sub); - if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_UINT32) { - dbus->message_iter_get_basic(&sub, end_pos); - *start_pos = start; - return SDL_TRUE; - } - } - } - } - dbus->message_iter_next(&array); - } - return SDL_FALSE; -} - static const char * IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus) { /* The text we need is nested weirdly, use dbus-monitor to see the structure better */ const char *text = NULL; - DBusMessageIter sub; + const char *struct_id = NULL; + DBusMessageIter sub1, sub2; - if (!IBus_EnterVariant(conn, iter, dbus, &sub, "IBusText", sizeof("IBusText"))) { + if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) { return NULL; } - - dbus->message_iter_next(&sub); - dbus->message_iter_next(&sub); - - if (dbus->message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING) { + + dbus->message_iter_recurse(iter, &sub1); + + if (dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT) { return NULL; } - dbus->message_iter_get_basic(&sub, &text); - + + dbus->message_iter_recurse(&sub1, &sub2); + + if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { + return NULL; + } + + dbus->message_iter_get_basic(&sub2, &struct_id); + if (!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0) { + return NULL; + } + + dbus->message_iter_next(&sub2); + dbus->message_iter_next(&sub2); + + if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) { + return NULL; + } + + dbus->message_iter_get_basic(&sub2, &text); + return text; } -static SDL_bool -IBus_GetVariantCursorPos(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext *dbus, - Uint32 *pos) -{ - dbus->message_iter_next(iter); - - if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_UINT32) { - return SDL_FALSE; - } - - dbus->message_iter_get_basic(iter, pos); - - return SDL_TRUE; -} - static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) { SDL_DBusContext *dbus = (SDL_DBusContext *)user_data; - + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")) { DBusMessageIter iter; const char *text; dbus->message_iter_init(msg, &iter); + text = IBus_GetVariantText(conn, &iter, dbus); - if (text && *text) { char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; - + while (i < text_bytes) { size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); SDL_SendKeyboardText(buf); - + i += sz; } } - + return DBUS_HANDLER_RESULT_HANDLED; } - + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")) { DBusMessageIter iter; const char *text; dbus->message_iter_init(msg, &iter); text = IBus_GetVariantText(conn, &iter, dbus); - + if (text) { - if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE)) { - Uint32 pos, start_pos, end_pos; - SDL_bool has_pos = SDL_FALSE; - SDL_bool has_dec_pos = SDL_FALSE; + char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + size_t text_bytes = SDL_strlen(text), i = 0; + size_t cursor = 0; + + do { + const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); + + SDL_SendEditingText(buf, cursor, chars); - dbus->message_iter_init(msg, &iter); - has_dec_pos = IBus_GetDecorationPosition(conn, &iter, dbus, &start_pos, &end_pos); - if (!has_dec_pos) - { - dbus->message_iter_init(msg, &iter); - has_pos = IBus_GetVariantCursorPos(conn, &iter, dbus, &pos); - } - - if(has_dec_pos) { - SDL_SendEditingText(text, start_pos, end_pos - start_pos); - } else if (has_pos) { - SDL_SendEditingText(text, pos, -1); - } else { - SDL_SendEditingText(text, -1, -1); - } - } else { - char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; - size_t text_bytes = SDL_strlen(text), i = 0; - size_t cursor = 0; - - do { - const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); - const size_t chars = SDL_utf8strlen(buf); - - SDL_SendEditingText(buf, cursor, chars); - i += sz; - cursor += chars; - } while (i < text_bytes); - } + i += sz; + cursor += chars; + } while (i < text_bytes); } - + SDL_IBus_UpdateTextRect(NULL); - + return DBUS_HANDLER_RESULT_HANDLED; } - + if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")) { SDL_SendEditingText("", 0, 0); return DBUS_HANDLER_RESULT_HANDLED; } - + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } @@ -614,20 +503,15 @@ SDL_IBus_Reset(void) } SDL_bool -SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) +SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { Uint32 result = 0; SDL_DBusContext *dbus = SDL_DBus_GetContext(); - - + if (IBus_CheckConnection(dbus)) { Uint32 mods = IBus_ModState(); - Uint32 ibus_keycode = keycode - 8; - if (state == SDL_RELEASED) { - mods |= (1 << 30); // IBUS_RELEASE_MASK - } if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent", - DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &ibus_keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) { result = 0; } diff --git a/externals/SDL/src/core/linux/SDL_ibus.h b/externals/SDL/src/core/linux/SDL_ibus.h index 71d1f2d30..73a9f1b8b 100755 --- a/externals/SDL/src/core/linux/SDL_ibus.h +++ b/externals/SDL/src/core/linux/SDL_ibus.h @@ -41,7 +41,7 @@ extern void SDL_IBus_Reset(void); /* Sends a keypress event to IBus, returns SDL_TRUE if IBus used this event to update its candidate list or change input methods. PumpEvents should be called some time after this, to recieve the TextInput / TextEditing event back. */ -extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); +extern SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); /* Update the position of IBus' candidate list. If rect is NULL then this will just reposition it relative to the focused window's new position. */ diff --git a/externals/SDL/src/core/linux/SDL_ime.c b/externals/SDL/src/core/linux/SDL_ime.c index 9c0cb80f0..84c461f8b 100755 --- a/externals/SDL/src/core/linux/SDL_ime.c +++ b/externals/SDL/src/core/linux/SDL_ime.c @@ -27,7 +27,7 @@ typedef SDL_bool (*_SDL_IME_Init)(void); typedef void (*_SDL_IME_Quit)(void); typedef void (*_SDL_IME_SetFocus)(SDL_bool); typedef void (*_SDL_IME_Reset)(void); -typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32, Uint8 state); +typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32); typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *); typedef void (*_SDL_IME_PumpEvents)(void); @@ -127,10 +127,10 @@ SDL_IME_Reset(void) } SDL_bool -SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) +SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { if (SDL_IME_ProcessKeyEvent_Real) - return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state); + return SDL_IME_ProcessKeyEvent_Real(keysym, keycode); return SDL_FALSE; } diff --git a/externals/SDL/src/core/linux/SDL_ime.h b/externals/SDL/src/core/linux/SDL_ime.h index cc5b105f0..a28a4b430 100755 --- a/externals/SDL/src/core/linux/SDL_ime.h +++ b/externals/SDL/src/core/linux/SDL_ime.h @@ -31,7 +31,7 @@ extern SDL_bool SDL_IME_Init(void); extern void SDL_IME_Quit(void); extern void SDL_IME_SetFocus(SDL_bool focused); extern void SDL_IME_Reset(void); -extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); +extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern void SDL_IME_UpdateTextRect(SDL_Rect *rect); extern void SDL_IME_PumpEvents(void); diff --git a/externals/SDL/src/core/openbsd/SDL_wscons_kbd.c b/externals/SDL/src/core/openbsd/SDL_wscons_kbd.c index 121867d6a..bd19d1517 100755 --- a/externals/SDL/src/core/openbsd/SDL_wscons_kbd.c +++ b/externals/SDL/src/core/openbsd/SDL_wscons_kbd.c @@ -394,7 +394,6 @@ typedef struct { unsigned int text_len; keysym_t composebuffer[2]; unsigned char composelen; - int type; } SDL_WSCONS_input_data; static SDL_WSCONS_input_data* inputs[4] = {NULL, NULL, NULL, NULL}; @@ -433,7 +432,6 @@ static SDL_WSCONS_input_data* SDL_WSCONS_Init_Keyboard(const char* dev) RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETLEDS, &input->ledstate)); input->origledstate = input->ledstate; RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GETENCODING, &input->encoding)); - RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_GTYPE, &input->type)); #ifdef WSKBDIO_SETVERSION RETIFIOCTLERR(ioctl(input->fd, WSKBDIO_SETVERSION, &version)); #endif @@ -727,12 +725,7 @@ static void updateKeyboard(SDL_WSCONS_input_data* input) } break; } - - if (input->type == WSKBD_TYPE_USB && events[i].value <= 0xE7) - SDL_SendKeyboardKey(type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)events[i].value); - else - Translate_to_keycode(input, type, events[i].value); - + Translate_to_keycode(input, type, events[i].value); if (type == WSCONS_EVENT_KEY_UP) continue; if (IS_ALTGR_MODE && !IS_CONTROL_HELD) diff --git a/externals/SDL/src/core/os2/geniconv/geniconv.c b/externals/SDL/src/core/os2/geniconv/geniconv.c index 5976fe79f..d4f3fa196 100755 --- a/externals/SDL/src/core/os2/geniconv/geniconv.c +++ b/externals/SDL/src/core/os2/geniconv/geniconv.c @@ -46,17 +46,17 @@ extern size_t _System os2_iconv (iconv_t cd, char **outbuf, size_t *outbytesleft); extern int _System os2_iconv_close (iconv_t cd); -/* Functions pointers */ +/* Functions pointers types */ typedef iconv_t (_System *FNICONV_OPEN)(const char*, const char*); typedef size_t (_System *FNICONV) (iconv_t, char **, size_t *, char **, size_t *); typedef int (_System *FNICONV_CLOSE)(iconv_t); +/* Used DLL module handle */ static HMODULE hmIconv = NULLHANDLE; -static FNICONV_OPEN fn_iconv_open = os2_iconv_open; -static FNICONV fn_iconv = os2_iconv; -static FNICONV_CLOSE fn_iconv_close = os2_iconv_close; - -static int geniconv_init = 0; +/* Functions pointers */ +static FNICONV_OPEN fn_iconv_open = NULL; +static FNICONV fn_iconv = NULL; +static FNICONV_CLOSE fn_iconv_close = NULL; static BOOL _loadDLL(const char *dllname, @@ -102,12 +102,10 @@ static BOOL _loadDLL(const char *dllname, static void _init(void) { - if (geniconv_init) { + if (fn_iconv_open != NULL) { return; /* Already initialized */ } - geniconv_init = 1; - /* Try to load kiconv.dll, iconv2.dll or iconv.dll */ if (!_loadDLL("KICONV", "_libiconv_open", "_libiconv", "_libiconv_close") && !_loadDLL("ICONV2", "_libiconv_open", "_libiconv", "_libiconv_close") && @@ -125,19 +123,16 @@ static void _init(void) * ---------------- */ -/* function to unload the used iconv dynamic library */ +/* Non-standard function for iconv to unload the used dynamic library */ void libiconv_clean(void) { - geniconv_init = 0; - - /* reset the function pointers. */ - fn_iconv_open = os2_iconv_open; - fn_iconv = os2_iconv; - fn_iconv_close = os2_iconv_close; - if (hmIconv != NULLHANDLE) { DosFreeModule(hmIconv); hmIconv = NULLHANDLE; + + fn_iconv_open = NULL; + fn_iconv = NULL; + fn_iconv_close = NULL; } } diff --git a/externals/SDL/src/core/windows/SDL_hid.c b/externals/SDL/src/core/windows/SDL_hid.c index d9dd04fbe..da9413596 100755 --- a/externals/SDL/src/core/windows/SDL_hid.c +++ b/externals/SDL/src/core/windows/SDL_hid.c @@ -27,6 +27,8 @@ HidD_GetString_t SDL_HidD_GetManufacturerString; HidD_GetString_t SDL_HidD_GetProductString; +HidD_GetPreparsedData_t SDL_HidD_GetPreparsedData; +HidD_FreePreparsedData_t SDL_HidD_FreePreparsedData; HidP_GetCaps_t SDL_HidP_GetCaps; HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps; HidP_GetValueCaps_t SDL_HidP_GetValueCaps; @@ -56,13 +58,15 @@ WIN_LoadHIDDLL(void) SDL_HidD_GetManufacturerString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetManufacturerString"); SDL_HidD_GetProductString = (HidD_GetString_t)GetProcAddress(s_pHIDDLL, "HidD_GetProductString"); + SDL_HidD_GetPreparsedData = (HidD_GetPreparsedData_t)GetProcAddress(s_pHIDDLL, "HidD_GetPreparsedData"); + SDL_HidD_FreePreparsedData = (HidD_FreePreparsedData_t)GetProcAddress(s_pHIDDLL, "HidD_FreePreparsedData"); SDL_HidP_GetCaps = (HidP_GetCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetCaps"); SDL_HidP_GetButtonCaps = (HidP_GetButtonCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetButtonCaps"); SDL_HidP_GetValueCaps = (HidP_GetValueCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetValueCaps"); SDL_HidP_MaxDataListLength = (HidP_MaxDataListLength_t)GetProcAddress(s_pHIDDLL, "HidP_MaxDataListLength"); SDL_HidP_GetData = (HidP_GetData_t)GetProcAddress(s_pHIDDLL, "HidP_GetData"); - if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString || - !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps || + if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString || !SDL_HidD_GetPreparsedData || + !SDL_HidD_FreePreparsedData || !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps || !SDL_HidP_GetValueCaps || !SDL_HidP_MaxDataListLength || !SDL_HidP_GetData) { WIN_UnloadHIDDLL(); return -1; diff --git a/externals/SDL/src/core/windows/SDL_hid.h b/externals/SDL/src/core/windows/SDL_hid.h index 82a001a2e..54b9feb52 100755 --- a/externals/SDL/src/core/windows/SDL_hid.h +++ b/externals/SDL/src/core/windows/SDL_hid.h @@ -183,6 +183,8 @@ extern int WIN_LoadHIDDLL(void); extern void WIN_UnloadHIDDLL(void); typedef BOOLEAN (WINAPI *HidD_GetString_t)(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); +typedef BOOLEAN (WINAPI *HidD_GetPreparsedData_t)(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData); +typedef BOOLEAN (WINAPI *HidD_FreePreparsedData_t)(PHIDP_PREPARSED_DATA PreparsedData); typedef NTSTATUS (WINAPI *HidP_GetCaps_t)(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities); typedef NTSTATUS (WINAPI *HidP_GetButtonCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData); typedef NTSTATUS (WINAPI *HidP_GetValueCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData); @@ -191,6 +193,8 @@ typedef NTSTATUS (WINAPI *HidP_GetData_t)(HIDP_REPORT_TYPE ReportType, PHIDP_DAT extern HidD_GetString_t SDL_HidD_GetManufacturerString; extern HidD_GetString_t SDL_HidD_GetProductString; +extern HidD_GetPreparsedData_t SDL_HidD_GetPreparsedData; +extern HidD_FreePreparsedData_t SDL_HidD_FreePreparsedData; extern HidP_GetCaps_t SDL_HidP_GetCaps; extern HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps; extern HidP_GetValueCaps_t SDL_HidP_GetValueCaps; diff --git a/externals/SDL/src/core/windows/SDL_windows.c b/externals/SDL/src/core/windows/SDL_windows.c index 50e128fcc..2bdf878dd 100755 --- a/externals/SDL/src/core/windows/SDL_windows.c +++ b/externals/SDL/src/core/windows/SDL_windows.c @@ -25,15 +25,7 @@ #include "SDL_windows.h" #include "SDL_error.h" -#include /* for CoInitialize/CoUninitialize (Win32 only) */ -#if defined(HAVE_ROAPI_H) -#include /* For RoInitialize/RoUninitialize (Win32 only) */ -#else -typedef enum RO_INIT_TYPE { - RO_INIT_SINGLETHREADED = 0, - RO_INIT_MULTITHREADED = 1 -} RO_INIT_TYPE; -#endif +#include /* for CoInitialize/CoUninitialize (Win32 only) */ #ifndef _WIN32_WINNT_VISTA #define _WIN32_WINNT_VISTA 0x0600 @@ -45,10 +37,6 @@ typedef enum RO_INIT_TYPE { #define _WIN32_WINNT_WIN8 0x0602 #endif -#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32 -#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 -#endif - /* Sets an error message based on an HRESULT */ int @@ -120,65 +108,6 @@ WIN_CoUninitialize(void) #endif } -#ifndef __WINRT__ -void * -WIN_LoadComBaseFunction(const char *name) -{ - static SDL_bool s_bLoaded; - static HMODULE s_hComBase; - - if (!s_bLoaded) { - s_hComBase = LoadLibraryEx(TEXT("combase.dll"), NULL, LOAD_LIBRARY_SEARCH_SYSTEM32); - s_bLoaded = SDL_TRUE; - } - if (s_hComBase) { - return GetProcAddress(s_hComBase, name); - } else { - return NULL; - } -} -#endif - -HRESULT -WIN_RoInitialize(void) -{ -#ifdef __WINRT__ - return S_OK; -#else - typedef HRESULT (WINAPI *RoInitialize_t)(RO_INIT_TYPE initType); - RoInitialize_t RoInitializeFunc = (RoInitialize_t)WIN_LoadComBaseFunction("RoInitialize"); - if (RoInitializeFunc) { - /* RO_INIT_SINGLETHREADED is equivalent to COINIT_APARTMENTTHREADED */ - HRESULT hr = RoInitializeFunc(RO_INIT_SINGLETHREADED); - if (hr == RPC_E_CHANGED_MODE) { - hr = RoInitializeFunc(RO_INIT_MULTITHREADED); - } - - /* S_FALSE means success, but someone else already initialized. */ - /* You still need to call RoUninitialize in this case! */ - if (hr == S_FALSE) { - return S_OK; - } - - return hr; - } else { - return E_NOINTERFACE; - } -#endif -} - -void -WIN_RoUninitialize(void) -{ -#ifndef __WINRT__ - typedef void (WINAPI *RoUninitialize_t)(void); - RoUninitialize_t RoUninitializeFunc = (RoUninitialize_t)WIN_LoadComBaseFunction("RoUninitialize"); - if (RoUninitializeFunc) { - RoUninitializeFunc(); - } -#endif -} - #ifndef __WINRT__ static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) diff --git a/externals/SDL/src/core/windows/SDL_windows.h b/externals/SDL/src/core/windows/SDL_windows.h index 9b0149253..221c3bd87 100755 --- a/externals/SDL/src/core/windows/SDL_windows.h +++ b/externals/SDL/src/core/windows/SDL_windows.h @@ -30,14 +30,8 @@ #ifndef UNICODE #define UNICODE 1 #endif -#undef WINVER -#define WINVER 0x0501 #undef _WIN32_WINNT -#if !defined(SDL_VIDEO_RENDER_D3D12) #define _WIN32_WINNT 0x501 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */ -#else -#define _WIN32_WINNT 0xA00 /* For D3D12, 0xA00 is required */ -#endif #endif #include @@ -69,19 +63,10 @@ extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr); /* Sets an error message based on GetLastError(). Always return -1. */ extern int WIN_SetError(const char *prefix); -#if !defined(__WINRT__) -/* Load a function from combase.dll */ -void *WIN_LoadComBaseFunction(const char *name); -#endif - /* Wrap up the oddities of CoInitialize() into a common function. */ extern HRESULT WIN_CoInitialize(void); extern void WIN_CoUninitialize(void); -/* Wrap up the oddities of RoInitialize() into a common function. */ -extern HRESULT WIN_RoInitialize(void); -extern void WIN_RoUninitialize(void); - /* Returns SDL_TRUE if we're running on Windows Vista and newer */ extern BOOL WIN_IsWindowsVistaOrGreater(void); diff --git a/externals/SDL/src/core/windows/SDL_xinput.c b/externals/SDL/src/core/windows/SDL_xinput.c index fa67efcbb..1893907e4 100755 --- a/externals/SDL/src/core/windows/SDL_xinput.c +++ b/externals/SDL/src/core/windows/SDL_xinput.c @@ -23,6 +23,8 @@ #include "SDL_xinput.h" +#ifdef HAVE_XINPUT_H + XInputGetState_t SDL_XInputGetState = NULL; XInputSetState_t SDL_XInputSetState = NULL; XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL; @@ -135,5 +137,6 @@ WIN_UnloadXInputDLL(void) } #endif /* __WINRT__ */ +#endif /* HAVE_XINPUT_H */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/core/windows/SDL_xinput.h b/externals/SDL/src/core/windows/SDL_xinput.h index 1879e09ad..6e72327d8 100755 --- a/externals/SDL/src/core/windows/SDL_xinput.h +++ b/externals/SDL/src/core/windows/SDL_xinput.h @@ -23,11 +23,10 @@ #ifndef SDL_xinput_h_ #define SDL_xinput_h_ -#include "SDL_windows.h" - #ifdef HAVE_XINPUT_H + +#include "SDL_windows.h" #include -#endif /* HAVE_XINPUT_H */ #ifndef XUSER_MAX_COUNT #define XUSER_MAX_COUNT 4 @@ -73,53 +72,6 @@ #define XINPUT_DEVSUBTYPE_ARCADE_PAD 0x13 #endif -#ifndef XINPUT_FLAG_GAMEPAD -#define XINPUT_FLAG_GAMEPAD 0x01 -#endif - -#ifndef XINPUT_GAMEPAD_DPAD_UP -#define XINPUT_GAMEPAD_DPAD_UP 0x0001 -#endif -#ifndef XINPUT_GAMEPAD_DPAD_DOWN -#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 -#endif -#ifndef XINPUT_GAMEPAD_DPAD_LEFT -#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004 -#endif -#ifndef XINPUT_GAMEPAD_DPAD_RIGHT -#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 -#endif -#ifndef XINPUT_GAMEPAD_START -#define XINPUT_GAMEPAD_START 0x0010 -#endif -#ifndef XINPUT_GAMEPAD_BACK -#define XINPUT_GAMEPAD_BACK 0x0020 -#endif -#ifndef XINPUT_GAMEPAD_LEFT_THUMB -#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040 -#endif -#ifndef XINPUT_GAMEPAD_RIGHT_THUMB -#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 -#endif -#ifndef XINPUT_GAMEPAD_LEFT_SHOULDER -#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 -#endif -#ifndef XINPUT_GAMEPAD_RIGHT_SHOULDER -#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 -#endif -#ifndef XINPUT_GAMEPAD_A -#define XINPUT_GAMEPAD_A 0x1000 -#endif -#ifndef XINPUT_GAMEPAD_B -#define XINPUT_GAMEPAD_B 0x2000 -#endif -#ifndef XINPUT_GAMEPAD_X -#define XINPUT_GAMEPAD_X 0x4000 -#endif -#ifndef XINPUT_GAMEPAD_Y -#define XINPUT_GAMEPAD_Y 0x8000 -#endif - #ifndef XINPUT_GAMEPAD_GUIDE #define XINPUT_GAMEPAD_GUIDE 0x0400 #endif @@ -177,36 +129,6 @@ typedef struct BYTE BatteryLevel; } XINPUT_BATTERY_INFORMATION_EX; -#ifndef HAVE_XINPUT_H - -typedef struct -{ - WORD wButtons; - BYTE bLeftTrigger; - BYTE bRightTrigger; - SHORT sThumbLX; - SHORT sThumbLY; - SHORT sThumbRX; - SHORT sThumbRY; -} XINPUT_GAMEPAD; - -typedef struct -{ - WORD wLeftMotorSpeed; - WORD wRightMotorSpeed; -} XINPUT_VIBRATION; - -typedef struct -{ - BYTE Type; - BYTE SubType; - WORD Flags; - XINPUT_GAMEPAD Gamepad; - XINPUT_VIBRATION Vibration; -} XINPUT_CAPABILITIES; - -#endif /* HAVE_XINPUT_H */ - /* Forward decl's for XInput API's we load dynamically and use if available */ typedef DWORD (WINAPI *XInputGetState_t) ( @@ -248,6 +170,8 @@ extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */ #define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities #define XINPUTGETBATTERYINFORMATION SDL_XInputGetBatteryInformation +#endif /* HAVE_XINPUT_H */ + #endif /* SDL_xinput_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/core/winrt/SDL_winrtapp_xaml.cpp b/externals/SDL/src/core/winrt/SDL_winrtapp_xaml.cpp index 69716e11d..b64c50591 100755 --- a/externals/SDL/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/externals/SDL/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -115,7 +115,7 @@ SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAs // Make sure we have a valid XAML element (to draw onto): if ( ! backgroundPanelAsIInspectable) { - return SDL_InvalidParamError("backgroundPanelAsIInspectable"); + return SDL_SetError("'backgroundPanelAsIInspectable' can't be NULL"); } Platform::Object ^ backgroundPanel = reinterpret_cast((IInspectable *) backgroundPanelAsIInspectable); diff --git a/externals/SDL/src/cpuinfo/SDL_cpuinfo.c b/externals/SDL/src/cpuinfo/SDL_cpuinfo.c index 9386d0ebb..babbb816c 100755 --- a/externals/SDL/src/cpuinfo/SDL_cpuinfo.c +++ b/externals/SDL/src/cpuinfo/SDL_cpuinfo.c @@ -98,10 +98,6 @@ #include #endif -#ifdef __PS2__ -#include -#endif - #define CPU_HAS_RDTSC (1 << 0) #define CPU_HAS_ALTIVEC (1 << 1) #define CPU_HAS_MMX (1 << 2) @@ -116,12 +112,6 @@ #define CPU_HAS_NEON (1 << 11) #define CPU_HAS_AVX512F (1 << 12) #define CPU_HAS_ARM_SIMD (1 << 13) -#define CPU_HAS_LSX (1 << 14) -#define CPU_HAS_LASX (1 << 15) - -#define CPU_CFG2 0x2 -#define CPU_CFG2_LSX (1 << 6) -#define CPU_CFG2_LASX (1 << 7) #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ && !__FreeBSD__ /* This is the brute force way of detecting instruction sets... @@ -140,7 +130,7 @@ CPU_haveCPUID(void) { int has_CPUID = 0; -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ #ifndef SDL_CPUINFO_DISABLED #if (defined(__GNUC__) || defined(__llvm__)) && defined(__i386__) __asm__ ( @@ -229,7 +219,7 @@ done: ); #endif #endif -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ return has_CPUID; } @@ -518,23 +508,6 @@ CPU_haveNEON(void) #endif } -static int -CPU_readCPUCFG(void) -{ - uint32_t cfg2 = 0; -#if defined __loongarch__ - __asm__ volatile( - "cpucfg %0, %1 \n\t" - : "+&r"(cfg2) - : "r"(CPU_CFG2) - ); -#endif - return cfg2; -} - -#define CPU_haveLSX() (CPU_readCPUCFG() & CPU_CFG2_LSX) -#define CPU_haveLASX() (CPU_readCPUCFG() & CPU_CFG2_LASX) - #if defined(__e2k__) inline int CPU_have3DNow(void) @@ -912,14 +885,6 @@ SDL_GetCPUFeatures(void) SDL_CPUFeatures |= CPU_HAS_NEON; SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); } - if (CPU_haveLSX()) { - SDL_CPUFeatures |= CPU_HAS_LSX; - SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 16); - } - if (CPU_haveLASX()) { - SDL_CPUFeatures |= CPU_HAS_LASX; - SDL_SIMDAlignment = SDL_max(SDL_SIMDAlignment, 32); - } } return SDL_CPUFeatures; } @@ -1009,18 +974,6 @@ SDL_HasNEON(void) return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON); } -SDL_bool -SDL_HasLSX(void) -{ - return CPU_FEATURE_AVAILABLE(CPU_HAS_LSX); -} - -SDL_bool -SDL_HasLASX(void) -{ - return CPU_FEATURE_AVAILABLE(CPU_HAS_LASX); -} - static int SDL_SystemRAM = 0; int @@ -1085,12 +1038,6 @@ SDL_GetSystemRAM(void) SDL_SystemRAM = 536870912; } #endif -#ifdef __PS2__ - if (SDL_SystemRAM <= 0) { - /* PlayStation 2 has 32MiB however there are some special models with 64 and 128 */ - SDL_SystemRAM = GetMemorySize(); - } -#endif #endif } return SDL_SystemRAM; @@ -1111,18 +1058,10 @@ void * SDL_SIMDAlloc(const size_t len) { const size_t alignment = SDL_SIMDGetAlignment(); - const size_t padding = (alignment - (len % alignment)) % alignment; + const size_t padding = alignment - (len % alignment); + const size_t padded = (padding != alignment) ? (len + padding) : len; Uint8 *retval = NULL; - Uint8 *ptr; - size_t to_allocate; - - /* alignment + padding + sizeof (void *) is bounded (a few hundred - * bytes max), so no need to check for overflow within that argument */ - if (SDL_size_add_overflow(len, alignment + padding + sizeof (void *), &to_allocate)) { - return NULL; - } - - ptr = (Uint8 *) SDL_malloc(to_allocate); + Uint8 *ptr = (Uint8 *) SDL_malloc(padded + alignment + sizeof (void *)); if (ptr) { /* store the actual allocated pointer right before our aligned pointer. */ retval = ptr + sizeof (void *); @@ -1136,18 +1075,12 @@ void * SDL_SIMDRealloc(void *mem, const size_t len) { const size_t alignment = SDL_SIMDGetAlignment(); - const size_t padding = (alignment - (len % alignment)) % alignment; + const size_t padding = alignment - (len % alignment); + const size_t padded = (padding != alignment) ? (len + padding) : len; Uint8 *retval = (Uint8*) mem; void *oldmem = mem; size_t memdiff = 0, ptrdiff; Uint8 *ptr; - size_t to_allocate; - - /* alignment + padding + sizeof (void *) is bounded (a few hundred - * bytes max), so no need to check for overflow within that argument */ - if (SDL_size_add_overflow(len, alignment + padding + sizeof (void *), &to_allocate)) { - return NULL; - } if (mem) { void **realptr = (void **) mem; @@ -1158,7 +1091,7 @@ SDL_SIMDRealloc(void *mem, const size_t len) memdiff = ((size_t) oldmem) - ((size_t) mem); } - ptr = (Uint8 *) SDL_realloc(mem, to_allocate); + ptr = (Uint8 *) SDL_realloc(mem, padded + alignment + sizeof (void *)); if (ptr == NULL) { return NULL; /* Out of memory, bail! */ @@ -1223,8 +1156,6 @@ main() printf("AVX-512F: %d\n", SDL_HasAVX512F()); printf("ARM SIMD: %d\n", SDL_HasARMSIMD()); printf("NEON: %d\n", SDL_HasNEON()); - printf("LSX: %d\n", SDL_HasLSX()); - printf("LASX: %d\n", SDL_HasLASX()); printf("RAM: %d MB\n", SDL_GetSystemRAM()); return 0; } diff --git a/externals/SDL/src/dynapi/SDL_dynapi.h b/externals/SDL/src/dynapi/SDL_dynapi.h index dc53e58b2..452078b1a 100755 --- a/externals/SDL/src/dynapi/SDL_dynapi.h +++ b/externals/SDL/src/dynapi/SDL_dynapi.h @@ -51,8 +51,6 @@ #define SDL_DYNAMIC_API 0 #elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */ #define SDL_DYNAMIC_API 0 -#elif defined(__PS2__) && __PS2__ -#define SDL_DYNAMIC_API 0 #elif defined(__PSP__) && __PSP__ #define SDL_DYNAMIC_API 0 #elif defined(__riscos__) && __riscos__ /* probably not useful on RISC OS, since dlopen() can't be used when using static linking. */ @@ -61,8 +59,6 @@ #define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ #elif defined(__VITA__) #define SDL_DYNAMIC_API 0 /* vitasdk doesn't support dynamic linking */ -#elif defined(__NGAGE__) -#define SDL_DYNAMIC_API 0 /* The N-Gage doesn't support dynamic linking either */ #elif defined(DYNAPI_NEEDS_DLOPEN) && !defined(HAVE_DLOPEN) #define SDL_DYNAMIC_API 0 /* we need dlopen(), but don't have it.... */ #endif diff --git a/externals/SDL/src/dynapi/SDL_dynapi_overrides.h b/externals/SDL/src/dynapi/SDL_dynapi_overrides.h index 1083fd9ad..53bb4d4f6 100755 --- a/externals/SDL/src/dynapi/SDL_dynapi_overrides.h +++ b/externals/SDL/src/dynapi/SDL_dynapi_overrides.h @@ -439,6 +439,8 @@ #define SDL_iconv_close SDL_iconv_close_REAL #define SDL_iconv SDL_iconv_REAL #define SDL_iconv_string SDL_iconv_string_REAL +#define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL +#define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL #define SDL_CreateRGBSurface SDL_CreateRGBSurface_REAL #define SDL_CreateRGBSurfaceFrom SDL_CreateRGBSurfaceFrom_REAL #define SDL_FreeSurface SDL_FreeSurface_REAL @@ -575,6 +577,7 @@ #define SDL_WarpMouseGlobal SDL_WarpMouseGlobal_REAL #define SDL_WinRTGetFSPathUNICODE SDL_WinRTGetFSPathUNICODE_REAL #define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPathUTF8_REAL +#define SDL_WinRTRunApp SDL_WinRTRunApp_REAL #define SDL_sqrtf SDL_sqrtf_REAL #define SDL_tan SDL_tan_REAL #define SDL_tanf SDL_tanf_REAL @@ -750,6 +753,7 @@ #define SDL_JoystickDetachVirtual SDL_JoystickDetachVirtual_REAL #define SDL_JoystickIsVirtual SDL_JoystickIsVirtual_REAL #define SDL_JoystickSetVirtualAxis SDL_JoystickSetVirtualAxis_REAL +#define SDL_JoystickSetVirtualBall SDL_JoystickSetVirtualBall_REAL #define SDL_JoystickSetVirtualButton SDL_JoystickSetVirtualButton_REAL #define SDL_JoystickSetVirtualHat SDL_JoystickSetVirtualHat_REAL #define SDL_GetErrorMsg SDL_GetErrorMsg_REAL @@ -851,27 +855,3 @@ #define SDL_GameControllerHasRumbleTriggers SDL_GameControllerHasRumbleTriggers_REAL #define SDL_hid_ble_scan SDL_hid_ble_scan_REAL #define SDL_PremultiplyAlpha SDL_PremultiplyAlpha_REAL -#define SDL_AndroidSendMessage SDL_AndroidSendMessage_REAL -#define SDL_GetTouchName SDL_GetTouchName_REAL -#define SDL_ClearComposition SDL_ClearComposition_REAL -#define SDL_IsTextInputShown SDL_IsTextInputShown_REAL -#define SDL_HasIntersectionF SDL_HasIntersectionF_REAL -#define SDL_IntersectFRect SDL_IntersectFRect_REAL -#define SDL_UnionFRect SDL_UnionFRect_REAL -#define SDL_EncloseFPoints SDL_EncloseFPoints_REAL -#define SDL_IntersectFRectAndLine SDL_IntersectFRectAndLine_REAL -#define SDL_RenderGetWindow SDL_RenderGetWindow_REAL -#define SDL_bsearch SDL_bsearch_REAL -#define SDL_GameControllerPathForIndex SDL_GameControllerPathForIndex_REAL -#define SDL_GameControllerPath SDL_GameControllerPath_REAL -#define SDL_JoystickPathForIndex SDL_JoystickPathForIndex_REAL -#define SDL_JoystickPath SDL_JoystickPath_REAL -#define SDL_JoystickAttachVirtualEx SDL_JoystickAttachVirtualEx_REAL -#define SDL_GameControllerGetFirmwareVersion SDL_GameControllerGetFirmwareVersion_REAL -#define SDL_JoystickGetFirmwareVersion SDL_JoystickGetFirmwareVersion_REAL -#define SDL_GUIDToString SDL_GUIDToString_REAL -#define SDL_GUIDFromString SDL_GUIDFromString_REAL -#define SDL_HasLSX SDL_HasLSX_REAL -#define SDL_HasLASX SDL_HasLASX_REAL -#define SDL_RenderGetD3D12Device SDL_RenderGetD3D12Device_REAL -#define SDL_utf8strnlen SDL_utf8strnlen_REAL diff --git a/externals/SDL/src/dynapi/SDL_dynapi_procs.h b/externals/SDL/src/dynapi/SDL_dynapi_procs.h index db4fa1bb9..000cde803 100755 --- a/externals/SDL/src/dynapi/SDL_dynapi_procs.h +++ b/externals/SDL/src/dynapi/SDL_dynapi_procs.h @@ -70,7 +70,7 @@ SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_RenderGetD3D9Device,(SDL_Renderer *a),(a), #endif #ifdef __IPHONEOS__ -SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void (SDLCALL *c)(void *), void *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void c, void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),) #endif @@ -408,7 +408,7 @@ SDL_DYNAPI_PROC(void*,SDL_realloc,(void *a, size_t b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_free,(void *a),(a),) SDL_DYNAPI_PROC(char*,SDL_getenv,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_setenv,(const char *a, const char *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(void,SDL_qsort,(void *a, size_t b, size_t c, int (SDLCALL *d)(const void *, const void *)),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_qsort,(void *a, size_t b, size_t c, int (*d)(const void *, const void *)),(a,b,c,d),) SDL_DYNAPI_PROC(int,SDL_abs,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_isdigit,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_isspace,(int a),(a),return) @@ -508,7 +508,7 @@ SDL_DYNAPI_PROC(void,SDL_WaitThread,(SDL_Thread *a, int *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_DetachThread,(SDL_Thread *a),(a),) SDL_DYNAPI_PROC(SDL_TLSID,SDL_TLSCreate,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_TLSGet,(SDL_TLSID a),(a),return) -SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (SDLCALL *c)(void*)),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_TLSSet,(SDL_TLSID a, const void *b, void (*c)(void*)),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_GetTicks,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceCounter,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceFrequency,(void),(),return) @@ -924,31 +924,3 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasRumble,(SDL_GameController *a),(a) SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasRumbleTriggers,(SDL_GameController *a),(a),return) SDL_DYNAPI_PROC(void,SDL_hid_ble_scan,(SDL_bool a),(a),) SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return) -#ifdef __ANDROID__ -SDL_DYNAPI_PROC(int,SDL_AndroidSendMessage,(Uint32 a, int b),(a,b),return) -#endif -SDL_DYNAPI_PROC(const char*,SDL_GetTouchName,(int a),(a),return) -SDL_DYNAPI_PROC(void,SDL_ClearComposition,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputShown,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersectionF,(const SDL_FRect *a, const SDL_FRect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) -SDL_DYNAPI_PROC(void,SDL_UnionFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_bool,SDL_EncloseFPoints,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRectAndLine,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_Window*,SDL_RenderGetWindow,(SDL_Renderer *a),(a),return) -SDL_DYNAPI_PROC(void*,SDL_bsearch,(const void *a, const void *b, size_t c, size_t d, int (SDLCALL *e)(const void *, const void *)),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(const char*,SDL_GameControllerPathForIndex,(int a),(a),return) -SDL_DYNAPI_PROC(const char*,SDL_GameControllerPath,(SDL_GameController *a),(a),return) -SDL_DYNAPI_PROC(const char*,SDL_JoystickPathForIndex,(int a),(a),return) -SDL_DYNAPI_PROC(const char*,SDL_JoystickPath,(SDL_Joystick *a),(a),return) -SDL_DYNAPI_PROC(int,SDL_JoystickAttachVirtualEx,(const SDL_VirtualJoystickDesc *a),(a),return) -SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetFirmwareVersion,(SDL_GameController *a),(a),return) -SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetFirmwareVersion,(SDL_Joystick *a),(a),return) -SDL_DYNAPI_PROC(void,SDL_GUIDToString,(SDL_GUID a, char *b, int c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_GUID,SDL_GUIDFromString,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasLSX,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasLASX,(void),(),return) -#ifdef __WIN32__ -SDL_DYNAPI_PROC(ID3D12Device*,SDL_RenderGetD3D12Device,(SDL_Renderer *a),(a),return) -#endif -SDL_DYNAPI_PROC(size_t,SDL_utf8strnlen,(const char *a, size_t b),(a,b),return) diff --git a/externals/SDL/src/dynapi/gendynapi.pl b/externals/SDL/src/dynapi/gendynapi.pl index a9ff9723b..b99a8a492 100755 --- a/externals/SDL/src/dynapi/gendynapi.pl +++ b/externals/SDL/src/dynapi/gendynapi.pl @@ -33,7 +33,6 @@ use File::Basename; chdir(dirname(__FILE__) . '/../..'); my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h"; my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h"; -my $sdl2_exports = "src/dynapi/SDL2.exports"; my %existing = (); if (-f $sdl_dynapi_procs_h) { @@ -48,7 +47,6 @@ if (-f $sdl_dynapi_procs_h) { open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n"); open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n"); -open(SDL2_EXPORTS, '>>', $sdl2_exports) or die("Can't open $sdl2_exports: $!\n"); opendir(HEADERS, 'include') or die("Can't open include dir: $!\n"); while (my $d = readdir(HEADERS)) { @@ -135,7 +133,6 @@ while (my $d = readdir(HEADERS)) { print("NEW: $decl\n"); print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n"; print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n"; - print SDL2_EXPORTS "++'_${fn}'.'SDL2.dll'.'${fn}'\n"; } else { print("Failed to parse decl [$decl]!\n"); } @@ -146,6 +143,5 @@ closedir(HEADERS); close(SDL_DYNAPI_PROCS_H); close(SDL_DYNAPI_OVERRIDES_H); -close(SDL2_EXPORTS); # vi: set ts=4 sw=4 expandtab: diff --git a/externals/SDL/src/events/SDL_events.c b/externals/SDL/src/events/SDL_events.c index 4f52d10a3..220fe1777 100755 --- a/externals/SDL/src/events/SDL_events.c +++ b/externals/SDL/src/events/SDL_events.c @@ -35,7 +35,7 @@ #include "SDL_syswm.h" #undef SDL_PRIs64 -#if defined(__WIN32__) && !defined(__CYGWIN__) +#ifdef __WIN32__ #define SDL_PRIs64 "I64d" #else #define SDL_PRIs64 "lld" @@ -150,19 +150,13 @@ SDL_PollSentinelChanged(void *userdata, const char *name, const char *oldValue, SDL_EventState(SDL_POLLSENTINEL, SDL_GetStringBoolean(hint, SDL_TRUE) ? SDL_ENABLE : SDL_DISABLE); } -/** - * Verbosity of logged events as defined in SDL_HINT_EVENT_LOGGING: - * - 0: (default) no logging - * - 1: logging of most events - * - 2: as above, plus mouse and finger motion - * - 3: as above, plus SDL_SysWMEvents - */ -static int SDL_EventLoggingVerbosity = 0; +/* 0 (default) means no logging, 1 means logging, 2 means logging with mouse and finger motion */ +static int SDL_DoEventLogging = 0; static void SDLCALL SDL_EventLoggingChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { - SDL_EventLoggingVerbosity = (hint && *hint) ? SDL_clamp(SDL_atoi(hint), 0, 3) : 0; + SDL_DoEventLogging = (hint && *hint) ? SDL_clamp(SDL_atoi(hint), 0, 2) : 0; } static void @@ -172,7 +166,7 @@ SDL_LogEvent(const SDL_Event *event) char details[128]; /* sensor/mouse/finger motion are spammy, ignore these if they aren't demanded. */ - if ( (SDL_EventLoggingVerbosity < 2) && + if ( (SDL_DoEventLogging < 2) && ( (event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION) || (event->type == SDL_CONTROLLERTOUCHPADMOTION) || @@ -181,11 +175,6 @@ SDL_LogEvent(const SDL_Event *event) return; } - /* window manager events are even more spammy, and don't provide much useful info. */ - if ((SDL_EventLoggingVerbosity < 3) && (event->type == SDL_SYSWMEVENT)) { - return; - } - /* this is to make SDL_snprintf() calls cleaner. */ #define uint unsigned int @@ -217,28 +206,11 @@ SDL_LogEvent(const SDL_Event *event) SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND) break; SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND) break; SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND) break; - SDL_EVENT_CASE(SDL_LOCALECHANGED) break; SDL_EVENT_CASE(SDL_KEYMAPCHANGED) break; SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break; SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break; SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break; - SDL_EVENT_CASE(SDL_DISPLAYEVENT) { - char name2[64]; - switch (event->display.event) { - case SDL_DISPLAYEVENT_NONE: SDL_strlcpy(name2, "SDL_DISPLAYEVENT_NONE (THIS IS PROBABLY A BUG!)", sizeof(name2)); break; - #define SDL_DISPLAYEVENT_CASE(x) case x: SDL_strlcpy(name2, #x, sizeof (name2)); break - SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_ORIENTATION); - SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_CONNECTED); - SDL_DISPLAYEVENT_CASE(SDL_DISPLAYEVENT_DISCONNECTED); - #undef SDL_DISPLAYEVENT_CASE - default: SDL_strlcpy(name2, "UNKNOWN (bug? fixme?)", sizeof(name2)); break; - } - SDL_snprintf(details, sizeof (details), " (timestamp=%u display=%u event=%s data1=%d)", - (uint) event->display.timestamp, (uint) event->display.display, name2, (int) event->display.data1); - break; - } - SDL_EVENT_CASE(SDL_WINDOWEVENT) { char name2[64]; switch(event->window.event) { @@ -260,8 +232,6 @@ SDL_LogEvent(const SDL_Event *event) SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS); SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST); - SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ICCPROF_CHANGED); - SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_DISPLAY_CHANGED); #undef SDL_WINDOWEVENT_CASE default: SDL_strlcpy(name2, "UNKNOWN (bug? fixme?)", sizeof (name2)); break; } @@ -601,7 +571,7 @@ SDL_AddEvent(SDL_Event * event) SDL_EventQ.free = entry->next; } - if (SDL_EventLoggingVerbosity > 0) { + if (SDL_DoEventLogging) { SDL_LogEvent(event); } @@ -690,12 +660,12 @@ static int SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType, SDL_bool include_sentinel) { - int i, used, sentinels_expected = 0; + int i, used; /* Don't look after we've quit */ if (!SDL_AtomicGet(&SDL_EventQ.active)) { /* We get a few spurious events at shutdown, so don't warn then */ - if (action == SDL_GETEVENT) { + if (action != SDL_ADDEVENT) { SDL_SetError("The event system has been shut down"); } return (-1); @@ -753,15 +723,8 @@ SDL_PeepEventsInternal(SDL_Event * events, int numevents, SDL_eventaction action } if (type == SDL_POLLSENTINEL) { /* Special handling for the sentinel event */ - if (!include_sentinel) { - /* Skip it, we don't want to include it */ - continue; - } - if (!events || action != SDL_GETEVENT) { - ++sentinels_expected; - } - if (SDL_AtomicGet(&SDL_sentinel_pending) > sentinels_expected) { - /* Skip it, there's another one pending */ + if (!include_sentinel || SDL_AtomicGet(&SDL_sentinel_pending) > 0) { + /* Skip it, we don't want to include it or there's another one pending */ continue; } } @@ -928,11 +891,7 @@ SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event * event, c) Periodic processing that takes place in some platform PumpEvents() functions happens d) Signals received in WaitEventTimeout() are turned into SDL events */ - /* We only want a single sentinel in the queue. We could get more than one if event is NULL, - * since the SDL_PeepEvents() call below won't remove it in that case. - */ - SDL_bool add_sentinel = (SDL_AtomicGet(&SDL_sentinel_pending) == 0) ? SDL_TRUE : SDL_FALSE; - SDL_PumpEventsInternal(add_sentinel); + SDL_PumpEventsInternal(SDL_TRUE); if (!_this->wakeup_lock || SDL_LockMutex(_this->wakeup_lock) == 0) { int status = SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT); @@ -973,10 +932,7 @@ SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event * event, status = _this->WaitEventTimeout(_this, loop_timeout); /* Set wakeup_window to NULL without holding the lock. */ _this->wakeup_window = NULL; - if (status == 0 && need_periodic_poll && loop_timeout == PERIODIC_POLL_INTERVAL_MS) { - /* We may have woken up to poll. Try again */ - continue; - } else if (status <= 0) { + if (status <= 0) { /* There is either an error or the timeout is elapsed: return */ return status; } @@ -1031,7 +987,6 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout) SDL_Window *wakeup_window; Uint32 start, expiration; SDL_bool include_sentinel = (timeout == 0) ? SDL_TRUE : SDL_FALSE; - int result; /* If there isn't a poll sentinel event pending, pump events and add one */ if (SDL_AtomicGet(&SDL_sentinel_pending) == 0) { @@ -1039,34 +994,33 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout) } /* First check for existing events */ - result = SDL_PeepEventsInternal(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, include_sentinel); - if (result < 0) { + switch (SDL_PeepEventsInternal(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, include_sentinel)) { + case -1: return 0; - } - if (include_sentinel) { - if (event) { - if (event->type == SDL_POLLSENTINEL) { - /* Reached the end of a poll cycle, and not willing to wait */ - return 0; - } - } else { - /* Need to peek the next event to check for sentinel */ - SDL_Event dummy; - - if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, SDL_TRUE) && - dummy.type == SDL_POLLSENTINEL) { - SDL_PeepEventsInternal(&dummy, 1, SDL_GETEVENT, SDL_POLLSENTINEL, SDL_POLLSENTINEL, SDL_TRUE); - /* Reached the end of a poll cycle, and not willing to wait */ - return 0; - } - } - } - if (result == 0) { + case 0: if (timeout == 0) { /* No events available, and not willing to wait */ return 0; } - } else { + break; + default: + if (include_sentinel) { + if (event) { + if (event->type == SDL_POLLSENTINEL) { + /* Reached the end of a poll cycle, and not willing to wait */ + return 0; + } + } else { + /* Need to peek the next event to check for sentinel */ + SDL_Event dummy; + + if (SDL_PeepEventsInternal(&dummy, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT, SDL_TRUE) && + dummy.type == SDL_POLLSENTINEL) { + /* Reached the end of a poll cycle, and not willing to wait */ + return 0; + } + } + } /* Has existing events */ return 1; } @@ -1278,7 +1232,8 @@ SDL_FilterEvents(SDL_EventFilter filter, void *userdata) Uint8 SDL_EventState(Uint32 type, int state) { - const SDL_bool isde = (state == SDL_DISABLE) || (state == SDL_ENABLE); + const SDL_bool isdnd = ((state == SDL_DISABLE) || (state == SDL_ENABLE)) && + ((type == SDL_DROPFILE) || (type == SDL_DROPTEXT)); Uint8 current_state; Uint8 hi = ((type >> 8) & 0xff); Uint8 lo = (type & 0xff); @@ -1290,32 +1245,44 @@ SDL_EventState(Uint32 type, int state) current_state = SDL_ENABLE; } - if (isde && state != current_state) { - if (state == SDL_DISABLE) { + if (state != current_state) + { + switch (state) { + case SDL_DISABLE: /* Disable this event type and discard pending events */ if (!SDL_disabled_events[hi]) { SDL_disabled_events[hi] = (SDL_DisabledEventBlock*) SDL_calloc(1, sizeof(SDL_DisabledEventBlock)); + if (!SDL_disabled_events[hi]) { + /* Out of memory, nothing we can do... */ + break; + } } - /* Out of memory, nothing we can do... */ - if (SDL_disabled_events[hi]) { - SDL_disabled_events[hi]->bits[lo/32] |= (1 << (lo&31)); - SDL_FlushEvent(type); - } - } else { // state == SDL_ENABLE + SDL_disabled_events[hi]->bits[lo/32] |= (1 << (lo&31)); + SDL_FlushEvent(type); + break; + case SDL_ENABLE: SDL_disabled_events[hi]->bits[lo/32] &= ~(1 << (lo&31)); + break; + default: + /* Querying state... */ + break; } #if !SDL_JOYSTICK_DISABLED - SDL_CalculateShouldUpdateJoysticks(); + if (state == SDL_DISABLE || state == SDL_ENABLE) { + SDL_CalculateShouldUpdateJoysticks(); + } #endif #if !SDL_SENSOR_DISABLED - SDL_CalculateShouldUpdateSensors(); + if (state == SDL_DISABLE || state == SDL_ENABLE) { + SDL_CalculateShouldUpdateSensors(); + } #endif } /* turn off drag'n'drop support if we've disabled the events. This might change some UI details at the OS level. */ - if (isde && ((type == SDL_DROPFILE) || (type == SDL_DROPTEXT))) { + if (isdnd) { SDL_ToggleDragAndDropSupport(); } diff --git a/externals/SDL/src/events/SDL_keyboard.c b/externals/SDL/src/events/SDL_keyboard.c index be1b7953e..3400ca0c5 100755 --- a/externals/SDL/src/events/SDL_keyboard.c +++ b/externals/SDL/src/events/SDL_keyboard.c @@ -282,10 +282,6 @@ static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = { SDLK_APP2, SDLK_AUDIOREWIND, SDLK_AUDIOFASTFORWARD, - SDLK_SOFTLEFT, - SDLK_SOFTRIGHT, - SDLK_CALL, - SDLK_ENDCALL, }; static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { @@ -522,10 +518,6 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { "App2", "AudioRewind", "AudioFastForward", - "SoftLeft", - "SoftRight", - "Call", - "EndCall", }; /* Taken from SDL_iconv() */ @@ -646,7 +638,6 @@ SDL_SetKeyboardFocus(SDL_Window * window) /* old window must lose an existing mouse capture. */ if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) { SDL_CaptureMouse(SDL_FALSE); /* drop the capture. */ - SDL_UpdateMouseCapture(SDL_TRUE); SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE)); } @@ -876,14 +867,10 @@ SDL_SendKeyboardText(const char *text) posted = 0; if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_Event event; - size_t i = 0, length = SDL_strlen(text); - event.text.type = SDL_TEXTINPUT; event.text.windowID = keyboard->focus ? keyboard->focus->id : 0; - while (i < length) { - i += SDL_utf8strlcpy(event.text.text, text + i, SDL_arraysize(event.text.text)); - posted |= (SDL_PushEvent(&event) > 0); - } + SDL_utf8strlcpy(event.text.text, text, SDL_arraysize(event.text.text)); + posted = (SDL_PushEvent(&event) > 0); } return (posted); } @@ -903,22 +890,6 @@ SDL_SendEditingText(const char *text, int start, int length) event.edit.start = start; event.edit.length = length; SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); - - if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE) && - SDL_strlen(text) > SDL_arraysize(event.text.text)) { - event.editExt.type = SDL_TEXTEDITING_EXT; - event.editExt.windowID = keyboard->focus ? keyboard->focus->id : 0; - event.editExt.text = text ? SDL_strdup(text) : NULL; - event.editExt.start = start; - event.editExt.length = length; - } else { - event.edit.type = SDL_TEXTEDITING; - event.edit.windowID = keyboard->focus ? keyboard->focus->id : 0; - event.edit.start = start; - event.edit.length = length; - SDL_utf8strlcpy(event.edit.text, text, SDL_arraysize(event.edit.text)); - } - posted = (SDL_PushEvent(&event) > 0); } return (posted); diff --git a/externals/SDL/src/events/SDL_mouse.c b/externals/SDL/src/events/SDL_mouse.c index dfa9a6c42..259ee9f20 100755 --- a/externals/SDL/src/events/SDL_mouse.c +++ b/externals/SDL/src/events/SDL_mouse.c @@ -109,28 +109,6 @@ SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldVal mouse->touch_mouse_events = SDL_GetStringBoolean(hint, SDL_TRUE); } -#if defined(__vita__) -static void SDLCALL -SDL_VitaTouchMouseDeviceChanged(void *userdata, const char *name, const char *oldValue, const char *hint) -{ - SDL_Mouse *mouse = (SDL_Mouse *)userdata; - if (hint) { - switch(*hint) { - default: - case '0': - mouse->vita_touch_mouse_device = 0; - break; - case '1': - mouse->vita_touch_mouse_device = 1; - break; - case '2': - mouse->vita_touch_mouse_device = 2; - break; - } - } -} -#endif - static void SDLCALL SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { @@ -149,18 +127,6 @@ SDL_MouseTouchEventsChanged(void *userdata, const char *name, const char *oldVal } } -static void SDLCALL -SDL_MouseAutoCaptureChanged(void *userdata, const char *name, const char *oldValue, const char *hint) -{ - SDL_Mouse *mouse = (SDL_Mouse *)userdata; - SDL_bool auto_capture = SDL_GetStringBoolean(hint, SDL_TRUE); - - if (auto_capture != mouse->auto_capture) { - mouse->auto_capture = auto_capture; - SDL_UpdateMouseCapture(SDL_FALSE); - } -} - /* Public functions */ int SDL_MouseInit(void) @@ -184,17 +150,9 @@ SDL_MouseInit(void) SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, SDL_TouchMouseEventsChanged, mouse); -#if defined(__vita__) - SDL_AddHintCallback(SDL_HINT_VITA_TOUCH_MOUSE_DEVICE, - SDL_VitaTouchMouseDeviceChanged, mouse); -#endif - SDL_AddHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS, SDL_MouseTouchEventsChanged, mouse); - SDL_AddHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE, - SDL_MouseAutoCaptureChanged, mouse); - mouse->was_touch_mouse_events = SDL_FALSE; /* no touch to mouse movement event pending */ mouse->cursor_shown = SDL_TRUE; @@ -290,10 +248,23 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate, SDL_ } } +/* Linux doesn't give you mouse events outside your window unless you grab + the pointer. + + Windows doesn't give you mouse events outside your window unless you call + SetCapture(). + + Both of these are slightly scary changes, so for now we'll punt and if the + mouse leaves the window you'll lose mouse focus and reset button state. +*/ +#ifdef SUPPORT_DRAG_OUTSIDE_WINDOW + if (!inWindow && !buttonstate) { +#else if (!inWindow) { +#endif if (window == mouse->focus) { #ifdef DEBUG_MOUSE - SDL_Log("Mouse left window, synthesizing move & focus lost event\n"); + printf("Mouse left window, synthesizing move & focus lost event\n"); #endif if (send_mouse_motion) { SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); @@ -305,7 +276,7 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate, SDL_ if (window != mouse->focus) { #ifdef DEBUG_MOUSE - SDL_Log("Mouse entered window, synthesizing focus gain & move event\n"); + printf("Mouse entered window, synthesizing focus gain & move event\n"); #endif SDL_SetMouseFocus(window); if (send_mouse_motion) { @@ -407,12 +378,14 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ /* Ignore relative motion when first positioning the mouse */ if (!mouse->has_position) { + xrel = 0; + yrel = 0; mouse->x = x; mouse->y = y; mouse->has_position = SDL_TRUE; } else if (!xrel && !yrel) { /* Drop events that don't change state */ #ifdef DEBUG_MOUSE - SDL_Log("Mouse event didn't change state - dropped!\n"); + printf("Mouse event didn't change state - dropped!\n"); #endif return 0; } @@ -560,7 +533,7 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state Uint32 type; Uint32 buttonstate; SDL_MouseInputSource *source; - + source = GetMouseInputSource(mouse, mouseID); if (!source) { return 0; @@ -660,11 +633,6 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate, SDL_TRUE); } - /* Automatically capture the mouse while buttons are pressed */ - if (mouse->auto_capture) { - SDL_UpdateMouseCapture(SDL_FALSE); - } - return posted; } @@ -759,7 +727,6 @@ SDL_MouseQuit(void) if (mouse->CaptureMouse) { SDL_CaptureMouse(SDL_FALSE); - SDL_UpdateMouseCapture(SDL_TRUE); } SDL_SetRelativeMouseMode(SDL_FALSE); SDL_ShowCursor(1); @@ -790,26 +757,11 @@ SDL_MouseQuit(void) } mouse->num_clickstates = 0; - SDL_DelHintCallback(SDL_HINT_MOUSE_DOUBLE_CLICK_TIME, - SDL_MouseDoubleClickTimeChanged, mouse); - - SDL_DelHintCallback(SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS, - SDL_MouseDoubleClickRadiusChanged, mouse); - SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, SDL_MouseNormalSpeedScaleChanged, mouse); SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, SDL_MouseRelativeSpeedScaleChanged, mouse); - - SDL_DelHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, - SDL_TouchMouseEventsChanged, mouse); - - SDL_DelHintCallback(SDL_HINT_MOUSE_TOUCH_EVENTS, - SDL_MouseTouchEventsChanged, mouse); - - SDL_DelHintCallback(SDL_HINT_MOUSE_AUTO_CAPTURE, - SDL_MouseAutoCaptureChanged, mouse); } Uint32 @@ -867,7 +819,7 @@ SDL_GetGlobalMouseState(int *x, int *y) } void -SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode) +SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -883,20 +835,6 @@ SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_r return; } - if (mouse->relative_mode && !ignore_relative_mode) { - /* 2.0.22 made warping in relative mode actually functional, which - * surprised many applications that weren't expecting the additional - * mouse motion. - * - * So for now, warping in relative mode adjusts the absolution position - * but doesn't generate motion events. - */ - mouse->x = x; - mouse->y = y; - mouse->has_position = SDL_TRUE; - return; - } - /* Ignore the previous position when we warp */ mouse->has_position = SDL_FALSE; @@ -908,12 +846,6 @@ SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_r } } -void -SDL_WarpMouseInWindow(SDL_Window * window, int x, int y) -{ - SDL_PerformWarpMouseInWindow(window, x, y, SDL_FALSE); -} - int SDL_WarpMouseGlobal(int x, int y) { @@ -973,9 +905,8 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) if (enabled && focusWindow) { SDL_SetMouseFocus(focusWindow); - if (mouse->relative_mode_warp) { - SDL_PerformWarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2, SDL_TRUE); - } + if (mouse->relative_mode_warp) + SDL_WarpMouseInWindow(focusWindow, focusWindow->w/2, focusWindow->h/2); } if (focusWindow) { @@ -983,10 +914,8 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) /* Put the cursor back to where the application expects it */ if (!enabled) { - SDL_PerformWarpMouseInWindow(focusWindow, mouse->x, mouse->y, SDL_TRUE); + SDL_WarpMouseInWindow(focusWindow, mouse->x, mouse->y); } - - SDL_UpdateMouseCapture(SDL_FALSE); } if (!enabled) { @@ -1008,84 +937,39 @@ SDL_GetRelativeMouseMode() return mouse->relative_mode; } -int -SDL_UpdateMouseCapture(SDL_bool force_release) -{ - SDL_Mouse *mouse = SDL_GetMouse(); - SDL_Window *capture_window = NULL; - - if (!mouse->CaptureMouse) { - return 0; - } - - if (!force_release) { - if (SDL_GetMessageBoxCount() == 0 && - (mouse->capture_desired || (mouse->auto_capture && SDL_GetMouseState(NULL, NULL) != 0))) { - if (!mouse->relative_mode) { - capture_window = SDL_GetKeyboardFocus(); - } - } - } - - if (capture_window != mouse->capture_window) { - /* We can get here recursively on Windows, so make sure we complete - * all of the window state operations before we change the capture state - * (e.g. https://github.com/libsdl-org/SDL/pull/5608) - */ - SDL_Window *previous_capture = mouse->capture_window; - - if (previous_capture) { - previous_capture->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; - } - - if (capture_window) { - capture_window->flags |= SDL_WINDOW_MOUSE_CAPTURE; - } - - mouse->capture_window = capture_window; - - if (mouse->CaptureMouse(capture_window) < 0) { - /* CaptureMouse() will have set an error, just restore the state */ - if (previous_capture) { - previous_capture->flags |= SDL_WINDOW_MOUSE_CAPTURE; - } - if (capture_window) { - capture_window->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; - } - mouse->capture_window = previous_capture; - - return -1; - } - } - return 0; -} - int SDL_CaptureMouse(SDL_bool enabled) { SDL_Mouse *mouse = SDL_GetMouse(); + SDL_Window *focusWindow; + SDL_bool isCaptured; if (!mouse->CaptureMouse) { return SDL_Unsupported(); } -#ifdef __WIN32__ - /* Windows mouse capture is tied to the current thread, and must be called - * from the thread that created the window being captured. Since we update - * the mouse capture state from the event processing, any application state - * changes must be processed on that thread as well. - */ - if (!SDL_OnVideoThread()) { - return SDL_SetError("SDL_CaptureMouse() must be called on the main thread"); - } -#endif /* __WIN32__ */ + focusWindow = SDL_GetKeyboardFocus(); - if (enabled && SDL_GetKeyboardFocus() == NULL) { - return SDL_SetError("No window has focus"); + isCaptured = focusWindow && (focusWindow->flags & SDL_WINDOW_MOUSE_CAPTURE); + if (isCaptured == enabled) { + return 0; /* already done! */ } - mouse->capture_desired = enabled; - return SDL_UpdateMouseCapture(SDL_FALSE); + if (enabled) { + if (!focusWindow) { + return SDL_SetError("No window has focus"); + } else if (mouse->CaptureMouse(focusWindow) == -1) { + return -1; /* CaptureMouse() should call SetError */ + } + focusWindow->flags |= SDL_WINDOW_MOUSE_CAPTURE; + } else { + if (mouse->CaptureMouse(NULL) == -1) { + return -1; /* CaptureMouse() should call SetError */ + } + focusWindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + } + + return 0; } SDL_Cursor * @@ -1145,7 +1029,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y) SDL_Cursor *cursor; if (!surface) { - SDL_InvalidParamError("surface"); + SDL_SetError("Passed NULL cursor surface"); return NULL; } diff --git a/externals/SDL/src/events/SDL_mouse_c.h b/externals/SDL/src/events/SDL_mouse_c.h index 70c320851..b7fb9fd5b 100755 --- a/externals/SDL/src/events/SDL_mouse_c.h +++ b/externals/SDL/src/events/SDL_mouse_c.h @@ -100,12 +100,6 @@ typedef struct SDL_bool touch_mouse_events; SDL_bool mouse_touch_events; SDL_bool was_touch_mouse_events; /* Was a touch-mouse event pending? */ -#if defined(__vita__) - Uint8 vita_touch_mouse_device; -#endif - SDL_bool auto_capture; - SDL_bool capture_desired; - SDL_Window *capture_window; /* Data for input source state */ int num_sources; @@ -137,9 +131,6 @@ extern void SDL_SetDefaultCursor(SDL_Cursor * cursor); /* Set the mouse focus window */ extern void SDL_SetMouseFocus(SDL_Window * window); -/* Update the mouse capture window */ -extern int SDL_UpdateMouseCapture(SDL_bool force_release); - /* Send a mouse motion event */ extern int SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); @@ -152,9 +143,6 @@ extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, U /* Send a mouse wheel event */ extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); -/* Warp the mouse within the window, potentially overriding relative mode */ -extern void SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ignore_relative_mode); - /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); diff --git a/externals/SDL/src/events/SDL_touch.c b/externals/SDL/src/events/SDL_touch.c index ebf26e091..8b1cf3a6f 100755 --- a/externals/SDL/src/events/SDL_touch.c +++ b/externals/SDL/src/events/SDL_touch.c @@ -63,16 +63,6 @@ SDL_GetTouchDevice(int index) return SDL_touchDevices[index]->id; } -const char* -SDL_GetTouchName(int index) -{ - if (index < 0 || index >= SDL_num_touch) { - SDL_SetError("Unknown touch device"); - return NULL; - } - return SDL_touchDevices[index]->name; -} - static int SDL_GetTouchIndex(SDL_TouchID id) { @@ -195,7 +185,6 @@ SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name) SDL_touchDevices[index]->num_fingers = 0; SDL_touchDevices[index]->max_fingers = 0; SDL_touchDevices[index]->fingers = NULL; - SDL_touchDevices[index]->name = SDL_strdup(name ? name : ""); /* Record this touch device for gestures */ /* We could do this on the fly in the gesture code if we wanted */ @@ -265,13 +254,8 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, #if SYNTHESIZE_TOUCH_TO_MOUSE /* SDL_HINT_TOUCH_MOUSE_EVENTS: controlling whether touch events should generate synthetic mouse events */ - /* SDL_HINT_VITA_TOUCH_MOUSE_DEVICE: controlling which touchpad should generate synthetic mouse events, PSVita-only */ { -#if defined(__vita__) - if (mouse->touch_mouse_events && ((mouse->vita_touch_mouse_device == id) || (mouse->vita_touch_mouse_device == 2)) ) { -#else if (mouse->touch_mouse_events) { -#endif /* FIXME: maybe we should only restrict to a few SDL_TouchDeviceType */ if (id != SDL_MOUSE_TOUCHID) { if (window) { @@ -318,9 +302,8 @@ SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window * window, finger = SDL_GetFinger(touch, fingerid); if (down) { if (finger) { - /* This finger is already down. - Assume the finger-up for the previous touch was lost, and send it. */ - SDL_SendTouch(id, fingerid, window, SDL_FALSE, x, y, pressure); + /* This finger is already down */ + return 0; } if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) { @@ -468,7 +451,6 @@ SDL_DelTouch(SDL_TouchID id) SDL_free(touch->fingers[i]); } SDL_free(touch->fingers); - SDL_free(touch->name); SDL_free(touch); SDL_num_touch--; diff --git a/externals/SDL/src/events/SDL_touch_c.h b/externals/SDL/src/events/SDL_touch_c.h index 4d5caf134..c9d9a3265 100755 --- a/externals/SDL/src/events/SDL_touch_c.h +++ b/externals/SDL/src/events/SDL_touch_c.h @@ -31,7 +31,6 @@ typedef struct SDL_Touch int num_fingers; int max_fingers; SDL_Finger** fingers; - char *name; } SDL_Touch; diff --git a/externals/SDL/src/events/SDL_windowevents.c b/externals/SDL/src/events/SDL_windowevents.c index cc8b891df..cb82d4ffd 100755 --- a/externals/SDL/src/events/SDL_windowevents.c +++ b/externals/SDL/src/events/SDL_windowevents.c @@ -25,7 +25,7 @@ #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_mouse_c.h" -#include "SDL_hints.h" + static int SDLCALL RemovePendingSizeChangedAndResizedEvents(void * userdata, SDL_Event *event) @@ -201,9 +201,8 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, if (windowevent == SDL_WINDOWEVENT_CLOSE) { if ( !window->prev && !window->next ) { - if (SDL_GetHintBoolean(SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE, SDL_TRUE)) { - SDL_SendQuit(); /* This is the last window in the list so send the SDL_QUIT event */ - } + /* This is the last window in the list so send the SDL_QUIT event */ + SDL_SendQuit(); } } diff --git a/externals/SDL/src/events/scancodes_darwin.h b/externals/SDL/src/events/scancodes_darwin.h index 75564112a..a511e11c8 100755 --- a/externals/SDL/src/events/scancodes_darwin.h +++ b/externals/SDL/src/events/scancodes_darwin.h @@ -25,7 +25,7 @@ - Apple USB keyboard driver source - experimentation on various ADB and USB ISO keyboards and one ADB ANSI keyboard */ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ static const SDL_Scancode darwin_scancode_table[] = { /* 0 */ SDL_SCANCODE_A, /* 1 */ SDL_SCANCODE_S, @@ -156,4 +156,4 @@ static const SDL_Scancode darwin_scancode_table[] = { /* 126 */ SDL_SCANCODE_UP, /* 127 */ SDL_SCANCODE_POWER }; -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ diff --git a/externals/SDL/src/events/scancodes_linux.h b/externals/SDL/src/events/scancodes_linux.h index f274e993a..72637b239 100755 --- a/externals/SDL/src/events/scancodes_linux.h +++ b/externals/SDL/src/events/scancodes_linux.h @@ -24,7 +24,7 @@ Sources: - Linux kernel source input.h */ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ static SDL_Scancode const linux_scancode_table[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* 1 */ SDL_SCANCODE_ESCAPE, @@ -260,4 +260,4 @@ static SDL_Scancode const linux_scancode_table[] = { /* 235 */ SDL_SCANCODE_UNKNOWN, /* KEY_DOCUMENTS */ /* 236 */ SDL_SCANCODE_UNKNOWN, /* KEY_BATTERY */ }; -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ diff --git a/externals/SDL/src/events/scancodes_windows.h b/externals/SDL/src/events/scancodes_windows.h index 9fc7067a2..eec768d62 100755 --- a/externals/SDL/src/events/scancodes_windows.h +++ b/externals/SDL/src/events/scancodes_windows.h @@ -23,7 +23,7 @@ /* Windows scancode to SDL scancode mapping table */ /* derived from Microsoft scan code document, http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc */ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ static const SDL_Scancode windows_scancode_table[] = { /* 0 1 2 3 4 5 6 7 */ @@ -52,4 +52,4 @@ static const SDL_Scancode windows_scancode_table[] = SDL_SCANCODE_INTERNATIONAL2, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL1, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */ SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL4, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL5, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_INTERNATIONAL3, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */ }; -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ diff --git a/externals/SDL/src/events/scancodes_xfree86.h b/externals/SDL/src/events/scancodes_xfree86.h index 1ce2a8c57..7046b7a8f 100755 --- a/externals/SDL/src/events/scancodes_xfree86.h +++ b/externals/SDL/src/events/scancodes_xfree86.h @@ -28,7 +28,7 @@ Sources: - atKeyNames.h from XFree86 source code */ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ static const SDL_Scancode xfree86_scancode_table[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* 1 */ SDL_SCANCODE_ESCAPE, @@ -509,4 +509,4 @@ static const SDL_Scancode xvnc_scancode_table[] = { #endif /* scancodes_xfree86_h_ */ -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ diff --git a/externals/SDL/src/file/SDL_rwops.c b/externals/SDL/src/file/SDL_rwops.c index 0b4cc17b2..5187fae04 100755 --- a/externals/SDL/src/file/SDL_rwops.c +++ b/externals/SDL/src/file/SDL_rwops.c @@ -62,6 +62,235 @@ #include "nacl_io/nacl_io.h" #endif +#ifdef __VITA__ + +#include +#include + +#define READAHEAD_BUFFER_SIZE 1024 +static int SDLCALL +vita_file_open(SDL_RWops * context, const char *filename, const char *mode) +{ + int h; + int open_flags; + SDL_bool has_r; + SDL_bool has_w; + SDL_bool has_a; + SDL_bool has_plus; + + if (!context) + return -1; /* failed (invalid call) */ + + context->hidden.vitaio.h = -1; /* mark this as unusable */ + context->hidden.vitaio.buffer.data = NULL; + context->hidden.vitaio.buffer.size = 0; + context->hidden.vitaio.buffer.left = 0; + + open_flags = 0; + + /* "r" = reading, file must exist */ + /* "w" = writing, truncate existing, file may not exist */ + /* "r+"= reading or writing, file must exist */ + /* "a" = writing, append file may not exist */ + /* "a+"= append + read, file may not exist */ + /* "w+" = read, write, truncate. file may not exist */ + + has_r = SDL_strchr(mode, 'r') != NULL; + has_w = SDL_strchr(mode, 'w') != NULL; + has_a = SDL_strchr(mode, 'a') != NULL; + has_plus = SDL_strchr(mode, '+') != NULL; + + if (has_plus) + { + if (has_r || has_w || has_a) + { + open_flags |= SCE_O_RDWR; + } + } + else + { + if (has_r) + { + open_flags |= SCE_O_RDONLY; + } + if (has_w || has_a) + { + open_flags |= SCE_O_WRONLY; + } + } + if (has_w || has_a) + { + open_flags |= SCE_O_CREAT; + } + if (has_w) + { + open_flags |= SCE_O_TRUNC; + } + if (has_a) + { + open_flags |= SCE_O_APPEND; + } + + context->hidden.vitaio.buffer.data = + (char *) SDL_malloc(READAHEAD_BUFFER_SIZE); + if (!context->hidden.vitaio.buffer.data) { + return SDL_OutOfMemory(); + } + + /* Try to open the file on the filesystem first */ + h = sceIoOpen(filename, open_flags, 0777); + + if (h < 0) { + /* Try opening it from app0:/ container if it's a relative path */ + char path[4096]; + SDL_snprintf(path, 4096, "app0:/%s", filename); + h = sceIoOpen(path, open_flags, 0777); + } + + if (h < 0) { + SDL_free(context->hidden.vitaio.buffer.data); + context->hidden.vitaio.buffer.data = NULL; + SDL_SetError("Couldn't open %s", filename); + return -2; /* failed (sceIoOpen) */ + } + context->hidden.vitaio.h = h; + + return 0; /* ok */ +} + +static Sint64 SDLCALL +vita_file_size(SDL_RWops * context) +{ + SceIoStat st; + if (!context || context->hidden.vitaio.h < 0) { + return SDL_SetError("vita_file_size: invalid context/file not opened"); + } + + if (sceIoGetstatByFd(context->hidden.vitaio.h, &st) < 0) { + return SDL_SetError("vita_file_size: could not get file size"); + } + return st.st_size; +} + +static Sint64 SDLCALL +vita_file_seek(SDL_RWops * context, Sint64 offset, int whence) +{ + int vitawhence; + + if (!context || context->hidden.vitaio.h < 0) { + return SDL_SetError("vita_file_seek: invalid context/file not opened"); + } + + /* FIXME: We may be able to satisfy the seek within buffered data */ + if (whence == RW_SEEK_CUR && context->hidden.vitaio.buffer.left) { + offset -= (long)context->hidden.vitaio.buffer.left; + } + context->hidden.vitaio.buffer.left = 0; + + switch (whence) { + case RW_SEEK_SET: + vitawhence = SCE_SEEK_SET; + break; + case RW_SEEK_CUR: + vitawhence = SCE_SEEK_CUR; + break; + case RW_SEEK_END: + vitawhence = SCE_SEEK_END; + break; + default: + return SDL_SetError("vita_file_seek: Unknown value for 'whence'"); + } + + return sceIoLseek(context->hidden.vitaio.h, offset, vitawhence); +} + +static size_t SDLCALL +vita_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) +{ + size_t total_need; + size_t total_read = 0; + size_t read_ahead; + size_t byte_read; + + total_need = size * maxnum; + + if (!context || context->hidden.vitaio.h < 0 || !total_need) { + return 0; + } + + if (context->hidden.vitaio.buffer.left > 0) { + void *data = (char *) context->hidden.vitaio.buffer.data + + context->hidden.vitaio.buffer.size - + context->hidden.vitaio.buffer.left; + read_ahead = + SDL_min(total_need, context->hidden.vitaio.buffer.left); + SDL_memcpy(ptr, data, read_ahead); + context->hidden.vitaio.buffer.left -= read_ahead; + + if (read_ahead == total_need) { + return maxnum; + } + ptr = (char *) ptr + read_ahead; + total_need -= read_ahead; + total_read += read_ahead; + } + + if (total_need < READAHEAD_BUFFER_SIZE) { + byte_read = sceIoRead(context->hidden.vitaio.h, context->hidden.vitaio.buffer.data, READAHEAD_BUFFER_SIZE); + read_ahead = SDL_min(total_need, (int) byte_read); + SDL_memcpy(ptr, context->hidden.vitaio.buffer.data, read_ahead); + context->hidden.vitaio.buffer.size = byte_read; + context->hidden.vitaio.buffer.left = byte_read - read_ahead; + total_read += read_ahead; + } else { + byte_read = sceIoRead(context->hidden.vitaio.h, ptr, total_need); + total_read += byte_read; + } + return (total_read / size); +} + +static size_t SDLCALL +vita_file_write(SDL_RWops * context, const void *ptr, size_t size, + size_t num) +{ + + size_t total_bytes; + size_t byte_written; + size_t nwritten; + + total_bytes = size * num; + + if (!context || context->hidden.vitaio.h < 0 || !size || !total_bytes) { + return 0; + } + + if (context->hidden.vitaio.buffer.left) { + sceIoLseek(context->hidden.vitaio.h, -(SceOff)context->hidden.vitaio.buffer.left, SCE_SEEK_CUR); + context->hidden.vitaio.buffer.left = 0; + } + + byte_written = sceIoWrite(context->hidden.vitaio.h, ptr, total_bytes); + + nwritten = byte_written / size; + return nwritten; +} + +static int SDLCALL +vita_file_close(SDL_RWops * context) +{ + if (context) { + if (context->hidden.vitaio.h >= 0) { + sceIoClose(context->hidden.vitaio.h); + context->hidden.vitaio.h = -1; /* to be sure */ + } + SDL_free(context->hidden.vitaio.buffer.data); + context->hidden.vitaio.buffer.data = NULL; + SDL_FreeRW(context); + } + return 0; +} +#endif + #ifdef __WIN32__ /* Functions to read/write Win32 API file pointers */ @@ -588,9 +817,23 @@ SDL_RWFromFile(const char *file, const char *mode) rwops->write = windows_file_write; rwops->close = windows_file_close; rwops->type = SDL_RWOPS_WINFILE; +#elif defined(__VITA__) + rwops = SDL_AllocRW(); + if (!rwops) + return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ + if (vita_file_open(rwops, file, mode) < 0) { + SDL_FreeRW(rwops); + return NULL; + } + rwops->size = vita_file_size; + rwops->seek = vita_file_seek; + rwops->read = vita_file_read; + rwops->write = vita_file_write; + rwops->close = vita_file_close; + rwops->type = SDL_RWOPS_VITAFILE; #elif HAVE_STDIO_H { - #if __APPLE__ && !SDL_FILE_DISABLED // TODO: add dummy? + #ifdef __APPLE__ FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode); #elif __WINRT__ FILE *fp = NULL; diff --git a/externals/SDL/src/filesystem/os2/SDL_sysfilesystem.c b/externals/SDL/src/filesystem/os2/SDL_sysfilesystem.c index 3203f0b3a..e8050cbec 100755 --- a/externals/SDL/src/filesystem/os2/SDL_sysfilesystem.c +++ b/externals/SDL/src/filesystem/os2/SDL_sysfilesystem.c @@ -31,7 +31,6 @@ #define INCL_DOSFILEMGR #define INCL_DOSPROCESS -#define INCL_DOSMODULEMGR #define INCL_DOSERRORS #include @@ -43,31 +42,30 @@ SDL_GetBasePath(void) PPIB pib; ULONG ulRC = DosGetInfoBlocks(&tib, &pib); PCHAR pcEnd; + ULONG cbResult; CHAR acBuf[CCHMAXPATH]; if (ulRC != NO_ERROR) { - SDL_SetError("Can't get process information block (E%lu)", ulRC); + debug_os2("DosGetInfoBlocks() failed, rc = %u", ulRC); return NULL; } - ulRC = DosQueryModuleName(pib->pib_hmte, sizeof(acBuf), acBuf); - if (ulRC != NO_ERROR) { - SDL_SetError("Can't query the module name (E%lu)", ulRC); - return NULL; - } - - pcEnd = SDL_strrchr(acBuf, '\\'); + pcEnd = SDL_strrchr(pib->pib_pchcmd, '\\'); if (pcEnd != NULL) - pcEnd[1] = '\0'; + pcEnd++; else { - if (acBuf[1] == ':') /* e.g. "C:FOO" */ - acBuf[2] = '\0'; + if (pib->pib_pchcmd[1] == ':') + pcEnd = &pib->pib_pchcmd[2]; else { - SDL_SetError("No path in module name"); + SDL_SetError("No path in pib->pib_pchcmd"); return NULL; } } + cbResult = pcEnd - pib->pib_pchcmd; + SDL_memcpy(acBuf, pib->pib_pchcmd, cbResult); + acBuf[cbResult] = '\0'; + return OS2_SysToUTF8(acBuf); } diff --git a/externals/SDL/src/filesystem/psp/SDL_sysfilesystem.c b/externals/SDL/src/filesystem/psp/SDL_sysfilesystem.c index 4abb90ad7..e9c6ee49e 100755 --- a/externals/SDL/src/filesystem/psp/SDL_sysfilesystem.c +++ b/externals/SDL/src/filesystem/psp/SDL_sysfilesystem.c @@ -34,44 +34,44 @@ char * SDL_GetBasePath(void) { - char *retval = NULL; - size_t len; - char cwd[FILENAME_MAX]; + char *retval = NULL; + size_t len; + char cwd[FILENAME_MAX]; + + getcwd(cwd, sizeof(cwd)); + len = SDL_strlen(cwd) + 2; + retval = (char *) SDL_malloc(len); + SDL_snprintf(retval, len, "%s/", cwd); - getcwd(cwd, sizeof(cwd)); - len = SDL_strlen(cwd) + 2; - retval = (char *) SDL_malloc(len); - SDL_snprintf(retval, len, "%s/", cwd); - - return retval; + return retval; } char * SDL_GetPrefPath(const char *org, const char *app) { - char *retval = NULL; - size_t len; - char *base = SDL_GetBasePath(); - if (!app) { - SDL_InvalidParamError("app"); - return NULL; - } - if(!org) { - org = ""; - } + char *retval = NULL; + size_t len; + char *base = SDL_GetBasePath(); + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if(!org) { + org = ""; + } - len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4; - retval = (char *) SDL_malloc(len); + len = SDL_strlen(base) + SDL_strlen(org) + SDL_strlen(app) + 4; + retval = (char *) SDL_malloc(len); - if (*org) { - SDL_snprintf(retval, len, "%s%s/%s/", base, org, app); - } else { - SDL_snprintf(retval, len, "%s%s/", base, app); - } - free(base); + if (*org) { + SDL_snprintf(retval, len, "%s%s/%s/", base, org, app); + } else { + SDL_snprintf(retval, len, "%s%s/", base, app); + } + free(base); - mkdir(retval, 0755); - return retval; + mkdir(retval, 0755); + return retval; } #endif /* SDL_FILESYSTEM_PSP */ diff --git a/externals/SDL/src/filesystem/windows/SDL_sysfilesystem.c b/externals/SDL/src/filesystem/windows/SDL_sysfilesystem.c index b57546c67..d50fb511b 100755 --- a/externals/SDL/src/filesystem/windows/SDL_sysfilesystem.c +++ b/externals/SDL/src/filesystem/windows/SDL_sysfilesystem.c @@ -35,23 +35,39 @@ char * SDL_GetBasePath(void) { + typedef DWORD (WINAPI *GetModuleFileNameExW_t)(HANDLE, HMODULE, LPWSTR, DWORD); + GetModuleFileNameExW_t pGetModuleFileNameExW; DWORD buflen = 128; WCHAR *path = NULL; + HANDLE psapi = LoadLibrary(TEXT("psapi.dll")); char *retval = NULL; DWORD len = 0; int i; + if (!psapi) { + WIN_SetError("Couldn't load psapi.dll"); + return NULL; + } + + pGetModuleFileNameExW = (GetModuleFileNameExW_t)GetProcAddress(psapi, "GetModuleFileNameExW"); + if (!pGetModuleFileNameExW) { + WIN_SetError("Couldn't find GetModuleFileNameExW"); + FreeLibrary(psapi); + return NULL; + } + while (SDL_TRUE) { void *ptr = SDL_realloc(path, buflen * sizeof (WCHAR)); if (!ptr) { SDL_free(path); + FreeLibrary(psapi); SDL_OutOfMemory(); return NULL; } path = (WCHAR *) ptr; - len = GetModuleFileNameW(NULL, path, buflen); + len = pGetModuleFileNameExW(GetCurrentProcess(), NULL, path, buflen); /* if it truncated, then len >= buflen - 1 */ /* if there was enough room (or failure), len < buflen - 1 */ if (len < buflen - 1) { @@ -62,6 +78,8 @@ SDL_GetBasePath(void) buflen *= 2; } + FreeLibrary(psapi); + if (len == 0) { SDL_free(path); WIN_SetError("Couldn't locate our .exe"); diff --git a/externals/SDL/src/haptic/windows/SDL_dinputhaptic.c b/externals/SDL/src/haptic/windows/SDL_dinputhaptic.c index f10c369af..0ae71f4a9 100755 --- a/externals/SDL/src/haptic/windows/SDL_dinputhaptic.c +++ b/externals/SDL/src/haptic/windows/SDL_dinputhaptic.c @@ -492,7 +492,8 @@ SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) ++index; } - return SDL_SetError("Couldn't find joystick in haptic device list"); + SDL_SetError("Couldn't find joystick in haptic device list"); + return -1; } void @@ -958,7 +959,8 @@ SDL_DINPUT_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect, SD REFGUID type = SDL_SYS_HapticEffectType(base); if (type == NULL) { - return SDL_SetError("Haptic: Unknown effect type."); + SDL_SetError("Haptic: Unknown effect type."); + return -1; } /* Get the effect. */ diff --git a/externals/SDL/src/haptic/windows/SDL_xinputhaptic.c b/externals/SDL/src/haptic/windows/SDL_xinputhaptic.c index 9212fbf32..2e1da5987 100755 --- a/externals/SDL/src/haptic/windows/SDL_xinputhaptic.c +++ b/externals/SDL/src/haptic/windows/SDL_xinputhaptic.c @@ -246,7 +246,8 @@ SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) ++index; } - return SDL_SetError("Couldn't find joystick in haptic device list"); + SDL_SetError("Couldn't find joystick in haptic device list"); + return -1; } void diff --git a/externals/SDL/src/hidapi/SDL_hidapi.c b/externals/SDL/src/hidapi/SDL_hidapi.c index d65611779..aacff63bf 100755 --- a/externals/SDL/src/hidapi/SDL_hidapi.c +++ b/externals/SDL/src/hidapi/SDL_hidapi.c @@ -951,7 +951,6 @@ DeleteHIDDeviceWrapper(SDL_hid_device *device) } #if !SDL_HIDAPI_DISABLED -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(SDL_LIBUSB_DYNAMIC) #define COPY_IF_EXISTS(var) \ if (pSrc->var != NULL) { \ @@ -988,7 +987,6 @@ CopyHIDDeviceInfo(struct SDL_hid_device_info *pSrc, struct SDL_hid_device_info * #undef COPY_IF_EXISTS #undef WCOPY_IF_EXISTS -#endif /* HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || SDL_LIBUSB_DYNAMIC */ #endif /* !SDL_HIDAPI_DISABLED */ static int SDL_hidapi_refcount = 0; @@ -1034,60 +1032,54 @@ int SDL_hid_init(void) #endif #ifdef SDL_LIBUSB_DYNAMIC - if (SDL_getenv("SDL_HIDAPI_DISABLE_LIBUSB") != NULL) { - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "libusb disabled by SDL_HIDAPI_DISABLE_LIBUSB"); - libusb_ctx.libhandle = NULL; - } else { - ++attempts; - libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC); - if (libusb_ctx.libhandle != NULL) { - SDL_bool loaded = SDL_TRUE; - #ifdef __OS2__ - #define LOAD_LIBUSB_SYMBOL(func) \ - if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle,"_libusb_" #func))) {loaded = SDL_FALSE;} - #else - #define LOAD_LIBUSB_SYMBOL(func) \ - if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;} - #endif - LOAD_LIBUSB_SYMBOL(init) - LOAD_LIBUSB_SYMBOL(exit) - LOAD_LIBUSB_SYMBOL(get_device_list) - LOAD_LIBUSB_SYMBOL(free_device_list) - LOAD_LIBUSB_SYMBOL(get_device_descriptor) - LOAD_LIBUSB_SYMBOL(get_active_config_descriptor) - LOAD_LIBUSB_SYMBOL(get_config_descriptor) - LOAD_LIBUSB_SYMBOL(free_config_descriptor) - LOAD_LIBUSB_SYMBOL(get_bus_number) - LOAD_LIBUSB_SYMBOL(get_device_address) - LOAD_LIBUSB_SYMBOL(open) - LOAD_LIBUSB_SYMBOL(close) - LOAD_LIBUSB_SYMBOL(claim_interface) - LOAD_LIBUSB_SYMBOL(release_interface) - LOAD_LIBUSB_SYMBOL(kernel_driver_active) - LOAD_LIBUSB_SYMBOL(detach_kernel_driver) - LOAD_LIBUSB_SYMBOL(attach_kernel_driver) - LOAD_LIBUSB_SYMBOL(set_interface_alt_setting) - LOAD_LIBUSB_SYMBOL(alloc_transfer) - LOAD_LIBUSB_SYMBOL(submit_transfer) - LOAD_LIBUSB_SYMBOL(cancel_transfer) - LOAD_LIBUSB_SYMBOL(free_transfer) - LOAD_LIBUSB_SYMBOL(control_transfer) - LOAD_LIBUSB_SYMBOL(interrupt_transfer) - LOAD_LIBUSB_SYMBOL(handle_events) - LOAD_LIBUSB_SYMBOL(handle_events_completed) - #undef LOAD_LIBUSB_SYMBOL + ++attempts; + libusb_ctx.libhandle = SDL_LoadObject(SDL_LIBUSB_DYNAMIC); + if (libusb_ctx.libhandle != NULL) { + SDL_bool loaded = SDL_TRUE; + #ifdef __OS2__ + #define LOAD_LIBUSB_SYMBOL(func) \ + if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle,"_libusb_" #func))) {loaded = SDL_FALSE;} + #else + #define LOAD_LIBUSB_SYMBOL(func) \ + if (!(libusb_ctx.func = SDL_LoadFunction(libusb_ctx.libhandle, "libusb_" #func))) {loaded = SDL_FALSE;} + #endif + LOAD_LIBUSB_SYMBOL(init) + LOAD_LIBUSB_SYMBOL(exit) + LOAD_LIBUSB_SYMBOL(get_device_list) + LOAD_LIBUSB_SYMBOL(free_device_list) + LOAD_LIBUSB_SYMBOL(get_device_descriptor) + LOAD_LIBUSB_SYMBOL(get_active_config_descriptor) + LOAD_LIBUSB_SYMBOL(get_config_descriptor) + LOAD_LIBUSB_SYMBOL(free_config_descriptor) + LOAD_LIBUSB_SYMBOL(get_bus_number) + LOAD_LIBUSB_SYMBOL(get_device_address) + LOAD_LIBUSB_SYMBOL(open) + LOAD_LIBUSB_SYMBOL(close) + LOAD_LIBUSB_SYMBOL(claim_interface) + LOAD_LIBUSB_SYMBOL(release_interface) + LOAD_LIBUSB_SYMBOL(kernel_driver_active) + LOAD_LIBUSB_SYMBOL(detach_kernel_driver) + LOAD_LIBUSB_SYMBOL(attach_kernel_driver) + LOAD_LIBUSB_SYMBOL(set_interface_alt_setting) + LOAD_LIBUSB_SYMBOL(alloc_transfer) + LOAD_LIBUSB_SYMBOL(submit_transfer) + LOAD_LIBUSB_SYMBOL(cancel_transfer) + LOAD_LIBUSB_SYMBOL(free_transfer) + LOAD_LIBUSB_SYMBOL(control_transfer) + LOAD_LIBUSB_SYMBOL(interrupt_transfer) + LOAD_LIBUSB_SYMBOL(handle_events) + LOAD_LIBUSB_SYMBOL(handle_events_completed) + #undef LOAD_LIBUSB_SYMBOL - if (!loaded) { - SDL_UnloadObject(libusb_ctx.libhandle); - libusb_ctx.libhandle = NULL; - /* SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, SDL_LIBUSB_DYNAMIC " found but could not load function"); */ - } else if (LIBUSB_hid_init() < 0) { - SDL_UnloadObject(libusb_ctx.libhandle); - libusb_ctx.libhandle = NULL; - } else { - ++success; - } + if (!loaded) { + SDL_UnloadObject(libusb_ctx.libhandle); + libusb_ctx.libhandle = NULL; + /* SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, SDL_LIBUSB_DYNAMIC " found but could not load function"); */ + } else if (LIBUSB_hid_init() < 0) { + SDL_UnloadObject(libusb_ctx.libhandle); + libusb_ctx.libhandle = NULL; + } else { + ++success; } } #endif /* SDL_LIBUSB_DYNAMIC */ @@ -1193,9 +1185,9 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned #ifdef SDL_LIBUSB_DYNAMIC if (libusb_ctx.libhandle) { usb_devs = LIBUSB_hid_enumerate(vendor_id, product_id); -#ifdef DEBUG_HIDAPI + #ifdef DEBUG_HIDAPI SDL_Log("libusb devices found:"); -#endif + #endif for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) { new_dev = (struct SDL_hid_device_info*) SDL_malloc(sizeof(struct SDL_hid_device_info)); if (!new_dev) { @@ -1205,11 +1197,11 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned return NULL; } CopyHIDDeviceInfo(usb_dev, new_dev); -#ifdef DEBUG_HIDAPI + #ifdef DEBUG_HIDAPI SDL_Log(" - %ls %ls 0x%.4hx 0x%.4hx", usb_dev->manufacturer_string, usb_dev->product_string, usb_dev->vendor_id, usb_dev->product_id); -#endif + #endif if (last != NULL) { last->next = new_dev; @@ -1530,7 +1522,7 @@ int SDL_hid_get_indexed_string(SDL_hid_device *device, int string_index, wchar_t void SDL_hid_ble_scan(SDL_bool active) { -#if !SDL_HIDAPI_DISABLED && (__IPHONEOS__ || __TVOS__) +#if __IPHONEOS__ || __TVOS__ hid_ble_scan(active); #endif } diff --git a/externals/SDL/src/hidapi/android/hid.cpp b/externals/SDL/src/hidapi/android/hid.cpp index de365d005..faed88554 100755 --- a/externals/SDL/src/hidapi/android/hid.cpp +++ b/externals/SDL/src/hidapi/android/hid.cpp @@ -24,30 +24,6 @@ // // This layer glues the hidapi API to Android's USB and BLE stack. - -// Common to stub version and non-stub version of functions -#include -#include - -#define TAG "hidapi" - -// Have error log always available -#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) - -#ifdef DEBUG -#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) -#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) -#else -#define LOGV(...) -#define LOGD(...) -#endif - -#define SDL_JAVA_PREFIX org_libsdl_app -#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) -#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function -#define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) - - #if !SDL_HIDAPI_DISABLED #include "SDL_hints.h" @@ -72,10 +48,30 @@ #define hid_get_indexed_string PLATFORM_hid_get_indexed_string #define hid_error PLATFORM_hid_error +#include +#include #include #include // For ETIMEDOUT and ECONNRESET #include // For malloc() and free() +#define TAG "hidapi" + +// Have error log always available +#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) + +#ifdef DEBUG +#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__) +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) +#else +#define LOGV(...) +#define LOGD(...) +#endif + +#define SDL_JAVA_PREFIX org_libsdl_app +#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) +#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function +#define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) + #include "../hidapi/hidapi.h" typedef uint32_t uint32; @@ -1340,79 +1336,4 @@ int hid_exit(void) } -#else - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz); - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReleaseCallback)(JNIEnv *env, jobject thiz); - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceConnected)(JNIEnv *env, jobject thiz, int nDeviceID, jstring sIdentifier, int nVendorId, int nProductId, jstring sSerialNumber, int nReleaseNumber, jstring sManufacturer, jstring sProduct, int nInterface, int nInterfaceClass, int nInterfaceSubclass, int nInterfaceProtocol ); - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenPending)(JNIEnv *env, jobject thiz, int nDeviceID); - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenResult)(JNIEnv *env, jobject thiz, int nDeviceID, bool bOpened); - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceDisconnected)(JNIEnv *env, jobject thiz, int nDeviceID); - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value); - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceFeatureReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value); - - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceRegisterCallback)(JNIEnv *env, jobject thiz ) -{ - LOGV("Stub HIDDeviceRegisterCallback()"); -} - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceReleaseCallback)(JNIEnv *env, jobject thiz) -{ - LOGV("Stub HIDDeviceReleaseCallback()"); -} - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceConnected)(JNIEnv *env, jobject thiz, int nDeviceID, jstring sIdentifier, int nVendorId, int nProductId, jstring sSerialNumber, int nReleaseNumber, jstring sManufacturer, jstring sProduct, int nInterface, int nInterfaceClass, int nInterfaceSubclass, int nInterfaceProtocol ) -{ - LOGV("Stub HIDDeviceConnected() id=%d VID/PID = %.4x/%.4x, interface %d\n", nDeviceID, nVendorId, nProductId, nInterface); -} - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenPending)(JNIEnv *env, jobject thiz, int nDeviceID) -{ - LOGV("Stub HIDDeviceOpenPending() id=%d\n", nDeviceID); -} - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceOpenResult)(JNIEnv *env, jobject thiz, int nDeviceID, bool bOpened) -{ - LOGV("Stub HIDDeviceOpenResult() id=%d, result=%s\n", nDeviceID, bOpened ? "true" : "false"); -} - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceDisconnected)(JNIEnv *env, jobject thiz, int nDeviceID) -{ - LOGV("Stub HIDDeviceDisconnected() id=%d\n", nDeviceID); -} - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceInputReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value) -{ - LOGV("Stub HIDDeviceInput() id=%d len=%u\n", nDeviceID, nBufSize); -} - -extern "C" -JNIEXPORT void JNICALL HID_DEVICE_MANAGER_JAVA_INTERFACE(HIDDeviceFeatureReport)(JNIEnv *env, jobject thiz, int nDeviceID, jbyteArray value) -{ - LOGV("Stub HIDDeviceFeatureReport() id=%d len=%u\n", nDeviceID, nBufSize); -} - #endif /* SDL_HIDAPI_DISABLED */ diff --git a/externals/SDL/src/hidapi/libusb/hid.c b/externals/SDL/src/hidapi/libusb/hid.c index 463060730..d4fd9da69 100755 --- a/externals/SDL/src/hidapi/libusb/hid.c +++ b/externals/SDL/src/hidapi/libusb/hid.c @@ -31,24 +31,9 @@ #include "SDL_thread.h" #include "SDL_mutex.h" -#ifndef HAVE_WCSDUP -#ifdef HAVE__WCSDUP +#if defined(HAVE__WCSDUP) && !defined(HAVE_WCSDUP) #define wcsdup _wcsdup -#else -#define wcsdup _dupwcs -static wchar_t *_dupwcs(const wchar_t *src) -{ - wchar_t *dst = NULL; - if (src) { - size_t len = SDL_wcslen(src) + 1; - len *= sizeof(wchar_t); - dst = (wchar_t *) malloc(len); - if (dst) memcpy(dst, src, len); - } - return dst; -} #endif -#endif /* HAVE_WCSDUP */ #include #include /* setlocale */ @@ -74,8 +59,12 @@ typedef struct _SDL_ThreadBarrier static int SDL_CreateThreadBarrier(SDL_ThreadBarrier *barrier, Uint32 count) { - SDL_assert(barrier != NULL); - SDL_assert(count != 0); + if (barrier == NULL) { + return SDL_SetError("barrier must be non-NULL"); + } + if (count == 0) { + return SDL_SetError("count must be > 0"); + } barrier->mutex = SDL_CreateMutex(); if (barrier->mutex == NULL) { @@ -384,16 +373,12 @@ static int is_language_supported(libusb_device_handle *dev, uint16_t lang) /* This function returns a newly allocated wide string containing the USB device string numbered by the index. The returned string must be freed by using free(). */ -#if defined(__OS2__) /* don't use iconv on OS/2: no support for wchar_t. */ -#define NO_ICONV -#endif static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) { char buf[512]; int len; wchar_t *str = NULL; -#if !defined(NO_ICONV) wchar_t wbuf[256]; SDL_iconv_t ic; size_t inbytes; @@ -401,9 +386,6 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) size_t res; const char *inptr; char *outptr; -#else - int i; -#endif /* Determine which language to use. */ uint16_t lang; @@ -420,23 +402,6 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) if (len < 0) return NULL; -#if defined(NO_ICONV) /* original hidapi code for NO_ICONV : */ - - /* Bionic does not have wchar_t iconv support, so it - has to be done manually. The following code will only work for - code points that can be represented as a single UTF-16 character, - and will incorrectly convert any code points which require more - than one UTF-16 character. - - Skip over the first character (2-bytes). */ - len -= 2; - str = (wchar_t*) malloc((len / 2 + 1) * sizeof(wchar_t)); - for (i = 0; i < len / 2; i++) { - str[i] = buf[i * 2 + 2] | (buf[i * 2 + 3] << 8); - } - str[len / 2] = 0x00000000; - -#else /* buf does not need to be explicitly NULL-terminated because it is only passed into iconv() which does not need it. */ @@ -469,7 +434,6 @@ static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx) err: SDL_iconv_close(ic); -#endif return str; } @@ -635,7 +599,6 @@ static int is_xbox360(unsigned short vendor_id, const struct libusb_interface_de 0x1bad, /* Harmonix */ 0x20d6, /* PowerA */ 0x24c6, /* PowerA */ - 0x2c22, /* Qanba */ }; if (intf_desc->bInterfaceClass == LIBUSB_CLASS_VENDOR_SPEC && @@ -995,7 +958,7 @@ static void LIBUSB_CALL read_callback(struct libusb_transfer *transfer) } -static int SDLCALL read_thread(void *param) +static int read_thread(void *param) { hid_device *dev = (hid_device *)param; uint8_t *buf; @@ -1498,7 +1461,6 @@ void HID_API_EXPORT hid_close(hid_device *dev) /* Clean up the Transfer objects allocated in read_thread(). */ free(dev->transfer->buffer); - dev->transfer->buffer = NULL; libusb_free_transfer(dev->transfer); /* release the interface */ diff --git a/externals/SDL/src/hidapi/mac/hid.c b/externals/SDL/src/hidapi/mac/hid.c index ec7ffaf16..19314a6e0 100755 --- a/externals/SDL/src/hidapi/mac/hid.c +++ b/externals/SDL/src/hidapi/mac/hid.c @@ -259,7 +259,7 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t buf[0] = 0; - if (str && CFGetTypeID(str) == CFStringGetTypeID()) { + if (str) { len --; CFIndex str_len = CFStringGetLength(str); @@ -298,7 +298,7 @@ static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, cha buf[0] = 0; - if (str && CFGetTypeID(str) == CFStringGetTypeID()) { + if (str) { len--; CFIndex str_len = CFStringGetLength(str); @@ -326,7 +326,10 @@ static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, cha static int get_serial_number(IOHIDDeviceRef device, wchar_t *buf, size_t len) { - return get_string_property(device, CFSTR(kIOHIDSerialNumberKey), buf, len); + // This crashes on M1 Macs, tracked by radar bug 79667729 + //return get_string_property(device, CFSTR(kIOHIDSerialNumberKey), buf, len); + buf[0] = 0; + return 0; } static int get_manufacturer_string(IOHIDDeviceRef device, wchar_t *buf, size_t len) @@ -554,7 +557,6 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, continue; } -#if 0 // Prefer direct HID support as that has extended functionality #if defined(SDL_JOYSTICK_MFI) // We want to prefer Game Controller support where available, // as Apple will likely be requiring that for supported devices. @@ -562,7 +564,6 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, if (IOS_SupportedHIDDevice(dev)) { continue; } -#endif #endif dev_vid = get_vendor_id(dev); @@ -572,7 +573,8 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, if ((vendor_id == 0x0 && product_id == 0x0) || (vendor_id == dev_vid && product_id == dev_pid)) { struct hid_device_info *tmp; - + size_t len; + /* VID/PID match. Create the record. */ tmp = (struct hid_device_info *)calloc(1, sizeof(struct hid_device_info)); if (cur_dev) { @@ -589,7 +591,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, /* Fill out the record */ cur_dev->next = NULL; - make_path(dev, cbuf, sizeof(cbuf)); + len = make_path(dev, cbuf, sizeof(cbuf)); cur_dev->path = strdup(cbuf); /* Serial Number */ @@ -816,9 +818,10 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) CFSetGetValues(device_set, (const void **) device_array); for (i = 0; i < num_devices; i++) { char cbuf[BUF_LEN]; + size_t len; IOHIDDeviceRef os_dev = device_array[i]; - make_path(os_dev, cbuf, sizeof(cbuf)); + len = make_path(os_dev, cbuf, sizeof(cbuf)); if (!strcmp(cbuf, path)) { // Matched Paths. Open this Device. IOReturn ret = IOHIDDeviceOpen(os_dev, kIOHIDOptionsTypeNone); @@ -831,7 +834,6 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive) /* Create the buffers for receiving data */ dev->max_input_report_len = (CFIndex) get_max_report_length(os_dev); - SDL_assert(dev->max_input_report_len > 0); dev->input_report_buf = (uint8_t *)calloc(dev->max_input_report_len, sizeof(uint8_t)); /* Create the Run Loop Mode for this device. @@ -935,14 +937,11 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length) /* Copy the data out of the linked list item (rpt) into the return buffer (data), and delete the liked list item. */ struct input_report *rpt = dev->input_reports; - size_t len = 0; - if (rpt != NULL) { - len = (length < rpt->len)? length: rpt->len; - memcpy(data, rpt->data, len); - dev->input_reports = rpt->next; - free(rpt->data); - free(rpt); - } + size_t len = (length < rpt->len)? length: rpt->len; + memcpy(data, rpt->data, len); + dev->input_reports = rpt->next; + free(rpt->data); + free(rpt); return (int)len; } diff --git a/externals/SDL/src/hidapi/windows/hid.c b/externals/SDL/src/hidapi/windows/hid.c index 8dfd11d05..f0a30c7d1 100755 --- a/externals/SDL/src/hidapi/windows/hid.c +++ b/externals/SDL/src/hidapi/windows/hid.c @@ -43,6 +43,21 @@ typedef LONG NTSTATUS; #endif +/* SDL C runtime functions */ +#include "SDL_stdinc.h" + +#define calloc SDL_calloc +#define free SDL_free +#define malloc SDL_malloc +#define memcpy SDL_memcpy +#define memset SDL_memset +#define strcmp SDL_strcmp +#define strlen SDL_strlen +#define strstr SDL_strstr +#define strtol SDL_strtol +#define wcscmp SDL_wcscmp +#define _wcsdup SDL_wcsdup + /* The maximum number of characters that can be passed into the HidD_Get*String() functions without it failing.*/ #define MAX_STRING_WCHARS 0xFFF @@ -79,26 +94,11 @@ extern "C" { } /* extern "C" */ #endif -#include "../hidapi/hidapi.h" - /*#include */ /*#include */ -/* SDL C runtime functions */ -#include "SDL_stdinc.h" - -#define calloc SDL_calloc -#define free SDL_free -#define malloc SDL_malloc -#define memcpy SDL_memcpy -#define memset SDL_memset -#define strcmp SDL_strcmp -#define strlen SDL_strlen -#define strstr SDL_strstr -#define strtol SDL_strtol -#define wcscmp SDL_wcscmp -#define _wcsdup SDL_wcsdup +#include "../hidapi/hidapi.h" #undef MIN #define MIN(x,y) ((x) < (y)? (x): (y)) diff --git a/externals/SDL/src/joystick/SDL_gamecontroller.c b/externals/SDL/src/joystick/SDL_gamecontroller.c index 2472695a8..e27922a6d 100755 --- a/externals/SDL/src/joystick/SDL_gamecontroller.c +++ b/externals/SDL/src/joystick/SDL_gamecontroller.c @@ -28,7 +28,6 @@ #include "SDL_sysjoystick.h" #include "SDL_joystick_c.h" #include "SDL_gamecontrollerdb.h" -#include "controller_type.h" #include "usb_ids.h" #if !SDL_EVENTS_DISABLED @@ -587,12 +586,6 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI (vendor == USB_VENDOR_SHENZHEN && product == USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER)) { /* GameCube driver has 12 buttons and 6 axes */ SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3,start:b8,x:b2,y:b3,", sizeof(mapping_string)); - } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_N64_CONTROLLER) { - SDL_strlcat(mapping_string, "a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,misc1:b15,", sizeof(mapping_string)); - } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER) { - SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,rightshoulder:b10,righttrigger:a5,start:b6,misc1:b15,", sizeof(mapping_string)); - } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SNES_CONTROLLER) { - SDL_strlcat(mapping_string, "a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,lefttrigger:a4,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,", sizeof(mapping_string)); } else { /* All other controllers have the standard set of 19 buttons and 6 axes */ SDL_strlcat(mapping_string, "a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", sizeof(mapping_string)); @@ -653,20 +646,12 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI */ static ControllerMapping_t *SDL_CreateMappingForRAWINPUTController(SDL_JoystickGUID guid) { - Uint16 vendor; - Uint16 product; SDL_bool existing; char mapping_string[1024]; - SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); - SDL_strlcpy(mapping_string, "none,*,", sizeof(mapping_string)); - if (GuessControllerType(vendor, product) == k_eControllerType_XInputSwitchController && - SDL_GetHintBoolean(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, SDL_TRUE)) { - SDL_strlcat(mapping_string, "a:b1,b:b0,x:b3,y:b2,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", sizeof(mapping_string)); - } else { - SDL_strlcat(mapping_string, "a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", sizeof(mapping_string)); - } + SDL_strlcat(mapping_string, "a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", sizeof(mapping_string)); + return SDL_PrivateAddMappingForGUID(guid, mapping_string, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } @@ -711,20 +696,19 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG return s_pXInputMapping; } #endif - if (!mapping) { - if (SDL_IsJoystickHIDAPI(guid)) { - mapping = SDL_CreateMappingForHIDAPIController(guid); - } else if (SDL_IsJoystickRAWINPUT(guid)) { - mapping = SDL_CreateMappingForRAWINPUTController(guid); - } else if (SDL_IsJoystickWGI(guid)) { - mapping = SDL_CreateMappingForWGIController(guid); - } else if (SDL_IsJoystickVirtual(guid)) { - /* We'll pick up a robust mapping in VIRTUAL_JoystickGetGamepadMapping */ #ifdef __ANDROID__ - } else { - mapping = SDL_CreateMappingForAndroidController(guid); + if (!mapping && !SDL_IsJoystickHIDAPI(guid)) { + mapping = SDL_CreateMappingForAndroidController(guid); + } #endif - } + if (!mapping && SDL_IsJoystickHIDAPI(guid)) { + mapping = SDL_CreateMappingForHIDAPIController(guid); + } + if (!mapping && SDL_IsJoystickRAWINPUT(guid)) { + mapping = SDL_CreateMappingForRAWINPUTController(guid); + } + if (!mapping && SDL_IsJoystickWGI(guid)) { + mapping = SDL_CreateMappingForWGIController(guid); } } return mapping; @@ -1274,11 +1258,6 @@ static ControllerMapping_t *SDL_PrivateGenerateAutomaticControllerMapping(const SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "dpdown", &raw_map->dpdown); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "dpleft", &raw_map->dpleft); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "dpright", &raw_map->dpright); - SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "misc1", &raw_map->misc1); - SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle1", &raw_map->paddle1); - SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle2", &raw_map->paddle2); - SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle3", &raw_map->paddle3); - SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "paddle4", &raw_map->paddle4); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "leftx", &raw_map->leftx); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "lefty", &raw_map->lefty); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "rightx", &raw_map->rightx); @@ -1753,20 +1732,6 @@ SDL_GameControllerNameForIndex(int device_index) } -/* - * Get the implementation dependent path of a controller - */ -const char * -SDL_GameControllerPathForIndex(int device_index) -{ - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); - if (pSupportedController) { - return SDL_JoystickPathForIndex(device_index); - } - return NULL; -} - - /** * Get the type of a game controller. */ @@ -1855,10 +1820,12 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) } #endif +#if defined(__ANDROID__) if (name && SDL_strcmp(name, "uinput-fpc") == 0) { /* The Google Pixel fingerprint sensor reports itself as a joystick */ return SDL_TRUE; } +#endif if (SDL_allowed_controllers.num_entries == 0 && SDL_ignored_controllers.num_entries == 0) { @@ -2327,15 +2294,6 @@ SDL_GameControllerName(SDL_GameController *gamecontroller) } } -const char * -SDL_GameControllerPath(SDL_GameController *gamecontroller) -{ - if (!gamecontroller) - return NULL; - - return SDL_JoystickPath(SDL_GameControllerGetJoystick(gamecontroller)); -} - SDL_GameControllerType SDL_GameControllerGetType(SDL_GameController *gamecontroller) { @@ -2375,12 +2333,6 @@ SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller) return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller)); } -Uint16 -SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller) -{ - return SDL_JoystickGetFirmwareVersion(SDL_GameControllerGetJoystick(gamecontroller)); -} - const char * SDL_GameControllerGetSerial(SDL_GameController *gamecontroller) { diff --git a/externals/SDL/src/joystick/SDL_gamecontrollerdb.h b/externals/SDL/src/joystick/SDL_gamecontrollerdb.h index 9266c5165..43c5d38f9 100755 --- a/externals/SDL/src/joystick/SDL_gamecontrollerdb.h +++ b/externals/SDL/src/joystick/SDL_gamecontrollerdb.h @@ -187,7 +187,6 @@ static const char *s_ControllerMappings [] = "030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ - "030000006d0400001ac2000000000000,Logitech Precision Gamepad,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700006382000000000000,MLG Gamepad PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000c62400002a89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", @@ -262,18 +261,11 @@ static const char *s_ControllerMappings [] = "03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,", "03000000300f00001210000000000000,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,", "03000000341a00000104000000000000,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,", - "03000000222c00000025000000000000,Qanba Dragon Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", - "03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick PS3 Mode,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick PS4 Mode,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", "030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,", "030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "03000000050b00005819000000000000,ROG Chakram Core,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", - "03000000050b0000181a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", - "03000000050b00001a1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", - "03000000050b00001c1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", - "03000000050b0000e318000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", - "03000000050b0000e518000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", "03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000321500000204000000000000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000321500000104000000000000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", @@ -449,7 +441,6 @@ static const char *s_ControllerMappings [] = "030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", - "03000000222c00000225000000010000,Qanba Dragon Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", "03000000321500000204000000010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000321500000104000000010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", @@ -503,7 +494,7 @@ static const char *s_ControllerMappings [] = "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif -#ifdef SDL_JOYSTICK_LINUX +#if defined(__LINUX__) "xinput,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -714,10 +705,6 @@ static const char *s_ControllerMappings [] = "03000000c62400003a54000001010000,PowerA XBox One Controller,a:b0,b:b1,back:b6,dpdown:h0.7,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000c62400000053000000010000,PowerA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,", - "03000000222c00000225000011010000,Qanba Dragon Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "03000000222c00000025000011010000,Qanba Dragon Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", - "03000000222c00000223000011010000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "03000000222c00000023000011010000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000008916000000fd000024010000,Razer Onza Tournament Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000321500000204000011010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", @@ -754,11 +741,8 @@ static const char *s_ControllerMappings [] = "030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", - "03000000de2800000112000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,", "03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", - "03000000de2800000211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,", "03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", - "03000000de2800004211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,", "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", @@ -771,7 +755,6 @@ static const char *s_ControllerMappings [] = "0300000000f00000f100000000010000,Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,", "030000004f0400000ed0000011010000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", - "030000004f04000015b3000001010000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", "030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,", "030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,", @@ -803,7 +786,6 @@ static const char *s_ControllerMappings [] = "030000005e040000ea02000001030000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", - "050000005e040000130b000011050000,Xbox Series X Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,", "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", @@ -905,6 +887,9 @@ static const char *s_ControllerMappings [] = "050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,", #endif +#if defined(SDL_JOYSTICK_VIRTUAL) + "00000000000000000000000000007601,Virtual Joystick,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", +#endif #if defined(SDL_JOYSTICK_EMSCRIPTEN) "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", #endif @@ -912,7 +897,7 @@ static const char *s_ControllerMappings [] = "50535669746120436f6e74726f6c6c65,PSVita Controller,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif #if defined(SDL_JOYSTICK_PSP) - "505350206275696c74696e206a6f7970,PSP builtin joypad,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", + "505350206275696c74696e206a6f7970,PSP builtin joypad,y:b0,b:b1,a:b2,x:b3,leftshoulder:b4,rightshoulder:b5,dpdown:b6,dpleft:b7,dpup:b8,dpright:b9,back:b10,start:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,", #endif "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", NULL diff --git a/externals/SDL/src/joystick/SDL_joystick.c b/externals/SDL/src/joystick/SDL_joystick.c index cf4dd7260..696038d2e 100755 --- a/externals/SDL/src/joystick/SDL_joystick.c +++ b/externals/SDL/src/joystick/SDL_joystick.c @@ -320,28 +320,6 @@ SDL_JoystickNameForIndex(int device_index) return name; } -/* - * Get the implementation dependent path of a joystick - */ -const char * -SDL_JoystickPathForIndex(int device_index) -{ - SDL_JoystickDriver *driver; - const char *path = NULL; - - SDL_LockJoysticks(); - if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { - path = driver->GetDevicePath(device_index); - } - SDL_UnlockJoysticks(); - - /* FIXME: Really we should reference count this path so it doesn't go away after unlock */ - if (!path) { - SDL_Unsupported(); - } - return path; -} - /* * Get the player index of a joystick, or -1 if it's not available */ @@ -408,8 +386,6 @@ SDL_JoystickOpen(int device_index) SDL_Joystick *joystick; SDL_Joystick *joysticklist; const char *joystickname = NULL; - const char *joystickpath = NULL; - SDL_JoystickPowerLevel initial_power_level; SDL_LockJoysticks(); @@ -459,13 +435,6 @@ SDL_JoystickOpen(int device_index) joystick->name = NULL; } - joystickpath = driver->GetDevicePath(device_index); - if (joystickpath) { - joystick->path = SDL_strdup(joystickpath); - } else { - joystick->path = NULL; - } - joystick->guid = driver->GetDeviceGUID(device_index); if (joystick->naxes > 0) { @@ -509,11 +478,6 @@ SDL_JoystickOpen(int device_index) SDL_UnlockJoysticks(); - /* send initial battery event */ - initial_power_level = joystick->epowerlevel; - joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; - SDL_PrivateJoystickBatteryLevel(joystick, initial_power_level); - driver->Update(joystick); return joystick; @@ -522,23 +486,9 @@ SDL_JoystickOpen(int device_index) int SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, int nhats) -{ - SDL_VirtualJoystickDesc desc; - - SDL_zero(desc); - desc.version = SDL_VIRTUAL_JOYSTICK_DESC_VERSION; - desc.type = (Uint16)type; - desc.naxes = (Uint16)naxes; - desc.nbuttons = (Uint16)nbuttons; - desc.nhats = (Uint16)nhats; - return SDL_JoystickAttachVirtualEx(&desc); -} - -int -SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc) { #if SDL_JOYSTICK_VIRTUAL - return SDL_JoystickAttachVirtualInner(desc); + return SDL_JoystickAttachVirtualInner(type, naxes, nbuttons, nhats); #else return SDL_SetError("SDL not built with virtual-joystick support"); #endif @@ -884,23 +834,6 @@ SDL_JoystickName(SDL_Joystick *joystick) return joystick->name; } -/* - * Get the implementation dependent path of this joystick - */ -const char * -SDL_JoystickPath(SDL_Joystick *joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return NULL; - } - - if (!joystick->path) { - SDL_Unsupported(); - return NULL; - } - return joystick->path; -} - /** * Get the player index of an opened joystick, or -1 if it's not available */ @@ -953,18 +886,17 @@ SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 h result = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble); } - if (result == 0) { - joystick->low_frequency_rumble = low_frequency_rumble; - joystick->high_frequency_rumble = high_frequency_rumble; + /* Save the rumble value regardless of success, so we don't spam the driver */ + joystick->low_frequency_rumble = low_frequency_rumble; + joystick->high_frequency_rumble = high_frequency_rumble; - if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { - joystick->rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); - if (!joystick->rumble_expiration) { - joystick->rumble_expiration = 1; - } - } else { - joystick->rumble_expiration = 0; + if ((low_frequency_rumble || high_frequency_rumble) && duration_ms) { + joystick->rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); + if (!joystick->rumble_expiration) { + joystick->rumble_expiration = 1; } + } else { + joystick->rumble_expiration = 0; } SDL_UnlockJoysticks(); @@ -988,18 +920,17 @@ SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 ri result = joystick->driver->RumbleTriggers(joystick, left_rumble, right_rumble); } - if (result == 0) { - joystick->left_trigger_rumble = left_rumble; - joystick->right_trigger_rumble = right_rumble; + /* Save the rumble value regardless of success, so we don't spam the driver */ + joystick->left_trigger_rumble = left_rumble; + joystick->right_trigger_rumble = right_rumble; - if ((left_rumble || right_rumble) && duration_ms) { - joystick->trigger_rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); - if (!joystick->trigger_rumble_expiration) { - joystick->trigger_rumble_expiration = 1; - } - } else { - joystick->trigger_rumble_expiration = 0; + if ((left_rumble || right_rumble) && duration_ms) { + joystick->trigger_rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS); + if (!joystick->trigger_rumble_expiration) { + joystick->trigger_rumble_expiration = 1; } + } else { + joystick->trigger_rumble_expiration = 0; } SDL_UnlockJoysticks(); @@ -1073,13 +1004,14 @@ SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) SDL_LockJoysticks(); isfreshvalue = red != joystick->led_red || - green != joystick->led_green || - blue != joystick->led_blue; + green != joystick->led_green || + blue != joystick->led_blue; - if (isfreshvalue || SDL_TICKS_PASSED(SDL_GetTicks(), joystick->led_expiration)) { + if ( isfreshvalue || SDL_TICKS_PASSED( SDL_GetTicks(), joystick->led_expiration ) ) { result = joystick->driver->SetLED(joystick, red, green, blue); joystick->led_expiration = SDL_GetTicks() + SDL_LED_MIN_REPEAT_MS; - } else { + } + else { /* Avoid spamming the driver */ result = 0; } @@ -1166,7 +1098,6 @@ SDL_JoystickClose(SDL_Joystick *joystick) } SDL_free(joystick->name); - SDL_free(joystick->path); SDL_free(joystick->serial); /* Free the data associated with this joystick */ @@ -1657,13 +1588,11 @@ SDL_JoystickUpdate(void) for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->attached) { - /* This driver should always be != NULL, but seeing a crash in the wild...? */ - if (!joystick->driver) { - continue; /* nothing we can do, and other things use joystick->driver below here. */ + /* This should always be true, but seeing a crash in the wild...? */ + if (joystick->driver) { + joystick->driver->Update(joystick); } - joystick->driver->Update(joystick); - if (joystick->delayed_guide_button) { SDL_GameControllerHandleDelayedGuideButton(joystick); } @@ -1810,11 +1739,6 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c char *name; size_t i, len; - /* Use the given name for the Nintendo Online NES Controllers */ - if (SDL_strncmp(product_name, "NES Controller", 14) == 0) { - return SDL_strdup(product_name); - } - custom_name = GuessControllerName(vendor, product); if (custom_name) { return SDL_strdup(custom_name); @@ -1837,48 +1761,23 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c if (*vendor_name && *product_name) { len = (SDL_strlen(vendor_name) + 1 + SDL_strlen(product_name) + 1); name = (char *)SDL_malloc(len); - if (name) { - SDL_snprintf(name, len, "%s %s", vendor_name, product_name); + if (!name) { + return NULL; } + SDL_snprintf(name, len, "%s %s", vendor_name, product_name); } else if (*product_name) { name = SDL_strdup(product_name); } else if (vendor || product) { - /* Couldn't find a controller name, try to give it one based on device type */ - switch (SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, NULL, SDL_TRUE)) { - case SDL_CONTROLLER_TYPE_XBOX360: - name = SDL_strdup("Xbox 360 Controller"); - break; - case SDL_CONTROLLER_TYPE_XBOXONE: - name = SDL_strdup("Xbox One Controller"); - break; - case SDL_CONTROLLER_TYPE_PS3: - name = SDL_strdup("PS3 Controller"); - break; - case SDL_CONTROLLER_TYPE_PS4: - name = SDL_strdup("PS4 Controller"); - break; - case SDL_CONTROLLER_TYPE_PS5: - name = SDL_strdup("PS5 Controller"); - break; - case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO: - name = SDL_strdup("Nintendo Switch Pro Controller"); - break; - default: - len = (6 + 1 + 6 + 1); - name = (char *)SDL_malloc(len); - if (name) { - SDL_snprintf(name, len, "0x%.4x/0x%.4x", vendor, product); - } - break; + len = (6 + 1 + 6 + 1); + name = (char *)SDL_malloc(len); + if (!name) { + return NULL; } + SDL_snprintf(name, len, "0x%.4x/0x%.4x", vendor, product); } else { name = SDL_strdup("Controller"); } - if (!name) { - return NULL; - } - /* Trim trailing whitespace */ for (len = SDL_strlen(name); (len > 0 && name[len - 1] == ' '); --len) { /* continue */ @@ -1927,85 +1826,9 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c } SDL_GameControllerType -SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI) +SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product) { - SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN; - - if (vendor == 0x0000 && product == 0x0000) { - /* Some devices are only identifiable by their name */ - if (name && - (SDL_strcmp(name, "Lic Pro Controller") == 0 || - SDL_strcmp(name, "Nintendo Wireless Gamepad") == 0 || - SDL_strcmp(name, "Wireless Gamepad") == 0)) { - /* HORI or PowerA Switch Pro Controller clone */ - type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; - } - - } else if (vendor == 0x0001 && product == 0x0001) { - type = SDL_CONTROLLER_TYPE_UNKNOWN; - - } else if (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { - type = SDL_CONTROLLER_TYPE_XBOXONE; - - } else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) || - (vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) { - type = SDL_CONTROLLER_TYPE_AMAZON_LUNA; - - } else if (vendor == USB_VENDOR_GOOGLE && product == USB_PRODUCT_GOOGLE_STADIA_CONTROLLER) { - type = SDL_CONTROLLER_TYPE_GOOGLE_STADIA; - - } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP) { - type = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_FALSE) ? SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO : SDL_CONTROLLER_TYPE_UNKNOWN; - - } else { - switch (GuessControllerType(vendor, product)) { - case k_eControllerType_XBox360Controller: - type = SDL_CONTROLLER_TYPE_XBOX360; - break; - case k_eControllerType_XBoxOneController: - type = SDL_CONTROLLER_TYPE_XBOXONE; - break; - case k_eControllerType_PS3Controller: - type = SDL_CONTROLLER_TYPE_PS3; - break; - case k_eControllerType_PS4Controller: - type = SDL_CONTROLLER_TYPE_PS4; - break; - case k_eControllerType_PS5Controller: - type = SDL_CONTROLLER_TYPE_PS5; - break; - case k_eControllerType_XInputPS4Controller: - if (forUI) { - type = SDL_CONTROLLER_TYPE_PS4; - } else { - type = SDL_CONTROLLER_TYPE_UNKNOWN; - } - break; - case k_eControllerType_SwitchProController: - case k_eControllerType_SwitchInputOnlyController: - type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; - break; - case k_eControllerType_XInputSwitchController: - if (forUI) { - type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; - } else { - type = SDL_CONTROLLER_TYPE_UNKNOWN; - } - break; - case k_eControllerType_SwitchJoyConLeft: - case k_eControllerType_SwitchJoyConRight: - /* We always support the Nintendo Online NES Controllers */ - if (name && SDL_strncmp(name, "NES Controller", 14) == 0) { - type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; - } else { - type = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_FALSE) ? SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO : SDL_CONTROLLER_TYPE_UNKNOWN; - } - break; - default: - break; - } - } - return type; + return SDL_GetJoystickGameControllerType(NULL, vendor, product, -1, 0, 0, 0); } SDL_GameControllerType @@ -2015,24 +1838,154 @@ SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *nam Uint16 vendor, product; SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); - type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, name, SDL_TRUE); + type = SDL_GetJoystickGameControllerType(name, vendor, product, -1, 0, 0, 0); if (type == SDL_CONTROLLER_TYPE_UNKNOWN) { if (SDL_IsJoystickXInput(guid)) { /* This is probably an Xbox One controller */ return SDL_CONTROLLER_TYPE_XBOXONE; } - if (SDL_IsJoystickVirtual(guid)) { - return SDL_CONTROLLER_TYPE_VIRTUAL; - } } return type; } -SDL_bool -SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id) +SDL_GameControllerType +SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol) { - EControllerType eType = GuessControllerType(vendor_id, product_id); - return (eType == k_eControllerType_XBoxOneController); + static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF; + static const int XB360_IFACE_SUBCLASS = 93; + static const int XB360_IFACE_PROTOCOL = 1; /* Wired */ + static const int XB360W_IFACE_PROTOCOL = 129; /* Wireless */ + static const int XBONE_IFACE_SUBCLASS = 71; + static const int XBONE_IFACE_PROTOCOL = 208; + + SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN; + + /* This code should match the checks in libusb/hid.c and HIDDeviceManager.java */ + if (interface_class == LIBUSB_CLASS_VENDOR_SPEC && + interface_subclass == XB360_IFACE_SUBCLASS && + (interface_protocol == XB360_IFACE_PROTOCOL || + interface_protocol == XB360W_IFACE_PROTOCOL)) { + + static const int SUPPORTED_VENDORS[] = { + 0x0079, /* GPD Win 2 */ + 0x044f, /* Thrustmaster */ + 0x045e, /* Microsoft */ + 0x046d, /* Logitech */ + 0x056e, /* Elecom */ + 0x06a3, /* Saitek */ + 0x0738, /* Mad Catz */ + 0x07ff, /* Mad Catz */ + 0x0e6f, /* PDP */ + 0x0f0d, /* Hori */ + 0x1038, /* SteelSeries */ + 0x11c9, /* Nacon */ + 0x12ab, /* Unknown */ + 0x1430, /* RedOctane */ + 0x146b, /* BigBen */ + 0x1532, /* Razer Sabertooth */ + 0x15e4, /* Numark */ + 0x162e, /* Joytech */ + 0x1689, /* Razer Onza */ + 0x1949, /* Lab126, Inc. */ + 0x1bad, /* Harmonix */ + 0x20d6, /* PowerA */ + 0x24c6, /* PowerA */ + }; + + int i; + for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) { + if (vendor == SUPPORTED_VENDORS[i]) { + type = SDL_CONTROLLER_TYPE_XBOX360; + break; + } + } + } + + if (interface_number == 0 && + interface_class == LIBUSB_CLASS_VENDOR_SPEC && + interface_subclass == XBONE_IFACE_SUBCLASS && + interface_protocol == XBONE_IFACE_PROTOCOL) { + + static const int SUPPORTED_VENDORS[] = { + 0x045e, /* Microsoft */ + 0x0738, /* Mad Catz */ + 0x0e6f, /* PDP */ + 0x0f0d, /* Hori */ + 0x1532, /* Razer Wildcat */ + 0x20d6, /* PowerA */ + 0x24c6, /* PowerA */ + 0x2e24, /* Hyperkin */ + }; + + int i; + for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) { + if (vendor == SUPPORTED_VENDORS[i]) { + type = SDL_CONTROLLER_TYPE_XBOXONE; + break; + } + } + } + + if (type == SDL_CONTROLLER_TYPE_UNKNOWN) { + if (vendor == 0x0000 && product == 0x0000) { + /* Some devices are only identifiable by their name */ + if (name && + (SDL_strcmp(name, "Lic Pro Controller") == 0 || + SDL_strcmp(name, "Nintendo Wireless Gamepad") == 0 || + SDL_strcmp(name, "Wireless Gamepad") == 0)) { + /* HORI or PowerA Switch Pro Controller clone */ + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; + } else if (name && SDL_strcmp(name, "Virtual Joystick") == 0) { + type = SDL_CONTROLLER_TYPE_VIRTUAL; + } else { + type = SDL_CONTROLLER_TYPE_UNKNOWN; + } + + } else if (vendor == 0x0001 && product == 0x0001) { + type = SDL_CONTROLLER_TYPE_UNKNOWN; + + } else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) || + (vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) { + type = SDL_CONTROLLER_TYPE_AMAZON_LUNA; + + } else if (vendor == USB_VENDOR_GOOGLE && product == USB_PRODUCT_GOOGLE_STADIA_CONTROLLER) { + type = SDL_CONTROLLER_TYPE_GOOGLE_STADIA; + + } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP) { + type = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_FALSE) ? SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO : SDL_CONTROLLER_TYPE_UNKNOWN; + + } else { + switch (GuessControllerType(vendor, product)) { + case k_eControllerType_XBox360Controller: + type = SDL_CONTROLLER_TYPE_XBOX360; + break; + case k_eControllerType_XBoxOneController: + type = SDL_CONTROLLER_TYPE_XBOXONE; + break; + case k_eControllerType_PS3Controller: + type = SDL_CONTROLLER_TYPE_PS3; + break; + case k_eControllerType_PS4Controller: + type = SDL_CONTROLLER_TYPE_PS4; + break; + case k_eControllerType_PS5Controller: + type = SDL_CONTROLLER_TYPE_PS5; + break; + case k_eControllerType_SwitchProController: + case k_eControllerType_SwitchInputOnlyController: + type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; + break; + case k_eControllerType_SwitchJoyConLeft: + case k_eControllerType_SwitchJoyConRight: + type = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, SDL_FALSE) ? SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO : SDL_CONTROLLER_TYPE_UNKNOWN; + break; + default: + type = SDL_CONTROLLER_TYPE_UNKNOWN; + break; + } + } + } + return type; } SDL_bool @@ -2196,14 +2149,10 @@ static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid) MAKE_VIDPID(0x046d, 0xc261), /* Logitech G920 (initial mode) */ MAKE_VIDPID(0x046d, 0xc262), /* Logitech G920 (active mode) */ MAKE_VIDPID(0x046d, 0xc26e), /* Logitech G923 */ - MAKE_VIDPID(0x046d, 0xca03), /* Logitech Momo Racing */ MAKE_VIDPID(0x044f, 0xb65d), /* Thrustmaster Wheel FFB */ MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster Wheel FFB */ MAKE_VIDPID(0x044f, 0xb677), /* Thrustmaster T150 */ - MAKE_VIDPID(0x044f, 0xb696), /* Thrustmaster T248 */ - MAKE_VIDPID(0x044f, 0xb66e), /* Thrustmaster T300RS (normal mode) */ - MAKE_VIDPID(0x044f, 0xb66f), /* Thrustmaster T300RS (advanced mode) */ - MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster T300RS (PS4 mode) */ + MAKE_VIDPID(0x044f, 0xb66e), /* Thrustmaster T300RS */ MAKE_VIDPID(0x044f, 0xb65e), /* Thrustmaster T500RS */ MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */ MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */ @@ -2241,12 +2190,6 @@ static SDL_bool SDL_IsJoystickProductArcadeStick(Uint32 vidpid) MAKE_VIDPID(0x1532, 0x0a00), /* Razer Atrox Arcade Stick */ MAKE_VIDPID(0x0f0d, 0x00aa), /* HORI Real Arcade Pro V Hayabusa in Switch Mode */ MAKE_VIDPID(0x20d6, 0xa715), /* PowerA Nintendo Switch Fusion Arcade Stick */ - MAKE_VIDPID(0x2c22, 0x2300), /* Qanba Obsidian Arcade Joystick in PS4 Mode */ - MAKE_VIDPID(0x2c22, 0x2302), /* Qanba Obsidian Arcade Joystick in PS3 Mode */ - MAKE_VIDPID(0x2c22, 0x2303), /* Qanba Obsidian Arcade Joystick in PC Mode */ - MAKE_VIDPID(0x2c22, 0x2500), /* Qanba Dragon Arcade Joystick in PS4 Mode */ - MAKE_VIDPID(0x2c22, 0x2502), /* Qanba Dragon Arcade Joystick in PS3 Mode */ - MAKE_VIDPID(0x2c22, 0x2503), /* Qanba Dragon Arcade Joystick in PC Mode */ }; int i; @@ -2495,24 +2438,11 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid) /* Additional entries */ /*****************************************************************/ - MAKE_VIDPID(0x04d9, 0x8008), /* OBINLB USB-HID Keyboard (Anne Pro II) */ - MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard (Anne Pro II) */ - MAKE_VIDPID(0x04d9, 0xa292), /* OBINLB USB-HID Keyboard (Anne Pro II) */ - MAKE_VIDPID(0x04d9, 0xa293), /* OBINLB USB-HID Keyboard (Anne Pro II) */ - MAKE_VIDPID(0x1532, 0x0266), /* Razer Huntman V2 Analog, non-functional DInput device */ - MAKE_VIDPID(0x1532, 0x0282), /* Razer Huntman Mini Analog, non-functional DInput device */ + MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard */ + MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Mouse */ MAKE_VIDPID(0x26ce, 0x01a2), /* ASRock LED Controller */ }; - static Uint32 rog_chakram_list[] = { - MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Core Mouse */ - MAKE_VIDPID(0x0b05, 0x18e3), /* ROG Chakram (wired) Mouse */ - MAKE_VIDPID(0x0b05, 0x18e5), /* ROG Chakram (wireless) Mouse */ - MAKE_VIDPID(0x0b05, 0x1a18), /* ROG Chakram X (wired) Mouse */ - MAKE_VIDPID(0x0b05, 0x1a1a), /* ROG Chakram X (wireless) Mouse */ - MAKE_VIDPID(0x0b05, 0x1a1c), /* ROG Chakram X (Bluetooth) Mouse */ - }; - unsigned int i; Uint32 id; Uint16 vendor; @@ -2528,20 +2458,14 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid) return SDL_TRUE; } } - if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_ROG_CHAKRAM, SDL_FALSE)) { - for (i = 0; i < SDL_arraysize(rog_chakram_list); ++i) { - if (id == rog_chakram_list[i]) { - return SDL_TRUE; - } - } - } - type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, name, SDL_FALSE); + type = SDL_GetJoystickGameControllerType(name, vendor, product, -1, 0, 0, 0); if ((type == SDL_CONTROLLER_TYPE_PS4 || type == SDL_CONTROLLER_TYPE_PS5) && SDL_IsPS4RemapperRunning()) { return SDL_TRUE; } - if (SDL_ShouldIgnoreGameController(name, guid)) { + if (SDL_IsGameControllerNameAndGUID(name, guid) && + SDL_ShouldIgnoreGameController(name, guid)) { return SDL_TRUE; } @@ -2674,14 +2598,6 @@ Uint16 SDL_JoystickGetProductVersion(SDL_Joystick *joystick) return version; } -Uint16 SDL_JoystickGetFirmwareVersion(SDL_Joystick *joystick) -{ - if (!SDL_PrivateJoystickValid(joystick)) { - return 0; - } - return joystick->firmware_version; -} - const char *SDL_JoystickGetSerial(SDL_Joystick *joystick) { if (!SDL_PrivateJoystickValid(joystick)) { @@ -2707,31 +2623,74 @@ SDL_JoystickType SDL_JoystickGetType(SDL_Joystick *joystick) /* convert the guid to a printable string */ void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID) { - SDL_GUIDToString(guid, pszGUID, cbGUID); + static const char k_rgchHexToASCII[] = "0123456789abcdef"; + int i; + + if ((pszGUID == NULL) || (cbGUID <= 0)) { + return; + } + + for (i = 0; i < sizeof(guid.data) && i < (cbGUID-1)/2; i++) { + /* each input byte writes 2 ascii chars, and might write a null byte. */ + /* If we don't have room for next input byte, stop */ + unsigned char c = guid.data[i]; + + *pszGUID++ = k_rgchHexToASCII[c >> 4]; + *pszGUID++ = k_rgchHexToASCII[c & 0x0F]; + } + *pszGUID = '\0'; +} + +/*----------------------------------------------------------------------------- + * Purpose: Returns the 4 bit nibble for a hex character + * Input : c - + * Output : unsigned char + *-----------------------------------------------------------------------------*/ +static unsigned char nibble(unsigned char c) +{ + if ((c >= '0') && (c <= '9')) { + return (c - '0'); + } + + if ((c >= 'A') && (c <= 'F')) { + return (c - 'A' + 0x0a); + } + + if ((c >= 'a') && (c <= 'f')) { + return (c - 'a' + 0x0a); + } + + /* received an invalid character, and no real way to return an error */ + /* AssertMsg1(false, "Q_nibble invalid hex character '%c' ", c); */ + return 0; } /* convert the string version of a joystick guid to the struct */ SDL_JoystickGUID SDL_JoystickGetGUIDFromString(const char *pchGUID) { - return SDL_GUIDFromString(pchGUID); + SDL_JoystickGUID guid; + int maxoutputbytes= sizeof(guid); + size_t len = SDL_strlen(pchGUID); + Uint8 *p; + size_t i; + + /* Make sure it's even */ + len = (len) & ~0x1; + + SDL_memset(&guid, 0x00, sizeof(guid)); + + p = (Uint8 *)&guid; + for (i = 0; (i < len) && ((p - (Uint8 *)&guid) < maxoutputbytes); i+=2, p++) { + *p = (nibble((unsigned char)pchGUID[i]) << 4) | nibble((unsigned char)pchGUID[i+1]); + } + + return guid; } /* update the power level for this joystick */ void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel ePowerLevel) { - SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialisation */ - if (ePowerLevel != joystick->epowerlevel) { -#if !SDL_EVENTS_DISABLED - if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) { - SDL_Event event; - event.type = SDL_JOYBATTERYUPDATED; - event.jbattery.which = joystick->instance_id; - event.jbattery.level = ePowerLevel; - SDL_PushEvent(&event); - } -#endif /* !SDL_EVENTS_DISABLED */ - joystick->epowerlevel = ePowerLevel; - } + joystick->epowerlevel = ePowerLevel; } /* return its power level */ @@ -2748,7 +2707,9 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger SDL_JoystickTouchpadInfo *touchpad_info; SDL_JoystickTouchpadFingerInfo *finger_info; int posted; +#if !SDL_EVENTS_DISABLED Uint32 event_type; +#endif if (touchpad < 0 || touchpad >= joystick->ntouchpads) { return 0; @@ -2792,6 +2753,7 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger } } +#if !SDL_EVENTS_DISABLED if (state == finger_info->state) { event_type = SDL_CONTROLLERTOUCHPADMOTION; } else if (state) { @@ -2799,6 +2761,7 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger } else { event_type = SDL_CONTROLLERTOUCHPADUP; } +#endif /* We ignore events if we don't have keyboard focus, except for touch release */ if (SDL_PrivateJoystickShouldIgnoreEvent()) { diff --git a/externals/SDL/src/joystick/SDL_joystick_c.h b/externals/SDL/src/joystick/SDL_joystick_c.h index a52167dbb..312e11337 100755 --- a/externals/SDL/src/joystick/SDL_joystick_c.h +++ b/externals/SDL/src/joystick/SDL_joystick_c.h @@ -58,11 +58,9 @@ extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint1 extern char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name); /* Function to return the type of a controller */ -extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI); +extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product); extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name); - -/* Function to return whether a joystick is an Xbox One controller */ -extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id); +extern SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol); /* Function to return whether a joystick is an Xbox One Elite controller */ extern SDL_bool SDL_IsJoystickXboxOneElite(Uint16 vendor_id, Uint16 product_id); @@ -170,11 +168,6 @@ typedef struct _SDL_GamepadMapping SDL_InputMapping dpdown; SDL_InputMapping dpleft; SDL_InputMapping dpright; - SDL_InputMapping misc1; - SDL_InputMapping paddle1; - SDL_InputMapping paddle2; - SDL_InputMapping paddle3; - SDL_InputMapping paddle4; SDL_InputMapping leftx; SDL_InputMapping lefty; SDL_InputMapping rightx; diff --git a/externals/SDL/src/joystick/SDL_sysjoystick.h b/externals/SDL/src/joystick/SDL_sysjoystick.h index 6fd82bdce..8b8792179 100755 --- a/externals/SDL/src/joystick/SDL_sysjoystick.h +++ b/externals/SDL/src/joystick/SDL_sysjoystick.h @@ -65,10 +65,8 @@ struct _SDL_Joystick { SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */ char *name; /* Joystick name - system dependent */ - char *path; /* Joystick path - system dependent */ char *serial; /* Joystick serial */ SDL_JoystickGUID guid; /* Joystick guid */ - Uint16 firmware_version; /* Firmware version, if available */ int naxes; /* Number of axis controls on the joystick */ SDL_JoystickAxisInfo *axes; @@ -120,7 +118,6 @@ struct _SDL_Joystick }; /* Device bus definitions */ -#define SDL_HARDWARE_BUS_VIRTUAL 0x00 #define SDL_HARDWARE_BUS_USB 0x03 #define SDL_HARDWARE_BUS_BLUETOOTH 0x05 @@ -149,9 +146,6 @@ typedef struct _SDL_JoystickDriver /* Function to get the device-dependent name of a joystick */ const char *(*GetDeviceName)(int device_index); - /* Function to get the device-dependent path of a joystick */ - const char *(*GetDevicePath)(int device_index); - /* Function to get the player index of a joystick */ int (*GetDevicePlayerIndex)(int device_index); diff --git a/externals/SDL/src/joystick/android/SDL_sysjoystick.c b/externals/SDL/src/joystick/android/SDL_sysjoystick.c index 104724afd..b84c77db8 100755 --- a/externals/SDL/src/joystick/android/SDL_sysjoystick.c +++ b/externals/SDL/src/joystick/android/SDL_sysjoystick.c @@ -103,7 +103,6 @@ keycode_to_SDL(int keycode) case AKEYCODE_BUTTON_THUMBR: button = SDL_CONTROLLER_BUTTON_RIGHTSTICK; break; - case AKEYCODE_MENU: case AKEYCODE_BUTTON_START: button = SDL_CONTROLLER_BUTTON_START; break; @@ -558,12 +557,6 @@ ANDROID_JoystickGetDeviceName(int device_index) return JoystickByDevIndex(device_index)->name; } -static const char * -ANDROID_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - static int ANDROID_JoystickGetDevicePlayerIndex(int device_index) { @@ -719,7 +712,6 @@ SDL_JoystickDriver SDL_ANDROID_JoystickDriver = ANDROID_JoystickGetCount, ANDROID_JoystickDetect, ANDROID_JoystickGetDeviceName, - ANDROID_JoystickGetDevicePath, ANDROID_JoystickGetDevicePlayerIndex, ANDROID_JoystickSetDevicePlayerIndex, ANDROID_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/bsd/SDL_bsdjoystick.c b/externals/SDL/src/joystick/bsd/SDL_bsdjoystick.c index d7b4d4730..f8859a534 100755 --- a/externals/SDL/src/joystick/bsd/SDL_bsdjoystick.c +++ b/externals/SDL/src/joystick/bsd/SDL_bsdjoystick.c @@ -268,15 +268,9 @@ static const char * BSD_JoystickGetDeviceName(int device_index) { if (joydevnames[device_index] != NULL) { - return joydevnames[device_index]; + return (joydevnames[device_index]); } - return joynames[device_index]; -} - -static const char * -BSD_JoystickGetDevicePath(int device_index) -{ - return joynames[device_index]; + return (joynames[device_index]); } static int @@ -813,7 +807,6 @@ SDL_JoystickDriver SDL_BSD_JoystickDriver = BSD_JoystickGetCount, BSD_JoystickDetect, BSD_JoystickGetDeviceName, - BSD_JoystickGetDevicePath, BSD_JoystickGetDevicePlayerIndex, BSD_JoystickSetDevicePlayerIndex, BSD_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/controller_type.h b/externals/SDL/src/joystick/controller_type.h index 9ec6c57ee..26950345c 100755 --- a/externals/SDL/src/joystick/controller_type.h +++ b/externals/SDL/src/joystick/controller_type.h @@ -53,9 +53,8 @@ typedef enum k_eControllerType_SwitchJoyConPair = 41, k_eControllerType_SwitchInputOnlyController = 42, k_eControllerType_MobileTouch = 43, - k_eControllerType_XInputSwitchController = 44, // Client-side only, used to mark Nintendo Switch style controllers as using XInput instead of the Nintendo Switch protocol + k_eControllerType_XInputSwitchController = 44, // Client-side only, used to mark Switch-compatible controllers as not supporting Switch controller protocol k_eControllerType_PS5Controller = 45, - k_eControllerType_XInputPS4Controller = 46, // Client-side only, used to mark DualShock 4 style controllers using XInput instead of the DualShock 4 controller protocol k_eControllerType_LastController, // Don't add game controllers below this enumeration - this enumeration can change value // Keyboards and Mice @@ -63,6 +62,7 @@ typedef enum k_eControllertype_GenericMouse = 800, } EControllerType; +#define MAKE_CONTROLLER_ID( nVID, nPID ) (unsigned int)( (unsigned int)nVID << 16 | (unsigned int)nPID ) typedef struct { unsigned int m_unDeviceID; @@ -70,10 +70,683 @@ typedef struct const char *m_pszName; } ControllerDescription_t; +static const ControllerDescription_t arrControllers[] = { + { MAKE_CONTROLLER_ID( 0x0079, 0x181a ), k_eControllerType_PS3Controller, NULL }, // Venom Arcade Stick + { MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL }, // Firestorm Dual Analog 3 + { MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL }, // Thrustmaster wireless 3-1 + { MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller + { MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x056e, 0x2013 ), k_eControllerType_PS3Controller, NULL }, // JC-U4113SBK + { MAKE_CONTROLLER_ID( 0x05b8, 0x1004 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x05b8, 0x1006 ), k_eControllerType_PS3Controller, NULL }, // JC-U3412SBK + { MAKE_CONTROLLER_ID( 0x06a3, 0xf622 ), k_eControllerType_PS3Controller, NULL }, // Cyborg V3 + { MAKE_CONTROLLER_ID( 0x0738, 0x3180 ), k_eControllerType_PS3Controller, NULL }, // Mad Catz Alpha PS3 mode + { MAKE_CONTROLLER_ID( 0x0738, 0x3250 ), k_eControllerType_PS3Controller, NULL }, // madcats fightpad pro ps3 + { MAKE_CONTROLLER_ID( 0x0738, 0x8180 ), k_eControllerType_PS3Controller, NULL }, // Mad Catz Alpha PS4 mode (no touchpad on device) + { MAKE_CONTROLLER_ID( 0x0738, 0x8838 ), k_eControllerType_PS3Controller, NULL }, // Madcatz Fightstick Pro + { MAKE_CONTROLLER_ID( 0x0810, 0x0001 ), k_eControllerType_PS3Controller, NULL }, // actually ps2 - maybe break out later + { MAKE_CONTROLLER_ID( 0x0810, 0x0003 ), k_eControllerType_PS3Controller, NULL }, // actually ps2 - maybe break out later + { MAKE_CONTROLLER_ID( 0x0925, 0x0005 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller + { MAKE_CONTROLLER_ID( 0x0925, 0x8866 ), k_eControllerType_PS3Controller, NULL }, // PS2 maybe break out later + { MAKE_CONTROLLER_ID( 0x0925, 0x8888 ), k_eControllerType_PS3Controller, NULL }, // Actually ps2 -maybe break out later Lakeview Research WiseGroup Ltd, MP-8866 Dual Joypad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0109 ), k_eControllerType_PS3Controller, NULL }, // PDP Versus Fighting Pad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x011e ), k_eControllerType_PS3Controller, NULL }, // Rock Candy PS4 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0128 ), k_eControllerType_PS3Controller, NULL }, // Rock Candy PS3 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0203 ), k_eControllerType_PS3Controller, NULL }, // Victrix Pro FS (PS4 peripheral but no trackpad/lightbar) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0214 ), k_eControllerType_PS3Controller, NULL }, // afterglow ps3 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x1314 ), k_eControllerType_PS3Controller, NULL }, // PDP Afterglow Wireless PS3 controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x6302 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x0e8f, 0x0008 ), k_eControllerType_PS3Controller, NULL }, // Green Asia + { MAKE_CONTROLLER_ID( 0x0e8f, 0x3075 ), k_eControllerType_PS3Controller, NULL }, // SpeedLink Strike FX + { MAKE_CONTROLLER_ID( 0x0e8f, 0x310d ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0009 ), k_eControllerType_PS3Controller, NULL }, // HORI BDA GP1 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x004d ), k_eControllerType_PS3Controller, NULL }, // Horipad 3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x005e ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting commander ps4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x005f ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting commander ps3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006a ), k_eControllerType_PS3Controller, NULL }, // Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006e ), k_eControllerType_PS3Controller, NULL }, // HORI horipad4 ps3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0085 ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting Commander PS3 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0086 ), k_eControllerType_PS3Controller, NULL }, // HORI Fighting Commander PC (Uses the Xbox 360 protocol, but has PS3 buttons) + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0087 ), k_eControllerType_PS3Controller, NULL }, // HORI fighting mini stick + { MAKE_CONTROLLER_ID( 0x0f30, 0x1100 ), k_eControllerType_PS3Controller, NULL }, // Quanba Q1 fight stick + { MAKE_CONTROLLER_ID( 0x11ff, 0x3331 ), k_eControllerType_PS3Controller, NULL }, // SRXJ-PH2400 + { MAKE_CONTROLLER_ID( 0x1345, 0x1000 ), k_eControllerType_PS3Controller, NULL }, // PS2 ACME GA-D5 + { MAKE_CONTROLLER_ID( 0x1345, 0x6005 ), k_eControllerType_PS3Controller, NULL }, // ps2 maybe break out later + { MAKE_CONTROLLER_ID( 0x146b, 0x0603 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x146b, 0x5500 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x1a34, 0x0836 ), k_eControllerType_PS3Controller, NULL }, // Afterglow PS3 + { MAKE_CONTROLLER_ID( 0x20bc, 0x5500 ), k_eControllerType_PS3Controller, NULL }, // ShanWan PS3 + { MAKE_CONTROLLER_ID( 0x20d6, 0x576d ), k_eControllerType_PS3Controller, NULL }, // Power A PS3 + { MAKE_CONTROLLER_ID( 0x20d6, 0xca6d ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x2563, 0x0523 ), k_eControllerType_PS3Controller, NULL }, // Digiflip GP006 + { MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x25f0, 0x83c3 ), k_eControllerType_PS3Controller, NULL }, // gioteck vx2 + { MAKE_CONTROLLER_ID( 0x25f0, 0xc121 ), k_eControllerType_PS3Controller, NULL }, // + { MAKE_CONTROLLER_ID( 0x2c22, 0x2000 ), k_eControllerType_PS3Controller, NULL }, // Quanba Drone + { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x8380, 0x0003 ), k_eControllerType_PS3Controller, NULL }, // BTP 2163 + { MAKE_CONTROLLER_ID( 0x8888, 0x0308 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller -extern EControllerType GuessControllerType( int nVID, int nPID ); -extern const char *GuessControllerName( int nVID, int nPID ); + { MAKE_CONTROLLER_ID( 0x0079, 0x181b ), k_eControllerType_PS4Controller, NULL }, // Venom Arcade Stick - XXX:this may not work and may need to be called a ps3 controller + { MAKE_CONTROLLER_ID( 0x054c, 0x05c4 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller, NULL }, // STRIKEPAD PS4 Grip Add-on + { MAKE_CONTROLLER_ID( 0x054c, 0x09cc ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Slim Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x0ba0 ), k_eControllerType_PS4Controller, NULL }, // Sony PS4 Controller (Wireless dongle) + { MAKE_CONTROLLER_ID( 0x0738, 0x8250 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightPad Pro PS4 + { MAKE_CONTROLLER_ID( 0x0738, 0x8384 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE S+ PS4 + { MAKE_CONTROLLER_ID( 0x0738, 0x8480 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE 2 PS4 + { MAKE_CONTROLLER_ID( 0x0738, 0x8481 ), k_eControllerType_PS4Controller, NULL }, // Mad Catz FightStick TE 2+ PS4 + { MAKE_CONTROLLER_ID( 0x0C12, 0x0E10 ), k_eControllerType_PS4Controller, NULL }, // Armor Armor 3 Pad PS4 + { MAKE_CONTROLLER_ID( 0x0C12, 0x1CF6 ), k_eControllerType_PS4Controller, NULL }, // EMIO PS4 Elite Controller + { MAKE_CONTROLLER_ID( 0x0c12, 0x0e15 ), k_eControllerType_PS4Controller, NULL }, // Game:Pad 4 + { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef6 ), k_eControllerType_PS4Controller, NULL }, // Hitbox Arcade Stick + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0055 ), k_eControllerType_PS4Controller, NULL }, // HORIPAD 4 FPS + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0066 ), k_eControllerType_PS4Controller, NULL }, // HORIPAD 4 FPS Plus + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0084 ), k_eControllerType_PS4Controller, NULL }, // HORI Fighting Commander PS4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x008a ), k_eControllerType_PS4Controller, NULL }, // HORI Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x009c ), k_eControllerType_PS4Controller, NULL }, // HORI TAC PRO mousething + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a0 ), k_eControllerType_PS4Controller, NULL }, // HORI TAC4 mousething + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ee ), k_eControllerType_PS4Controller, NULL }, // Hori mini wired https://www.playstation.com/en-us/explore/accessories/gaming-controllers/mini-wired-gamepad/ + { MAKE_CONTROLLER_ID( 0x11c0, 0x4001 ), k_eControllerType_PS4Controller, NULL }, // "PS4 Fun Controller" added from user log + { MAKE_CONTROLLER_ID( 0x146b, 0x0d01 ), k_eControllerType_PS4Controller, NULL }, // Nacon Revolution Pro Controller - has gyro + { MAKE_CONTROLLER_ID( 0x146b, 0x0d02 ), k_eControllerType_PS4Controller, NULL }, // Nacon Revolution Pro Controller v2 - has gyro + { MAKE_CONTROLLER_ID( 0x146b, 0x0d10 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Infinite - has gyro + { MAKE_CONTROLLER_ID( 0x1532, 0X0401 ), k_eControllerType_PS4Controller, NULL }, // Razer Panthera PS4 Controller + { MAKE_CONTROLLER_ID( 0x1532, 0x1000 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju PS4 Controller + { MAKE_CONTROLLER_ID( 0x1532, 0x1004 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Ultimate USB + { MAKE_CONTROLLER_ID( 0x1532, 0x1007 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Tournament edition USB + { MAKE_CONTROLLER_ID( 0x1532, 0x1008 ), k_eControllerType_PS4Controller, NULL }, // Razer Panthera Evo Fightstick + { MAKE_CONTROLLER_ID( 0x1532, 0x1009 ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Ultimate BT + { MAKE_CONTROLLER_ID( 0x1532, 0x100A ), k_eControllerType_PS4Controller, NULL }, // Razer Raiju 2 Tournament edition BT + { MAKE_CONTROLLER_ID( 0x1532, 0x1100 ), k_eControllerType_PS4Controller, NULL }, // Razer RAION Fightpad - Trackpad, no gyro, lightbar hardcoded to green + { MAKE_CONTROLLER_ID( 0x20d6, 0x792a ), k_eControllerType_PS4Controller, NULL }, // PowerA Fusion Fight Pad + { MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller, NULL }, // Armor 3 or Level Up Cobra - At least one variant has gyro + { MAKE_CONTROLLER_ID( 0x9886, 0x0025 ), k_eControllerType_PS4Controller, NULL }, // Astro C40 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0207 ), k_eControllerType_PS4Controller, NULL }, // Victrix Pro Fightstick w/ Touchpad for PS4 + // Removing the Giotek because there were a bunch of help tickets from users w/ issues including from non-PS4 controller users. This VID/PID is probably used in different FW's + // { MAKE_CONTROLLER_ID( 0x7545, 0x1122 ), k_eControllerType_PS4Controller, NULL }, // Giotek VX4 - trackpad/gyro don't work. Had to not filter on interface info. Light bar is flaky, but works. + { MAKE_CONTROLLER_ID( 0x044f, 0xd00e ), k_eControllerType_PS4Controller, NULL }, // Thrustmast Eswap Pro - No gyro and lightbar doesn't change color. Works otherwise + { MAKE_CONTROLLER_ID( 0x0c12, 0x1e10 ), k_eControllerType_PS4Controller, NULL }, // P4 Wired Gamepad generic knock off - lightbar but not trackpad or gyro + { MAKE_CONTROLLER_ID( 0x146b, 0x0d09 ), k_eControllerType_PS4Controller, NULL }, // NACON Daija Fight Stick - touchpad but no gyro/rumble + { MAKE_CONTROLLER_ID( 0x146b, 0x0d10 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Unlimited + { MAKE_CONTROLLER_ID( 0x146b, 0x0d08 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution Unlimited Wireless Dongle + { MAKE_CONTROLLER_ID( 0x146b, 0x0d06 ), k_eControllerType_PS4Controller, NULL }, // NACON Asymetrical Controller Wireless Dongle -- show up as ps4 until you connect controller to it then it reboots into Xbox controller with different vvid/pid + { MAKE_CONTROLLER_ID( 0x146b, 0x1103 ), k_eControllerType_PS4Controller, NULL }, // NACON Asymetrical Controller -- on windows this doesn't enumerate + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0123 ), k_eControllerType_PS4Controller, NULL }, // HORI Wireless Controller Light (Japan only) - only over bt- over usb is xbox and pid 0x0124 + { MAKE_CONTROLLER_ID( 0x146b, 0x0d13 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution 3 + { MAKE_CONTROLLER_ID( 0x0c12, 0x0e20 ), k_eControllerType_PS4Controller, NULL }, // Brook Mars Controller - needs FW update to show up as Ps4 controller on PC. Has Gyro but touchpad is a single button. -#endif // CONTROLLER_TYPE_H + { MAKE_CONTROLLER_ID( 0x054c, 0x0ce6 ), k_eControllerType_PS5Controller, NULL }, // Sony PS5 Controller + + { MAKE_CONTROLLER_ID( 0x0079, 0x0006 ), k_eControllerType_UnknownNonSteamController, NULL }, // DragonRise Generic USB PCB, sometimes configured as a PC Twin Shock Controller - looks like a DS3 but the face buttons are 1-4 instead of symbols + + { MAKE_CONTROLLER_ID( 0x0079, 0x18d4 ), k_eControllerType_XBox360Controller, NULL }, // GPD Win 2 X-Box Controller + { MAKE_CONTROLLER_ID( 0x03eb, 0xff02 ), k_eControllerType_XBox360Controller, NULL }, // Wooting Two + { MAKE_CONTROLLER_ID( 0x044f, 0xb326 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster Gamepad GP XID + { MAKE_CONTROLLER_ID( 0x045e, 0x028e ), k_eControllerType_XBox360Controller, "Xbox 360 Controller" }, // Microsoft X-Box 360 pad + { MAKE_CONTROLLER_ID( 0x045e, 0x028f ), k_eControllerType_XBox360Controller, "Xbox 360 Controller" }, // Microsoft X-Box 360 pad v2 + { MAKE_CONTROLLER_ID( 0x045e, 0x0291 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver (XBOX) + { MAKE_CONTROLLER_ID( 0x045e, 0x02a0 ), k_eControllerType_XBox360Controller, NULL }, // Microsoft X-Box 360 Big Button IR + { MAKE_CONTROLLER_ID( 0x045e, 0x02a1 ), k_eControllerType_XBox360Controller, NULL }, // Microsoft X-Box 360 Wireless Controller with XUSB driver on Windows + { MAKE_CONTROLLER_ID( 0x045e, 0x02a9 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver (third party knockoff) + { MAKE_CONTROLLER_ID( 0x045e, 0x0719 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver + { MAKE_CONTROLLER_ID( 0x046d, 0xc21d ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F310 + { MAKE_CONTROLLER_ID( 0x046d, 0xc21e ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F510 + { MAKE_CONTROLLER_ID( 0x046d, 0xc21f ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F710 + { MAKE_CONTROLLER_ID( 0x046d, 0xc242 ), k_eControllerType_XBox360Controller, NULL }, // Logitech Chillstream Controller + { MAKE_CONTROLLER_ID( 0x056e, 0x2004 ), k_eControllerType_XBox360Controller, NULL }, // Elecom JC-U3613M + { MAKE_CONTROLLER_ID( 0x06a3, 0xf51a ), k_eControllerType_XBox360Controller, NULL }, // Saitek P3600 + { MAKE_CONTROLLER_ID( 0x0738, 0x4716 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Wired Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x0738, 0x4718 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV FightStick SE + { MAKE_CONTROLLER_ID( 0x0738, 0x4726 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x0738, 0x4728 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV FightPad + { MAKE_CONTROLLER_ID( 0x0738, 0x4736 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MicroCon Gamepad + { MAKE_CONTROLLER_ID( 0x0738, 0x4738 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Wired Xbox 360 Controller (SFIV) + { MAKE_CONTROLLER_ID( 0x0738, 0x4740 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Beat Pad + { MAKE_CONTROLLER_ID( 0x0738, 0xb726 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox controller - MW2 + { MAKE_CONTROLLER_ID( 0x0738, 0xbeef ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz JOYTECH NEO SE Advanced GamePad + { MAKE_CONTROLLER_ID( 0x0738, 0xcb02 ), k_eControllerType_XBox360Controller, NULL }, // Saitek Cyborg Rumble Pad - PC/Xbox 360 + { MAKE_CONTROLLER_ID( 0x0738, 0xcb03 ), k_eControllerType_XBox360Controller, NULL }, // Saitek P3200 Rumble Pad - PC/Xbox 360 + { MAKE_CONTROLLER_ID( 0x0738, 0xf738 ), k_eControllerType_XBox360Controller, NULL }, // Super SFIV FightStick TE S + { MAKE_CONTROLLER_ID( 0x0955, 0x7210 ), k_eControllerType_XBox360Controller, NULL }, // Nvidia Shield local controller + { MAKE_CONTROLLER_ID( 0x0955, 0xb400 ), k_eControllerType_XBox360Controller, NULL }, // NVIDIA Shield streaming controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0105 ), k_eControllerType_XBox360Controller, NULL }, // HSM3 Xbox360 dancepad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0113 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x011f ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Rock Candy" }, // PDP Rock Candy Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0125 ), k_eControllerType_XBox360Controller, "PDP INJUSTICE FightStick" }, // PDP INJUSTICE FightStick for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0127 ), k_eControllerType_XBox360Controller, "PDP INJUSTICE FightPad" }, // PDP INJUSTICE FightPad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0131 ), k_eControllerType_XBox360Controller, "PDP EA Soccer Controller" }, // PDP EA Soccer Gamepad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0133 ), k_eControllerType_XBox360Controller, "PDP Battlefield 4 Controller" }, // PDP Battlefield 4 Gamepad + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0143 ), k_eControllerType_XBox360Controller, "PDP MK X Fight Stick" }, // PDP MK X Fight Stick for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0147 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Marvel Controller" }, // PDP Marvel Controller for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0201 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0213 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x021f ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Rock Candy" }, // PDP Rock Candy Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0301 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0313 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0314 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Afterglow" }, // PDP Afterglow Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0401 ), k_eControllerType_XBox360Controller, "PDP Xbox 360 Controller" }, // PDP Gamepad for Xbox 360 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0413 ), k_eControllerType_XBox360Controller, NULL }, // PDP Afterglow AX.1 (unlisted) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0501 ), k_eControllerType_XBox360Controller, NULL }, // PDP Xbox 360 Controller (unlisted) + { MAKE_CONTROLLER_ID( 0x0e6f, 0xf900 ), k_eControllerType_XBox360Controller, NULL }, // PDP Afterglow AX.1 (unlisted) + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000a ), k_eControllerType_XBox360Controller, NULL }, // Hori Co. DOA4 FightStick + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000c ), k_eControllerType_XBox360Controller, NULL }, // Hori PadEX Turbo + { MAKE_CONTROLLER_ID( 0x0f0d, 0x000d ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick EX2 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0016 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.EX + { MAKE_CONTROLLER_ID( 0x0f0d, 0x001b ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro VX + { MAKE_CONTROLLER_ID( 0x0f0d, 0x008c ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro 4 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00db ), k_eControllerType_XBox360Controller, "HORI Slime Controller" }, // Hori Dragon Quest Slime Controller + { MAKE_CONTROLLER_ID( 0x1038, 0x1430 ), k_eControllerType_XBox360Controller, "SteelSeries Stratus Duo" }, // SteelSeries Stratus Duo + { MAKE_CONTROLLER_ID( 0x1038, 0x1431 ), k_eControllerType_XBox360Controller, "SteelSeries Stratus Duo" }, // SteelSeries Stratus Duo + { MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_XBox360Controller, NULL }, // SteelSeries Nimbus/Stratus XL + { MAKE_CONTROLLER_ID( 0x11c9, 0x55f0 ), k_eControllerType_XBox360Controller, NULL }, // Nacon GC-100XF + { MAKE_CONTROLLER_ID( 0x12ab, 0x0004 ), k_eControllerType_XBox360Controller, NULL }, // Honey Bee Xbox360 dancepad + { MAKE_CONTROLLER_ID( 0x12ab, 0x0301 ), k_eControllerType_XBox360Controller, NULL }, // PDP AFTERGLOW AX.1 + { MAKE_CONTROLLER_ID( 0x12ab, 0x0303 ), k_eControllerType_XBox360Controller, NULL }, // Mortal Kombat Klassic FightStick + { MAKE_CONTROLLER_ID( 0x1430, 0x02a0 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Controller Adapter + { MAKE_CONTROLLER_ID( 0x1430, 0x4748 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Guitar Hero X-plorer + { MAKE_CONTROLLER_ID( 0x1430, 0xf801 ), k_eControllerType_XBox360Controller, NULL }, // RedOctane Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x0601 ), k_eControllerType_XBox360Controller, NULL }, // BigBen Interactive XBOX 360 Controller +// { MAKE_CONTROLLER_ID( 0x1532, 0x0037 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f00 ), k_eControllerType_XBox360Controller, NULL }, // Power A Mini Pro Elite + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f0a ), k_eControllerType_XBox360Controller, NULL }, // Xbox Airflo wired controller + { MAKE_CONTROLLER_ID( 0x15e4, 0x3f10 ), k_eControllerType_XBox360Controller, NULL }, // Batarang Xbox 360 controller + { MAKE_CONTROLLER_ID( 0x162e, 0xbeef ), k_eControllerType_XBox360Controller, NULL }, // Joytech Neo-Se Take2 + { MAKE_CONTROLLER_ID( 0x1689, 0xfd00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza Tournament Edition + { MAKE_CONTROLLER_ID( 0x1689, 0xfd01 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza Classic Edition + { MAKE_CONTROLLER_ID( 0x1689, 0xfe00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x1949, 0x041a ), k_eControllerType_XBox360Controller, "Amazon Luna Controller" }, // Amazon Luna Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0x0002 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Rock Band Guitar + { MAKE_CONTROLLER_ID( 0x1bad, 0x0003 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Rock Band Drumkit + { MAKE_CONTROLLER_ID( 0x1bad, 0xf016 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf018 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Street Fighter IV SE Fighting Stick + { MAKE_CONTROLLER_ID( 0x1bad, 0xf019 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Brawlstick for Xbox 360 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf021 ), k_eControllerType_XBox360Controller, NULL }, // Mad Cats Ghost Recon FS GamePad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf023 ), k_eControllerType_XBox360Controller, NULL }, // MLG Pro Circuit Controller (Xbox) + { MAKE_CONTROLLER_ID( 0x1bad, 0xf025 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Call Of Duty + { MAKE_CONTROLLER_ID( 0x1bad, 0xf027 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FPS Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf028 ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV FightPad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf02e ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Fightpad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf036 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MicroCon GamePad Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf038 ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV FightStick TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf039 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MvC2 TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03a ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz SFxT Fightstick Pro + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03d ), k_eControllerType_XBox360Controller, NULL }, // Street Fighter IV Arcade Stick TE - Chun Li + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03e ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz MLG FightStick TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xf03f ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick SoulCaliber + { MAKE_CONTROLLER_ID( 0x1bad, 0xf042 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick TES+ + { MAKE_CONTROLLER_ID( 0x1bad, 0xf080 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz FightStick TE2 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf501 ), k_eControllerType_XBox360Controller, NULL }, // HoriPad EX2 Turbo + { MAKE_CONTROLLER_ID( 0x1bad, 0xf502 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.VX SA + { MAKE_CONTROLLER_ID( 0x1bad, 0xf503 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick VX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf504 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro. EX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf505 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick EX2B + { MAKE_CONTROLLER_ID( 0x1bad, 0xf506 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro.EX Premium VLX + { MAKE_CONTROLLER_ID( 0x1bad, 0xf900 ), k_eControllerType_XBox360Controller, NULL }, // Harmonix Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf901 ), k_eControllerType_XBox360Controller, NULL }, // Gamestop Xbox 360 Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf902 ), k_eControllerType_XBox360Controller, NULL }, // Mad Catz Gamepad2 + { MAKE_CONTROLLER_ID( 0x1bad, 0xf903 ), k_eControllerType_XBox360Controller, NULL }, // Tron Xbox 360 controller + { MAKE_CONTROLLER_ID( 0x1bad, 0xf904 ), k_eControllerType_XBox360Controller, NULL }, // PDP Versus Fighting Pad + { MAKE_CONTROLLER_ID( 0x1bad, 0xf906 ), k_eControllerType_XBox360Controller, NULL }, // MortalKombat FightStick + { MAKE_CONTROLLER_ID( 0x1bad, 0xfa01 ), k_eControllerType_XBox360Controller, NULL }, // MadCatz GamePad + { MAKE_CONTROLLER_ID( 0x1bad, 0xfd00 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza TE + { MAKE_CONTROLLER_ID( 0x1bad, 0xfd01 ), k_eControllerType_XBox360Controller, NULL }, // Razer Onza + { MAKE_CONTROLLER_ID( 0x24c6, 0x5000 ), k_eControllerType_XBox360Controller, NULL }, // Razer Atrox Arcade Stick + { MAKE_CONTROLLER_ID( 0x24c6, 0x5300 ), k_eControllerType_XBox360Controller, NULL }, // PowerA MINI PROEX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5303 ), k_eControllerType_XBox360Controller, NULL }, // Xbox Airflo wired controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x530a ), k_eControllerType_XBox360Controller, NULL }, // Xbox 360 Pro EX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x531a ), k_eControllerType_XBox360Controller, NULL }, // PowerA Pro Ex + { MAKE_CONTROLLER_ID( 0x24c6, 0x5397 ), k_eControllerType_XBox360Controller, NULL }, // FUS1ON Tournament Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5500 ), k_eControllerType_XBox360Controller, NULL }, // Hori XBOX 360 EX 2 with Turbo + { MAKE_CONTROLLER_ID( 0x24c6, 0x5501 ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro VX-SA + { MAKE_CONTROLLER_ID( 0x24c6, 0x5502 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Stick VX Alt + { MAKE_CONTROLLER_ID( 0x24c6, 0x5503 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Edge + { MAKE_CONTROLLER_ID( 0x24c6, 0x5506 ), k_eControllerType_XBox360Controller, NULL }, // Hori SOULCALIBUR V Stick + { MAKE_CONTROLLER_ID( 0x24c6, 0x550d ), k_eControllerType_XBox360Controller, NULL }, // Hori GEM Xbox controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x550e ), k_eControllerType_XBox360Controller, NULL }, // Hori Real Arcade Pro V Kai 360 + { MAKE_CONTROLLER_ID( 0x24c6, 0x5508 ), k_eControllerType_XBox360Controller, NULL }, // Hori PAD A + { MAKE_CONTROLLER_ID( 0x24c6, 0x5510 ), k_eControllerType_XBox360Controller, NULL }, // Hori Fighting Commander ONE + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b00 ), k_eControllerType_XBox360Controller, NULL }, // ThrustMaster Ferrari Italia 458 Racing Wheel + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b02 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster, Inc. GPX Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5b03 ), k_eControllerType_XBox360Controller, NULL }, // Thrustmaster Ferrari 458 Racing Wheel + { MAKE_CONTROLLER_ID( 0x24c6, 0x5d04 ), k_eControllerType_XBox360Controller, NULL }, // Razer Sabertooth + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafa ), k_eControllerType_XBox360Controller, NULL }, // Aplay Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafb ), k_eControllerType_XBox360Controller, NULL }, // Aplay Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafc ), k_eControllerType_XBox360Controller, NULL }, // Afterglow Gamepad 1 + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafd ), k_eControllerType_XBox360Controller, NULL }, // Afterglow Gamepad 3 + { MAKE_CONTROLLER_ID( 0x24c6, 0xfafe ), k_eControllerType_XBox360Controller, NULL }, // Rock Candy Gamepad for Xbox 360 + + { MAKE_CONTROLLER_ID( 0x045e, 0x02d1 ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02dd ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One pad (Firmware 2015) + { MAKE_CONTROLLER_ID( 0x045e, 0x02e0 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x02e3 ), k_eControllerType_XBoxOneController, "Xbox One Elite Controller" }, // Microsoft X-Box One Elite pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02ea ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad + { MAKE_CONTROLLER_ID( 0x045e, 0x02fd ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController, NULL }, // Microsoft X-Box One controller with XBOXGIP driver on Windows + { MAKE_CONTROLLER_ID( 0x045e, 0x0b00 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad + { MAKE_CONTROLLER_ID( 0x045e, 0x0b02 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b05 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b0a ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad + { MAKE_CONTROLLER_ID( 0x045e, 0x0b0c ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad (Bluetooth) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b12 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad + { MAKE_CONTROLLER_ID( 0x045e, 0x0b13 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b20 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b21 ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b22 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (BLE) + { MAKE_CONTROLLER_ID( 0x0738, 0x4a01 ), k_eControllerType_XBoxOneController, NULL }, // Mad Catz FightStick TE 2 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0139 ), k_eControllerType_XBoxOneController, "PDP Xbox One Afterglow" }, // PDP Afterglow Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x013B ), k_eControllerType_XBoxOneController, "PDP Xbox One Face-Off Controller" }, // PDP Face-Off Gamepad for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x013a ), k_eControllerType_XBoxOneController, NULL }, // PDP Xbox One Controller (unlisted) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0145 ), k_eControllerType_XBoxOneController, "PDP MK X Fight Pad" }, // PDP MK X Fight Pad for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0146 ), k_eControllerType_XBoxOneController, "PDP Xbox One Rock Candy" }, // PDP Rock Candy Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015b ), k_eControllerType_XBoxOneController, "PDP Fallout 4 Vault Boy Controller" }, // PDP Fallout 4 Vault Boy Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015c ), k_eControllerType_XBoxOneController, "PDP Xbox One @Play Controller" }, // PDP @Play Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015d ), k_eControllerType_XBoxOneController, "PDP Mirror's Edge Controller" }, // PDP Mirror's Edge Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x015f ), k_eControllerType_XBoxOneController, "PDP Metallic Controller" }, // PDP Metallic Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0160 ), k_eControllerType_XBoxOneController, "PDP NFL Face-Off Controller" }, // PDP NFL Official Face-Off Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0161 ), k_eControllerType_XBoxOneController, "PDP Xbox One Camo" }, // PDP Camo Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0162 ), k_eControllerType_XBoxOneController, "PDP Xbox One Controller" }, // PDP Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0163 ), k_eControllerType_XBoxOneController, "PDP Deliverer of Truth" }, // PDP Legendary Collection: Deliverer of Truth + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0164 ), k_eControllerType_XBoxOneController, "PDP Battlefield 1 Controller" }, // PDP Battlefield 1 Official Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0165 ), k_eControllerType_XBoxOneController, "PDP Titanfall 2 Controller" }, // PDP Titanfall 2 Official Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0166 ), k_eControllerType_XBoxOneController, "PDP Mass Effect: Andromeda Controller" }, // PDP Mass Effect: Andromeda Official Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0167 ), k_eControllerType_XBoxOneController, "PDP Halo Wars 2 Face-Off Controller" }, // PDP Halo Wars 2 Official Face-Off Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0205 ), k_eControllerType_XBoxOneController, "PDP Victrix Pro Fight Stick" }, // PDP Victrix Pro Fight Stick + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0206 ), k_eControllerType_XBoxOneController, "PDP Mortal Kombat Controller" }, // PDP Mortal Kombat 25 Anniversary Edition Stick (Xbox One) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0246 ), k_eControllerType_XBoxOneController, "PDP Xbox One Rock Candy" }, // PDP Rock Candy Wired Controller for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0261 ), k_eControllerType_XBoxOneController, "PDP Xbox One Camo" }, // PDP Camo Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0262 ), k_eControllerType_XBoxOneController, "PDP Xbox One Controller" }, // PDP Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Wired Controller for Xbox One - Midnight Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Wired Controller for Xbox One - Verdant Green + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a2 ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Wired Controller for Xbox One - Crimson Red + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a4 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Wired Controller for Xbox One - Stealth Series | Phantom Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Wired Controller for Xbox One - Stealth Series | Ghost White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a6 ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Wired Controller for Xbox One - Stealth Series | Revenant Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a7 ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Wired Controller for Xbox One - Raven Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a8 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02a9 ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Wired Controller for Xbox One - Midnight Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02aa ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Wired Controller for Xbox One - Verdant Green + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ab ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Wired Controller for Xbox One - Crimson Red + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ac ), k_eControllerType_XBoxOneController, "PDP Xbox One Ember Orange" }, // PDP Wired Controller for Xbox One - Ember Orange + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ad ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Wired Controller for Xbox One - Stealth Series | Phantom Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ae ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Wired Controller for Xbox One - Stealth Series | Ghost White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02af ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Wired Controller for Xbox One - Stealth Series | Revenant Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Wired Controller for Xbox One - Raven Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Wired Controller for Xbox One - Arctic White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Afterglow" }, // PDP Afterglow Prismatic Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b5 ), k_eControllerType_XBoxOneController, "PDP Xbox One GAMEware Controller" }, // PDP GAMEware Wired Controller Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02b6 ), k_eControllerType_XBoxOneController, NULL }, // PDP One-Handed Joystick Adaptive Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02bd ), k_eControllerType_XBoxOneController, "PDP Xbox One Royal Purple" }, // PDP Wired Controller for Xbox One - Royal Purple + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02be ), k_eControllerType_XBoxOneController, "PDP Xbox One Raven Black" }, // PDP Deluxe Wired Controller for Xbox One - Raven Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02bf ), k_eControllerType_XBoxOneController, "PDP Xbox One Midnight Blue" }, // PDP Deluxe Wired Controller for Xbox One - Midnight Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c0 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantom Black" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Phantom Black + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c1 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ghost White" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Ghost White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c2 ), k_eControllerType_XBoxOneController, "PDP Xbox One Revenant Blue" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Revenant Blue + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c3 ), k_eControllerType_XBoxOneController, "PDP Xbox One Verdant Green" }, // PDP Deluxe Wired Controller for Xbox One - Verdant Green + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c4 ), k_eControllerType_XBoxOneController, "PDP Xbox One Ember Orange" }, // PDP Deluxe Wired Controller for Xbox One - Ember Orange + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Royal Purple" }, // PDP Deluxe Wired Controller for Xbox One - Royal Purple + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c6 ), k_eControllerType_XBoxOneController, "PDP Xbox One Crimson Red" }, // PDP Deluxe Wired Controller for Xbox One - Crimson Red + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c7 ), k_eControllerType_XBoxOneController, "PDP Xbox One Arctic White" }, // PDP Deluxe Wired Controller for Xbox One - Arctic White + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c8 ), k_eControllerType_XBoxOneController, "PDP Kingdom Hearts Controller" }, // PDP Kingdom Hearts Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02c9 ), k_eControllerType_XBoxOneController, "PDP Xbox One Phantasm Red" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Phantasm Red + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ca ), k_eControllerType_XBoxOneController, "PDP Xbox One Specter Violet" }, // PDP Deluxe Wired Controller for Xbox One - Stealth Series | Specter Violet + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cb ), k_eControllerType_XBoxOneController, "PDP Xbox One Specter Violet" }, // PDP Wired Controller for Xbox One - Stealth Series | Specter Violet + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cd ), k_eControllerType_XBoxOneController, "PDP Xbox One Blu-merang" }, // PDP Rock Candy Wired Controller for Xbox One - Blu-merang + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02ce ), k_eControllerType_XBoxOneController, "PDP Xbox One Cranblast" }, // PDP Rock Candy Wired Controller for Xbox One - Cranblast + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02cf ), k_eControllerType_XBoxOneController, "PDP Xbox One Aqualime" }, // PDP Rock Candy Wired Controller for Xbox One - Aqualime + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d5 ), k_eControllerType_XBoxOneController, "PDP Xbox One Red Camo" }, // PDP Wired Controller for Xbox One - Red Camo + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0346 ), k_eControllerType_XBoxOneController, "PDP Xbox One RC Gamepad" }, // PDP RC Gamepad for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0446 ), k_eControllerType_XBoxOneController, "PDP Xbox One RC Gamepad" }, // PDP RC Gamepad for Xbox One + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02da ), k_eControllerType_XBoxOneController, "PDP Xbox Series X Afterglow" }, // PDP Xbox Series X Afterglow + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d6 ), k_eControllerType_XBoxOneController, "Victrix Gambit Tournament Controller" }, // Victrix Gambit Tournament Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x02d9 ), k_eControllerType_XBoxOneController, "PDP Xbox Series X Midnight Blue" }, // PDP Xbox Series X Midnight Blue + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0063 ), k_eControllerType_XBoxOneController, NULL }, // Hori Real Arcade Pro Hayabusa (USA) Xbox One + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0067 ), k_eControllerType_XBoxOneController, NULL }, // HORIPAD ONE + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0078 ), k_eControllerType_XBoxOneController, NULL }, // Hori Real Arcade Pro V Kai Xbox One + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c5 ), k_eControllerType_XBoxOneController, NULL }, // HORI Fighting Commander + { MAKE_CONTROLLER_ID( 0x1532, 0x0a00 ), k_eControllerType_XBoxOneController, NULL }, // Razer Atrox Arcade Stick + { MAKE_CONTROLLER_ID( 0x1532, 0x0a03 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wildcat + { MAKE_CONTROLLER_ID( 0x1532, 0x0a14 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wolverine Ultimate + { MAKE_CONTROLLER_ID( 0x1532, 0x0a15 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wolverine Tournament Edition + { MAKE_CONTROLLER_ID( 0x20d6, 0x2001 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Black Inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x2002 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Gray/White Inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x2003 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Green Inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x2004 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Pink inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x2005 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Wired Controller Core - Black + { MAKE_CONTROLLER_ID( 0x20d6, 0x2006 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Wired Controller Core - White + { MAKE_CONTROLLER_ID( 0x20d6, 0x2009 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Red inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x200a ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Blue inline + { MAKE_CONTROLLER_ID( 0x20d6, 0x200b ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Camo Metallic Red + { MAKE_CONTROLLER_ID( 0x20d6, 0x200c ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Camo Metallic Blue + { MAKE_CONTROLLER_ID( 0x20d6, 0x200d ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Seafoam Fade + { MAKE_CONTROLLER_ID( 0x20d6, 0x200e ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Midnight Blue + { MAKE_CONTROLLER_ID( 0x20d6, 0x200f ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Soldier Green + { MAKE_CONTROLLER_ID( 0x20d6, 0x2011 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired - Metallic Ice + { MAKE_CONTROLLER_ID( 0x20d6, 0x2012 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X Cuphead EnWired Controller - Mugman + { MAKE_CONTROLLER_ID( 0x20d6, 0x2015 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Blue Hint + { MAKE_CONTROLLER_ID( 0x20d6, 0x2016 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller - Green Hint + { MAKE_CONTROLLER_ID( 0x20d6, 0x2017 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Cntroller - Arctic Camo + { MAKE_CONTROLLER_ID( 0x20d6, 0x2018 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Arc Lightning + { MAKE_CONTROLLER_ID( 0x20d6, 0x2019 ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Royal Purple + { MAKE_CONTROLLER_ID( 0x20d6, 0x201a ), k_eControllerType_XBoxOneController, "PowerA Xbox Series X Controller" }, // PowerA Xbox Series X EnWired Controller Nebula + { MAKE_CONTROLLER_ID( 0x20d6, 0x4001 ), k_eControllerType_XBoxOneController, "PowerA Fusion Pro 2 Controller" }, // PowerA Fusion Pro 2 Wired Controller (Xbox Series X style) + { MAKE_CONTROLLER_ID( 0x20d6, 0x4002 ), k_eControllerType_XBoxOneController, "PowerA Spectra Infinity Controller" }, // PowerA Spectra Infinity Wired Controller (Xbox Series X style) + { MAKE_CONTROLLER_ID( 0x24c6, 0x541a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Xbox One Mini Wired Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x542a ), k_eControllerType_XBoxOneController, NULL }, // Xbox ONE spectra + { MAKE_CONTROLLER_ID( 0x24c6, 0x543a ), k_eControllerType_XBoxOneController, "PowerA Xbox One Controller" }, // PowerA Xbox ONE liquid metal controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x551a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Pro Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x561a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x581a ), k_eControllerType_XBoxOneController, NULL }, // BDA XB1 Classic Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x591a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Pro Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x592a ), k_eControllerType_XBoxOneController, NULL }, // BDA XB1 Spectra Pro + { MAKE_CONTROLLER_ID( 0x24c6, 0x791a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Fusion Fight Pad + { MAKE_CONTROLLER_ID( 0x2e24, 0x0652 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke + { MAKE_CONTROLLER_ID( 0x2e24, 0x1618 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin Duke + { MAKE_CONTROLLER_ID( 0x2e24, 0x1688 ), k_eControllerType_XBoxOneController, NULL }, // Hyperkin X91 + { MAKE_CONTROLLER_ID( 0x146b, 0x0611 ), k_eControllerType_XBoxOneController, NULL }, // Xbox Controller Mode for NACON Revolution 3 + + // These have been added via Minidump for unrecognized Xinput controller assert + { MAKE_CONTROLLER_ID( 0x0000, 0x0000 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x045e, 0x02a2 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller - Microsoft VID + { MAKE_CONTROLLER_ID( 0x0e6f, 0x1414 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0159 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0xfaff ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x006d ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a4 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1832 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x187f ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1883 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x03eb, 0xff01 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2c22, 0x2303 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef8 ), k_eControllerType_XBox360Controller, NULL }, // Homemade fightstick based on brook pcb (with XInput driver??) + { MAKE_CONTROLLER_ID( 0x046d, 0x1000 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1345, 0x6006 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x056e, 0x2012 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x0602 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ae ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x046d, 0x0401 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0x0301 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0xcaa3 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0xc261 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x046d, 0x0291 ), k_eControllerType_XBox360Controller, NULL }, // logitech xinput + { MAKE_CONTROLLER_ID( 0x0079, 0x18d3 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00b1 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0001, 0x0001 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x188e ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x187c ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x189c ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x0079, 0x1874 ), k_eControllerType_XBox360Controller, NULL }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x2f24, 0x0050 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x2e ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x9886, 0x24 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x91 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x719 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xed ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xc0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x152 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a7 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x1007 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2b8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2c22, 0x2503 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + + /* Added from Minidumps 10-9-19 */ + { MAKE_CONTROLLER_ID( 0x0, 0x6686 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x11ff, 0x511 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x12ab, 0x304 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x291 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x2a9 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1430, 0x70b ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x604 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x605 ), k_eControllerType_XBoxOneController, NULL }, // NACON PS4 controller in Xbox mode - might also be other bigben brand xbox controllers + { MAKE_CONTROLLER_ID( 0x146b, 0x606 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x146b, 0x609 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0x28e ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0x2a0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x1bad, 0x5500 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x20ab, 0x55ef ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x5509 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2516, 0x69 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x25b1, 0x360 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2c22, 0x2203 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x11 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x53 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0xb7 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x1004 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0x1008 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x46d, 0xf301 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0x2a0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0x7263 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0xb738 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0xcb29 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x738, 0xf401 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18c2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18c8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x79, 0x18cf ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xc12, 0xe17 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xc12, 0xe1c ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xc12, 0xe22 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xc12, 0xe30 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xd2d2, 0xd2d2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xd62, 0x9a1a ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xd62, 0x9a1b ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe00, 0xe00 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x12a ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2a5 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2b2 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2bd ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2bf ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2c0 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0x2c6 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0x97 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xba ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xf0d, 0xd8 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xfff, 0x2a1 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x45e, 0x867 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + // Added 12-17-2020 + { MAKE_CONTROLLER_ID( 0x16d0, 0xf3f ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0x2f24, 0x8f ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + { MAKE_CONTROLLER_ID( 0xe6f, 0xf501 ), k_eControllerType_XBoxOneController, NULL }, // Unknown Controller + + //{ MAKE_CONTROLLER_ID( 0x1949, 0x0402 ), /*android*/, NULL }, // Unknown Controller + + { MAKE_CONTROLLER_ID( 0x05ac, 0x0001 ), k_eControllerType_AppleController, NULL }, // MFI Extended Gamepad (generic entry for iOS/tvOS) + { MAKE_CONTROLLER_ID( 0x05ac, 0x0002 ), k_eControllerType_AppleController, NULL }, // MFI Standard Gamepad (generic entry for iOS/tvOS) + + // We now support Joy-Cons if SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS is set to "1", but they won't be combined into one controller. + { MAKE_CONTROLLER_ID( 0x057e, 0x2006 ), k_eControllerType_SwitchJoyConLeft, NULL }, // Nintendo Switch Joy-Con (Left) + { MAKE_CONTROLLER_ID( 0x057e, 0x2007 ), k_eControllerType_SwitchJoyConRight, NULL }, // Nintendo Switch Joy-Con (Right) + + // This same controller ID is spoofed by many 3rd-party Switch controllers. + // The ones we currently know of are: + // * Any 8bitdo controller with Switch support + // * ORTZ Gaming Wireless Pro Controller + // * ZhiXu Gamepad Wireless + // * Sunwaytek Wireless Motion Controller for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController, NULL }, // Nintendo Switch Pro Controller + + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORIPAD for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Pokken Tournament DX Pro Pad + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00f6 ), k_eControllerType_SwitchProController, NULL }, // HORI Wireless Switch Pad +#ifdef _WIN32 + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_XInputSwitchController, NULL }, // HORI Fighting Commander - Is a Switch controller but shows up through XInput on Windows. +#else + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00dc ), k_eControllerType_SwitchProController, "HORI Fighting Commander" }, +#endif + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0180 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Pro Controller for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0181 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Deluxe Wired Pro Controller for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0184 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Deluxe+ Audio Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0185 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Wired Fight Pad Pro for Nintendo Switch + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0186 ), k_eControllerType_SwitchProController, NULL }, // PDP Afterglow Wireless Switch Controller - working gyro. USB is for charging only. Many later "Wireless" line devices w/ gyro also use this vid/pid + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0187 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Rockcandy Wired Controller + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0188 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Afterglow Wired Deluxe+ Audio Controller + { MAKE_CONTROLLER_ID( 0x0f0d, 0x00aa ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Real Arcade Pro V Hayabusa in Switch Mode + { MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Wired Controller Plus/PowerA Wired Controller Nintendo GameCube Style + { MAKE_CONTROLLER_ID( 0x20d6, 0xa712 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Fusion Fight Pad + { MAKE_CONTROLLER_ID( 0x20d6, 0xa713 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Super Mario Controller + { MAKE_CONTROLLER_ID( 0x20d6, 0xa714 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Spectra Controller + { MAKE_CONTROLLER_ID( 0x20d6, 0xa715 ), k_eControllerType_SwitchInputOnlyController, NULL }, // Power A Fusion Wireless Arcade Stick (USB Mode) Over BT is shows up as 057e 2009 + { MAKE_CONTROLLER_ID( 0x20d6, 0xa716 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PowerA Nintendo Switch Fusion Pro Controller - USB requires toggling switch on back of device + + // Valve products + { MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch, NULL }, // Streaming mobile touch virtual controls + { MAKE_CONTROLLER_ID( 0x28de, 0x1101 ), k_eControllerType_SteamController, NULL }, // Valve Legacy Steam Controller (CHELL) + { MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController, NULL }, // Valve wired Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamController, NULL }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamController, NULL }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController, NULL }, // Valve wireless Steam Controller + { MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamControllerV2, NULL }, // Valve wired Steam Controller (HEADCRAB) + { MAKE_CONTROLLER_ID( 0x28de, 0x1202 ), k_eControllerType_SteamControllerV2, NULL }, // Valve Bluetooth Steam Controller (HEADCRAB) +}; + +static SDL_INLINE const char *GetControllerTypeOverride( int nVID, int nPID ) +{ + const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERTYPE); + if (hint) { + char key[32]; + const char *spot = NULL; + + SDL_snprintf(key, sizeof(key), "0x%.4x/0x%.4x=", nVID, nPID); + spot = SDL_strstr(hint, key); + if (!spot) { + SDL_snprintf(key, sizeof(key), "0x%.4X/0x%.4X=", nVID, nPID); + spot = SDL_strstr(hint, key); + } + if (spot) { + spot += SDL_strlen(key); + if (SDL_strncmp(spot, "k_eControllerType_", 18) == 0) { + spot += 18; + } + return spot; + } + } + return NULL; +} + +static SDL_INLINE EControllerType GuessControllerType( int nVID, int nPID ) +{ +#if 0//def _DEBUG + // Verify that there are no duplicates in the controller list + // If the list were sorted, we could do this much more efficiently, as well as improve lookup speed. + static bool s_bCheckedForDuplicates; + if ( !s_bCheckedForDuplicates ) + { + s_bCheckedForDuplicates = true; + int i, j; + for ( i = 0; i < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++i ) + { + for ( j = i + 1; j < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++j ) + { + if ( arrControllers[ i ].m_unDeviceID == arrControllers[ j ].m_unDeviceID ) + { + Log( "Duplicate controller entry found for VID 0x%.4x PID 0x%.4x\n", ( arrControllers[ i ].m_unDeviceID >> 16 ), arrControllers[ i ].m_unDeviceID & 0xFFFF ); + } + } + } + } +#endif // _DEBUG + + unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID ); + int iIndex; + + const char *pszOverride = GetControllerTypeOverride( nVID, nPID ); + if ( pszOverride ) + { + if ( SDL_strncasecmp( pszOverride, "Xbox360", 7 ) == 0 ) + { + return k_eControllerType_XBox360Controller; + } + if ( SDL_strncasecmp( pszOverride, "XboxOne", 7 ) == 0 ) + { + return k_eControllerType_XBoxOneController; + } + if ( SDL_strncasecmp( pszOverride, "PS3", 3 ) == 0 ) + { + return k_eControllerType_PS3Controller; + } + if ( SDL_strncasecmp( pszOverride, "PS4", 3 ) == 0 ) + { + return k_eControllerType_PS4Controller; + } + if ( SDL_strncasecmp( pszOverride, "PS5", 3 ) == 0 ) + { + return k_eControllerType_PS5Controller; + } + if ( SDL_strncasecmp( pszOverride, "SwitchPro", 9 ) == 0 ) + { + return k_eControllerType_SwitchProController; + } + if ( SDL_strncasecmp( pszOverride, "Steam", 5 ) == 0 ) + { + return k_eControllerType_SteamController; + } + return k_eControllerType_UnknownNonSteamController; + } + + for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex ) + { + if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID ) + { + return arrControllers[ iIndex ].m_eControllerType; + } + } + + return k_eControllerType_UnknownNonSteamController; + +} + +static SDL_INLINE const char *GuessControllerName( int nVID, int nPID ) +{ + unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID ); + int iIndex; + for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex ) + { + if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID ) + { + return arrControllers[ iIndex ].m_pszName; + } + } + + return NULL; + +} + +#undef MAKE_CONTROLLER_ID + +static SDL_INLINE int GetDefaultDeadzoneSizeForControllerType( EControllerType eControllerType ) +{ + switch ( eControllerType ) + { + case k_eControllerType_UnknownNonSteamController: + case k_eControllerType_XBoxOneController: + case k_eControllerType_XBox360Controller: + case k_eControllerType_AppleController: + case k_eControllerType_AndroidController: + case k_eControllerType_PS3Controller: + case k_eControllerType_PS5Controller: + return 10000; + case k_eControllerType_SteamControllerV2: + return 8192; + case k_eControllerType_PS4Controller: + return 4096; + case k_eControllerType_SwitchJoyConLeft: + case k_eControllerType_SwitchJoyConRight: + case k_eControllerType_SwitchJoyConPair: + return 8192; // Actual dead-zone should be 15% of full-scale, but we use this to account for variances in 3rd-party controllers + case k_eControllerType_SwitchProController: + return 8192; // Actual dead-zone should be closer to 10% of full-scale, but we use this to account for variances in 3rd-party controllers + default: + return 8192; + } +} + +#endif // CONSTANTS_H -/* vi: set ts=4 sw=4 noexpandtab: */ diff --git a/externals/SDL/src/joystick/darwin/SDL_iokitjoystick.c b/externals/SDL/src/joystick/darwin/SDL_iokitjoystick.c index 91072c52e..7f2514728 100755 --- a/externals/SDL/src/joystick/darwin/SDL_iokitjoystick.c +++ b/externals/SDL/src/joystick/darwin/SDL_iokitjoystick.c @@ -744,6 +744,7 @@ DARWIN_JoystickDetect(void) } } +/* Function to get the device-dependent name of a joystick */ const char * DARWIN_JoystickGetDeviceName(int device_index) { @@ -751,12 +752,6 @@ DARWIN_JoystickGetDeviceName(int device_index) return device ? device->product : "UNKNOWN"; } -const char * -DARWIN_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - static int DARWIN_JoystickGetDevicePlayerIndex(int device_index) { @@ -1120,7 +1115,6 @@ SDL_JoystickDriver SDL_DARWIN_JoystickDriver = DARWIN_JoystickGetCount, DARWIN_JoystickDetect, DARWIN_JoystickGetDeviceName, - DARWIN_JoystickGetDevicePath, DARWIN_JoystickGetDevicePlayerIndex, DARWIN_JoystickSetDevicePlayerIndex, DARWIN_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/dummy/SDL_sysjoystick.c b/externals/SDL/src/joystick/dummy/SDL_sysjoystick.c index 3cf8da5f9..ec1c8e651 100755 --- a/externals/SDL/src/joystick/dummy/SDL_sysjoystick.c +++ b/externals/SDL/src/joystick/dummy/SDL_sysjoystick.c @@ -52,12 +52,6 @@ DUMMY_JoystickGetDeviceName(int device_index) return NULL; } -static const char * -DUMMY_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - static int DUMMY_JoystickGetDevicePlayerIndex(int device_index) { @@ -152,7 +146,6 @@ SDL_JoystickDriver SDL_DUMMY_JoystickDriver = DUMMY_JoystickGetCount, DUMMY_JoystickDetect, DUMMY_JoystickGetDeviceName, - DUMMY_JoystickGetDevicePath, DUMMY_JoystickGetDevicePlayerIndex, DUMMY_JoystickSetDevicePlayerIndex, DUMMY_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/emscripten/SDL_sysjoystick.c b/externals/SDL/src/joystick/emscripten/SDL_sysjoystick.c index 1664a907c..eb0ff2a74 100755 --- a/externals/SDL/src/joystick/emscripten/SDL_sysjoystick.c +++ b/externals/SDL/src/joystick/emscripten/SDL_sysjoystick.c @@ -280,12 +280,6 @@ EMSCRIPTEN_JoystickGetDeviceName(int device_index) return JoystickByDeviceIndex(device_index)->name; } -static const char * -EMSCRIPTEN_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - static int EMSCRIPTEN_JoystickGetDevicePlayerIndex(int device_index) { @@ -450,7 +444,6 @@ SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver = EMSCRIPTEN_JoystickGetCount, EMSCRIPTEN_JoystickDetect, EMSCRIPTEN_JoystickGetDeviceName, - EMSCRIPTEN_JoystickGetDevicePath, EMSCRIPTEN_JoystickGetDevicePlayerIndex, EMSCRIPTEN_JoystickSetDevicePlayerIndex, EMSCRIPTEN_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/haiku/SDL_haikujoystick.cc b/externals/SDL/src/joystick/haiku/SDL_haikujoystick.cc index c0c6e012c..38a975227 100755 --- a/externals/SDL/src/joystick/haiku/SDL_haikujoystick.cc +++ b/externals/SDL/src/joystick/haiku/SDL_haikujoystick.cc @@ -64,15 +64,15 @@ extern "C" char name[B_OS_NAME_LENGTH]; /* Search for attached joysticks */ - nports = joystick.CountDevices(); - numjoysticks = 0; - SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport)); - SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname)); + nports = joystick.CountDevices(); + numjoysticks = 0; + SDL_memset(SDL_joyport, 0, (sizeof SDL_joyport)); + SDL_memset(SDL_joyname, 0, (sizeof SDL_joyname)); for (i = 0; (numjoysticks < MAX_JOYSTICKS) && (i < nports); ++i) { if (joystick.GetDeviceName(i, name) == B_OK) { if (joystick.Open(name) != B_ERROR) { - BString stick_name; + BString stick_name; joystick.GetControllerName(&stick_name); SDL_joyport[numjoysticks] = SDL_strdup(name); SDL_joyname[numjoysticks] = SDL_CreateJoystickName(0, 0, NULL, stick_name.String()); @@ -93,16 +93,12 @@ extern "C" { } +/* Function to get the device-dependent name of a joystick */ static const char *HAIKU_JoystickGetDeviceName(int device_index) { return SDL_joyname[device_index]; } - static const char *HAIKU_JoystickGetDevicePath(int device_index) - { - return SDL_joyport[device_index]; - } - static int HAIKU_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -302,7 +298,6 @@ extern "C" HAIKU_JoystickGetCount, HAIKU_JoystickDetect, HAIKU_JoystickGetDeviceName, - HAIKU_JoystickGetDevicePath, HAIKU_JoystickGetDevicePlayerIndex, HAIKU_JoystickSetDevicePlayerIndex, HAIKU_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_gamecube.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_gamecube.c index dad4daeaa..5af93da60 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_gamecube.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_gamecube.c @@ -53,7 +53,6 @@ typedef struct { /* Without this variable, hid_write starts to lag a TON */ SDL_bool rumbleUpdate; SDL_bool m_bUseButtonLabels; - SDL_bool useRumbleBrake; } SDL_DriverGameCube_Context; static SDL_bool @@ -71,7 +70,7 @@ HIDAPI_DriverGameCube_IsSupportedDevice(const char *name, SDL_GameControllerType } static const char * -HIDAPI_DriverGameCube_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverGameCube_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { return "Nintendo GameCube Controller"; } @@ -93,14 +92,6 @@ static void SDLCALL SDL_GameControllerButtonReportingHintChanged(void *userdata, ctx->m_bUseButtonLabels = SDL_GetStringBoolean(hint, SDL_TRUE); } -static void SDLCALL SDL_JoystickGameCubeRumbleBrakeHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) -{ - if (hint) { - SDL_DriverGameCube_Context *ctx = (SDL_DriverGameCube_Context *)userdata; - ctx->useRumbleBrake = SDL_GetStringBoolean(hint, SDL_FALSE); - } -} - static Uint8 RemapButton(SDL_DriverGameCube_Context *ctx, Uint8 button) { if (!ctx->m_bUseButtonLabels) { @@ -151,7 +142,6 @@ HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device) ctx->joysticks[2] = -1; ctx->joysticks[3] = -1; ctx->rumble[0] = rumbleMagic; - ctx->useRumbleBrake = SDL_FALSE; if (device->vendor_id != USB_VENDOR_NINTENDO) { ctx->pc_mode = SDL_TRUE; @@ -205,8 +195,6 @@ HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device) } } - SDL_AddHintCallback(SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE, - SDL_JoystickGameCubeRumbleBrakeHintChanged, ctx); SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, SDL_GameControllerButtonReportingHintChanged, ctx); @@ -451,22 +439,12 @@ HIDAPI_DriverGameCube_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *jo for (i = 0; i < MAX_CONTROLLERS; i += 1) { if (joystick->instance_id == ctx->joysticks[i]) { if (ctx->wireless[i]) { - return SDL_SetError("Nintendo GameCube WaveBird controllers do not support rumble"); + return SDL_SetError("Ninteno GameCube WaveBird controllers do not support rumble"); } if (!ctx->rumbleAllowed[i]) { return SDL_SetError("Second USB cable for WUP-028 not connected"); } - if (ctx->useRumbleBrake) { - if (low_frequency_rumble == 0 && high_frequency_rumble > 0) { - val = 0; /* if only low is 0 we want to do a regular stop*/ - } else if (low_frequency_rumble == 0 && high_frequency_rumble == 0) { - val = 2; /* if both frequencies are 0 we want to do a hard stop */ - } else { - val = 1; /* normal rumble */ - } - } else { - val = (low_frequency_rumble > 0 || high_frequency_rumble > 0); - } + val = (low_frequency_rumble > 0 || high_frequency_rumble > 0); if (val != ctx->rumble[i + 1]) { ctx->rumble[i + 1] = val; ctx->rumbleUpdate = SDL_TRUE; @@ -476,7 +454,8 @@ HIDAPI_DriverGameCube_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *jo } /* Should never get here! */ - return SDL_SetError("Couldn't find joystick"); + SDL_SetError("Couldn't find joystick"); + return -1; } static int @@ -544,8 +523,6 @@ HIDAPI_DriverGameCube_FreeDevice(SDL_HIDAPI_Device *device) SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, SDL_GameControllerButtonReportingHintChanged, ctx); - SDL_DelHintCallback(SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE, - SDL_JoystickGameCubeRumbleBrakeHintChanged, ctx); SDL_LockMutex(device->dev_lock); { diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_luna.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_luna.c index 4b283e284..ead55af34 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_luna.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_luna.c @@ -54,7 +54,7 @@ HIDAPI_DriverLuna_IsSupportedDevice(const char *name, SDL_GameControllerType typ } static const char * -HIDAPI_DriverLuna_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverLuna_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { return "Amazon Luna Controller"; } @@ -267,16 +267,16 @@ HIDAPI_DriverLuna_HandleBluetoothStatePacket(SDL_Joystick *joystick, SDL_DriverL /* Battery level report */ int level = data[1] * 100 / 0xFF; if (level == 0) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); + joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; } else if (level <= 20) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); + joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; } else if (level <= 70) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); + joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; } else { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); + joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; } return; diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_ps4.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_ps4.c index 7c87043cf..129541266 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -155,7 +155,7 @@ HIDAPI_DriverPS4_IsSupportedDevice(const char *name, SDL_GameControllerType type } static const char * -HIDAPI_DriverPS4_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverPS4_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { if (vendor_id == USB_VENDOR_SONY) { return "PS4 Controller"; @@ -177,12 +177,6 @@ static SDL_bool HIDAPI_DriverPS4_CanRumble(Uint16 vendor_id, Uint16 product_id) (product_id == USB_PRODUCT_RAZER_PANTHERA || product_id == USB_PRODUCT_RAZER_PANTHERA_EVO)) { return SDL_FALSE; } - - /* The Victrix Pro FS v2 will hang on reboot if we send output reports */ - if (vendor_id == USB_VENDOR_PDP && product_id == USB_PRODUCT_VICTRIX_FS_PRO_V2) { - return SDL_FALSE; - } - return SDL_TRUE; } @@ -801,18 +795,18 @@ HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev, SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); if (packet->ucBatteryLevel & 0x10) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; } else { /* Battery level ranges from 0 to 10 */ int level = (packet->ucBatteryLevel & 0xF); if (level == 0) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); + joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; } else if (level <= 2) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); + joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; } else if (level <= 7) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); + joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; } else { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); + joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; } } diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_ps5.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_ps5.c index ed9ab7886..6d7f87d59 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -59,7 +59,6 @@ typedef enum { k_EPS5FeatureReportIdCalibration = 0x05, k_EPS5FeatureReportIdSerialNumber = 0x09, - k_EPS5FeatureReportIdFirmwareInfo = 0x20, } EPS5FeatureReportId; typedef struct @@ -185,7 +184,7 @@ HIDAPI_DriverPS5_IsSupportedDevice(const char *name, SDL_GameControllerType type } static const char * -HIDAPI_DriverPS5_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverPS5_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { if (vendor_id == USB_VENDOR_SONY) { return "PS5 Controller"; @@ -602,13 +601,6 @@ HIDAPI_DriverPS5_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) data[6], data[5], data[4], data[3], data[2], data[1]); joystick->serial = SDL_strdup(serial); } - - /* Read the firmware version - This will also enable enhanced reports over Bluetooth - */ - if (ReadFeatureReport(device->dev, k_EPS5FeatureReportIdFirmwareInfo, data, USB_PACKET_LENGTH) >= 46) { - joystick->firmware_version = (Uint16)data[44] | ((Uint16)data[45] << 8); - } } if (!joystick->serial && device->serial && SDL_strlen(device->serial) == 12) { @@ -755,11 +747,7 @@ HIDAPI_DriverPS5_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joy } } - if (SDL_HIDAPI_SendRumbleAndUnlock(device, data, report_size) != report_size) { - return -1; - } - - return 0; + return SDL_HIDAPI_SendRumbleAndUnlock(device, data, report_size); } static int @@ -969,10 +957,7 @@ HIDAPI_DriverPS5_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_device *dev, axis = ((int)packet->ucRightJoystickY * 257) - 32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); - /* A check of packet->ucBatteryLevel & 0x10 should work as a check for BT vs USB but doesn't - * seem to always work. Possibly related to being 100% charged? - */ - if (!ctx->is_bluetooth) { + if (packet->ucBatteryLevel & 0x10) { /* 0x20 set means fully charged */ SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); } else { diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_rumble.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_rumble.c index 9cbdb9599..bf376277e 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_rumble.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_rumble.c @@ -53,7 +53,7 @@ typedef struct SDL_HIDAPI_RumbleContext static SDL_HIDAPI_RumbleContext rumble_context; -static int SDLCALL SDL_HIDAPI_RumbleThread(void *data) +static int SDL_HIDAPI_RumbleThread(void *data) { SDL_HIDAPI_RumbleContext *ctx = (SDL_HIDAPI_RumbleContext *)data; diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_stadia.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_stadia.c index 35025db9e..0a5c2584f 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_stadia.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_stadia.c @@ -55,7 +55,7 @@ HIDAPI_DriverStadia_IsSupportedDevice(const char *name, SDL_GameControllerType t } static const char * -HIDAPI_DriverStadia_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverStadia_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { return "Google Stadia Controller"; } diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_steam.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_steam.c index bbf1f0e2b..b69c598dc 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_steam.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_steam.c @@ -1004,7 +1004,7 @@ HIDAPI_DriverSteam_IsSupportedDevice(const char *name, SDL_GameControllerType ty } static const char * -HIDAPI_DriverSteam_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverSteam_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { return "Steam Controller"; } diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_switch.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_switch.c index 3fbd91e02..d97e1f9c8 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_switch.c @@ -63,11 +63,6 @@ #define SWITCH_GYRO_SCALE 14.2842f #define SWITCH_ACCEL_SCALE 4096.f -#define SWITCH_GYRO_SCALE_OFFSET 13371.0f -#define SWITCH_GYRO_SCALE_MULT 936.0f -#define SWITCH_ACCEL_SCALE_OFFSET 16384.0f -#define SWITCH_ACCEL_SCALE_MULT 4.0f - typedef enum { k_eSwitchInputReportIDs_SubcommandReply = 0x21, k_eSwitchInputReportIDs_FullControllerState = 0x30, @@ -119,14 +114,6 @@ typedef enum { #define k_unSPIStickCalibrationEndOffset 0x604E #define k_unSPIStickCalibrationLength (k_unSPIStickCalibrationEndOffset - k_unSPIStickCalibrationStartOffset + 1) -#define k_unSPIIMUScaleStartOffset 0x6020 -#define k_unSPIIMUScaleEndOffset 0x6037 -#define k_unSPIIMUScaleLength (k_unSPIIMUScaleEndOffset - k_unSPIIMUScaleStartOffset + 1) - -#define k_unSPIIMUUserScaleStartOffset 0x8026 -#define k_unSPIIMUUserScaleEndOffset 0x8039 -#define k_unSPIIMUUserScaleLength (k_unSPIIMUUserScaleEndOffset - k_unSPIIMUUserScaleStartOffset + 1) - #pragma pack(1) typedef struct { @@ -279,16 +266,6 @@ typedef struct { Sint16 sMax; } axis[2]; } m_StickExtents[2]; - - struct IMUScaleData { - float fAccelScaleX; - float fAccelScaleY; - float fAccelScaleZ; - - float fGyroScaleX; - float fGyroScaleY; - float fGyroScaleZ; - } m_IMUScaleData; } SDL_DriverSwitch_Context; @@ -305,29 +282,9 @@ HasHomeLED(int vendor_id, int product_id) return SDL_FALSE; } - /* The Nintendo Online classic controllers don't have a Home LED */ - if (vendor_id == USB_VENDOR_NINTENDO && - (product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER || - product_id == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER || - product_id == USB_PRODUCT_NINTENDO_SNES_CONTROLLER)) { - return SDL_FALSE; - } - return SDL_TRUE; } -static SDL_bool -AlwaysUsesLabels(int vendor_id, int product_id) -{ - /* These controllers don't have a diamond button configuration, so always use labels */ - if (vendor_id == USB_VENDOR_NINTENDO && - (product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER || - product_id == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER)) { - return SDL_TRUE; - } - return SDL_FALSE; -} - static SDL_bool IsGameCubeFormFactor(int vendor_id, int product_id) { @@ -362,7 +319,7 @@ HIDAPI_DriverSwitch_IsSupportedDevice(const char *name, SDL_GameControllerType t } static const char * -HIDAPI_DriverSwitch_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverSwitch_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { /* Give a user friendly name for this controller */ if (vendor_id == USB_VENDOR_NINTENDO) { @@ -375,24 +332,8 @@ HIDAPI_DriverSwitch_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 pro } if (product_id == USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_RIGHT) { - /* Use the given name for the Nintendo Online NES Controllers */ - if (SDL_strncmp(name, "NES Controller", 14) == 0) { - return name; - } return "Nintendo Switch Joy-Con Right"; } - - if (product_id == USB_PRODUCT_NINTENDO_N64_CONTROLLER) { - return "Nintendo N64 Controller"; - } - - if (product_id == USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER) { - return "Nintendo SEGA Genesis Controller"; - } - - if (product_id == USB_PRODUCT_NINTENDO_SNES_CONTROLLER) { - return "Nintendo SNES Controller"; - } } return "Nintendo Switch Pro Controller"; @@ -828,72 +769,6 @@ static SDL_bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx, Uint8 input_ return SDL_TRUE; } -static SDL_bool LoadIMUCalibration(SDL_DriverSwitch_Context* ctx) -{ - Uint8* pIMUScale; - SwitchSubcommandInputPacket_t* reply = NULL; - Sint16 sAccelRawX, sAccelRawY, sAccelRawZ, sGyroRawX, sGyroRawY, sGyroRawZ; - - /* Read Calibration Info */ - SwitchSPIOpData_t readParams; - readParams.unAddress = k_unSPIIMUScaleStartOffset; - readParams.ucLength = k_unSPIIMUScaleLength; - - if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t*)&readParams, sizeof(readParams), &reply)) { - const float accelScale = SDL_STANDARD_GRAVITY / SWITCH_ACCEL_SCALE; - const float gyroScale = (float)M_PI / 180.0f / SWITCH_GYRO_SCALE; - - ctx->m_IMUScaleData.fAccelScaleX = accelScale; - ctx->m_IMUScaleData.fAccelScaleY = accelScale; - ctx->m_IMUScaleData.fAccelScaleZ = accelScale; - - ctx->m_IMUScaleData.fGyroScaleX = gyroScale; - ctx->m_IMUScaleData.fGyroScaleY = gyroScale; - ctx->m_IMUScaleData.fGyroScaleZ = gyroScale; - - return SDL_FALSE; - } - - /* IMU scale gives us multipliers for converting raw values to real world values */ - pIMUScale = reply->spiReadData.rgucReadData; - - sAccelRawX = ((pIMUScale[1] << 8) & 0xF00) | pIMUScale[0]; - sAccelRawY = ((pIMUScale[3] << 8) & 0xF00) | pIMUScale[2]; - sAccelRawZ = ((pIMUScale[5] << 8) & 0xF00) | pIMUScale[4]; - - sGyroRawX = ((pIMUScale[13] << 8) & 0xF00) | pIMUScale[12]; - sGyroRawY = ((pIMUScale[15] << 8) & 0xF00) | pIMUScale[14]; - sGyroRawZ = ((pIMUScale[17] << 8) & 0xF00) | pIMUScale[16]; - - /* Check for user calibration data. If it's present and set, it'll override the factory settings */ - readParams.unAddress = k_unSPIIMUUserScaleStartOffset; - readParams.ucLength = k_unSPIIMUUserScaleLength; - if (WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t*)&readParams, sizeof(readParams), &reply) && (pIMUScale[0] | pIMUScale[1] << 8) == 0xA1B2) { - pIMUScale = reply->spiReadData.rgucReadData; - - sAccelRawX = ((pIMUScale[3] << 8) & 0xF00) | pIMUScale[2]; - sAccelRawY = ((pIMUScale[5] << 8) & 0xF00) | pIMUScale[4]; - sAccelRawZ = ((pIMUScale[7] << 8) & 0xF00) | pIMUScale[6]; - - sGyroRawX = ((pIMUScale[15] << 8) & 0xF00) | pIMUScale[14]; - sGyroRawY = ((pIMUScale[17] << 8) & 0xF00) | pIMUScale[16]; - sGyroRawZ = ((pIMUScale[19] << 8) & 0xF00) | pIMUScale[18]; - } - - /* Accelerometer scale */ - ctx->m_IMUScaleData.fAccelScaleX = SWITCH_ACCEL_SCALE_MULT / (float)(SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawX) * SDL_STANDARD_GRAVITY; - ctx->m_IMUScaleData.fAccelScaleY = SWITCH_ACCEL_SCALE_MULT / (float)(SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawY) * SDL_STANDARD_GRAVITY; - ctx->m_IMUScaleData.fAccelScaleZ = SWITCH_ACCEL_SCALE_MULT / (float)(SWITCH_ACCEL_SCALE_OFFSET - (float)sAccelRawZ) * SDL_STANDARD_GRAVITY; - - /* Gyro scale */ - ctx->m_IMUScaleData.fGyroScaleX = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawX) * (float)M_PI / 180.0f; - ctx->m_IMUScaleData.fGyroScaleY = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawY) * (float)M_PI / 180.0f; - ctx->m_IMUScaleData.fGyroScaleZ = SWITCH_GYRO_SCALE_MULT / (float)(SWITCH_GYRO_SCALE_OFFSET - (float)sGyroRawZ) * (float)M_PI / 180.0f; - - return SDL_TRUE; -} - - static Sint16 ApplyStickCalibrationCentered(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue, Sint16 sCenter) { sRawValue -= sCenter; @@ -1039,11 +914,6 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti goto error; } - if (!LoadIMUCalibration(ctx)) { - SDL_SetError("Couldn't load sensor calibration"); - goto error; - } - if (!SetVibrationEnabled(ctx, 1)) { SDL_SetError("Couldn't enable vibration"); goto error; @@ -1097,12 +967,8 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti ctx->m_bIsGameCube = SDL_TRUE; } - if (AlwaysUsesLabels(device->vendor_id, device->product_id)) { - ctx->m_bUseButtonLabels = SDL_TRUE; - } else { - SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, - SDL_GameControllerButtonReportingHintChanged, ctx); - } + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, + SDL_GameControllerButtonReportingHintChanged, ctx); /* Initialize the joystick capabilities */ if (ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft || @@ -1157,7 +1023,8 @@ HIDAPI_DriverSwitch_ActuallyRumbleJoystick(SDL_DriverSwitch_Context *ctx, Uint16 ctx->m_bRumbleActive = (low_frequency_rumble || high_frequency_rumble) ? SDL_TRUE : SDL_FALSE; if (!WriteRumble(ctx)) { - return SDL_SetError("Couldn't send rumble packet"); + SDL_SetError("Couldn't send rumble packet"); + return -1; } return 0; } @@ -1280,6 +1147,20 @@ HIDAPI_DriverSwitch_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joy return 0; } +static float +HIDAPI_DriverSwitch_ScaleGyro(Sint16 value) +{ + float result = (value / SWITCH_GYRO_SCALE) * (float)M_PI / 180.0f; + return result; +} + +static float +HIDAPI_DriverSwitch_ScaleAccel(Sint16 value) +{ + float result = (value / SWITCH_ACCEL_SCALE) * SDL_STANDARD_GRAVITY; + return result; +} + static void HandleInputOnlyControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SwitchInputOnlyControllerStatePacket_t *packet) { Sint16 axis; @@ -1477,13 +1358,13 @@ static void SendSensorUpdate(SDL_Joystick *joystick, SDL_DriverSwitch_Context *c * users will want consistent axis mappings across devices. */ if (type == SDL_SENSOR_GYRO) { - data[0] = -(ctx->m_IMUScaleData.fGyroScaleY * (float)values[1]); - data[1] = ctx->m_IMUScaleData.fGyroScaleZ * (float)values[2]; - data[2] = -(ctx->m_IMUScaleData.fGyroScaleX * (float)values[0]); + data[0] = -HIDAPI_DriverSwitch_ScaleGyro(values[1]); + data[1] = HIDAPI_DriverSwitch_ScaleGyro(values[2]); + data[2] = -HIDAPI_DriverSwitch_ScaleGyro(values[0]); } else { - data[0] = -(ctx->m_IMUScaleData.fAccelScaleY * (float)values[1]); - data[1] = ctx->m_IMUScaleData.fAccelScaleZ * (float)values[2]; - data[2] = -(ctx->m_IMUScaleData.fAccelScaleX * (float)values[0]); + data[0] = -HIDAPI_DriverSwitch_ScaleAccel(values[1]); + data[1] = HIDAPI_DriverSwitch_ScaleAccel(values[2]); + data[2] = -HIDAPI_DriverSwitch_ScaleAccel(values[0]); } /* Right Joy-Con flips some axes, so let's flip them back for consistency */ @@ -1560,20 +1441,20 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C * LSB of connection nibble is USB/Switch connection status */ if (packet->controllerState.ucBatteryAndConnection & 0x1) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_WIRED); + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; } else { /* LSB of the battery nibble is used to report charging. * The battery level is reported from 0(empty)-8(full) */ int level = (packet->controllerState.ucBatteryAndConnection & 0xE0) >> 4; if (level == 0) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); + joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; } else if (level <= 2) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); + joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; } else if (level <= 6) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); + joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; } else { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); + joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; } } diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_xbox360.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_xbox360.c index 28e04cfa4..da7aa240f 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_xbox360.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_xbox360.c @@ -83,7 +83,7 @@ HIDAPI_DriverXbox360_IsSupportedDevice(const char *name, SDL_GameControllerType } static const char * -HIDAPI_DriverXbox360_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverXbox360_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { return NULL; } diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_xbox360w.c index 0c7dfef93..e6e6171ab 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_xbox360w.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_xbox360w.c @@ -57,7 +57,7 @@ HIDAPI_DriverXbox360W_IsSupportedDevice(const char *name, SDL_GameControllerType } static const char * -HIDAPI_DriverXbox360W_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverXbox360W_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { return "Xbox 360 Wireless Controller"; } @@ -81,13 +81,13 @@ UpdatePowerLevel(SDL_Joystick *joystick, Uint8 level) float normalized_level = (float)level / 255.0f; if (normalized_level <= 0.05f) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_EMPTY); + joystick->epowerlevel = SDL_JOYSTICK_POWER_EMPTY; } else if (normalized_level <= 0.20f) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_LOW); + joystick->epowerlevel = SDL_JOYSTICK_POWER_LOW; } else if (normalized_level <= 0.70f) { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_MEDIUM); + joystick->epowerlevel = SDL_JOYSTICK_POWER_MEDIUM; } else { - SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); + joystick->epowerlevel = SDL_JOYSTICK_POWER_FULL; } } diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapi_xboxone.c b/externals/SDL/src/joystick/hidapi/SDL_hidapi_xboxone.c index b549ef6d6..a5a58f875 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -285,7 +285,7 @@ HIDAPI_DriverXboxOne_IsSupportedDevice(const char *name, SDL_GameControllerType } static const char * -HIDAPI_DriverXboxOne_GetDeviceName(const char *name, Uint16 vendor_id, Uint16 product_id) +HIDAPI_DriverXboxOne_GetDeviceName(Uint16 vendor_id, Uint16 product_id) { return NULL; } @@ -478,6 +478,30 @@ HIDAPI_DriverXboxOne_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Jo return SDL_Unsupported(); } +static Sint16 FilterLeftThumb(Sint16 axis) +{ + if (axis <= XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE && axis >= -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE) { + return 0; + } + return axis; +} + +static Sint16 FilterRightThumb(Sint16 axis) +{ + if (axis <= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE && axis >= -XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) { + return 0; + } + return axis; +} + +static Sint16 FilterTrigger(Sint16 axis) +{ + if (axis <= XINPUT_GAMEPAD_TRIGGER_THRESHOLD) { + return 0; + } + return axis; +} + static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne_Context *ctx, Uint8 *data, int size) { @@ -612,7 +636,7 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne if (axis == -32768 && size == 30 && (data[22] & 0x80) != 0) { axis = 32767; } - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, FilterTrigger(axis)); axis = ((int)*(Sint16*)(&data[8]) * 64) - 32768; if (axis == -32768 && size == 30 && (data[22] & 0x40) != 0) { @@ -621,16 +645,16 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne if (axis == 32704) { axis = 32767; } - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, FilterTrigger(axis)); axis = *(Sint16*)(&data[10]); - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, FilterLeftThumb(axis)); axis = *(Sint16*)(&data[12]); - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, ~axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, FilterLeftThumb(~axis)); axis = *(Sint16*)(&data[14]); - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, FilterRightThumb(axis)); axis = *(Sint16*)(&data[16]); - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, ~axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, FilterRightThumb(~axis)); SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); } @@ -830,22 +854,22 @@ HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(SDL_Joystick *joystick, SDL_Driv if (axis == 32704) { axis = 32767; } - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, FilterTrigger(axis)); axis = ((int)*(Sint16*)(&data[11]) * 64) - 32768; if (axis == 32704) { axis = 32767; } - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, FilterTrigger(axis)); axis = (int)*(Uint16*)(&data[1]) - 0x8000; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, FilterLeftThumb(axis)); axis = (int)*(Uint16*)(&data[3]) - 0x8000; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, FilterLeftThumb(axis)); axis = (int)*(Uint16*)(&data[5]) - 0x8000; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, FilterRightThumb(axis)); axis = (int)*(Uint16*)(&data[7]) - 0x8000; - SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, FilterRightThumb(axis)); SDL_memcpy(ctx->last_state, data, SDL_min(size, sizeof(ctx->last_state))); } diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapijoystick.c b/externals/SDL/src/joystick/hidapi/SDL_hidapijoystick.c index 38164b0f7..959b72414 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapijoystick.c @@ -110,96 +110,11 @@ HIDAPI_RemapVal(float val, float val_min, float val_max, float output_min, float static void HIDAPI_JoystickDetect(void); static void HIDAPI_JoystickClose(SDL_Joystick *joystick); -static SDL_GameControllerType -SDL_GetJoystickGameControllerProtocol(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol) -{ - static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF; - static const int XB360_IFACE_SUBCLASS = 93; - static const int XB360_IFACE_PROTOCOL = 1; /* Wired */ - static const int XB360W_IFACE_PROTOCOL = 129; /* Wireless */ - static const int XBONE_IFACE_SUBCLASS = 71; - static const int XBONE_IFACE_PROTOCOL = 208; - - SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN; - - /* This code should match the checks in libusb/hid.c and HIDDeviceManager.java */ - if (interface_class == LIBUSB_CLASS_VENDOR_SPEC && - interface_subclass == XB360_IFACE_SUBCLASS && - (interface_protocol == XB360_IFACE_PROTOCOL || - interface_protocol == XB360W_IFACE_PROTOCOL)) { - - static const int SUPPORTED_VENDORS[] = { - 0x0079, /* GPD Win 2 */ - 0x044f, /* Thrustmaster */ - 0x045e, /* Microsoft */ - 0x046d, /* Logitech */ - 0x056e, /* Elecom */ - 0x06a3, /* Saitek */ - 0x0738, /* Mad Catz */ - 0x07ff, /* Mad Catz */ - 0x0e6f, /* PDP */ - 0x0f0d, /* Hori */ - 0x1038, /* SteelSeries */ - 0x11c9, /* Nacon */ - 0x12ab, /* Unknown */ - 0x1430, /* RedOctane */ - 0x146b, /* BigBen */ - 0x1532, /* Razer */ - 0x15e4, /* Numark */ - 0x162e, /* Joytech */ - 0x1689, /* Razer Onza */ - 0x1949, /* Lab126, Inc. */ - 0x1bad, /* Harmonix */ - 0x20d6, /* PowerA */ - 0x24c6, /* PowerA */ - 0x2c22, /* Qanba */ - }; - - int i; - for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) { - if (vendor == SUPPORTED_VENDORS[i]) { - type = SDL_CONTROLLER_TYPE_XBOX360; - break; - } - } - } - - if (interface_number == 0 && - interface_class == LIBUSB_CLASS_VENDOR_SPEC && - interface_subclass == XBONE_IFACE_SUBCLASS && - interface_protocol == XBONE_IFACE_PROTOCOL) { - - static const int SUPPORTED_VENDORS[] = { - 0x045e, /* Microsoft */ - 0x0738, /* Mad Catz */ - 0x0e6f, /* PDP */ - 0x0f0d, /* Hori */ - 0x1532, /* Razer */ - 0x20d6, /* PowerA */ - 0x24c6, /* PowerA */ - 0x2e24, /* Hyperkin */ - }; - - int i; - for (i = 0; i < SDL_arraysize(SUPPORTED_VENDORS); ++i) { - if (vendor == SUPPORTED_VENDORS[i]) { - type = SDL_CONTROLLER_TYPE_XBOXONE; - break; - } - } - } - - if (type == SDL_CONTROLLER_TYPE_UNKNOWN) { - type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor, product, name, SDL_FALSE); - } - return type; -} - static SDL_bool HIDAPI_IsDeviceSupported(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name) { int i; - SDL_GameControllerType type = SDL_GetJoystickGameControllerProtocol(name, vendor_id, product_id, -1, 0, 0, 0); + SDL_GameControllerType type = SDL_GetJoystickGameControllerType(name, vendor_id, product_id, -1, 0, 0, 0); for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; @@ -219,8 +134,14 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device) const Uint16 USAGE_MULTIAXISCONTROLLER = 0x0008; int i; SDL_GameControllerType type; + SDL_JoystickGUID check_guid; - if (SDL_ShouldIgnoreJoystick(device->name, device->guid)) { + /* Make sure we have a generic GUID here, otherwise if we pass a HIDAPI + guid, this call will create a game controller mapping for the device. + */ + check_guid = device->guid; + check_guid.data[14] = 0; + if (SDL_ShouldIgnoreJoystick(device->name, check_guid)) { return NULL; } @@ -233,7 +154,7 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device) } } - type = SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); + type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { SDL_HIDAPI_DeviceDriver *driver = SDL_HIDAPI_drivers[i]; if (driver->enabled && driver->IsSupportedDevice(device->name, type, device->vendor_id, device->product_id, device->version, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol)) { @@ -285,8 +206,8 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device) device->driver = HIDAPI_GetDeviceDriver(device); if (device->driver) { - const char *name = device->driver->GetDeviceName(device->name, device->vendor_id, device->product_id); - if (name && name != device->name) { + const char *name = device->driver->GetDeviceName(device->vendor_id, device->product_id); + if (name) { SDL_free(device->name); device->name = SDL_strdup(name); } @@ -306,7 +227,7 @@ HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device) } /* Disconnect any joysticks */ - while (device->num_joysticks && device->joysticks) { + while (device->num_joysticks) { HIDAPI_JoystickDisconnected(device, device->joysticks[0]); } @@ -388,7 +309,8 @@ HIDAPI_JoystickInit(void) #endif if (SDL_hid_init() < 0) { - return SDL_SetError("Couldn't initialize hidapi"); + SDL_SetError("Couldn't initialize hidapi"); + return -1; } for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) { @@ -542,6 +464,38 @@ HIDAPI_AddDevice(struct SDL_hid_device_info *info) char *serial_number = HIDAPI_ConvertString(info->serial_number); device->name = SDL_CreateJoystickName(device->vendor_id, device->product_id, manufacturer_string, product_string); + if (SDL_strncmp(device->name, "0x", 2) == 0) { + /* Couldn't find a controller name, try to give it one based on device type */ + const char *name = NULL; + + switch (SDL_GetJoystickGameControllerType(NULL, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol)) { + case SDL_CONTROLLER_TYPE_XBOX360: + name = "Xbox 360 Controller"; + break; + case SDL_CONTROLLER_TYPE_XBOXONE: + name = "Xbox One Controller"; + break; + case SDL_CONTROLLER_TYPE_PS3: + name = "PS3 Controller"; + break; + case SDL_CONTROLLER_TYPE_PS4: + name = "PS4 Controller"; + break; + case SDL_CONTROLLER_TYPE_PS5: + name = "PS5 Controller"; + break; + case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO: + name = "Nintendo Switch Pro Controller"; + break; + default: + break; + } + + if (name) { + SDL_free(device->name); + device->name = SDL_strdup(name); + } + } if (manufacturer_string) { SDL_free(manufacturer_string); @@ -674,13 +628,13 @@ HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id, SDL_HIDAPI_Devi /* If we're looking for the raw input Xbox One controller, match it against any other Xbox One controller */ if (product_id == USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER && - SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == SDL_CONTROLLER_TYPE_XBOXONE) { + SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == SDL_CONTROLLER_TYPE_XBOXONE) { return SDL_TRUE; } /* If we're looking for an XInput controller, match it against any other Xbox controller */ if (product_id == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { - SDL_GameControllerType type = SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); + SDL_GameControllerType type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); if (type == SDL_CONTROLLER_TYPE_XBOX360 || type == SDL_CONTROLLER_TYPE_XBOXONE) { return SDL_TRUE; } @@ -709,7 +663,7 @@ HIDAPI_IsDeviceTypePresent(SDL_GameControllerType type) device = SDL_HIDAPI_devices; while (device) { if (device->driver && - SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == type) { + SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == type) { result = SDL_TRUE; break; } @@ -830,21 +784,6 @@ HIDAPI_JoystickGetDeviceName(int device_index) return name; } -static const char * -HIDAPI_JoystickGetDevicePath(int device_index) -{ - SDL_HIDAPI_Device *device; - const char *path = NULL; - - device = HIDAPI_GetDeviceByIndex(device_index, NULL); - if (device) { - /* FIXME: The device could be freed after this path is returned... */ - path = device->path; - } - - return path; -} - static int HIDAPI_JoystickGetDevicePlayerIndex(int device_index) { @@ -932,7 +871,8 @@ HIDAPI_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint1 result = device->driver->RumbleJoystick(device, joystick, low_frequency_rumble, high_frequency_rumble); } else { - result = SDL_SetError("Rumble failed, device disconnected"); + SDL_SetError("Rumble failed, device disconnected"); + result = -1; } return result; @@ -948,7 +888,8 @@ HIDAPI_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 result = device->driver->RumbleJoystickTriggers(device, joystick, left_rumble, right_rumble); } else { - result = SDL_SetError("Rumble failed, device disconnected"); + SDL_SetError("Rumble failed, device disconnected"); + result = -1; } return result; @@ -978,7 +919,8 @@ HIDAPI_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue result = device->driver->SetJoystickLED(device, joystick, red, green, blue); } else { - result = SDL_SetError("SetLED failed, device disconnected"); + SDL_SetError("SetLED failed, device disconnected"); + result = -1; } return result; @@ -994,7 +936,8 @@ HIDAPI_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) result = device->driver->SendJoystickEffect(device, joystick, data, size); } else { - result = SDL_SetError("SendEffect failed, device disconnected"); + SDL_SetError("SendEffect failed, device disconnected"); + result = -1; } return result; @@ -1010,7 +953,8 @@ HIDAPI_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) result = device->driver->SetJoystickSensorsEnabled(device, joystick, enabled); } else { - result = SDL_SetError("SetSensorsEnabled failed, device disconnected"); + SDL_SetError("SetSensorsEnabled failed, device disconnected"); + result = -1; } return result; @@ -1092,7 +1036,6 @@ SDL_JoystickDriver SDL_HIDAPI_JoystickDriver = HIDAPI_JoystickGetCount, HIDAPI_JoystickDetect, HIDAPI_JoystickGetDeviceName, - HIDAPI_JoystickGetDevicePath, HIDAPI_JoystickGetDevicePlayerIndex, HIDAPI_JoystickSetDevicePlayerIndex, HIDAPI_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/hidapi/SDL_hidapijoystick_c.h b/externals/SDL/src/joystick/hidapi/SDL_hidapijoystick_c.h index 73c2ad922..c1b75d8db 100755 --- a/externals/SDL/src/joystick/hidapi/SDL_hidapijoystick_c.h +++ b/externals/SDL/src/joystick/hidapi/SDL_hidapijoystick_c.h @@ -90,7 +90,7 @@ typedef struct _SDL_HIDAPI_DeviceDriver SDL_bool enabled; SDL_bool enabled_default; SDL_bool (*IsSupportedDevice)(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol); - const char *(*GetDeviceName)(const char *name, Uint16 vendor_id, Uint16 product_id); + const char *(*GetDeviceName)(Uint16 vendor_id, Uint16 product_id); SDL_bool (*InitDevice)(SDL_HIDAPI_Device *device); int (*GetDevicePlayerIndex)(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id); void (*SetDevicePlayerIndex)(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index); diff --git a/externals/SDL/src/joystick/iphoneos/SDL_mfijoystick.m b/externals/SDL/src/joystick/iphoneos/SDL_mfijoystick.m index c55cf7887..ed2384255 100755 --- a/externals/SDL/src/joystick/iphoneos/SDL_mfijoystick.m +++ b/externals/SDL/src/joystick/iphoneos/SDL_mfijoystick.m @@ -69,9 +69,6 @@ static NSString *GCInputXboxShareButton = @"Button Share"; #if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000)) @property(nonatomic, readonly) NSString *productCategory; #endif -#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140500) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140500) || (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110300)) -@property(class, nonatomic, readwrite) BOOL shouldMonitorBackgroundEvents; -#endif @end @interface GCExtendedGamepad (SDL) #if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 121000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 121000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1401000)) @@ -180,10 +177,6 @@ IsControllerXbox(GCController *controller) static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller) { - if ((@available(macOS 11.3, *)) && !GCController.shouldMonitorBackgroundEvents) { - GCController.shouldMonitorBackgroundEvents = YES; - } - Uint16 *guid16 = (Uint16 *)device->guid.data; Uint16 vendor = 0; Uint16 product = 0; @@ -334,15 +327,6 @@ IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controlle subtype = 1; } - if (SDL_strcmp(name, "Backbone One") == 0) { - /* The Backbone app uses share button */ - if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_MISC1)) != 0) { - device->button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_MISC1); - --nbuttons; - device->has_xbox_share_button = SDL_FALSE; - } - } - device->naxes = 6; /* 2 thumbsticks and 2 triggers */ device->nhats = 1; /* d-pad */ device->nbuttons = nbuttons; @@ -647,12 +631,6 @@ IOS_JoystickGetDeviceName(int device_index) return device ? device->name : "Unknown"; } -static const char * -IOS_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - static int IOS_JoystickGetDevicePlayerIndex(int device_index) { @@ -741,7 +719,7 @@ IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) } #ifdef ENABLE_MFI_SENSORS - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { GCController *controller = joystick->hwdata->controller; GCMotion *motion = controller.motion; if (motion && motion.hasRotationRate) { @@ -754,7 +732,7 @@ IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) #endif /* ENABLE_MFI_SENSORS */ #ifdef ENABLE_MFI_SYSTEM_GESTURE_STATE - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { GCController *controller = joystick->hwdata->controller; for (id key in controller.physicalInputProfile.buttons) { GCControllerButtonInput *button = controller.physicalInputProfile.buttons[key]; @@ -966,7 +944,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } #ifdef ENABLE_MFI_SENSORS - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { GCMotion *motion = controller.motion; if (motion && motion.sensorsActive) { float data[3]; @@ -1059,7 +1037,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } #ifdef ENABLE_MFI_BATTERY - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { GCDeviceBattery *battery = controller.battery; if (battery) { SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN; @@ -1100,8 +1078,8 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) #ifdef ENABLE_MFI_RUMBLE @interface SDL_RumbleMotor : NSObject - @property(nonatomic,strong) CHHapticEngine *engine API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0)); - @property(nonatomic,strong) id player API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0)); + @property(nonatomic,strong) CHHapticEngine *engine API_AVAILABLE(macos(11.0), ios(13.0), tvos(14.0)); + @property(nonatomic,strong) id player API_AVAILABLE(macos(11.0), ios(13.0), tvos(14.0)); @property bool active; @end @@ -1111,7 +1089,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) -(void)cleanup { @autoreleasepool { - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { if (self.player != nil) { [self.player cancelAndReturnError:nil]; self.player = nil; @@ -1127,7 +1105,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) -(int)setIntensity:(float)intensity { @autoreleasepool { - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { NSError *error = nil; if (self.engine == nil) { @@ -1173,7 +1151,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) } } --(id) initWithController:(GCController*)controller locality:(GCHapticsLocality)locality API_AVAILABLE(macos(10.16), ios(14.0), tvos(14.0)) +-(id) initWithController:(GCController*)controller locality:(GCHapticsLocality)locality API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0)) { @autoreleasepool { self = [super init]; @@ -1191,7 +1169,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) return nil; } - __weak __typeof(self) weakSelf = self; + __weak typeof(self) weakSelf = self; self.engine.stoppedHandler = ^(CHHapticEngineStoppedReason stoppedReason) { SDL_RumbleMotor *_this = weakSelf; if (_this == nil) { @@ -1273,7 +1251,7 @@ IOS_MFIJoystickUpdate(SDL_Joystick *joystick) static SDL_RumbleContext *IOS_JoystickInitRumble(GCController *controller) { @autoreleasepool { - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { SDL_RumbleMotor *low_frequency_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityLeftHandle]; SDL_RumbleMotor *high_frequency_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityRightHandle]; SDL_RumbleMotor *left_trigger_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityLeftTrigger]; @@ -1301,7 +1279,7 @@ IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 h return SDL_SetError("Controller is no longer connected"); } - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { if (!device->rumble && device->controller && device->controller.haptics) { SDL_RumbleContext *rumble = IOS_JoystickInitRumble(device->controller); if (rumble) { @@ -1331,7 +1309,7 @@ IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 ri return SDL_SetError("Controller is no longer connected"); } - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { if (!device->rumble && device->controller && device->controller.haptics) { SDL_RumbleContext *rumble = IOS_JoystickInitRumble(device->controller); if (rumble) { @@ -1364,7 +1342,7 @@ IOS_JoystickGetCapabilities(SDL_Joystick *joystick) return 0; } - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { GCController *controller = device->controller; #ifdef ENABLE_MFI_LIGHT if (controller.light) { @@ -1401,7 +1379,7 @@ IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) return SDL_SetError("Controller is no longer connected"); } - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { GCController *controller = device->controller; GCDeviceLight *light = controller.light; if (light) { @@ -1434,7 +1412,7 @@ IOS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) return SDL_SetError("Controller is no longer connected"); } - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { GCController *controller = device->controller; GCMotion *motion = controller.motion; if (motion) { @@ -1497,7 +1475,7 @@ IOS_JoystickClose(SDL_Joystick *joystick) controller.playerIndex = -1; #ifdef ENABLE_MFI_SYSTEM_GESTURE_STATE - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macOS 11.0, iOS 14.0, tvOS 14.0, *)) { for (id key in controller.physicalInputProfile.buttons) { GCControllerButtonInput *button = controller.physicalInputProfile.buttons[key]; if ([button isBoundToSystemGesture]) { @@ -1595,7 +1573,7 @@ SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device) static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char *name) { - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) { if (element) { [element.sfSymbolsName getCString: name maxLength: 255 encoding: NSASCIIStringEncoding]; } @@ -1629,7 +1607,7 @@ IOS_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController *gamecontrol elementName[0] = '\0'; #if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) if (gamecontroller && SDL_GameControllerGetJoystick(gamecontroller)->driver == &SDL_IOS_JoystickDriver) { - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(iOS 14.0, tvOS 14.0, macOS 11.0, *)) { GCController *controller = SDL_GameControllerGetJoystick(gamecontroller)->hwdata->controller; if ([controller respondsToSelector:@selector(physicalInputProfile)]) { NSDictionary *elements = controller.physicalInputProfile.elements; @@ -1742,7 +1720,7 @@ IOS_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontrolle elementName[0] = '\0'; #if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) if (gamecontroller && SDL_GameControllerGetJoystick(gamecontroller)->driver == &SDL_IOS_JoystickDriver) { - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (@available(iOS 14.0, tvOS 14.0, macOS 11.0, *)) { GCController *controller = SDL_GameControllerGetJoystick(gamecontroller)->hwdata->controller; if ([controller respondsToSelector:@selector(physicalInputProfile)]) { NSDictionary *elements = controller.physicalInputProfile.elements; @@ -1783,7 +1761,6 @@ SDL_JoystickDriver SDL_IOS_JoystickDriver = IOS_JoystickGetCount, IOS_JoystickDetect, IOS_JoystickGetDeviceName, - IOS_JoystickGetDevicePath, IOS_JoystickGetDevicePlayerIndex, IOS_JoystickSetDevicePlayerIndex, IOS_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/linux/SDL_sysjoystick.c b/externals/SDL/src/joystick/linux/SDL_sysjoystick.c index 307dd5642..851448acd 100755 --- a/externals/SDL/src/joystick/linux/SDL_sysjoystick.c +++ b/externals/SDL/src/joystick/linux/SDL_sysjoystick.c @@ -82,10 +82,6 @@ #define DEBUG_INPUT_EVENTS 1 #endif -#if 0 -#define DEBUG_GAMEPAD_MAPPING 1 -#endif - typedef enum { ENUMERATION_UNSET, @@ -113,7 +109,6 @@ typedef struct SDL_joylist_item /* Steam Controller support */ SDL_bool m_bSteamController; - SDL_bool checked_mapping; SDL_GamepadMapping *mapping; } SDL_joylist_item; @@ -497,6 +492,21 @@ static void SteamControllerDisconnectedCallback(int device_instance) } } +#ifdef HAVE_INOTIFY +#ifdef HAVE_INOTIFY_INIT1 +static int SDL_inotify_init1(void) { + return inotify_init1(IN_NONBLOCK | IN_CLOEXEC); +} +#else +static int SDL_inotify_init1(void) { + int fd = inotify_init(); + if (fd < 0) return -1; + fcntl(fd, F_SETFL, O_NONBLOCK); + fcntl(fd, F_SETFD, FD_CLOEXEC); + return fd; +} +#endif + static int StrHasPrefix(const char *string, const char *prefix) { @@ -551,21 +561,6 @@ IsJoystickDeviceNode(const char *node) } } -#ifdef HAVE_INOTIFY -#ifdef HAVE_INOTIFY_INIT1 -static int SDL_inotify_init1(void) { - return inotify_init1(IN_NONBLOCK | IN_CLOEXEC); -} -#else -static int SDL_inotify_init1(void) { - int fd = inotify_init(); - if (fd < 0) return -1; - fcntl(fd, F_SETFL, O_NONBLOCK); - fcntl(fd, F_SETFD, FD_CLOEXEC); - return fd; -} -#endif - static void LINUX_InotifyJoystickDetect(void) { @@ -610,26 +605,6 @@ LINUX_InotifyJoystickDetect(void) } #endif /* HAVE_INOTIFY */ -static int get_event_joystick_index(int event) -{ - int joystick_index = -1; - int i, count; - struct dirent **entries = NULL; - char path[PATH_MAX]; - - SDL_snprintf(path, SDL_arraysize(path), "/sys/class/input/event%d/device", event); - count = scandir(path, &entries, NULL, alphasort); - for (i = 0; i < count; ++i) { - if (SDL_strncmp(entries[i]->d_name, "js", 2) == 0) { - joystick_index = SDL_atoi(entries[i]->d_name+2); - } - free(entries[i]); /* This should NOT be SDL_free() */ - } - free(entries); /* This should NOT be SDL_free() */ - - return joystick_index; -} - /* Detect devices by reading /dev/input. In the inotify code path we * have to do this the first time, to detect devices that already existed * before we started; in the non-inotify code path we do this repeatedly @@ -640,39 +615,12 @@ filter_entries(const struct dirent *entry) return IsJoystickDeviceNode(entry->d_name); } static int -sort_entries(const void *_a, const void *_b) +sort_entries(const struct dirent **a, const struct dirent **b) { - const struct dirent **a = (const struct dirent **)_a; - const struct dirent **b = (const struct dirent **)_b; - int numA, numB; - int offset; - - if (SDL_classic_joysticks) { - offset = 2; /* strlen("js") */ - numA = SDL_atoi((*a)->d_name+offset); - numB = SDL_atoi((*b)->d_name+offset); - } else { - offset = 5; /* strlen("event") */ - numA = SDL_atoi((*a)->d_name+offset); - numB = SDL_atoi((*b)->d_name+offset); - - /* See if we can get the joystick ordering */ - { - int jsA = get_event_joystick_index(numA); - int jsB = get_event_joystick_index(numB); - if (jsA >= 0 && jsB >= 0) { - numA = jsA; - numB = jsB; - } else if (jsA >= 0) { - return -1; - } else if (jsB >= 0) { - return 1; - } - } - } + int numA = SDL_atoi((*a)->d_name+5); + int numB = SDL_atoi((*b)->d_name+5); return (numA - numB); } - static void LINUX_FallbackJoystickDetect(void) { @@ -685,13 +633,10 @@ LINUX_FallbackJoystickDetect(void) /* Opening input devices can generate synchronous device I/O, so avoid it if we can */ if (stat("/dev/input", &sb) == 0 && sb.st_mtime != last_input_dir_mtime) { int i, count; - struct dirent **entries = NULL; + struct dirent **entries; char path[PATH_MAX]; - count = scandir("/dev/input", &entries, filter_entries, NULL); - if (count > 1) { - qsort(entries, count, sizeof(*entries), sort_entries); - } + count = scandir("/dev/input", &entries, filter_entries, sort_entries); for (i = 0; i < count; ++i) { SDL_snprintf(path, SDL_arraysize(path), "/dev/input/%s", entries[i]->d_name); MaybeAddDevice(path); @@ -738,7 +683,29 @@ LINUX_JoystickInit(void) SDL_classic_joysticks = SDL_GetHintBoolean(SDL_HINT_LINUX_JOYSTICK_CLASSIC, SDL_FALSE); - enumeration_method = ENUMERATION_UNSET; +#if SDL_USE_LIBUDEV + if (enumeration_method == ENUMERATION_UNSET) { + if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "udev disabled by SDL_JOYSTICK_DISABLE_UDEV"); + enumeration_method = ENUMERATION_FALLBACK; + + } else if (access("/.flatpak-info", F_OK) == 0 + || access("/run/host/container-manager", F_OK) == 0) { + /* Explicitly check `/.flatpak-info` because, for old versions of + * Flatpak, this was the only available way to tell if we were in + * a Flatpak container. */ + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "Container detected, disabling udev integration"); + enumeration_method = ENUMERATION_FALLBACK; + + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "Using udev for joystick device discovery"); + enumeration_method = ENUMERATION_LIBUDEV; + } + } +#endif /* First see if the user specified one or more joysticks to use */ if (devices != NULL) { @@ -767,28 +734,6 @@ LINUX_JoystickInit(void) LINUX_JoystickDetect(); #if SDL_USE_LIBUDEV - if (enumeration_method == ENUMERATION_UNSET) { - if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) { - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "udev disabled by SDL_JOYSTICK_DISABLE_UDEV"); - enumeration_method = ENUMERATION_FALLBACK; - - } else if (access("/.flatpak-info", F_OK) == 0 - || access("/run/host/container-manager", F_OK) == 0) { - /* Explicitly check `/.flatpak-info` because, for old versions of - * Flatpak, this was the only available way to tell if we were in - * a Flatpak container. */ - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "Container detected, disabling udev integration"); - enumeration_method = ENUMERATION_FALLBACK; - - } else { - SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, - "Using udev for joystick device discovery"); - enumeration_method = ENUMERATION_LIBUDEV; - } - } - if (enumeration_method == ENUMERATION_LIBUDEV) { if (SDL_UDEV_Init() < 0) { return SDL_SetError("Could not initialize UDEV"); @@ -858,18 +803,13 @@ JoystickByDevIndex(int device_index) return item; } +/* Function to get the device-dependent name of a joystick */ static const char * LINUX_JoystickGetDeviceName(int device_index) { return JoystickByDevIndex(device_index)->name; } -static const char * -LINUX_JoystickGetDevicePath(int device_index) -{ - return JoystickByDevIndex(device_index)->path; -} - static int LINUX_JoystickGetDevicePlayerIndex(int device_index) { @@ -930,37 +870,6 @@ allocate_balldata(SDL_Joystick *joystick) return (0); } -static SDL_bool -GuessIfAxesAreDigitalHat(struct input_absinfo *absinfo_x, struct input_absinfo *absinfo_y) -{ - /* A "hat" is assumed to be a digital input with at most 9 possible states - * (3 per axis: negative/zero/positive), as opposed to a true "axis" which - * can report a continuous range of possible values. Unfortunately the Linux - * joystick interface makes no distinction between digital hat axes and any - * other continuous analog axis, so we have to guess. */ - - /* If both axes are missing, they're not anything. */ - if (!absinfo_x && !absinfo_y) - return SDL_FALSE; - - /* If the hint says so, treat all hats as digital. */ - if (SDL_GetHintBoolean(SDL_HINT_LINUX_DIGITAL_HATS, SDL_FALSE)) - return SDL_TRUE; - - /* If both axes have ranges constrained between -1 and 1, they're definitely digital. */ - if ((!absinfo_x || (absinfo_x->minimum == -1 && absinfo_x->maximum == 1)) && - (!absinfo_y || (absinfo_y->minimum == -1 && absinfo_y->maximum == 1))) - return SDL_TRUE; - - /* If both axes lack fuzz, flat, and resolution values, they're probably digital. */ - if ((!absinfo_x || (!absinfo_x->fuzz && !absinfo_x->flat && !absinfo_x->resolution)) && - (!absinfo_y || (!absinfo_y->fuzz && !absinfo_y->flat && !absinfo_y->resolution))) - return SDL_TRUE; - - /* Otherwise, treat them as analog. */ - return SDL_FALSE; -} - static void ConfigJoystick(SDL_Joystick *joystick, int fd) { @@ -971,7 +880,6 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) unsigned long ffbit[NBITS(FF_MAX)] = { 0 }; Uint8 key_pam_size, abs_pam_size; SDL_bool use_deadzones = SDL_GetHintBoolean(SDL_HINT_LINUX_JOYSTICK_DEADZONES, SDL_FALSE); - SDL_bool use_hat_deadzones = SDL_GetHintBoolean(SDL_HINT_LINUX_HAT_DEADZONES, SDL_TRUE); /* See if this device uses the new unified event API */ if ((ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) >= 0) && @@ -999,45 +907,10 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) ++joystick->nbuttons; } } - for (i = ABS_HAT0X; i <= ABS_HAT3Y; i += 2) { - int hat_x = -1; - int hat_y = -1; - struct input_absinfo absinfo_x; - struct input_absinfo absinfo_y; - if (test_bit(i, absbit)) - hat_x = ioctl(fd, EVIOCGABS(i), &absinfo_x); - if (test_bit(i + 1, absbit)) - hat_y = ioctl(fd, EVIOCGABS(i + 1), &absinfo_y); - if (GuessIfAxesAreDigitalHat((hat_x < 0 ? (void*)0 : &absinfo_x), - (hat_y < 0 ? (void*)0 : &absinfo_y))) { - const int hat_index = (i - ABS_HAT0X) / 2; - struct hat_axis_correct *correct = &joystick->hwdata->hat_correct[hat_index]; -#ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has digital hat: #%d\n", hat_index); - if (hat_x >= 0) { - SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", - absinfo_x.value, absinfo_x.minimum, absinfo_x.maximum, - absinfo_x.fuzz, absinfo_x.flat, absinfo_x.resolution); - } - if (hat_y >= 0) { - SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", - absinfo_y.value, absinfo_y.minimum, absinfo_y.maximum, - absinfo_y.fuzz, absinfo_y.flat, absinfo_y.resolution); - } -#endif /* DEBUG_INPUT_EVENTS */ - joystick->hwdata->hats_indices[hat_index] = joystick->nhats; - joystick->hwdata->has_hat[hat_index] = SDL_TRUE; - correct->use_deadzones = use_hat_deadzones; - correct->minimum[0] = (hat_x < 0) ? -1 : absinfo_x.minimum; - correct->maximum[0] = (hat_x < 0) ? 1 : absinfo_x.maximum; - correct->minimum[1] = (hat_y < 0) ? -1 : absinfo_y.minimum; - correct->maximum[1] = (hat_y < 0) ? 1 : absinfo_y.maximum; - ++joystick->nhats; - } - } for (i = 0; i < ABS_MAX; ++i) { - /* Skip digital hats */ - if (joystick->hwdata->has_hat[(i - ABS_HAT0X) / 2]) { + /* Skip hats */ + if (i == ABS_HAT0X) { + i = ABS_HAT3Y; continue; } if (test_bit(i, absbit)) { @@ -1049,9 +922,9 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) } #ifdef DEBUG_INPUT_EVENTS SDL_Log("Joystick has absolute axis: 0x%.2x\n", i); - SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + SDL_Log("Values = { %d, %d, %d, %d, %d }\n", absinfo.value, absinfo.minimum, absinfo.maximum, - absinfo.fuzz, absinfo.flat, absinfo.resolution); + absinfo.fuzz, absinfo.flat); #endif /* DEBUG_INPUT_EVENTS */ joystick->hwdata->abs_map[i] = joystick->naxes; joystick->hwdata->has_abs[i] = SDL_TRUE; @@ -1079,6 +952,24 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) ++joystick->naxes; } } + for (i = ABS_HAT0X; i <= ABS_HAT3Y; i += 2) { + if (test_bit(i, absbit) || test_bit(i + 1, absbit)) { + struct input_absinfo absinfo; + int hat_index = (i - ABS_HAT0X) / 2; + + if (ioctl(fd, EVIOCGABS(i), &absinfo) < 0) { + continue; + } +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("Joystick has hat %d\n", hat_index); + SDL_Log("Values = { %d, %d, %d, %d, %d }\n", + absinfo.value, absinfo.minimum, absinfo.maximum, + absinfo.fuzz, absinfo.flat); +#endif /* DEBUG_INPUT_EVENTS */ + joystick->hwdata->hats_indices[hat_index] = joystick->nhats++; + joystick->hwdata->has_hat[hat_index] = SDL_TRUE; + } + } if (test_bit(REL_X, relbit) || test_bit(REL_Y, relbit)) { ++joystick->nballs; } @@ -1124,19 +1015,14 @@ ConfigJoystick(SDL_Joystick *joystick, int fd) for (i = 0; i < abs_pam_size; ++i) { Uint8 code = joystick->hwdata->abs_pam[i]; - // TODO: is there any way to detect analog hats in advance via this API? if (code >= ABS_HAT0X && code <= ABS_HAT3Y) { int hat_index = (code - ABS_HAT0X) / 2; if (!joystick->hwdata->has_hat[hat_index]) { #ifdef DEBUG_INPUT_EVENTS - SDL_Log("Joystick has digital hat: #%d\n", hat_index); + SDL_Log("Joystick has hat %d\n", hat_index); #endif joystick->hwdata->hats_indices[hat_index] = joystick->nhats++; joystick->hwdata->has_hat[hat_index] = SDL_TRUE; - joystick->hwdata->hat_correct[hat_index].minimum[0] = -1; - joystick->hwdata->hat_correct[hat_index].maximum[0] = 1; - joystick->hwdata->hat_correct[hat_index].minimum[1] = -1; - joystick->hwdata->hat_correct[hat_index].maximum[1] = 1; } } else { #ifdef DEBUG_INPUT_EVENTS @@ -1335,48 +1221,26 @@ LINUX_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) } static void -HandleHat(SDL_Joystick *stick, int hatidx, int axis, int value) +HandleHat(SDL_Joystick *stick, Uint8 hat, int axis, int value) { - const int hatnum = stick->hwdata->hats_indices[hatidx]; struct hwdata_hat *the_hat; - struct hat_axis_correct *correct; const Uint8 position_map[3][3] = { {SDL_HAT_LEFTUP, SDL_HAT_UP, SDL_HAT_RIGHTUP}, {SDL_HAT_LEFT, SDL_HAT_CENTERED, SDL_HAT_RIGHT}, {SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN} }; - the_hat = &stick->hwdata->hats[hatnum]; - correct = &stick->hwdata->hat_correct[hatidx]; - /* Hopefully we detected any analog axes and left them as is rather than trying - * to use them as digital hats, but just in case, the deadzones here will - * prevent the slightest of twitches on an analog axis from registering as a hat - * movement. If the axes really are digital, this won't hurt since they should - * only ever be sending min, 0, or max anyway. */ + the_hat = &stick->hwdata->hats[hat]; if (value < 0) { - if (value <= correct->minimum[axis]) { - correct->minimum[axis] = value; - value = 0; - } else if (!correct->use_deadzones || value < correct->minimum[axis] / 3) { - value = 0; - } else { - value = 1; - } - } else if (value > 0) { - if (value >= correct->maximum[axis]) { - correct->maximum[axis] = value; - value = 2; - } else if (!correct->use_deadzones || value > correct->maximum[axis] / 3) { - value = 2; - } else { - value = 1; - } - } else { // value == 0 + value = 0; + } else if (value == 0) { value = 1; + } else if (value > 0) { + value = 2; } if (value != the_hat->axis[axis]) { the_hat->axis[axis] = value; - SDL_PrivateJoystickHat(stick, hatnum, + SDL_PrivateJoystickHat(stick, hat, position_map[the_hat->axis[1]][the_hat->axis[0]]); } } @@ -1431,7 +1295,10 @@ PollAllValues(SDL_Joystick *joystick) /* Poll all axis */ for (i = ABS_X; i < ABS_MAX; i++) { - /* We don't need to test for digital hats here, they won't have has_abs[] set */ + if (i == ABS_HAT0X) { /* we handle hats in the next loop, skip them for now. */ + i = ABS_HAT3Y; + continue; + } if (joystick->hwdata->has_abs[i]) { if (ioctl(joystick->hwdata->fd, EVIOCGABS(i), &absinfo) >= 0) { absinfo.value = AxisCorrect(joystick, i, absinfo.value); @@ -1447,16 +1314,15 @@ PollAllValues(SDL_Joystick *joystick) } } - /* Poll all digital hats */ + /* Poll all hats */ for (i = ABS_HAT0X; i <= ABS_HAT3Y; i++) { const int baseaxis = i - ABS_HAT0X; const int hatidx = baseaxis / 2; SDL_assert(hatidx < SDL_arraysize(joystick->hwdata->has_hat)); - /* We don't need to test for analog axes here, they won't have has_hat[] set */ if (joystick->hwdata->has_hat[hatidx]) { if (ioctl(joystick->hwdata->fd, EVIOCGABS(i), &absinfo) >= 0) { const int hataxis = baseaxis % 2; - HandleHat(joystick, hatidx, hataxis, absinfo.value); + HandleHat(joystick, joystick->hwdata->hats_indices[hatidx], hataxis, absinfo.value); } } } @@ -1484,7 +1350,7 @@ static void HandleInputEvents(SDL_Joystick *joystick) { struct input_event events[32]; - int i, len, code, hat_index; + int i, len, code; if (joystick->hwdata->fresh) { PollAllValues(joystick); @@ -1519,11 +1385,9 @@ HandleInputEvents(SDL_Joystick *joystick) case ABS_HAT2Y: case ABS_HAT3X: case ABS_HAT3Y: - hat_index = (code - ABS_HAT0X) / 2; - if (joystick->hwdata->has_hat[hat_index]) { - HandleHat(joystick, hat_index, code % 2, events[i].value); - break; - } + code -= ABS_HAT0X; + HandleHat(joystick, joystick->hwdata->hats_indices[code / 2], code % 2, events[i].value); + break; default: events[i].value = AxisCorrect(joystick, code, events[i].value); SDL_PrivateJoystickAxis(joystick, @@ -1576,7 +1440,7 @@ static void HandleClassicEvents(SDL_Joystick *joystick) { struct js_event events[32]; - int i, len, code, hat_index; + int i, len, code; joystick->hwdata->fresh = SDL_FALSE; while ((len = read(joystick->hwdata->fd, events, (sizeof events))) > 0) { @@ -1600,11 +1464,9 @@ HandleClassicEvents(SDL_Joystick *joystick) case ABS_HAT2Y: case ABS_HAT3X: case ABS_HAT3Y: - hat_index = (code - ABS_HAT0X) / 2; - if (joystick->hwdata->has_hat[hat_index]) { - HandleHat(joystick, hat_index, code % 2, events[i].value); - break; - } + code -= ABS_HAT0X; + HandleHat(joystick, joystick->hwdata->hats_indices[code / 2], code % 2, events[i].value); + break; default: SDL_PrivateJoystickAxis(joystick, joystick->hwdata->abs_map[code], @@ -1710,18 +1572,10 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) { SDL_Joystick *joystick; SDL_joylist_item *item = JoystickByDevIndex(device_index); - unsigned int mapped; - if (item->checked_mapping) { - if (item->mapping) { - SDL_memcpy(out, item->mapping, sizeof(*out)); -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Prior mapping for device %d", device_index); -#endif - return SDL_TRUE; - } else { - return SDL_FALSE; - } + if (item->mapping) { + SDL_memcpy(out, item->mapping, sizeof(*out)); + return SDL_TRUE; } /* We temporarily open the device to check how it's configured. Make @@ -1741,8 +1595,6 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) return SDL_FALSE; } - item->checked_mapping = SDL_TRUE; - if (PrepareJoystickHwdata(joystick, item) == -1) { SDL_free(joystick->hwdata); SDL_free(joystick); @@ -1765,17 +1617,11 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) if (joystick->hwdata->has_key[BTN_A]) { out->a.kind = EMappingKind_Button; out->a.target = joystick->hwdata->key_map[BTN_A]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped A to button %d (BTN_A)", out->a.target); -#endif } if (joystick->hwdata->has_key[BTN_B]) { out->b.kind = EMappingKind_Button; out->b.target = joystick->hwdata->key_map[BTN_B]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped B to button %d (BTN_B)", out->b.target); -#endif } /* Xbox controllers use BTN_X and BTN_Y, and PS4 controllers use BTN_WEST and BTN_NORTH */ @@ -1783,74 +1629,47 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) if (joystick->hwdata->has_key[BTN_WEST]) { out->x.kind = EMappingKind_Button; out->x.target = joystick->hwdata->key_map[BTN_WEST]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped X to button %d (BTN_WEST)", out->x.target); -#endif } if (joystick->hwdata->has_key[BTN_NORTH]) { out->y.kind = EMappingKind_Button; out->y.target = joystick->hwdata->key_map[BTN_NORTH]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped Y to button %d (BTN_NORTH)", out->y.target); -#endif } } else { if (joystick->hwdata->has_key[BTN_X]) { out->x.kind = EMappingKind_Button; out->x.target = joystick->hwdata->key_map[BTN_X]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped X to button %d (BTN_X)", out->x.target); -#endif } if (joystick->hwdata->has_key[BTN_Y]) { out->y.kind = EMappingKind_Button; out->y.target = joystick->hwdata->key_map[BTN_Y]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped Y to button %d (BTN_Y)", out->y.target); -#endif } } if (joystick->hwdata->has_key[BTN_SELECT]) { out->back.kind = EMappingKind_Button; out->back.target = joystick->hwdata->key_map[BTN_SELECT]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped BACK to button %d (BTN_SELECT)", out->back.target); -#endif } if (joystick->hwdata->has_key[BTN_START]) { out->start.kind = EMappingKind_Button; out->start.target = joystick->hwdata->key_map[BTN_START]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped START to button %d (BTN_START)", out->start.target); -#endif } if (joystick->hwdata->has_key[BTN_THUMBL]) { out->leftstick.kind = EMappingKind_Button; out->leftstick.target = joystick->hwdata->key_map[BTN_THUMBL]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFTSTICK to button %d (BTN_THUMBL)", out->leftstick.target); -#endif } if (joystick->hwdata->has_key[BTN_THUMBR]) { out->rightstick.kind = EMappingKind_Button; out->rightstick.target = joystick->hwdata->key_map[BTN_THUMBR]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped RIGHTSTICK to button %d (BTN_THUMBR)", out->rightstick.target); -#endif } if (joystick->hwdata->has_key[BTN_MODE]) { out->guide.kind = EMappingKind_Button; out->guide.target = joystick->hwdata->key_map[BTN_MODE]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped GUIDE to button %d (BTN_MODE)", out->guide.target); -#endif } /* @@ -1858,191 +1677,84 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) can be digital, or analog, or both at the same time. */ - /* Prefer digital shoulder buttons, but settle for digital or analog hat. */ - mapped = 0; - + /* Prefer digital shoulder buttons, but settle for analog if missing. */ if (joystick->hwdata->has_key[BTN_TL]) { out->leftshoulder.kind = EMappingKind_Button; out->leftshoulder.target = joystick->hwdata->key_map[BTN_TL]; - mapped |= 0x1; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFTSHOULDER to button %d (BTN_TL)", out->leftshoulder.target); -#endif } if (joystick->hwdata->has_key[BTN_TR]) { out->rightshoulder.kind = EMappingKind_Button; out->rightshoulder.target = joystick->hwdata->key_map[BTN_TR]; - mapped |= 0x2; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped RIGHTSHOULDER to button %d (BTN_TR)", out->rightshoulder.target); -#endif } - if (mapped != 0x3 && joystick->hwdata->has_hat[1]) { + if (joystick->hwdata->has_hat[1] && /* Check if ABS_HAT1{X, Y} is available. */ + (!joystick->hwdata->has_key[BTN_TL] || !joystick->hwdata->has_key[BTN_TR])) { int hat = joystick->hwdata->hats_indices[1] << 4; out->leftshoulder.kind = EMappingKind_Hat; out->rightshoulder.kind = EMappingKind_Hat; out->leftshoulder.target = hat | 0x4; out->rightshoulder.target = hat | 0x2; - mapped |= 0x3; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFT+RIGHTSHOULDER to hat 1 (ABS_HAT1X, ABS_HAT1Y)"); -#endif } - if (!(mapped & 0x1) && joystick->hwdata->has_abs[ABS_HAT1Y]) { - out->leftshoulder.kind = EMappingKind_Axis; - out->leftshoulder.target = joystick->hwdata->abs_map[ABS_HAT1Y]; - mapped |= 0x1; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFTSHOULDER to axis %d (ABS_HAT1Y)", out->leftshoulder.target); -#endif - } - - if (!(mapped & 0x2) && joystick->hwdata->has_abs[ABS_HAT1X]) { - out->rightshoulder.kind = EMappingKind_Axis; - out->rightshoulder.target = joystick->hwdata->abs_map[ABS_HAT1X]; - mapped |= 0x2; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped RIGHTSHOULDER to axis %d (ABS_HAT1X)", out->rightshoulder.target); -#endif - } - - /* Prefer analog triggers, but settle for digital hat or buttons. */ - mapped = 0; - - if (joystick->hwdata->has_abs[ABS_HAT2Y]) { - out->lefttrigger.kind = EMappingKind_Axis; - out->lefttrigger.target = joystick->hwdata->abs_map[ABS_HAT2Y]; - mapped |= 0x1; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFTTRIGGER to axis %d (ABS_HAT2Y)", out->lefttrigger.target); -#endif - } else if (joystick->hwdata->has_abs[ABS_Z]) { - out->lefttrigger.kind = EMappingKind_Axis; - out->lefttrigger.target = joystick->hwdata->abs_map[ABS_Z]; - mapped |= 0x1; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFTTRIGGER to axis %d (ABS_Z)", out->lefttrigger.target); -#endif - } - - if (joystick->hwdata->has_abs[ABS_HAT2X]) { - out->righttrigger.kind = EMappingKind_Axis; - out->righttrigger.target = joystick->hwdata->abs_map[ABS_HAT2X]; - mapped |= 0x2; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped RIGHTTRIGGER to axis %d (ABS_HAT2X)", out->righttrigger.target); -#endif - } else if (joystick->hwdata->has_abs[ABS_RZ]) { - out->righttrigger.kind = EMappingKind_Axis; - out->righttrigger.target = joystick->hwdata->abs_map[ABS_RZ]; - mapped |= 0x2; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped RIGHTTRIGGER to axis %d (ABS_RZ)", out->righttrigger.target); -#endif - } - - if (mapped != 0x3 && joystick->hwdata->has_hat[2]) { + /* Prefer analog triggers, but settle for digital if missing. */ + if (joystick->hwdata->has_hat[2]) { /* Check if ABS_HAT2{X,Y} is available. */ int hat = joystick->hwdata->hats_indices[2] << 4; out->lefttrigger.kind = EMappingKind_Hat; out->righttrigger.kind = EMappingKind_Hat; out->lefttrigger.target = hat | 0x4; out->righttrigger.target = hat | 0x2; - mapped |= 0x3; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFT+RIGHTTRIGGER to hat 2 (ABS_HAT2X, ABS_HAT2Y)"); -#endif + } else { + if (joystick->hwdata->has_abs[ABS_Z]) { + out->lefttrigger.kind = EMappingKind_Axis; + out->lefttrigger.target = joystick->hwdata->abs_map[ABS_Z]; + } else if (joystick->hwdata->has_key[BTN_TL2]) { + out->lefttrigger.kind = EMappingKind_Button; + out->lefttrigger.target = joystick->hwdata->key_map[BTN_TL2]; + } + + if (joystick->hwdata->has_abs[ABS_RZ]) { + out->righttrigger.kind = EMappingKind_Axis; + out->righttrigger.target = joystick->hwdata->abs_map[ABS_RZ]; + } else if (joystick->hwdata->has_key[BTN_TR2]) { + out->righttrigger.kind = EMappingKind_Button; + out->righttrigger.target = joystick->hwdata->key_map[BTN_TR2]; + } } - if (!(mapped & 0x1) && joystick->hwdata->has_key[BTN_TL2]) { - out->lefttrigger.kind = EMappingKind_Button; - out->lefttrigger.target = joystick->hwdata->key_map[BTN_TL2]; - mapped |= 0x1; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFTTRIGGER to button %d (BTN_TL2)", out->lefttrigger.target); -#endif - } - - if (!(mapped & 0x2) && joystick->hwdata->has_key[BTN_TR2]) { - out->righttrigger.kind = EMappingKind_Button; - out->righttrigger.target = joystick->hwdata->key_map[BTN_TR2]; - mapped |= 0x2; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped RIGHTTRIGGER to button %d (BTN_TR2)", out->righttrigger.target); -#endif - } - - /* Prefer digital D-Pad buttons, but settle for digital or analog hat. */ - mapped = 0; - + /* Prefer digital D-Pad, but settle for analog if missing. */ if (joystick->hwdata->has_key[BTN_DPAD_UP]) { out->dpup.kind = EMappingKind_Button; out->dpup.target = joystick->hwdata->key_map[BTN_DPAD_UP]; - mapped |= 0x1; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped DPUP to button %d (BTN_DPAD_UP)", out->dpup.target); -#endif } if (joystick->hwdata->has_key[BTN_DPAD_DOWN]) { out->dpdown.kind = EMappingKind_Button; out->dpdown.target = joystick->hwdata->key_map[BTN_DPAD_DOWN]; - mapped |= 0x2; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped DPDOWN to button %d (BTN_DPAD_DOWN)", out->dpdown.target); -#endif } if (joystick->hwdata->has_key[BTN_DPAD_LEFT]) { out->dpleft.kind = EMappingKind_Button; out->dpleft.target = joystick->hwdata->key_map[BTN_DPAD_LEFT]; - mapped |= 0x4; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped DPLEFT to button %d (BTN_DPAD_LEFT)", out->dpleft.target); -#endif } if (joystick->hwdata->has_key[BTN_DPAD_RIGHT]) { out->dpright.kind = EMappingKind_Button; out->dpright.target = joystick->hwdata->key_map[BTN_DPAD_RIGHT]; - mapped |= 0x8; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped DPRIGHT to button %d (BTN_DPAD_RIGHT)", out->dpright.target); -#endif } - if (mapped != 0xF) { - if (joystick->hwdata->has_hat[0]) { - int hat = joystick->hwdata->hats_indices[0] << 4; - out->dpleft.kind = EMappingKind_Hat; - out->dpright.kind = EMappingKind_Hat; - out->dpup.kind = EMappingKind_Hat; - out->dpdown.kind = EMappingKind_Hat; - out->dpleft.target = hat | 0x8; - out->dpright.target = hat | 0x2; - out->dpup.target = hat | 0x1; - out->dpdown.target = hat | 0x4; - mapped |= 0xF; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped DPUP+DOWN+LEFT+RIGHT to hat 0 (ABS_HAT0X, ABS_HAT0Y)"); -#endif - } else if (joystick->hwdata->has_abs[ABS_HAT0X] && joystick->hwdata->has_abs[ABS_HAT0Y]) { - out->dpleft.kind = EMappingKind_Axis; - out->dpright.kind = EMappingKind_Axis; - out->dpup.kind = EMappingKind_Axis; - out->dpdown.kind = EMappingKind_Axis; - out->dpleft.target = joystick->hwdata->abs_map[ABS_HAT0X]; - out->dpright.target = joystick->hwdata->abs_map[ABS_HAT0X]; - out->dpup.target = joystick->hwdata->abs_map[ABS_HAT0Y]; - out->dpdown.target = joystick->hwdata->abs_map[ABS_HAT0Y]; - mapped |= 0xF; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped DPUP+DOWN to axis %d (ABS_HAT0Y)", out->dpup.target); - SDL_Log("Mapped DPLEFT+RIGHT to axis %d (ABS_HAT0X)", out->dpleft.target); -#endif - } + if (joystick->hwdata->has_hat[0] && /* Check if ABS_HAT0{X,Y} is available. */ + (!joystick->hwdata->has_key[BTN_DPAD_LEFT] || !joystick->hwdata->has_key[BTN_DPAD_RIGHT] || + !joystick->hwdata->has_key[BTN_DPAD_UP] || !joystick->hwdata->has_key[BTN_DPAD_DOWN])) { + int hat = joystick->hwdata->hats_indices[0] << 4; + out->dpleft.kind = EMappingKind_Hat; + out->dpright.kind = EMappingKind_Hat; + out->dpup.kind = EMappingKind_Hat; + out->dpdown.kind = EMappingKind_Hat; + out->dpleft.target = hat | 0x8; + out->dpright.target = hat | 0x2; + out->dpup.target = hat | 0x1; + out->dpdown.target = hat | 0x4; } if (joystick->hwdata->has_abs[ABS_X] && joystick->hwdata->has_abs[ABS_Y]) { @@ -2050,10 +1762,6 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) out->lefty.kind = EMappingKind_Axis; out->leftx.target = joystick->hwdata->abs_map[ABS_X]; out->lefty.target = joystick->hwdata->abs_map[ABS_Y]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped LEFTX to axis %d (ABS_X)", out->leftx.target); - SDL_Log("Mapped LEFTY to axis %d (ABS_Y)", out->lefty.target); -#endif } if (joystick->hwdata->has_abs[ABS_RX] && joystick->hwdata->has_abs[ABS_RY]) { @@ -2061,10 +1769,6 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) out->righty.kind = EMappingKind_Axis; out->rightx.target = joystick->hwdata->abs_map[ABS_RX]; out->righty.target = joystick->hwdata->abs_map[ABS_RY]; -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Mapped RIGHTX to axis %d (ABS_RX)", out->rightx.target); - SDL_Log("Mapped RIGHTY to axis %d (ABS_RY)", out->righty.target); -#endif } LINUX_JoystickClose(joystick); @@ -2075,9 +1779,6 @@ LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) if (item->mapping) { SDL_memcpy(item->mapping, out, sizeof(*out)); } -#ifdef DEBUG_GAMEPAD_MAPPING - SDL_Log("Generated mapping for device %d", device_index); -#endif return SDL_TRUE; } @@ -2088,7 +1789,6 @@ SDL_JoystickDriver SDL_LINUX_JoystickDriver = LINUX_JoystickGetCount, LINUX_JoystickDetect, LINUX_JoystickGetDeviceName, - LINUX_JoystickGetDevicePath, LINUX_JoystickGetDevicePlayerIndex, LINUX_JoystickSetDevicePlayerIndex, LINUX_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/linux/SDL_sysjoystick_c.h b/externals/SDL/src/joystick/linux/SDL_sysjoystick_c.h index f0e27b9ca..49b8686d0 100755 --- a/externals/SDL/src/joystick/linux/SDL_sysjoystick_c.h +++ b/externals/SDL/src/joystick/linux/SDL_sysjoystick_c.h @@ -83,12 +83,6 @@ struct joystick_hwdata /* 4 = (ABS_HAT3X-ABS_HAT0X)/2 (see input-event-codes.h in kernel) */ int hats_indices[4]; SDL_bool has_hat[4]; - struct hat_axis_correct - { - SDL_bool use_deadzones; - int minimum[2]; - int maximum[2]; - } hat_correct[4]; /* Set when gamepad is pending removal due to ENODEV read error */ SDL_bool gone; diff --git a/externals/SDL/src/joystick/os2/SDL_os2joystick.c b/externals/SDL/src/joystick/os2/SDL_os2joystick.c index 1c292ff4d..00b7fc554 100755 --- a/externals/SDL/src/joystick/os2/SDL_os2joystick.c +++ b/externals/SDL/src/joystick/os2/SDL_os2joystick.c @@ -377,17 +377,15 @@ static void OS2_JoystickDetect(void) { } +/***********************************************************/ +/* Function to get the device-dependent name of a joystick */ +/***********************************************************/ static const char *OS2_JoystickGetDeviceName(int device_index) { /* No need to verify if device exists, already done in upper layer */ return SYS_JoyData[device_index].szDeviceName; } -static const char *OS2_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - static int OS2_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -781,7 +779,6 @@ SDL_JoystickDriver SDL_OS2_JoystickDriver = OS2_NumJoysticks, OS2_JoystickDetect, OS2_JoystickGetDeviceName, - OS2_JoystickGetDevicePath, OS2_JoystickGetDevicePlayerIndex, OS2_JoystickSetDevicePlayerIndex, OS2_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/psp/SDL_sysjoystick.c b/externals/SDL/src/joystick/psp/SDL_sysjoystick.c index a5422592b..d71979560 100755 --- a/externals/SDL/src/joystick/psp/SDL_sysjoystick.c +++ b/externals/SDL/src/joystick/psp/SDL_sysjoystick.c @@ -142,6 +142,7 @@ static void PSP_JoystickDetect(void) } #if 0 +/* Function to get the device-dependent name of a joystick */ static const char *PSP_JoystickName(int idx) { if (idx == 0) return "PSP controller"; @@ -150,16 +151,12 @@ static const char *PSP_JoystickName(int idx) } #endif +/* Function to get the device-dependent name of a joystick */ static const char *PSP_JoystickGetDeviceName(int device_index) { return "PSP builtin joypad"; } -static const char *PSP_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - static int PSP_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -307,7 +304,6 @@ SDL_JoystickDriver SDL_PSP_JoystickDriver = PSP_NumJoysticks, PSP_JoystickDetect, PSP_JoystickGetDeviceName, - PSP_JoystickGetDevicePath, PSP_JoystickGetDevicePlayerIndex, PSP_JoystickSetDevicePlayerIndex, PSP_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/sort_controllers.py b/externals/SDL/src/joystick/sort_controllers.py index 93461eb42..bcd05f6a4 100755 --- a/externals/SDL/src/joystick/sort_controllers.py +++ b/externals/SDL/src/joystick/sort_controllers.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # # Script to sort the game controller database entries in SDL_gamecontroller.c diff --git a/externals/SDL/src/joystick/usb_ids.h b/externals/SDL/src/joystick/usb_ids.h index 14c84e5df..5b2648e3e 100755 --- a/externals/SDL/src/joystick/usb_ids.h +++ b/externals/SDL/src/joystick/usb_ids.h @@ -47,9 +47,6 @@ #define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_LEFT 0x2006 #define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_RIGHT 0x2007 #define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP 0x200e -#define USB_PRODUCT_NINTENDO_N64_CONTROLLER 0x2019 -#define USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER 0x201e -#define USB_PRODUCT_NINTENDO_SNES_CONTROLLER 0x2017 #define USB_PRODUCT_RAZER_PANTHERA 0x0401 #define USB_PRODUCT_RAZER_PANTHERA_EVO 0x1008 #define USB_PRODUCT_RAZER_ATROX 0x0a00 @@ -57,7 +54,6 @@ #define USB_PRODUCT_SONY_DS4_DONGLE 0x0ba0 #define USB_PRODUCT_SONY_DS4_SLIM 0x09cc #define USB_PRODUCT_SONY_DS5 0x0ce6 -#define USB_PRODUCT_VICTRIX_FS_PRO_V2 0x0207 #define USB_PRODUCT_XBOX360_XUSB_CONTROLLER 0x02a1 /* XUSB driver software PID */ #define USB_PRODUCT_XBOX360_WIRED_CONTROLLER 0x028e #define USB_PRODUCT_XBOX360_WIRELESS_RECEIVER 0x0719 diff --git a/externals/SDL/src/joystick/virtual/SDL_virtualjoystick.c b/externals/SDL/src/joystick/virtual/SDL_virtualjoystick.c index 273c75e5a..508dd80f9 100755 --- a/externals/SDL/src/joystick/virtual/SDL_virtualjoystick.c +++ b/externals/SDL/src/joystick/virtual/SDL_virtualjoystick.c @@ -24,11 +24,11 @@ /* This is the virtual implementation of the SDL joystick API */ -#include "SDL_endian.h" #include "SDL_virtualjoystick_c.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" +extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver; static joystick_hwdata * g_VJoys = NULL; @@ -56,6 +56,18 @@ VIRTUAL_FreeHWData(joystick_hwdata *hwdata) if (!hwdata) { return; } + if (hwdata->axes) { + SDL_free((void *)hwdata->axes); + hwdata->axes = NULL; + } + if (hwdata->buttons) { + SDL_free((void *)hwdata->buttons); + hwdata->buttons = NULL; + } + if (hwdata->hats) { + SDL_free(hwdata->hats); + hwdata->hats = NULL; + } /* Remove hwdata from SDL-global list */ while (cur) { @@ -71,170 +83,51 @@ VIRTUAL_FreeHWData(joystick_hwdata *hwdata) cur = cur->next; } - if (hwdata->joystick) { - hwdata->joystick->hwdata = NULL; - hwdata->joystick = NULL; - } - if (hwdata->name) { - SDL_free(hwdata->name); - hwdata->name = NULL; - } - if (hwdata->axes) { - SDL_free((void *)hwdata->axes); - hwdata->axes = NULL; - } - if (hwdata->buttons) { - SDL_free((void *)hwdata->buttons); - hwdata->buttons = NULL; - } - if (hwdata->hats) { - SDL_free(hwdata->hats); - hwdata->hats = NULL; - } SDL_free(hwdata); } int -SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc) +SDL_JoystickAttachVirtualInner(SDL_JoystickType type, + int naxes, + int nbuttons, + int nhats) { joystick_hwdata *hwdata = NULL; int device_index = -1; - const char *name = NULL; - Uint16 *guid16; - int axis_triggerleft = -1; - int axis_triggerright = -1; - - if (!desc) { - return SDL_InvalidParamError("desc"); - } - if (desc->version != SDL_VIRTUAL_JOYSTICK_DESC_VERSION) { - /* Is this an old version that we can support? */ - return SDL_SetError("Unsupported virtual joystick description version %d", desc->version); - } hwdata = SDL_calloc(1, sizeof(joystick_hwdata)); if (!hwdata) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); } - SDL_memcpy(&hwdata->desc, desc, sizeof(*desc)); - if (hwdata->desc.name) { - name = hwdata->desc.name; - } else { - switch (hwdata->desc.type) { - case SDL_JOYSTICK_TYPE_GAMECONTROLLER: - name = "Virtual Controller"; - break; - case SDL_JOYSTICK_TYPE_WHEEL: - name = "Virtual Wheel"; - break; - case SDL_JOYSTICK_TYPE_ARCADE_STICK: - name = "Virtual Arcade Stick"; - break; - case SDL_JOYSTICK_TYPE_FLIGHT_STICK: - name = "Virtual Flight Stick"; - break; - case SDL_JOYSTICK_TYPE_DANCE_PAD: - name = "Virtual Dance Pad"; - break; - case SDL_JOYSTICK_TYPE_GUITAR: - name = "Virtual Guitar"; - break; - case SDL_JOYSTICK_TYPE_DRUM_KIT: - name = "Virtual Drum Kit"; - break; - case SDL_JOYSTICK_TYPE_ARCADE_PAD: - name = "Virtual Arcade Pad"; - break; - case SDL_JOYSTICK_TYPE_THROTTLE: - name = "Virtual Throttle"; - break; - default: - name = "Virtual Joystick"; - break; - } - } - hwdata->name = SDL_strdup(name); - - if (hwdata->desc.type == SDL_JOYSTICK_TYPE_GAMECONTROLLER) { - int i, axis; - - if (hwdata->desc.button_mask == 0) { - for (i = 0; i < hwdata->desc.nbuttons && i < sizeof(hwdata->desc.button_mask)*8; ++i) { - hwdata->desc.button_mask |= (1 << i); - } - } - - if (hwdata->desc.axis_mask == 0) { - if (hwdata->desc.naxes >= 2) { - hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_LEFTX) | (1 << SDL_CONTROLLER_AXIS_LEFTY)); - } - if (hwdata->desc.naxes >= 4) { - hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_RIGHTX) | (1 << SDL_CONTROLLER_AXIS_RIGHTY)); - } - if (hwdata->desc.naxes >= 6) { - hwdata->desc.axis_mask |= ((1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT) | (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT)); - } - } - - /* Find the trigger axes */ - axis = 0; - for (i = 0; axis < hwdata->desc.naxes && i < SDL_CONTROLLER_AXIS_MAX; ++i) { - if (hwdata->desc.axis_mask & (1 << i)) { - if (i == SDL_CONTROLLER_AXIS_TRIGGERLEFT) { - axis_triggerleft = axis; - } - if (i == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { - axis_triggerright = axis; - } - ++axis; - } - } - } - - /* We only need 16 bits for each of these; space them out to fill 128. */ - /* Byteswap so devices get same GUID on little/big endian platforms. */ - guid16 = (Uint16 *)hwdata->guid.data; - *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_VIRTUAL); - *guid16++ = 0; - *guid16++ = SDL_SwapLE16(hwdata->desc.vendor_id); - *guid16++ = 0; - *guid16++ = SDL_SwapLE16(hwdata->desc.product_id); - *guid16++ = 0; - *guid16++ = 0; - *guid16++ = 0; /* This will be overwritten below with the virtual controller signature */ + hwdata->naxes = naxes; + hwdata->nbuttons = nbuttons; + hwdata->nhats = nhats; + hwdata->name = "Virtual Joystick"; /* Note that this is a Virtual device and what subtype it is */ hwdata->guid.data[14] = 'v'; - hwdata->guid.data[15] = (Uint8)hwdata->desc.type; + hwdata->guid.data[15] = (Uint8)type; /* Allocate fields for different control-types */ - if (hwdata->desc.naxes > 0) { - hwdata->axes = SDL_calloc(hwdata->desc.naxes, sizeof(Sint16)); + if (naxes > 0) { + hwdata->axes = SDL_calloc(naxes, sizeof(Sint16)); if (!hwdata->axes) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); } - - /* Trigger axes are at minimum value at rest */ - if (axis_triggerleft >= 0) { - hwdata->axes[axis_triggerleft] = SDL_JOYSTICK_AXIS_MIN; - } - if (axis_triggerright >= 0) { - hwdata->axes[axis_triggerright] = SDL_JOYSTICK_AXIS_MIN; - } } - if (hwdata->desc.nbuttons > 0) { - hwdata->buttons = SDL_calloc(hwdata->desc.nbuttons, sizeof(Uint8)); + if (nbuttons > 0) { + hwdata->buttons = SDL_calloc(nbuttons, sizeof(Uint8)); if (!hwdata->buttons) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); } } - if (hwdata->desc.nhats > 0) { - hwdata->hats = SDL_calloc(hwdata->desc.nhats, sizeof(Uint8)); + if (nhats > 0) { + hwdata->hats = SDL_calloc(nhats, sizeof(Uint8)); if (!hwdata->hats) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); @@ -245,16 +138,8 @@ SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc) hwdata->instance_id = SDL_GetNextJoystickInstanceID(); /* Add virtual joystick to SDL-global lists */ - if (g_VJoys) { - joystick_hwdata *last; - - for (last = g_VJoys; last->next; last = last->next) { - continue; - } - last->next = hwdata; - } else { - g_VJoys = hwdata; - } + hwdata->next = g_VJoys; + g_VJoys = hwdata; SDL_PrivateJoystickAdded(hwdata->instance_id); /* Return the new virtual-device's index */ @@ -291,7 +176,7 @@ SDL_JoystickSetVirtualAxisInner(SDL_Joystick *joystick, int axis, Sint16 value) } hwdata = (joystick_hwdata *)joystick->hwdata; - if (axis < 0 || axis >= hwdata->desc.naxes) { + if (axis < 0 || axis >= hwdata->naxes) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid axis index"); } @@ -316,7 +201,7 @@ SDL_JoystickSetVirtualButtonInner(SDL_Joystick *joystick, int button, Uint8 valu } hwdata = (joystick_hwdata *)joystick->hwdata; - if (button < 0 || button >= hwdata->desc.nbuttons) { + if (button < 0 || button >= hwdata->nbuttons) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid button index"); } @@ -341,7 +226,7 @@ SDL_JoystickSetVirtualHatInner(SDL_Joystick *joystick, int hat, Uint8 value) } hwdata = (joystick_hwdata *)joystick->hwdata; - if (hat < 0 || hat >= hwdata->desc.nhats) { + if (hat < 0 || hat >= hwdata->nhats) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid hat index"); } @@ -386,14 +271,7 @@ VIRTUAL_JoystickGetDeviceName(int device_index) if (!hwdata) { return NULL; } - return hwdata->name; -} - - -static const char * -VIRTUAL_JoystickGetDevicePath(int device_index) -{ - return NULL; + return hwdata->name ? hwdata->name : ""; } @@ -407,11 +285,6 @@ VIRTUAL_JoystickGetDevicePlayerIndex(int device_index) static void VIRTUAL_JoystickSetDevicePlayerIndex(int device_index, int player_index) { - joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); - - if (hwdata && hwdata->desc.SetPlayerIndex) { - hwdata->desc.SetPlayerIndex(hwdata->desc.userdata, player_index); - } } @@ -446,12 +319,15 @@ VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index) if (!hwdata) { return SDL_SetError("No such device"); } + if (hwdata->opened) { + return SDL_SetError("Joystick already opened"); + } joystick->instance_id = hwdata->instance_id; joystick->hwdata = hwdata; - joystick->naxes = hwdata->desc.naxes; - joystick->nbuttons = hwdata->desc.nbuttons; - joystick->nhats = hwdata->desc.nhats; - hwdata->joystick = joystick; + joystick->naxes = hwdata->naxes; + joystick->nbuttons = hwdata->nbuttons; + joystick->nhats = hwdata->nhats; + hwdata->opened = SDL_TRUE; return 0; } @@ -459,99 +335,33 @@ VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index) static int VIRTUAL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) { - int result; - - if (joystick->hwdata) { - joystick_hwdata *hwdata = joystick->hwdata; - if (hwdata->desc.Rumble) { - result = hwdata->desc.Rumble(hwdata->desc.userdata, low_frequency_rumble, high_frequency_rumble); - } else { - result = SDL_Unsupported(); - } - } else { - result = SDL_SetError("Rumble failed, device disconnected"); - } - - return result; + return SDL_Unsupported(); } static int VIRTUAL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) { - int result; - - if (joystick->hwdata) { - joystick_hwdata *hwdata = joystick->hwdata; - if (hwdata->desc.RumbleTriggers) { - result = hwdata->desc.RumbleTriggers(hwdata->desc.userdata, left_rumble, right_rumble); - } else { - result = SDL_Unsupported(); - } - } else { - result = SDL_SetError("Rumble failed, device disconnected"); - } - - return result; + return SDL_Unsupported(); } static Uint32 VIRTUAL_JoystickGetCapabilities(SDL_Joystick *joystick) { - joystick_hwdata *hwdata = joystick->hwdata; - Uint32 caps = 0; - - if (hwdata) { - if (hwdata->desc.Rumble) { - caps |= SDL_JOYCAP_RUMBLE; - } - if (hwdata->desc.RumbleTriggers) { - caps |= SDL_JOYCAP_RUMBLE_TRIGGERS; - } - if (hwdata->desc.SetLED) { - caps |= SDL_JOYCAP_LED; - } - } - return caps; + return 0; } static int VIRTUAL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) { - int result; - - if (joystick->hwdata) { - joystick_hwdata *hwdata = joystick->hwdata; - if (hwdata->desc.SetLED) { - result = hwdata->desc.SetLED(hwdata->desc.userdata, red, green, blue); - } else { - result = SDL_Unsupported(); - } - } else { - result = SDL_SetError("SetLED failed, device disconnected"); - } - - return result; + return SDL_Unsupported(); } static int VIRTUAL_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size) { - int result; - - if (joystick->hwdata) { - joystick_hwdata *hwdata = joystick->hwdata; - if (hwdata->desc.SendEffect) { - result = hwdata->desc.SendEffect(hwdata->desc.userdata, data, size); - } else { - result = SDL_Unsupported(); - } - } else { - result = SDL_SetError("SendEffect failed, device disconnected"); - } - - return result; + return SDL_Unsupported(); } static int @@ -576,17 +386,13 @@ VIRTUAL_JoystickUpdate(SDL_Joystick *joystick) hwdata = (joystick_hwdata *)joystick->hwdata; - if (hwdata->desc.Update) { - hwdata->desc.Update(hwdata->desc.userdata); - } - - for (i = 0; i < hwdata->desc.naxes; ++i) { + for (i = 0; i < hwdata->naxes; ++i) { SDL_PrivateJoystickAxis(joystick, i, hwdata->axes[i]); } - for (i = 0; i < hwdata->desc.nbuttons; ++i) { + for (i = 0; i < hwdata->nbuttons; ++i) { SDL_PrivateJoystickButton(joystick, i, hwdata->buttons[i]); } - for (i = 0; i < hwdata->desc.nhats; ++i) { + for (i = 0; i < hwdata->nhats; ++i) { SDL_PrivateJoystickHat(joystick, i, hwdata->hats[i]); } } @@ -595,11 +401,17 @@ VIRTUAL_JoystickUpdate(SDL_Joystick *joystick) static void VIRTUAL_JoystickClose(SDL_Joystick *joystick) { - if (joystick->hwdata) { - joystick_hwdata *hwdata = joystick->hwdata; - hwdata->joystick = NULL; - joystick->hwdata = NULL; + joystick_hwdata *hwdata; + + if (!joystick) { + return; } + if (!joystick->hwdata) { + return; + } + + hwdata = (joystick_hwdata *)joystick->hwdata; + hwdata->opened = SDL_FALSE; } @@ -614,145 +426,7 @@ VIRTUAL_JoystickQuit(void) static SDL_bool VIRTUAL_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) { - joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); - int current_button = 0; - int current_axis = 0; - - if (hwdata->desc.type != SDL_JOYSTICK_TYPE_GAMECONTROLLER) { - return SDL_FALSE; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_A))) { - out->a.kind = EMappingKind_Button; - out->a.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_B))) { - out->b.kind = EMappingKind_Button; - out->b.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_X))) { - out->x.kind = EMappingKind_Button; - out->x.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_Y))) { - out->y.kind = EMappingKind_Button; - out->y.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK))) { - out->back.kind = EMappingKind_Button; - out->back.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE))) { - out->guide.kind = EMappingKind_Button; - out->guide.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_START))) { - out->start.kind = EMappingKind_Button; - out->start.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK))) { - out->leftstick.kind = EMappingKind_Button; - out->leftstick.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK))) { - out->rightstick.kind = EMappingKind_Button; - out->rightstick.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER))) { - out->leftshoulder.kind = EMappingKind_Button; - out->leftshoulder.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER))) { - out->rightshoulder.kind = EMappingKind_Button; - out->rightshoulder.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_UP))) { - out->dpup.kind = EMappingKind_Button; - out->dpup.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_DOWN))) { - out->dpdown.kind = EMappingKind_Button; - out->dpdown.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT))) { - out->dpleft.kind = EMappingKind_Button; - out->dpleft.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_DPAD_RIGHT))) { - out->dpright.kind = EMappingKind_Button; - out->dpright.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_MISC1))) { - out->misc1.kind = EMappingKind_Button; - out->misc1.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE1))) { - out->paddle1.kind = EMappingKind_Button; - out->paddle1.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE2))) { - out->paddle2.kind = EMappingKind_Button; - out->paddle2.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE3))) { - out->paddle3.kind = EMappingKind_Button; - out->paddle3.target = current_button++; - } - - if (current_button < hwdata->desc.nbuttons && (hwdata->desc.button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE4))) { - out->paddle4.kind = EMappingKind_Button; - out->paddle4.target = current_button++; - } - - if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_LEFTX))) { - out->leftx.kind = EMappingKind_Axis; - out->leftx.target = current_axis++; - } - - if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_LEFTY))) { - out->lefty.kind = EMappingKind_Axis; - out->lefty.target = current_axis++; - } - - if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_RIGHTX))) { - out->rightx.kind = EMappingKind_Axis; - out->rightx.target = current_axis++; - } - - if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_RIGHTY))) { - out->righty.kind = EMappingKind_Axis; - out->righty.target = current_axis++; - } - - if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERLEFT))) { - out->lefttrigger.kind = EMappingKind_Axis; - out->lefttrigger.target = current_axis++; - } - - if (current_axis < hwdata->desc.naxes && (hwdata->desc.axis_mask & (1 << SDL_CONTROLLER_AXIS_TRIGGERRIGHT))) { - out->righttrigger.kind = EMappingKind_Axis; - out->righttrigger.target = current_axis++; - } - - return SDL_TRUE; + return SDL_FALSE; } SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver = @@ -761,7 +435,6 @@ SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver = VIRTUAL_JoystickGetCount, VIRTUAL_JoystickDetect, VIRTUAL_JoystickGetDeviceName, - VIRTUAL_JoystickGetDevicePath, VIRTUAL_JoystickGetDevicePlayerIndex, VIRTUAL_JoystickSetDevicePlayerIndex, VIRTUAL_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/virtual/SDL_virtualjoystick_c.h b/externals/SDL/src/joystick/virtual/SDL_virtualjoystick_c.h index 5e15f1dd6..b251c2d14 100755 --- a/externals/SDL/src/joystick/virtual/SDL_virtualjoystick_c.h +++ b/externals/SDL/src/joystick/virtual/SDL_virtualjoystick_c.h @@ -34,19 +34,24 @@ typedef struct joystick_hwdata { SDL_JoystickType type; SDL_bool attached; - char *name; + const char *name; SDL_JoystickGUID guid; - SDL_VirtualJoystickDesc desc; + int naxes; Sint16 *axes; + int nbuttons; Uint8 *buttons; + int nhats; Uint8 *hats; SDL_JoystickID instance_id; - SDL_Joystick *joystick; - + SDL_bool opened; struct joystick_hwdata *next; } joystick_hwdata; -int SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc); +int SDL_JoystickAttachVirtualInner(SDL_JoystickType type, + int naxes, + int nbuttons, + int nhats); + int SDL_JoystickDetachVirtualInner(int device_index); int SDL_JoystickSetVirtualAxisInner(SDL_Joystick * joystick, int axis, Sint16 value); @@ -54,7 +59,4 @@ int SDL_JoystickSetVirtualButtonInner(SDL_Joystick * joystick, int button, Uint8 int SDL_JoystickSetVirtualHatInner(SDL_Joystick * joystick, int hat, Uint8 value); #endif /* SDL_JOYSTICK_VIRTUAL */ - #endif /* SDL_VIRTUALJOYSTICK_C_H */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/joystick/vita/SDL_sysjoystick.c b/externals/SDL/src/joystick/vita/SDL_sysjoystick.c index b5c7a2778..3ef1fc178 100755 --- a/externals/SDL/src/joystick/vita/SDL_sysjoystick.c +++ b/externals/SDL/src/joystick/vita/SDL_sysjoystick.c @@ -147,7 +147,7 @@ int VITA_JoystickInit(void) // after the app has already started. SDL_numjoysticks = 1; - SDL_PrivateJoystickAdded(0); + // How many additional paired controllers are there? sceCtrlGetControllerPortInfo(&myPortInfo); @@ -157,7 +157,6 @@ int VITA_JoystickInit(void) { if (myPortInfo.port[i]!=SCE_CTRL_TYPE_UNPAIRED) { - SDL_PrivateJoystickAdded(SDL_numjoysticks); SDL_numjoysticks++; } } @@ -179,6 +178,7 @@ SDL_JoystickID VITA_JoystickGetDeviceInstanceID(int device_index) return device_index; } +/* Function to get the device-dependent name of a joystick */ const char *VITA_JoystickGetDeviceName(int index) { if (index == 0) @@ -194,12 +194,7 @@ const char *VITA_JoystickGetDeviceName(int index) return "PSVita Controller"; SDL_SetError("No joystick available with that index"); - return NULL; -} - -const char *VITA_JoystickGetDevicePath(int index) -{ - return NULL; + return(NULL); } static int @@ -404,7 +399,6 @@ SDL_JoystickDriver SDL_VITA_JoystickDriver = VITA_JoystickGetCount, VITA_JoystickDetect, VITA_JoystickGetDeviceName, - VITA_JoystickGetDevicePath, VITA_JoystickGetDevicePlayerIndex, VITA_JoystickSetDevicePlayerIndex, VITA_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/windows/SDL_dinputjoystick.c b/externals/SDL/src/joystick/windows/SDL_dinputjoystick.c index da35ebb00..c2f53a93f 100755 --- a/externals/SDL/src/joystick/windows/SDL_dinputjoystick.c +++ b/externals/SDL/src/joystick/windows/SDL_dinputjoystick.c @@ -253,7 +253,7 @@ SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char* hidPath) return SDL_TRUE; } - type = SDL_GetJoystickGameControllerTypeFromVIDPID(vendor_id, product_id, NULL, SDL_FALSE); + type = SDL_GetJoystickGameControllerType("", vendor_id, product_id, -1, 0, 0, 0); if (type == SDL_CONTROLLER_TYPE_XBOX360 || type == SDL_CONTROLLER_TYPE_XBOXONE || (vendor_id == USB_VENDOR_VALVE && product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD)) { @@ -456,7 +456,7 @@ EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext) pNewJoystick = *(JoyStick_DeviceData**)pContext; while (pNewJoystick) { /* update GUIDs of joysticks with matching paths, in case they're not open yet */ - if (SDL_strcmp(pNewJoystick->path, hidPath) == 0) { + if (SDL_strcmp(pNewJoystick->hidPath, hidPath) == 0) { /* if we are replacing the front of the list then update it */ if (pNewJoystick == *(JoyStick_DeviceData**)pContext) { *(JoyStick_DeviceData**)pContext = pNewJoystick->pNext; @@ -483,7 +483,7 @@ EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext) CHECK(pNewJoystick); SDL_zerop(pNewJoystick); - SDL_strlcpy(pNewJoystick->path, hidPath, SDL_arraysize(pNewJoystick->path)); + SDL_strlcpy(pNewJoystick->hidPath, hidPath, SDL_arraysize(pNewJoystick->hidPath)); SDL_memcpy(&pNewJoystick->dxdevice, pDeviceInstance, sizeof(DIDEVICEINSTANCE)); SDL_memset(pNewJoystick->guid.data, 0, sizeof(pNewJoystick->guid.data)); @@ -683,7 +683,7 @@ EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE pDeviceObject, LPVOID pContext) /* Sort using the data offset into the DInput struct. * This gives a reasonable ordering for the inputs. */ -static int SDLCALL +static int SortDevFunc(const void *a, const void *b) { const input_t *inputA = (const input_t*)a; diff --git a/externals/SDL/src/joystick/windows/SDL_rawinputjoystick.c b/externals/SDL/src/joystick/windows/SDL_rawinputjoystick.c index e6e9831ed..8178ee624 100755 --- a/externals/SDL/src/joystick/windows/SDL_rawinputjoystick.c +++ b/externals/SDL/src/joystick/windows/SDL_rawinputjoystick.c @@ -40,6 +40,7 @@ #include "SDL_timer.h" #include "../usb_ids.h" #include "../SDL_sysjoystick.h" +#include "../controller_type.h" #include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_hid.h" #include "../hidapi/SDL_hidapijoystick_c.h" @@ -61,18 +62,11 @@ typedef struct WindowsGamingInputGamepadState WindowsGamingInputGamepadState; #define GamepadButtons_GUIDE 0x40000000 #define COBJMACROS #include "windows.gaming.input.h" -#include #endif #if defined(SDL_JOYSTICK_RAWINPUT_XINPUT) || defined(SDL_JOYSTICK_RAWINPUT_WGI) #define SDL_JOYSTICK_RAWINPUT_MATCHING #define SDL_JOYSTICK_RAWINPUT_MATCH_AXES -#define SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS -#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS -#define SDL_JOYSTICK_RAWINPUT_MATCH_COUNT 6 // stick + trigger axes -#else -#define SDL_JOYSTICK_RAWINPUT_MATCH_COUNT 4 // stick axes -#endif #endif /*#define DEBUG_RAWINPUT*/ @@ -104,7 +98,6 @@ typedef struct _SDL_RAWINPUT_Device { SDL_atomic_t refcount; char *name; - char *path; Uint16 vendor_id; Uint16 product_id; Uint16 version; @@ -135,7 +128,7 @@ struct joystick_hwdata USHORT trigger_hack_index; #ifdef SDL_JOYSTICK_RAWINPUT_MATCHING - Uint64 match_state; /* Lowest 16 bits for button states, higher 24 for 6 4bit axes */ + Uint32 match_state; /* Low 16 bits for button states, high 16 for 4 4bit axes */ Uint32 last_state_packet; #endif @@ -180,7 +173,7 @@ static struct { typedef struct WindowsMatchState { #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES - SHORT match_axes[SDL_JOYSTICK_RAWINPUT_MATCH_COUNT]; + SHORT match_axes[4]; #endif #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT WORD xinput_buttons; @@ -191,13 +184,13 @@ typedef struct WindowsMatchState { SDL_bool any_data; } WindowsMatchState; -static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state) +static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint32 match_state) { #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES int ii; #endif - SDL_bool any_axes_data = SDL_FALSE; + state->any_data = SDL_FALSE; #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES /* SHORT state->match_axes[4] = { (match_state & 0x000F0000) >> 4, @@ -206,18 +199,12 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state (match_state & 0xF0000000) >> 16, }; */ for (ii = 0; ii < 4; ii++) { - state->match_axes[ii] = (SHORT)((match_state & (0x000F0000ull << (ii * 4))) >> (4 + ii * 4)); - any_axes_data |= ((Uint32)(state->match_axes[ii] + 0x1000) > 0x2000); /* match_state bit is not 0xF, 0x1, or 0x2 */ + state->match_axes[ii] = (match_state & (0x000F0000 << (ii * 4))) >> (4 + ii * 4); + if ((Uint32)(state->match_axes[ii] + 0x1000) > 0x2000) { /* match_state bit is not 0xF, 0x1, or 0x2 */ + state->any_data = SDL_TRUE; + } } #endif /* SDL_JOYSTICK_RAWINPUT_MATCH_AXES */ -#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS - for (; ii < SDL_JOYSTICK_RAWINPUT_MATCH_COUNT; ii++) { - state->match_axes[ii] = (SHORT)((match_state & (0x000F0000ull << (ii * 4))) >> (4 + ii * 4)); - any_axes_data |= (state->match_axes[ii] != SDL_MIN_SINT16); - } -#endif /* SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS */ - - state->any_data = any_axes_data; #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT /* Match axes by checking if the distance between the high 4 bits of axis and the 4 bits from match_state is 1 or less */ @@ -233,16 +220,9 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state SDL_abs((Sint8)((gamepad.sThumbRX & 0xF000) >> 8) - ((match_state & 0x0F000000) >> 20)) <= 0x10 && \ SDL_abs((Sint8)((~gamepad.sThumbRY & 0xF000) >> 8) - ((match_state & 0xF0000000) >> 24)) <= 0x10) */ - /* Can only match trigger values if a single trigger has a value. */ -#define XInputTriggersMatch(gamepad) ( \ - ((state->match_axes[4] == SDL_MIN_SINT16) && (state->match_axes[5] == SDL_MIN_SINT16)) || \ - ((gamepad.bLeftTrigger != 0) && (gamepad.bRightTrigger != 0)) || \ - ((Uint32)((((int)gamepad.bLeftTrigger * 257) - 32768) - state->match_axes[4]) <= 0x2fff) || \ - ((Uint32)((((int)gamepad.bRightTrigger * 257) - 32768) - state->match_axes[5]) <= 0x2fff)) - state->xinput_buttons = /* Bitwise map .RLDUWVQTS.KYXBA -> YXBA..WVQTKSRLDU */ - (WORD)(match_state << 12 | (match_state & 0x0780) >> 1 | (match_state & 0x0010) << 1 | (match_state & 0x0040) >> 2 | (match_state & 0x7800) >> 11); + match_state << 12 | (match_state & 0x0780) >> 1 | (match_state & 0x0010) << 1 | (match_state & 0x0040) >> 2 | (match_state & 0x7800) >> 11; /* Explicit ((match_state & (1<match_axes[2] + 0x1000) <= 0x2fff && \ (Uint16)((~(Sint16)(gamepad.RightThumbstickY * SDL_MAX_SINT16) & 0xF000) - state->match_axes[3] + 0x1000) <= 0x2fff) -#define WindowsGamingInputTriggersMatch(gamepad) ( \ - ((state->match_axes[4] == SDL_MIN_SINT16) && (state->match_axes[5] == SDL_MIN_SINT16)) || \ - ((gamepad.LeftTrigger == 0.0f) && (gamepad.RightTrigger == 0.0f)) || \ - ((Uint16)((((int)(gamepad.LeftTrigger * SDL_MAX_UINT16)) - 32768) - state->match_axes[4]) <= 0x2fff) || \ - ((Uint16)((((int)(gamepad.RightTrigger * SDL_MAX_UINT16)) - 32768) - state->match_axes[5]) <= 0x2fff)) state->wgi_buttons = /* Bitwise map .RLD UWVQ TS.K YXBA -> ..QT WVRL DUYX BAKS */ @@ -379,9 +354,6 @@ RAWINPUT_XInputSlotMatches(const WindowsMatchState *state, Uint8 slot_idx) if ((xinput_buttons & ~XINPUT_GAMEPAD_GUIDE) == state->xinput_buttons #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES && XInputAxesMatch(xinput_state[slot_idx].state.Gamepad) -#endif -#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS - && XInputTriggersMatch(xinput_state[slot_idx].state.Gamepad) #endif ) { return SDL_TRUE; @@ -566,24 +538,22 @@ RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx) if (!wgi_state.initialized) { static const IID SDL_IID_IGamepadStatics = { 0x8BBCE529, 0xD49C, 0x39E9, { 0x95, 0x60, 0xE4, 0x7D, 0xDE, 0x96, 0xB7, 0xC8 } }; HRESULT hr; + HMODULE hModule; - if (FAILED(WIN_RoInitialize())) { + /* I think this takes care of RoInitialize() in a way that is compatible with the rest of SDL */ + if (FAILED(WIN_CoInitialize())) { return; } wgi_state.initialized = SDL_TRUE; wgi_state.dirty = SDL_TRUE; - { + hModule = LoadLibraryA("combase.dll"); + if (hModule != NULL) { typedef HRESULT (WINAPI *WindowsCreateStringReference_t)(PCWSTR sourceString, UINT32 length, HSTRING_HEADER *hstringHeader, HSTRING* string); typedef HRESULT (WINAPI *RoGetActivationFactory_t)(HSTRING activatableClassId, REFIID iid, void** factory); -#ifdef __WINRT__ - WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = WindowsCreateStringReference; - RoGetActivationFactory_t RoGetActivationFactoryFunc = RoGetActivationFactory; -#else - WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)WIN_LoadComBaseFunction("WindowsCreateStringReference"); - RoGetActivationFactory_t RoGetActivationFactoryFunc = (RoGetActivationFactory_t)WIN_LoadComBaseFunction("RoGetActivationFactory"); -#endif + WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)GetProcAddress(hModule, "WindowsCreateStringReference"); + RoGetActivationFactory_t RoGetActivationFactoryFunc = (RoGetActivationFactory_t)GetProcAddress(hModule, "RoGetActivationFactory"); if (WindowsCreateStringReferenceFunc && RoGetActivationFactoryFunc) { PCWSTR pNamespace = L"Windows.Gaming.Input.Gamepad"; HSTRING_HEADER hNamespaceStringHeader; @@ -594,21 +564,18 @@ RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx) RoGetActivationFactoryFunc(hNamespaceString, &SDL_IID_IGamepadStatics, (void **)&wgi_state.gamepad_statics); } } + FreeLibrary(hModule); } } } static SDL_bool -RAWINPUT_WindowsGamingInputSlotMatches(const WindowsMatchState *state, WindowsGamingInputGamepadState *slot, SDL_bool xinput_correlated) +RAWINPUT_WindowsGamingInputSlotMatches(const WindowsMatchState *state, WindowsGamingInputGamepadState *slot) { Uint32 wgi_buttons = slot->state.Buttons; if ((wgi_buttons & 0x3FFF) == state->wgi_buttons #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES && WindowsGamingInputAxesMatch(slot->state) -#endif -#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS - // Don't try to match WGI triggers if getting values from XInput - && (xinput_correlated || WindowsGamingInputTriggersMatch(slot->state)) #endif ) { return SDL_TRUE; @@ -617,14 +584,14 @@ RAWINPUT_WindowsGamingInputSlotMatches(const WindowsMatchState *state, WindowsGa } static SDL_bool -RAWINPUT_GuessWindowsGamingInputSlot(const WindowsMatchState *state, Uint8 *correlation_id, WindowsGamingInputGamepadState **slot, SDL_bool xinput_correlated) +RAWINPUT_GuessWindowsGamingInputSlot(const WindowsMatchState *state, Uint8 *correlation_id, WindowsGamingInputGamepadState **slot) { int match_count, user_index; match_count = 0; for (user_index = 0; user_index < wgi_state.per_gamepad_count; ++user_index) { WindowsGamingInputGamepadState *gamepad_state = wgi_state.per_gamepad[user_index]; - if (RAWINPUT_WindowsGamingInputSlotMatches(state, gamepad_state, xinput_correlated)) { + if (RAWINPUT_WindowsGamingInputSlotMatches(state, gamepad_state)) { ++match_count; *slot = gamepad_state; /* Incrementing correlation_id for any match, as negative evidence for others being correlated */ @@ -659,7 +626,7 @@ RAWINPUT_QuitWindowsGamingInput(RAWINPUT_DeviceContext *ctx) __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics_Release(wgi_state.gamepad_statics); wgi_state.gamepad_statics = NULL; } - WIN_RoUninitialize(); + WIN_CoUninitialize(); wgi_state.initialized = SDL_FALSE; } } @@ -689,9 +656,10 @@ RAWINPUT_ReleaseDevice(SDL_RAWINPUT_Device *device) #endif /* SDL_JOYSTICK_RAWINPUT_XINPUT */ if (SDL_AtomicDecRef(&device->refcount)) { - SDL_free(device->preparsed_data); + if (device->preparsed_data) { + SDL_HidD_FreePreparsedData(device->preparsed_data); + } SDL_free(device->name); - SDL_free(device->path); SDL_free(device); } } @@ -715,8 +683,9 @@ RAWINPUT_AddDevice(HANDLE hDevice) SDL_RAWINPUT_Device *device = NULL; SDL_RAWINPUT_Device *curr, *last; RID_DEVICE_INFO rdi; - UINT size; + UINT rdi_size = sizeof(rdi); char dev_name[MAX_PATH]; + UINT name_size = SDL_arraysize(dev_name); HANDLE hFile = INVALID_HANDLE_VALUE; /* Make sure we're not trying to add the same device twice */ @@ -725,13 +694,11 @@ RAWINPUT_AddDevice(HANDLE hDevice) } /* Figure out what kind of device it is */ - size = sizeof(rdi); - CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICEINFO, &rdi, &size) != (UINT)-1); + CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICEINFO, &rdi, &rdi_size) != (UINT)-1); CHECK(rdi.dwType == RIM_TYPEHID); /* Get the device "name" (HID Path) */ - size = SDL_arraysize(dev_name); - CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICENAME, dev_name, &size) != (UINT)-1); + CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICENAME, dev_name, &name_size) != (UINT)-1); /* Only take XInput-capable devices */ CHECK(SDL_strstr(dev_name, "IG_") != NULL); #ifdef SDL_JOYSTICK_HIDAPI @@ -745,13 +712,7 @@ RAWINPUT_AddDevice(HANDLE hDevice) device->product_id = (Uint16)rdi.hid.dwProductId; device->version = (Uint16)rdi.hid.dwVersionNumber; device->is_xinput = SDL_TRUE; - device->is_xboxone = SDL_IsJoystickXboxOne(device->vendor_id, device->product_id); - - /* Get HID Top-Level Collection Preparsed Data */ - size = 0; - CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_PREPARSEDDATA, NULL, &size) != (UINT)-1); - CHECK(device->preparsed_data = (PHIDP_PREPARSED_DATA)SDL_calloc(size, sizeof(BYTE))); - CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_PREPARSEDDATA, device->preparsed_data, &size) != (UINT)-1); + device->is_xboxone = GuessControllerType(device->vendor_id, device->product_id) == k_eControllerType_XBoxOneController; { const Uint16 vendor = device->vendor_id; @@ -797,7 +758,8 @@ RAWINPUT_AddDevice(HANDLE hDevice) SDL_free(product_string); } } - device->path = SDL_strdup(dev_name); + + CHECK(SDL_HidD_GetPreparsedData(hFile, &device->preparsed_data)); CloseHandle(hFile); hFile = INVALID_HANDLE_VALUE; @@ -830,12 +792,8 @@ err: CloseHandle(hFile); } if (device) { - if (device->name) { + if (device->name) SDL_free(device->name); - } - if (device->path) { - SDL_free(device->path); - } SDL_free(device); } #undef CHECK @@ -932,12 +890,9 @@ RAWINPUT_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, co return SDL_TRUE; } - /* The Xbox 360 wireless controller shows up as product 0 in WGI. - Try to match it to a Raw Input device via name or known product ID. */ + /* The Xbox 360 wireless controller shows up as product 0 in WGI */ if (vendor_id == device->vendor_id && product_id == 0 && - ((name && SDL_strstr(device->name, name) != NULL) || - (device->vendor_id == USB_VENDOR_MICROSOFT && - device->product_id == USB_PRODUCT_XBOX360_XUSB_CONTROLLER))) { + name && SDL_strstr(device->name, name) != NULL) { return SDL_TRUE; } @@ -1038,12 +993,6 @@ RAWINPUT_JoystickGetDeviceName(int device_index) return RAWINPUT_GetDeviceByIndex(device_index)->name; } -static const char * -RAWINPUT_JoystickGetDevicePath(int device_index) -{ - return RAWINPUT_GetDeviceByIndex(device_index)->path; -} - static int RAWINPUT_JoystickGetDevicePlayerIndex(int device_index) { @@ -1068,7 +1017,7 @@ RAWINPUT_JoystickGetDeviceInstanceID(int device_index) return RAWINPUT_GetDeviceByIndex(device_index)->joystick_id; } -static int SDLCALL +static int RAWINPUT_SortValueCaps(const void *A, const void *B) { HIDP_VALUE_CAPS *capsA = (HIDP_VALUE_CAPS *)A; @@ -1268,7 +1217,7 @@ RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) } } - joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + SDL_PrivateJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_UNKNOWN); return 0; } @@ -1278,8 +1227,8 @@ RAWINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin { #if defined(SDL_JOYSTICK_RAWINPUT_WGI) || defined(SDL_JOYSTICK_RAWINPUT_XINPUT) RAWINPUT_DeviceContext *ctx = joystick->hwdata; -#endif SDL_bool rumbled = SDL_FALSE; +#endif #ifdef SDL_JOYSTICK_RAWINPUT_WGI if (!rumbled && ctx->wgi_correlated) { @@ -1312,13 +1261,6 @@ RAWINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin } #endif /* SDL_JOYSTICK_RAWINPUT_XINPUT */ - if (!rumbled) { -#if defined(SDL_JOYSTICK_RAWINPUT_WGI) || defined(SDL_JOYSTICK_RAWINPUT_XINPUT) - return SDL_SetError("Controller isn't correlated yet, try hitting a button first"); -#else - return SDL_Unsupported(); -#endif - } return 0; } @@ -1327,7 +1269,7 @@ RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint { #if defined(SDL_JOYSTICK_RAWINPUT_WGI) RAWINPUT_DeviceContext *ctx = joystick->hwdata; - + if (ctx->wgi_correlated) { WindowsGamingInputGamepadState *gamepad_state = ctx->wgi_slot; HRESULT hr; @@ -1337,10 +1279,8 @@ RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint if (!SUCCEEDED(hr)) { return SDL_SetError("Setting vibration failed: 0x%lx\n", hr); } - return 0; - } else { - return SDL_SetError("Controller isn't correlated yet, try hitting a button first"); } + return 0; #else return SDL_Unsupported(); #endif @@ -1349,15 +1289,15 @@ RAWINPUT_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint static Uint32 RAWINPUT_JoystickGetCapabilities(SDL_Joystick *joystick) { - Uint32 result = 0; -#if defined(SDL_JOYSTICK_RAWINPUT_XINPUT) || defined(SDL_JOYSTICK_RAWINPUT_WGI) RAWINPUT_DeviceContext *ctx = joystick->hwdata; + Uint32 result = 0; #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT if (ctx->is_xinput) { result |= SDL_JOYCAP_RUMBLE; } #endif + #ifdef SDL_JOYSTICK_RAWINPUT_WGI if (ctx->is_xinput) { result |= SDL_JOYCAP_RUMBLE; @@ -1367,7 +1307,6 @@ RAWINPUT_JoystickGetCapabilities(SDL_Joystick *joystick) } } #endif -#endif /**/ return result; } @@ -1444,13 +1383,12 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT), (1 << SDL_CONTROLLER_BUTTON_DPAD_UP) | (1 << SDL_CONTROLLER_BUTTON_DPAD_LEFT), }; - Uint64 match_state = ctx->match_state; + Uint32 match_state = ctx->match_state; /* Update match_state with button bit, then fall through */ -#define SDL_PrivateJoystickButton(joystick, button, state) if (button < SDL_arraysize(button_map)) { Uint64 button_bit = 1ull << button_map[button]; match_state = (match_state & ~button_bit) | (button_bit * (state)); } SDL_PrivateJoystickButton(joystick, button, state) +#define SDL_PrivateJoystickButton(joystick, button, state) if (button < SDL_arraysize(button_map)) { if (state) match_state |= 1 << button_map[button]; else match_state &= ~(1 << button_map[button]); } SDL_PrivateJoystickButton(joystick, button, state) #ifdef SDL_JOYSTICK_RAWINPUT_MATCH_AXES /* Grab high 4 bits of value, then fall through */ -#define AddAxisToMatchState(axis, value) { match_state = (match_state & ~(0xFull << (4 * axis + 16))) | ((value) & 0xF000ull) << (4 * axis + 4); } -#define SDL_PrivateJoystickAxis(joystick, axis, value) if (axis < 4) AddAxisToMatchState(axis, value); SDL_PrivateJoystickAxis(joystick, axis, value) +#define SDL_PrivateJoystickAxis(joystick, axis, value) if (axis < 4) match_state = (match_state & ~(0xF << (4 * axis + 16))) | ((value) & 0xF000) << (4 * axis + 4); SDL_PrivateJoystickAxis(joystick, axis, value) #endif #endif /* SDL_JOYSTICK_RAWINPUT_MATCHING */ @@ -1515,14 +1453,8 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) #undef SDL_PrivateJoystickAxis #endif -#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS -#define AddTriggerToMatchState(axis, value) { int match_axis = axis + SDL_JOYSTICK_RAWINPUT_MATCH_COUNT - joystick->naxes; AddAxisToMatchState(match_axis, value); } -#endif /* SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS */ - if (ctx->trigger_hack) { SDL_bool has_trigger_data = SDL_FALSE; - int left_trigger = joystick->naxes - 2; - int right_trigger = joystick->naxes - 1; #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT /* Prefer XInput over WindowsGamingInput, it continues to provide data in the background */ @@ -1537,36 +1469,28 @@ RAWINPUT_HandleStatePacket(SDL_Joystick *joystick, Uint8 *data, int size) } #endif /* SDL_JOYSTICK_RAWINPUT_WGI */ -#ifndef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS - if (!has_trigger_data) -#endif - { + if (!has_trigger_data) { HIDP_DATA *item = GetData(ctx->trigger_hack_index, ctx->data, data_length); if (item) { + int left_trigger = joystick->naxes - 2; + int right_trigger = joystick->naxes - 1; Sint16 value = (int)(Uint16)item->RawValue - 0x8000; - Sint16 left_value = (value > 0) ? (value * 2 - 32767) : SDL_MIN_SINT16; - Sint16 right_value = (value < 0) ? (-value * 2 - 32769) : SDL_MIN_SINT16; - -#ifdef SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS - AddTriggerToMatchState(left_trigger, left_value); - AddTriggerToMatchState(right_trigger, right_value); - if (!has_trigger_data) -#endif /* SDL_JOYSTICK_RAWINPUT_MATCH_TRIGGERS */ - { - SDL_PrivateJoystickAxis(joystick, left_trigger, left_value); - SDL_PrivateJoystickAxis(joystick, right_trigger, right_value); + if (value < 0) { + value = -value * 2 - 32769; + SDL_PrivateJoystickAxis(joystick, left_trigger, SDL_MIN_SINT16); + SDL_PrivateJoystickAxis(joystick, right_trigger, value); + } else if (value > 0) { + value = value * 2 - 32767; + SDL_PrivateJoystickAxis(joystick, left_trigger, value); + SDL_PrivateJoystickAxis(joystick, right_trigger, SDL_MIN_SINT16); + } else { + SDL_PrivateJoystickAxis(joystick, left_trigger, SDL_MIN_SINT16); + SDL_PrivateJoystickAxis(joystick, right_trigger, SDL_MIN_SINT16); } } } } -#ifdef AddAxisToMatchState -#undef AddAxisToMatchState -#endif -#ifdef AddTriggerToMatchState -#undef AddTriggerToMatchState -#endif - #ifdef SDL_JOYSTICK_RAWINPUT_MATCHING if (ctx->is_xinput) { ctx->match_state = match_state; @@ -1586,25 +1510,17 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) int guide_button = joystick->nbuttons - 1; int left_trigger = joystick->naxes - 2; int right_trigger = joystick->naxes - 1; -#ifdef SDL_JOYSTICK_RAWINPUT_WGI - SDL_bool xinput_correlated; -#endif RAWINPUT_FillMatchState(&match_state_xinput, ctx->match_state); #ifdef SDL_JOYSTICK_RAWINPUT_WGI - #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT - xinput_correlated = ctx->xinput_correlated; - #else - xinput_correlated = SDL_FALSE; - #endif /* Parallel logic to WINDOWS_XINPUT below */ RAWINPUT_UpdateWindowsGamingInput(); if (ctx->wgi_correlated && !joystick->low_frequency_rumble && !joystick->high_frequency_rumble && !joystick->left_trigger_rumble && !joystick->right_trigger_rumble) { /* We have been previously correlated, ensure we are still matching, see comments in XINPUT section */ - if (RAWINPUT_WindowsGamingInputSlotMatches(&match_state_xinput, ctx->wgi_slot, xinput_correlated)) { + if (RAWINPUT_WindowsGamingInputSlotMatches(&match_state_xinput, ctx->wgi_slot)) { ctx->wgi_uncorrelate_count = 0; } else { ++ctx->wgi_uncorrelate_count; @@ -1633,7 +1549,7 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick) if (RAWINPUT_MissingWindowsGamingInputSlot()) { Uint8 correlation_id; WindowsGamingInputGamepadState *slot_idx = NULL; - if (RAWINPUT_GuessWindowsGamingInputSlot(&match_state_xinput, &correlation_id, &slot_idx, xinput_correlated)) { + if (RAWINPUT_GuessWindowsGamingInputSlot(&match_state_xinput, &correlation_id, &slot_idx)) { /* we match exactly one WindowsGamingInput device */ /* Probably can do without wgi_correlation_count, just check and clear wgi_slot to NULL, unless we need even more frames to be sure. */ @@ -1935,7 +1851,7 @@ RAWINPUT_UnregisterNotifications() return; } } - + LRESULT CALLBACK RAWINPUT_WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -2030,7 +1946,6 @@ SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver = RAWINPUT_JoystickGetCount, RAWINPUT_JoystickDetect, RAWINPUT_JoystickGetDeviceName, - RAWINPUT_JoystickGetDevicePath, RAWINPUT_JoystickGetDevicePlayerIndex, RAWINPUT_JoystickSetDevicePlayerIndex, RAWINPUT_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/windows/SDL_windows_gaming_input.c b/externals/SDL/src/joystick/windows/SDL_windows_gaming_input.c index a266d4b5c..2cb5f2cb7 100755 --- a/externals/SDL/src/joystick/windows/SDL_windows_gaming_input.c +++ b/externals/SDL/src/joystick/windows/SDL_windows_gaming_input.c @@ -35,13 +35,6 @@ #include -#ifdef ____FIReference_1_INT32_INTERFACE_DEFINED__ -/* MinGW-64 uses __FIReference_1_INT32 instead of Microsoft's __FIReference_1_int */ -#define __FIReference_1_int __FIReference_1_INT32 -#define __FIReference_1_int_get_Value __FIReference_1_INT32_get_Value -#define __FIReference_1_int_Release __FIReference_1_INT32_Release -#endif - struct joystick_hwdata { __x_ABI_CWindows_CGaming_CInput_CIRawGameController *controller; @@ -75,7 +68,6 @@ static struct { EventRegistrationToken controller_added_token; EventRegistrationToken controller_removed_token; int controller_count; - SDL_bool ro_initialized; WindowsGamingInputControllerState *controllers; } wgi; @@ -268,9 +260,10 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde WindowsGetStringRawBufferFunc = WindowsGetStringRawBuffer; WindowsDeleteStringFunc = WindowsDeleteString; #else - { - WindowsGetStringRawBufferFunc = (WindowsGetStringRawBuffer_t)WIN_LoadComBaseFunction("WindowsGetStringRawBuffer"); - WindowsDeleteStringFunc = (WindowsDeleteString_t)WIN_LoadComBaseFunction("WindowsDeleteString"); + HMODULE hModule = LoadLibraryA("combase.dll"); + if (hModule != NULL) { + WindowsGetStringRawBufferFunc = (WindowsGetStringRawBuffer_t)GetProcAddress(hModule, "WindowsGetStringRawBuffer"); + WindowsDeleteStringFunc = (WindowsDeleteString_t)GetProcAddress(hModule, "WindowsDeleteString"); } #endif /* __WINRT__ */ if (WindowsGetStringRawBufferFunc && WindowsDeleteStringFunc) { @@ -284,10 +277,15 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde WindowsDeleteStringFunc(hString); } } +#ifndef __WINRT__ + if (hModule != NULL) { + FreeLibrary(hModule); + } +#endif __x_ABI_CWindows_CGaming_CInput_CIRawGameController2_Release(controller2); } if (!name) { - name = SDL_strdup(""); + name = ""; } hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(controller, &IID_IGameController, (void **)&gamecontroller); @@ -446,43 +444,23 @@ WGI_JoystickInit(void) WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = NULL; RoGetActivationFactory_t RoGetActivationFactoryFunc = NULL; +#ifndef __WINRT__ + HMODULE hModule; +#endif HRESULT hr; - if (FAILED(WIN_RoInitialize())) { - return SDL_SetError("RoInitialize() failed"); + if (FAILED(WIN_CoInitialize())) { + return SDL_SetError("CoInitialize() failed"); } - wgi.ro_initialized = SDL_TRUE; - -#ifndef __WINRT__ - { - /* There seems to be a bug in Windows where a dependency of WGI can be unloaded from memory prior to WGI itself. - * This results in Windows_Gaming_Input!GameController::~GameController() invoking an unloaded DLL and crashing. - * As a workaround, we will keep a reference to the MTA to prevent COM from unloading DLLs later. - * See https://github.com/libsdl-org/SDL/issues/5552 for more details. - */ - static PVOID cookie = NULL; - if (!cookie) { - typedef HRESULT (WINAPI *CoIncrementMTAUsage_t)(PVOID* pCookie); - CoIncrementMTAUsage_t CoIncrementMTAUsageFunc = (CoIncrementMTAUsage_t)WIN_LoadComBaseFunction("CoIncrementMTAUsage"); - if (CoIncrementMTAUsageFunc) { - if (FAILED(CoIncrementMTAUsageFunc(&cookie))) { - return SDL_SetError("CoIncrementMTAUsage() failed"); - } - } else { - /* CoIncrementMTAUsage() is present since Win8, so we should never make it here. */ - return SDL_SetError("CoIncrementMTAUsage() not found"); - } - } - } -#endif #ifdef __WINRT__ WindowsCreateStringReferenceFunc = WindowsCreateStringReference; RoGetActivationFactoryFunc = RoGetActivationFactory; #else - { - WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)WIN_LoadComBaseFunction("WindowsCreateStringReference"); - RoGetActivationFactoryFunc = (RoGetActivationFactory_t)WIN_LoadComBaseFunction("RoGetActivationFactory"); + hModule = LoadLibraryA("combase.dll"); + if (hModule != NULL) { + WindowsCreateStringReferenceFunc = (WindowsCreateStringReference_t)GetProcAddress(hModule, "WindowsCreateStringReference"); + RoGetActivationFactoryFunc = (RoGetActivationFactory_t)GetProcAddress(hModule, "RoGetActivationFactory"); } #endif /* __WINRT__ */ if (WindowsCreateStringReferenceFunc && RoGetActivationFactoryFunc) { @@ -541,6 +519,11 @@ WGI_JoystickInit(void) } } } +#ifndef __WINRT__ + if (hModule != NULL) { + FreeLibrary(hModule); + } +#endif if (wgi.statics) { __FIVectorView_1_Windows__CGaming__CInput__CRawGameController *controllers; @@ -593,12 +576,6 @@ WGI_JoystickGetDeviceName(int device_index) return wgi.controllers[device_index].name; } -static const char * -WGI_JoystickGetDevicePath(int device_index) -{ - return NULL; -} - static int WGI_JoystickGetDevicePlayerIndex(int device_index) { @@ -886,12 +863,53 @@ WGI_JoystickQuit(void) __x_ABI_CWindows_CGaming_CInput_CIRawGameControllerStatics_remove_RawGameControllerRemoved(wgi.statics, wgi.controller_removed_token); __x_ABI_CWindows_CGaming_CInput_CIRawGameControllerStatics_Release(wgi.statics); } - - if (wgi.ro_initialized) { - WIN_RoUninitialize(); - } - SDL_zero(wgi); + + /* Don't uninitialize COM because of what appears to be a bug in Microsoft WGI reference counting. + * + * If you plug in a non-Xbox controller and let the application run for 30 seconds, then it crashes in CoUninitialize() + * with this stack trace: + + Windows.Gaming.Input.dll!GameController::~GameController(void) Unknown + Windows.Gaming.Input.dll!GameController::`vector deleting destructor'(unsigned int) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::Details::RuntimeClassImpl,1,1,0,struct Windows::Gaming::Input::IGameController,struct Windows::Gaming::Input::IGameControllerBatteryInfo,struct Microsoft::WRL::CloakedIid,class Microsoft::WRL::FtmBase>::Release(void) Unknown + Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::AggregableRuntimeClass,struct Microsoft::WRL::CloakedIid,struct Microsoft::WRL::CloakedIid,struct Microsoft::WRL::CloakedIid,class Microsoft::WRL::Details::Nil,class Microsoft::WRL::Details::Nil,class Microsoft::WRL::Details::Nil>::Release(void) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::ComPtr<`WaitForCompletion,Windows::Foundation::IAsyncOperationWithProgress>'::`2'::FTMEventDelegate>::~ComPtr<`WaitForCompletion,Windows::Foundation::IAsyncOperationWithProgress>'::`2'::FTMEventDelegate>() Unknown + Windows.Gaming.Input.dll!`eh vector destructor iterator'(void *,unsigned int,int,void (*)(void *)) Unknown + Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::GameControllerCollection::~GameControllerCollection(void) Unknown + Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::GameControllerCollection::`vector deleting destructor'(unsigned int) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::Details::RuntimeClassImpl,1,1,0,struct Windows::Foundation::Collections::IIterable,struct Windows::Foundation::Collections::IVectorView,class Microsoft::WRL::FtmBase>::Release(void) Unknown + Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::CustomGameControllerFactoryBase::~CustomGameControllerFactoryBase(void) Unknown + Windows.Gaming.Input.dll!Windows::Gaming::Input::Custom::Details::CustomGameControllerFactoryBase::`vector deleting destructor'(unsigned int) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::ActivationFactory >,struct Windows::Gaming::Input::IFlightStickStatics,class Microsoft::WRL::Details::Nil,0>::Release(void) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::ComPtr<`WaitForCompletion,Windows::Foundation::IAsyncOperationWithProgress>'::`2'::FTMEventDelegate>::~ComPtr<`WaitForCompletion,Windows::Foundation::IAsyncOperationWithProgress>'::`2'::FTMEventDelegate>() Unknown + Windows.Gaming.Input.dll!NtList::~NtList(void) Unknown + Windows.Gaming.Input.dll!FactoryManager::`vector deleting destructor'(unsigned int) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::ActivationFactory,struct Windows::Gaming::Input::Custom::IGameControllerFactoryManagerStatics2,struct Microsoft::WRL::CloakedIid,0>::Release(void) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::Details::TerminateMap(class Microsoft::WRL::Details::ModuleBase *,unsigned short const *,bool) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::Module<1,class Microsoft::WRL::Details::DefaultModule<1> >::~Module<1,class Microsoft::WRL::Details::DefaultModule<1> >(void) Unknown + Windows.Gaming.Input.dll!Microsoft::WRL::Details::DefaultModule<1>::`vector deleting destructor'(unsigned int) Unknown + Windows.Gaming.Input.dll!`dynamic atexit destructor for 'Microsoft::WRL::Details::StaticStorage,0,int>::instance_''() Unknown + Windows.Gaming.Input.dll!__CRT_INIT@12() Unknown + Windows.Gaming.Input.dll!__DllMainCRTStartup() Unknown + ntdll.dll!_LdrxCallInitRoutine@16() Unknown + ntdll.dll!LdrpCallInitRoutine() Unknown + ntdll.dll!LdrpProcessDetachNode() Unknown + ntdll.dll!LdrpUnloadNode() Unknown + ntdll.dll!LdrpDecrementModuleLoadCountEx() Unknown + ntdll.dll!LdrUnloadDll() Unknown + KernelBase.dll!FreeLibrary() Unknown + combase.dll!FreeLibraryWithLogging(LoadOrFreeWhy why, HINSTANCE__ * hMod, const wchar_t * pswzOptionalFileName) Line 193 C++ + combase.dll!CClassCache::CDllPathEntry::CFinishObject::Finish() Line 3311 C++ + combase.dll!CClassCache::CFinishComposite::Finish() Line 3421 C++ + combase.dll!CClassCache::CleanUpDllsForProcess() Line 7009 C++ + [Inline Frame] combase.dll!CCCleanUpDllsForProcess() Line 8773 C++ + combase.dll!ProcessUninitialize() Line 2243 C++ + combase.dll!DecrementProcessInitializeCount() Line 993 C++ + combase.dll!wCoUninitialize(COleTls & Tls, int fHostThread) Line 4126 C++ + combase.dll!CoUninitialize() Line 3945 C++ + */ + /* WIN_CoUninitialize(); */ } static SDL_bool @@ -906,7 +924,6 @@ SDL_JoystickDriver SDL_WGI_JoystickDriver = WGI_JoystickGetCount, WGI_JoystickDetect, WGI_JoystickGetDeviceName, - WGI_JoystickGetDevicePath, WGI_JoystickGetDevicePlayerIndex, WGI_JoystickSetDevicePlayerIndex, WGI_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/windows/SDL_windowsjoystick.c b/externals/SDL/src/joystick/windows/SDL_windowsjoystick.c index 463afd7e5..7dae16d9f 100755 --- a/externals/SDL/src/joystick/windows/SDL_windowsjoystick.c +++ b/externals/SDL/src/joystick/windows/SDL_windowsjoystick.c @@ -330,7 +330,7 @@ SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex static SDL_DeviceNotificationData s_notification_data; /* Function/thread to scan the system for joysticks. */ -static int SDLCALL +static int SDL_JoystickThread(void *_data) { #if SDL_JOYSTICK_XINPUT @@ -555,6 +555,7 @@ WINDOWS_JoystickDetect(void) } } +/* Function to get the device-dependent name of a joystick */ static const char * WINDOWS_JoystickGetDeviceName(int device_index) { @@ -567,18 +568,6 @@ WINDOWS_JoystickGetDeviceName(int device_index) return device->joystickname; } -static const char * -WINDOWS_JoystickGetDevicePath(int device_index) -{ - JoyStick_DeviceData *device = SYS_Joystick; - int index; - - for (index = device_index; index > 0; index--) - device = device->pNext; - - return device->path; -} - static int WINDOWS_JoystickGetDevicePlayerIndex(int device_index) { @@ -766,7 +755,6 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = WINDOWS_JoystickGetCount, WINDOWS_JoystickDetect, WINDOWS_JoystickGetDeviceName, - WINDOWS_JoystickGetDevicePath, WINDOWS_JoystickGetDevicePlayerIndex, WINDOWS_JoystickSetDevicePlayerIndex, WINDOWS_JoystickGetDeviceGUID, diff --git a/externals/SDL/src/joystick/windows/SDL_windowsjoystick_c.h b/externals/SDL/src/joystick/windows/SDL_windowsjoystick_c.h index d7e09abde..1b9625385 100755 --- a/externals/SDL/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/externals/SDL/src/joystick/windows/SDL_windowsjoystick_c.h @@ -37,7 +37,7 @@ typedef struct JoyStick_DeviceData BYTE SubType; Uint8 XInputUserId; DIDEVICEINSTANCE dxdevice; - char path[MAX_PATH]; + char hidPath[MAX_PATH]; struct JoyStick_DeviceData *pNext; } JoyStick_DeviceData; diff --git a/externals/SDL/src/joystick/windows/SDL_xinputjoystick.c b/externals/SDL/src/joystick/windows/SDL_xinputjoystick.c index 439957399..a8eece5d3 100755 --- a/externals/SDL/src/joystick/windows/SDL_xinputjoystick.c +++ b/externals/SDL/src/joystick/windows/SDL_xinputjoystick.c @@ -201,20 +201,9 @@ GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) * userid, but we'll record it so we'll at least be consistent * when the raw device list changes. */ - if (rdi.hid.dwVendorId == USB_VENDOR_VALVE && - rdi.hid.dwProductId == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) { - /* Steam encodes the real device in the path */ - int realVID = rdi.hid.dwVendorId; - int realPID = rdi.hid.dwProductId; - SDL_sscanf(devName, "\\\\.\\pipe\\HID#VID_045E&PID_028E&IG_00#%x&%x&", &realVID, &realPID); - *pVID = (Uint16)realVID; - *pPID = (Uint16)realPID; - *pVersion = 0; - } else { - *pVID = (Uint16)rdi.hid.dwVendorId; - *pPID = (Uint16)rdi.hid.dwProductId; - *pVersion = (Uint16)rdi.hid.dwVersionNumber; - } + *pVID = (Uint16)rdi.hid.dwVendorId; + *pPID = (Uint16)rdi.hid.dwProductId; + *pVersion = (Uint16)rdi.hid.dwVersionNumber; if (s_arrXInputDevicePath[userid]) { SDL_free(s_arrXInputDevicePath[userid]); } @@ -297,7 +286,6 @@ AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) SDL_free(pNewJoystick); return; /* better luck next time? */ } - SDL_snprintf(pNewJoystick->path, sizeof(pNewJoystick->path), "XInput#%d", userid); if (SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)) { SDL_free(pNewJoystick); diff --git a/externals/SDL/src/libm/math_private.h b/externals/SDL/src/libm/math_private.h index f560cca6a..4a30a521a 100755 --- a/externals/SDL/src/libm/math_private.h +++ b/externals/SDL/src/libm/math_private.h @@ -27,7 +27,7 @@ #define libm_hidden_def(x) #define strong_alias(x, y) -#if !defined(__HAIKU__) && !defined(__PSP__) && !defined(__PS2__) /* already defined in a system header. */ +#if !defined(__HAIKU__) && !defined(__PSP__) /* already defined in a system header. */ typedef unsigned int u_int32_t; #endif @@ -66,10 +66,9 @@ typedef unsigned int u_int32_t; * Math on arm is special: * For FPA, float words are always big-endian. * For VFP, floats words follow the memory system mode. - * For Maverick, float words are always little-endian. */ -#if (SDL_FLOATWORDORDER == SDL_BIG_ENDIAN) +#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) typedef union { diff --git a/externals/SDL/src/loadso/os2/SDL_sysloadso.c b/externals/SDL/src/loadso/os2/SDL_sysloadso.c index 2b96848ac..5e6971252 100755 --- a/externals/SDL/src/loadso/os2/SDL_sysloadso.c +++ b/externals/SDL/src/loadso/os2/SDL_sysloadso.c @@ -41,7 +41,7 @@ SDL_LoadObject(const char *sofile) PSZ pszModName; if (!sofile) { - SDL_InvalidParamError("sofile"); + SDL_SetError("NULL sofile"); return NULL; } diff --git a/externals/SDL/src/loadso/windows/SDL_sysloadso.c b/externals/SDL/src/loadso/windows/SDL_sysloadso.c index d3c84042b..7e5730a89 100755 --- a/externals/SDL/src/loadso/windows/SDL_sysloadso.c +++ b/externals/SDL/src/loadso/windows/SDL_sysloadso.c @@ -36,7 +36,7 @@ SDL_LoadObject(const char *sofile) LPTSTR tstr; if (!sofile) { - SDL_InvalidParamError("sofile"); + SDL_SetError("NULL sofile"); return NULL; } tstr = WIN_UTF8ToString(sofile); diff --git a/externals/SDL/src/main/haiku/SDL_BApp.h b/externals/SDL/src/main/haiku/SDL_BApp.h index 215f83662..56b1fa0d6 100755 --- a/externals/SDL/src/main/haiku/SDL_BApp.h +++ b/externals/SDL/src/main/haiku/SDL_BApp.h @@ -21,7 +21,6 @@ #ifndef SDL_BAPP_H #define SDL_BAPP_H -#include #include #include #if SDL_VIDEO_OPENGL @@ -94,15 +93,6 @@ public: } - virtual void RefsReceived(BMessage* message) { - char filePath[512]; - entry_ref entryRef; - for (int32 i = 0; message->FindRef("refs", i, &entryRef) == B_OK; i++) { - BPath referencePath = BPath(&entryRef); - SDL_SendDropFile(NULL, referencePath.Path()); - } - return; - } /* Event-handling functions */ virtual void MessageReceived(BMessage* message) { @@ -208,10 +198,6 @@ public: } #if SDL_VIDEO_OPENGL - BGLView *GetCurrentContext() { - return _current_context; - } - void SetCurrentContext(BGLView *newContext) { if(_current_context) _current_context->UnlockGL(); @@ -248,22 +234,25 @@ private: } win = GetSDLWindow(winID); - // Simple relative mode support for mouse. - if (SDL_GetMouse()->relative_mode) { - int winWidth, winHeight, winPosX, winPosY; - SDL_GetWindowSize(win, &winWidth, &winHeight); - SDL_GetWindowPosition(win, &winPosX, &winPosY); - int dx = x - (winWidth / 2); - int dy = y - (winHeight / 2); - SDL_SendMouseMotion(win, 0, SDL_GetMouse()->relative_mode, dx, dy); - set_mouse_position((winPosX + winWidth / 2), (winPosY + winHeight / 2)); - if (!be_app->IsCursorHidden()) - be_app->HideCursor(); - } else { - SDL_SendMouseMotion(win, 0, 0, x, y); - if (SDL_ShowCursor(-1) && be_app->IsCursorHidden()) - be_app->ShowCursor(); - } + // Simple relative mode support for mouse. + if (SDL_GetMouse()->relative_mode) { + int winWidth, winHeight, winPosX, winPosY; + SDL_GetWindowSize(win, &winWidth, &winHeight); + SDL_GetWindowPosition(win, &winPosX, &winPosY); + int dx = x - (winWidth / 2); + int dy = y - (winHeight / 2); + SDL_SendMouseMotion(win, 0, SDL_GetMouse()->relative_mode, dx, dy); + set_mouse_position((winPosX + winWidth / 2), (winPosY + winHeight / 2)); + if (!be_app->IsCursorHidden()) + be_app->HideCursor(); + } else { + SDL_SendMouseMotion(win, 0, 0, x, y); + if (SDL_ShowCursor(-1) && be_app->IsCursorHidden()) + be_app->ShowCursor(); + } + + /* Tell the application that the mouse passed over, redraw needed */ + HAIKU_UpdateWindowFramebuffer(NULL,win,NULL,-1); } void _HandleMouseButton(BMessage *msg) { @@ -311,7 +300,7 @@ private: } HAIKU_SetKeyState(scancode, state); SDL_SendKeyboardKey(state, HAIKU_GetScancodeFromBeKey(scancode)); - + if (state == SDL_PRESSED && SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { const int8 *keyUtf8; ssize_t count; diff --git a/externals/SDL/src/main/uikit/SDL_uikit_main.c b/externals/SDL/src/main/uikit/SDL_uikit_main.c index 62cfffd5c..702f67391 100755 --- a/externals/SDL/src/main/uikit/SDL_uikit_main.c +++ b/externals/SDL/src/main/uikit/SDL_uikit_main.c @@ -1,6 +1,7 @@ /* SDL_uikit_main.c, placed in the public domain by Sam Lantinga 3/18/2019 */ +#include "../../SDL_internal.h" /* Include the SDL main definition header */ #include "SDL_main.h" diff --git a/externals/SDL/src/main/windows/SDL_windows_main.c b/externals/SDL/src/main/windows/SDL_windows_main.c index 70fb9b9b7..056787e40 100755 --- a/externals/SDL/src/main/windows/SDL_windows_main.c +++ b/externals/SDL/src/main/windows/SDL_windows_main.c @@ -70,7 +70,7 @@ main_getcmdline(void) if (!argv[i]) { return OutOfMemory(); } - SDL_memcpy(argv[i], arg, len); + CopyMemory(argv[i], arg, len); SDL_free(arg); } argv[i] = NULL; diff --git a/externals/SDL/src/main/windows/version.rc b/externals/SDL/src/main/windows/version.rc index 5f56a2cff..eef3d5b9d 100755 --- a/externals/SDL/src/main/windows/version.rc +++ b/externals/SDL/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,23,1,0 - PRODUCTVERSION 2,23,1,0 + FILEVERSION 2,0,20,0 + PRODUCTVERSION 2,0,20,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 23, 1, 0\0" + VALUE "FileVersion", "2, 0, 20, 0\0" VALUE "InternalName", "SDL\0" VALUE "LegalCopyright", "Copyright (C) 2022 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 23, 1, 0\0" + VALUE "ProductVersion", "2, 0, 20, 0\0" END END BLOCK "VarFileInfo" diff --git a/externals/SDL/src/misc/winrt/SDL_sysurl.cpp b/externals/SDL/src/misc/winrt/SDL_sysurl.cpp index 111a14413..c83cc8513 100755 --- a/externals/SDL/src/misc/winrt/SDL_sysurl.cpp +++ b/externals/SDL/src/misc/winrt/SDL_sysurl.cpp @@ -18,9 +18,10 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ +#include -#include "../SDL_sysurl.h" #include "../../core/windows/SDL_windows.h" +#include "../SDL_sysurl.h" int SDL_SYS_OpenURL(const char *url) diff --git a/externals/SDL/src/power/linux/SDL_syspower.c b/externals/SDL/src/power/linux/SDL_syspower.c index f4e1ecc3d..3b9ab1ba9 100755 --- a/externals/SDL/src/power/linux/SDL_syspower.c +++ b/externals/SDL/src/power/linux/SDL_syspower.c @@ -561,30 +561,20 @@ check_upower_device(DBusConnection *conn, const char *path, SDL_PowerState *stat return; } else if (!ui32) { return; /* we don't care about random devices with batteries, like wireless controllers, etc */ - } - - if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "IsPresent", DBUS_TYPE_BOOLEAN, &ui32)) { + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "IsPresent", DBUS_TYPE_BOOLEAN, &ui32)) { return; - } - if (!ui32) { + } else if (!ui32) { st = SDL_POWERSTATE_NO_BATTERY; + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "State", DBUS_TYPE_UINT32, &ui32)) { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } else if (ui32 == 1) { /* 1 == charging */ + st = SDL_POWERSTATE_CHARGING; + } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */ + st = SDL_POWERSTATE_ON_BATTERY; + } else if (ui32 == 4) { /* 4 == full */ + st = SDL_POWERSTATE_CHARGED; } else { - /* Get updated information on the battery status - * This can occasionally fail, and we'll just return slightly stale data in that case - */ - SDL_DBus_CallMethodOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Refresh", DBUS_TYPE_INVALID, DBUS_TYPE_INVALID); - - if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "State", DBUS_TYPE_UINT32, &ui32)) { - st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ - } else if (ui32 == 1) { /* 1 == charging */ - st = SDL_POWERSTATE_CHARGING; - } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */ - st = SDL_POWERSTATE_ON_BATTERY; - } else if (ui32 == 4) { /* 4 == full */ - st = SDL_POWERSTATE_CHARGED; - } else { - st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ - } + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ } if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Percentage", DBUS_TYPE_DOUBLE, &d)) { diff --git a/externals/SDL/src/render/SDL_d3dmath.c b/externals/SDL/src/render/SDL_d3dmath.c index fb7de371f..63048bb88 100755 --- a/externals/SDL/src/render/SDL_d3dmath.c +++ b/externals/SDL/src/render/SDL_d3dmath.c @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED #include "SDL_stdinc.h" #include "SDL_d3dmath.h" @@ -131,6 +131,6 @@ Float4X4 MatrixRotationZ(float r) } -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/render/SDL_d3dmath.h b/externals/SDL/src/render/SDL_d3dmath.h index 211bfdd5a..7b74cfe75 100755 --- a/externals/SDL/src/render/SDL_d3dmath.h +++ b/externals/SDL/src/render/SDL_d3dmath.h @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED /* Direct3D matrix math functions */ @@ -67,6 +67,6 @@ Float4X4 MatrixRotationX(float r); Float4X4 MatrixRotationY(float r); Float4X4 MatrixRotationZ(float r); -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/render/SDL_render.c b/externals/SDL/src/render/SDL_render.c index 7d9d97eef..03c2691d2 100755 --- a/externals/SDL/src/render/SDL_render.c +++ b/externals/SDL/src/render/SDL_render.c @@ -48,13 +48,13 @@ this should probably be removed at some point in the future. --ryan. */ #define CHECK_RENDERER_MAGIC(renderer, retval) \ if (!renderer || renderer->magic != &renderer_magic) { \ - SDL_InvalidParamError("renderer"); \ + SDL_SetError("Invalid renderer"); \ return retval; \ } #define CHECK_TEXTURE_MAGIC(texture, retval) \ if (!texture || texture->magic != &texture_magic) { \ - SDL_InvalidParamError("texture"); \ + SDL_SetError("Invalid texture"); \ return retval; \ } @@ -96,9 +96,6 @@ static const SDL_RenderDriver *render_drivers[] = { #if SDL_VIDEO_RENDER_D3D11 &D3D11_RenderDriver, #endif -#if SDL_VIDEO_RENDER_D3D12 - &D3D12_RenderDriver, -#endif #if SDL_VIDEO_RENDER_METAL &METAL_RenderDriver, #endif @@ -353,13 +350,13 @@ static int QueueCmdSetViewport(SDL_Renderer *renderer) { int retval = 0; - if (!renderer->viewport_queued || (SDL_memcmp(&renderer->viewport, &renderer->last_queued_viewport, sizeof (SDL_DRect)) != 0)) { + if (!renderer->viewport_queued || (SDL_memcmp(&renderer->viewport, &renderer->last_queued_viewport, sizeof (SDL_Rect)) != 0)) { SDL_RenderCommand *cmd = AllocateRenderCommand(renderer); retval = -1; if (cmd != NULL) { cmd->command = SDL_RENDERCMD_SETVIEWPORT; cmd->data.viewport.first = 0; /* render backend will fill this in. */ - /* Convert SDL_DRect to SDL_Rect */ + /* Convert SDL_FRect to SDL_Rect */ cmd->data.viewport.rect.x = (int)SDL_floor(renderer->viewport.x); cmd->data.viewport.rect.y = (int)SDL_floor(renderer->viewport.y); cmd->data.viewport.rect.w = (int)SDL_floor(renderer->viewport.w); @@ -368,7 +365,7 @@ QueueCmdSetViewport(SDL_Renderer *renderer) if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; } else { - SDL_memcpy(&renderer->last_queued_viewport, &renderer->viewport, sizeof (SDL_DRect)); + SDL_memcpy(&renderer->last_queued_viewport, &renderer->viewport, sizeof (SDL_Rect)); renderer->viewport_queued = SDL_TRUE; } } @@ -382,19 +379,19 @@ QueueCmdSetClipRect(SDL_Renderer *renderer) int retval = 0; if ((!renderer->cliprect_queued) || (renderer->clipping_enabled != renderer->last_queued_cliprect_enabled) || - (SDL_memcmp(&renderer->clip_rect, &renderer->last_queued_cliprect, sizeof (SDL_DRect)) != 0)) { + (SDL_memcmp(&renderer->clip_rect, &renderer->last_queued_cliprect, sizeof (SDL_Rect)) != 0)) { SDL_RenderCommand *cmd = AllocateRenderCommand(renderer); if (cmd == NULL) { retval = -1; } else { cmd->command = SDL_RENDERCMD_SETCLIPRECT; cmd->data.cliprect.enabled = renderer->clipping_enabled; - /* Convert SDL_DRect to SDL_Rect */ + /* Convert SDL_FRect to SDL_Rect */ cmd->data.cliprect.rect.x = (int)SDL_floor(renderer->clip_rect.x); cmd->data.cliprect.rect.y = (int)SDL_floor(renderer->clip_rect.y); cmd->data.cliprect.rect.w = (int)SDL_floor(renderer->clip_rect.w); cmd->data.cliprect.rect.h = (int)SDL_floor(renderer->clip_rect.h); - SDL_memcpy(&renderer->last_queued_cliprect, &renderer->clip_rect, sizeof (SDL_DRect)); + SDL_memcpy(&renderer->last_queued_cliprect, &renderer->clip_rect, sizeof (SDL_Rect)); renderer->last_queued_cliprect_enabled = renderer->clipping_enabled; renderer->cliprect_queued = SDL_TRUE; } @@ -583,10 +580,10 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; } + + SDL_small_free(xy, isstack1); + SDL_small_free(indices, isstack2); } - SDL_small_free(xy, isstack1); - SDL_small_free(indices, isstack2); - } else { retval = renderer->QueueFillRects(renderer, cmd, rects, count); if (retval < 0) { @@ -614,12 +611,12 @@ QueueCmdCopy(SDL_Renderer *renderer, SDL_Texture * texture, const SDL_Rect * src static int QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture * texture, const SDL_Rect * srcquad, const SDL_FRect * dstrect, - const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y) + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) { SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_COPY_EX, texture); int retval = -1; if (cmd != NULL) { - retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip, scale_x, scale_y); + retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip); if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; } @@ -679,7 +676,7 @@ SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info) #endif } -static void GetWindowViewportValues(SDL_Renderer *renderer, int *logical_w, int *logical_h, SDL_DRect *viewport, SDL_FPoint *scale) +static void GetWindowViewportValues(SDL_Renderer *renderer, int *logical_w, int *logical_h, SDL_FRect *viewport, SDL_FPoint *scale) { SDL_LockMutex(renderer->target_mutex); *logical_w = renderer->target ? renderer->logical_w_backup : renderer->logical_w; @@ -701,17 +698,7 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) renderer->WindowEvent(renderer, &event->window); } - /* In addition to size changes, we also want to do this block for - * moves as well, for two reasons: - * - * 1. The window could be moved to a new display, which has a new - * DPI and therefore a new window/drawable ratio - * 2. For whatever reason, the viewport can get messed up during - * window movement (this has been observed on macOS), so this is - * also a good opportunity to force viewport updates - */ - if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED || - event->window.event == SDL_WINDOWEVENT_MOVED) { + if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { /* Make sure we're operating on the default render target */ SDL_Texture *saved_target = SDL_GetRenderTarget(renderer); if (saved_target) { @@ -741,12 +728,19 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) SDL_GetWindowSize(renderer->window, &w, &h); } - renderer->viewport.x = (double)0; - renderer->viewport.y = (double)0; - renderer->viewport.w = (double)w; - renderer->viewport.h = (double)h; - QueueCmdSetViewport(renderer); - FlushRenderCommandsIfNotBatching(renderer); + if (renderer->target) { + renderer->viewport_backup.x = 0; + renderer->viewport_backup.y = 0; + renderer->viewport_backup.w = (float) w; + renderer->viewport_backup.h = (float) h; + } else { + renderer->viewport.x = 0; + renderer->viewport.y = 0; + renderer->viewport.w = (float) w; + renderer->viewport.h = (float) h; + QueueCmdSetViewport(renderer); + FlushRenderCommandsIfNotBatching(renderer); + } } if (saved_target) { @@ -771,7 +765,7 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID); if (window == renderer->window) { int logical_w, logical_h; - SDL_DRect viewport; + SDL_FRect viewport; SDL_FPoint scale; GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); if (logical_w) { @@ -798,7 +792,7 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) SDL_Window *window = SDL_GetWindowFromID(event->button.windowID); if (window == renderer->window) { int logical_w, logical_h; - SDL_DRect viewport; + SDL_FRect viewport; SDL_FPoint scale; GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); if (logical_w) { @@ -813,7 +807,7 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) event->type == SDL_FINGERMOTION) { int logical_w, logical_h; float physical_w, physical_h; - SDL_DRect viewport; + SDL_FRect viewport; SDL_FPoint scale; GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); @@ -936,7 +930,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) #endif if (!window) { - SDL_InvalidParamError("window"); + SDL_SetError("Invalid window"); goto error; } @@ -985,24 +979,24 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) } } } - if (!renderer) { + if (index == n) { SDL_SetError("Couldn't find matching render driver"); goto error; } } else { - if (index >= n) { + if (index >= SDL_GetNumRenderDrivers()) { SDL_SetError("index must be -1 or in the range of 0 - %d", - n - 1); + SDL_GetNumRenderDrivers() - 1); goto error; } /* Create a new renderer instance */ renderer = render_drivers[index]->CreateRenderer(window, flags); batching = SDL_FALSE; - if (!renderer) { - goto error; - } } + if (!renderer) { + goto error; + } VerifyDrawQueueFunctions(renderer); @@ -1108,13 +1102,6 @@ SDL_GetRenderer(SDL_Window * window) return (SDL_Renderer *)SDL_GetWindowData(window, SDL_WINDOWRENDERDATA); } -SDL_Window * -SDL_RenderGetWindow(SDL_Renderer *renderer) -{ - CHECK_RENDERER_MAGIC(renderer, NULL); - return renderer->window; -} - int SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info) { @@ -1339,7 +1326,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface) CHECK_RENDERER_MAGIC(renderer, NULL); if (!surface) { - SDL_InvalidParamError("SDL_CreateTextureFromSurface(): surface"); + SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface"); return NULL; } @@ -1605,11 +1592,10 @@ SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode) CHECK_TEXTURE_MAGIC(texture, -1); renderer = texture->renderer; + renderer->SetTextureScaleMode(renderer, texture, scaleMode); texture->scaleMode = scaleMode; if (texture->native) { return SDL_SetTextureScaleMode(texture->native, scaleMode); - } else { - renderer->SetTextureScaleMode(renderer, texture, scaleMode); } return 0; } @@ -2231,10 +2217,10 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) } if (texture) { - renderer->viewport.x = (double)0; - renderer->viewport.y = (double)0; - renderer->viewport.w = (double)texture->w; - renderer->viewport.h = (double)texture->h; + renderer->viewport.x = 0.0f; + renderer->viewport.y = 0.0f; + renderer->viewport.w = (float) texture->w; + renderer->viewport.h = (float) texture->h; SDL_zero(renderer->clip_rect); renderer->clipping_enabled = SDL_FALSE; renderer->scale.x = 1.0f; @@ -2266,8 +2252,6 @@ SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer) { - CHECK_RENDERER_MAGIC(renderer, NULL); - return renderer->target; } @@ -2443,19 +2427,19 @@ SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect) CHECK_RENDERER_MAGIC(renderer, -1); if (rect) { - renderer->viewport.x = (double)rect->x * renderer->scale.x; - renderer->viewport.y = (double)rect->y * renderer->scale.y; - renderer->viewport.w = (double)rect->w * renderer->scale.x; - renderer->viewport.h = (double)rect->h * renderer->scale.y; + renderer->viewport.x = rect->x * renderer->scale.x; + renderer->viewport.y = rect->y * renderer->scale.y; + renderer->viewport.w = rect->w * renderer->scale.x; + renderer->viewport.h = rect->h * renderer->scale.y; } else { int w, h; if (SDL_GetRendererOutputSize(renderer, &w, &h) < 0) { return -1; } - renderer->viewport.x = (double)0; - renderer->viewport.y = (double)0; - renderer->viewport.w = (double)w; - renderer->viewport.h = (double)h; + renderer->viewport.x = 0.0f; + renderer->viewport.y = 0.0f; + renderer->viewport.w = (float) w; + renderer->viewport.h = (float) h; } retval = QueueCmdSetViewport(renderer); return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer); @@ -2479,8 +2463,8 @@ RenderGetViewportSize(SDL_Renderer * renderer, SDL_FRect * rect) { rect->x = 0.0f; rect->y = 0.0f; - rect->w = (float)(renderer->viewport.w / renderer->scale.x); - rect->h = (float)(renderer->viewport.h / renderer->scale.y); + rect->w = renderer->viewport.w / renderer->scale.x; + rect->h = renderer->viewport.h / renderer->scale.y; } int @@ -2491,10 +2475,10 @@ SDL_RenderSetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect) if (rect) { renderer->clipping_enabled = SDL_TRUE; - renderer->clip_rect.x = (double)rect->x * renderer->scale.x; - renderer->clip_rect.y = (double)rect->y * renderer->scale.y; - renderer->clip_rect.w = (double)rect->w * renderer->scale.x; - renderer->clip_rect.h = (double)rect->h * renderer->scale.y; + renderer->clip_rect.x = rect->x * renderer->scale.x; + renderer->clip_rect.y = rect->y * renderer->scale.y; + renderer->clip_rect.w = rect->w * renderer->scale.x; + renderer->clip_rect.h = rect->h * renderer->scale.y; } else { renderer->clipping_enabled = SDL_FALSE; SDL_zero(renderer->clip_rect); @@ -2558,10 +2542,10 @@ SDL_RenderWindowToLogical(SDL_Renderer * renderer, int windowX, int windowY, flo window_physical_y = ((float) windowY) / renderer->dpi_scale.y; if (logicalX) { - *logicalX = (float)((window_physical_x - renderer->viewport.x) / renderer->scale.x); + *logicalX = (window_physical_x - renderer->viewport.x) / renderer->scale.x; } if (logicalY) { - *logicalY = (float)((window_physical_y - renderer->viewport.y) / renderer->scale.y); + *logicalY = (window_physical_y - renderer->viewport.y) / renderer->scale.y; } } @@ -2572,8 +2556,8 @@ SDL_RenderLogicalToWindow(SDL_Renderer * renderer, float logicalX, float logical CHECK_RENDERER_MAGIC(renderer, ); - window_physical_x = (float)((logicalX * renderer->scale.x) + renderer->viewport.x); - window_physical_y = (float)((logicalY * renderer->scale.y) + renderer->viewport.y); + window_physical_x = (logicalX * renderer->scale.x) + renderer->viewport.x; + window_physical_y = (logicalY * renderer->scale.y) + renderer->viewport.y; if (windowX) { *windowX = (int)(window_physical_x * renderer->dpi_scale.x); @@ -2673,16 +2657,11 @@ static int RenderDrawPointsWithRects(SDL_Renderer * renderer, const SDL_Point * points, const int count) { - int retval; + int retval = -1; SDL_bool isstack; - SDL_FRect *frects; + SDL_FRect *frects = SDL_small_alloc(SDL_FRect, count, &isstack); int i; - if (count < 1) { - return 0; - } - - frects = SDL_small_alloc(SDL_FRect, count, &isstack); if (!frects) { return SDL_OutOfMemory(); } @@ -2694,7 +2673,9 @@ RenderDrawPointsWithRects(SDL_Renderer * renderer, frects[i].h = renderer->scale.y; } - retval = QueueCmdFillRects(renderer, frects, count); + if (count) { + retval = QueueCmdFillRects(renderer, frects, count); + } SDL_small_free(frects, isstack); @@ -2713,7 +2694,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - return SDL_InvalidParamError("SDL_RenderDrawPoints(): points"); + return SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points"); } if (count < 1) { return 0; @@ -2749,16 +2730,11 @@ static int RenderDrawPointsWithRectsF(SDL_Renderer * renderer, const SDL_FPoint * fpoints, const int count) { - int retval; + int retval = -1; SDL_bool isstack; - SDL_FRect *frects; + SDL_FRect *frects = SDL_small_alloc(SDL_FRect, count, &isstack); int i; - if (count < 1) { - return 0; - } - - frects = SDL_small_alloc(SDL_FRect, count, &isstack); if (!frects) { return SDL_OutOfMemory(); } @@ -2770,7 +2746,9 @@ RenderDrawPointsWithRectsF(SDL_Renderer * renderer, frects[i].h = renderer->scale.y; } - retval = QueueCmdFillRects(renderer, frects, count); + if (count) { + retval = QueueCmdFillRects(renderer, frects, count); + } SDL_small_free(frects, isstack); @@ -2786,7 +2764,7 @@ SDL_RenderDrawPointsF(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - return SDL_InvalidParamError("SDL_RenderDrawPointsF(): points"); + return SDL_SetError("SDL_RenderDrawPointsF(): Passed NULL points"); } if (count < 1) { return 0; @@ -2995,7 +2973,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - return SDL_InvalidParamError("SDL_RenderDrawLines(): points"); + return SDL_SetError("SDL_RenderDrawLines(): Passed NULL points"); } if (count < 2) { return 0; @@ -3034,7 +3012,7 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!points) { - return SDL_InvalidParamError("SDL_RenderDrawLinesF(): points"); + return SDL_SetError("SDL_RenderDrawLinesF(): Passed NULL points"); } if (count < 2) { return 0; @@ -3167,11 +3145,10 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer, num_vertices, indices, num_indices, size_indices, 1.0f, 1.0f); + SDL_small_free(xy, isstack1); + SDL_small_free(indices, isstack2); } - SDL_small_free(xy, isstack1); - SDL_small_free(indices, isstack2); - } else if (renderer->scale.x != 1.0f || renderer->scale.y != 1.0f) { retval = RenderDrawLinesWithRectsF(renderer, points, count); } else { @@ -3234,7 +3211,7 @@ SDL_RenderDrawRects(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - return SDL_InvalidParamError("SDL_RenderDrawRects(): rects"); + return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects"); } if (count < 1) { return 0; @@ -3264,7 +3241,7 @@ SDL_RenderDrawRectsF(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - return SDL_InvalidParamError("SDL_RenderDrawRectsF(): rects"); + return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects"); } if (count < 1) { return 0; @@ -3331,7 +3308,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - return SDL_InvalidParamError("SDL_RenderFillRects(): rects"); + return SDL_SetError("SDL_RenderFillRects(): Passed NULL rects"); } if (count < 1) { return 0; @@ -3374,7 +3351,7 @@ SDL_RenderFillRectsF(SDL_Renderer * renderer, CHECK_RENDERER_MAGIC(renderer, -1); if (!rects) { - return SDL_InvalidParamError("SDL_RenderFillRectsF(): rects"); + return SDL_SetError("SDL_RenderFillFRects(): Passed NULL rects"); } if (count < 1) { return 0; @@ -3405,6 +3382,60 @@ SDL_RenderFillRectsF(SDL_Renderer * renderer, return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer); } +/* !!! FIXME: move this to a public API if we want to do float versions of all of these later */ +SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r) +{ + return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE; +} + +/* !!! FIXME: move this to a public API if we want to do float versions of all of these later */ +static SDL_bool +SDL_HasIntersectionF(const SDL_FRect * A, const SDL_FRect * B) +{ + float Amin, Amax, Bmin, Bmax; + + if (!A) { + SDL_InvalidParamError("A"); + return SDL_FALSE; + } + + if (!B) { + SDL_InvalidParamError("B"); + return SDL_FALSE; + } + + /* Special cases for empty rects */ + if (SDL_FRectEmpty(A) || SDL_FRectEmpty(B)) { + return SDL_FALSE; + } + + /* Horizontal intersection */ + Amin = A->x; + Amax = Amin + A->w; + Bmin = B->x; + Bmax = Bmin + B->w; + if (Bmin > Amin) + Amin = Bmin; + if (Bmax < Amax) + Amax = Bmax; + if (Amax <= Amin) + return SDL_FALSE; + + /* Vertical intersection */ + Amin = A->y; + Amax = Amin + A->h; + Bmin = B->y; + Bmax = Bmin + B->h; + if (Bmin > Amin) + Amin = Bmin; + if (Bmax < Amax) + Amax = Bmax; + if (Amax <= Amin) + return SDL_FALSE; + + return SDL_TRUE; +} + int SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect) @@ -3703,7 +3734,15 @@ SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, renderer->scale.x, renderer->scale.y); } else { - retval = QueueCmdCopyEx(renderer, texture, &real_srcrect, &real_dstrect, angle, &real_center, flip, renderer->scale.x, renderer->scale.y); + real_dstrect.x *= renderer->scale.x; + real_dstrect.y *= renderer->scale.y; + real_dstrect.w *= renderer->scale.x; + real_dstrect.h *= renderer->scale.y; + + real_center.x *= renderer->scale.x; + real_center.y *= renderer->scale.y; + + retval = QueueCmdCopyEx(renderer, texture, &real_srcrect, &real_dstrect, angle, &real_center, flip); } return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer); } @@ -4007,23 +4046,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer, if (texture && s.w != 0 && s.h != 0) { SDL_SetTextureAlphaMod(texture, col0_.a); SDL_SetTextureColorMod(texture, col0_.r, col0_.g, col0_.b); - if (s.w > 0 && s.h > 0) { - SDL_RenderCopyF(renderer, texture, &s, &d); - } else { - int flags = 0; - if (s.w < 0) { - flags |= SDL_FLIP_HORIZONTAL; - s.w *= -1; - s.x -= s.w; - } - if (s.h < 0) { - flags |= SDL_FLIP_VERTICAL; - s.h *= -1; - s.y -= s.h; - } - SDL_RenderCopyExF(renderer, texture, &s, &d, 0, NULL, flags); - } - + SDL_RenderCopyF(renderer, texture, &s, &d); #if DEBUG_SW_RENDER_GEOMETRY SDL_Log("Rect-COPY: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a, (void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h); @@ -4033,8 +4056,8 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer, SDL_SetRenderDrawColor(renderer, col0_.r, col0_.g, col0_.b, col0_.a); SDL_RenderFillRectF(renderer, &d); #if DEBUG_SW_RENDER_GEOMETRY - SDL_Log("Rect-FILL: RGB %d %d %d - Alpha:%d - texture=%p: dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a, - (void *)texture, d.x, d.y, d.w, d.h); + SDL_Log("Rect-FILL: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a, + (void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h); } else { SDL_Log("Rect-DISMISS: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a, (void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h); @@ -4216,11 +4239,7 @@ SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, FlushRenderCommands(renderer); /* we need to render before we read the results. */ if (!format) { - if (renderer->target == NULL) { - format = SDL_GetWindowPixelFormat(renderer->window); - } else { - format = renderer->target->format; - } + format = SDL_GetWindowPixelFormat(renderer->window); } real_rect.x = (int)SDL_floor(renderer->viewport.x); diff --git a/externals/SDL/src/render/SDL_sysrender.h b/externals/SDL/src/render/SDL_sysrender.h index 481ae91bf..ff38ed0dd 100755 --- a/externals/SDL/src/render/SDL_sysrender.h +++ b/externals/SDL/src/render/SDL_sysrender.h @@ -28,19 +28,6 @@ #include "SDL_mutex.h" #include "SDL_yuv_sw_c.h" - -/** - * A rectangle, with the origin at the upper left (double precision). - */ -typedef struct SDL_DRect -{ - double x; - double y; - double w; - double h; -} SDL_DRect; - - /* The SDL 2D rendering system */ typedef struct SDL_RenderDriver SDL_RenderDriver; @@ -156,7 +143,7 @@ struct SDL_Renderer const SDL_Rect * srcrect, const SDL_FRect * dstrect); int (*QueueCopyEx) (SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture, const SDL_Rect * srcquad, const SDL_FRect * dstrect, - const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y); + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip); int (*QueueGeometry) (SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices, @@ -214,12 +201,12 @@ struct SDL_Renderer SDL_bool integer_scale; /* The drawable area within the window */ - SDL_DRect viewport; - SDL_DRect viewport_backup; + SDL_FRect viewport; + SDL_FRect viewport_backup; /* The clip rectangle within the window */ - SDL_DRect clip_rect; - SDL_DRect clip_rect_backup; + SDL_FRect clip_rect; + SDL_FRect clip_rect_backup; /* Wether or not the clipping rectangle is used. */ SDL_bool clipping_enabled; @@ -257,8 +244,8 @@ struct SDL_Renderer SDL_RenderCommand *render_commands_pool; Uint32 render_command_generation; Uint32 last_queued_color; - SDL_DRect last_queued_viewport; - SDL_DRect last_queued_cliprect; + SDL_FRect last_queued_viewport; + SDL_FRect last_queued_cliprect; SDL_bool last_queued_cliprect_enabled; SDL_bool color_queued; SDL_bool viewport_queued; @@ -283,7 +270,6 @@ struct SDL_RenderDriver /* Not all of these are available in a given build. Use #ifdefs, etc. */ extern SDL_RenderDriver D3D_RenderDriver; extern SDL_RenderDriver D3D11_RenderDriver; -extern SDL_RenderDriver D3D12_RenderDriver; extern SDL_RenderDriver GL_RenderDriver; extern SDL_RenderDriver GLES2_RenderDriver; extern SDL_RenderDriver GLES_RenderDriver; diff --git a/externals/SDL/src/render/direct3d/SDL_render_d3d.c b/externals/SDL/src/render/direct3d/SDL_render_d3d.c index 2708d2d00..deb324c7d 100755 --- a/externals/SDL/src/render/direct3d/SDL_render_d3d.c +++ b/externals/SDL/src/render/direct3d/SDL_render_d3d.c @@ -41,13 +41,6 @@ #include "SDL_shaders_d3d.h" -#ifdef __WATCOMC__ -/* FIXME: Remove this once https://github.com/open-watcom/open-watcom-v2/pull/868 is merged */ -#define D3DBLENDOP_REVSUBTRACT 3 -/* FIXME: Remove this once https://github.com/open-watcom/open-watcom-v2/pull/869 is merged */ -#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT( 2073 ) -#endif - typedef struct { SDL_Rect viewport; @@ -78,9 +71,7 @@ typedef struct IDirect3DSurface9 *defaultRenderTarget; IDirect3DSurface9 *currentRenderTarget; void* d3dxDLL; -#if SDL_HAVE_YUV LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS]; -#endif LPDIRECT3DVERTEXBUFFER9 vertexBuffers[8]; size_t vertexBufferSize[8]; int currentVertexBuffer; @@ -104,7 +95,6 @@ typedef struct D3D_TextureRep texture; D3DTEXTUREFILTERTYPE scaleMode; -#if SDL_HAVE_YUV /* YV12 texture support */ SDL_bool yuv; D3D_TextureRep utexture; @@ -112,7 +102,6 @@ typedef struct Uint8 *pixels; int pitch; SDL_Rect locked_rect; -#endif } D3D_TextureData; typedef struct @@ -308,7 +297,7 @@ D3D_ActivateRenderer(SDL_Renderer * renderer) int w, h; Uint32 window_flags = SDL_GetWindowFlags(window); - WIN_GetDrawableSize(window, &w, &h); + SDL_GetWindowSize(window, &w, &h); data->pparams.BackBufferWidth = w; data->pparams.BackBufferHeight = h; if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { @@ -354,15 +343,7 @@ D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -static int -D3D_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) -{ - WIN_GetDrawableSize(renderer->window, w, h); - return 0; -} - -static D3DBLEND -GetBlendFunc(SDL_BlendFactor factor) +static D3DBLEND GetBlendFunc(SDL_BlendFactor factor) { switch (factor) { case SDL_BLENDFACTOR_ZERO: @@ -385,28 +366,9 @@ GetBlendFunc(SDL_BlendFactor factor) return D3DBLEND_DESTALPHA; case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: return D3DBLEND_INVDESTALPHA; - default: break; + default: + return (D3DBLEND)0; } - return (D3DBLEND) 0; -} - -static D3DBLENDOP -GetBlendEquation(SDL_BlendOperation operation) -{ - switch (operation) { - case SDL_BLENDOPERATION_ADD: - return D3DBLENDOP_ADD; - case SDL_BLENDOPERATION_SUBTRACT: - return D3DBLENDOP_SUBTRACT; - case SDL_BLENDOPERATION_REV_SUBTRACT: - return D3DBLENDOP_REVSUBTRACT; - case SDL_BLENDOPERATION_MINIMUM: - return D3DBLENDOP_MIN; - case SDL_BLENDOPERATION_MAXIMUM: - return D3DBLENDOP_MAX; - default: break; - } - return (D3DBLENDOP) 0; } static SDL_bool @@ -421,16 +383,14 @@ D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || - !GetBlendEquation(colorOperation) || - !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor) || - !GetBlendEquation(alphaOperation)) { + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor)) { return SDL_FALSE; } - - if (!data->enableSeparateAlphaBlend) { - if ((srcColorFactor != srcAlphaFactor) || (dstColorFactor != dstAlphaFactor) || (colorOperation != alphaOperation)) { - return SDL_FALSE; - } + if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->enableSeparateAlphaBlend) { + return SDL_FALSE; + } + if (colorOperation != SDL_BLENDOPERATION_ADD || alphaOperation != SDL_BLENDOPERATION_ADD) { + return SDL_FALSE; } return SDL_TRUE; } @@ -574,7 +534,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) { return -1; } -#if SDL_HAVE_YUV + if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { texturedata->yuv = SDL_TRUE; @@ -587,7 +547,6 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) return -1; } } -#endif return 0; } @@ -604,7 +563,7 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) { return -1; } -#if SDL_HAVE_YUV + if (texturedata->yuv) { if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) { return -1; @@ -614,7 +573,6 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) return -1; } } -#endif return 0; } @@ -626,13 +584,14 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata; if (!texturedata) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { return -1; } -#if SDL_HAVE_YUV + if (texturedata->yuv) { /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); @@ -647,7 +606,6 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } } -#endif return 0; } @@ -663,7 +621,8 @@ D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata; if (!texturedata) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { @@ -688,9 +647,10 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, IDirect3DDevice9 *device = data->device; if (!texturedata) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } -#if SDL_HAVE_YUV + texturedata->locked_rect = *rect; if (texturedata->yuv) { @@ -706,9 +666,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, (void *) ((Uint8 *) texturedata->pixels + rect->y * texturedata->pitch + rect->x * SDL_BYTESPERPIXEL(texture->format)); *pitch = texturedata->pitch; - } else -#endif - { + } else { RECT d3drect; D3DLOCKED_RECT locked; HRESULT result; @@ -741,17 +699,14 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (!texturedata) { return; } -#if SDL_HAVE_YUV + if (texturedata->yuv) { const SDL_Rect *rect = &texturedata->locked_rect; void *pixels = (void *) ((Uint8 *) texturedata->pixels + rect->y * texturedata->pitch + rect->x * SDL_BYTESPERPIXEL(texture->format)); D3D_UpdateTexture(renderer, texture, rect, pixels, texturedata->pitch); - } - else -#endif - { + } else { IDirect3DTexture9_UnlockRect(texturedata->texture.staging, 0); texturedata->texture.dirty = SDL_TRUE; if (data->drawstate.texture == texture) { @@ -759,6 +714,10 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) data->drawstate.shader = NULL; IDirect3DDevice9_SetPixelShader(data->device, NULL); IDirect3DDevice9_SetTexture(data->device, 0, NULL); + if (texturedata->yuv) { + IDirect3DDevice9_SetTexture(data->device, 1, NULL); + IDirect3DDevice9_SetTexture(data->device, 2, NULL); + } } } } @@ -797,7 +756,8 @@ D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture) texturedata = (D3D_TextureData *)texture->driverdata; if (!texturedata) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } /* Make sure the render target is updated if it was locked and written to */ @@ -982,7 +942,8 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH SDL_assert(*shader == NULL); if (!texturedata) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } UpdateTextureScaleMode(data, texturedata, 0); @@ -990,7 +951,7 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH if (BindTextureRep(data->device, &texturedata->texture, 0) < 0) { return -1; } -#if SDL_HAVE_YUV + if (texturedata->yuv) { switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { case SDL_YUV_CONVERSION_JPEG: @@ -1016,7 +977,6 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH return -1; } } -#endif return 0; } @@ -1027,22 +987,18 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) const SDL_BlendMode blend = cmd->data.draw.blend; if (texture != data->drawstate.texture) { -#if SDL_HAVE_YUV D3D_TextureData *oldtexturedata = data->drawstate.texture ? (D3D_TextureData *) data->drawstate.texture->driverdata : NULL; D3D_TextureData *newtexturedata = texture ? (D3D_TextureData *) texture->driverdata : NULL; -#endif LPDIRECT3DPIXELSHADER9 shader = NULL; /* disable any enabled textures we aren't going to use, let SetupTextureState() do the rest. */ if (texture == NULL) { IDirect3DDevice9_SetTexture(data->device, 0, NULL); } -#if SDL_HAVE_YUV if ((!newtexturedata || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) { IDirect3DDevice9_SetTexture(data->device, 1, NULL); IDirect3DDevice9_SetTexture(data->device, 2, NULL); } -#endif if (texture && SetupTextureState(data, texture, &shader) < 0) { return -1; } @@ -1059,12 +1015,10 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) } else if (texture) { D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata; UpdateDirtyTexture(data->device, &texturedata->texture); -#if SDL_HAVE_YUV if (texturedata->yuv) { UpdateDirtyTexture(data->device, &texturedata->utexture); UpdateDirtyTexture(data->device, &texturedata->vtexture); } -#endif } if (blend != data->drawstate.blend) { @@ -1076,15 +1030,11 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blend))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, GetBlendFunc(SDL_GetBlendModeDstColorFactor(blend))); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_BLENDOP, - GetBlendEquation(SDL_GetBlendModeColorOperation(blend))); if (data->enableSeparateAlphaBlend) { IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blend))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blend))); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_BLENDOPALPHA, - GetBlendEquation(SDL_GetBlendModeAlphaOperation(blend))); } } @@ -1093,13 +1043,7 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) if (data->drawstate.viewport_dirty) { const SDL_Rect *viewport = &data->drawstate.viewport; - D3DVIEWPORT9 d3dviewport; - d3dviewport.X = viewport->x; - d3dviewport.Y = viewport->y; - d3dviewport.Width = viewport->w; - d3dviewport.Height = viewport->h; - d3dviewport.MinZ = 0.0f; - d3dviewport.MaxZ = 1.0f; + const D3DVIEWPORT9 d3dviewport = { viewport->x, viewport->y, viewport->w, viewport->h, 0.0f, 1.0f }; IDirect3DDevice9_SetViewport(data->device, &d3dviewport); /* Set an orthographic projection matrix */ @@ -1126,11 +1070,7 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) if (data->drawstate.cliprect_dirty) { const SDL_Rect *viewport = &data->drawstate.viewport; const SDL_Rect *rect = &data->drawstate.cliprect; - RECT d3drect; - d3drect.left = viewport->x + rect->x; - d3drect.top = viewport->y + rect->y; - d3drect.right = viewport->x + rect->x + rect->w; - d3drect.bottom = viewport->y + rect->y + rect->h; + const RECT d3drect = { viewport->x + rect->x, viewport->y + rect->y, viewport->x + rect->x + rect->w, viewport->y + rect->y + rect->h }; IDirect3DDevice9_SetScissorRect(data->device, &d3drect); data->drawstate.cliprect_dirty = SDL_FALSE; } @@ -1245,9 +1185,7 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0); } else { /* Clear is defined to clear the entire render target */ - D3DVIEWPORT9 wholeviewport = { 0, 0, 0, 0, 0.0f, 1.0f }; - wholeviewport.Width = backw; - wholeviewport.Height = backh; + const D3DVIEWPORT9 wholeviewport = { 0, 0, backw, backh, 0.0f, 1.0f }; IDirect3DDevice9_SetViewport(data->device, &wholeviewport); data->drawstate.viewport_dirty = SDL_TRUE; /* we still need to (re)set orthographic projection, so always mark it dirty. */ IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0); @@ -1338,7 +1276,6 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, RECT d3drect; D3DLOCKED_RECT locked; HRESULT result; - int status; if (data->currentRenderTarget) { backBuffer = data->currentRenderTarget; @@ -1373,7 +1310,7 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, return D3D_SetError("LockRect()", result); } - status = SDL_ConvertPixels(rect->w, rect->h, + SDL_ConvertPixels(rect->w, rect->h, D3DFMTToPixelFormat(desc.Format), locked.pBits, locked.Pitch, format, pixels, pitch); @@ -1381,7 +1318,7 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, IDirect3DSurface9_Release(surface); - return status; + return 0; } static void @@ -1420,12 +1357,10 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) renderdata->drawstate.shader = NULL; IDirect3DDevice9_SetPixelShader(renderdata->device, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 0, NULL); -#if SDL_HAVE_YUV if (data->yuv) { IDirect3DDevice9_SetTexture(renderdata->device, 1, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 2, NULL); } -#endif } if (!data) { @@ -1433,11 +1368,9 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) } D3D_DestroyTextureRep(&data->texture); -#if SDL_HAVE_YUV D3D_DestroyTextureRep(&data->utexture); D3D_DestroyTextureRep(&data->vtexture); SDL_free(data->pixels); -#endif SDL_free(data); texture->driverdata = NULL; } @@ -1459,14 +1392,12 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } -#if SDL_HAVE_YUV for (i = 0; i < SDL_arraysize(data->shaders); ++i) { if (data->shaders[i]) { IDirect3DPixelShader9_Release(data->shaders[i]); data->shaders[i] = NULL; } } -#endif /* Release all vertex buffers */ for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) { if (data->vertexBuffers[i]) { @@ -1623,7 +1554,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) } renderer->WindowEvent = D3D_WindowEvent; - renderer->GetOutputSize = D3D_GetOutputSize; renderer->SupportsBlendMode = D3D_SupportsBlendMode; renderer->CreateTexture = D3D_CreateTexture; renderer->UpdateTexture = D3D_UpdateTexture; @@ -1653,7 +1583,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) SDL_GetWindowWMInfo(window, &windowinfo); window_flags = SDL_GetWindowFlags(window); - WIN_GetDrawableSize(window, &w, &h); + SDL_GetWindowSize(window, &w, &h); SDL_GetWindowDisplayMode(window, &fullscreen_mode); SDL_zero(pparams); @@ -1740,7 +1670,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) /* Set up parameters for rendering */ D3D_InitRenderState(data); -#if SDL_HAVE_YUV + if (caps.MaxSimultaneousTextures >= 3) { int i; for (i = 0; i < SDL_arraysize(data->shaders); ++i) { @@ -1754,10 +1684,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; } } -#endif - data->drawstate.viewport_dirty = SDL_TRUE; - data->drawstate.cliprect_dirty = SDL_TRUE; - data->drawstate.cliprect_enabled_dirty = SDL_TRUE; + data->drawstate.blend = SDL_BLENDMODE_INVALID; return renderer; diff --git a/externals/SDL/src/render/direct3d11/SDL_render_d3d11.c b/externals/SDL/src/render/direct3d11/SDL_render_d3d11.c index 30c44ce48..f8d8c7cf5 100755 --- a/externals/SDL/src/render/direct3d11/SDL_render_d3d11.c +++ b/externals/SDL/src/render/direct3d11/SDL_render_d3d11.c @@ -27,9 +27,6 @@ #define COBJMACROS #include "../../core/windows/SDL_windows.h" -#if !defined(__WINRT__) -#include "../../video/windows/SDL_windowswindow.h" -#endif #include "SDL_hints.h" #include "SDL_loadso.h" #include "SDL_syswm.h" @@ -94,7 +91,7 @@ typedef struct int lockedTexturePositionX; int lockedTexturePositionY; D3D11_FILTER scaleMode; -#if SDL_HAVE_YUV + /* YV12 texture support */ SDL_bool yuv; ID3D11Texture2D *mainTextureU; @@ -110,7 +107,6 @@ typedef struct Uint8 *pixels; int pitch; SDL_Rect locked_rect; -#endif } D3D11_TextureData; /* Blend mode data */ @@ -491,11 +487,6 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) creationFlags |= D3D11_CREATE_DEVICE_DEBUG; } - /* Create a single-threaded device unless the app requests otherwise. */ - if (!SDL_GetHintBoolean(SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_FALSE)) { - creationFlags |= D3D11_CREATE_DEVICE_SINGLETHREADED; - } - /* Create the Direct3D 11 API device object and a corresponding context. */ result = D3D11CreateDeviceFunc( data->dxgiAdapter, @@ -913,11 +904,7 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) /* The width and height of the swap chain must be based on the display's * non-rotated size. */ -#if defined(__WINRT__) SDL_GetWindowSize(renderer->window, &w, &h); -#else - WIN_GetDrawableSize(renderer->window, &w, &h); -#endif data->rotation = D3D11_GetCurrentRotation(); /* SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation); */ if (D3D11_IsDisplayRotated90Degrees(data->rotation)) { @@ -1005,16 +992,6 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer) goto done; } - /* Set the swap chain target immediately, so that a target is always set - * even before we get to SetDrawState. Without this it's possible to hit - * null references in places like ReadPixels! - */ - ID3D11DeviceContext_OMSetRenderTargets(data->d3dContext, - 1, - &data->mainRenderTargetView, - NULL - ); - data->viewportDirty = SDL_TRUE; done: @@ -1058,15 +1035,6 @@ D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -#if !defined(__WINRT__) -static int -D3D11_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) -{ - WIN_GetDrawableSize(renderer->window, w, h); - return 0; -} -#endif - static SDL_bool D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { @@ -1141,9 +1109,10 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + return -1; } -#if SDL_HAVE_YUV + if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { textureData->yuv = SDL_TRUE; @@ -1158,7 +1127,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + return -1; } result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, @@ -1168,7 +1138,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + return -1; } } @@ -1189,11 +1160,11 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + return -1; } } -#endif /* SDL_HAVE_YUV */ - SDL_zero(resourceViewDesc); + resourceViewDesc.Format = textureDesc.Format; resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceViewDesc.Texture2D.MostDetailedMip = 0; @@ -1205,9 +1176,10 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + return -1; } -#if SDL_HAVE_YUV + if (textureData->yuv) { result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, (ID3D11Resource *)textureData->mainTextureU, @@ -1216,7 +1188,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + return -1; } result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, (ID3D11Resource *)textureData->mainTextureV, @@ -1225,7 +1198,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + return -1; } } @@ -1241,14 +1215,13 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + return -1; } } -#endif /* SDL_HAVE_YUV */ if (texture->access & SDL_TEXTUREACCESS_TARGET) { D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; - SDL_zero(renderTargetViewDesc); renderTargetViewDesc.Format = textureDesc.Format; renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; renderTargetViewDesc.Texture2D.MipSlice = 0; @@ -1259,7 +1232,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) &textureData->mainTextureRenderTargetView); if (FAILED(result)) { D3D11_DestroyTexture(renderer, texture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result); + return -1; } } @@ -1280,7 +1254,6 @@ D3D11_DestroyTexture(SDL_Renderer * renderer, SAFE_RELEASE(data->mainTextureResourceView); SAFE_RELEASE(data->mainTextureRenderTargetView); SAFE_RELEASE(data->stagingTexture); -#if SDL_HAVE_YUV SAFE_RELEASE(data->mainTextureU); SAFE_RELEASE(data->mainTextureResourceViewU); SAFE_RELEASE(data->mainTextureV); @@ -1288,7 +1261,6 @@ D3D11_DestroyTexture(SDL_Renderer * renderer, SAFE_RELEASE(data->mainTextureNV); SAFE_RELEASE(data->mainTextureResourceViewNV); SDL_free(data->pixels); -#endif SDL_free(data); texture->driverdata = NULL; } @@ -1318,7 +1290,8 @@ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *tex NULL, &stagingTexture); if (FAILED(result)) { - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); + return -1; } /* Get a write-only pointer to data in the staging texture: */ @@ -1330,8 +1303,9 @@ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *tex &textureMemory ); if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); SAFE_RELEASE(stagingTexture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); + return -1; } src = (const Uint8 *)pixels; @@ -1383,13 +1357,14 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; if (!textureData) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) { return -1; } -#if SDL_HAVE_YUV + if (textureData->yuv) { /* Skip to the correct offset into the next texture */ srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); @@ -1413,7 +1388,6 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } } -#endif /* SDL_HAVE_YUV */ return 0; } @@ -1429,7 +1403,8 @@ D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; if (!textureData) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { @@ -1454,7 +1429,8 @@ D3D11_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture, D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; if (!textureData) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { @@ -1479,9 +1455,10 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D11_MAPPED_SUBRESOURCE textureMemory; if (!textureData) { - return SDL_SetError("Texture is not currently available"); + SDL_SetError("Texture is not currently available"); + return -1; } -#if SDL_HAVE_YUV + if (textureData->yuv || textureData->nv12) { /* It's more efficient to upload directly... */ if (!textureData->pixels) { @@ -1498,7 +1475,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, *pitch = textureData->pitch; return 0; } -#endif + if (textureData->stagingTexture) { return SDL_SetError("texture is already locked"); } @@ -1523,7 +1500,8 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, NULL, &textureData->stagingTexture); if (FAILED(result)) { - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D [create staging texture]"), result); + return -1; } /* Get a write-only pointer to data in the staging texture: */ @@ -1535,8 +1513,9 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, &textureMemory ); if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); SAFE_RELEASE(textureData->stagingTexture); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result); + return -1; } /* Make note of where the staging texture will be written to @@ -1562,7 +1541,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (!textureData) { return; } -#if SDL_HAVE_YUV + if (textureData->yuv || textureData->nv12) { const SDL_Rect *rect = &textureData->locked_rect; void *pixels = @@ -1571,7 +1550,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) D3D11_UpdateTexture(renderer, texture, rect, pixels, textureData->pitch); return; } -#endif + /* Commit the pixel buffer's changes back to the staging texture: */ ID3D11DeviceContext_Unmap(rendererData->d3dContext, (ID3D11Resource *)textureData->stagingTexture, @@ -1734,7 +1713,8 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer, &mappedResource ); if (FAILED(result)) { - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [vertex buffer]"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [vertex buffer]"), result); + return -1; } SDL_memcpy(mappedResource.pData, vertexData, dataSizeInBytes); ID3D11DeviceContext_Unmap(rendererData->d3dContext, (ID3D11Resource *)rendererData->vertexBuffers[vbidx], 0); @@ -1761,7 +1741,8 @@ D3D11_UpdateVertexBuffer(SDL_Renderer *renderer, &rendererData->vertexBuffers[vbidx] ); if (FAILED(result)) { - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex buffer]"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBuffer [vertex buffer]"), result); + return -1; } rendererData->vertexBufferSizes[vbidx] = dataSizeInBytes; @@ -2014,7 +1995,7 @@ D3D11_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const default: return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); } -#if SDL_HAVE_YUV + if (textureData->yuv) { ID3D11ShaderResourceView *shaderResources[] = { textureData->mainTextureResourceView, @@ -2065,7 +2046,7 @@ D3D11_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix); } -#endif /* SDL_HAVE_YUV */ + return D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_RGB], 1, &textureData->mainTextureResourceView, textureSampler, matrix); } @@ -2268,20 +2249,30 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, /* Copy the data into the desired buffer, converting pixels to the * desired format at the same time: */ - status = SDL_ConvertPixels( + if (SDL_ConvertPixels( rect->w, rect->h, D3D11_DXGIFormatToSDLPixelFormat(stagingTextureDesc.Format), textureMemory.pData, textureMemory.RowPitch, format, pixels, - pitch); + pitch) != 0) { + /* When SDL_ConvertPixels fails, it'll have already set the format. + * Get the error message, and attach some extra data to it. + */ + char errorMessage[1024]; + SDL_snprintf(errorMessage, sizeof(errorMessage), "%s, Convert Pixels failed: %s", __FUNCTION__, SDL_GetError()); + SDL_SetError("%s", errorMessage); + goto done; + } /* Unmap the texture: */ ID3D11DeviceContext_Unmap(data->d3dContext, (ID3D11Resource *)stagingTexture, 0); + status = 0; + done: SAFE_RELEASE(backBuffer); SAFE_RELEASE(stagingTexture); @@ -2374,7 +2365,6 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags) data = (D3D11_RenderData *) SDL_calloc(1, sizeof(*data)); if (!data) { - SDL_free(renderer); SDL_OutOfMemory(); return NULL; } @@ -2382,9 +2372,6 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags) data->identity = MatrixIdentity(); renderer->WindowEvent = D3D11_WindowEvent; -#if !defined(__WINRT__) - renderer->GetOutputSize = D3D11_GetOutputSize; -#endif renderer->SupportsBlendMode = D3D11_SupportsBlendMode; renderer->CreateTexture = D3D11_CreateTexture; renderer->UpdateTexture = D3D11_UpdateTexture; diff --git a/externals/SDL/src/render/direct3d11/SDL_shaders_d3d11.c b/externals/SDL/src/render/direct3d11/SDL_shaders_d3d11.c index 3a6807b5f..4c49cfe34 100755 --- a/externals/SDL/src/render/direct3d11/SDL_shaders_d3d11.c +++ b/externals/SDL/src/render/direct3d11/SDL_shaders_d3d11.c @@ -1886,10 +1886,9 @@ static struct { const void *shader_data; SIZE_T shader_size; -} D3D11_shaders[NUM_SHADERS] = { +} D3D11_shaders[] = { { D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) }, { D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) }, -#if SDL_HAVE_YUV { D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) }, { D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) }, { D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) }, @@ -1899,7 +1898,6 @@ static struct { D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) }, { D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) }, { D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) }, -#endif }; int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout) diff --git a/externals/SDL/src/render/direct3d11/SDL_shaders_d3d11.h b/externals/SDL/src/render/direct3d11/SDL_shaders_d3d11.h index d877c0906..d25a79ada 100755 --- a/externals/SDL/src/render/direct3d11/SDL_shaders_d3d11.h +++ b/externals/SDL/src/render/direct3d11/SDL_shaders_d3d11.h @@ -25,7 +25,6 @@ typedef enum { SHADER_SOLID, SHADER_RGB, -#if SDL_HAVE_YUV SHADER_YUV_JPEG, SHADER_YUV_BT601, SHADER_YUV_BT709, @@ -35,7 +34,6 @@ typedef enum { SHADER_NV21_JPEG, SHADER_NV21_BT601, SHADER_NV21_BT709, -#endif NUM_SHADERS } D3D11_Shader; diff --git a/externals/SDL/src/render/metal/SDL_render_metal.m b/externals/SDL/src/render/metal/SDL_render_metal.m index 6ade20c12..e093fd4d8 100755 --- a/externals/SDL/src/render/metal/SDL_render_metal.m +++ b/externals/SDL/src/render/metal/SDL_render_metal.m @@ -142,6 +142,24 @@ typedef struct METAL_ShaderPipelines @end @implementation METAL_RenderData +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_mtldevice release]; + [_mtlcmdqueue release]; + [_mtlcmdbuffer release]; + [_mtlcmdencoder release]; + [_mtllibrary release]; + [_mtlbackbuffer release]; + [_mtlsamplernearest release]; + [_mtlsamplerlinear release]; + [_mtlbufconstants release]; + [_mtlbufquadindices release]; + [_mtllayer release]; + [_mtlpassdesc release]; + [super dealloc]; +} +#endif @end @interface METAL_TextureData : NSObject @@ -149,17 +167,26 @@ typedef struct METAL_ShaderPipelines @property (nonatomic, retain) id mtltexture_uv; @property (nonatomic, retain) id mtlsampler; @property (nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction; -#if SDL_HAVE_YUV @property (nonatomic, assign) BOOL yuv; @property (nonatomic, assign) BOOL nv12; @property (nonatomic, assign) size_t conversionBufferOffset; -#endif @property (nonatomic, assign) BOOL hasdata; + @property (nonatomic, retain) id lockedbuffer; @property (nonatomic, assign) SDL_Rect lockedrect; @end @implementation METAL_TextureData +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_mtltexture release]; + [_mtltexture_uv release]; + [_mtlsampler release]; + [_lockedbuffer release]; + [super dealloc]; +} +#endif @end static int @@ -314,6 +341,13 @@ MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache, METAL_PipelineState *states = SDL_realloc(cache->states, (cache->count + 1) * sizeof(pipeline)); +#if !__has_feature(objc_arc) + [mtlpipedesc release]; // !!! FIXME: can these be reused for each creation, or does the pipeline obtain it? + [mtlvertfn release]; + [mtlfragfn release]; + [state release]; +#endif + if (states) { states[cache->count++] = pipeline; cache->states = states; @@ -571,14 +605,14 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) mtltexdesc.usage = MTLTextureUsageShaderRead; } } - + id mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; if (mtltexture == nil) { return SDL_SetError("Texture allocation failed"); } id mtltexture_uv = nil; -#if SDL_HAVE_YUV + BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12); BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21); @@ -597,10 +631,13 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (yuv || nv12) { mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; if (mtltexture_uv == nil) { +#if !__has_feature(objc_arc) + [mtltexture release]; +#endif return SDL_SetError("Texture allocation failed"); } } -#endif /* SDL_HAVE_YUV */ + METAL_TextureData *texturedata = [[METAL_TextureData alloc] init]; if (texture->scaleMode == SDL_ScaleModeNearest) { texturedata.mtlsampler = data.mtlsamplernearest; @@ -609,7 +646,7 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } texturedata.mtltexture = mtltexture; texturedata.mtltexture_uv = mtltexture_uv; -#if SDL_HAVE_YUV + texturedata.yuv = yuv; texturedata.nv12 = nv12; @@ -619,12 +656,10 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV12; } else if (texture->format == SDL_PIXELFORMAT_NV21) { texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21; - } else -#endif - { + } else { texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY; } -#if SDL_HAVE_YUV + if (yuv || nv12) { size_t offset = 0; SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionModeForResolution(texture->w, texture->h); @@ -636,9 +671,15 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } texturedata.conversionBufferOffset = offset; } -#endif + texture->driverdata = (void*)CFBridgingRetain(texturedata); +#if !__has_feature(objc_arc) + [texturedata release]; + [mtltexture release]; + [mtltexture_uv release]; +#endif + return 0; }} @@ -698,6 +739,10 @@ METAL_UpdateTextureInternal(SDL_Renderer * renderer, METAL_TextureData *textured return SDL_OutOfMemory(); } +#if !__has_feature(objc_arc) + [stagingtex autorelease]; +#endif + METAL_UploadTextureData(stagingtex, stagingrect, 0, pixels, pitch); if (data.mtlcmdencoder != nil) { @@ -740,7 +785,7 @@ METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, if (METAL_UpdateTextureInternal(renderer, texturedata, texturedata.mtltexture, *rect, 0, pixels, pitch) < 0) { return -1; } -#if SDL_HAVE_YUV + if (texturedata.yuv) { int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; @@ -770,7 +815,7 @@ METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } } -#endif + texturedata.hasdata = YES; return 0; @@ -851,12 +896,10 @@ METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, } *pitch = SDL_BYTESPERPIXEL(texture->format) * rect->w; -#if SDL_HAVE_YUV + if (texturedata.yuv || texturedata.nv12) { buffersize = ((*pitch) * rect->h) + (2 * (*pitch + 1) / 2) * ((rect->h + 1) / 2); - } else -#endif - { + } else { buffersize = (*pitch) * rect->h; } @@ -869,6 +912,11 @@ METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, texturedata.lockedbuffer = lockedbuffer; *pixels = [lockedbuffer contents]; + /* METAL_TextureData.lockedbuffer retains. */ +#if !__has_feature(objc_arc) + [lockedbuffer release]; +#endif + return 0; }} @@ -905,7 +953,7 @@ METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) destinationSlice:0 destinationLevel:0 destinationOrigin:MTLOriginMake(rect.x, rect.y, 0)]; -#if SDL_HAVE_YUV + if (texturedata.yuv) { int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; @@ -945,7 +993,7 @@ METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) destinationLevel:0 destinationOrigin:MTLOriginMake(UVrect.x, UVrect.y, 0)]; } -#endif + [blitcmd endEncoding]; [data.mtlcmdbuffer commit]; @@ -1156,8 +1204,13 @@ METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture typedef struct { + #if __has_feature(objc_arc) __unsafe_unretained id pipeline; __unsafe_unretained id vertex_buffer; + #else + id pipeline; + id vertex_buffer; + #endif size_t constants_offset; SDL_Texture *texture; SDL_bool cliprect_dirty; @@ -1197,29 +1250,22 @@ SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_Met } if (statecache->cliprect_dirty) { - SDL_Rect output; - SDL_Rect clip; + MTLScissorRect mtlrect; if (statecache->cliprect_enabled) { - clip = statecache->cliprect; - clip.x += statecache->viewport.x; - clip.y += statecache->viewport.y; + const SDL_Rect *rect = &statecache->cliprect; + mtlrect.x = statecache->viewport.x + rect->x; + mtlrect.y = statecache->viewport.y + rect->y; + mtlrect.width = rect->w; + mtlrect.height = rect->h; } else { - clip = statecache->viewport; + mtlrect.x = statecache->viewport.x; + mtlrect.y = statecache->viewport.y; + mtlrect.width = statecache->viewport.w; + mtlrect.height = statecache->viewport.h; } - - /* Set Scissor Rect Validation: w/h must be <= render pass */ - SDL_zero(output); - METAL_GetOutputSize(renderer, &output.w, &output.h); - - if (SDL_IntersectRect(&output, &clip, &clip)) { - MTLScissorRect mtlrect; - mtlrect.x = clip.x; - mtlrect.y = clip.y; - mtlrect.width = clip.w; - mtlrect.height = clip.h; + if (mtlrect.width > 0 && mtlrect.height > 0) { [data.mtlcmdencoder setScissorRect:mtlrect]; } - statecache->cliprect_dirty = SDL_FALSE; } @@ -1267,12 +1313,10 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const size_t } [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture atIndex:0]; -#if SDL_HAVE_YUV if (texturedata.yuv || texturedata.nv12) { [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture_uv atIndex:1]; [data.mtlcmdencoder setFragmentBuffer:data.mtlbufconstants offset:texturedata.conversionBufferOffset atIndex:1]; } -#endif statecache->texture = texture; } return SDL_TRUE; @@ -1307,6 +1351,9 @@ METAL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver * TODO: this buffer is also used for constants. Is performance still * good for those, or should we have a managed buffer for them? */ mtlbufvertex = [data.mtldevice newBufferWithLength:vertsize options:MTLResourceStorageModeShared]; + #if !__has_feature(objc_arc) + [mtlbufvertex autorelease]; + #endif mtlbufvertex.label = @"SDL vertex data"; SDL_memcpy([mtlbufvertex contents], vertices, vertsize); @@ -1650,6 +1697,9 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) } if (view == NULL) { +#if !__has_feature(objc_arc) + [mtldevice release]; +#endif SDL_free(renderer); if (changed_window) { SDL_RecreateWindow(window, window_flags); @@ -1661,6 +1711,9 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) data = [[METAL_RenderData alloc] init]; if (data == nil) { +#if !__has_feature(objc_arc) + [mtldevice release]; +#endif /* Release the metal view instead of destroying it, in case we want to use it later (recreating the renderer) */ @@ -1679,7 +1732,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) data.mtlview = view; #ifdef __MACOSX__ - layer = (CAMetalLayer *)[(__bridge NSView *)view layer]; + layer = (CAMetalLayer *)[(NSView *)view layer]; #else layer = (CAMetalLayer *)[(__bridge UIView *)view layer]; #endif @@ -1704,6 +1757,9 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) id mtllibrary = [data.mtldevice newLibraryWithData:mtllibdata error:&err]; data.mtllibrary = mtllibrary; SDL_assert(err == nil); +#if !__has_feature(objc_arc) + dispatch_release(mtllibdata); +#endif data.mtllibrary.label = @"SDL Metal renderer shader library"; /* Do some shader pipeline state loading up-front rather than on demand. */ @@ -1761,6 +1817,9 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) }; id mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared]; + #if !__has_feature(objc_arc) + [mtlbufconstantstaging autorelease]; + #endif char *constantdata = [mtlbufconstantstaging contents]; SDL_memcpy(constantdata + CONSTANTS_OFFSET_IDENTITY, identitytransform, sizeof(identitytransform)); @@ -1772,6 +1831,9 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) int quadcount = UINT16_MAX / 4; size_t indicessize = sizeof(UInt16) * quadcount * 6; id mtlbufquadindicesstaging = [data.mtldevice newBufferWithLength:indicessize options:MTLResourceStorageModeShared]; +#if !__has_feature(objc_arc) + [mtlbufquadindicesstaging autorelease]; +#endif /* Quads in the following vertex order (matches the FillRects vertices): * 1---3 @@ -1889,6 +1951,18 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.max_texture_width = maxtexsize; renderer->info.max_texture_height = maxtexsize; +#if !__has_feature(objc_arc) + [mtlcmdqueue release]; + [mtllibrary release]; + [samplerdesc release]; + [mtlsamplernearest release]; + [mtlsamplerlinear release]; + [mtlbufconstants release]; + [mtlbufquadindices release]; + [data release]; + [mtldevice release]; +#endif + return renderer; }} diff --git a/externals/SDL/src/render/opengl/SDL_render_gl.c b/externals/SDL/src/render/opengl/SDL_render_gl.c index b5af52af3..47d5ae8a1 100755 --- a/externals/SDL/src/render/opengl/SDL_render_gl.c +++ b/externals/SDL/src/render/opengl/SDL_render_gl.c @@ -30,11 +30,6 @@ #include #endif -#ifdef SDL_VIDEO_VITA_PVR_OGL -#include -#include -#endif - /* To prevent unnecessary window recreation, * these should match the defaults selected in SDL_GL_ResetAttributes */ @@ -324,20 +319,6 @@ GL_GetFBO(GL_RenderData *data, Uint32 w, Uint32 h) return result; } -static void -GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) -{ - /* If the window x/y/w/h changed at all, assume the viewport has been - * changed behind our backs. x/y changes might seem weird but viewport - * resets have been observed on macOS at minimum! - */ - if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED || - event->event == SDL_WINDOWEVENT_MOVED) { - GL_RenderData *data = (GL_RenderData *) renderer->driverdata; - data->drawstate.viewport_dirty = SDL_TRUE; - } -} - static int GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) { @@ -1057,7 +1038,7 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te return 0; } -static int +static void SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader shader) { const SDL_BlendMode blend = cmd->data.draw.blend; @@ -1130,8 +1111,7 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader } } - vertex_array = cmd->command == SDL_RENDERCMD_DRAW_POINTS - || cmd->command == SDL_RENDERCMD_DRAW_LINES + vertex_array = cmd->command == SDL_RENDERCMD_DRAW_LINES || cmd->command == SDL_RENDERCMD_GEOMETRY; color_array = cmd->command == SDL_RENDERCMD_GEOMETRY; texture_array = cmd->data.draw.texture != NULL; @@ -1164,11 +1144,9 @@ SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const GL_Shader } data->drawstate.texture_array = texture_array; } - - return 0; } -static int +static void SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd) { SDL_Texture *texture = cmd->data.draw.texture; @@ -1204,8 +1182,6 @@ SetCopyState(GL_RenderData *data, const SDL_RenderCommand *cmd) data->drawstate.texture = texture; } - - return 0; } static int @@ -1213,6 +1189,7 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic { /* !!! FIXME: it'd be nice to use a vertex buffer instead of immediate mode... */ GL_RenderData *data = (GL_RenderData *) renderer->driverdata; + size_t i; if (GL_ActivateRenderer(renderer) < 0) { return -1; @@ -1231,9 +1208,9 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } #ifdef __MACOSX__ - // On macOS on older systems, the OpenGL view change and resize events aren't - // necessarily synchronized, so just always reset it. - // Workaround for: https://discourse.libsdl.org/t/sdl-2-0-22-prerelease/35306/6 + // On macOS, moving the window seems to invalidate the OpenGL viewport state, + // so don't bother trying to persist it across frames; always reset it. + // Workaround for: https://github.com/libsdl-org/SDL/issues/1504 data->drawstate.viewport_dirty = SDL_TRUE; #endif @@ -1267,7 +1244,6 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic data->drawstate.cliprect_enabled = cmd->data.cliprect.enabled; data->drawstate.cliprect_enabled_dirty = SDL_TRUE; } - if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)) != 0) { SDL_memcpy(&data->drawstate.cliprect, rect, sizeof (SDL_Rect)); data->drawstate.cliprect_dirty = SDL_TRUE; @@ -1296,6 +1272,31 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } data->glClear(GL_COLOR_BUFFER_BIT); + + break; + } + + case SDL_RENDERCMD_DRAW_POINTS: { + const size_t count = cmd->data.draw.count; + const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); + SetDrawState(data, cmd, SHADER_SOLID); + data->glBegin(GL_POINTS); + for (i = 0; i < count; i++, verts += 2) { + data->glVertex2f(verts[0], verts[1]); + } + data->glEnd(); + break; + } + + case SDL_RENDERCMD_DRAW_LINES: { + const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); + const size_t count = cmd->data.draw.count; + SDL_assert(count >= 2); + SetDrawState(data, cmd, SHADER_SOLID); + + /* SetDrawState handles glEnableClientState. */ + data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, verts); + data->glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) count); break; } @@ -1308,113 +1309,42 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic case SDL_RENDERCMD_COPY_EX: /* unused */ break; - case SDL_RENDERCMD_DRAW_LINES: { - if (SetDrawState(data, cmd, SHADER_SOLID) == 0) { - size_t count = cmd->data.draw.count; - const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); + case SDL_RENDERCMD_GEOMETRY: { + const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); + SDL_Texture *texture = cmd->data.draw.texture; + const size_t count = cmd->data.draw.count; + + if (texture) { + SetCopyState(data, cmd); + } else { + SetDrawState(data, cmd, SHADER_SOLID); + } + + { + Uint32 color = data->drawstate.color; + GLubyte a = (GLubyte)((color >> 24) & 0xFF); + GLubyte r = (GLubyte)((color >> 16) & 0xFF); + GLubyte g = (GLubyte)((color >> 8) & 0xFF); + GLubyte b = (GLubyte)((color >> 0) & 0xFF); /* SetDrawState handles glEnableClientState. */ - data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, verts); - - if (count > 2) { - /* joined lines cannot be grouped */ - data->glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)count); + if (texture) { + data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 5, verts + 0); + data->glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(float) * 5, verts + 2); + data->glTexCoordPointer(2, GL_FLOAT, sizeof(float) * 5, verts + 3); } else { - /* let's group non joined lines */ - SDL_RenderCommand *finalcmd = cmd; - SDL_RenderCommand *nextcmd = cmd->next; - SDL_BlendMode thisblend = cmd->data.draw.blend; - - while (nextcmd != NULL) { - const SDL_RenderCommandType nextcmdtype = nextcmd->command; - if (nextcmdtype != SDL_RENDERCMD_DRAW_LINES) { - break; /* can't go any further on this draw call, different render command up next. */ - } else if (nextcmd->data.draw.count != 2) { - break; /* can't go any further on this draw call, those are joined lines */ - } else if (nextcmd->data.draw.blend != thisblend) { - break; /* can't go any further on this draw call, different blendmode copy up next. */ - } else { - finalcmd = nextcmd; /* we can combine copy operations here. Mark this one as the furthest okay command. */ - count += nextcmd->data.draw.count; - } - nextcmd = nextcmd->next; - } - - data->glDrawArrays(GL_LINES, 0, (GLsizei)count); - cmd = finalcmd; /* skip any copy commands we just combined in here. */ - } - } - break; - } - - case SDL_RENDERCMD_DRAW_POINTS: - case SDL_RENDERCMD_GEOMETRY: { - /* as long as we have the same copy command in a row, with the - same texture, we can combine them all into a single draw call. */ - SDL_Texture *thistexture = cmd->data.draw.texture; - SDL_BlendMode thisblend = cmd->data.draw.blend; - const SDL_RenderCommandType thiscmdtype = cmd->command; - SDL_RenderCommand *finalcmd = cmd; - SDL_RenderCommand *nextcmd = cmd->next; - size_t count = cmd->data.draw.count; - int ret; - while (nextcmd != NULL) { - const SDL_RenderCommandType nextcmdtype = nextcmd->command; - if (nextcmdtype != thiscmdtype) { - break; /* can't go any further on this draw call, different render command up next. */ - } else if (nextcmd->data.draw.texture != thistexture || nextcmd->data.draw.blend != thisblend) { - break; /* can't go any further on this draw call, different texture/blendmode copy up next. */ - } else { - finalcmd = nextcmd; /* we can combine copy operations here. Mark this one as the furthest okay command. */ - count += nextcmd->data.draw.count; - } - nextcmd = nextcmd->next; - } - - if (thistexture) { - ret = SetCopyState(data, cmd); - } else { - ret = SetDrawState(data, cmd, SHADER_SOLID); - } - - if (ret == 0) { - const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first); - int op = GL_TRIANGLES; /* SDL_RENDERCMD_GEOMETRY */ - if (thiscmdtype == SDL_RENDERCMD_DRAW_POINTS) { - op = GL_POINTS; + data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 3, verts + 0); + data->glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(float) * 3, verts + 2); } - if (thiscmdtype == SDL_RENDERCMD_DRAW_POINTS) { - /* SetDrawState handles glEnableClientState. */ - data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 2, verts); - } else { - /* SetDrawState handles glEnableClientState. */ - if (thistexture) { - data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 5, verts + 0); - data->glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(float) * 5, verts + 2); - data->glTexCoordPointer(2, GL_FLOAT, sizeof(float) * 5, verts + 3); - } else { - data->glVertexPointer(2, GL_FLOAT, sizeof(float) * 3, verts + 0); - data->glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(float) * 3, verts + 2); - } - } - - data->glDrawArrays(op, 0, (GLsizei) count); + data->glDrawArrays(GL_TRIANGLES, 0, (GLsizei) count); /* Restore previously set color when we're done. */ - if (thiscmdtype != SDL_RENDERCMD_DRAW_POINTS) { - Uint32 color = data->drawstate.color; - GLubyte a = (GLubyte)((color >> 24) & 0xFF); - GLubyte r = (GLubyte)((color >> 16) & 0xFF); - GLubyte g = (GLubyte)((color >> 8) & 0xFF); - GLubyte b = (GLubyte)((color >> 0) & 0xFF); - data->glColor4ub(r, g, b, a); - } + data->glColor4ub(r, g, b, a); } - - cmd = finalcmd; /* skip any copy commands we just combined in here. */ break; - } + } + case SDL_RENDERCMD_NO_OP: break; @@ -1709,32 +1639,6 @@ GL_SetVSync(SDL_Renderer * renderer, const int vsync) return retval; } -static SDL_bool -GL_IsProbablyAccelerated(const GL_RenderData *data) -{ - /*const char *vendor = (const char *) data->glGetString(GL_VENDOR);*/ - const char *renderer = (const char *) data->glGetString(GL_RENDERER); - -#ifdef __WINDOWS__ - if (SDL_strcmp(renderer, "GDI Generic") == 0) { - return SDL_FALSE; /* Microsoft's fallback software renderer. Fix your system! */ - } -#endif - -#ifdef __APPLE__ - if (SDL_strcmp(renderer, "Apple Software Renderer") == 0) { - return SDL_FALSE; /* (a probably very old) Apple software-based OpenGL. */ - } -#endif - - if (SDL_strcmp(renderer, "Software Rasterizer") == 0) { - return SDL_FALSE; /* (a probably very old) Software Mesa, or some other generic thing. */ - } - - /* !!! FIXME: swrast? llvmpipe? softpipe? */ - - return SDL_TRUE; -} static SDL_Renderer * GL_CreateRenderer(SDL_Window * window, Uint32 flags) @@ -1745,14 +1649,11 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) Uint32 window_flags; int profile_mask = 0, major = 0, minor = 0; SDL_bool changed_window = SDL_FALSE; - const char *hint; - SDL_bool non_power_of_two_supported = SDL_FALSE; SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor); -#ifndef SDL_VIDEO_VITA_PVR_OGL window_flags = SDL_GetWindowFlags(window); if (!(window_flags & SDL_WINDOW_OPENGL) || profile_mask == SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) { @@ -1766,7 +1667,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) goto error; } } -#endif renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); if (!renderer) { @@ -1781,7 +1681,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) goto error; } - renderer->WindowEvent = GL_WindowEvent; renderer->GetOutputSize = GL_GetOutputSize; renderer->SupportsBlendMode = GL_SupportsBlendMode; renderer->CreateTexture = GL_CreateTexture; @@ -1808,7 +1707,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->GL_BindTexture = GL_BindTexture; renderer->GL_UnbindTexture = GL_UnbindTexture; renderer->info = GL_RenderDriver.info; - renderer->info.flags = 0; /* will set some flags below. */ + renderer->info.flags = SDL_RENDERER_ACCELERATED; renderer->driverdata = data; renderer->window = window; @@ -1832,10 +1731,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) goto error; } - if (GL_IsProbablyAccelerated(data)) { - renderer->info.flags |= SDL_RENDERER_ACCELERATED; - } - #ifdef __MACOSX__ /* Enable multi-threaded rendering */ /* Disabled until Ryan finishes his VBO/PBO code... @@ -1869,37 +1764,15 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); } - hint = SDL_getenv("GL_ARB_texture_non_power_of_two"); - if (!hint || *hint != '0') { - SDL_bool isGL2 = SDL_FALSE; - const char *verstr = (const char *)data->glGetString(GL_VERSION); - if (verstr) { - char verbuf[16]; - char *ptr; - SDL_strlcpy(verbuf, verstr, sizeof (verbuf)); - ptr = SDL_strchr(verbuf, '.'); - if (ptr) { - *ptr = '\0'; - if (SDL_atoi(verbuf) >= 2) { - isGL2 = SDL_TRUE; - } - } - } - if (isGL2 || SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two")) { - non_power_of_two_supported = SDL_TRUE; - } - } - data->textype = GL_TEXTURE_2D; - if (non_power_of_two_supported) { + if (SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two")) { data->GL_ARB_texture_non_power_of_two_supported = SDL_TRUE; - data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); - renderer->info.max_texture_width = value; - renderer->info.max_texture_height = value; } else if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) { data->GL_ARB_texture_rectangle_supported = SDL_TRUE; data->textype = GL_TEXTURE_RECTANGLE_ARB; + } + if (data->GL_ARB_texture_rectangle_supported) { data->glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, &value); renderer->info.max_texture_width = value; renderer->info.max_texture_height = value; @@ -1924,7 +1797,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) } SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s", data->shaders ? "ENABLED" : "DISABLED"); -#if SDL_HAVE_YUV + /* We support YV12 textures using 3 textures and a shader */ if (data->shaders && data->num_texture_units >= 3) { renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; @@ -1932,7 +1805,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; } -#endif + #ifdef __MACOSX__ renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY; #endif diff --git a/externals/SDL/src/render/opengl/SDL_shaders_gl.c b/externals/SDL/src/render/opengl/SDL_shaders_gl.c index 4db083555..b4f7aa39f 100755 --- a/externals/SDL/src/render/opengl/SDL_shaders_gl.c +++ b/externals/SDL/src/render/opengl/SDL_shaders_gl.c @@ -284,7 +284,7 @@ static const char *shader_source[NUM_SHADERS][2] = " gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n" "}" }, -#if SDL_HAVE_YUV + /* SHADER_YUV_JPEG */ { /* vertex shader */ @@ -384,7 +384,6 @@ static const char *shader_source[NUM_SHADERS][2] = BT709_SHADER_CONSTANTS NV21_SHADER_BODY }, -#endif /* SDL_HAVE_YUV */ }; static SDL_bool diff --git a/externals/SDL/src/render/opengl/SDL_shaders_gl.h b/externals/SDL/src/render/opengl/SDL_shaders_gl.h index d3e6c398a..56382b4be 100755 --- a/externals/SDL/src/render/opengl/SDL_shaders_gl.h +++ b/externals/SDL/src/render/opengl/SDL_shaders_gl.h @@ -32,7 +32,6 @@ typedef enum { SHADER_SOLID, SHADER_RGB, SHADER_RGBA, -#if SDL_HAVE_YUV SHADER_YUV_JPEG, SHADER_YUV_BT601, SHADER_YUV_BT709, @@ -44,7 +43,6 @@ typedef enum { SHADER_NV21_JPEG, SHADER_NV21_BT601, SHADER_NV21_BT709, -#endif NUM_SHADERS } GL_Shader; diff --git a/externals/SDL/src/render/opengles2/SDL_render_gles2.c b/externals/SDL/src/render/opengles2/SDL_render_gles2.c index c2f5d640f..c38ee9723 100755 --- a/externals/SDL/src/render/opengles2/SDL_render_gles2.c +++ b/externals/SDL/src/render/opengles2/SDL_render_gles2.c @@ -28,17 +28,6 @@ #include "../../video/SDL_blit.h" #include "SDL_shaders_gles2.h" -/* WebGL doesn't offer client-side arrays, so use Vertex Buffer Objects - on Emscripten, which converts GLES2 into WebGL calls. - In all other cases, attempt to use client-side arrays, as they tend to - be dramatically faster when not batching, and about the same when - we are. */ -#if defined(__EMSCRIPTEN__) -#define USE_VERTEX_BUFFER_OBJECTS 1 -#else -#define USE_VERTEX_BUFFER_OBJECTS 0 -#endif - /* To prevent unnecessary window recreation, * these should match the defaults selected in SDL_GL_ResetAttributes */ @@ -162,12 +151,9 @@ typedef struct GLES2_RenderData GLES2_ProgramCache program_cache; Uint8 clear_r, clear_g, clear_b, clear_a; -#if USE_VERTEX_BUFFER_OBJECTS GLuint vertex_buffers[8]; size_t vertex_buffer_size[8]; int current_vertex_buffer; -#endif - GLES2_DrawStateCache drawstate; } GLES2_RenderData; @@ -561,7 +547,6 @@ GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source, int w, int case GLES2_IMAGESOURCE_TEXTURE_BGR: ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR; break; -#if SDL_HAVE_YUV case GLES2_IMAGESOURCE_TEXTURE_YUV: switch (SDL_GetYUVConversionModeForResolution(w, h)) { case SDL_YUV_CONVERSION_JPEG: @@ -618,7 +603,6 @@ GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source, int w, int goto fault; } break; -#endif /* SDL_HAVE_YUV */ case GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES: ftype = GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES; break; @@ -860,7 +844,7 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture } static int -SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_ImageSource imgsrc, void *vertices) +SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_ImageSource imgsrc) { SDL_Texture *texture = cmd->data.draw.texture; const SDL_BlendMode blend = cmd->data.draw.blend; @@ -900,14 +884,39 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I data->drawstate.cliprect_dirty = SDL_FALSE; } - if ((texture != NULL) != data->drawstate.texturing) { - if (texture == NULL) { - data->glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD); - data->drawstate.texturing = SDL_FALSE; - } else { - data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD); - data->drawstate.texturing = SDL_TRUE; + if (texture != data->drawstate.texture) { + if ((texture != NULL) != data->drawstate.texturing) { + if (texture == NULL) { + data->glDisableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD); + data->drawstate.texturing = SDL_FALSE; + } else { + data->glEnableVertexAttribArray((GLenum) GLES2_ATTRIBUTE_TEXCOORD); + data->drawstate.texturing = SDL_TRUE; + } } + + if (texture) { + GLES2_TextureData *tdata = (GLES2_TextureData *) texture->driverdata; +#if SDL_HAVE_YUV + if (tdata->yuv) { + data->glActiveTexture(GL_TEXTURE2); + data->glBindTexture(tdata->texture_type, tdata->texture_v); + + data->glActiveTexture(GL_TEXTURE1); + data->glBindTexture(tdata->texture_type, tdata->texture_u); + + data->glActiveTexture(GL_TEXTURE0); + } else if (tdata->nv12) { + data->glActiveTexture(GL_TEXTURE1); + data->glBindTexture(tdata->texture_type, tdata->texture_u); + + data->glActiveTexture(GL_TEXTURE0); + } +#endif + data->glBindTexture(tdata->texture_type, tdata->texture); + } + + data->drawstate.texture = texture; } if (texture) { @@ -917,7 +926,7 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I } if (texture) { - SDL_Vertex *verts = (SDL_Vertex *) (((Uint8 *) vertices) + cmd->data.draw.first); + SDL_Vertex *verts = (SDL_Vertex *) (cmd->data.draw.first); data->glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, stride, (const GLvoid *)&verts->tex_coord); } @@ -951,7 +960,7 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I /* all drawing commands use this */ { - SDL_VertexSolid *verts = (SDL_VertexSolid *) (((Uint8 *) vertices) + cmd->data.draw.first); + SDL_VertexSolid *verts = (SDL_VertexSolid *) (cmd->data.draw.first); data->glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, stride, (const GLvoid *) &verts->position); data->glVertexAttribPointer(GLES2_ATTRIBUTE_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE /* Normalized */, stride, (const GLvoid *) &verts->color); } @@ -960,12 +969,11 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I } static int -SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertices) +SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd) { GLES2_RenderData *data = (GLES2_RenderData *) renderer->driverdata; GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; SDL_Texture *texture = cmd->data.draw.texture; - int ret; /* Pick an appropriate shader */ if (renderer->target) { @@ -1020,7 +1028,6 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice break; } break; -#if SDL_HAVE_YUV case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_YV12: sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV; @@ -1031,7 +1038,6 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; -#endif case SDL_PIXELFORMAT_EXTERNAL_OES: sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; break; @@ -1055,7 +1061,6 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice case SDL_PIXELFORMAT_BGR888: sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; break; -#if SDL_HAVE_YUV case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_YV12: sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV; @@ -1066,7 +1071,6 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; -#endif case SDL_PIXELFORMAT_EXTERNAL_OES: sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; break; @@ -1075,31 +1079,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice } } - ret = SetDrawState(data, cmd, sourceType, vertices); - - if (texture != data->drawstate.texture) { - GLES2_TextureData *tdata = (GLES2_TextureData *) texture->driverdata; -#if SDL_HAVE_YUV - if (tdata->yuv) { - data->glActiveTexture(GL_TEXTURE2); - data->glBindTexture(tdata->texture_type, tdata->texture_v); - - data->glActiveTexture(GL_TEXTURE1); - data->glBindTexture(tdata->texture_type, tdata->texture_u); - - data->glActiveTexture(GL_TEXTURE0); - } else if (tdata->nv12) { - data->glActiveTexture(GL_TEXTURE1); - data->glBindTexture(tdata->texture_type, tdata->texture_u); - - data->glActiveTexture(GL_TEXTURE0); - } -#endif - data->glBindTexture(tdata->texture_type, tdata->texture); - data->drawstate.texture = texture; - } - - return ret; + return SetDrawState(data, cmd, sourceType); } static int @@ -1107,11 +1087,8 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver { GLES2_RenderData *data = (GLES2_RenderData *) renderer->driverdata; const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 || renderer->target->format == SDL_PIXELFORMAT_RGB888)); - -#if USE_VERTEX_BUFFER_OBJECTS const int vboidx = data->current_vertex_buffer; const GLuint vbo = data->vertex_buffers[vboidx]; -#endif if (GLES2_ActivateRenderer(renderer) < 0) { return -1; @@ -1129,7 +1106,6 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver } } -#if USE_VERTEX_BUFFER_OBJECTS /* upload the new VBO data for this set of commands. */ data->glBindBuffer(GL_ARRAY_BUFFER, vbo); if (data->vertex_buffer_size[vboidx] < vertsize) { @@ -1144,8 +1120,6 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver if (data->current_vertex_buffer >= SDL_arraysize(data->vertex_buffers)) { data->current_vertex_buffer = 0; } - vertices = NULL; /* attrib pointers will be offsets into the VBO. */ -#endif while (cmd) { switch (cmd->command) { @@ -1210,7 +1184,7 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver break; case SDL_RENDERCMD_DRAW_LINES: { - if (SetDrawState(data, cmd, GLES2_IMAGESOURCE_SOLID, vertices) == 0) { + if (SetDrawState(data, cmd, GLES2_IMAGESOURCE_SOLID) == 0) { size_t count = cmd->data.draw.count; if (count > 2) { /* joined lines cannot be grouped */ @@ -1268,9 +1242,9 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver } if (thistexture) { - ret = SetCopyState(renderer, cmd, vertices); + ret = SetCopyState(renderer, cmd); } else { - ret = SetDrawState(data, cmd, GLES2_IMAGESOURCE_SOLID, vertices); + ret = SetDrawState(data, cmd, GLES2_IMAGESOURCE_SOLID); } if (ret == 0) { @@ -1334,10 +1308,8 @@ GLES2_DestroyRenderer(SDL_Renderer *renderer) data->framebuffers = nextnode; } -#if USE_VERTEX_BUFFER_OBJECTS data->glDeleteBuffers(SDL_arraysize(data->vertex_buffers), data->vertex_buffers); GL_CheckError("", renderer); -#endif SDL_GL_DeleteContext(data->context); } @@ -1370,7 +1342,6 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) format = GL_RGBA; type = GL_UNSIGNED_BYTE; break; -#if SDL_HAVE_YUV case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_NV12: @@ -1378,7 +1349,6 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) format = GL_LUMINANCE; type = GL_UNSIGNED_BYTE; break; -#endif #ifdef GL_TEXTURE_EXTERNAL_OES case SDL_PIXELFORMAT_EXTERNAL_OES: format = GL_NONE; @@ -2101,10 +2071,8 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); renderer->info.max_texture_height = value; -#if USE_VERTEX_BUFFER_OBJECTS /* we keep a few of these and cycle through them, so data can live for a few frames. */ data->glGenBuffers(SDL_arraysize(data->vertex_buffers), data->vertex_buffers); -#endif data->framebuffers = NULL; data->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &window_framebuffer); @@ -2137,12 +2105,11 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->SetVSync = GLES2_SetVSync; renderer->GL_BindTexture = GLES2_BindTexture; renderer->GL_UnbindTexture = GLES2_UnbindTexture; -#if SDL_HAVE_YUV + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; -#endif #ifdef GL_TEXTURE_EXTERNAL_OES renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES; #endif @@ -2198,4 +2165,3 @@ SDL_RenderDriver GLES2_RenderDriver = { #endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/externals/SDL/src/render/opengles2/SDL_shaders_gles2.c b/externals/SDL/src/render/opengles2/SDL_shaders_gles2.c index a1f78fdd9..49b2a3606 100755 --- a/externals/SDL/src/render/opengles2/SDL_shaders_gles2.c +++ b/externals/SDL/src/render/opengles2/SDL_shaders_gles2.c @@ -121,8 +121,6 @@ static const Uint8 GLES2_Fragment_TextureBGR[] = " \ } \ "; -#if SDL_HAVE_YUV - #define JPEG_SHADER_CONSTANTS \ "// YUV offset \n" \ "const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \ @@ -301,7 +299,6 @@ static const Uint8 GLES2_Fragment_TextureNV21BT709[] = \ BT709_SHADER_CONSTANTS \ NV21_SHADER_BODY \ ; -#endif /* Custom Android video format texture */ static const Uint8 GLES2_Fragment_TextureExternalOES[] = " \ @@ -338,7 +335,6 @@ const Uint8 *GLES2_GetShader(GLES2_ShaderType type) return GLES2_Fragment_TextureRGB; case GLES2_SHADER_FRAGMENT_TEXTURE_BGR: return GLES2_Fragment_TextureBGR; -#if SDL_HAVE_YUV case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG: return GLES2_Fragment_TextureYUVJPEG; case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601: @@ -361,7 +357,6 @@ const Uint8 *GLES2_GetShader(GLES2_ShaderType type) return GLES2_Fragment_TextureNV21BT601; case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709: return GLES2_Fragment_TextureNV21BT709; -#endif case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES: return GLES2_Fragment_TextureExternalOES; default: diff --git a/externals/SDL/src/render/opengles2/SDL_shaders_gles2.h b/externals/SDL/src/render/opengles2/SDL_shaders_gles2.h index 09780239d..32c4309ca 100755 --- a/externals/SDL/src/render/opengles2/SDL_shaders_gles2.h +++ b/externals/SDL/src/render/opengles2/SDL_shaders_gles2.h @@ -34,7 +34,6 @@ typedef enum GLES2_SHADER_FRAGMENT_TEXTURE_ARGB, GLES2_SHADER_FRAGMENT_TEXTURE_BGR, GLES2_SHADER_FRAGMENT_TEXTURE_RGB, -#if SDL_HAVE_YUV GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG, GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601, GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709, @@ -46,7 +45,6 @@ typedef enum GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709, -#endif GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES, GLES2_SHADER_COUNT } GLES2_ShaderType; diff --git a/externals/SDL/src/render/psp/SDL_render_psp.c b/externals/SDL/src/render/psp/SDL_render_psp.c index cdc0b9156..9431b929b 100755 --- a/externals/SDL/src/render/psp/SDL_render_psp.c +++ b/externals/SDL/src/render/psp/SDL_render_psp.c @@ -442,8 +442,8 @@ TextureSpillLRU(PSP_RenderData* data, size_t wanted) { } LRUTargetRemove(data, lru); } else { - // Asked to spill but there nothing to spill - return SDL_SetError("Could not spill more VRAM to system memory. VRAM : %dKB,(%dKB), wanted %dKB", vmemavail()/1024, vlargestblock()/1024, wanted/1024); + SDL_SetError("Could not spill more VRAM to system memory. VRAM : %dKB,(%dKB), wanted %dKB", vmemavail()/1024, vlargestblock()/1024, wanted/1024); + return -1; //Asked to spill but there nothing to spill } return 0; } @@ -556,8 +556,7 @@ static int TextureShouldSwizzle(PSP_TextureData* psp_texture, SDL_Texture *texture) { return !((texture->access == SDL_TEXTUREACCESS_TARGET) && InVram(psp_texture->data)) - && texture->access != SDL_TEXTUREACCESS_STREAMING - && (texture->w >= 16 || texture->h >= 16); + && (texture->w >= 16 || texture->h >= 16); } static void @@ -775,13 +774,14 @@ PSP_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FR cmd->data.draw.count = count; for (i = 0; i < count; i++, rects++) { - verts->x = rects->x; - verts->y = rects->y; + const SDL_FRect *rect = &rects[i]; + verts->x = rect->x; + verts->y = rect->y; verts->z = 0.0f; verts++; - verts->x = rects->x + rects->w + 0.5f; - verts->y = rects->y + rects->h + 0.5f; + verts->x = rect->x + rect->w; + verts->y = rect->y + rect->h; verts->z = 0.0f; verts++; } @@ -881,7 +881,7 @@ PSP_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * tex static int PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect, - const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y) + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) { VertTV *verts = (VertTV *) SDL_AllocateRenderVertices(renderer, 4 * sizeof (VertTV), 4, &cmd->data.draw.first); const float centerx = center->x; @@ -891,29 +891,27 @@ PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t const float width = dstrect->w - centerx; const float height = dstrect->h - centery; float s, c; - float cw1, sw1, ch1, sh1, cw2, sw2, ch2, sh2; + float cw, sw, ch, sh; float u0 = srcrect->x; float v0 = srcrect->y; float u1 = srcrect->x + srcrect->w; float v1 = srcrect->y + srcrect->h; + + if (!verts) { return -1; } cmd->data.draw.count = 1; - MathSincos(degToRad(360-angle), &s, &c); + MathSincos(degToRad(angle), &s, &c); - cw1 = c * -centerx; - sw1 = s * -centerx; - ch1 = c * -centery; - sh1 = s * -centery; - cw2 = c * width; - sw2 = s * width; - ch2 = c * height; - sh2 = s * height; + cw = c * width; + sw = s * width; + ch = c * height; + sh = s * height; if (flip & SDL_FLIP_VERTICAL) { Swap(&v0, &v1); @@ -925,44 +923,31 @@ PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t verts->u = u0; verts->v = v0; - verts->x = x + cw1 + sh1; - verts->y = y - sw1 + ch1; + verts->x = x - cw + sh; + verts->y = y - sw - ch; verts->z = 0; verts++; verts->u = u0; verts->v = v1; - verts->x = x + cw1 + sh2; - verts->y = y - sw1 + ch2; + verts->x = x - cw - sh; + verts->y = y - sw + ch; verts->z = 0; verts++; verts->u = u1; verts->v = v1; - verts->x = x + cw2 + sh2; - verts->y = y - sw2 + ch2; + verts->x = x + cw - sh; + verts->y = y + sw + ch; verts->z = 0; verts++; verts->u = u1; verts->v = v0; - verts->x = x + cw2 + sh1; - verts->y = y - sw2 + ch1; + verts->x = x + cw + sh; + verts->y = y + sw - ch; verts->z = 0; - - if (scale_x != 1.0f || scale_y != 1.0f) { - verts->x *= scale_x; - verts->y *= scale_y; - verts--; - verts->x *= scale_x; - verts->y *= scale_y; - verts--; - verts->x *= scale_x; - verts->y *= scale_y; - verts--; - verts->x *= scale_x; - verts->y *= scale_y; - } + verts++; return 0; } diff --git a/externals/SDL/src/render/software/SDL_blendfillrect.c b/externals/SDL/src/render/software/SDL_blendfillrect.c index 569c15058..5f4912655 100755 --- a/externals/SDL/src/render/software/SDL_blendfillrect.c +++ b/externals/SDL/src/render/software/SDL_blendfillrect.c @@ -220,7 +220,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, SDL_Rect clipped; if (!dst) { - return SDL_InvalidParamError("SDL_BlendFillRect(): dst"); + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ @@ -291,7 +291,7 @@ SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, int status = 0; if (!dst) { - return SDL_InvalidParamError("SDL_BlendFillRects(): dst"); + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ diff --git a/externals/SDL/src/render/software/SDL_blendline.c b/externals/SDL/src/render/software/SDL_blendline.c index 4921bf101..c38c4425a 100755 --- a/externals/SDL/src/render/software/SDL_blendline.c +++ b/externals/SDL/src/render/software/SDL_blendline.c @@ -809,7 +809,7 @@ SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, BlendLineFunc func; if (!dst) { - return SDL_InvalidParamError("SDL_BlendLine(): dst"); + return SDL_SetError("SDL_BlendLine(): Passed NULL destination surface"); } func = SDL_CalculateBlendLineFunc(dst->format); diff --git a/externals/SDL/src/render/software/SDL_blendpoint.c b/externals/SDL/src/render/software/SDL_blendpoint.c index 613169b7b..d5b662cce 100755 --- a/externals/SDL/src/render/software/SDL_blendpoint.c +++ b/externals/SDL/src/render/software/SDL_blendpoint.c @@ -218,7 +218,7 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r Uint8 g, Uint8 b, Uint8 a) { if (!dst) { - return SDL_InvalidParamError("SDL_BlendPoint(): dst"); + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ @@ -287,7 +287,7 @@ SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count, int status = 0; if (!dst) { - return SDL_InvalidParamError("SDL_BlendPoints(): dst"); + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ diff --git a/externals/SDL/src/render/software/SDL_drawline.c b/externals/SDL/src/render/software/SDL_drawline.c index e309f1619..8dbd3d219 100755 --- a/externals/SDL/src/render/software/SDL_drawline.c +++ b/externals/SDL/src/render/software/SDL_drawline.c @@ -144,7 +144,7 @@ SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color) DrawLineFunc func; if (!dst) { - return SDL_InvalidParamError("SDL_DrawLine(): dst"); + return SDL_SetError("SDL_DrawLine(): Passed NULL destination surface"); } func = SDL_CalculateDrawLineFunc(dst->format); @@ -173,7 +173,7 @@ SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count, DrawLineFunc func; if (!dst) { - return SDL_InvalidParamError("SDL_DrawLines(): dst"); + return SDL_SetError("SDL_DrawLines(): Passed NULL destination surface"); } func = SDL_CalculateDrawLineFunc(dst->format); diff --git a/externals/SDL/src/render/software/SDL_drawpoint.c b/externals/SDL/src/render/software/SDL_drawpoint.c index b99838ac6..999f015cd 100755 --- a/externals/SDL/src/render/software/SDL_drawpoint.c +++ b/externals/SDL/src/render/software/SDL_drawpoint.c @@ -30,7 +30,7 @@ int SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color) { if (!dst) { - return SDL_InvalidParamError("SDL_DrawPoint(): dst"); + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ @@ -71,7 +71,7 @@ SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count, int x, y; if (!dst) { - return SDL_InvalidParamError("SDL_DrawPoints(): dst"); + return SDL_SetError("Passed NULL destination surface"); } /* This function doesn't work on surfaces < 8 bpp */ diff --git a/externals/SDL/src/render/software/SDL_render_sw.c b/externals/SDL/src/render/software/SDL_render_sw.c index a1af12cd6..7a2aac295 100755 --- a/externals/SDL/src/render/software/SDL_render_sw.c +++ b/externals/SDL/src/render/software/SDL_render_sw.c @@ -99,7 +99,8 @@ SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } - return SDL_SetError("Software renderer doesn't have an output surface"); + SDL_SetError("Software renderer doesn't have an output surface"); + return -1; } static int @@ -273,14 +274,12 @@ typedef struct CopyExData double angle; SDL_FPoint center; SDL_RendererFlip flip; - float scale_x; - float scale_y; } CopyExData; static int SW_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect, - const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y) + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) { CopyExData *verts = (CopyExData *) SDL_AllocateRenderVertices(renderer, sizeof (CopyExData), 0, &cmd->data.draw.first); @@ -299,41 +298,21 @@ SW_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * te verts->angle = angle; SDL_memcpy(&verts->center, center, sizeof (SDL_FPoint)); verts->flip = flip; - verts->scale_x = scale_x; - verts->scale_y = scale_y; return 0; } -static int -Blit_to_Screen(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *surface, SDL_Rect *dstrect, - float scale_x, float scale_y, SDL_ScaleMode scaleMode) -{ - int retval; - /* Renderer scaling, if needed */ - if (scale_x != 1.0f || scale_y != 1.0f) { - SDL_Rect r; - r.x = (int)((float) dstrect->x * scale_x); - r.y = (int)((float) dstrect->y * scale_y); - r.w = (int)((float) dstrect->w * scale_x); - r.h = (int)((float) dstrect->h * scale_y); - retval = SDL_PrivateUpperBlitScaled(src, srcrect, surface, &r, scaleMode); - } else { - retval = SDL_BlitSurface(src, srcrect, surface, dstrect); - } - return retval; -} - static int SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * final_rect, - const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip, float scale_x, float scale_y) + const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip) { SDL_Surface *src = (SDL_Surface *) texture->driverdata; SDL_Rect tmp_rect; SDL_Surface *src_clone, *src_rotated, *src_scaled; SDL_Surface *mask = NULL, *mask_rotated = NULL; - int retval = 0; + int retval = 0, dstwidth, dstheight, abscenterx, abscentery; + double cangle, sangle, px, py, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y; SDL_BlendMode blendmode; Uint8 alphaMod, rMod, gMod, bMod; int applyModulation = SDL_FALSE; @@ -435,32 +414,53 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex SDL_SetSurfaceBlendMode(src_clone, blendmode); if (!retval) { - SDL_Rect rect_dest; - double cangle, sangle; - - SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, center, - &rect_dest, &cangle, &sangle); - src_rotated = SDLgfx_rotateSurface(src_clone, angle, - (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, - &rect_dest, cangle, sangle, center); + SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle); + src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); if (src_rotated == NULL) { retval = -1; } if (!retval && mask != NULL) { /* The mask needed for the NONE blend mode gets rotated with the same parameters. */ - mask_rotated = SDLgfx_rotateSurface(mask, angle, - SDL_FALSE, 0, 0, - &rect_dest, cangle, sangle, center); + mask_rotated = SDLgfx_rotateSurface(mask, angle, dstwidth/2, dstheight/2, SDL_FALSE, 0, 0, dstwidth, dstheight, cangle, sangle); if (mask_rotated == NULL) { retval = -1; } } if (!retval) { + /* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */ + abscenterx = final_rect->x + (int)center->x; + abscentery = final_rect->y + (int)center->y; + /* Compensate the angle inversion to match the behaviour of the other backends */ + sangle = -sangle; - tmp_rect.x = final_rect->x + rect_dest.x; - tmp_rect.y = final_rect->y + rect_dest.y; - tmp_rect.w = rect_dest.w; - tmp_rect.h = rect_dest.h; + /* Top Left */ + px = final_rect->x - abscenterx; + py = final_rect->y - abscentery; + p1x = px * cangle - py * sangle + abscenterx; + p1y = px * sangle + py * cangle + abscentery; + + /* Top Right */ + px = final_rect->x + final_rect->w - abscenterx; + py = final_rect->y - abscentery; + p2x = px * cangle - py * sangle + abscenterx; + p2y = px * sangle + py * cangle + abscentery; + + /* Bottom Left */ + px = final_rect->x - abscenterx; + py = final_rect->y + final_rect->h - abscentery; + p3x = px * cangle - py * sangle + abscenterx; + p3y = px * sangle + py * cangle + abscentery; + + /* Bottom Right */ + px = final_rect->x + final_rect->w - abscenterx; + py = final_rect->y + final_rect->h - abscentery; + p4x = px * cangle - py * sangle + abscenterx; + p4y = px * sangle + py * cangle + abscentery; + + tmp_rect.x = (int)MIN(MIN(p1x, p2x), MIN(p3x, p4x)); + tmp_rect.y = (int)MIN(MIN(p1y, p2y), MIN(p3y, p4y)); + tmp_rect.w = dstwidth; + tmp_rect.h = dstheight; /* The NONE blend mode needs some special care with non-opaque surfaces. * Other blend modes or opaque surfaces can be blitted directly. @@ -471,8 +471,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex SDL_SetSurfaceAlphaMod(src_rotated, alphaMod); SDL_SetSurfaceColorMod(src_rotated, rMod, gMod, bMod); } - /* Renderer scaling, if needed */ - retval = Blit_to_Screen(src_rotated, NULL, surface, &tmp_rect, scale_x, scale_y, texture->scaleMode); + retval = SDL_BlitSurface(src_rotated, NULL, surface, &tmp_rect); } else { /* The NONE blend mode requires three steps to get the pixels onto the destination surface. * First, the area where the rotated pixels will be blitted to get set to zero. @@ -481,8 +480,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex */ SDL_Rect mask_rect = tmp_rect; SDL_SetSurfaceBlendMode(mask_rotated, SDL_BLENDMODE_NONE); - /* Renderer scaling, if needed */ - retval = Blit_to_Screen(mask_rotated, NULL, surface, &mask_rect, scale_x, scale_y, texture->scaleMode); + retval = SDL_BlitSurface(mask_rotated, NULL, surface, &mask_rect); if (!retval) { /* The next step copies the alpha value. This is done with the BLEND blend mode and * by modulating the source colors with 0. Since the destination is all zeros, this @@ -490,8 +488,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex */ SDL_SetSurfaceColorMod(src_rotated, 0, 0, 0); mask_rect = tmp_rect; - /* Renderer scaling, if needed */ - retval = Blit_to_Screen(src_rotated, NULL, surface, &mask_rect, scale_x, scale_y, texture->scaleMode); + retval = SDL_BlitSurface(src_rotated, NULL, surface, &mask_rect); if (!retval) { /* The last step gets the color values in place. The ADD blend mode simply adds them to * the destination (where the color values are all zero). However, because the ADD blend @@ -507,8 +504,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex retval = -1; } else { SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD); - /* Renderer scaling, if needed */ - retval = Blit_to_Screen(src_rotated_rgb, NULL, surface, &tmp_rect, scale_x, scale_y, texture->scaleMode); + retval = SDL_BlitSurface(src_rotated_rgb, NULL, surface, &tmp_rect); SDL_FreeSurface(src_rotated_rgb); } } @@ -827,42 +823,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic * to avoid potentially frequent RLE encoding/decoding. */ SDL_SetSurfaceRLE(surface, 0); - - /* Prevent to do scaling + clipping on viewport boundaries as it may lose proportion */ - if (dstrect->x < 0 || dstrect->y < 0 || dstrect->x + dstrect->w > surface->w || dstrect->y + dstrect->h > surface->h) { - SDL_Surface *tmp = SDL_CreateRGBSurfaceWithFormat(0, dstrect->w, dstrect->h, 0, src->format->format); - /* Scale to an intermediate surface, then blit */ - if (tmp) { - SDL_Rect r; - SDL_BlendMode blendmode; - Uint8 alphaMod, rMod, gMod, bMod; - - SDL_GetSurfaceBlendMode(src, &blendmode); - SDL_GetSurfaceAlphaMod(src, &alphaMod); - SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod); - - r.x = 0; - r.y = 0; - r.w = dstrect->w; - r.h = dstrect->h; - - SDL_SetSurfaceBlendMode(src, SDL_BLENDMODE_NONE); - SDL_SetSurfaceColorMod(src, 255, 255, 255); - SDL_SetSurfaceAlphaMod(src, 255); - - SDL_PrivateUpperBlitScaled(src, srcrect, tmp, &r, texture->scaleMode); - - SDL_SetSurfaceColorMod(tmp, rMod, gMod, bMod); - SDL_SetSurfaceAlphaMod(tmp, alphaMod); - SDL_SetSurfaceBlendMode(tmp, blendmode); - - SDL_BlitSurface(tmp, NULL, surface, dstrect); - SDL_FreeSurface(tmp); - /* No need to set back r/g/b/a/blendmode to 'src' since it's done in PrepTextureForCopy() */ - } - } else{ - SDL_PrivateUpperBlitScaled(src, srcrect, surface, dstrect, texture->scaleMode); - } + SDL_PrivateUpperBlitScaled(src, srcrect, surface, dstrect, texture->scaleMode); } break; } @@ -879,8 +840,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } SW_RenderCopyEx(renderer, surface, cmd->data.draw.texture, ©data->srcrect, - ©data->dstrect, copydata->angle, ©data->center, copydata->flip, - copydata->scale_x, copydata->scale_y); + ©data->dstrect, copydata->angle, ©data->center, copydata->flip); break; } @@ -1017,7 +977,7 @@ SW_CreateRendererForSurface(SDL_Surface * surface) SW_RenderData *data; if (!surface) { - SDL_InvalidParamError("surface"); + SDL_SetError("Can't create renderer for NULL surface"); return NULL; } diff --git a/externals/SDL/src/render/software/SDL_rotate.c b/externals/SDL/src/render/software/SDL_rotate.c index d5ffc147a..b5ac715e8 100755 --- a/externals/SDL/src/render/software/SDL_rotate.c +++ b/externals/SDL/src/render/software/SDL_rotate.c @@ -61,6 +61,11 @@ typedef struct tColorY { Uint8 y; } tColorY; +/* ! +\brief Returns maximum of two numbers a and b. +*/ +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) + /* ! \brief Number of guard rows added to destination surfaces. @@ -77,7 +82,7 @@ to a situation where the program can segfault. \brief Returns colorkey info for a surface */ static Uint32 -get_colorkey(SDL_Surface *src) +_colorkey(SDL_Surface *src) { Uint32 key = 0; if (SDL_HasColorKey(src)) { @@ -86,18 +91,6 @@ get_colorkey(SDL_Surface *src) return key; } -/* rotate (sx, sy) by (angle, center) into (dx, dy) */ -static void -rotate(double sx, double sy, double sinangle, double cosangle, const SDL_FPoint *center, double *dx, double *dy) { - sx -= center->x; - sy -= center->y; - - *dx = cosangle * sx - sinangle * sy; - *dy = sinangle * sx + cosangle * sy; - - *dx += center->x; - *dy += center->y; -} /* ! \brief Internal target surface sizing function for rotations with trig result return. @@ -112,61 +105,49 @@ rotate(double sx, double sy, double sinangle, double cosangle, const SDL_FPoint */ void -SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FPoint *center, - SDL_Rect *rect_dest, double *cangle, double *sangle) +SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, + int *dstwidth, int *dstheight, + double *cangle, double *sangle) { - int minx, maxx, miny, maxy; - double radangle; - double x0, x1, x2, x3; - double y0, y1, y2, y3; - double sinangle; - double cosangle; - - radangle = angle * (M_PI / 180.0); - sinangle = SDL_sin(radangle); - cosangle = SDL_cos(radangle); - - /* - * Determine destination width and height by rotating a source box, at pixel center - */ - rotate(0.5, 0.5, sinangle, cosangle, center, &x0, &y0); - rotate(width - 0.5, 0.5, sinangle, cosangle, center, &x1, &y1); - rotate(0.5, height - 0.5, sinangle, cosangle, center, &x2, &y2); - rotate(width - 0.5, height - 0.5, sinangle, cosangle, center, &x3, &y3); - - minx = (int)SDL_floor( SDL_min( SDL_min(x0, x1), SDL_min(x2, x3) ) ); - maxx = (int)SDL_ceil( SDL_max( SDL_max(x0, x1), SDL_max(x2, x3) ) ); - - miny = (int)SDL_floor( SDL_min( SDL_min(y0, y1), SDL_min(y2, y3) ) ); - maxy = (int)SDL_ceil( SDL_max( SDL_max(y0, y1), SDL_max(y2, y3) ) ); - - rect_dest->w = maxx - minx; - rect_dest->h = maxy - miny; - rect_dest->x = minx; - rect_dest->y = miny; - - /* reverse the angle because our rotations are clockwise */ - *sangle = -sinangle; - *cangle = cosangle; - - { - /* The trig code below gets the wrong size (due to FP inaccuracy?) when angle is a multiple of 90 degrees */ - int angle90 = (int)(angle/90); - if(angle90 == angle/90) { /* if the angle is a multiple of 90 degrees */ - angle90 %= 4; - if(angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */ - if(angle90 & 1) { - rect_dest->w = height; - rect_dest->h = width; - *cangle = 0; - *sangle = angle90 == 1 ? -1 : 1; /* reversed because our rotations are clockwise */ - } else { - rect_dest->w = width; - rect_dest->h = height; - *cangle = angle90 == 0 ? 1 : -1; - *sangle = 0; - } + /* The trig code below gets the wrong size (due to FP inaccuracy?) when angle is a multiple of 90 degrees */ + int angle90 = (int)(angle/90); + if(angle90 == angle/90) { /* if the angle is a multiple of 90 degrees */ + angle90 %= 4; + if(angle90 < 0) angle90 += 4; /* 0:0 deg, 1:90 deg, 2:180 deg, 3:270 deg */ + if(angle90 & 1) { + *dstwidth = height; + *dstheight = width; + *cangle = 0; + *sangle = angle90 == 1 ? -1 : 1; /* reversed because our rotations are clockwise */ + } else { + *dstwidth = width; + *dstheight = height; + *cangle = angle90 == 0 ? 1 : -1; + *sangle = 0; } + } else { + double x, y, cx, cy, sx, sy; + double radangle; + int dstwidthhalf, dstheighthalf; + /* + * Determine destination width and height by rotating a centered source box + */ + radangle = angle * (M_PI / -180.0); /* reverse the angle because our rotations are clockwise */ + *sangle = SDL_sin(radangle); + *cangle = SDL_cos(radangle); + x = (double)(width / 2); + y = (double)(height / 2); + cx = *cangle * x; + cy = *cangle * y; + sx = *sangle * x; + sy = *sangle * y; + + dstwidthhalf = MAX((int) + SDL_ceil(MAX(MAX(MAX(SDL_fabs(cx + sy), SDL_fabs(cx - sy)), SDL_fabs(-cx + sy)), SDL_fabs(-cx - sy))), 1); + dstheighthalf = MAX((int) + SDL_ceil(MAX(MAX(MAX(SDL_fabs(sx + cy), SDL_fabs(sx - cy)), SDL_fabs(-sx + cy)), SDL_fabs(-sx - cy))), 1); + *dstwidth = 2 * dstwidthhalf; + *dstheight = 2 * dstheighthalf; } } @@ -239,56 +220,48 @@ Assumes dst surface was allocated with the correct dimensions. \param src Source surface. \param dst Destination surface. +\param cx Horizontal center coordinate. +\param cy Vertical center coordinate. \param isin Integer version of sine of angle. \param icos Integer version of cosine of angle. \param flipx Flag indicating horizontal mirroring should be applied. \param flipy Flag indicating vertical mirroring should be applied. \param smooth Flag indicating anti-aliasing should be used. -\param dst_rect destination coordinates -\param center true center. */ static void -transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int isin, int icos, - int flipx, int flipy, int smooth, - const SDL_Rect *rect_dest, - const SDL_FPoint *center) +_transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth) { - int sw, sh; - int cx, cy; + int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh; tColorRGBA c00, c01, c10, c11, cswap; tColorRGBA *pc, *sp; int gap; - const int fp_half = (1<<15); /* * Variable setup */ + xd = ((src->w - dst->w) << 15); + yd = ((src->h - dst->h) << 15); + ax = (cx << 16) - (icos * cx); + ay = (cy << 16) - (isin * cx); sw = src->w - 1; sh = src->h - 1; pc = (tColorRGBA*) dst->pixels; gap = dst->pitch - dst->w * 4; - cx = (int)(center->x * 65536.0); - cy = (int)(center->y * 65536.0); /* * Switch between interpolating and non-interpolating code */ if (smooth) { - int y; for (y = 0; y < dst->h; y++) { - int x; - double src_x = (rect_dest->x + 0 + 0.5 - center->x); - double src_y = (rect_dest->y + y + 0.5 - center->y); - int sdx = (int)((icos * src_x - isin * src_y) + cx - fp_half); - int sdy = (int)((isin * src_x + icos * src_y) + cy - fp_half); + dy = cy - y; + sdx = (ax + (isin * dy)) + xd; + sdy = (ay - (icos * dy)) + yd; for (x = 0; x < dst->w; x++) { - int dx = (sdx >> 16); - int dy = (sdy >> 16); + dx = (sdx >> 16); + dy = (sdy >> 16); if (flipx) dx = sw - dx; if (flipy) dy = sh - dy; if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) { - int ex, ey; - int t1, t2; sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy) + dx; c00 = *sp; sp += 1; @@ -330,16 +303,13 @@ transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int isin, int icos, pc = (tColorRGBA *) ((Uint8 *) pc + gap); } } else { - int y; for (y = 0; y < dst->h; y++) { - int x; - double src_x = (rect_dest->x + 0 + 0.5 - center->x); - double src_y = (rect_dest->y + y + 0.5 - center->y); - int sdx = (int)((icos * src_x - isin * src_y) + cx - fp_half); - int sdy = (int)((isin * src_x + icos * src_y) + cy - fp_half); + dy = cy - y; + sdx = (ax + (isin * dy)) + xd; + sdy = (ay - (icos * dy)) + yd; for (x = 0; x < dst->w; x++) { - int dx = (sdx >> 16); - int dy = (sdy >> 16); + dx = (sdx >> 16); + dy = (sdy >> 16); if ((unsigned)dx < (unsigned)src->w && (unsigned)dy < (unsigned)src->h) { if(flipx) dx = sw - dx; if(flipy) dy = sh - dy; @@ -365,54 +335,46 @@ Assumes dst surface was allocated with the correct dimensions. \param src Source surface. \param dst Destination surface. +\param cx Horizontal center coordinate. +\param cy Vertical center coordinate. \param isin Integer version of sine of angle. \param icos Integer version of cosine of angle. \param flipx Flag indicating horizontal mirroring should be applied. \param flipy Flag indicating vertical mirroring should be applied. -\param dst_rect destination coordinates -\param center true center. */ static void -transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int isin, int icos, int flipx, int flipy, - const SDL_Rect *rect_dest, - const SDL_FPoint *center) +transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy) { - int sw, sh; - int cx, cy; + int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay; tColorY *pc; int gap; - const int fp_half = (1<<15); - int y; /* * Variable setup */ - sw = src->w - 1; - sh = src->h - 1; + xd = ((src->w - dst->w) << 15); + yd = ((src->h - dst->h) << 15); + ax = (cx << 16) - (icos * cx); + ay = (cy << 16) - (isin * cx); pc = (tColorY*) dst->pixels; gap = dst->pitch - dst->w; - cx = (int)(center->x * 65536.0); - cy = (int)(center->y * 65536.0); - /* * Clear surface to colorkey */ - SDL_memset(pc, (int)(get_colorkey(src) & 0xff), dst->pitch * dst->h); + SDL_memset(pc, (int)(_colorkey(src) & 0xff), dst->pitch * dst->h); /* * Iterate through destination surface */ for (y = 0; y < dst->h; y++) { - int x; - double src_x = (rect_dest->x + 0 + 0.5 - center->x); - double src_y = (rect_dest->y + y + 0.5 - center->y); - int sdx = (int)((icos * src_x - isin * src_y) + cx - fp_half); - int sdy = (int)((isin * src_x + icos * src_y) + cy - fp_half); + dy = cy - y; + sdx = (ax + (isin * dy)) + xd; + sdy = (ay - (icos * dy)) + yd; for (x = 0; x < dst->w; x++) { - int dx = (sdx >> 16); - int dy = (sdy >> 16); + dx = (sdx >> 16); + dy = (sdy >> 16); if ((unsigned)dx < (unsigned)src->w && (unsigned)dy < (unsigned)src->h) { - if (flipx) dx = sw - dx; - if (flipy) dy = sh- dy; + if (flipx) dx = (src->w-1)-dx; + if (flipy) dy = (src->h-1)-dy; *pc = *((tColorY *)src->pixels + src->pitch * dy + dx); } sdx += icos; @@ -428,7 +390,7 @@ transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int isin, int icos, int \brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. Rotates a 32-bit or 8-bit 'src' surface to newly created 'dst' surface. -'angle' is the rotation in degrees, 'center' the rotation center. If 'smooth' is set +'angle' is the rotation in degrees, 'centerx' and 'centery' the rotation center. If 'smooth' is set then the destination 32-bit surface is anti-aliased. 8-bit surfaces must have a colorkey. 32-bit surfaces must have a 8888 layout with red, green, blue and alpha masks (any ordering goes). The blend mode of the 'src' surface has some effects on generation of the 'dst' surface: The NONE @@ -438,21 +400,21 @@ When using the NONE and MOD modes, color and alpha modulation must be applied be \param src The surface to rotozoom. \param angle The angle to rotate in degrees. +\param centerx The horizontal coordinate of the center of rotation \param zoomy The vertical coordinate of the center of rotation \param smooth Antialiasing flag; set to SMOOTHING_ON to enable. \param flipx Set to 1 to flip the image horizontally \param flipy Set to 1 to flip the image vertically -\param rect_dest The destination rect bounding box +\param dstwidth The destination surface width +\param dstheight The destination surface height \param cangle The angle cosine \param sangle The angle sine -\param center The true coordinate of the center of rotation \return The new rotated surface. */ SDL_Surface * -SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int flipy, - const SDL_Rect *rect_dest, double cangle, double sangle, const SDL_FPoint *center) +SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle) { SDL_Surface *rz_dst; int is8bit, angle90; @@ -471,6 +433,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int colorKeyAvailable = SDL_TRUE; } } + /* This function requires a 32-bit surface or 8-bit surface with a colorkey */ is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable; if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask))) @@ -484,18 +447,16 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int rz_dst = NULL; if (is8bit) { /* Target surface is 8 bit */ - rz_dst = SDL_CreateRGBSurfaceWithFormat(0, rect_dest->w, rect_dest->h + GUARD_ROWS, 8, src->format->format); + rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0); if (rz_dst != NULL) { - if (src->format->palette) { - for (i = 0; i < src->format->palette->ncolors; i++) { - rz_dst->format->palette->colors[i] = src->format->palette->colors[i]; - } - rz_dst->format->palette->ncolors = src->format->palette->ncolors; + for (i = 0; i < src->format->palette->ncolors; i++) { + rz_dst->format->palette->colors[i] = src->format->palette->colors[i]; } + rz_dst->format->palette->ncolors = src->format->palette->ncolors; } } else { /* Target surface is 32 bit with source RGBA ordering */ - rz_dst = SDL_CreateRGBSurface(0, rect_dest->w, rect_dest->h + GUARD_ROWS, 32, + rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 32, src->format->Rmask, src->format->Gmask, src->format->Bmask, src->format->Amask); } @@ -505,7 +466,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int return NULL; /* Adjust for guard rows */ - rz_dst->h = rect_dest->h; + rz_dst->h = dstheight; SDL_GetSurfaceBlendMode(src, &blendmode); @@ -536,7 +497,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int } /* check if the rotation is a multiple of 90 degrees so we can take a fast path and also somewhat reduce - * the off-by-one problem in transformSurfaceRGBA that expresses itself when the rotation is near + * the off-by-one problem in _transformSurfaceRGBA that expresses itself when the rotation is near * multiples of 90 degrees. */ angle90 = (int)(angle/90); @@ -552,16 +513,16 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int if(angle90 >= 0) { transformSurfaceY90(src, rz_dst, angle90, flipx, flipy); } else { - transformSurfaceY(src, rz_dst, (int)sangleinv, (int)cangleinv, - flipx, flipy, rect_dest, center); + transformSurfaceY(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, + flipx, flipy); } } else { /* Call the 32-bit transformation routine to do the rotation */ if (angle90 >= 0) { transformSurfaceRGBA90(src, rz_dst, angle90, flipx, flipy); } else { - transformSurfaceRGBA(src, rz_dst, (int)sangleinv, (int)cangleinv, - flipx, flipy, smooth, rect_dest, center); + _transformSurfaceRGBA(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, + flipx, flipy, smooth); } } diff --git a/externals/SDL/src/render/software/SDL_rotate.h b/externals/SDL/src/render/software/SDL_rotate.h index 8d7ec9d28..e1746c92c 100755 --- a/externals/SDL/src/render/software/SDL_rotate.h +++ b/externals/SDL/src/render/software/SDL_rotate.h @@ -22,9 +22,11 @@ #ifndef SDL_rotate_h_ #define SDL_rotate_h_ -extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int flipy, - const SDL_Rect *rect_dest, double cangle, double sangle, const SDL_FPoint *center); -extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, const SDL_FPoint *center, - SDL_Rect *rect_dest, double *cangle, double *sangle); +#ifndef MIN +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle); +extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle); #endif /* SDL_rotate_h_ */ diff --git a/externals/SDL/src/render/software/SDL_triangle.c b/externals/SDL/src/render/software/SDL_triangle.c index 694cb4d91..ce003e169 100755 --- a/externals/SDL/src/render/software/SDL_triangle.c +++ b/externals/SDL/src/render/software/SDL_triangle.c @@ -718,21 +718,6 @@ end: } -#define FORMAT_ALPHA 0 -#define FORMAT_NO_ALPHA -1 -#define FORMAT_2101010 1 -#define FORMAT_HAS_ALPHA(format) format == 0 -#define FORMAT_HAS_NO_ALPHA(format) format < 0 -static int SDL_INLINE detect_format(SDL_PixelFormat *pf) { - if (pf->format == SDL_PIXELFORMAT_ARGB2101010) { - return FORMAT_2101010; - } else if (pf->Amask) { - return FORMAT_ALPHA; - } else { - return FORMAT_NO_ALPHA; - } -} - static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info, SDL_Point s2_x_area, SDL_Rect dstrect, int area, int bias_w0, int bias_w1, int bias_w2, @@ -753,32 +738,25 @@ SDL_BlitTriangle_Slow(SDL_BlitInfo *info, SDL_PixelFormat *dst_fmt = info->dst_fmt; int srcbpp = src_fmt->BytesPerPixel; int dstbpp = dst_fmt->BytesPerPixel; - int srcfmt_val; - int dstfmt_val; Uint32 rgbmask = ~src_fmt->Amask; Uint32 ckey = info->colorkey & rgbmask; Uint8 *dst_ptr = info->dst; int dst_pitch = info->dst_pitch;; - srcfmt_val = detect_format(src_fmt); - dstfmt_val = detect_format(dst_fmt); - TRIANGLE_BEGIN_LOOP { Uint8 *src; Uint8 *dst = dptr; TRIANGLE_GET_TEXTCOORD src = (info->src + (srcy * info->src_pitch) + (srcx * srcbpp)); - if (FORMAT_HAS_ALPHA(srcfmt_val)) { - DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB, srcA); - } else if (FORMAT_HAS_NO_ALPHA(srcfmt_val)) { - DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB); - srcA = 0xFF; + if (src_fmt->Amask) { + DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, + srcB, srcA); } else { - /* SDL_PIXELFORMAT_ARGB2101010 */ - srcpixel = *((Uint32 *)(src)); - RGBA_FROM_ARGB2101010(srcpixel, srcR, srcG, srcB, srcA); + DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, + srcB); + srcA = 0xFF; } if (flags & SDL_COPY_COLORKEY) { /* srcpixel isn't set for 24 bpp */ @@ -790,15 +768,13 @@ SDL_BlitTriangle_Slow(SDL_BlitInfo *info, continue; } } - if (FORMAT_HAS_ALPHA(dstfmt_val)) { - DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA); - } else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) { - DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB); - dstA = 0xFF; + if (dst_fmt->Amask) { + DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, + dstB, dstA); } else { - /* SDL_PIXELFORMAT_ARGB2101010 */ - dstpixel = *((Uint32 *)(dst)); - RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA); + DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, + dstB); + dstA = 0xFF; } if (! is_uniform) { @@ -869,15 +845,10 @@ SDL_BlitTriangle_Slow(SDL_BlitInfo *info, dstA = 255; break; } - if (FORMAT_HAS_ALPHA(dstfmt_val)) { + if (dst_fmt->Amask) { ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA); - } else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) { - ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); } else { - /* SDL_PIXELFORMAT_ARGB2101010 */ - Uint32 pixel; - ARGB2101010_FROM_RGBA(pixel, dstR, dstG, dstB, dstA); - *(Uint32 *)dst = pixel; + ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); } } TRIANGLE_END_LOOP diff --git a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm.c b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm.c index 98b03e629..937701298 100755 --- a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm.c @@ -61,11 +61,6 @@ static int VITA_GXM_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * text const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch); -static int VITA_GXM_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * rect, - const Uint8 *Yplane, int Ypitch, - const Uint8 *UVplane, int UVpitch); - static int VITA_GXM_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch); @@ -110,16 +105,12 @@ SDL_RenderDriver VITA_GXM_RenderDriver = { .info = { .name = "VITA gxm", .flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE, - .num_texture_formats = 8, + .num_texture_formats = 4, .texture_formats = { [0] = SDL_PIXELFORMAT_ABGR8888, [1] = SDL_PIXELFORMAT_ARGB8888, [2] = SDL_PIXELFORMAT_RGB565, - [3] = SDL_PIXELFORMAT_BGR565, - [4] = SDL_PIXELFORMAT_YV12, - [5] = SDL_PIXELFORMAT_IYUV, - [6] = SDL_PIXELFORMAT_NV12, - [7] = SDL_PIXELFORMAT_NV21, + [3] = SDL_PIXELFORMAT_BGR565 }, .max_texture_width = 4096, .max_texture_height = 4096, @@ -142,15 +133,6 @@ PixelFormatToVITAFMT(Uint32 format) return SCE_GXM_TEXTURE_FORMAT_U5U6U5_RGB; case SDL_PIXELFORMAT_BGR565: return SCE_GXM_TEXTURE_FORMAT_U5U6U5_BGR; - case SDL_PIXELFORMAT_YV12: - return SCE_GXM_TEXTURE_FORMAT_YVU420P3_CSC0; - case SDL_PIXELFORMAT_IYUV: - return SCE_GXM_TEXTURE_FORMAT_YUV420P3_CSC0; - // should be the other way around. looks like SCE bug. - case SDL_PIXELFORMAT_NV12: - return SCE_GXM_TEXTURE_FORMAT_YVU420P2_CSC0; - case SDL_PIXELFORMAT_NV21: - return SCE_GXM_TEXTURE_FORMAT_YUV420P2_CSC0; default: return SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ABGR; } @@ -235,7 +217,7 @@ VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags) data = (VITA_GXM_RenderData *) SDL_calloc(1, sizeof(VITA_GXM_RenderData)); if (!data) { - SDL_free(renderer); + VITA_GXM_DestroyRenderer(renderer); SDL_OutOfMemory(); return NULL; } @@ -244,10 +226,7 @@ VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->SupportsBlendMode = VITA_GXM_SupportsBlendMode; renderer->CreateTexture = VITA_GXM_CreateTexture; renderer->UpdateTexture = VITA_GXM_UpdateTexture; -#if SDL_HAVE_YUV renderer->UpdateTextureYUV = VITA_GXM_UpdateTextureYUV; - renderer->UpdateTextureNV = VITA_GXM_UpdateTextureNV; -#endif renderer->LockTexture = VITA_GXM_LockTexture; renderer->UnlockTexture = VITA_GXM_UnlockTexture; renderer->SetTextureScaleMode = VITA_GXM_SetTextureScaleMode; @@ -314,17 +293,7 @@ VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) return SDL_OutOfMemory(); } - vita_texture->tex = create_gxm_texture( - data, - texture->w, - texture->h, - PixelFormatToVITAFMT(texture->format), - (texture->access == SDL_TEXTUREACCESS_TARGET), - &(vita_texture->w), - &(vita_texture->h), - &(vita_texture->pitch), - &(vita_texture->wscale) - ); + vita_texture->tex = create_gxm_texture(data, texture->w, texture->h, PixelFormatToVITAFMT(texture->format), (texture->access == SDL_TEXTUREACCESS_TARGET)); if (!vita_texture->tex) { SDL_free(vita_texture); @@ -335,129 +304,38 @@ VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) VITA_GXM_SetTextureScaleMode(renderer, texture, texture->scaleMode); -#if SDL_HAVE_YUV - vita_texture->yuv = ((texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12)); - vita_texture->nv12 = ((texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21)); -#endif + vita_texture->w = gxm_texture_get_width(vita_texture->tex); + vita_texture->h = gxm_texture_get_height(vita_texture->tex); + vita_texture->pitch = gxm_texture_get_stride(vita_texture->tex); return 0; } -static void VITA_GXM_SetYUVProfile(SDL_Renderer * renderer, SDL_Texture *texture) -{ - VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata; - int ret = 0; - switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { - case SDL_YUV_CONVERSION_BT601: - ret = sceGxmSetYuvProfile(data->gxm_context, 0, SCE_GXM_YUV_PROFILE_BT601_STANDARD); - break; - case SDL_YUV_CONVERSION_BT709: - ret = sceGxmSetYuvProfile(data->gxm_context, 0, SCE_GXM_YUV_PROFILE_BT709_STANDARD); - break; - case SDL_YUV_CONVERSION_JPEG: - default: - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV profile: %d\n", SDL_GetYUVConversionModeForResolution(texture->w, texture->h)); - break; - } - - if (ret < 0) { - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Setting YUV profile failed: %x\n", ret); - } -} static int VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch) { - VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata; + const Uint8 *src; Uint8 *dst; - int row, length, dpitch; - -#if SDL_HAVE_YUV - if (vita_texture->yuv || vita_texture->nv12) { - VITA_GXM_SetYUVProfile(renderer, texture); - } -#endif + int row, length,dpitch; + src = pixels; VITA_GXM_LockTexture(renderer, texture, rect, (void **)&dst, &dpitch); length = rect->w * SDL_BYTESPERPIXEL(texture->format); if (length == pitch && length == dpitch) { - SDL_memcpy(dst, pixels, length*rect->h); + SDL_memcpy(dst, src, length*rect->h); } else { for (row = 0; row < rect->h; ++row) { - SDL_memcpy(dst, pixels, length); - pixels += pitch; + SDL_memcpy(dst, src, length); + src += pitch; dst += dpitch; } } -#if SDL_HAVE_YUV - if (vita_texture->yuv) { - void *Udst; - void *Vdst; - int uv_pitch = (dpitch+1) / 2; - int uv_src_pitch = (pitch+1) / 2; - SDL_Rect UVrect = {rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2}; - - // skip Y plane - Uint8 *Dpixels = gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h); - - Udst = Dpixels + (UVrect.y * uv_pitch) + UVrect.x; - Vdst = Dpixels + (uv_pitch * ((vita_texture->h + 1) / 2)) + (UVrect.y * uv_pitch) + UVrect.x; - - length = UVrect.w; - - // U plane - if (length == uv_src_pitch && length == uv_pitch) { - SDL_memcpy(Udst, pixels, length*UVrect.h); - } else { - for (row = 0; row < UVrect.h; ++row) { - SDL_memcpy(Udst, pixels, length); - pixels += uv_src_pitch; - Udst += uv_pitch; - } - } - - // V plane - if (length == uv_src_pitch && length == uv_pitch) { - SDL_memcpy(Vdst, pixels, length*UVrect.h); - } else { - for (row = 0; row < UVrect.h; ++row) { - SDL_memcpy(Vdst, pixels, length); - pixels += uv_src_pitch; - Vdst += uv_pitch; - } - } - - } else if (vita_texture->nv12) { - void *UVdst; - int uv_pitch = 2 * ((dpitch+1) / 2); - int uv_src_pitch = 2 * ((pitch+1) / 2); - SDL_Rect UVrect = {rect->x / 2, rect->y / 2, (rect->w + 1) / 2 , (rect->h + 1) / 2}; - - // skip Y plane - void *Dpixels = (void *) ((Uint8 *) gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h)); - UVdst = Dpixels + (UVrect.y * uv_pitch) + UVrect.x; - - length = UVrect.w*2; - - // UV plane - if (length == uv_src_pitch && length == uv_pitch) { - SDL_memcpy(UVdst, pixels, length*UVrect.h); - } else { - for (row = 0; row < UVrect.h; ++row) { - SDL_memcpy(UVdst, pixels, length); - pixels += uv_src_pitch; - UVdst += uv_pitch; - } - } - } -#endif - return 0; } -#if SDL_HAVE_YUV static int VITA_GXM_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, @@ -465,133 +343,9 @@ VITA_GXM_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch) { - Uint8 *dst; - int row, length, dpitch; - SDL_Rect UVrect = {rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2}; - - VITA_GXM_SetYUVProfile(renderer, texture); - - // copy Y plane - // obtain pixels via locking so that texture is flushed - VITA_GXM_LockTexture(renderer, texture, rect, (void **)&dst, &dpitch); - - length = rect->w; - - if (length == Ypitch && length == dpitch) { - SDL_memcpy(dst, Yplane, length*rect->h); - } else { - for (row = 0; row < rect->h; ++row) { - SDL_memcpy(dst, Yplane, length); - Yplane += Ypitch; - dst += dpitch; - } - } - - // U/V planes - { - void *Udst; - void *Vdst; - VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata; - int uv_pitch = (dpitch+1) / 2; - - // skip Y plane - void *pixels = (void *) ((Uint8 *) gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h)); - - if (texture->format == SDL_PIXELFORMAT_YV12) { // YVU - Vdst = pixels + (UVrect.y * uv_pitch) + UVrect.x; - Udst = pixels + (uv_pitch * ((vita_texture->h + 1) / 2)) + (UVrect.y * uv_pitch) + UVrect.x; - } else { // YUV - Udst = pixels + (UVrect.y * uv_pitch) + UVrect.x; - Vdst = pixels + (uv_pitch * ((vita_texture->h + 1) / 2)) + (UVrect.y * uv_pitch) + UVrect.x; - } - - length = UVrect.w; - - // U plane - if (length == Upitch && length == uv_pitch) { - SDL_memcpy(Udst, Uplane, length*UVrect.h); - } else { - for (row = 0; row < UVrect.h; ++row) { - SDL_memcpy(Udst, Uplane, length); - Uplane += Upitch; - Udst += uv_pitch; - } - } - - // V plane - if (length == Vpitch && length == uv_pitch) { - SDL_memcpy(Vdst, Vplane, length*UVrect.h); - } else { - for (row = 0; row < UVrect.h; ++row) { - SDL_memcpy(Vdst, Vplane, length); - Vplane += Vpitch; - Vdst += uv_pitch; - } - } - - } - return 0; } -static int -VITA_GXM_UpdateTextureNV(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * rect, - const Uint8 *Yplane, int Ypitch, - const Uint8 *UVplane, int UVpitch) -{ - - Uint8 *dst; - int row, length, dpitch; - SDL_Rect UVrect = {rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2}; - - VITA_GXM_SetYUVProfile(renderer, texture); - - // copy Y plane - VITA_GXM_LockTexture(renderer, texture, rect, (void **)&dst, &dpitch); - - length = rect->w * SDL_BYTESPERPIXEL(texture->format); - - if (length == Ypitch && length == dpitch) { - SDL_memcpy(dst, Yplane, length*rect->h); - } else { - for (row = 0; row < rect->h; ++row) { - SDL_memcpy(dst, Yplane, length); - Yplane += Ypitch; - dst += dpitch; - } - } - - // UV plane - { - void *UVdst; - VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata; - int uv_pitch = 2 * ((dpitch+1) / 2); - - // skip Y plane - void *pixels = (void *) ((Uint8 *) gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h)); - - UVdst = pixels + (UVrect.y * uv_pitch) + UVrect.x; - - length = UVrect.w * 2; - - // UV plane - if (length == UVpitch && length == uv_pitch) { - SDL_memcpy(UVdst, UVplane, length*UVrect.h); - } else { - for (row = 0; row < UVrect.h; ++row) { - SDL_memcpy(UVdst, UVplane, length); - UVplane += UVpitch; - UVdst += uv_pitch; - } - } - } - - return 0; -} - -#endif - static int VITA_GXM_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch) @@ -763,7 +517,6 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu size_indices = indices ? size_indices : 0; if (texture) { - VITA_GXM_TextureData* vita_texture = (VITA_GXM_TextureData*) texture->driverdata; texture_vertex *vertices; vertices = (texture_vertex *)pool_malloc( @@ -796,7 +549,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu vertices[i].x = xy_[0] * scale_x; vertices[i].y = xy_[1] * scale_y; - vertices[i].u = uv_[0] * vita_texture->wscale; + vertices[i].u = uv_[0]; vertices[i].v = uv_[1]; vertices[i].color = col_; } @@ -975,6 +728,14 @@ SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd) return 0; } +static int +SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd) +{ + VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata; + + return SetDrawState(data, cmd); +} + static int VITA_GXM_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize) { @@ -1061,7 +822,11 @@ VITA_GXM_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void * nextcmd = nextcmd->next; } - ret = SetDrawState(data, cmd); + if (thistexture) { + ret = SetCopyState(renderer, cmd); + } else { + ret = SetDrawState(data, cmd); + } if (ret == 0) { int op = SCE_GXM_PRIMITIVE_TRIANGLES; @@ -1246,7 +1011,7 @@ VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) sceGxmFinish(data->gxm_context); - free_gxm_texture(data, vita_texture->tex); + free_gxm_texture(vita_texture->tex); SDL_free(vita_texture); diff --git a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.c b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.c index 85d682ad7..d3322730a 100755 --- a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.c +++ b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.c @@ -26,7 +26,7 @@ #include "SDL_render_vita_gxm_memory.h" void * -vita_mem_alloc(unsigned int type, unsigned int size, unsigned int alignment, unsigned int attribs, SceUID *uid) +mem_gpu_alloc(SceKernelMemBlockType type, unsigned int size, unsigned int alignment, unsigned int attribs, SceUID *uid) { void *mem; @@ -51,7 +51,7 @@ vita_mem_alloc(unsigned int type, unsigned int size, unsigned int alignment, uns } void -vita_mem_free(SceUID uid) +mem_gpu_free(SceUID uid) { void *mem = NULL; if (sceKernelGetMemBlockBase(uid, &mem) < 0) @@ -61,71 +61,7 @@ vita_mem_free(SceUID uid) } void * -vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size) -{ - void *mem; - - if (data->texturePool == NULL) { - int poolsize; - int ret; - SceKernelFreeMemorySizeInfo info; - info.size = sizeof(SceKernelFreeMemorySizeInfo); - sceKernelGetFreeMemorySize(&info); - - poolsize = ALIGN(info.size_cdram, 256*1024); - if (poolsize > info.size_cdram) { - poolsize = ALIGN(info.size_cdram - 256*1024, 256*1024); - } - data->texturePoolUID = sceKernelAllocMemBlock("gpu_texture_pool", SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, poolsize, NULL); - if (data->texturePoolUID < 0) { - return NULL; - } - - ret = sceKernelGetMemBlockBase(data->texturePoolUID, &mem); - if ( ret < 0) - { - return NULL; - } - data->texturePool = sceClibMspaceCreate(mem, poolsize); - - if (data->texturePool == NULL) { - return NULL; - } - ret = sceGxmMapMemory(mem, poolsize, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE); - if (ret < 0) - { - return NULL; - } - } - return sceClibMspaceMemalign(data->texturePool, SCE_GXM_TEXTURE_ALIGNMENT, size); -} - -void -vita_gpu_mem_free(VITA_GXM_RenderData *data, void* ptr) -{ - if (data->texturePool != NULL) - { - sceClibMspaceFree(data->texturePool, ptr); - } -} - -void -vita_gpu_mem_destroy(VITA_GXM_RenderData *data) -{ - void *mem = NULL; - if (data->texturePool != NULL) - { - sceClibMspaceDestroy(data->texturePool); - data->texturePool = NULL; - if (sceKernelGetMemBlockBase(data->texturePoolUID, &mem) < 0) - return; - sceGxmUnmapMemory(mem); - sceKernelFreeMemBlock(data->texturePoolUID); - } -} - -void * -vita_mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) +mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) { void *mem = NULL; @@ -141,7 +77,7 @@ vita_mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_of } void -vita_mem_vertex_usse_free(SceUID uid) +mem_vertex_usse_free(SceUID uid) { void *mem = NULL; if (sceKernelGetMemBlockBase(uid, &mem) < 0) @@ -151,7 +87,7 @@ vita_mem_vertex_usse_free(SceUID uid) } void * -vita_mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) +mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset) { void *mem = NULL; @@ -167,7 +103,7 @@ vita_mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_ } void -vita_mem_fragment_usse_free(SceUID uid) +mem_fragment_usse_free(SceUID uid) { void *mem = NULL; if (sceKernelGetMemBlockBase(uid, &mem) < 0) diff --git a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.h b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.h index 93b9f3498..51bc8a80a 100755 --- a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.h +++ b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.h @@ -25,19 +25,15 @@ #include #include #include -#include "SDL_render_vita_gxm_types.h" #define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) -void *vita_mem_alloc(unsigned int type, unsigned int size, unsigned int alignment, unsigned int attribs, SceUID *uid); -void vita_mem_free(SceUID uid); -void *vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size); -void vita_gpu_mem_free(VITA_GXM_RenderData *data, void* ptr); -void vita_gpu_mem_destroy(VITA_GXM_RenderData *data); -void *vita_mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset); -void vita_mem_vertex_usse_free(SceUID uid); -void *vita_mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset); -void vita_mem_fragment_usse_free(SceUID uid); +void *mem_gpu_alloc(SceKernelMemBlockType type, unsigned int size, unsigned int alignment, unsigned int attribs, SceUID *uid); +void mem_gpu_free(SceUID uid); +void *mem_vertex_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset); +void mem_vertex_usse_free(SceUID uid); +void *mem_fragment_usse_alloc(unsigned int size, SceUID *uid, unsigned int *usse_offset); +void mem_fragment_usse_free(SceUID uid); #endif /* SDL_RENDER_VITA_GXM_MEMORY_H */ diff --git a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.c index 035e8a63c..e043b55ab 100755 --- a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.c +++ b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.c @@ -117,8 +117,6 @@ tex_format_to_bytespp(SceGxmTextureFormat format) case SCE_GXM_TEXTURE_BASE_FORMAT_U8: case SCE_GXM_TEXTURE_BASE_FORMAT_S8: case SCE_GXM_TEXTURE_BASE_FORMAT_P8: - case SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P2: // YUV actually uses 12 bits per pixel. UV planes bits/mem are handled elsewhere - case SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P3: return 1; case SCE_GXM_TEXTURE_BASE_FORMAT_U4U4U4U4: case SCE_GXM_TEXTURE_BASE_FORMAT_U8U3U3U2: @@ -416,28 +414,28 @@ gxm_init(SDL_Renderer *renderer) } // allocate ring buffer memory using default sizes - vdmRingBuffer = vita_mem_alloc( + vdmRingBuffer = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, SCE_GXM_DEFAULT_VDM_RING_BUFFER_SIZE, 4, SCE_GXM_MEMORY_ATTRIB_READ, &data->vdmRingBufferUid); - vertexRingBuffer = vita_mem_alloc( + vertexRingBuffer = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, SCE_GXM_DEFAULT_VERTEX_RING_BUFFER_SIZE, 4, SCE_GXM_MEMORY_ATTRIB_READ, &data->vertexRingBufferUid); - fragmentRingBuffer = vita_mem_alloc( + fragmentRingBuffer = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, SCE_GXM_DEFAULT_FRAGMENT_RING_BUFFER_SIZE, 4, SCE_GXM_MEMORY_ATTRIB_READ, &data->fragmentRingBufferUid); - fragmentUsseRingBuffer = vita_mem_fragment_usse_alloc( + fragmentUsseRingBuffer = mem_fragment_usse_alloc( SCE_GXM_DEFAULT_FRAGMENT_USSE_RING_BUFFER_SIZE, &data->fragmentUsseRingBufferUid, &fragmentUsseRingBufferOffset); @@ -482,7 +480,7 @@ gxm_init(SDL_Renderer *renderer) for (i = 0; i < VITA_GXM_BUFFERS; i++) { // allocate memory for display - data->displayBufferData[i] = vita_mem_alloc( + data->displayBufferData[i] = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, 4 * VITA_GXM_SCREEN_STRIDE * VITA_GXM_SCREEN_HEIGHT, SCE_GXM_COLOR_SURFACE_ALIGNMENT, @@ -527,7 +525,7 @@ gxm_init(SDL_Renderer *renderer) // allocate the depth buffer - data->depthBufferData = vita_mem_alloc( + data->depthBufferData = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, 4 * sampleCount, SCE_GXM_DEPTHSTENCIL_SURFACE_ALIGNMENT, @@ -535,7 +533,7 @@ gxm_init(SDL_Renderer *renderer) &data->depthBufferUid); // allocate the stencil buffer - data->stencilBufferData = vita_mem_alloc( + data->stencilBufferData = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, 4 * sampleCount, SCE_GXM_DEPTHSTENCIL_SURFACE_ALIGNMENT, @@ -567,19 +565,19 @@ gxm_init(SDL_Renderer *renderer) // allocate memory for buffers and USSE code - patcherBuffer = vita_mem_alloc( + patcherBuffer = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, patcherBufferSize, 4, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE, &data->patcherBufferUid); - patcherVertexUsse = vita_mem_vertex_usse_alloc( + patcherVertexUsse = mem_vertex_usse_alloc( patcherVertexUsseSize, &data->patcherVertexUsseUid, &patcherVertexUsseOffset); - patcherFragmentUsse = vita_mem_fragment_usse_alloc( + patcherFragmentUsse = mem_fragment_usse_alloc( patcherFragmentUsseSize, &data->patcherFragmentUsseUid, &patcherFragmentUsseOffset); @@ -730,7 +728,7 @@ gxm_init(SDL_Renderer *renderer) } // create the clear triangle vertex/index data - data->clearVertices = (clear_vertex *)vita_mem_alloc( + data->clearVertices = (clear_vertex *)mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, 3*sizeof(clear_vertex), 4, @@ -742,7 +740,7 @@ gxm_init(SDL_Renderer *renderer) // Allocate a 64k * 2 bytes = 128 KiB buffer and store all possible // 16-bit indices in linear ascending order, so we can use this for // all drawing operations where we don't want to use indexing. - data->linearIndices = (uint16_t *)vita_mem_alloc( + data->linearIndices = (uint16_t *)mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, UINT16_MAX*sizeof(uint16_t), sizeof(uint16_t), @@ -873,7 +871,7 @@ gxm_init(SDL_Renderer *renderer) data->textureWvpParam = (SceGxmProgramParameter *)sceGxmProgramFindParameterByName(textureVertexProgramGxp, "wvp"); // Allocate memory for the memory pool - data->pool_addr[0] = vita_mem_alloc( + data->pool_addr[0] = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW, VITA_GXM_POOL_SIZE, sizeof(void *), @@ -881,7 +879,7 @@ gxm_init(SDL_Renderer *renderer) &data->poolUid[0] ); - data->pool_addr[1] = vita_mem_alloc( + data->pool_addr[1] = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW, VITA_GXM_POOL_SIZE, sizeof(void *), @@ -920,28 +918,28 @@ void gxm_finish(SDL_Renderer *renderer) free_fragment_programs(data, &data->blendFragmentPrograms.blend_mode_mod); free_fragment_programs(data, &data->blendFragmentPrograms.blend_mode_mul); - vita_mem_free(data->linearIndicesUid); - vita_mem_free(data->clearVerticesUid); + mem_gpu_free(data->linearIndicesUid); + mem_gpu_free(data->clearVerticesUid); // wait until display queue is finished before deallocating display buffers sceGxmDisplayQueueFinish(); // clean up display queue - vita_mem_free(data->depthBufferUid); + mem_gpu_free(data->depthBufferUid); for (size_t i = 0; i < VITA_GXM_BUFFERS; i++) { // clear the buffer then deallocate SDL_memset(data->displayBufferData[i], 0, VITA_GXM_SCREEN_HEIGHT * VITA_GXM_SCREEN_STRIDE * 4); - vita_mem_free(data->displayBufferUid[i]); + mem_gpu_free(data->displayBufferUid[i]); // destroy the sync object sceGxmSyncObjectDestroy(data->displayBufferSync[i]); } // Free the depth and stencil buffer - vita_mem_free(data->depthBufferUid); - vita_mem_free(data->stencilBufferUid); + mem_gpu_free(data->depthBufferUid); + mem_gpu_free(data->stencilBufferUid); // unregister programs and destroy shader patcher sceGxmShaderPatcherUnregisterProgram(data->shaderPatcher, data->clearFragmentProgramId); @@ -952,24 +950,23 @@ void gxm_finish(SDL_Renderer *renderer) sceGxmShaderPatcherUnregisterProgram(data->shaderPatcher, data->textureVertexProgramId); sceGxmShaderPatcherDestroy(data->shaderPatcher); - vita_mem_fragment_usse_free(data->patcherFragmentUsseUid); - vita_mem_vertex_usse_free(data->patcherVertexUsseUid); - vita_mem_free(data->patcherBufferUid); + mem_fragment_usse_free(data->patcherFragmentUsseUid); + mem_vertex_usse_free(data->patcherVertexUsseUid); + mem_gpu_free(data->patcherBufferUid); // destroy the render target sceGxmDestroyRenderTarget(data->renderTarget); // destroy the gxm context sceGxmDestroyContext(data->gxm_context); - vita_mem_fragment_usse_free(data->fragmentUsseRingBufferUid); - vita_mem_free(data->fragmentRingBufferUid); - vita_mem_free(data->vertexRingBufferUid); - vita_mem_free(data->vdmRingBufferUid); + mem_fragment_usse_free(data->fragmentUsseRingBufferUid); + mem_gpu_free(data->fragmentRingBufferUid); + mem_gpu_free(data->vertexRingBufferUid); + mem_gpu_free(data->vdmRingBufferUid); SDL_free(data->contextParams.hostMem); - vita_mem_free(data->poolUid[0]); - vita_mem_free(data->poolUid[1]); - vita_gpu_mem_destroy(data); + mem_gpu_free(data->poolUid[0]); + mem_gpu_free(data->poolUid[1]); // terminate libgxm sceGxmTerminate(); @@ -978,20 +975,16 @@ void gxm_finish(SDL_Renderer *renderer) // textures void -free_gxm_texture(VITA_GXM_RenderData *data, gxm_texture *texture) +free_gxm_texture(gxm_texture *texture) { if (texture) { if (texture->gxm_rendertarget) { sceGxmDestroyRenderTarget(texture->gxm_rendertarget); } if (texture->depth_UID) { - vita_mem_free(texture->depth_UID); - } - if (texture->cdram) { - vita_gpu_mem_free(data, sceGxmTextureGetData(&texture->gxm_tex)); - } else { - vita_mem_free(texture->data_UID); + mem_gpu_free(texture->depth_UID); } + mem_gpu_free(texture->data_UID); SDL_free(texture); } } @@ -1002,6 +995,25 @@ gxm_texture_get_format(const gxm_texture *texture) return sceGxmTextureGetFormat(&texture->gxm_tex); } +unsigned int +gxm_texture_get_width(const gxm_texture *texture) +{ + return sceGxmTextureGetWidth(&texture->gxm_tex); +} + +unsigned int +gxm_texture_get_height(const gxm_texture *texture) +{ + return sceGxmTextureGetHeight(&texture->gxm_tex); +} + +unsigned int +gxm_texture_get_stride(const gxm_texture *texture) +{ + return ((gxm_texture_get_width(texture) + 7) & ~7) + * tex_format_to_bytespp(gxm_texture_get_format(texture)); +} + void * gxm_texture_get_datap(const gxm_texture *texture) { @@ -1009,53 +1021,34 @@ gxm_texture_get_datap(const gxm_texture *texture) } gxm_texture * -create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, SceGxmTextureFormat format, unsigned int isRenderTarget, unsigned int *return_w, unsigned int *return_h, unsigned int *return_pitch, float *return_wscale) +create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, SceGxmTextureFormat format, unsigned int isRenderTarget) { gxm_texture *texture = SDL_calloc(1, sizeof(gxm_texture)); - int aligned_w = ALIGN(w, 8); - int texture_w = w; - int tex_size = aligned_w * h * tex_format_to_bytespp(format); + const int tex_size = ((w + 7) & ~ 7) * h * tex_format_to_bytespp(format); void *texture_data; - int ret; - - *return_wscale = 1.0f; - - // SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P3/P2 based formats require width aligned to 16 - if ( (format & 0x9f000000U) == SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P3 || (format & 0x9f000000U) == SCE_GXM_TEXTURE_BASE_FORMAT_YUV420P2) { - aligned_w = ALIGN(w, 16); - texture_w = aligned_w; - tex_size = aligned_w * h * tex_format_to_bytespp(format); - *return_wscale = (float) (w) / texture_w; - // add storage for UV planes - tex_size += (((aligned_w + 1) / 2) * ((h + 1) / 2)) * 2; - } if (!texture) return NULL; - *return_w = w; - *return_h = h; - *return_pitch = aligned_w * tex_format_to_bytespp(format); - /* Allocate a GPU buffer for the texture */ - texture_data = vita_gpu_mem_alloc( - data, - tex_size + texture_data = mem_gpu_alloc( + SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, + tex_size, + SCE_GXM_TEXTURE_ALIGNMENT, + SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE, + &texture->data_UID ); /* Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM */ if (!texture_data) { SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n"); - texture_data = vita_mem_alloc( + texture_data = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, tex_size, SCE_GXM_TEXTURE_ALIGNMENT, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE, &texture->data_UID ); - texture->cdram = 0; - } else { - texture->cdram = 1; } if (!texture_data) { @@ -1067,12 +1060,7 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc SDL_memset(texture_data, 0, tex_size); /* Create the gxm texture */ - ret = sceGxmTextureInitLinear( &texture->gxm_tex, texture_data, format, texture_w, h, 0); - if (ret < 0) { - free_gxm_texture(data, texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "texture init failed: %x\n", ret); - return NULL; - } + sceGxmTextureInitLinear( &texture->gxm_tex, texture_data, format, w, h, 0); if (isRenderTarget) { void *depthBufferData; @@ -1095,13 +1083,13 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc ); if (err < 0) { - free_gxm_texture(data, texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %x\n", err); + free_gxm_texture(texture); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %d\n", err); return NULL; } // allocate it - depthBufferData = vita_mem_alloc( + depthBufferData = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, 4*sampleCount, SCE_GXM_DEPTHSTENCIL_SURFACE_ALIGNMENT, @@ -1118,8 +1106,8 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc NULL); if (err < 0) { - free_gxm_texture(data, texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %x\n", err); + free_gxm_texture(texture); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %d\n", err); return NULL; } @@ -1143,8 +1131,8 @@ create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, Sc texture->gxm_rendertarget = tgt; if (err < 0) { - free_gxm_texture(data, texture); - SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %x\n", err); + free_gxm_texture(texture); + SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %d\n", err); return NULL; } } @@ -1193,7 +1181,7 @@ void gxm_init_for_common_dialog(void) for (int i = 0; i < VITA_GXM_BUFFERS; i += 1) { buffer_for_common_dialog[i].displayData.wait_vblank = SDL_TRUE; - buffer_for_common_dialog[i].displayData.address = vita_mem_alloc( + buffer_for_common_dialog[i].displayData.address = mem_gpu_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW, 4 * VITA_GXM_SCREEN_STRIDE * VITA_GXM_SCREEN_HEIGHT, SCE_GXM_COLOR_SURFACE_ALIGNMENT, @@ -1241,7 +1229,7 @@ void gxm_term_for_common_dialog(void) sceGxmDisplayQueueFinish(); for (int i = 0; i < VITA_GXM_BUFFERS; i += 1) { - vita_mem_free(buffer_for_common_dialog[i].uid); + mem_gpu_free(buffer_for_common_dialog[i].uid); sceGxmSyncObjectDestroy(buffer_for_common_dialog[i].sync); } } diff --git a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.h b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.h index 67659889d..351bdc2e6 100755 --- a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.h +++ b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.h @@ -48,12 +48,15 @@ void unset_clip_rectangle(VITA_GXM_RenderData *data); int gxm_init(SDL_Renderer *renderer); void gxm_finish(SDL_Renderer *renderer); -gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, SceGxmTextureFormat format, unsigned int isRenderTarget, unsigned int *return_w, unsigned int *return_h, unsigned int *return_pitch, float *return_wscale); -void free_gxm_texture(VITA_GXM_RenderData *data, gxm_texture *texture); +gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, SceGxmTextureFormat format, unsigned int isRenderTarget); +void free_gxm_texture(gxm_texture *texture); void gxm_texture_set_filters(gxm_texture *texture, SceGxmTextureFilter min_filter, SceGxmTextureFilter mag_filter); SceGxmTextureFormat gxm_texture_get_format(const gxm_texture *texture); +unsigned int gxm_texture_get_width(const gxm_texture *texture); +unsigned int gxm_texture_get_height(const gxm_texture *texture); +unsigned int gxm_texture_get_stride(const gxm_texture *texture); void *gxm_texture_get_datap(const gxm_texture *texture); void gxm_minimal_init_for_common_dialog(void); diff --git a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_types.h b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_types.h index c5cbf5898..898a92d9c 100755 --- a/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_types.h +++ b/externals/SDL/src/render/vitagxm/SDL_render_vita_gxm_types.h @@ -33,7 +33,6 @@ #include #include #include -#include #include @@ -80,7 +79,6 @@ typedef struct gxm_texture { SceGxmColorSurface gxm_colorsurface; SceGxmDepthStencilSurface gxm_depthstencil; SceUID depth_UID; - SDL_bool cdram; } gxm_texture; typedef struct fragment_programs { @@ -188,19 +186,14 @@ typedef struct blend_fragment_programs blendFragmentPrograms; gxm_drawstate_cache drawstate; - SceClibMspace texturePool; - SceUID texturePoolUID; } VITA_GXM_RenderData; typedef struct { gxm_texture *tex; - unsigned int pitch; - unsigned int w; - unsigned int h; - float wscale; - SDL_bool yuv; - SDL_bool nv12; + unsigned int pitch; + unsigned int w; + unsigned int h; } VITA_GXM_TextureData; #endif /* SDL_RENDER_VITA_GXM_TYPES_H */ diff --git a/externals/SDL/src/sensor/windows/SDL_windowssensor.c b/externals/SDL/src/sensor/windows/SDL_windowssensor.c index 21b119d22..bb8d39ed2 100755 --- a/externals/SDL/src/sensor/windows/SDL_windowssensor.c +++ b/externals/SDL/src/sensor/windows/SDL_windowssensor.c @@ -325,10 +325,7 @@ static int DisconnectSensor(ISensor *sensor) for (i = 0; i < SDL_num_sensors; ++i) { old_sensor = &SDL_sensors[i]; if (sensor == old_sensor->sensor) { - /* This call hangs for some reason: - * https://github.com/libsdl-org/SDL/issues/5288 - */ - /*ISensor_SetEventSink(sensor, NULL);*/ + ISensor_SetEventSink(sensor, NULL); ISensor_Release(sensor); SDL_free(old_sensor->name); --SDL_num_sensors; diff --git a/externals/SDL/src/stdlib/SDL_getenv.c b/externals/SDL/src/stdlib/SDL_getenv.c index add833284..d54cfe9ee 100755 --- a/externals/SDL/src/stdlib/SDL_getenv.c +++ b/externals/SDL/src/stdlib/SDL_getenv.c @@ -48,7 +48,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite) { /* Input validation */ - if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { + if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { return (-1); } @@ -59,7 +59,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite) { /* Input validation */ - if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { + if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { return (-1); } @@ -82,7 +82,7 @@ SDL_setenv(const char *name, const char *value, int overwrite) char *new_variable; /* Input validation */ - if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { + if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { return (-1); } @@ -115,7 +115,7 @@ SDL_setenv(const char *name, const char *value, int overwrite) char *new_variable; /* Input validation */ - if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { + if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) { return (-1); } @@ -181,7 +181,7 @@ SDL_getenv(const char *name) #endif /* Input validation */ - if (!name || *name == '\0') { + if (!name || !*name) { return NULL; } @@ -194,7 +194,7 @@ SDL_getenv(const char *name) size_t bufferlen; /* Input validation */ - if (!name || *name == '\0') { + if (!name || SDL_strlen(name)==0) { return NULL; } @@ -222,7 +222,7 @@ SDL_getenv(const char *name) char *value; /* Input validation */ - if (!name || *name == '\0') { + if (!name || SDL_strlen(name)==0) { return NULL; } diff --git a/externals/SDL/src/stdlib/SDL_iconv.c b/externals/SDL/src/stdlib/SDL_iconv.c index f3a4cbbee..c88731b8d 100755 --- a/externals/SDL/src/stdlib/SDL_iconv.c +++ b/externals/SDL/src/stdlib/SDL_iconv.c @@ -36,6 +36,18 @@ #define LIBICONV_PLUG 1 #endif #include + +/* Depending on which standard the iconv() was implemented with, + iconv() may or may not use const char ** for the inbuf param. + If we get this wrong, it's just a warning, so no big deal. +*/ +#if defined(_XGP6) || defined(__APPLE__) || defined(__RISCOS__) || defined(__FREEBSD__) || \ + defined(__EMSCRIPTEN__) || \ + (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \ + (defined(_NEWLIB_VERSION))) +#define ICONV_INBUF_NONCONST +#endif + #include SDL_COMPILE_TIME_ASSERT(iconv_t, sizeof (iconv_t) <= sizeof (SDL_iconv_t)); @@ -57,9 +69,12 @@ SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft) { - /* iconv's second parameter may or may not be `const char const *` depending on the - C runtime's whims. Casting to void * seems to make everyone happy, though. */ - const size_t retCode = iconv((iconv_t) ((uintptr_t) cd), (void *) inbuf, inbytesleft, outbuf, outbytesleft); + size_t retCode; +#ifdef ICONV_INBUF_NONCONST + retCode = iconv((iconv_t) ((uintptr_t) cd), (char **) inbuf, inbytesleft, outbuf, outbytesleft); +#else + retCode = iconv((iconv_t) ((uintptr_t) cd), inbuf, inbytesleft, outbuf, outbytesleft); +#endif if (retCode == (size_t) - 1) { switch (errno) { case E2BIG: @@ -126,7 +141,7 @@ static struct const char *name; int format; } encodings[] = { -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ { "ASCII", ENCODING_ASCII }, { "US-ASCII", ENCODING_ASCII }, { "8859-1", ENCODING_LATIN1 }, @@ -160,7 +175,7 @@ static struct { "UCS-4LE", ENCODING_UCS4LE }, { "UCS-4BE", ENCODING_UCS4BE }, { "UCS-4-INTERNAL", ENCODING_UCS4NATIVE }, -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ }; static const char * diff --git a/externals/SDL/src/stdlib/SDL_malloc.c b/externals/SDL/src/stdlib/SDL_malloc.c index 0a51dddce..b5dd6414f 100755 --- a/externals/SDL/src/stdlib/SDL_malloc.c +++ b/externals/SDL/src/stdlib/SDL_malloc.c @@ -733,7 +733,7 @@ extern "C" maximum supported value of n differs across systems, but is in all cases less than the maximum representable value of a size_t. */ - void * SDLCALL dlmalloc(size_t); + void *dlmalloc(size_t); /* free(void* p) @@ -742,14 +742,14 @@ extern "C" It has no effect if p is null. If p was not malloced or already freed, free(p) will by default cause the current program to abort. */ - void SDLCALL dlfree(void *); + void dlfree(void *); /* calloc(size_t n_elements, size_t element_size); Returns a pointer to n_elements * element_size bytes, with all locations set to zero. */ - void * SDLCALL dlcalloc(size_t, size_t); + void *dlcalloc(size_t, size_t); /* realloc(void* p, size_t n) @@ -774,7 +774,7 @@ extern "C" to be used as an argument to realloc is not supported. */ - void * SDLCALL dlrealloc(void *, size_t); + void *dlrealloc(void *, size_t); /* memalign(size_t alignment, size_t n); @@ -5305,10 +5305,10 @@ History: #endif /* !HAVE_MALLOC */ #ifdef HAVE_MALLOC -static void* SDLCALL real_malloc(size_t s) { return malloc(s); } -static void* SDLCALL real_calloc(size_t n, size_t s) { return calloc(n, s); } -static void* SDLCALL real_realloc(void *p, size_t s) { return realloc(p,s); } -static void SDLCALL real_free(void *p) { free(p); } +#define real_malloc malloc +#define real_calloc calloc +#define real_realloc realloc +#define real_free free #else #define real_malloc dlmalloc #define real_calloc dlcalloc diff --git a/externals/SDL/src/stdlib/SDL_qsort.c b/externals/SDL/src/stdlib/SDL_qsort.c index 26e97c908..b175f444e 100755 --- a/externals/SDL/src/stdlib/SDL_qsort.c +++ b/externals/SDL/src/stdlib/SDL_qsort.c @@ -534,38 +534,5 @@ extern void qsortG(void *base, size_t nmemb, size_t size, #endif /* HAVE_QSORT */ -void * -SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) -{ -#if defined(HAVE_BSEARCH) - return bsearch(key, base, nmemb, size, compare); -#else -/* SDL's replacement: Taken from the Public Domain C Library (PDCLib): - Permission is granted to use, modify, and / or redistribute at will. -*/ - const void *pivot; - size_t corr; - int rc; - - while (nmemb) { - /* algorithm needs -1 correction if remaining elements are an even number. */ - corr = nmemb % 2; - nmemb /= 2; - pivot = (const char *)base + (nmemb * size); - rc = compare(key, pivot); - - if (rc > 0) { - base = (const char *)pivot + size; - /* applying correction */ - nmemb -= (1 - corr); - } else if (rc == 0) { - return (void *)pivot; - } - } - - return NULL; -#endif /* HAVE_BSEARCH */ -} - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/stdlib/SDL_stdlib.c b/externals/SDL/src/stdlib/SDL_stdlib.c index 62cbef884..9d785aad5 100755 --- a/externals/SDL/src/stdlib/SDL_stdlib.c +++ b/externals/SDL/src/stdlib/SDL_stdlib.c @@ -549,9 +549,8 @@ int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); } __declspec(selectany) int _fltused = 1; #endif -/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls. - Always provide it for the SDL2 DLL, but skip it when building static lib w/ static runtime. */ -#if (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) +/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls */ +#if _MSC_VER >= 1400 extern void *memcpy(void* dst, const void* src, size_t len); #pragma intrinsic(memcpy) @@ -571,7 +570,7 @@ memset(void *dst, int c, size_t len) { return SDL_memset(dst, c, len); } -#endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */ +#endif /* _MSC_VER >= 1400 */ #ifdef _M_IX86 diff --git a/externals/SDL/src/stdlib/SDL_string.c b/externals/SDL/src/stdlib/SDL_string.c index 943e72740..12cc2da8f 100755 --- a/externals/SDL/src/stdlib/SDL_string.c +++ b/externals/SDL/src/stdlib/SDL_string.c @@ -27,7 +27,12 @@ /* This file contains portable string manipulation functions for SDL */ #include "SDL_stdinc.h" -#include "SDL_vacopy.h" + +#if defined(_MSC_VER) && _MSC_VER <= 1800 +/* Visual Studio 2013 tries to link with _vacopy in the C runtime. Newer versions do an inline assignment */ +#undef va_copy +#define va_copy(dst, src) dst = src +#endif #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) #define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) @@ -263,6 +268,108 @@ SDL_ScanFloat(const char *text, double *valuep) } #endif +void * +SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len) +{ +#if defined(HAVE_MEMSET) + return memset(dst, c, len); +#else + size_t left; + Uint32 *dstp4; + Uint8 *dstp1 = (Uint8 *) dst; + Uint8 value1; + Uint32 value4; + + /* The value used in memset() is a byte, passed as an int */ + c &= 0xff; + + /* The destination pointer needs to be aligned on a 4-byte boundary to + * execute a 32-bit set. Set first bytes manually if needed until it is + * aligned. */ + value1 = (Uint8)c; + while ((uintptr_t)dstp1 & 0x3) { + if (len--) { + *dstp1++ = value1; + } else { + return dst; + } + } + + value4 = ((Uint32)c | ((Uint32)c << 8) | ((Uint32)c << 16) | ((Uint32)c << 24)); + dstp4 = (Uint32 *) dstp1; + left = (len % 4); + len /= 4; + while (len--) { + *dstp4++ = value4; + } + + dstp1 = (Uint8 *) dstp4; + switch (left) { + case 3: + *dstp1++ = value1; + case 2: + *dstp1++ = value1; + case 1: + *dstp1++ = value1; + } + + return dst; +#endif /* HAVE_MEMSET */ +} + +void * +SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len) +{ +#ifdef __GNUC__ + /* Presumably this is well tuned for speed. + On my machine this is twice as fast as the C code below. + */ + return __builtin_memcpy(dst, src, len); +#elif defined(HAVE_MEMCPY) + return memcpy(dst, src, len); +#elif defined(HAVE_BCOPY) + bcopy(src, dst, len); + return dst; +#else + /* GCC 4.9.0 with -O3 will generate movaps instructions with the loop + using Uint32* pointers, so we need to make sure the pointers are + aligned before we loop using them. + */ + if (((uintptr_t)src & 0x3) || ((uintptr_t)dst & 0x3)) { + /* Do an unaligned byte copy */ + Uint8 *srcp1 = (Uint8 *)src; + Uint8 *dstp1 = (Uint8 *)dst; + + while (len--) { + *dstp1++ = *srcp1++; + } + } else { + size_t left = (len % 4); + Uint32 *srcp4, *dstp4; + Uint8 *srcp1, *dstp1; + + srcp4 = (Uint32 *) src; + dstp4 = (Uint32 *) dst; + len /= 4; + while (len--) { + *dstp4++ = *srcp4++; + } + + srcp1 = (Uint8 *) srcp4; + dstp1 = (Uint8 *) dstp4; + switch (left) { + case 3: + *dstp1++ = *srcp1++; + case 2: + *dstp1++ = *srcp1++; + case 1: + *dstp1++ = *srcp1++; + } + } + return dst; +#endif /* __GNUC__ */ +} + void * SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len) { @@ -532,16 +639,19 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_ size_t bytes = SDL_min(src_bytes, dst_bytes - 1); size_t i = 0; unsigned char trailing_bytes = 0; - - if (bytes) { + if (bytes) + { unsigned char c = (unsigned char)src[bytes - 1]; - if (UTF8_IsLeadByte(c)) { + if (UTF8_IsLeadByte(c)) --bytes; - } else if (UTF8_IsTrailingByte(c)) { - for (i = bytes - 1; i != 0; --i) { + else if (UTF8_IsTrailingByte(c)) + { + for (i = bytes - 1; i != 0; --i) + { c = (unsigned char)src[i]; trailing_bytes = UTF8_TrailingBytes(c); - if (trailing_bytes) { + if (trailing_bytes) + { if (bytes - i != trailing_bytes + 1) bytes = i; @@ -552,7 +662,6 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_ SDL_memcpy(dst, src, bytes); } dst[bytes] = '\0'; - return bytes; } @@ -573,23 +682,6 @@ SDL_utf8strlen(const char *str) return retval; } -size_t -SDL_utf8strnlen(const char *str, size_t bytes) -{ - size_t retval = 0; - const char *p = str; - unsigned char ch; - - while ((ch = *(p++)) != 0 && bytes-- > 0) { - /* if top two bits are 1 and 0, it's a continuation byte. */ - if ((ch & 0xc0) != 0x80) { - retval++; - } - } - - return retval; -} - size_t SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) { @@ -978,16 +1070,13 @@ SDL_strcmp(const char *str1, const char *str2) #if defined(HAVE_STRCMP) return strcmp(str1, str2); #else - int result; - - while(1) { - result = (int)((unsigned char) *str1 - (unsigned char) *str2); - if (result != 0 || (*str1 == '\0'/* && *str2 == '\0'*/)) + while (*str1 && *str2) { + if (*str1 != *str2) break; ++str1; ++str2; } - return result; + return (int)((unsigned char) *str1 - (unsigned char) *str2); #endif /* HAVE_STRCMP */ } @@ -997,20 +1086,17 @@ SDL_strncmp(const char *str1, const char *str2, size_t maxlen) #if defined(HAVE_STRNCMP) return strncmp(str1, str2, maxlen); #else - int result; - - while (maxlen) { - result = (int) (unsigned char) *str1 - (unsigned char) *str2; - if (result != 0 || *str1 == '\0'/* && *str2 == '\0'*/) + while (*str1 && *str2 && maxlen) { + if (*str1 != *str2) break; ++str1; ++str2; --maxlen; } if (!maxlen) { - result = 0; + return 0; } - return result; + return (int) ((unsigned char) *str1 - (unsigned char) *str2); #endif /* HAVE_STRNCMP */ } @@ -1022,18 +1108,19 @@ SDL_strcasecmp(const char *str1, const char *str2) #elif defined(HAVE__STRICMP) return _stricmp(str1, str2); #else - int a, b, result; - - while (1) { + char a = 0; + char b = 0; + while (*str1 && *str2) { a = SDL_toupper((unsigned char) *str1); b = SDL_toupper((unsigned char) *str2); - result = a - b; - if (result != 0 || a == 0 /*&& b == 0*/) + if (a != b) break; ++str1; ++str2; } - return result; + a = SDL_toupper(*str1); + b = SDL_toupper(*str2); + return (int) ((unsigned char) a - (unsigned char) b); #endif /* HAVE_STRCASECMP */ } @@ -1045,21 +1132,24 @@ SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen) #elif defined(HAVE__STRNICMP) return _strnicmp(str1, str2, maxlen); #else - int a, b, result; - - while (maxlen) { + char a = 0; + char b = 0; + while (*str1 && *str2 && maxlen) { a = SDL_tolower((unsigned char) *str1); b = SDL_tolower((unsigned char) *str2); - result = a - b; - if (result != 0 || a == 0 /*&& b == 0*/) + if (a != b) break; ++str1; ++str2; --maxlen; } - if (maxlen == 0) - result = 0; - return result; + if (maxlen == 0) { + return 0; + } else { + a = SDL_tolower((unsigned char) *str1); + b = SDL_tolower((unsigned char) *str2); + return (int) ((unsigned char) a - (unsigned char) b); + } #endif /* HAVE_STRNCASECMP */ } diff --git a/externals/SDL/src/test/SDL_test_common.c b/externals/SDL/src/test/SDL_test_common.c index 93a0e7c74..48c6c72f0 100755 --- a/externals/SDL/src/test/SDL_test_common.c +++ b/externals/SDL/src/test/SDL_test_common.c @@ -1464,12 +1464,10 @@ default: return "???"; static void SDLTest_PrintEvent(SDL_Event * event) { -#ifndef VERBOSE_MOTION_EVENTS if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) { /* Mouse and finger motion are really spammy */ return; } -#endif switch (event->type) { case SDL_DISPLAYEVENT: diff --git a/externals/SDL/src/test/SDL_test_harness.c b/externals/SDL/src/test/SDL_test_harness.c index 2e94f6c28..8f10f3e5c 100755 --- a/externals/SDL/src/test/SDL_test_harness.c +++ b/externals/SDL/src/test/SDL_test_harness.c @@ -169,7 +169,7 @@ SDLTest_GenerateExecKey(const char *runSeed, const char *suiteName, const char * * \return Timer id or -1 on failure. */ static SDL_TimerID -SDLTest_SetTestTimeout(int timeout, void (SDLCALL *callback)(void)) +SDLTest_SetTestTimeout(int timeout, void (*callback)(void)) { Uint32 timeoutInMilliseconds; SDL_TimerID timerID; @@ -209,7 +209,7 @@ SDLTest_SetTestTimeout(int timeout, void (SDLCALL *callback)(void)) #if defined(__WATCOMC__) #pragma aux SDLTest_BailOut aborts; #endif -static SDL_NORETURN void SDLCALL +static SDL_NORETURN void SDLTest_BailOut(void) { SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); @@ -349,7 +349,7 @@ static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) /* Gets a timer value in seconds */ static float GetClock() { - float currentClock = SDL_GetPerformanceCounter() / (float) SDL_GetPerformanceFrequency(); + float currentClock = clock() / (float) CLOCKS_PER_SEC; return currentClock; } @@ -443,11 +443,6 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user } } - if (totalNumberOfTests == 0) { - SDLTest_LogError("No tests to run?"); - return -1; - } - /* Pre-allocate an array for tracking failed tests (potentially all test cases) */ failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); if (failedTests == NULL) { diff --git a/externals/SDL/src/test/SDL_test_random.c b/externals/SDL/src/test/SDL_test_random.c index b2babf18c..c52e050bb 100755 --- a/externals/SDL/src/test/SDL_test_random.c +++ b/externals/SDL/src/test/SDL_test_random.c @@ -70,7 +70,7 @@ void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext) srand((unsigned int)time(NULL)); a=rand(); - srand((unsigned int)SDL_GetPerformanceCounter()); + srand((unsigned int)clock()); b=rand(); SDLTest_RandomInit(rndContext, a, b); } diff --git a/externals/SDL/src/thread/SDL_thread_c.h b/externals/SDL/src/thread/SDL_thread_c.h index 55a4a8875..fb0885a2d 100755 --- a/externals/SDL/src/thread/SDL_thread_c.h +++ b/externals/SDL/src/thread/SDL_thread_c.h @@ -32,8 +32,6 @@ #include "pthread/SDL_systhread_c.h" #elif SDL_THREAD_WINDOWS #include "windows/SDL_systhread_c.h" -#elif SDL_THREAD_PS2 -#include "ps2/SDL_systhread_c.h" #elif SDL_THREAD_PSP #include "psp/SDL_systhread_c.h" #elif SDL_THREAD_VITA @@ -42,8 +40,6 @@ #include "stdcpp/SDL_systhread_c.h" #elif SDL_THREAD_OS2 #include "os2/SDL_systhread_c.h" -#elif SDL_THREAD_NGAGE -#include "ngage/SDL_systhread_c.h" #else #error Need thread implementation for this platform #include "generic/SDL_systhread_c.h" diff --git a/externals/SDL/src/thread/generic/SDL_syscond.c b/externals/SDL/src/thread/generic/SDL_syscond.c index 59e8ce076..328e37c90 100755 --- a/externals/SDL/src/thread/generic/SDL_syscond.c +++ b/externals/SDL/src/thread/generic/SDL_syscond.c @@ -99,7 +99,7 @@ SDL_CondSignal_generic(SDL_cond * _cond) { SDL_cond_generic *cond = (SDL_cond_generic *)_cond; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -124,7 +124,7 @@ SDL_CondBroadcast_generic(SDL_cond * _cond) { SDL_cond_generic *cond = (SDL_cond_generic *)_cond; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -181,7 +181,7 @@ SDL_CondWaitTimeout_generic(SDL_cond * _cond, SDL_mutex * mutex, Uint32 ms) int retval; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* Obtain the protection mutex, and increment the number of waiters. diff --git a/externals/SDL/src/thread/generic/SDL_sysmutex.c b/externals/SDL/src/thread/generic/SDL_sysmutex.c index 42965aa8b..9028c7268 100755 --- a/externals/SDL/src/thread/generic/SDL_sysmutex.c +++ b/externals/SDL/src/thread/generic/SDL_sysmutex.c @@ -78,7 +78,7 @@ SDL_LockMutex(SDL_mutex * mutex) SDL_threadID this_thread; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } this_thread = SDL_ThreadID(); @@ -109,7 +109,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) SDL_threadID this_thread; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } this_thread = SDL_ThreadID(); @@ -139,7 +139,7 @@ SDL_mutexV(SDL_mutex * mutex) return 0; #else if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } /* If we don't own the mutex, we can't unlock it */ diff --git a/externals/SDL/src/thread/generic/SDL_syssem.c b/externals/SDL/src/thread/generic/SDL_syssem.c index c21ff196a..93ce2952d 100755 --- a/externals/SDL/src/thread/generic/SDL_syssem.c +++ b/externals/SDL/src/thread/generic/SDL_syssem.c @@ -132,7 +132,7 @@ SDL_SemTryWait(SDL_sem * sem) int retval; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL semaphore"); } retval = SDL_MUTEX_TIMEDOUT; @@ -152,7 +152,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) int retval; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL semaphore"); } /* A timeout of 0 is an easy case */ @@ -200,7 +200,7 @@ int SDL_SemPost(SDL_sem * sem) { if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL semaphore"); } SDL_LockMutex(sem->count_lock); diff --git a/externals/SDL/src/thread/os2/SDL_sysmutex.c b/externals/SDL/src/thread/os2/SDL_sysmutex.c index d3fc7a3bd..28986f632 100755 --- a/externals/SDL/src/thread/os2/SDL_sysmutex.c +++ b/externals/SDL/src/thread/os2/SDL_sysmutex.c @@ -56,12 +56,12 @@ SDL_CreateMutex(void) void SDL_DestroyMutex(SDL_mutex * mutex) { + ULONG ulRC; HMTX hMtx = (HMTX)mutex; - if (hMtx != NULLHANDLE) { - const ULONG ulRC = DosCloseMutexSem(hMtx); - if (ulRC != NO_ERROR) { - debug_os2("DosCloseMutexSem(), rc = %u", ulRC); - } + + ulRC = DosCloseMutexSem(hMtx); + if (ulRC != NO_ERROR) { + debug_os2("DosCloseMutexSem(), rc = %u", ulRC); } } @@ -73,7 +73,7 @@ SDL_LockMutex(SDL_mutex * mutex) HMTX hMtx = (HMTX)mutex; if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); ulRC = DosRequestMutexSem(hMtx, SEM_INDEFINITE_WAIT); if (ulRC != NO_ERROR) { @@ -92,7 +92,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) HMTX hMtx = (HMTX)mutex; if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); ulRC = DosRequestMutexSem(hMtx, SEM_IMMEDIATE_RETURN); @@ -115,7 +115,7 @@ SDL_UnlockMutex(SDL_mutex * mutex) HMTX hMtx = (HMTX)mutex; if (hMtx == NULLHANDLE) - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); ulRC = DosReleaseMutexSem(hMtx); if (ulRC != NO_ERROR) diff --git a/externals/SDL/src/thread/os2/SDL_syssem.c b/externals/SDL/src/thread/os2/SDL_syssem.c index 79bf0673f..d2ede6991 100755 --- a/externals/SDL/src/thread/os2/SDL_syssem.c +++ b/externals/SDL/src/thread/os2/SDL_syssem.c @@ -89,7 +89,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) ULONG cPost; if (sem == NULL) - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); if (timeout != SEM_INDEFINITE_WAIT) DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulStartTime, sizeof(ULONG)); @@ -147,7 +147,7 @@ SDL_SemValue(SDL_sem * sem) ULONG ulRC; if (sem == NULL) { - SDL_InvalidParamError("sem"); + SDL_SetError("Passed a NULL sem"); return 0; } @@ -167,7 +167,7 @@ SDL_SemPost(SDL_sem * sem) ULONG ulRC; if (sem == NULL) - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); if (ulRC != NO_ERROR) diff --git a/externals/SDL/src/thread/psp/SDL_syscond.c b/externals/SDL/src/thread/psp/SDL_syscond.c index 02307ed9c..5c98610af 100755 --- a/externals/SDL/src/thread/psp/SDL_syscond.c +++ b/externals/SDL/src/thread/psp/SDL_syscond.c @@ -84,7 +84,7 @@ int SDL_CondSignal(SDL_cond * cond) { if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -108,7 +108,7 @@ int SDL_CondBroadcast(SDL_cond * cond) { if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -164,7 +164,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) int retval; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* Obtain the protection mutex, and increment the number of waiters. diff --git a/externals/SDL/src/thread/psp/SDL_sysmutex.c b/externals/SDL/src/thread/psp/SDL_sysmutex.c index 9e391629a..0adc16c01 100755 --- a/externals/SDL/src/thread/psp/SDL_sysmutex.c +++ b/externals/SDL/src/thread/psp/SDL_sysmutex.c @@ -84,7 +84,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) #else SceInt32 res = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } res = sceKernelTryLockLwMutex(&mutex->lock, 1); @@ -114,7 +114,7 @@ SDL_mutexP(SDL_mutex * mutex) #else SceInt32 res = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } res = sceKernelLockLwMutex(&mutex->lock, 1, NULL); @@ -136,7 +136,7 @@ SDL_mutexV(SDL_mutex * mutex) SceInt32 res = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } res = sceKernelUnlockLwMutex(&mutex->lock, 1); diff --git a/externals/SDL/src/thread/psp/SDL_syssem.c b/externals/SDL/src/thread/psp/SDL_syssem.c index 640619cd9..aaac5b68e 100755 --- a/externals/SDL/src/thread/psp/SDL_syssem.c +++ b/externals/SDL/src/thread/psp/SDL_syssem.c @@ -82,7 +82,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) int res; if (sem == NULL) { - SDL_InvalidParamError("sem"); + SDL_SetError("Passed a NULL sem"); return 0; } @@ -128,7 +128,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) SceKernelSemaInfo info; if (sem == NULL) { - SDL_InvalidParamError("sem"); + SDL_SetError("Passed a NULL sem"); return 0; } @@ -144,7 +144,7 @@ int SDL_SemPost(SDL_sem *sem) int res; if (sem == NULL) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); } res = sceKernelSignalSema(sem->semid, 1); diff --git a/externals/SDL/src/thread/pthread/SDL_syscond.c b/externals/SDL/src/thread/pthread/SDL_syscond.c index c84ec7ada..5ebd415cc 100755 --- a/externals/SDL/src/thread/pthread/SDL_syscond.c +++ b/externals/SDL/src/thread/pthread/SDL_syscond.c @@ -68,7 +68,7 @@ SDL_CondSignal(SDL_cond * cond) int retval; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } retval = 0; @@ -85,7 +85,7 @@ SDL_CondBroadcast(SDL_cond * cond) int retval; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } retval = 0; @@ -105,7 +105,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) struct timespec abstime; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } #ifdef HAVE_CLOCK_GETTIME @@ -148,7 +148,7 @@ int SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex) { if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) { return SDL_SetError("pthread_cond_wait() failed"); } diff --git a/externals/SDL/src/thread/pthread/SDL_sysmutex.c b/externals/SDL/src/thread/pthread/SDL_sysmutex.c index c26982aed..027a6cb41 100755 --- a/externals/SDL/src/thread/pthread/SDL_sysmutex.c +++ b/externals/SDL/src/thread/pthread/SDL_sysmutex.c @@ -85,7 +85,7 @@ SDL_LockMutex(SDL_mutex * mutex) #endif if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } #if FAKE_RECURSIVE_MUTEX @@ -122,7 +122,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) #endif if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } retval = 0; @@ -162,7 +162,7 @@ int SDL_UnlockMutex(SDL_mutex * mutex) { if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } #if FAKE_RECURSIVE_MUTEX diff --git a/externals/SDL/src/thread/pthread/SDL_syssem.c b/externals/SDL/src/thread/pthread/SDL_syssem.c index 9a0c88822..2c97ef4e5 100755 --- a/externals/SDL/src/thread/pthread/SDL_syssem.c +++ b/externals/SDL/src/thread/pthread/SDL_syssem.c @@ -73,7 +73,7 @@ SDL_SemTryWait(SDL_sem * sem) int retval; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL semaphore"); } retval = SDL_MUTEX_TIMEDOUT; if (sem_trywait(&sem->sem) == 0) { @@ -88,7 +88,7 @@ SDL_SemWait(SDL_sem * sem) int retval; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL semaphore"); } do { @@ -115,7 +115,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) #endif if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL semaphore"); } /* Try the easy cases first */ @@ -195,7 +195,7 @@ SDL_SemPost(SDL_sem * sem) int retval; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL semaphore"); } retval = sem_post(&sem->sem); diff --git a/externals/SDL/src/thread/pthread/SDL_systhread.c b/externals/SDL/src/thread/pthread/SDL_systhread.c index 3b3f40fa1..b5ab82dbf 100755 --- a/externals/SDL/src/thread/pthread/SDL_systhread.c +++ b/externals/SDL/src/thread/pthread/SDL_systhread.c @@ -30,13 +30,13 @@ #endif #include -#include #ifdef __LINUX__ #include #include #include #include +#include #include "../../core/linux/SDL_dbus.h" #endif /* __LINUX__ */ @@ -137,29 +137,22 @@ SDL_SYS_SetupThread(const char *name) #if defined(__MACOSX__) || defined(__IPHONEOS__) ppthread_setname_np(name); #elif defined(__LINUX__) - if (ppthread_setname_np(pthread_self(), name) == ERANGE) { - char namebuf[16]; /* Limited to 16 char */ - SDL_strlcpy(namebuf, name, sizeof (namebuf)); - ppthread_setname_np(pthread_self(), namebuf); - } + ppthread_setname_np(pthread_self(), name); #endif } #elif HAVE_PTHREAD_SETNAME_NP #if defined(__NETBSD__) pthread_setname_np(pthread_self(), "%s", name); #else - if (pthread_setname_np(pthread_self(), name) == ERANGE) { - char namebuf[16]; /* Limited to 16 char */ - SDL_strlcpy(namebuf, name, sizeof (namebuf)); - pthread_setname_np(pthread_self(), namebuf); - } + pthread_setname_np(pthread_self(), name); #endif #elif HAVE_PTHREAD_SET_NAME_NP pthread_set_name_np(pthread_self(), name); #elif defined(__HAIKU__) /* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */ char namebuf[B_OS_NAME_LENGTH]; - SDL_strlcpy(namebuf, name, sizeof (namebuf)); + SDL_snprintf(namebuf, sizeof (namebuf), "%s", name); + namebuf[sizeof (namebuf) - 1] = '\0'; rename_thread(find_thread(NULL), namebuf); #endif } @@ -193,7 +186,7 @@ SDL_ThreadID(void) int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) { -#if __NACL__ || __RISCOS__ || __OS2__ +#if __NACL__ || __RISCOS__ /* FIXME: Setting thread priority does not seem to be supported in NACL */ return 0; #else diff --git a/externals/SDL/src/thread/stdcpp/SDL_syscond.cpp b/externals/SDL/src/thread/stdcpp/SDL_syscond.cpp index 90c38adba..8aa26d73d 100755 --- a/externals/SDL/src/thread/stdcpp/SDL_syscond.cpp +++ b/externals/SDL/src/thread/stdcpp/SDL_syscond.cpp @@ -70,7 +70,8 @@ int SDL_CondSignal(SDL_cond * cond) { if (!cond) { - return SDL_InvalidParamError("cond"); + SDL_SetError("Passed a NULL condition variable"); + return -1; } cond->cpp_cond.notify_one(); @@ -83,7 +84,8 @@ int SDL_CondBroadcast(SDL_cond * cond) { if (!cond) { - return SDL_InvalidParamError("cond"); + SDL_SetError("Passed a NULL condition variable"); + return -1; } cond->cpp_cond.notify_all(); @@ -116,11 +118,13 @@ int SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) { if (!cond) { - return SDL_InvalidParamError("cond"); + SDL_SetError("Passed a NULL condition variable"); + return -1; } if (!mutex) { - return SDL_InvalidParamError("mutex"); + SDL_SetError("Passed a NULL mutex variable"); + return -1; } try { @@ -144,7 +148,8 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) } } } catch (std::system_error & ex) { - return SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what()); + SDL_SetError("unable to wait on a C++ condition variable: code=%d; %s", ex.code(), ex.what()); + return -1; } } diff --git a/externals/SDL/src/thread/stdcpp/SDL_sysmutex.cpp b/externals/SDL/src/thread/stdcpp/SDL_sysmutex.cpp index 828801046..4146bc98d 100755 --- a/externals/SDL/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/externals/SDL/src/thread/stdcpp/SDL_sysmutex.cpp @@ -65,14 +65,16 @@ int SDL_mutexP(SDL_mutex * mutex) { if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + SDL_SetError("Passed a NULL mutex"); + return -1; } try { mutex->cpp_mutex.lock(); return 0; } catch (std::system_error & ex) { - return SDL_SetError("unable to lock a C++ mutex: code=%d; %s", ex.code(), ex.what()); + SDL_SetError("unable to lock a C++ mutex: code=%d; %s", ex.code(), ex.what()); + return -1; } } @@ -82,7 +84,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) { int retval = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } if (mutex->cpp_mutex.try_lock() == false) { @@ -97,7 +99,8 @@ int SDL_mutexV(SDL_mutex * mutex) { if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + SDL_SetError("Passed a NULL mutex"); + return -1; } mutex->cpp_mutex.unlock(); diff --git a/externals/SDL/src/thread/stdcpp/SDL_systhread.cpp b/externals/SDL/src/thread/stdcpp/SDL_systhread.cpp index 3d818ac56..086a1fde2 100755 --- a/externals/SDL/src/thread/stdcpp/SDL_systhread.cpp +++ b/externals/SDL/src/thread/stdcpp/SDL_systhread.cpp @@ -52,9 +52,11 @@ SDL_SYS_CreateThread(SDL_Thread * thread) thread->handle = (void *) new std::thread(std::move(cpp_thread)); return 0; } catch (std::system_error & ex) { - return SDL_SetError("unable to start a C++ thread: code=%d; %s", ex.code(), ex.what()); + SDL_SetError("unable to start a C++ thread: code=%d; %s", ex.code(), ex.what()); + return -1; } catch (std::bad_alloc &) { - return SDL_OutOfMemory(); + SDL_OutOfMemory(); + return -1; } } diff --git a/externals/SDL/src/thread/vita/SDL_syscond.c b/externals/SDL/src/thread/vita/SDL_syscond.c index c6e46c475..799bc0ae1 100755 --- a/externals/SDL/src/thread/vita/SDL_syscond.c +++ b/externals/SDL/src/thread/vita/SDL_syscond.c @@ -84,7 +84,7 @@ int SDL_CondSignal(SDL_cond * cond) { if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -108,7 +108,7 @@ int SDL_CondBroadcast(SDL_cond * cond) { if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* If there are waiting threads not already signalled, then @@ -164,7 +164,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) int retval; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } /* Obtain the protection mutex, and increment the number of waiters. diff --git a/externals/SDL/src/thread/vita/SDL_sysmutex.c b/externals/SDL/src/thread/vita/SDL_sysmutex.c index 6327182cc..a18705a61 100755 --- a/externals/SDL/src/thread/vita/SDL_sysmutex.c +++ b/externals/SDL/src/thread/vita/SDL_sysmutex.c @@ -80,7 +80,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) #else SceInt32 res = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } res = sceKernelTryLockLwMutex(&mutex->lock, 1); @@ -110,7 +110,7 @@ SDL_mutexP(SDL_mutex * mutex) #else SceInt32 res = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } res = sceKernelLockLwMutex(&mutex->lock, 1, NULL); @@ -132,7 +132,7 @@ SDL_mutexV(SDL_mutex * mutex) SceInt32 res = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } res = sceKernelUnlockLwMutex(&mutex->lock, 1); diff --git a/externals/SDL/src/thread/vita/SDL_syssem.c b/externals/SDL/src/thread/vita/SDL_syssem.c index 7fecd6ca2..34e4d9ca8 100755 --- a/externals/SDL/src/thread/vita/SDL_syssem.c +++ b/externals/SDL/src/thread/vita/SDL_syssem.c @@ -83,7 +83,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) unsigned int res; if (sem == NULL) { - SDL_InvalidParamError("sem"); + SDL_SetError("Passed a NULL sem"); return 0; } @@ -130,7 +130,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) info.size = sizeof(info); if (sem == NULL) { - SDL_InvalidParamError("sem"); + SDL_SetError("Passed a NULL sem"); return 0; } @@ -146,7 +146,7 @@ int SDL_SemPost(SDL_sem *sem) int res; if (sem == NULL) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); } res = sceKernelSignalSema(sem->semid, 1); diff --git a/externals/SDL/src/thread/windows/SDL_syscond_cv.c b/externals/SDL/src/thread/windows/SDL_syscond_cv.c index 54d34084f..89c1a17f4 100755 --- a/externals/SDL/src/thread/windows/SDL_syscond_cv.c +++ b/externals/SDL/src/thread/windows/SDL_syscond_cv.c @@ -109,7 +109,7 @@ SDL_CondSignal_cv(SDL_cond * _cond) { SDL_cond_cv *cond = (SDL_cond_cv *)_cond; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } pWakeConditionVariable(&cond->cond); @@ -122,7 +122,7 @@ SDL_CondBroadcast_cv(SDL_cond * _cond) { SDL_cond_cv *cond = (SDL_cond_cv *)_cond; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } pWakeAllConditionVariable(&cond->cond); @@ -138,10 +138,10 @@ SDL_CondWaitTimeout_cv(SDL_cond * _cond, SDL_mutex * _mutex, Uint32 ms) int ret; if (!cond) { - return SDL_InvalidParamError("cond"); + return SDL_SetError("Passed a NULL condition variable"); } if (!_mutex) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } if (ms == SDL_MUTEX_MAXWAIT) { diff --git a/externals/SDL/src/thread/windows/SDL_sysmutex.c b/externals/SDL/src/thread/windows/SDL_sysmutex.c index b0b4abcb0..327f31db5 100755 --- a/externals/SDL/src/thread/windows/SDL_sysmutex.c +++ b/externals/SDL/src/thread/windows/SDL_sysmutex.c @@ -88,7 +88,7 @@ SDL_LockMutex_srw(SDL_mutex * _mutex) DWORD this_thread; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } this_thread = GetCurrentThreadId(); @@ -115,7 +115,7 @@ SDL_TryLockMutex_srw(SDL_mutex * _mutex) int retval = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } this_thread = GetCurrentThreadId(); @@ -139,7 +139,7 @@ SDL_UnlockMutex_srw(SDL_mutex * _mutex) SDL_mutex_srw *mutex = (SDL_mutex_srw *)_mutex; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } if (mutex->owner == GetCurrentThreadId()) { @@ -208,7 +208,7 @@ SDL_LockMutex_cs(SDL_mutex * mutex_) { SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } EnterCriticalSection(&mutex->cs); @@ -222,7 +222,7 @@ SDL_TryLockMutex_cs(SDL_mutex * mutex_) SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_; int retval = 0; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } if (TryEnterCriticalSection(&mutex->cs) == 0) { @@ -237,7 +237,7 @@ SDL_UnlockMutex_cs(SDL_mutex * mutex_) { SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_; if (mutex == NULL) { - return SDL_InvalidParamError("mutex"); + return SDL_SetError("Passed a NULL mutex"); } LeaveCriticalSection(&mutex->cs); diff --git a/externals/SDL/src/thread/windows/SDL_syssem.c b/externals/SDL/src/thread/windows/SDL_syssem.c index 794a713a8..3c2e69cf0 100755 --- a/externals/SDL/src/thread/windows/SDL_syssem.c +++ b/externals/SDL/src/thread/windows/SDL_syssem.c @@ -122,7 +122,7 @@ SDL_SemTryWait_atom(SDL_sem * _sem) LONG count; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); } count = sem->count; @@ -144,7 +144,7 @@ SDL_SemWait_atom(SDL_sem * _sem) LONG count; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); } for (;;) { @@ -176,7 +176,7 @@ SDL_SemWaitTimeout_atom(SDL_sem * _sem, Uint32 timeout) } if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); } /** @@ -219,7 +219,7 @@ SDL_SemValue_atom(SDL_sem * _sem) SDL_sem_atom *sem = (SDL_sem_atom *)_sem; if (!sem) { - SDL_InvalidParamError("sem"); + SDL_SetError("Passed a NULL sem"); return 0; } @@ -232,7 +232,7 @@ SDL_SemPost_atom(SDL_sem * _sem) SDL_sem_atom *sem = (SDL_sem_atom *)_sem; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); } InterlockedIncrement(&sem->count); @@ -313,7 +313,7 @@ SDL_SemWaitTimeout_kern(SDL_sem * _sem, Uint32 timeout) DWORD dwMilliseconds; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); } if (timeout == SDL_MUTEX_MAXWAIT) { @@ -354,7 +354,7 @@ SDL_SemValue_kern(SDL_sem * _sem) { SDL_sem_kern *sem = (SDL_sem_kern *)_sem; if (!sem) { - SDL_InvalidParamError("sem"); + SDL_SetError("Passed a NULL sem"); return 0; } return (Uint32)sem->count; @@ -365,7 +365,7 @@ SDL_SemPost_kern(SDL_sem * _sem) { SDL_sem_kern *sem = (SDL_sem_kern *)_sem; if (!sem) { - return SDL_InvalidParamError("sem"); + return SDL_SetError("Passed a NULL sem"); } /* Increase the counter in the first place, because * after a successful release the semaphore may diff --git a/externals/SDL/src/timer/os2/SDL_systimer.c b/externals/SDL/src/timer/os2/SDL_systimer.c index 8a8425d29..c5bcf64b7 100755 --- a/externals/SDL/src/timer/os2/SDL_systimer.c +++ b/externals/SDL/src/timer/os2/SDL_systimer.c @@ -39,7 +39,6 @@ typedef unsigned long long ULLONG; -static SDL_bool ticks_started = SDL_FALSE; static ULONG ulTmrFreq = 0; static ULLONG ullTmrStart = 0; @@ -47,14 +46,7 @@ void SDL_TicksInit(void) { ULONG ulTmrStart; /* for 32-bit fallback. */ - ULONG ulRC; - - if (ticks_started) { - return; - } - ticks_started = SDL_TRUE; - - ulRC = DosTmrQueryFreq(&ulTmrFreq); + ULONG ulRC = DosTmrQueryFreq(&ulTmrFreq); if (ulRC != NO_ERROR) { debug_os2("DosTmrQueryFreq() failed, rc = %u", ulRC); } else { @@ -73,7 +65,6 @@ SDL_TicksInit(void) void SDL_TicksQuit(void) { - ticks_started = SDL_FALSE; } Uint64 @@ -82,7 +73,7 @@ SDL_GetTicks64(void) Uint64 ui64Result; ULLONG ullTmrNow; - if (!ticks_started) { + if (ulTmrFreq == 0) { /* Was not initialized. */ SDL_TicksInit(); } diff --git a/externals/SDL/src/timer/unix/SDL_systimer.c b/externals/SDL/src/timer/unix/SDL_systimer.c index 2cf26764c..57fdab09c 100755 --- a/externals/SDL/src/timer/unix/SDL_systimer.c +++ b/externals/SDL/src/timer/unix/SDL_systimer.c @@ -187,6 +187,13 @@ SDL_GetPerformanceFrequency(void) void SDL_Delay(Uint32 ms) { +#ifdef __EMSCRIPTEN__ + if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { + /* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */ + emscripten_sleep(ms); + return; + } +#endif int was_error; #if HAVE_NANOSLEEP @@ -196,14 +203,6 @@ SDL_Delay(Uint32 ms) Uint64 then, now, elapsed; #endif -#ifdef __EMSCRIPTEN__ - if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { - /* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */ - emscripten_sleep(ms); - return; - } -#endif - /* Set the timeout interval */ #if HAVE_NANOSLEEP elapsed.tv_sec = ms / 1000; diff --git a/externals/SDL/src/video/SDL_RLEaccel.c b/externals/SDL/src/video/SDL_RLEaccel.c index b67b765e9..983c9d914 100755 --- a/externals/SDL/src/video/SDL_RLEaccel.c +++ b/externals/SDL/src/video/SDL_RLEaccel.c @@ -92,6 +92,10 @@ #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + #define PIXEL_COPY(to, from, len, bpp) \ SDL_memcpy(to, from, (size_t)(len) * (bpp)) @@ -1157,13 +1161,13 @@ RLEAlphaSurface(SDL_Surface * surface) ADD_OPAQUE_COUNTS(max_opaque_run, 0); skip -= max_opaque_run; } - len = SDL_min(run, max_opaque_run); + len = MIN(run, max_opaque_run); ADD_OPAQUE_COUNTS(skip, len); dst += copy_opaque(dst, src + runstart, len, sf, df); runstart += len; run -= len; while (run) { - len = SDL_min(run, max_opaque_run); + len = MIN(run, max_opaque_run); ADD_OPAQUE_COUNTS(0, len); dst += copy_opaque(dst, src + runstart, len, sf, df); runstart += len; @@ -1191,13 +1195,13 @@ RLEAlphaSurface(SDL_Surface * surface) ADD_TRANSL_COUNTS(max_transl_run, 0); skip -= max_transl_run; } - len = SDL_min(run, max_transl_run); + len = MIN(run, max_transl_run); ADD_TRANSL_COUNTS(skip, len); dst += copy_transl(dst, src + runstart, len, sf, df); runstart += len; run -= len; while (run) { - len = SDL_min(run, max_transl_run); + len = MIN(run, max_transl_run); ADD_TRANSL_COUNTS(0, len); dst += copy_transl(dst, src + runstart, len, sf, df); runstart += len; @@ -1218,13 +1222,9 @@ RLEAlphaSurface(SDL_Surface * surface) /* Now that we have it encoded, release the original pixels */ if (!(surface->flags & SDL_PREALLOC)) { - if (surface->flags & SDL_SIMD_ALIGNED) { - SDL_SIMDFree(surface->pixels); - surface->flags &= ~SDL_SIMD_ALIGNED; - } else { - SDL_free(surface->pixels); - } + SDL_SIMDFree(surface->pixels); surface->pixels = NULL; + surface->flags &= ~SDL_SIMD_ALIGNED; } /* reallocate the buffer to release unused memory */ @@ -1359,14 +1359,14 @@ RLEColorkeySurface(SDL_Surface * surface) ADD_COUNTS(maxn, 0); skip -= maxn; } - len = SDL_min(run, maxn); + len = MIN(run, maxn); ADD_COUNTS(skip, len); SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp); dst += len * bpp; run -= len; runstart += len; while (run) { - len = SDL_min(run, maxn); + len = MIN(run, maxn); ADD_COUNTS(0, len); SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp); dst += len * bpp; @@ -1386,13 +1386,9 @@ RLEColorkeySurface(SDL_Surface * surface) /* Now that we have it encoded, release the original pixels */ if (!(surface->flags & SDL_PREALLOC)) { - if (surface->flags & SDL_SIMD_ALIGNED) { - SDL_SIMDFree(surface->pixels); - surface->flags &= ~SDL_SIMD_ALIGNED; - } else { - SDL_free(surface->pixels); - } + SDL_SIMDFree(surface->pixels); surface->pixels = NULL; + surface->flags &= ~SDL_SIMD_ALIGNED; } /* reallocate the buffer to release unused memory */ diff --git a/externals/SDL/src/video/SDL_blit.c b/externals/SDL/src/video/SDL_blit.c index fa6492f51..dc4d7e9c3 100755 --- a/externals/SDL/src/video/SDL_blit.c +++ b/externals/SDL/src/video/SDL_blit.c @@ -231,7 +231,9 @@ SDL_CalculateBlit(SDL_Surface * surface) if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) { blit = SDL_BlitCopy; } else if (surface->format->Rloss > 8 || dst->format->Rloss > 8) { - blit = SDL_Blit_Slow; + /* Greater than 8 bits per channel not supported yet */ + SDL_InvalidateMap(map); + return SDL_SetError("Blit combination not supported"); } #if SDL_HAVE_BLIT_0 else if (surface->format->BitsPerPixel < 8 && diff --git a/externals/SDL/src/video/SDL_blit.h b/externals/SDL/src/video/SDL_blit.h index e00ba68e2..53222e441 100755 --- a/externals/SDL/src/video/SDL_blit.h +++ b/externals/SDL/src/video/SDL_blit.h @@ -269,18 +269,18 @@ do { \ { \ switch (bpp) { \ case 1: { \ - Uint8 _pixel; \ + Uint8 _Pixel; \ \ - PIXEL_FROM_RGB(_pixel, fmt, r, g, b); \ - *((Uint8 *)(buf)) = _pixel; \ + PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ + *((Uint8 *)(buf)) = _Pixel; \ } \ break; \ \ case 2: { \ - Uint16 _pixel; \ + Uint16 _Pixel; \ \ - PIXEL_FROM_RGB(_pixel, fmt, r, g, b); \ - *((Uint16 *)(buf)) = _pixel; \ + PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ + *((Uint16 *)(buf)) = _Pixel; \ } \ break; \ \ @@ -298,10 +298,10 @@ do { \ break; \ \ case 4: { \ - Uint32 _pixel; \ + Uint32 _Pixel; \ \ - PIXEL_FROM_RGB(_pixel, fmt, r, g, b); \ - *((Uint32 *)(buf)) = _pixel; \ + PIXEL_FROM_RGB(_Pixel, fmt, r, g, b); \ + *((Uint32 *)(buf)) = _Pixel; \ } \ break; \ } \ diff --git a/externals/SDL/src/video/SDL_blit_0.c b/externals/SDL/src/video/SDL_blit_0.c index 54882f8b1..e2eecba7d 100755 --- a/externals/SDL/src/video/SDL_blit_0.c +++ b/externals/SDL/src/video/SDL_blit_0.c @@ -452,94 +452,11 @@ static const SDL_BlitFunc colorkey_blit[] = { (SDL_BlitFunc) NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key }; - -static void -Blit4bto4(SDL_BlitInfo * info) -{ - int width = info->dst_w; - int height = info->dst_h; - Uint8 *src = info->src; - Uint32 *dst = (Uint32 *) info->dst; - int srcskip = info->src_skip; - int dstskip = info->dst_skip; - Uint32 *map = (Uint32 *) info->table; - int c; - - /* Set up some basic variables */ - srcskip += width - (width + 1) / 2; - - while (height--) { - Uint8 byte = 0, bit; - for (c = 0; c < width; ++c) { - if ((c & 0x1) == 0) { - byte = *src++; - } - bit = (byte & 0xF0) >> 4; - if (1) { - *dst = map[bit]; - } - byte <<= 4; - dst++; - } - src += srcskip; - dst = (Uint32 *) ((Uint8 *) dst + dstskip); - } -} - -static void -Blit4bto4Key(SDL_BlitInfo * info) -{ - int width = info->dst_w; - int height = info->dst_h; - Uint8 *src = info->src; - Uint32 *dst = (Uint32 *) info->dst; - int srcskip = info->src_skip; - int dstskip = info->dst_skip; - Uint32 ckey = info->colorkey; - Uint32 *map = (Uint32 *) info->table; - int c; - - /* Set up some basic variables */ - srcskip += width - (width + 1) / 2; - - while (height--) { - Uint8 byte = 0, bit; - for (c = 0; c < width; ++c) { - if ((c & 0x1) == 0) { - byte = *src++; - } - bit = (byte & 0xF0) >> 4; - if (bit != ckey) { - *dst = map[bit]; - } - byte <<= 4; - dst++; - } - src += srcskip; - dst = (Uint32 *) ((Uint8 *) dst + dstskip); - } -} - SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface * surface) { int which; - /* 4bits to 32bits */ - if (surface->format->BitsPerPixel == 4) { - if (surface->map->dst->format->BytesPerPixel == 4) { - switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) { - case 0: - return Blit4bto4; - - case SDL_COPY_COLORKEY: - return Blit4bto4Key; - } - } - /* We don't fully support 4-bit packed pixel modes */ - return NULL; - } - if (surface->format->BitsPerPixel != 1) { /* We don't support sub 8-bit packed pixel modes */ return (SDL_BlitFunc) NULL; diff --git a/externals/SDL/src/video/SDL_blit_1.c b/externals/SDL/src/video/SDL_blit_1.c index 2c353fd27..d5030cfb1 100755 --- a/externals/SDL/src/video/SDL_blit_1.c +++ b/externals/SDL/src/video/SDL_blit_1.c @@ -50,7 +50,7 @@ Blit1to1(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { *dst = map[*src]; @@ -58,7 +58,7 @@ Blit1to1(SDL_BlitInfo * info) dst++; src++; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width; c; --c) { *dst = map[*src]; @@ -103,14 +103,14 @@ Blit1to2(SDL_BlitInfo * info) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { *(Uint16 *)dst = map[*src++]; dst += 2; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -210,7 +210,7 @@ Blit1to3(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { o = *src * 4; @@ -221,7 +221,7 @@ Blit1to3(SDL_BlitInfo * info) src++; dst += 3; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width; c; --c) { o = *src * 4; @@ -259,11 +259,11 @@ Blit1to4(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( *dst++ = map[*src++]; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width / 4; c; --c) { *dst++ = map[*src++]; @@ -299,7 +299,7 @@ Blit1to1Key(SDL_BlitInfo * info) if (palmap) { while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -309,13 +309,13 @@ Blit1to1Key(SDL_BlitInfo * info) src++; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } } else { while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -325,7 +325,7 @@ Blit1to1Key(SDL_BlitInfo * info) src++; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -348,7 +348,7 @@ Blit1to2Key(SDL_BlitInfo * info) dstskip /= 2; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -358,7 +358,7 @@ Blit1to2Key(SDL_BlitInfo * info) dstp++; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dstp += dstskip; } @@ -378,7 +378,7 @@ Blit1to3Key(SDL_BlitInfo * info) int o; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -391,7 +391,7 @@ Blit1to3Key(SDL_BlitInfo * info) dst += 3; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -413,7 +413,7 @@ Blit1to4Key(SDL_BlitInfo * info) dstskip /= 4; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -423,7 +423,7 @@ Blit1to4Key(SDL_BlitInfo * info) dstp++; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dstp += dstskip; } @@ -450,7 +450,7 @@ Blit1toNAlpha(SDL_BlitInfo * info) dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4( { sR = srcpal[*src].r; @@ -463,7 +463,7 @@ Blit1toNAlpha(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -491,7 +491,7 @@ Blit1toNAlphaKey(SDL_BlitInfo * info) dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ( *src != ckey ) { @@ -506,7 +506,7 @@ Blit1toNAlphaKey(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } diff --git a/externals/SDL/src/video/SDL_blit_A.c b/externals/SDL/src/video/SDL_blit_A.c index 56ba024c9..4c0726eb0 100755 --- a/externals/SDL/src/video/SDL_blit_A.c +++ b/externals/SDL/src/video/SDL_blit_A.c @@ -47,7 +47,7 @@ BlitNto1SurfaceAlpha(SDL_BlitInfo * info) const unsigned A = info->a; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -68,7 +68,7 @@ BlitNto1SurfaceAlpha(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -93,7 +93,7 @@ BlitNto1PixelAlpha(SDL_BlitInfo * info) unsigned dR, dG, dB; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4( { DISEMBLE_RGBA(src,srcbpp,srcfmt,Pixel,sR,sG,sB,sA); @@ -114,7 +114,7 @@ BlitNto1PixelAlpha(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -141,7 +141,7 @@ BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info) const unsigned A = info->a; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -164,7 +164,7 @@ BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -348,7 +348,7 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info) multmask2 = 0x00FF00FF00FF00FFULL; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ Uint32 alpha = *srcp & amask; if (alpha == 0) { @@ -382,7 +382,7 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -467,14 +467,14 @@ BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 2; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ Uint32 s = *srcp++; Uint32 d = *dstp; *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) + (s & d & 0x00010101)) | 0xff000000; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -500,7 +500,7 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info) Uint32 d1; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ s = *srcp; d = *dstp; @@ -515,7 +515,7 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -534,7 +534,7 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 2; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ Uint32 dalpha; Uint32 d; @@ -569,7 +569,7 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -587,7 +587,7 @@ BlitRGBtoBGRPixelAlpha(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 2; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ Uint32 dalpha; Uint32 d; @@ -624,7 +624,7 @@ BlitRGBtoBGRPixelAlpha(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -654,7 +654,7 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info) multmask2 = 0x00FF00FF00FF00FFULL; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ Uint32 alpha; @@ -694,7 +694,7 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info) ++srcp; ++dstp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -848,7 +848,7 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info) bmask = _mm_set_pi32(0x001F001F, 0x001F001F); /* MASKBLUE -> bmask */ while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP_124( { s = *srcp++; @@ -944,7 +944,7 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info) srcp += 4; dstp += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -986,7 +986,7 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info) bmask = _mm_set_pi32(0x001F001F, 0x001F001F); /* MASKBLUE -> bmask */ while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP_124( { s = *srcp++; @@ -1082,7 +1082,7 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info) srcp += 4; dstp += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1109,7 +1109,7 @@ Blit565to565SurfaceAlpha(SDL_BlitInfo * info) alpha >>= 3; /* downscale alpha to 5 bits */ while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ Uint32 s = *srcp++; Uint32 d = *dstp; @@ -1124,7 +1124,7 @@ Blit565to565SurfaceAlpha(SDL_BlitInfo * info) d &= 0x07e0f81f; *dstp++ = (Uint16)(d | d >> 16); }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1148,7 +1148,7 @@ Blit555to555SurfaceAlpha(SDL_BlitInfo * info) alpha >>= 3; /* downscale alpha to 5 bits */ while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ Uint32 s = *srcp++; Uint32 d = *dstp; @@ -1163,7 +1163,7 @@ Blit555to555SurfaceAlpha(SDL_BlitInfo * info) d &= 0x03e07c1f; *dstp++ = (Uint16)(d | d >> 16); }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1182,7 +1182,7 @@ BlitARGBto565PixelAlpha(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 1; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ Uint32 s = *srcp; unsigned alpha = s >> 27; /* downscale alpha to 5 bits */ @@ -1210,7 +1210,7 @@ BlitARGBto565PixelAlpha(SDL_BlitInfo * info) srcp++; dstp++; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1228,7 +1228,7 @@ BlitARGBto555PixelAlpha(SDL_BlitInfo * info) int dstskip = info->dst_skip >> 1; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4({ unsigned alpha; Uint32 s = *srcp; @@ -1257,7 +1257,7 @@ BlitARGBto555PixelAlpha(SDL_BlitInfo * info) srcp++; dstp++; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -1284,7 +1284,7 @@ BlitNtoNSurfaceAlpha(SDL_BlitInfo * info) if (sA) { while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -1295,7 +1295,7 @@ BlitNtoNSurfaceAlpha(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1323,7 +1323,7 @@ BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info) const unsigned sA = info->a; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4( { RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel); @@ -1337,7 +1337,7 @@ BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1366,7 +1366,7 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info) dstbpp = dstfmt->BytesPerPixel; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP4( { DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); @@ -1379,7 +1379,7 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info) dst += dstbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } diff --git a/externals/SDL/src/video/SDL_blit_N.c b/externals/SDL/src/video/SDL_blit_N.c index ae9c30882..5736b86e3 100755 --- a/externals/SDL/src/video/SDL_blit_N.c +++ b/externals/SDL/src/video/SDL_blit_N.c @@ -128,7 +128,7 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) * leave alpha with a zero mask, but we should still swizzle the bits. */ /* ARGB */ - static const struct SDL_PixelFormat default_pixel_format = { + const static const struct SDL_PixelFormat default_pixel_format = { 0, NULL, 0, 0, {0, 0}, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, @@ -1008,11 +1008,11 @@ Blit_RGB888_index8(SDL_BlitInfo * info) if (map == NULL) { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( RGB888_RGB332(*dst++, *src); , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -1044,13 +1044,13 @@ Blit_RGB888_index8(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( RGB888_RGB332(Pixel, *src); *dst++ = map[Pixel]; ++src; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -1118,11 +1118,11 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) if (map == NULL) { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( RGB101010_RGB332(*dst++, *src); , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -1154,13 +1154,13 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( RGB101010_RGB332(Pixel, *src); *dst++ = map[Pixel]; ++src; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width / 4; c; --c) { /* Pack RGB into 8bit pixel */ @@ -1235,13 +1235,13 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( RGB888_RGB555(dst, src); ++src; ++dst; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1361,13 +1361,13 @@ Blit_RGB888_RGB565(SDL_BlitInfo * info) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( RGB888_RGB565(dst, src); ++src; ++dst; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -1476,14 +1476,14 @@ Blit_RGB565_32(SDL_BlitInfo * info, const Uint32 * map) #ifdef USE_DUFFS_LOOP while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { *dst++ = RGB565_32(dst, src, map); src += 2; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2088,7 +2088,7 @@ Blit_RGB555_ARGB1555(SDL_BlitInfo * info) Uint16 mask = ((Uint32)info->a >> dstfmt->Aloss) << dstfmt->Ashift; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { *dst = *src | mask; @@ -2096,7 +2096,7 @@ Blit_RGB555_ARGB1555(SDL_BlitInfo * info) ++src; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src = (Uint16 *) ((Uint8 *) src + srcskip); dst = (Uint16 *) ((Uint8 *) dst + dstskip); } @@ -2132,7 +2132,7 @@ BlitNto1(SDL_BlitInfo * info) if (map == NULL) { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2145,7 +2145,7 @@ BlitNto1(SDL_BlitInfo * info) dst++; src += srcbpp; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width; c; --c) { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2164,7 +2164,7 @@ BlitNto1(SDL_BlitInfo * info) } else { while (height--) { #ifdef USE_DUFFS_LOOP - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2177,7 +2177,7 @@ BlitNto1(SDL_BlitInfo * info) dst++; src += srcbpp; , width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ #else for (c = width; c; --c) { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB); @@ -2214,7 +2214,7 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) Uint32 mask = ((Uint32)info->a >> dstfmt->Aloss) << dstfmt->Ashift; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { *dst = *src | mask; @@ -2222,7 +2222,7 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) ++src; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2231,7 +2231,7 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { *dst = *src & mask; @@ -2239,7 +2239,7 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info) ++src; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2259,7 +2259,7 @@ Blit4to4CopyAlpha(SDL_BlitInfo * info) /* RGBA->RGBA, COPY_ALPHA */ while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { *dst = *src; @@ -2267,7 +2267,7 @@ Blit4to4CopyAlpha(SDL_BlitInfo * info) ++src; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src = (Uint32 *) ((Uint8 *) src + srcskip); dst = (Uint32 *) ((Uint8 *) dst + dstskip); } @@ -2380,7 +2380,7 @@ BlitNtoN(SDL_BlitInfo * info) get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { dst[0] = src[p0]; @@ -2391,7 +2391,7 @@ BlitNtoN(SDL_BlitInfo * info) src += 4; dst += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2408,7 +2408,7 @@ BlitNtoN(SDL_BlitInfo * info) get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { dst[0] = src[p0]; @@ -2417,7 +2417,7 @@ BlitNtoN(SDL_BlitInfo * info) src += 4; dst += 3; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2434,7 +2434,7 @@ BlitNtoN(SDL_BlitInfo * info) get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { dst[0] = src[p0]; @@ -2445,7 +2445,7 @@ BlitNtoN(SDL_BlitInfo * info) src += 3; dst += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2454,7 +2454,7 @@ BlitNtoN(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint32 Pixel; @@ -2467,7 +2467,7 @@ BlitNtoN(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2499,7 +2499,7 @@ BlitNtoNCopyAlpha(SDL_BlitInfo * info) get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { dst[0] = src[p0]; @@ -2509,7 +2509,7 @@ BlitNtoNCopyAlpha(SDL_BlitInfo * info) src += 4; dst += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2554,7 +2554,7 @@ BlitNto1Key(SDL_BlitInfo * info) if (palmap == NULL) { while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, @@ -2569,13 +2569,13 @@ BlitNto1Key(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } } else { while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, @@ -2590,7 +2590,7 @@ BlitNto1Key(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2615,7 +2615,7 @@ Blit2to2Key(SDL_BlitInfo * info) ckey &= rgbmask; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ( (*srcp & rgbmask) != ckey ) { @@ -2625,7 +2625,7 @@ Blit2to2Key(SDL_BlitInfo * info) srcp++; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ srcp += srcskip; dstp += dstskip; } @@ -2662,7 +2662,7 @@ BlitNtoNKey(SDL_BlitInfo * info) /* RGB->RGBA, SET_ALPHA */ Uint32 mask = ((Uint32)info->a) << dstfmt->Ashift; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ((*src32 & rgbmask) != ckey) { @@ -2671,7 +2671,7 @@ BlitNtoNKey(SDL_BlitInfo * info) ++dst32; ++src32; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src32 = (Uint32 *) ((Uint8 *) src32 + srcskip); dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip); } @@ -2680,7 +2680,7 @@ BlitNtoNKey(SDL_BlitInfo * info) /* RGBA->RGB, NO_ALPHA */ Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ((*src32 & rgbmask) != ckey) { @@ -2689,7 +2689,7 @@ BlitNtoNKey(SDL_BlitInfo * info) ++dst32; ++src32; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src32 = (Uint32 *) ((Uint8 *) src32 + srcskip); dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip); } @@ -2708,7 +2708,7 @@ BlitNtoNKey(SDL_BlitInfo * info) get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint32 *src32 = (Uint32*)src; @@ -2723,7 +2723,7 @@ BlitNtoNKey(SDL_BlitInfo * info) src += 4; dst += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2746,7 +2746,7 @@ BlitNtoNKey(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint8 s0 = src[0]; @@ -2762,7 +2762,7 @@ BlitNtoNKey(SDL_BlitInfo * info) dst += 3; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2784,7 +2784,7 @@ BlitNtoNKey(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint8 s0 = src[0]; @@ -2800,7 +2800,7 @@ BlitNtoNKey(SDL_BlitInfo * info) dst += 3; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2816,7 +2816,7 @@ BlitNtoNKey(SDL_BlitInfo * info) get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint32 *src32 = (Uint32*)src; @@ -2828,7 +2828,7 @@ BlitNtoNKey(SDL_BlitInfo * info) src += 4; dst += 3; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2855,7 +2855,7 @@ BlitNtoNKey(SDL_BlitInfo * info) get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel); while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint8 s0 = src[0]; @@ -2872,7 +2872,7 @@ BlitNtoNKey(SDL_BlitInfo * info) src += 3; dst += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2881,7 +2881,7 @@ BlitNtoNKey(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint32 Pixel; @@ -2897,7 +2897,7 @@ BlitNtoNKey(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2938,7 +2938,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) Uint32 *src32 = (Uint32*)src; Uint32 *dst32 = (Uint32*)dst; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { if ((*src32 & rgbmask) != ckey) { @@ -2948,7 +2948,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) ++dst32; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src32 = (Uint32 *)((Uint8 *)src32 + srcskip); dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip); } @@ -2967,7 +2967,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL); while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint32 *src32 = (Uint32*)src; @@ -2980,7 +2980,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) src += 4; dst += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -2989,7 +2989,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); @@ -3000,7 +3000,7 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -3022,7 +3022,7 @@ Blit2101010toN(SDL_BlitInfo * info) unsigned sR, sG, sB, sA; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Pixel = *(Uint32 *)src; @@ -3032,7 +3032,7 @@ Blit2101010toN(SDL_BlitInfo * info) src += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -3054,7 +3054,7 @@ BlitNto2101010(SDL_BlitInfo * info) unsigned sR, sG, sB, sA; while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA); @@ -3064,7 +3064,7 @@ BlitNto2101010(SDL_BlitInfo * info) src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -3096,7 +3096,7 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) int i2 = srcbpp - 1 - 2; #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint32 *dst32 = (Uint32*)dst; @@ -3107,7 +3107,7 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) dst += 4; src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -3125,7 +3125,7 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) int j2 = dstbpp - 1 - 2; #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint8 s0 = src[i0]; @@ -3137,7 +3137,7 @@ Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo * info) dst += dstbpp; src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -3169,7 +3169,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) #else int i0 = 3, i1 = 2, i2 = 1, i3 = 0; #endif - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint32 *dst32 = (Uint32*)dst; @@ -3182,7 +3182,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) dst += 4; src += 4; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -3197,7 +3197,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) int i2 = srcbpp - 1 - 2; #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint32 *dst32 = (Uint32*)dst; @@ -3209,7 +3209,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) dst += 4; src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } @@ -3228,7 +3228,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) int j2 = dstbpp - 1 - 0; #endif while (height--) { - /* *INDENT-OFF* */ /* clang-format off */ + /* *INDENT-OFF* */ DUFFS_LOOP( { Uint8 s0 = src[i0]; @@ -3241,7 +3241,7 @@ Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo * info) dst += dstbpp; src += srcbpp; }, width); - /* *INDENT-ON* */ /* clang-format on */ + /* *INDENT-ON* */ src += srcskip; dst += dstskip; } diff --git a/externals/SDL/src/video/SDL_blit_auto.c b/externals/SDL/src/video/SDL_blit_auto.c index f15a43622..359c1bdf5 100755 --- a/externals/SDL/src/video/SDL_blit_auto.c +++ b/externals/SDL/src/video/SDL_blit_auto.c @@ -23,7 +23,7 @@ #if SDL_HAVE_BLIT_AUTO -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ #include "SDL_video.h" #include "SDL_blit.h" @@ -756,6 +756,7 @@ static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; const Uint32 A = 0xFF; + Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -775,7 +776,8 @@ static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - pixel |= (A << 24); + R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + pixel = (A << 24) | (R << 16) | (G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -2230,6 +2232,7 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; + Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -2249,7 +2252,8 @@ static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - pixel &= 0xFFFFFF; + R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; + pixel = (R << 16) | (G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -3391,6 +3395,7 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; + Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -3410,7 +3415,8 @@ static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - pixel >>= 8; + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); + pixel = (R << 16) | (G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -4157,6 +4163,7 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; + Uint32 R, G, B, A; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -4176,7 +4183,8 @@ static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - pixel = (pixel >> 8) | (pixel << 24); + R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel; + pixel = (A << 24) | (R << 16) | (G << 8) | B; *dst = pixel; posx += incx; ++dst; @@ -4939,6 +4947,7 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; + Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -4958,7 +4967,8 @@ static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - pixel &= 0xFFFFFF; + B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; + pixel = (B << 16) | (G << 8) | R; *dst = pixel; posx += incx; ++dst; @@ -6105,6 +6115,7 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; + Uint32 R, G, B; int srcy, srcx; Uint32 posy, posx; int incy, incx; @@ -6124,7 +6135,8 @@ static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) srcx = posx >> 16; src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4)); pixel = *src; - pixel >>= 8; + B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); + pixel = (B << 16) | (G << 8) | R; *dst = pixel; posx += incx; ++dst; @@ -7014,7 +7026,7 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = { { 0, 0, 0, 0, NULL } }; -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ #endif /* SDL_HAVE_BLIT_AUTO */ diff --git a/externals/SDL/src/video/SDL_blit_slow.c b/externals/SDL/src/video/SDL_blit_slow.c index ed9c692b1..a104517e8 100755 --- a/externals/SDL/src/video/SDL_blit_slow.c +++ b/externals/SDL/src/video/SDL_blit_slow.c @@ -24,21 +24,6 @@ #include "SDL_blit.h" #include "SDL_blit_slow.h" -#define FORMAT_ALPHA 0 -#define FORMAT_NO_ALPHA -1 -#define FORMAT_2101010 1 -#define FORMAT_HAS_ALPHA(format) format == 0 -#define FORMAT_HAS_NO_ALPHA(format) format < 0 -static int SDL_INLINE detect_format(SDL_PixelFormat *pf) { - if (pf->format == SDL_PIXELFORMAT_ARGB2101010) { - return FORMAT_2101010; - } else if (pf->Amask) { - return FORMAT_ALPHA; - } else { - return FORMAT_NO_ALPHA; - } -} - /* The ONE TRUE BLITTER * This puppy has to handle all the unoptimized cases - yes, it's slow. */ @@ -61,14 +46,9 @@ SDL_Blit_Slow(SDL_BlitInfo * info) SDL_PixelFormat *dst_fmt = info->dst_fmt; int srcbpp = src_fmt->BytesPerPixel; int dstbpp = dst_fmt->BytesPerPixel; - int srcfmt_val; - int dstfmt_val; Uint32 rgbmask = ~src_fmt->Amask; Uint32 ckey = info->colorkey & rgbmask; - srcfmt_val = detect_format(src_fmt); - dstfmt_val = detect_format(dst_fmt); - incy = (info->src_h << 16) / info->dst_h; incx = (info->src_w << 16) / info->dst_w; posy = incy / 2; /* start at the middle of pixel */ @@ -82,18 +62,14 @@ SDL_Blit_Slow(SDL_BlitInfo * info) while (n--) { srcx = posx >> 16; src = (info->src + (srcy * info->src_pitch) + (srcx * srcbpp)); - - if (FORMAT_HAS_ALPHA(srcfmt_val)) { - DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB, srcA); - } else if (FORMAT_HAS_NO_ALPHA(srcfmt_val)) { - DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB); - srcA = 0xFF; + if (src_fmt->Amask) { + DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, + srcB, srcA); } else { - /* SDL_PIXELFORMAT_ARGB2101010 */ - srcpixel = *((Uint32 *)(src)); - RGBA_FROM_ARGB2101010(srcpixel, srcR, srcG, srcB, srcA); + DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, + srcB); + srcA = 0xFF; } - if (flags & SDL_COPY_COLORKEY) { /* srcpixel isn't set for 24 bpp */ if (srcbpp == 3) { @@ -106,15 +82,13 @@ SDL_Blit_Slow(SDL_BlitInfo * info) continue; } } - if (FORMAT_HAS_ALPHA(dstfmt_val)) { - DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA); - } else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) { - DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB); - dstA = 0xFF; + if (dst_fmt->Amask) { + DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, + dstB, dstA); } else { - /* SDL_PIXELFORMAT_ARGB2101010 */ - dstpixel = *((Uint32 *)(dst)); - RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA); + DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, + dstB); + dstA = 0xFF; } if (flags & SDL_COPY_MODULATE_COLOR) { @@ -177,15 +151,10 @@ SDL_Blit_Slow(SDL_BlitInfo * info) dstA = 255; break; } - if (FORMAT_HAS_ALPHA(dstfmt_val)) { + if (dst_fmt->Amask) { ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA); - } else if (FORMAT_HAS_NO_ALPHA(dstfmt_val)) { - ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); } else { - /* SDL_PIXELFORMAT_ARGB2101010 */ - Uint32 pixel; - ARGB2101010_FROM_RGBA(pixel, dstR, dstG, dstB, dstA); - *(Uint32 *)dst = pixel; + ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB); } posx += incx; dst += dstbpp; diff --git a/externals/SDL/src/video/SDL_bmp.c b/externals/SDL/src/video/SDL_bmp.c index cb220440a..5bddd7354 100755 --- a/externals/SDL/src/video/SDL_bmp.c +++ b/externals/SDL/src/video/SDL_bmp.c @@ -53,7 +53,7 @@ #define LCS_WINDOWS_COLOR_SPACE 0x57696E20 #endif -static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8) +static int readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8) { /* | Sets the surface pixels from src. A bmp image is upside down. @@ -70,14 +70,14 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8 #define COPY_PIXEL(x) spot = &bits[ofs++]; if(spot >= start && spot < end) *spot = (x) for (;;) { - if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; + if (!SDL_RWread(src, &ch, 1, 1)) return 1; /* | encoded mode starts with a run length, and then a byte | with two colour indexes to alternate between for the run */ if (ch) { Uint8 pixel; - if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE; + if (!SDL_RWread(src, &pixel, 1, 1)) return 1; if (isRle8) { /* 256-color bitmap, compressed */ do { COPY_PIXEL(pixel); @@ -98,18 +98,18 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8 | a cursor move, or some absolute data. | zero tag may be absolute mode or an escape */ - if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; + if (!SDL_RWread(src, &ch, 1, 1)) return 1; switch (ch) { case 0: /* end of line */ ofs = 0; bits -= pitch; /* go to previous */ break; case 1: /* end of bitmap */ - return SDL_FALSE; /* success! */ + return 0; /* success! */ case 2: /* delta */ - if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; + if (!SDL_RWread(src, &ch, 1, 1)) return 1; ofs += ch; - if (!SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; + if (!SDL_RWread(src, &ch, 1, 1)) return 1; bits -= (ch * pitch); break; default: /* no compression */ @@ -117,14 +117,14 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8 needsPad = (ch & 1); do { Uint8 pixel; - if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE; + if (!SDL_RWread(src, &pixel, 1, 1)) return 1; COPY_PIXEL(pixel); } while (--ch); } else { needsPad = (((ch+1)>>1) & 1); /* (ch+1)>>1: bytes size */ for (;;) { Uint8 pixel; - if (!SDL_RWread(src, &pixel, 1, 1)) return SDL_TRUE; + if (!SDL_RWread(src, &pixel, 1, 1)) return 1; COPY_PIXEL(pixel >> 4); if (!--ch) break; COPY_PIXEL(pixel & 0x0F); @@ -132,7 +132,7 @@ static SDL_bool readRlePixels(SDL_Surface * surface, SDL_RWops * src, int isRle8 } } /* pad at even boundary */ - if (needsPad && !SDL_RWread(src, &ch, 1, 1)) return SDL_TRUE; + if (needsPad && !SDL_RWread(src, &ch, 1, 1)) return 1; break; } } @@ -213,17 +213,12 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) surface = NULL; was_error = SDL_FALSE; if (src == NULL) { - SDL_InvalidParamError("src"); was_error = SDL_TRUE; goto done; } /* Read in the BMP file header */ fp_offset = SDL_RWtell(src); - if (fp_offset < 0) { - was_error = SDL_TRUE; - goto done; - } SDL_ClearError(); if (SDL_RWread(src, magic, 1, 2) != 2) { SDL_Error(SDL_EFREAD); @@ -412,12 +407,6 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) goto done; } - if (biBitCount >= 32) { /* we shift biClrUsed by this value later. */ - SDL_SetError("Unsupported or incorrect biBitCount field"); - was_error = SDL_TRUE; - goto done; - } - if (biClrUsed == 0) { biClrUsed = 1 << biBitCount; } @@ -462,8 +451,8 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) goto done; } if ((biCompression == BI_RLE4) || (biCompression == BI_RLE8)) { - was_error = readRlePixels(surface, src, biCompression == BI_RLE8); - if (was_error) SDL_Error(SDL_EFREAD); + was_error = (SDL_bool)readRlePixels(surface, src, biCompression == BI_RLE8); + if (was_error) SDL_SetError("Error reading from BMP"); goto done; } top = (Uint8 *)surface->pixels; @@ -495,7 +484,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) for (i = 0; i < surface->w; ++i) { if (i % (8 / ExpandBMP) == 0) { if (!SDL_RWread(src, &pixel, 1, 1)) { - SDL_Error(SDL_EFREAD); + SDL_SetError("Error reading from BMP"); was_error = SDL_TRUE; goto done; } diff --git a/externals/SDL/src/video/SDL_egl.c b/externals/SDL/src/video/SDL_egl.c index bd1578a7d..e10cf7c70 100755 --- a/externals/SDL/src/video/SDL_egl.c +++ b/externals/SDL/src/video/SDL_egl.c @@ -27,6 +27,7 @@ #endif #if SDL_VIDEO_DRIVER_ANDROID #include +#include "../core/android/SDL_android.h" #include "../video/android/SDL_androidvideo.h" #endif #if SDL_VIDEO_DRIVER_RPI @@ -98,7 +99,7 @@ #define DEFAULT_OGL_ES "libGLESv1_CM.so.1" #endif /* SDL_VIDEO_DRIVER_RPI */ -#if SDL_VIDEO_OPENGL && !SDL_VIDEO_VITA_PVR_OGL +#if SDL_VIDEO_OPENGL #include "SDL_opengl.h" #endif @@ -114,7 +115,7 @@ _this->egl_data->NAME = (void *)NAME; #else #define LOAD_FUNC(NAME) \ -_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->egl_dll_handle, #NAME); \ +_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ if (!_this->egl_data->NAME) \ { \ return SDL_SetError("Could not retrieve EGL function " #NAME); \ @@ -250,12 +251,12 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc) /* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */ if (!retval) { static char procname[64]; - retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc); + retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, proc); /* just in case you need an underscore prepended... */ if (!retval && (SDL_strlen(proc) < (sizeof (procname) - 1))) { procname[0] = '_'; SDL_strlcpy(procname + 1, proc, sizeof (procname) - 1); - retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, procname); + retval = SDL_LoadFunction(_this->egl_data->egl_dll_handle, procname); } } #endif @@ -280,14 +281,14 @@ SDL_EGL_UnloadLibrary(_THIS) _this->egl_data->egl_display = NULL; } + if (_this->egl_data->dll_handle) { + SDL_UnloadObject(_this->egl_data->dll_handle); + _this->egl_data->dll_handle = NULL; + } if (_this->egl_data->egl_dll_handle) { SDL_UnloadObject(_this->egl_data->egl_dll_handle); _this->egl_data->egl_dll_handle = NULL; } - if (_this->egl_data->opengl_dll_handle) { - SDL_UnloadObject(_this->egl_data->opengl_dll_handle); - _this->egl_data->opengl_dll_handle = NULL; - } SDL_free(_this->egl_data); _this->egl_data = NULL; @@ -297,7 +298,7 @@ SDL_EGL_UnloadLibrary(_THIS) int SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) { - void *egl_dll_handle = NULL, *opengl_dll_handle = NULL; + void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */ const char *path = NULL; #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT const char *d3dcompiler; @@ -349,32 +350,32 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */ path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); if (path != NULL) { - opengl_dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); } - if (opengl_dll_handle == NULL) { + if (egl_dll_handle == NULL) { if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { if (_this->gl_config.major_version > 1) { path = DEFAULT_OGL_ES2; - opengl_dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); #ifdef ALT_OGL_ES2 - if (opengl_dll_handle == NULL && !vc4) { + if (egl_dll_handle == NULL && !vc4) { path = ALT_OGL_ES2; - opengl_dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); } #endif } else { path = DEFAULT_OGL_ES; - opengl_dll_handle = SDL_LoadObject(path); - if (opengl_dll_handle == NULL) { + egl_dll_handle = SDL_LoadObject(path); + if (egl_dll_handle == NULL) { path = DEFAULT_OGL_ES_PVR; - opengl_dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); } #ifdef ALT_OGL_ES2 - if (opengl_dll_handle == NULL && !vc4) { + if (egl_dll_handle == NULL && !vc4) { path = ALT_OGL_ES2; - opengl_dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); } #endif } @@ -382,47 +383,47 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) #ifdef DEFAULT_OGL else { path = DEFAULT_OGL; - opengl_dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); #ifdef ALT_OGL - if (opengl_dll_handle == NULL) { + if (egl_dll_handle == NULL) { path = ALT_OGL; - opengl_dll_handle = SDL_LoadObject(path); + egl_dll_handle = SDL_LoadObject(path); } #endif } #endif } - _this->egl_data->opengl_dll_handle = opengl_dll_handle; + _this->egl_data->egl_dll_handle = egl_dll_handle; - if (opengl_dll_handle == NULL) { + if (egl_dll_handle == NULL) { return SDL_SetError("Could not initialize OpenGL / GLES library"); } /* Loading libGL* in the previous step took care of loading libEGL.so, but we future proof by double checking */ if (egl_path != NULL) { - egl_dll_handle = SDL_LoadObject(egl_path); + dll_handle = SDL_LoadObject(egl_path); } /* Try loading a EGL symbol, if it does not work try the default library paths */ - if (egl_dll_handle == NULL || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) { - if (egl_dll_handle != NULL) { - SDL_UnloadObject(egl_dll_handle); + if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) { + if (dll_handle != NULL) { + SDL_UnloadObject(dll_handle); } path = SDL_getenv("SDL_VIDEO_EGL_DRIVER"); if (path == NULL) { path = DEFAULT_EGL; } - egl_dll_handle = SDL_LoadObject(path); + dll_handle = SDL_LoadObject(path); #ifdef ALT_EGL - if (egl_dll_handle == NULL && !vc4) { + if (dll_handle == NULL && !vc4) { path = ALT_EGL; - egl_dll_handle = SDL_LoadObject(path); + dll_handle = SDL_LoadObject(path); } #endif - if (egl_dll_handle == NULL || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) { - if (egl_dll_handle != NULL) { - SDL_UnloadObject(egl_dll_handle); + if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) { + if (dll_handle != NULL) { + SDL_UnloadObject(dll_handle); } return SDL_SetError("Could not load EGL library"); } @@ -430,9 +431,9 @@ SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path) } #endif - _this->egl_data->egl_dll_handle = egl_dll_handle; + _this->egl_data->dll_handle = dll_handle; #if SDL_VIDEO_DRIVER_VITA - _this->egl_data->opengl_dll_handle = opengl_dll_handle; + _this->egl_data->egl_dll_handle = egl_dll_handle; #endif /* Load new function pointers */ @@ -529,7 +530,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } #endif /* Try the implementation-specific eglGetDisplay even if eglGetPlatformDisplay fails */ - if ((_this->egl_data->egl_display == EGL_NO_DISPLAY) && (_this->egl_data->eglGetDisplay != NULL)) { + if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); } if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { @@ -908,7 +909,8 @@ SDL_EGL_ChooseConfig(_THIS) int ret; if (!_this->egl_data) { - return SDL_SetError("EGL not initialized"); + /* The EGL library wasn't loaded, SDL_GetError() should have info */ + return -1; } /* Try with EGL_CONFIG_CAVEAT set to EGL_NONE, to avoid any EGL_SLOW_CONFIG or EGL_NON_CONFORMANT_CONFIG */ @@ -941,7 +943,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) SDL_bool profile_es = (profile_mask == SDL_GL_CONTEXT_PROFILE_ES); if (!_this->egl_data) { - SDL_SetError("EGL not initialized"); + /* The EGL library wasn't loaded, SDL_GetError() should have info */ return NULL; } @@ -1042,8 +1044,16 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) _this->egl_data->egl_swapinterval = 0; if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) { - /* Delete the context */ + /* Save the SDL error set by SDL_EGL_MakeCurrent */ + char errorText[1024]; + SDL_strlcpy(errorText, SDL_GetError(), SDL_arraysize(errorText)); + + /* Delete the context, which may alter the value returned by SDL_GetError() */ SDL_EGL_DeleteContext(_this, egl_context); + + /* Restore the SDL error */ + SDL_SetError("%s", errorText); + return NULL; } @@ -1061,7 +1071,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) if (SDL_GL_ExtensionSupported("GL_OES_surfaceless_context")) { _this->gl_allow_no_surface = SDL_TRUE; } -#if SDL_VIDEO_OPENGL && !defined(SDL_VIDEO_DRIVER_VITA) +#if SDL_VIDEO_OPENGL } else { /* Desktop OpenGL supports it by default from version 3.0 on. */ void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params); @@ -1086,7 +1096,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context) EGLContext egl_context = (EGLContext) context; if (!_this->egl_data) { - return SDL_SetError("EGL not initialized"); + return SDL_SetError("OpenGL not initialized"); } if (!_this->egl_data->eglMakeCurrent) { @@ -1094,7 +1104,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context) /* Can't do the nothing there is to do? Probably trying to cleanup a failed startup, just return. */ return 0; } else { - return SDL_SetError("EGL not initialized"); /* something clearly went wrong somewhere. */ + return SDL_SetError("OpenGL not initialized"); /* something clearly went wrong somewhere. */ } } @@ -1250,12 +1260,10 @@ EGLSurface SDL_EGL_CreateOffscreenSurface(_THIS, int width, int height) { EGLint attributes[] = { - EGL_WIDTH, 0, - EGL_HEIGHT, 0, + EGL_WIDTH, width, + EGL_HEIGHT, height, EGL_NONE }; - attributes[1] = width; - attributes[3] = height; if (SDL_EGL_ChooseConfig(_this) != 0) { return EGL_NO_SURFACE; diff --git a/externals/SDL/src/video/SDL_egl_c.h b/externals/SDL/src/video/SDL_egl_c.h index 76d26f93b..1827af05a 100755 --- a/externals/SDL/src/video/SDL_egl_c.h +++ b/externals/SDL/src/video/SDL_egl_c.h @@ -33,7 +33,7 @@ typedef struct SDL_EGL_VideoData { - void *opengl_dll_handle, *egl_dll_handle; + void *egl_dll_handle, *dll_handle; EGLDisplay egl_display; EGLConfig egl_config; int egl_swapinterval; diff --git a/externals/SDL/src/video/SDL_fillrect.c b/externals/SDL/src/video/SDL_fillrect.c index 66985117d..55702191a 100755 --- a/externals/SDL/src/video/SDL_fillrect.c +++ b/externals/SDL/src/video/SDL_fillrect.c @@ -26,7 +26,7 @@ #ifdef __SSE__ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ #if defined(_MSC_VER) && !defined(__clang__) #define SSE_BEGIN \ @@ -128,7 +128,7 @@ SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) DEFINE_SSE_FILLRECT(2, Uint16) DEFINE_SSE_FILLRECT(4, Uint32) -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ #endif /* __SSE__ */ static void @@ -238,7 +238,7 @@ int SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color) { if (!dst) { - return SDL_InvalidParamError("SDL_FillRect(): dst"); + return SDL_SetError("Passed NULL destination surface"); } /* If 'rect' == NULL, then fill the whole surface */ @@ -306,7 +306,12 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, int i; if (!dst) { - return SDL_InvalidParamError("SDL_FillRects(): dst"); + return SDL_SetError("Passed NULL destination surface"); + } + + /* This function doesn't work on surfaces < 8 bpp */ + if (dst->format->BitsPerPixel < 8) { + return SDL_SetError("SDL_FillRect(): Unsupported surface format"); } /* Nothing to do */ @@ -316,28 +321,11 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count, /* Perform software fill */ if (!dst->pixels) { - return SDL_SetError("SDL_FillRects(): You must lock the surface"); + return SDL_SetError("SDL_FillRect(): You must lock the surface"); } if (!rects) { - return SDL_InvalidParamError("SDL_FillRects(): rects"); - } - - /* This function doesn't usually work on surfaces < 8 bpp - * Except: support for 4bits, when filling full size. - */ - if (dst->format->BitsPerPixel < 8) { - if (count == 1) { - const SDL_Rect *r = &rects[0]; - if (r->x == 0 && r->y == 0 && r->w == dst->w && r->w == dst->h) { - if (dst->format->BitsPerPixel == 4) { - Uint8 b = (((Uint8) color << 4) | (Uint8) color); - SDL_memset(dst->pixels, b, dst->h * dst->pitch); - return 1; - } - } - } - return SDL_SetError("SDL_FillRects(): Unsupported surface format"); + return SDL_SetError("SDL_FillRects() passed NULL rects"); } #if SDL_ARM_NEON_BLITTERS diff --git a/externals/SDL/src/video/SDL_pixels.c b/externals/SDL/src/video/SDL_pixels.c index 858ccba7b..26da00cf4 100755 --- a/externals/SDL/src/video/SDL_pixels.c +++ b/externals/SDL/src/video/SDL_pixels.c @@ -28,7 +28,6 @@ #include "SDL_blit.h" #include "SDL_pixels_c.h" #include "SDL_RLEaccel_c.h" -#include "../SDL_list.h" /* Lookup tables to expand partial bytes to the full 0..255 range */ @@ -678,7 +677,7 @@ int SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette) { if (!format) { - return SDL_InvalidParamError("SDL_SetPixelFormatPalette(): format"); + return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format"); } if (palette && palette->ncolors > (1 << format->BitsPerPixel)) { @@ -1025,6 +1024,12 @@ SDL_AllocBlitMap(void) } +typedef struct SDL_ListNode +{ + void *entry; + struct SDL_ListNode *next; +} SDL_ListNode; + void SDL_InvalidateAllBlitMap(SDL_Surface *surface) { @@ -1040,6 +1045,40 @@ SDL_InvalidateAllBlitMap(SDL_Surface *surface) } } +static void SDL_ListAdd(SDL_ListNode **head, void *ent); +static void SDL_ListRemove(SDL_ListNode **head, void *ent); + +void +SDL_ListAdd(SDL_ListNode **head, void *ent) +{ + SDL_ListNode *node = SDL_malloc(sizeof (*node)); + + if (node == NULL) { + SDL_OutOfMemory(); + return; + } + + node->entry = ent; + node->next = *head; + *head = node; +} + +void +SDL_ListRemove(SDL_ListNode **head, void *ent) +{ + SDL_ListNode **ptr = head; + + while (*ptr) { + if ((*ptr)->entry == ent) { + SDL_ListNode *tmp = *ptr; + *ptr = (*ptr)->next; + SDL_free(tmp); + return; + } + ptr = &(*ptr)->next; + } +} + void SDL_InvalidateMap(SDL_BlitMap * map) { diff --git a/externals/SDL/src/video/SDL_rect.c b/externals/SDL/src/video/SDL_rect.c index dfa939032..0c929517c 100755 --- a/externals/SDL/src/video/SDL_rect.c +++ b/externals/SDL/src/video/SDL_rect.c @@ -23,8 +23,447 @@ #include "SDL_rect.h" #include "SDL_rect_c.h" -/* There's no float version of this at the moment, because it's not a public API - and internally we only need the int version. */ +SDL_bool +SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B) +{ + int Amin, Amax, Bmin, Bmax; + + if (!A) { + SDL_InvalidParamError("A"); + return SDL_FALSE; + } + + if (!B) { + SDL_InvalidParamError("B"); + return SDL_FALSE; + } + + /* Special cases for empty rects */ + if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) { + return SDL_FALSE; + } + + /* Horizontal intersection */ + Amin = A->x; + Amax = Amin + A->w; + Bmin = B->x; + Bmax = Bmin + B->w; + if (Bmin > Amin) + Amin = Bmin; + if (Bmax < Amax) + Amax = Bmax; + if (Amax <= Amin) + return SDL_FALSE; + + /* Vertical intersection */ + Amin = A->y; + Amax = Amin + A->h; + Bmin = B->y; + Bmax = Bmin + B->h; + if (Bmin > Amin) + Amin = Bmin; + if (Bmax < Amax) + Amax = Bmax; + if (Amax <= Amin) + return SDL_FALSE; + + return SDL_TRUE; +} + +SDL_bool +SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) +{ + int Amin, Amax, Bmin, Bmax; + + if (!A) { + SDL_InvalidParamError("A"); + return SDL_FALSE; + } + + if (!B) { + SDL_InvalidParamError("B"); + return SDL_FALSE; + } + + if (!result) { + SDL_InvalidParamError("result"); + return SDL_FALSE; + } + + /* Special cases for empty rects */ + if (SDL_RectEmpty(A) || SDL_RectEmpty(B)) { + result->w = 0; + result->h = 0; + return SDL_FALSE; + } + + /* Horizontal intersection */ + Amin = A->x; + Amax = Amin + A->w; + Bmin = B->x; + Bmax = Bmin + B->w; + if (Bmin > Amin) + Amin = Bmin; + result->x = Amin; + if (Bmax < Amax) + Amax = Bmax; + result->w = Amax - Amin; + + /* Vertical intersection */ + Amin = A->y; + Amax = Amin + A->h; + Bmin = B->y; + Bmax = Bmin + B->h; + if (Bmin > Amin) + Amin = Bmin; + result->y = Amin; + if (Bmax < Amax) + Amax = Bmax; + result->h = Amax - Amin; + + return !SDL_RectEmpty(result); +} + +void +SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result) +{ + int Amin, Amax, Bmin, Bmax; + + if (!A) { + SDL_InvalidParamError("A"); + return; + } + + if (!B) { + SDL_InvalidParamError("B"); + return; + } + + if (!result) { + SDL_InvalidParamError("result"); + return; + } + + /* Special cases for empty Rects */ + if (SDL_RectEmpty(A)) { + if (SDL_RectEmpty(B)) { + /* A and B empty */ + return; + } else { + /* A empty, B not empty */ + *result = *B; + return; + } + } else { + if (SDL_RectEmpty(B)) { + /* A not empty, B empty */ + *result = *A; + return; + } + } + + /* Horizontal union */ + Amin = A->x; + Amax = Amin + A->w; + Bmin = B->x; + Bmax = Bmin + B->w; + if (Bmin < Amin) + Amin = Bmin; + result->x = Amin; + if (Bmax > Amax) + Amax = Bmax; + result->w = Amax - Amin; + + /* Vertical union */ + Amin = A->y; + Amax = Amin + A->h; + Bmin = B->y; + Bmax = Bmin + B->h; + if (Bmin < Amin) + Amin = Bmin; + result->y = Amin; + if (Bmax > Amax) + Amax = Bmax; + result->h = Amax - Amin; +} + +SDL_bool +SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, + SDL_Rect * result) +{ + int minx = 0; + int miny = 0; + int maxx = 0; + int maxy = 0; + int x, y, i; + + if (!points) { + SDL_InvalidParamError("points"); + return SDL_FALSE; + } + + if (count < 1) { + SDL_InvalidParamError("count"); + return SDL_FALSE; + } + + if (clip) { + SDL_bool added = SDL_FALSE; + const int clip_minx = clip->x; + const int clip_miny = clip->y; + const int clip_maxx = clip->x+clip->w-1; + const int clip_maxy = clip->y+clip->h-1; + + /* Special case for empty rectangle */ + if (SDL_RectEmpty(clip)) { + return SDL_FALSE; + } + + for (i = 0; i < count; ++i) { + x = points[i].x; + y = points[i].y; + + if (x < clip_minx || x > clip_maxx || + y < clip_miny || y > clip_maxy) { + continue; + } + if (!added) { + /* Special case: if no result was requested, we are done */ + if (result == NULL) { + return SDL_TRUE; + } + + /* First point added */ + minx = maxx = x; + miny = maxy = y; + added = SDL_TRUE; + continue; + } + if (x < minx) { + minx = x; + } else if (x > maxx) { + maxx = x; + } + if (y < miny) { + miny = y; + } else if (y > maxy) { + maxy = y; + } + } + if (!added) { + return SDL_FALSE; + } + } else { + /* Special case: if no result was requested, we are done */ + if (result == NULL) { + return SDL_TRUE; + } + + /* No clipping, always add the first point */ + minx = maxx = points[0].x; + miny = maxy = points[0].y; + + for (i = 1; i < count; ++i) { + x = points[i].x; + y = points[i].y; + + if (x < minx) { + minx = x; + } else if (x > maxx) { + maxx = x; + } + if (y < miny) { + miny = y; + } else if (y > maxy) { + maxy = y; + } + } + } + + if (result) { + result->x = minx; + result->y = miny; + result->w = (maxx-minx)+1; + result->h = (maxy-miny)+1; + } + return SDL_TRUE; +} + +/* Use the Cohen-Sutherland algorithm for line clipping */ +#define CODE_BOTTOM 1 +#define CODE_TOP 2 +#define CODE_LEFT 4 +#define CODE_RIGHT 8 + +static int +ComputeOutCode(const SDL_Rect * rect, int x, int y) +{ + int code = 0; + if (y < rect->y) { + code |= CODE_TOP; + } else if (y >= rect->y + rect->h) { + code |= CODE_BOTTOM; + } + if (x < rect->x) { + code |= CODE_LEFT; + } else if (x >= rect->x + rect->w) { + code |= CODE_RIGHT; + } + return code; +} + +SDL_bool +SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, + int *Y2) +{ + int x = 0; + int y = 0; + int x1, y1; + int x2, y2; + int rectx1; + int recty1; + int rectx2; + int recty2; + int outcode1, outcode2; + + if (!rect) { + SDL_InvalidParamError("rect"); + return SDL_FALSE; + } + + if (!X1) { + SDL_InvalidParamError("X1"); + return SDL_FALSE; + } + + if (!Y1) { + SDL_InvalidParamError("Y1"); + return SDL_FALSE; + } + + if (!X2) { + SDL_InvalidParamError("X2"); + return SDL_FALSE; + } + + if (!Y2) { + SDL_InvalidParamError("Y2"); + return SDL_FALSE; + } + + /* Special case for empty rect */ + if (SDL_RectEmpty(rect)) { + return SDL_FALSE; + } + + x1 = *X1; + y1 = *Y1; + x2 = *X2; + y2 = *Y2; + rectx1 = rect->x; + recty1 = rect->y; + rectx2 = rect->x + rect->w - 1; + recty2 = rect->y + rect->h - 1; + + /* Check to see if entire line is inside rect */ + if (x1 >= rectx1 && x1 <= rectx2 && x2 >= rectx1 && x2 <= rectx2 && + y1 >= recty1 && y1 <= recty2 && y2 >= recty1 && y2 <= recty2) { + return SDL_TRUE; + } + + /* Check to see if entire line is to one side of rect */ + if ((x1 < rectx1 && x2 < rectx1) || (x1 > rectx2 && x2 > rectx2) || + (y1 < recty1 && y2 < recty1) || (y1 > recty2 && y2 > recty2)) { + return SDL_FALSE; + } + + if (y1 == y2) { + /* Horizontal line, easy to clip */ + if (x1 < rectx1) { + *X1 = rectx1; + } else if (x1 > rectx2) { + *X1 = rectx2; + } + if (x2 < rectx1) { + *X2 = rectx1; + } else if (x2 > rectx2) { + *X2 = rectx2; + } + return SDL_TRUE; + } + + if (x1 == x2) { + /* Vertical line, easy to clip */ + if (y1 < recty1) { + *Y1 = recty1; + } else if (y1 > recty2) { + *Y1 = recty2; + } + if (y2 < recty1) { + *Y2 = recty1; + } else if (y2 > recty2) { + *Y2 = recty2; + } + return SDL_TRUE; + } + + /* More complicated Cohen-Sutherland algorithm */ + outcode1 = ComputeOutCode(rect, x1, y1); + outcode2 = ComputeOutCode(rect, x2, y2); + while (outcode1 || outcode2) { + if (outcode1 & outcode2) { + return SDL_FALSE; + } + + if (outcode1) { + if (outcode1 & CODE_TOP) { + y = recty1; + x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + } else if (outcode1 & CODE_BOTTOM) { + y = recty2; + x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + } else if (outcode1 & CODE_LEFT) { + x = rectx1; + y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + } else if (outcode1 & CODE_RIGHT) { + x = rectx2; + y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + } + x1 = x; + y1 = y; + outcode1 = ComputeOutCode(rect, x, y); + } else { + if (outcode2 & CODE_TOP) { + y = recty1; + x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + } else if (outcode2 & CODE_BOTTOM) { + y = recty2; + x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + } else if (outcode2 & CODE_LEFT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-b0d01a.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ + x = rectx1; + y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + } else if (outcode2 & CODE_RIGHT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-39b114.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ + x = rectx2; + y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + } + x2 = x; + y2 = y; + outcode2 = ComputeOutCode(rect, x, y); + } + } + *X1 = x1; + *Y1 = y1; + *X2 = x2; + *Y2 = y2; + return SDL_TRUE; +} + SDL_bool SDL_GetSpanEnclosingRect(int width, int height, int numrects, const SDL_Rect * rects, SDL_Rect *span) @@ -36,16 +475,24 @@ SDL_GetSpanEnclosingRect(int width, int height, if (width < 1) { SDL_InvalidParamError("width"); return SDL_FALSE; - } else if (height < 1) { + } + + if (height < 1) { SDL_InvalidParamError("height"); return SDL_FALSE; - } else if (!rects) { + } + + if (!rects) { SDL_InvalidParamError("rects"); return SDL_FALSE; - } else if (!span) { + } + + if (!span) { SDL_InvalidParamError("span"); return SDL_FALSE; - } else if (numrects < 1) { + } + + if (numrects < 1) { SDL_InvalidParamError("numrects"); return SDL_FALSE; } @@ -80,36 +527,4 @@ SDL_GetSpanEnclosingRect(int width, int height, return SDL_FALSE; } - -/* For use with the Cohen-Sutherland algorithm for line clipping, in SDL_rect_impl.h */ -#define CODE_BOTTOM 1 -#define CODE_TOP 2 -#define CODE_LEFT 4 -#define CODE_RIGHT 8 - -/* Same code twice, for float and int versions... */ -#define RECTTYPE SDL_Rect -#define POINTTYPE SDL_Point -#define SCALARTYPE int -#define COMPUTEOUTCODE ComputeOutCode -#define SDL_HASINTERSECTION SDL_HasIntersection -#define SDL_INTERSECTRECT SDL_IntersectRect -#define SDL_RECTEMPTY SDL_RectEmpty -#define SDL_UNIONRECT SDL_UnionRect -#define SDL_ENCLOSEPOINTS SDL_EnclosePoints -#define SDL_INTERSECTRECTANDLINE SDL_IntersectRectAndLine -#include "SDL_rect_impl.h" - -#define RECTTYPE SDL_FRect -#define POINTTYPE SDL_FPoint -#define SCALARTYPE float -#define COMPUTEOUTCODE ComputeOutCodeF -#define SDL_HASINTERSECTION SDL_HasIntersectionF -#define SDL_INTERSECTRECT SDL_IntersectFRect -#define SDL_RECTEMPTY SDL_FRectEmpty -#define SDL_UNIONRECT SDL_UnionFRect -#define SDL_ENCLOSEPOINTS SDL_EncloseFPoints -#define SDL_INTERSECTRECTANDLINE SDL_IntersectFRectAndLine -#include "SDL_rect_impl.h" - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/SDL_surface.c b/externals/SDL/src/video/SDL_surface.c index f3ee6a4c4..b3cfa5cd2 100755 --- a/externals/SDL/src/video/SDL_surface.c +++ b/externals/SDL/src/video/SDL_surface.c @@ -33,43 +33,25 @@ SDL_COMPILE_TIME_ASSERT(surface_size_assumptions, sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32)); -SDL_COMPILE_TIME_ASSERT(can_indicate_overflow, SDL_SIZE_MAX > SDL_MAX_SINT32); - /* Public routines */ /* - * Calculate the pad-aligned scanline width of a surface. - * Return SDL_SIZE_MAX on overflow. + * Calculate the pad-aligned scanline width of a surface */ -static size_t -SDL_CalculatePitch(Uint32 format, size_t width, SDL_bool minimal) +static Sint64 +SDL_CalculatePitch(Uint32 format, int width) { - size_t pitch; + Sint64 pitch; if (SDL_ISPIXELFORMAT_FOURCC(format) || SDL_BITSPERPIXEL(format) >= 8) { - if (SDL_size_mul_overflow(width, SDL_BYTESPERPIXEL(format), &pitch)) { - return SDL_SIZE_MAX; - } + pitch = ((Sint64)width * SDL_BYTESPERPIXEL(format)); } else { - if (SDL_size_mul_overflow(width, SDL_BITSPERPIXEL(format), &pitch)) { - return SDL_SIZE_MAX; - } - if (SDL_size_add_overflow(pitch, 7, &pitch)) { - return SDL_SIZE_MAX; - } - pitch /= 8; - } - if (!minimal) { - /* 4-byte aligning for speed */ - if (SDL_size_add_overflow(pitch, 3, &pitch)) { - return SDL_SIZE_MAX; - } - pitch &= ~3; + pitch = (((Sint64)width * SDL_BITSPERPIXEL(format)) + 7) / 8; } + pitch = (pitch + 3) & ~3; /* 4-byte aligning for speed */ return pitch; } -/* TODO: In SDL 3, drop the unused flags and depth parameters */ /* * Create an empty RGB surface of the appropriate depth using the given * enum SDL_PIXELFORMAT_* format @@ -78,24 +60,14 @@ SDL_Surface * SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format) { - size_t pitch; + Sint64 pitch; SDL_Surface *surface; /* The flags are no longer used, make the compiler happy */ (void)flags; - if (width < 0) { - SDL_InvalidParamError("width"); - return NULL; - } - - if (height < 0) { - SDL_InvalidParamError("height"); - return NULL; - } - - pitch = SDL_CalculatePitch(format, width, SDL_FALSE); - if (pitch > SDL_MAX_SINT32) { + pitch = SDL_CalculatePitch(format, width); + if (pitch < 0 || pitch > SDL_MAX_SINT32) { /* Overflow... */ SDL_OutOfMemory(); return NULL; @@ -141,15 +113,15 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, /* Get the pixels */ if (surface->w && surface->h) { /* Assumptions checked in surface_size_assumptions assert above */ - size_t size; - if (SDL_size_mul_overflow(surface->h, surface->pitch, &size)) { + Sint64 size = ((Sint64)surface->h * surface->pitch); + if (size < 0 || size > SDL_MAX_SINT32) { /* Overflow... */ SDL_FreeSurface(surface); SDL_OutOfMemory(); return NULL; } - surface->pixels = SDL_SIMDAlloc(size); + surface->pixels = SDL_SIMDAlloc((size_t)size); if (!surface->pixels) { SDL_FreeSurface(surface); SDL_OutOfMemory(); @@ -157,7 +129,7 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, } surface->flags |= SDL_SIMD_ALIGNED; /* This is important for bitmaps */ - SDL_memset(surface->pixels, 0, size); + SDL_memset(surface->pixels, 0, surface->h * surface->pitch); } /* Allocate an empty mapping */ @@ -177,7 +149,6 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, return surface; } -/* TODO: In SDL 3, drop the unused flags parameter */ /* * Create an empty RGB surface of the appropriate depth */ @@ -208,34 +179,8 @@ SDL_CreateRGBSurfaceFrom(void *pixels, Uint32 Amask) { SDL_Surface *surface; - Uint32 format; - size_t minimalPitch; - if (width < 0) { - SDL_InvalidParamError("width"); - return NULL; - } - - if (height < 0) { - SDL_InvalidParamError("height"); - return NULL; - } - - format = SDL_MasksToPixelFormatEnum(depth, Rmask, Gmask, Bmask, Amask); - - if (format == SDL_PIXELFORMAT_UNKNOWN) { - SDL_SetError("Unknown pixel format"); - return NULL; - } - - minimalPitch = SDL_CalculatePitch(format, width, SDL_TRUE); - - if (pitch < 0 || ((size_t) pitch) < minimalPitch) { - SDL_InvalidParamError("pitch"); - return NULL; - } - - surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format); + surface = SDL_CreateRGBSurface(0, 0, 0, depth, Rmask, Gmask, Bmask, Amask); if (surface != NULL) { surface->flags |= SDL_PREALLOC; surface->pixels = pixels; @@ -247,7 +192,6 @@ SDL_CreateRGBSurfaceFrom(void *pixels, return surface; } -/* TODO: In SDL 3, drop the unused depth parameter */ /* * Create an RGB surface from an existing memory buffer using the given given * enum SDL_PIXELFORMAT_* format @@ -258,24 +202,6 @@ SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, Uint32 format) { SDL_Surface *surface; - size_t minimalPitch; - - if (width < 0) { - SDL_InvalidParamError("width"); - return NULL; - } - - if (height < 0) { - SDL_InvalidParamError("height"); - return NULL; - } - - minimalPitch = SDL_CalculatePitch(format, width, SDL_TRUE); - - if (pitch < 0 || ((size_t) pitch) < minimalPitch) { - SDL_InvalidParamError("pitch"); - return NULL; - } surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format); if (surface != NULL) { @@ -293,7 +219,7 @@ int SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette) { if (!surface) { - return SDL_InvalidParamError("SDL_SetSurfacePalette(): surface"); + return SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface"); } if (SDL_SetPixelFormatPalette(surface->format, palette) < 0) { return -1; @@ -720,7 +646,7 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect, /* Make sure the surfaces aren't locked */ if (!src || !dst) { - return SDL_InvalidParamError("SDL_UpperBlit(): src/dst"); + return SDL_SetError("SDL_UpperBlit: passed a NULL surface"); } if (src->locked || dst->locked) { return SDL_SetError("Surfaces must not be locked during blit"); @@ -831,7 +757,7 @@ SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, /* Make sure the surfaces aren't locked */ if (!src || !dst) { - return SDL_InvalidParamError("SDL_UpperBlitScaled(): src/dst"); + return SDL_SetError("SDL_UpperBlitScaled: passed a NULL surface"); } if (src->locked || dst->locked) { return SDL_SetError("Surfaces must not be locked during blit"); @@ -1478,7 +1404,8 @@ int SDL_ConvertPixels(int width, int height, } #else if (SDL_ISPIXELFORMAT_FOURCC(src_format) || SDL_ISPIXELFORMAT_FOURCC(dst_format)) { - return SDL_SetError("SDL not built with YUV support"); + SDL_SetError("SDL not built with YUV support"); + return -1; } #endif diff --git a/externals/SDL/src/video/SDL_sysvideo.h b/externals/SDL/src/video/SDL_sysvideo.h index b1876b2b8..3f401a5b2 100755 --- a/externals/SDL/src/video/SDL_sysvideo.h +++ b/externals/SDL/src/video/SDL_sysvideo.h @@ -237,7 +237,6 @@ struct SDL_VideoDevice int (*SetWindowGammaRamp) (_THIS, SDL_Window * window, const Uint16 * ramp); int (*GetWindowGammaRamp) (_THIS, SDL_Window * window, Uint16 * ramp); void* (*GetWindowICCProfile) (_THIS, SDL_Window * window, size_t* size); - int (*GetWindowDisplayIndex)(_THIS, SDL_Window * window); void (*SetWindowMouseRect)(_THIS, SDL_Window * window); void (*SetWindowMouseGrab) (_THIS, SDL_Window * window, SDL_bool grabbed); void (*SetWindowKeyboardGrab) (_THIS, SDL_Window * window, SDL_bool grabbed); @@ -308,8 +307,6 @@ struct SDL_VideoDevice void (*StartTextInput) (_THIS); void (*StopTextInput) (_THIS); void (*SetTextInputRect) (_THIS, SDL_Rect *rect); - void (*ClearComposition) (_THIS); - SDL_bool (*IsTextInputShown) (_THIS); /* Screen keyboard */ SDL_bool (*HasScreenKeyboardSupport) (_THIS); @@ -333,8 +330,6 @@ struct SDL_VideoDevice /* * * */ /* Data common to all drivers */ - SDL_threadID thread; - SDL_bool checked_texture_framebuffer; SDL_bool is_dummy; SDL_bool suspend_screensaver; SDL_Window *wakeup_window; @@ -347,7 +342,6 @@ struct SDL_VideoDevice Uint32 next_object_id; char *clipboard_text; SDL_bool setting_display_mode; - SDL_bool disable_display_mode_switching; /* * * */ /* Data used by the GL drivers */ @@ -458,12 +452,9 @@ extern VideoBootStrap VIVANTE_bootstrap; extern VideoBootStrap Emscripten_bootstrap; extern VideoBootStrap QNX_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; -extern VideoBootStrap NGAGE_bootstrap; extern VideoBootStrap OS2DIVE_bootstrap; extern VideoBootStrap OS2VMAN_bootstrap; -/* Use SDL_OnVideoThread() sparingly, to avoid regressions in use cases that currently happen to work */ -extern SDL_bool SDL_OnVideoThread(void); extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display, SDL_bool send_event); @@ -477,7 +468,6 @@ extern SDL_VideoDisplay *SDL_GetDisplay(int displayIndex); extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window); extern void *SDL_GetDisplayDriverData( int displayIndex ); extern SDL_bool SDL_IsVideoContextExternal(void); -extern int SDL_GetMessageBoxCount(void); extern void SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor); diff --git a/externals/SDL/src/video/SDL_video.c b/externals/SDL/src/video/SDL_video.c index 084ece803..cad77f1a8 100755 --- a/externals/SDL/src/video/SDL_video.c +++ b/externals/SDL/src/video/SDL_video.c @@ -118,9 +118,6 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_OFFSCREEN &OFFSCREEN_bootstrap, #endif -#if SDL_VIDEO_DRIVER_NGAGE - &NGAGE_bootstrap, -#endif #if SDL_VIDEO_DRIVER_OS2 &OS2DIVE_bootstrap, &OS2VMAN_bootstrap, @@ -131,6 +128,8 @@ static VideoBootStrap *bootstrap[] = { NULL }; +static SDL_VideoDevice *_this = NULL; + #define CHECK_WINDOW_MAGIC(window, retval) \ if (!_this) { \ SDL_UninitializedVideo(); \ @@ -173,58 +172,129 @@ typedef struct { int bytes_per_pixel; } SDL_WindowTextureData; +static SDL_bool +ShouldUseTextureFramebuffer() +{ + const char *hint; + + /* If there's no native framebuffer support then there's no option */ + if (!_this->CreateWindowFramebuffer) { + return SDL_TRUE; + } + + /* If this is the dummy driver there is no texture support */ + if (_this->is_dummy) { + return SDL_FALSE; + } + + /* See if the user or application wants a specific behavior */ + hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); + if (hint) { + if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { + return SDL_FALSE; + } else { + return SDL_TRUE; + } + } + + /* Each platform has different performance characteristics */ +#if defined(__WIN32__) + /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. + */ + return SDL_FALSE; + +#elif defined(__MACOSX__) + /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */ + return SDL_TRUE; + +#elif defined(__LINUX__) + /* Properly configured OpenGL drivers are faster than MIT-SHM */ +#if SDL_VIDEO_OPENGL + /* Ugh, find a way to cache this value! */ + { + SDL_Window *window; + SDL_GLContext context; + SDL_bool hasAcceleratedOpenGL = SDL_FALSE; + + window = SDL_CreateWindow("OpenGL test", -32, -32, 32, 32, SDL_WINDOW_OPENGL|SDL_WINDOW_HIDDEN); + if (window) { + context = SDL_GL_CreateContext(window); + if (context) { + const GLubyte *(APIENTRY * glGetStringFunc) (GLenum); + const char *vendor = NULL; + + glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); + if (glGetStringFunc) { + vendor = (const char *) glGetStringFunc(GL_VENDOR); + } + /* Add more vendors here at will... */ + if (vendor && + (SDL_strstr(vendor, "ATI Technologies") || + SDL_strstr(vendor, "NVIDIA"))) { + hasAcceleratedOpenGL = SDL_TRUE; + } + SDL_GL_DeleteContext(context); + } + SDL_DestroyWindow(window); + } + return hasAcceleratedOpenGL; + } +#elif SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + /* Let's be optimistic about this! */ + return SDL_TRUE; +#else + return SDL_FALSE; +#endif + +#else + /* Play it safe, assume that if there is a framebuffer driver that it's + optimized for the current platform. + */ + return SDL_FALSE; +#endif +} static int -SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) +SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) { - SDL_RendererInfo info; - SDL_WindowTextureData *data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); - int i; + SDL_WindowTextureData *data; + data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); if (!data) { SDL_Renderer *renderer = NULL; + int i; const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); - const SDL_bool specific_accelerated_renderer = ( - hint && *hint != '0' && *hint != '1' && - SDL_strcasecmp(hint, "true") != 0 && - SDL_strcasecmp(hint, "false") != 0 && - SDL_strcasecmp(hint, "software") != 0 - ); /* Check to see if there's a specific driver requested */ - if (specific_accelerated_renderer) { + if (hint && *hint != '0' && *hint != '1' && + SDL_strcasecmp(hint, "true") != 0 && + SDL_strcasecmp(hint, "false") != 0 && + SDL_strcasecmp(hint, "software") != 0) { for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { + SDL_RendererInfo info; SDL_GetRenderDriverInfo(i, &info); if (SDL_strcasecmp(info.name, hint) == 0) { renderer = SDL_CreateRenderer(window, i, 0); break; } } - if (!renderer || (SDL_GetRendererInfo(renderer, &info) == -1)) { - if (renderer) { SDL_DestroyRenderer(renderer); } - return SDL_SetError("Requested renderer for " SDL_HINT_FRAMEBUFFER_ACCELERATION " is not available"); - } - /* if it was specifically requested, even if SDL_RENDERER_ACCELERATED isn't set, we'll accept this renderer. */ - } else { + } + + if (!renderer) { for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { + SDL_RendererInfo info; SDL_GetRenderDriverInfo(i, &info); if (SDL_strcmp(info.name, "software") != 0) { renderer = SDL_CreateRenderer(window, i, 0); - if (renderer && (SDL_GetRendererInfo(renderer, &info) == 0) && (info.flags & SDL_RENDERER_ACCELERATED)) { - break; /* this will work. */ - } - if (renderer) { /* wasn't accelerated, etc, skip it. */ - SDL_DestroyRenderer(renderer); - renderer = NULL; + if (renderer) { + break; } } } - if (!renderer) { - return SDL_SetError("No hardware accelerated renderers available"); - } } - - SDL_assert(renderer != NULL); /* should have explicitly checked this above. */ + if (!renderer) { + return SDL_SetError("No hardware accelerated renderers available"); + } /* Create the data after we successfully create the renderer (bug #1116) */ data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data)); @@ -235,10 +305,6 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, data); data->renderer = renderer; - } else { - if (SDL_GetRendererInfo(data->renderer, &info) == -1) { - return -1; - } } /* Free any old texture and pixel data */ @@ -249,14 +315,23 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo SDL_free(data->pixels); data->pixels = NULL; - /* Find the first format without an alpha channel */ - *format = info.texture_formats[0]; + { + SDL_RendererInfo info; + Uint32 i; - for (i = 0; i < (int) info.num_texture_formats; ++i) { - if (!SDL_ISPIXELFORMAT_FOURCC(info.texture_formats[i]) && - !SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) { - *format = info.texture_formats[i]; - break; + if (SDL_GetRendererInfo(data->renderer, &info) < 0) { + return -1; + } + + /* Find the first format without an alpha channel */ + *format = info.texture_formats[0]; + + for (i = 0; i < info.num_texture_formats; ++i) { + if (!SDL_ISPIXELFORMAT_FOURCC(info.texture_formats[i]) && + !SDL_ISPIXELFORMAT_ALPHA(info.texture_formats[i])) { + *format = info.texture_formats[i]; + break; + } } } @@ -264,7 +339,6 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo SDL_TEXTUREACCESS_STREAMING, window->w, window->h); if (!data->texture) { - /* codechecker_false_positive [Malloc] Static analyzer doesn't realize allocated `data` is saved to SDL_WINDOWTEXTUREDATA and not leaked here. */ return -1; } @@ -290,9 +364,6 @@ SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window * window, Uint32 * fo return 0; } -static SDL_VideoDevice *_this = NULL; -static SDL_atomic_t SDL_messagebox_count; - static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, const SDL_Rect * rects, int numrects) { @@ -342,7 +413,8 @@ SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window * window) SDL_free(data); } -static int SDLCALL + +static int cmpmodes(const void *A, const void *B) { const SDL_DisplayMode *a = (const SDL_DisplayMode *) A; @@ -429,7 +501,7 @@ SDL_VideoInit(const char *driver_name) i = index = 0; video = NULL; if (driver_name == NULL) { - driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER); + driver_name = SDL_getenv("SDL_VIDEODRIVER"); } if (driver_name != NULL && *driver_name != 0) { const char *driver_attempt = driver_name; @@ -470,7 +542,6 @@ SDL_VideoInit(const char *driver_name) _this = video; _this->name = bootstrap[i]->name; _this->next_object_id = 1; - _this->thread = SDL_ThreadID(); /* Set some very sane GL defaults */ @@ -493,6 +564,13 @@ SDL_VideoInit(const char *driver_name) return SDL_SetError("The video driver did not add any displays"); } + /* Add the renderer framebuffer emulation if desired */ + if (ShouldUseTextureFramebuffer()) { + _this->CreateWindowFramebuffer = SDL_CreateWindowTexture; + _this->UpdateWindowFramebuffer = SDL_UpdateWindowTexture; + _this->DestroyWindowFramebuffer = SDL_DestroyWindowTexture; + } + /* Disable the screen saver by default. This is a change from <= 2.0.1, but most things using SDL are games or media players; you wouldn't want a screensaver to trigger if you're playing exclusively with a @@ -550,12 +628,6 @@ SDL_GetVideoDevice(void) return _this; } -SDL_bool -SDL_OnVideoThread() -{ - return (_this && SDL_ThreadID() == _this->thread) ? SDL_TRUE : SDL_FALSE; -} - int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode) { @@ -898,7 +970,7 @@ SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode *current, *match; if (!mode || !closest) { - SDL_InvalidParamError("mode/closest"); + SDL_SetError("Missing desired mode or closest mode parameter"); return NULL; } @@ -1071,64 +1143,61 @@ SDL_GetDisplay(int displayIndex) int SDL_GetWindowDisplayIndex(SDL_Window * window) { + int displayIndex; + int i, dist; + int closest = -1; + int closest_dist = 0x7FFFFFFF; + SDL_Point center; + SDL_Point delta; + SDL_Rect rect; + CHECK_WINDOW_MAGIC(window, -1); - if (_this->GetWindowDisplayIndex) { - return _this->GetWindowDisplayIndex(_this, window); - } else { - int displayIndex; - int i, dist; - int closest = -1; - int closest_dist = 0x7FFFFFFF; - SDL_Point center; - SDL_Point delta; - SDL_Rect rect; - if (SDL_WINDOWPOS_ISUNDEFINED(window->x) || - SDL_WINDOWPOS_ISCENTERED(window->x)) { - displayIndex = (window->x & 0xFFFF); - if (displayIndex >= _this->num_displays) { - displayIndex = 0; - } - return displayIndex; + if (SDL_WINDOWPOS_ISUNDEFINED(window->x) || + SDL_WINDOWPOS_ISCENTERED(window->x)) { + displayIndex = (window->x & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; } - if (SDL_WINDOWPOS_ISUNDEFINED(window->y) || - SDL_WINDOWPOS_ISCENTERED(window->y)) { - displayIndex = (window->y & 0xFFFF); - if (displayIndex >= _this->num_displays) { - displayIndex = 0; - } - return displayIndex; - } - - /* Find the display containing the window */ - for (i = 0; i < _this->num_displays; ++i) { - SDL_VideoDisplay *display = &_this->displays[i]; - - if (display->fullscreen_window == window) { - return i; - } - } - center.x = window->x + window->w / 2; - center.y = window->y + window->h / 2; - for (i = 0; i < _this->num_displays; ++i) { - SDL_GetDisplayBounds(i, &rect); - if (SDL_EnclosePoints(¢er, 1, &rect, NULL)) { - return i; - } - - delta.x = center.x - (rect.x + rect.w / 2); - delta.y = center.y - (rect.y + rect.h / 2); - dist = (delta.x*delta.x + delta.y*delta.y); - if (dist < closest_dist) { - closest = i; - closest_dist = dist; - } - } - if (closest < 0) { - SDL_SetError("Couldn't find any displays"); - } - return closest; + return displayIndex; } + if (SDL_WINDOWPOS_ISUNDEFINED(window->y) || + SDL_WINDOWPOS_ISCENTERED(window->y)) { + displayIndex = (window->y & 0xFFFF); + if (displayIndex >= _this->num_displays) { + displayIndex = 0; + } + return displayIndex; + } + + /* Find the display containing the window */ + for (i = 0; i < _this->num_displays; ++i) { + SDL_VideoDisplay *display = &_this->displays[i]; + + if (display->fullscreen_window == window) { + return i; + } + } + center.x = window->x + window->w / 2; + center.y = window->y + window->h / 2; + for (i = 0; i < _this->num_displays; ++i) { + SDL_GetDisplayBounds(i, &rect); + if (SDL_EnclosePoints(¢er, 1, &rect, NULL)) { + return i; + } + + delta.x = center.x - (rect.x + rect.w / 2); + delta.y = center.y - (rect.y + rect.h / 2); + dist = (delta.x*delta.x + delta.y*delta.y); + if (dist < closest_dist) { + closest = i; + closest_dist = dist; + } + } + if (closest < 0) { + SDL_SetError("Couldn't find any displays"); + } + return closest; } SDL_VideoDisplay * @@ -1199,7 +1268,6 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode) } else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode, &fullscreen_mode)) { - SDL_zerop(mode); return SDL_SetError("Couldn't find display mode match"); } @@ -1353,17 +1421,14 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) resized = SDL_FALSE; } - /* Don't try to change the display mode if the driver doesn't want it. */ - if (_this->disable_display_mode_switching == SDL_FALSE) { - /* only do the mode change if we want exclusive fullscreen */ - if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { - if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) { - return -1; - } - } else { - if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) { - return -1; - } + /* only do the mode change if we want exclusive fullscreen */ + if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { + if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) { + return -1; + } + } else { + if (SDL_SetDisplayModeForDisplay(display, NULL) < 0) { + return -1; } } @@ -1374,17 +1439,12 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) /* Generate a mode change event here */ if (resized) { -#if !defined(ANDROID) && !defined(WIN32) +#ifndef ANDROID /* Android may not resize the window to exactly what our fullscreen mode is, especially on * windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't * use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, * Android's SetWindowFullscreen will generate the window event for us with the proper final size. */ - - /* This is also unnecessary on Win32 (WIN_SetWindowFullscreen calls SetWindowPos, - * WM_WINDOWPOSCHANGED will send SDL_WINDOWEVENT_RESIZED). Also, on Windows with DPI scaling enabled, - * we're keeping modes in pixels, but window sizes in dpi-scaled points, so this would be a unit mismatch. - */ SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, fullscreen_mode.w, fullscreen_mode.h); #endif @@ -1516,16 +1576,12 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } /* Some platforms have certain graphics backends enabled by default */ - if (!graphics_flags && !SDL_IsVideoContextExternal()) { + if (!_this->is_dummy && !graphics_flags && !SDL_IsVideoContextExternal()) { #if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__ - if (_this->GL_CreateContext != NULL) { - flags |= SDL_WINDOW_OPENGL; - } + flags |= SDL_WINDOW_OPENGL; #endif #if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOSX__ || __IPHONEOS__) - if (_this->Metal_CreateView != NULL) { - flags |= SDL_WINDOW_METAL; - } + flags |= SDL_WINDOW_METAL; #endif } @@ -1700,7 +1756,6 @@ SDL_Window * SDL_CreateWindowFrom(const void *data) { SDL_Window *window; - Uint32 flags = SDL_WINDOW_FOREIGN; if (!_this) { SDL_UninitializedVideo(); @@ -1710,37 +1765,6 @@ SDL_CreateWindowFrom(const void *data) SDL_Unsupported(); return NULL; } - - if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL, SDL_FALSE)) { - if (!_this->GL_CreateContext) { - SDL_SetError("OpenGL support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); - return NULL; - } - if (SDL_GL_LoadLibrary(NULL) < 0) { - return NULL; - } - flags |= SDL_WINDOW_OPENGL; - } - - if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN, SDL_FALSE)) { - if (!_this->Vulkan_CreateSurface) { - SDL_SetError("Vulkan support is either not configured in SDL " - "or not available in current SDL video driver " - "(%s) or platform", _this->name); - return NULL; - } - if (flags & SDL_WINDOW_OPENGL) { - SDL_SetError("Vulkan and OpenGL not supported on same window"); - return NULL; - } - if (SDL_Vulkan_LoadLibrary(NULL) < 0) { - return NULL; - } - flags |= SDL_WINDOW_VULKAN; - } - window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); if (!window) { SDL_OutOfMemory(); @@ -1748,7 +1772,7 @@ SDL_CreateWindowFrom(const void *data) } window->magic = &_this->window_magic; window->id = _this->next_object_id++; - window->flags = flags; + window->flags = SDL_WINDOW_FOREIGN; window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; window->opacity = 1.0f; @@ -1794,9 +1818,7 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) } /* Restore video mode, etc. */ - if (!(window->flags & SDL_WINDOW_FOREIGN)) { - SDL_HideWindow(window); - } + SDL_HideWindow(window); /* Tear down the old native window */ if (window->surface) { @@ -1805,13 +1827,9 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) window->surface = NULL; window->surface_valid = SDL_FALSE; } - - if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */ - if (_this->DestroyWindowFramebuffer) { - _this->DestroyWindowFramebuffer(_this, window); - } + if (_this->DestroyWindowFramebuffer) { + _this->DestroyWindowFramebuffer(_this, window); } - if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) { _this->DestroyWindow(_this, window); } @@ -1827,6 +1845,17 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) need_gl_load = SDL_TRUE; } + if ((window->flags & SDL_WINDOW_METAL) != (flags & SDL_WINDOW_METAL)) { + if (flags & SDL_WINDOW_METAL) { + need_gl_load = SDL_TRUE; + } else { + need_gl_unload = SDL_TRUE; + } + } else if (window->flags & SDL_WINDOW_METAL) { + need_gl_unload = SDL_TRUE; + need_gl_load = SDL_TRUE; + } + if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) { if (flags & SDL_WINDOW_VULKAN) { need_vulkan_load = SDL_TRUE; @@ -1839,15 +1868,18 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) } if ((flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) { - return SDL_SetError("Vulkan and OpenGL not supported on same window"); + SDL_SetError("Vulkan and OpenGL not supported on same window"); + return -1; } if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_OPENGL)) { - return SDL_SetError("Metal and OpenGL not supported on same window"); + SDL_SetError("Metal and OpenGL not supported on same window"); + return -1; } if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_VULKAN)) { - return SDL_SetError("Metal and Vulkan not supported on same window"); + SDL_SetError("Metal and Vulkan not supported on same window"); + return -1; } if (need_gl_unload) { @@ -2241,14 +2273,12 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h) SDL_UpdateFullscreenMode(window, SDL_TRUE); } } else { - int old_w = window->w; - int old_h = window->h; window->w = w; window->h = h; if (_this->SetWindowSize) { _this->SetWindowSize(_this, window); } - if (window->w != old_w || window->h != old_h) { + if (window->w == w && window->h == h) { /* We didn't get a SDL_WINDOWEVENT_RESIZED event (by design) */ SDL_OnWindowResized(window); } @@ -2509,71 +2539,18 @@ SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags) static SDL_Surface * SDL_CreateWindowFramebuffer(SDL_Window * window) { - Uint32 format = 0; - void *pixels = NULL; - int pitch = 0; + Uint32 format; + void *pixels; + int pitch; int bpp; Uint32 Rmask, Gmask, Bmask, Amask; - SDL_bool created_framebuffer = SDL_FALSE; - /* This will switch the video backend from using a software surface to - using a GPU texture through the 2D render API, if we think this would - be more efficient. This only checks once, on demand. */ - if (!_this->checked_texture_framebuffer) { - SDL_bool attempt_texture_framebuffer = SDL_TRUE; - - /* See if the user or application wants to specifically disable the framebuffer */ - const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); - if (hint) { - if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { - attempt_texture_framebuffer = SDL_FALSE; - } - } - - if (_this->is_dummy) { /* dummy driver never has GPU support, of course. */ - attempt_texture_framebuffer = SDL_FALSE; - } - - #if defined(__WIN32__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ - else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "windows") == 0)) { - attempt_texture_framebuffer = SDL_FALSE; - } - #endif - #if defined(__EMSCRIPTEN__) - else { - attempt_texture_framebuffer = SDL_FALSE; - } - #endif - - if (attempt_texture_framebuffer) { - if (SDL_CreateWindowTexture(_this, window, &format, &pixels, &pitch) == -1) { - /* !!! FIXME: if this failed halfway (made renderer, failed to make texture, etc), - !!! FIXME: we probably need to clean this up so it doesn't interfere with - !!! FIXME: a software fallback at the system level (can we blit to an - !!! FIXME: OpenGL window? etc). */ - } else { - /* future attempts will just try to use a texture framebuffer. */ - /* !!! FIXME: maybe we shouldn't override these but check if we used a texture - !!! FIXME: framebuffer at the right places; is it feasible we could have an - !!! FIXME: accelerated OpenGL window and a second ends up in software? */ - _this->CreateWindowFramebuffer = SDL_CreateWindowTexture; - _this->UpdateWindowFramebuffer = SDL_UpdateWindowTexture; - _this->DestroyWindowFramebuffer = SDL_DestroyWindowTexture; - created_framebuffer = SDL_TRUE; - } - } - - _this->checked_texture_framebuffer = SDL_TRUE; /* don't check this again. */ + if (!_this->CreateWindowFramebuffer || !_this->UpdateWindowFramebuffer) { + return NULL; } - if (!created_framebuffer) { - if (!_this->CreateWindowFramebuffer || !_this->UpdateWindowFramebuffer) { - return NULL; - } - - if (_this->CreateWindowFramebuffer(_this, window, &format, &pixels, &pitch) < 0) { - return NULL; - } + if (_this->CreateWindowFramebuffer(_this, window, &format, &pixels, &pitch) < 0) { + return NULL; } if (window->surface) { @@ -2631,8 +2608,6 @@ SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, return SDL_SetError("Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface"); } - SDL_assert(_this->checked_texture_framebuffer); /* we should have done this before we had a valid surface. */ - return _this->UpdateWindowFramebuffer(_this, window, rects, numrects); } @@ -3051,7 +3026,7 @@ SDL_OnWindowFocusGained(SDL_Window * window) if (mouse && mouse->relative_mode) { SDL_SetMouseFocus(window); if (mouse->relative_mode_warp) { - SDL_PerformWarpMouseInWindow(window, window->w/2, window->h/2, SDL_TRUE); + SDL_WarpMouseInWindow(window, window->w/2, window->h/2); } } @@ -3087,8 +3062,7 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window) /* Real fullscreen windows should minimize on focus loss so the desktop video mode is restored */ hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS); if (!hint || !*hint || SDL_strcasecmp(hint, "auto") == 0) { - if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP || - _this->disable_display_mode_switching == SDL_TRUE) { + if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { return SDL_FALSE; } else { return SDL_TRUE; @@ -3139,9 +3113,7 @@ SDL_DestroyWindow(SDL_Window * window) window->is_destroying = SDL_TRUE; /* Restore video mode, etc. */ - if (!(window->flags & SDL_WINDOW_FOREIGN)) { - SDL_HideWindow(window); - } + SDL_HideWindow(window); /* Make sure this window no longer has focus */ if (SDL_GetKeyboardFocus() == window) { @@ -3164,10 +3136,8 @@ SDL_DestroyWindow(SDL_Window * window) window->surface = NULL; window->surface_valid = SDL_FALSE; } - if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */ - if (_this->DestroyWindowFramebuffer) { - _this->DestroyWindowFramebuffer(_this, window); - } + if (_this->DestroyWindowFramebuffer) { + _this->DestroyWindowFramebuffer(_this, window); } if (_this->DestroyWindow) { _this->DestroyWindow(_this, window); @@ -3952,10 +3922,6 @@ SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx) { int retval; - if (!_this) { - return SDL_UninitializedVideo(); - } - if (window == SDL_GL_GetCurrentWindow() && ctx == SDL_GL_GetCurrentContext()) { /* We're already current. */ @@ -4213,24 +4179,6 @@ SDL_StartTextInput(void) } } -void -SDL_ClearComposition(void) -{ - if (_this && _this->ClearComposition) { - _this->ClearComposition(_this); - } -} - -SDL_bool -SDL_IsTextInputShown(void) -{ - if (_this && _this->IsTextInputShown) { - return _this->IsTextInputShown(_this); - } - - return SDL_FALSE; -} - SDL_bool SDL_IsTextInputActive(void) { @@ -4284,12 +4232,6 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) return SDL_FALSE; } -int -SDL_GetMessageBoxCount(void) -{ - return SDL_AtomicGet(&SDL_messagebox_count); -} - #if SDL_VIDEO_DRIVER_ANDROID #include "android/SDL_androidmessagebox.h" #endif @@ -4350,6 +4292,7 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) int retval = -1; SDL_bool relative_mode; int show_cursor_prev; + SDL_bool mouse_captured; SDL_Window *current_window; SDL_MessageBoxData mbdata; @@ -4359,11 +4302,10 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) return SDL_SetError("Invalid number of buttons"); } - (void)SDL_AtomicIncRef(&SDL_messagebox_count); - current_window = SDL_GetKeyboardFocus(); + mouse_captured = current_window && ((SDL_GetWindowFlags(current_window) & SDL_WINDOW_MOUSE_CAPTURE) != 0); relative_mode = SDL_GetRelativeMouseMode(); - SDL_UpdateMouseCapture(SDL_FALSE); + SDL_CaptureMouse(SDL_FALSE); SDL_SetRelativeMouseMode(SDL_FALSE); show_cursor_prev = SDL_ShowCursor(1); SDL_ResetKeyboard(); @@ -4467,15 +4409,15 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } } - (void)SDL_AtomicDecRef(&SDL_messagebox_count); - if (current_window) { SDL_RaiseWindow(current_window); + if (mouse_captured) { + SDL_CaptureMouse(SDL_TRUE); + } } SDL_ShowCursor(show_cursor_prev); SDL_SetRelativeMouseMode(relative_mode); - SDL_UpdateMouseCapture(SDL_FALSE); return retval; } diff --git a/externals/SDL/src/video/SDL_vulkan_internal.h b/externals/SDL/src/video/SDL_vulkan_internal.h index 1ec1ab473..52fae34da 100755 --- a/externals/SDL/src/video/SDL_vulkan_internal.h +++ b/externals/SDL/src/video/SDL_vulkan_internal.h @@ -25,11 +25,13 @@ #include "SDL_stdinc.h" -#if SDL_VIDEO_VULKAN -#if SDL_LOADSO_DISABLED || SDL_LOADSO_DUMMY -#error You should not be here. +#if defined(SDL_LOADSO_DISABLED) +#undef SDL_VIDEO_VULKAN +#define SDL_VIDEO_VULKAN 0 #endif +#if SDL_VIDEO_VULKAN + #if SDL_VIDEO_DRIVER_ANDROID #define VK_USE_PLATFORM_ANDROID_KHR #endif diff --git a/externals/SDL/src/video/SDL_yuv.c b/externals/SDL/src/video/SDL_yuv.c index 50395ff48..72ed99d18 100755 --- a/externals/SDL/src/video/SDL_yuv.c +++ b/externals/SDL/src/video/SDL_yuv.c @@ -290,48 +290,6 @@ static SDL_bool yuv_rgb_sse( return SDL_FALSE; } -static SDL_bool yuv_rgb_lsx( - Uint32 src_format, Uint32 dst_format, - Uint32 width, Uint32 height, - const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, - Uint8 *rgb, Uint32 rgb_stride, - YCbCrType yuv_type) -{ -#ifdef __loongarch_sx - if (!SDL_HasLSX()) { - return SDL_FALSE; - } - if (src_format == SDL_PIXELFORMAT_YV12 || - src_format == SDL_PIXELFORMAT_IYUV) { - - switch (dst_format) { - case SDL_PIXELFORMAT_RGB24: - yuv420_rgb24_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); - return SDL_TRUE; - case SDL_PIXELFORMAT_RGBX8888: - case SDL_PIXELFORMAT_RGBA8888: - yuv420_rgba_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); - return SDL_TRUE; - case SDL_PIXELFORMAT_BGRX8888: - case SDL_PIXELFORMAT_BGRA8888: - yuv420_bgra_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); - return SDL_TRUE; - case SDL_PIXELFORMAT_RGB888: - case SDL_PIXELFORMAT_ARGB8888: - yuv420_argb_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); - return SDL_TRUE; - case SDL_PIXELFORMAT_BGR888: - case SDL_PIXELFORMAT_ABGR8888: - yuv420_abgr_lsx(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); - return SDL_TRUE; - default: - break; - } - } -#endif - return SDL_FALSE; -} - static SDL_bool yuv_rgb_std( Uint32 src_format, Uint32 dst_format, Uint32 width, Uint32 height, @@ -459,10 +417,6 @@ SDL_ConvertPixels_YUV_to_RGB(int width, int height, return 0; } - if (yuv_rgb_lsx(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { - return 0; - } - if (yuv_rgb_std(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { return 0; } diff --git a/externals/SDL/src/video/android/SDL_androidevents.c b/externals/SDL/src/video/android/SDL_androidevents.c index 3424a8254..23a5bf50b 100755 --- a/externals/SDL/src/video/android/SDL_androidevents.c +++ b/externals/SDL/src/video/android/SDL_androidevents.c @@ -67,7 +67,6 @@ SDL_NumberOfEvents(Uint32 type) return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type); } -#if SDL_VIDEO_OPENGL_EGL static void android_egl_context_restore(SDL_Window *window) { @@ -97,7 +96,7 @@ android_egl_context_backup(SDL_Window *window) data->backup_done = 1; } } -#endif + /* * Android_ResumeSem and Android_PauseSem are signaled from Java_org_libsdl_app_SDLActivity_nativePause and Java_org_libsdl_app_SDLActivity_nativeResume @@ -114,14 +113,12 @@ Android_PumpEvents_Blocking(_THIS) if (videodata->isPaused) { SDL_bool isContextExternal = SDL_IsVideoContextExternal(); -#if SDL_VIDEO_OPENGL_EGL /* Make sure this is the last thing we do before pausing */ if (!isContextExternal) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_backup(Android_Window); SDL_UnlockMutex(Android_ActivityMutex); } -#endif ANDROIDAUDIO_PauseDevices(); openslES_PauseDevices(); @@ -141,13 +138,11 @@ Android_PumpEvents_Blocking(_THIS) aaudio_ResumeDevices(); /* Restore the GL Context from here, as this operation is thread dependent */ -#if SDL_VIDEO_OPENGL_EGL if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_restore(Android_Window); SDL_UnlockMutex(Android_ActivityMutex); } -#endif /* Make sure SW Keyboard is restored when an app becomes foreground */ if (SDL_IsTextInputActive()) { @@ -193,13 +188,11 @@ Android_PumpEvents_NonBlocking(_THIS) SDL_bool isContextExternal = SDL_IsVideoContextExternal(); if (backup_context) { -#if SDL_VIDEO_OPENGL_EGL if (!isContextExternal) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_backup(Android_Window); SDL_UnlockMutex(Android_ActivityMutex); } -#endif if (videodata->pauseAudio) { ANDROIDAUDIO_PauseDevices(); @@ -226,14 +219,12 @@ Android_PumpEvents_NonBlocking(_THIS) aaudio_ResumeDevices(); } -#if SDL_VIDEO_OPENGL_EGL /* Restore the GL Context from here, as this operation is thread dependent */ if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_restore(Android_Window); SDL_UnlockMutex(Android_ActivityMutex); } -#endif /* Make sure SW Keyboard is restored when an app becomes foreground */ if (SDL_IsTextInputActive()) { diff --git a/externals/SDL/src/video/android/SDL_androidgl.c b/externals/SDL/src/video/android/SDL_androidgl.c index fe1b17b26..698b87190 100755 --- a/externals/SDL/src/video/android/SDL_androidgl.c +++ b/externals/SDL/src/video/android/SDL_androidgl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID && SDL_VIDEO_OPENGL_EGL +#if SDL_VIDEO_DRIVER_ANDROID /* Android SDL video driver implementation */ diff --git a/externals/SDL/src/video/android/SDL_androidkeyboard.c b/externals/SDL/src/video/android/SDL_androidkeyboard.c index 9bb025521..635a22ead 100755 --- a/externals/SDL/src/video/android/SDL_androidkeyboard.c +++ b/externals/SDL/src/video/android/SDL_androidkeyboard.c @@ -41,12 +41,12 @@ void Android_InitKeyboard(void) static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_UNKNOWN, /* AKEYCODE_UNKNOWN */ - SDL_SCANCODE_SOFTLEFT, /* AKEYCODE_SOFT_LEFT */ - SDL_SCANCODE_SOFTRIGHT, /* AKEYCODE_SOFT_RIGHT */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_LEFT */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_SOFT_RIGHT */ SDL_SCANCODE_AC_HOME, /* AKEYCODE_HOME */ SDL_SCANCODE_AC_BACK, /* AKEYCODE_BACK */ - SDL_SCANCODE_CALL, /* AKEYCODE_CALL */ - SDL_SCANCODE_ENDCALL, /* AKEYCODE_ENDCALL */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_CALL */ + SDL_SCANCODE_UNKNOWN, /* AKEYCODE_ENDCALL */ SDL_SCANCODE_0, /* AKEYCODE_0 */ SDL_SCANCODE_1, /* AKEYCODE_1 */ SDL_SCANCODE_2, /* AKEYCODE_2 */ diff --git a/externals/SDL/src/video/android/SDL_androidvideo.c b/externals/SDL/src/video/android/SDL_androidvideo.c index 9555ea078..330192918 100755 --- a/externals/SDL/src/video/android/SDL_androidvideo.c +++ b/externals/SDL/src/video/android/SDL_androidvideo.c @@ -122,14 +122,12 @@ Android_CreateDevice(int devindex) device->SetWindowTitle = Android_SetWindowTitle; device->SetWindowFullscreen = Android_SetWindowFullscreen; device->MinimizeWindow = Android_MinimizeWindow; - device->SetWindowResizable = Android_SetWindowResizable; device->DestroyWindow = Android_DestroyWindow; device->GetWindowWMInfo = Android_GetWindowWMInfo; device->free = Android_DeleteDevice; /* GL pointers */ -#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Android_GLES_LoadLibrary; device->GL_GetProcAddress = Android_GLES_GetProcAddress; device->GL_UnloadLibrary = Android_GLES_UnloadLibrary; @@ -139,7 +137,6 @@ Android_CreateDevice(int devindex) device->GL_GetSwapInterval = Android_GLES_GetSwapInterval; device->GL_SwapWindow = Android_GLES_SwapWindow; device->GL_DeleteContext = Android_GLES_DeleteContext; -#endif #if SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary; diff --git a/externals/SDL/src/video/android/SDL_androidwindow.c b/externals/SDL/src/video/android/SDL_androidwindow.c index 21bedca7d..c8e45331a 100755 --- a/externals/SDL/src/video/android/SDL_androidwindow.c +++ b/externals/SDL/src/video/android/SDL_androidwindow.c @@ -81,7 +81,6 @@ Android_CreateWindow(_THIS, SDL_Window * window) /* Do not create EGLSurface for Vulkan window since it will then make the window incompatible with vkCreateAndroidSurfaceKHR */ -#if SDL_VIDEO_OPENGL_EGL if ((window->flags & SDL_WINDOW_OPENGL) != 0) { data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); @@ -92,7 +91,6 @@ Android_CreateWindow(_THIS, SDL_Window * window) goto endfunction; } } -#endif window->driverdata = data; Android_Window = window; @@ -116,8 +114,6 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display SDL_LockMutex(Android_ActivityMutex); if (window == Android_Window) { - SDL_WindowData *data; - int old_w, old_h, new_w, new_h; /* If the window is being destroyed don't change visible state */ if (!window->is_destroying) { @@ -134,7 +130,8 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display goto endfunction; } - data = (SDL_WindowData *)window->driverdata; + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + if (!data || !data->native_window) { if (data && !data->native_window) { SDL_SetError("Missing native window"); @@ -142,11 +139,11 @@ Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display goto endfunction; } - old_w = window->w; - old_h = window->h; + int old_w = window->w; + int old_h = window->h; - new_w = ANativeWindow_getWidth(data->native_window); - new_h = ANativeWindow_getHeight(data->native_window); + int new_w = ANativeWindow_getWidth(data->native_window); + int new_h = ANativeWindow_getHeight(data->native_window); if (new_w < 0 || new_h < 0) { SDL_SetError("ANativeWindow_getWidth/Height() fails"); @@ -168,12 +165,6 @@ Android_MinimizeWindow(_THIS, SDL_Window *window) Android_JNI_MinizeWindow(); } -void Android_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable) -{ - /* Set orientation */ - Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS)); -} - void Android_DestroyWindow(_THIS, SDL_Window *window) { @@ -184,13 +175,9 @@ Android_DestroyWindow(_THIS, SDL_Window *window) if (window->driverdata) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - -#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } -#endif - if (data->native_window) { ANativeWindow_release(data->native_window); } @@ -207,18 +194,15 @@ Android_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - if (info->version.major == SDL_MAJOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION && + info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_ANDROID; info->info.android.window = data->native_window; - -#if SDL_VIDEO_OPENGL_EGL info->info.android.surface = data->egl_surface; -#endif - return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } diff --git a/externals/SDL/src/video/android/SDL_androidwindow.h b/externals/SDL/src/video/android/SDL_androidwindow.h index 58e459006..efda30303 100755 --- a/externals/SDL/src/video/android/SDL_androidwindow.h +++ b/externals/SDL/src/video/android/SDL_androidwindow.h @@ -30,7 +30,6 @@ extern int Android_CreateWindow(_THIS, SDL_Window *window); extern void Android_SetWindowTitle(_THIS, SDL_Window *window); extern void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen); extern void Android_MinimizeWindow(_THIS, SDL_Window *window); -extern void Android_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable); extern void Android_DestroyWindow(_THIS, SDL_Window *window); extern SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info); @@ -38,10 +37,8 @@ extern SDL_Window *Android_Window; typedef struct { -#if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; EGLContext egl_context; /* We use this to preserve the context when losing focus */ -#endif SDL_bool backup_done; ANativeWindow *native_window; diff --git a/externals/SDL/src/video/cocoa/SDL_cocoaclipboard.h b/externals/SDL/src/video/cocoa/SDL_cocoaclipboard.h index c8c4d6808..dd5e25224 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoaclipboard.h +++ b/externals/SDL/src/video/cocoa/SDL_cocoaclipboard.h @@ -24,12 +24,12 @@ #define SDL_cocoaclipboard_h_ /* Forward declaration */ -@class SDL_VideoData; +struct SDL_VideoData; extern int Cocoa_SetClipboardText(_THIS, const char *text); extern char *Cocoa_GetClipboardText(_THIS); extern SDL_bool Cocoa_HasClipboardText(_THIS); -extern void Cocoa_CheckClipboardUpdate(SDL_VideoData * data); +extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data); #endif /* SDL_cocoaclipboard_h_ */ diff --git a/externals/SDL/src/video/cocoa/SDL_cocoaclipboard.m b/externals/SDL/src/video/cocoa/SDL_cocoaclipboard.m index e3878ce8f..1995c7289 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoaclipboard.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoaclipboard.m @@ -29,7 +29,7 @@ int Cocoa_SetClipboardText(_THIS, const char *text) { @autoreleasepool { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSPasteboard *pasteboard; NSString *format = NSPasteboardTypeString; NSString *nsstr = [NSString stringWithUTF8String:text]; @@ -38,7 +38,7 @@ Cocoa_SetClipboardText(_THIS, const char *text) } pasteboard = [NSPasteboard generalPasteboard]; - data.clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; + data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; [pasteboard setString:nsstr forType:format]; return 0; @@ -86,7 +86,7 @@ Cocoa_HasClipboardText(_THIS) } void -Cocoa_CheckClipboardUpdate(SDL_VideoData * data) +Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) { @autoreleasepool { NSPasteboard *pasteboard; @@ -94,11 +94,11 @@ Cocoa_CheckClipboardUpdate(SDL_VideoData * data) pasteboard = [NSPasteboard generalPasteboard]; count = [pasteboard changeCount]; - if (count != data.clipboard_count) { - if (data.clipboard_count) { + if (count != data->clipboard_count) { + if (data->clipboard_count) { SDL_SendClipboardUpdate(); } - data.clipboard_count = count; + data->clipboard_count = count; } }} diff --git a/externals/SDL/src/video/cocoa/SDL_cocoaevents.m b/externals/SDL/src/video/cocoa/SDL_cocoaevents.m index 3a256d2cf..d077bad6e 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoaevents.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoaevents.m @@ -45,7 +45,7 @@ static SDL_Window *FindSDLWindowForNSWindow(NSWindow *win) SDL_VideoDevice *device = SDL_GetVideoDevice(); if (device && device->windows) { for (sdlwindow = device->windows; sdlwindow; sdlwindow = sdlwindow->next) { - NSWindow *nswindow = ((__bridge SDL_WindowData *) sdlwindow->driverdata).nswindow; + NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; if (win == nswindow) return sdlwindow; } @@ -121,6 +121,7 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; + [appDefaults release]; } @end // SDLApplication @@ -181,6 +182,8 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL]; } + + [super dealloc]; } - (void)windowWillClose:(NSNotification *)notification; @@ -371,6 +374,9 @@ CreateApplicationMenus(void) /* Create the main menu bar */ [NSApp setMainMenu:mainMenu]; + [mainMenu release]; /* we're done with it, let NSApp own it. */ + mainMenu = nil; + /* Create the application menu */ appName = GetApplicationName(); appleMenu = [[NSMenu alloc] initWithTitle:@""]; @@ -390,6 +396,7 @@ CreateApplicationMenus(void) [menuItem setSubmenu:serviceMenu]; [NSApp setServicesMenu:serviceMenu]; + [serviceMenu release]; [appleMenu addItem:[NSMenuItem separatorItem]]; @@ -410,9 +417,12 @@ CreateApplicationMenus(void) menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; [menuItem setSubmenu:appleMenu]; [[NSApp mainMenu] addItem:menuItem]; + [menuItem release]; /* Tell the application object that this is now the application menu */ [NSApp setAppleMenu:appleMenu]; + [appleMenu release]; + /* Create the window menu */ windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; @@ -424,21 +434,26 @@ CreateApplicationMenus(void) [windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""]; - /* Add the fullscreen toggle menu option. */ - /* Cocoa should update the title to Enter or Exit Full Screen automatically. - * But if not, then just fallback to Toggle Full Screen. - */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; - [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; - [windowMenu addItem:menuItem]; + /* Add the fullscreen toggle menu option, if supported */ + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { + /* Cocoa should update the title to Enter or Exit Full Screen automatically. + * But if not, then just fallback to Toggle Full Screen. + */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; + [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; + [windowMenu addItem:menuItem]; + [menuItem release]; + } /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; [menuItem setSubmenu:windowMenu]; [[NSApp mainMenu] addItem:menuItem]; + [menuItem release]; /* Tell the application object that this is now the window menu */ [NSApp setWindowsMenu:windowMenu]; + [windowMenu release]; } void @@ -503,6 +518,19 @@ Cocoa_RegisterApp(void) int Cocoa_PumpEventsUntilDate(_THIS, NSDate *expiration, bool accumulate) { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + /* Update activity every 30 seconds to prevent screensaver */ + SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; + if (_this->suspend_screensaver && !data->screensaver_use_iopm) { + Uint32 now = SDL_GetTicks(); + if (!data->screensaver_activity || + SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) { + UpdateSystemActivity(UsrActivity); + data->screensaver_activity = now; + } + } +#endif + for ( ; ; ) { NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:expiration inMode:NSDefaultRunLoopMode dequeue:YES ]; if ( event == nil ) { @@ -548,7 +576,7 @@ Cocoa_PumpEvents(_THIS) void Cocoa_SendWakeupEvent(_THIS, SDL_Window *window) { @autoreleasepool { - NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; + NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; NSEvent* event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined location: NSMakePoint(0,0) @@ -567,11 +595,15 @@ void Cocoa_SuspendScreenSaver(_THIS) { @autoreleasepool { - SDL_VideoData *data = (__bridge SDL_VideoData *)_this->driverdata; + SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; - if (data.screensaver_assertion) { - IOPMAssertionRelease(data.screensaver_assertion); - data.screensaver_assertion = kIOPMNullAssertionID; + if (!data->screensaver_use_iopm) { + return; + } + + if (data->screensaver_assertion) { + IOPMAssertionRelease(data->screensaver_assertion); + data->screensaver_assertion = 0; } if (_this->suspend_screensaver) { @@ -580,13 +612,11 @@ Cocoa_SuspendScreenSaver(_THIS) * seen by OS X power users. there's an additional optional human-readable * (localized) reason parameter which we don't set. */ - IOPMAssertionID assertion = kIOPMNullAssertionID; NSString *name = [GetApplicationName() stringByAppendingString:@" using SDL_DisableScreenSaver"]; IOPMAssertionCreateWithDescription(kIOPMAssertPreventUserIdleDisplaySleep, - (__bridge CFStringRef) name, + (CFStringRef) name, NULL, NULL, NULL, 0, NULL, - &assertion); - data.screensaver_assertion = assertion; + &data->screensaver_assertion); } }} diff --git a/externals/SDL/src/video/cocoa/SDL_cocoakeyboard.m b/externals/SDL/src/video/cocoa/SDL_cocoakeyboard.m index 59ee39dc0..b229ac3f6 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoakeyboard.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoakeyboard.m @@ -104,7 +104,8 @@ } if (_markedText != aString) { - _markedText = aString; + [_markedText release]; + _markedText = [aString retain]; } _selectedRange = selectedRange; @@ -119,6 +120,7 @@ - (void)unmarkText { + [_markedText release]; _markedText = nil; SDL_SendEditingText("", 0, 0); @@ -140,7 +142,14 @@ aRange.location, aRange.length, windowHeight, NSStringFromRect(rect)); - rect = [window convertRectToScreen:rect]; +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + if (![window respondsToSelector:@selector(convertRectToScreen:)]) { + rect.origin = [window convertBaseToScreen:rect.origin]; + } else +#endif + { + rect = [window convertRectToScreen:rect]; + } return rect; } @@ -372,14 +381,14 @@ DoSidedModifiers(unsigned short scancode, static void HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags) { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - if (modifierFlags == data.modifierFlags) { + if (modifierFlags == data->modifierFlags) { return; } - DoSidedModifiers(scancode, data.modifierFlags, modifierFlags); - data.modifierFlags = modifierFlags; + DoSidedModifiers(scancode, data->modifierFlags, modifierFlags); + data->modifierFlags = modifierFlags; } static void @@ -393,10 +402,10 @@ UpdateKeymap(SDL_VideoData *data, SDL_bool send_event) /* See if the keymap needs to be updated */ key_layout = TISCopyCurrentKeyboardLayoutInputSource(); - if (key_layout == data.key_layout) { + if (key_layout == data->key_layout) { return; } - data.key_layout = key_layout; + data->key_layout = key_layout; SDL_GetDefaultKeymap(keymap); @@ -452,7 +461,7 @@ cleanup: void Cocoa_InitKeyboard(_THIS) { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; UpdateKeymap(data, SDL_FALSE); @@ -464,19 +473,19 @@ Cocoa_InitKeyboard(_THIS) SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option"); SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); - data.modifierFlags = (unsigned int)[NSEvent modifierFlags]; - SDL_ToggleModState(KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) != 0); + data->modifierFlags = (unsigned int)[NSEvent modifierFlags]; + SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSEventModifierFlagCapsLock) != 0); } void Cocoa_StartTextInput(_THIS) { @autoreleasepool { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_Window *window = SDL_GetKeyboardFocus(); NSWindow *nswindow = nil; if (window) { - nswindow = ((__bridge SDL_WindowData*)window->driverdata).nswindow; + nswindow = ((SDL_WindowData*)window->driverdata)->nswindow; } NSView *parentView = [nswindow contentView]; @@ -486,16 +495,16 @@ Cocoa_StartTextInput(_THIS) * than one copy. When we switched to another window and requesting for * text input, simply remove the field editor from its superview then add * it to the front most window's content view */ - if (!data.fieldEdit) { - data.fieldEdit = + if (!data->fieldEdit) { + data->fieldEdit = [[SDLTranslatorResponder alloc] initWithFrame: NSMakeRect(0.0, 0.0, 0.0, 0.0)]; } - if (![[data.fieldEdit superview] isEqual:parentView]) { + if (![[data->fieldEdit superview] isEqual:parentView]) { /* DEBUG_IME(@"add fieldEdit to window contentView"); */ - [data.fieldEdit removeFromSuperview]; - [parentView addSubview: data.fieldEdit]; - [nswindow makeFirstResponder: data.fieldEdit]; + [data->fieldEdit removeFromSuperview]; + [parentView addSubview: data->fieldEdit]; + [nswindow makeFirstResponder: data->fieldEdit]; } }} @@ -503,31 +512,32 @@ void Cocoa_StopTextInput(_THIS) { @autoreleasepool { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - if (data && data.fieldEdit) { - [data.fieldEdit removeFromSuperview]; - data.fieldEdit = nil; + if (data && data->fieldEdit) { + [data->fieldEdit removeFromSuperview]; + [data->fieldEdit release]; + data->fieldEdit = nil; } }} void Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; if (!rect) { SDL_InvalidParamError("rect"); return; } - [data.fieldEdit setInputRect:rect]; + [data->fieldEdit setInputRect:rect]; } void Cocoa_HandleKeyEvent(_THIS, NSEvent *event) { - SDL_VideoData *data = _this ? ((__bridge SDL_VideoData *) _this->driverdata) : nil; + SDL_VideoData *data = _this ? ((SDL_VideoData *) _this->driverdata) : NULL; if (!data) { return; /* can happen when returning from fullscreen Space on shutdown */ } @@ -565,7 +575,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) #endif if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { /* FIXME CW 2007-08-16: only send those events to the field editor for which we actually want text events, not e.g. esc or function keys. Arrow keys in particular seem to produce crashes sometimes. */ - [data.fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; + [data->fieldEdit interpretKeyEvents:[NSArray arrayWithObject:event]]; #if 0 text = [[event characters] UTF8String]; if(text && *text) { diff --git a/externals/SDL/src/video/cocoa/SDL_cocoamessagebox.m b/externals/SDL/src/video/cocoa/SDL_cocoamessagebox.m index 494f88d71..e3fc20b7e 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoamessagebox.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoamessagebox.m @@ -45,9 +45,9 @@ /* Retain the NSWindow because we'll show the alert later on the main thread */ if (window) { - nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; + nswindow = [((SDL_WindowData *) window->driverdata)->nswindow retain]; } else { - nswindow = nil; + nswindow = NULL; } } @@ -60,7 +60,7 @@ #ifdef MAC_OS_X_VERSION_10_9 if ([alert respondsToSelector:@selector(beginSheetModalForWindow:completionHandler:)]) { [alert beginSheetModalForWindow:nswindow completionHandler:^(NSModalResponse returnCode) { - self->clicked = returnCode; + clicked = returnCode; }]; } else #endif @@ -75,7 +75,7 @@ SDL_Delay(100); } - nswindow = nil; + [nswindow release]; } else { clicked = [alert runModal]; } @@ -94,7 +94,7 @@ Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid { Cocoa_RegisterApp(); - NSAlert* alert = [[NSAlert alloc] init]; + NSAlert* alert = [[[NSAlert alloc] init] autorelease]; if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { [alert setAlertStyle:NSAlertStyleCritical]; @@ -129,7 +129,7 @@ Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid } } - SDLMessageBoxPresenter* presenter = [[SDLMessageBoxPresenter alloc] initWithParentWindow:messageboxdata->window]; + SDLMessageBoxPresenter* presenter = [[[SDLMessageBoxPresenter alloc] initWithParentWindow:messageboxdata->window] autorelease]; [presenter showAlert:alert]; diff --git a/externals/SDL/src/video/cocoa/SDL_cocoametalview.m b/externals/SDL/src/video/cocoa/SDL_cocoametalview.m index ebdc921a1..6e33c4899 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoametalview.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoametalview.m @@ -89,7 +89,7 @@ SDL_MetalViewEventWatch(void *userdata, SDL_Event *event) /* Allow resize. */ self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; - SDL_AddEventWatch(SDL_MetalViewEventWatch, (__bridge void *)(self)); + SDL_AddEventWatch(SDL_MetalViewEventWatch, self); [self updateDrawableSize]; } @@ -99,7 +99,8 @@ SDL_MetalViewEventWatch(void *userdata, SDL_Event *event) - (void)dealloc { - SDL_DelEventWatch(SDL_MetalViewEventWatch, (__bridge void *)(self)); + SDL_DelEventWatch(SDL_MetalViewEventWatch, self); + [super dealloc]; } - (NSInteger)tag @@ -134,7 +135,7 @@ SDL_MetalView Cocoa_Metal_CreateView(_THIS, SDL_Window * window) { @autoreleasepool { SDL_WindowData* data = (__bridge SDL_WindowData *)window->driverdata; - NSView *view = data.nswindow.contentView; + NSView *view = data->nswindow.contentView; BOOL highDPI = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; Uint32 windowID = SDL_GetWindowID(window); SDL_cocoametalview *newview; @@ -150,6 +151,7 @@ Cocoa_Metal_CreateView(_THIS, SDL_Window * window) [view addSubview:newview]; metalview = (SDL_MetalView)CFBridgingRetain(newview); + [newview release]; return metalview; }} @@ -172,7 +174,7 @@ void Cocoa_Metal_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) { @autoreleasepool { SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; - NSView *contentView = data.sdlContentView; + NSView *contentView = data->sdlContentView; SDL_cocoametalview* metalview = [contentView viewWithTag:SDL_METALVIEW_TAG]; if (metalview) { CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; @@ -187,8 +189,11 @@ Cocoa_Metal_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) /* Fall back to the viewport size. */ NSRect viewport = [contentView bounds]; if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - /* This gives us the correct viewport for a Retina-enabled view. */ - viewport = [contentView convertRectToBacking:viewport]; + /* This gives us the correct viewport for a Retina-enabled view, only + * supported on 10.7+. */ + if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { + viewport = [contentView convertRectToBacking:viewport]; + } } if (w) { *w = viewport.size.width; diff --git a/externals/SDL/src/video/cocoa/SDL_cocoamodes.m b/externals/SDL/src/video/cocoa/SDL_cocoamodes.m index 88284b505..e8ce12d86 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoamodes.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoamodes.m @@ -31,17 +31,34 @@ #include #include +/* we need this for ShowMenuBar() and HideMenuBar(). */ +#include + /* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ #include #ifndef MAC_OS_X_VERSION_10_13 #define NSAppKitVersionNumber10_12 1504 #endif -#if (IOGRAPHICSTYPES_REV < 40) -#define kDisplayModeNativeFlag 0x02000000 -#endif +static void +Cocoa_ToggleMenuBar(const BOOL show) +{ + /* !!! FIXME: keep an eye on this. + * ShowMenuBar/HideMenuBar is officially unavailable for 64-bit binaries. + * It happens to work, as of 10.7, but we're going to see if + * we can just simply do without it on newer OSes... + */ +#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) && !defined(__LP64__) + if (show) { + ShowMenuBar(); + } else { + HideMenuBar(); + } +#endif +} + static int CG_SetError(const char *prefix, CGDisplayErr result) { @@ -286,7 +303,7 @@ Cocoa_GetDisplayName(CGDirectDisplayID displayID) /* This API is deprecated in 10.9 with no good replacement (as of 10.15). */ io_service_t servicePort = CGDisplayIOServicePort(displayID); CFDictionaryRef deviceInfo = IODisplayCreateInfoDictionary(servicePort, kIODisplayOnlyPreferredName); - NSDictionary *localizedNames = [(__bridge NSDictionary *)deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]]; + NSDictionary *localizedNames = [(NSDictionary *)deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]]; const char* displayName = NULL; if ([localizedNames count] > 0) { @@ -477,7 +494,7 @@ Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdp CFRelease(dmOptions); } else #endif - { + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { // fallback for 10.7 scaleFactor = [screen backingScaleFactor]; displayNativeSize.width = displayNativeSize.width * scaleFactor; @@ -626,6 +643,10 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) } else { CGDisplayRelease(displaydata->display); } + + if (CGDisplayIsMain(displaydata->display)) { + Cocoa_ToggleMenuBar(YES); + } } else { /* Put up the blanking window (a window above all other windows) */ if (CGDisplayIsMain(displaydata->display)) { @@ -645,6 +666,11 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) CG_SetError("CGDisplaySwitchToMode()", result); goto ERR_NO_SWITCH; } + + /* Hide the menu bar so it doesn't intercept events */ + if (CGDisplayIsMain(displaydata->display)) { + Cocoa_ToggleMenuBar(NO); + } } /* Fade in again (asynchronously) */ @@ -691,6 +717,7 @@ Cocoa_QuitModes(_THIS) CFRelease(mode->modes); } } + Cocoa_ToggleMenuBar(YES); } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/externals/SDL/src/video/cocoa/SDL_cocoamouse.m b/externals/SDL/src/video/cocoa/SDL_cocoamouse.m index f6534b334..4c107d816 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoamouse.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoamouse.m @@ -53,7 +53,7 @@ NSData *cursorData = [NSData dataWithBytesNoCopy:&cursorBytes[0] length:sizeof(cursorBytes) freeWhenDone:NO]; - NSImage *cursorImage = [[NSImage alloc] initWithData:cursorData]; + NSImage *cursorImage = [[[NSImage alloc] initWithData:cursorData] autorelease]; invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage hotSpot:NSZeroPoint]; } @@ -75,7 +75,8 @@ Cocoa_CreateDefaultCursor() if (nscursor) { cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - cursor->driverdata = (void *)CFBridgingRetain(nscursor); + cursor->driverdata = nscursor; + [nscursor retain]; } } @@ -98,52 +99,15 @@ Cocoa_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) if (nscursor) { cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { - cursor->driverdata = (void *)CFBridgingRetain(nscursor); + cursor->driverdata = nscursor; + } else { + [nscursor release]; } } return cursor; }} -/* there are .pdf files of some of the cursors we need, installed by default on macOS, but not available through NSCursor. - If we can load them ourselves, use them, otherwise fallback to something standard but not super-great. - Since these are under /System, they should be available even to sandboxed apps. */ -static NSCursor * -LoadHiddenSystemCursor(NSString *cursorName, SEL fallback) -{ - NSString *cursorPath = [@"/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/Resources/cursors" stringByAppendingPathComponent:cursorName]; - NSImage *image = [[NSImage alloc] initWithContentsOfFile:[cursorPath stringByAppendingPathComponent:@"cursor.pdf"]]; - if ((image == nil) || (image.valid == NO)) { - return [NSCursor performSelector:fallback]; - } - - NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[cursorPath stringByAppendingPathComponent:@"info.plist"]]; - - /* we can't do animation atm. :/ */ - const int frames = [[info valueForKey:@"frames"] integerValue]; - if (frames > 1) { - const NSSize cropped_size = NSMakeSize(image.size.width, (int) (image.size.height / frames)); - NSImage *cropped = [[NSImage alloc] initWithSize:cropped_size]; - if (cropped == nil) { - return [NSCursor performSelector:fallback]; - } - - #ifdef MAC_OS_VERSION_12_0 /* same value as deprecated symbol. */ - const NSCompositingOperation operation = NSCompositingOperationCopy; - #else - const NSCompositingOperation operation = NSCompositeCopy; - #endif - [cropped lockFocus]; - const NSRect cropped_rect = NSMakeRect(0, 0, cropped_size.width, cropped_size.height); - [image drawInRect:cropped_rect fromRect:cropped_rect operation:operation fraction:1]; - [cropped unlockFocus]; - image = cropped; - } - - NSCursor *cursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint([[info valueForKey:@"hotx"] doubleValue], [[info valueForKey:@"hoty"] doubleValue])]; - return cursor; -} - static SDL_Cursor * Cocoa_CreateSystemCursor(SDL_SystemCursor id) { @autoreleasepool @@ -158,29 +122,27 @@ Cocoa_CreateSystemCursor(SDL_SystemCursor id) case SDL_SYSTEM_CURSOR_IBEAM: nscursor = [NSCursor IBeamCursor]; break; + case SDL_SYSTEM_CURSOR_WAIT: + nscursor = [NSCursor arrowCursor]; + break; case SDL_SYSTEM_CURSOR_CROSSHAIR: nscursor = [NSCursor crosshairCursor]; break; - case SDL_SYSTEM_CURSOR_WAIT: /* !!! FIXME: this is more like WAITARROW */ - nscursor = LoadHiddenSystemCursor(@"busybutclickable", @selector(arrowCursor)); - break; - case SDL_SYSTEM_CURSOR_WAITARROW: /* !!! FIXME: this is meant to be animated */ - nscursor = LoadHiddenSystemCursor(@"busybutclickable", @selector(arrowCursor)); + case SDL_SYSTEM_CURSOR_WAITARROW: + nscursor = [NSCursor arrowCursor]; break; case SDL_SYSTEM_CURSOR_SIZENWSE: - nscursor = LoadHiddenSystemCursor(@"resizenorthwestsoutheast", @selector(closedHandCursor)); - break; case SDL_SYSTEM_CURSOR_SIZENESW: - nscursor = LoadHiddenSystemCursor(@"resizenortheastsouthwest", @selector(closedHandCursor)); + nscursor = [NSCursor closedHandCursor]; break; case SDL_SYSTEM_CURSOR_SIZEWE: - nscursor = LoadHiddenSystemCursor(@"resizeeastwest", @selector(resizeLeftRightCursor)); + nscursor = [NSCursor resizeLeftRightCursor]; break; case SDL_SYSTEM_CURSOR_SIZENS: - nscursor = LoadHiddenSystemCursor(@"resizenorthsouth", @selector(resizeUpDownCursor)); + nscursor = [NSCursor resizeUpDownCursor]; break; case SDL_SYSTEM_CURSOR_SIZEALL: - nscursor = LoadHiddenSystemCursor(@"move", @selector(closedHandCursor)); + nscursor = [NSCursor closedHandCursor]; break; case SDL_SYSTEM_CURSOR_NO: nscursor = [NSCursor operationNotAllowedCursor]; @@ -197,7 +159,8 @@ Cocoa_CreateSystemCursor(SDL_SystemCursor id) cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { /* We'll free it later, so retain it here */ - cursor->driverdata = (void *)CFBridgingRetain(nscursor); + [nscursor retain]; + cursor->driverdata = nscursor; } } @@ -208,7 +171,9 @@ static void Cocoa_FreeCursor(SDL_Cursor * cursor) { @autoreleasepool { - CFBridgingRelease(cursor->driverdata); + NSCursor *nscursor = (NSCursor *)cursor->driverdata; + + [nscursor release]; SDL_free(cursor); }} @@ -219,11 +184,11 @@ Cocoa_ShowCursor(SDL_Cursor * cursor) SDL_VideoDevice *device = SDL_GetVideoDevice(); SDL_Window *window = (device ? device->windows : NULL); for (; window != NULL; window = window->next) { - SDL_WindowData *driverdata = (__bridge SDL_WindowData *)window->driverdata; + SDL_WindowData *driverdata = (SDL_WindowData *)window->driverdata; if (driverdata) { - [driverdata.nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:) - withObject:[driverdata.nswindow contentView] - waitUntilDone:NO]; + [driverdata->nswindow performSelectorOnMainThread:@selector(invalidateCursorRectsForView:) + withObject:[driverdata->nswindow contentView] + waitUntilDone:NO]; } } return 0; @@ -249,10 +214,10 @@ Cocoa_WarpMouseGlobal(int x, int y) { SDL_Mouse *mouse = SDL_GetMouse(); if (mouse->focus) { - SDL_WindowData *data = (__bridge SDL_WindowData *) mouse->focus->driverdata; - if ([data.listener isMovingOrFocusClickPending]) { + SDL_WindowData *data = (SDL_WindowData *) mouse->focus->driverdata; + if ([data->listener isMovingOrFocusClickPending]) { DLog("Postponing warp, window being moved or focused."); - [data.listener setPendingMoveX:x Y:y]; + [data->listener setPendingMoveX:x Y:y]; return 0; } } @@ -288,12 +253,28 @@ Cocoa_WarpMouseGlobal(int x, int y) static void Cocoa_WarpMouse(SDL_Window * window, int x, int y) { - Cocoa_WarpMouseGlobal(window->x + x, window->y + y); + Cocoa_WarpMouseGlobal(x + window->x, y + window->y); } static int Cocoa_SetRelativeMouseMode(SDL_bool enabled) { + /* We will re-apply the relative mode when the window gets focus, if it + * doesn't have focus right now. + */ + SDL_Window *window = SDL_GetMouseFocus(); + if (!window) { + return 0; + } + + /* We will re-apply the relative mode when the window finishes being moved, + * if it is being moved right now. + */ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if ([data->listener isMovingOrFocusClickPending]) { + return 0; + } + CGError result; if (enabled) { DLog("Turning on."); @@ -306,22 +287,6 @@ Cocoa_SetRelativeMouseMode(SDL_bool enabled) return SDL_SetError("CGAssociateMouseAndMouseCursorPosition() failed"); } - /* We will re-apply the non-relative mode when the window gets focus, if it - * doesn't have focus right now. - */ - SDL_Window *window = SDL_GetKeyboardFocus(); - if (!window) { - return 0; - } - - /* We will re-apply the non-relative mode when the window finishes being moved, - * if it is being moved right now. - */ - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - if ([data.listener isMovingOrFocusClickPending]) { - return 0; - } - /* The hide/unhide calls are redundant most of the time, but they fix * https://bugzilla.libsdl.org/show_bug.cgi?id=2550 */ @@ -395,18 +360,18 @@ Cocoa_HandleTitleButtonEvent(_THIS, NSEvent *event) NSWindow *nswindow = [event window]; for (window = _this->windows; window; window = window->next) { - SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; - if (data && data.nswindow == nswindow) { + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + if (data && data->nswindow == nswindow) { switch ([event type]) { case NSEventTypeLeftMouseDown: case NSEventTypeRightMouseDown: case NSEventTypeOtherMouseDown: - [data.listener setFocusClickPending:[event buttonNumber]]; + [data->listener setFocusClickPending:[event buttonNumber]]; break; case NSEventTypeLeftMouseUp: case NSEventTypeRightMouseUp: case NSEventTypeOtherMouseUp: - [data.listener clearFocusClickPending:[event buttonNumber]]; + [data->listener clearFocusClickPending:[event buttonNumber]]; break; default: break; @@ -502,13 +467,15 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) CGFloat y = [event deltaY]; SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL; - if ([event isDirectionInvertedFromDevice] == YES) { - direction = SDL_MOUSEWHEEL_FLIPPED; + if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) { + if ([event isDirectionInvertedFromDevice] == YES) { + direction = SDL_MOUSEWHEEL_FLIPPED; + } } /* For discrete scroll events from conventional mice, always send a full tick. For continuous scroll events from trackpads, send fractional deltas for smoother scrolling. */ - if (![event hasPreciseScrollingDeltas]) { + if (![event respondsToSelector:@selector(hasPreciseScrollingDeltas)] || ![event hasPreciseScrollingDeltas]) { if (x > 0) { x = SDL_ceil(x); } else if (x < 0) { diff --git a/externals/SDL/src/video/cocoa/SDL_cocoaopengl.m b/externals/SDL/src/video/cocoa/SDL_cocoaopengl.m index aa2f51eaa..9d31b9c22 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoaopengl.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoaopengl.m @@ -82,10 +82,10 @@ - (void)setWindow:(SDL_Window *)newWindow { if (self->window) { - SDL_WindowData *oldwindowdata = (__bridge SDL_WindowData *)self->window->driverdata; + SDL_WindowData *oldwindowdata = (SDL_WindowData *)self->window->driverdata; /* Make sure to remove us from the old window's context list, or we'll get scheduled updates from it too. */ - NSMutableArray *contexts = oldwindowdata.nscontexts; + NSMutableArray *contexts = oldwindowdata->nscontexts; @synchronized (contexts) { [contexts removeObject:self]; } @@ -94,11 +94,11 @@ self->window = newWindow; if (newWindow) { - SDL_WindowData *windowdata = (__bridge SDL_WindowData *)newWindow->driverdata; - NSView *contentview = windowdata.sdlContentView; + SDL_WindowData *windowdata = (SDL_WindowData *)newWindow->driverdata; + NSView *contentview = windowdata->sdlContentView; /* Now sign up for scheduled updates for the new window. */ - NSMutableArray *contexts = windowdata.nscontexts; + NSMutableArray *contexts = windowdata->nscontexts; @synchronized (contexts) { [contexts addObject:self]; } @@ -180,10 +180,10 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; + SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; NSOpenGLPixelFormatAttribute attr[32]; NSOpenGLPixelFormat *fmt; SDLOpenGLContext *context; - SDL_GLContext sdlcontext; NSOpenGLContext *share_context = nil; int i = 0; const char *glversion; @@ -213,15 +213,22 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) return NULL; #endif } + if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) { + SDL_SetError ("OpenGL Core Profile is not supported on this platform version"); + return NULL; + } attr[i++] = NSOpenGLPFAAllowOfflineRenderers; - NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; - if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { - profile = NSOpenGLProfileVersion3_2Core; + /* specify a profile if we're on Lion (10.7) or later. */ + if (lion_or_later) { + NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { + profile = NSOpenGLProfileVersion3_2Core; + } + attr[i++] = NSOpenGLPFAOpenGLProfile; + attr[i++] = profile; } - attr[i++] = NSOpenGLPFAOpenGLProfile; - attr[i++] = profile; attr[i++] = NSOpenGLPFAColorSize; attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8; @@ -281,20 +288,20 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) } if (_this->gl_config.share_with_current_context) { - share_context = (__bridge NSOpenGLContext*)SDL_GL_GetCurrentContext(); + share_context = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); } context = [[SDLOpenGLContext alloc] initWithFormat:fmt shareContext:share_context]; + [fmt release]; + if (context == nil) { SDL_SetError("Failed creating OpenGL context"); return NULL; } - sdlcontext = (SDL_GLContext)CFBridgingRetain(context); - - if ( Cocoa_GL_MakeCurrent(_this, window, (__bridge SDL_GLContext)context) < 0 ) { - Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); + if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) { + Cocoa_GL_DeleteContext(_this, context); SDL_SetError("Failed making OpenGL context current"); return NULL; } @@ -308,27 +315,27 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) glGetStringFunc = (const GLubyte *(APIENTRY *)(GLenum)) SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { - Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); + Cocoa_GL_DeleteContext(_this, context); SDL_SetError ("Failed getting OpenGL glGetString entry point"); return NULL; } glversion = (const char *)glGetStringFunc(GL_VERSION); if (glversion == NULL) { - Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); + Cocoa_GL_DeleteContext(_this, context); SDL_SetError ("Failed getting OpenGL context version"); return NULL; } if (SDL_sscanf(glversion, "%d.%d", &glversion_major, &glversion_minor) != 2) { - Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); + Cocoa_GL_DeleteContext(_this, context); SDL_SetError ("Failed parsing OpenGL context version"); return NULL; } if ((glversion_major < _this->gl_config.major_version) || ((glversion_major == _this->gl_config.major_version) && (glversion_minor < _this->gl_config.minor_version))) { - Cocoa_GL_DeleteContext(_this, (__bridge SDL_GLContext)context); + Cocoa_GL_DeleteContext(_this, context); SDL_SetError ("Failed creating OpenGL context at version requested"); return NULL; } @@ -339,7 +346,7 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) /*_this->gl_config.major_version = glversion_major;*/ /*_this->gl_config.minor_version = glversion_minor;*/ } - return sdlcontext; + return context; }} int @@ -347,7 +354,7 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { @autoreleasepool { if (context) { - SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)context; + SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; if ([nscontext window] != window) { [nscontext setWindow:window]; [nscontext updateIfNeeded]; @@ -362,15 +369,17 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) void Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) -{ @autoreleasepool { - SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; - NSView *contentView = windata.sdlContentView; + SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; + NSView *contentView = windata->sdlContentView; NSRect viewport = [contentView bounds]; if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - /* This gives us the correct viewport for a Retina-enabled view. */ - viewport = [contentView convertRectToBacking:viewport]; + /* This gives us the correct viewport for a Retina-enabled view, only + * supported on 10.7+. */ + if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { + viewport = [contentView convertRectToBacking:viewport]; + } } if (w) { @@ -380,7 +389,7 @@ Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) if (h) { *h = viewport.size.height; } -}} +} int Cocoa_GL_SetSwapInterval(_THIS, int interval) @@ -394,7 +403,7 @@ Cocoa_GL_SetSwapInterval(_THIS, int interval) return SDL_SetError("Late swap tearing currently unsupported"); } - nscontext = (__bridge NSOpenGLContext*)SDL_GL_GetCurrentContext(); + nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); if (nscontext != nil) { value = interval; [nscontext setValues:&value forParameter:NSOpenGLCPSwapInterval]; @@ -414,7 +423,7 @@ Cocoa_GL_GetSwapInterval(_THIS) GLint value; int status = 0; - nscontext = (__bridge NSOpenGLContext*)SDL_GL_GetCurrentContext(); + nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); if (nscontext != nil) { [nscontext getValues:&value forParameter:NSOpenGLCPSwapInterval]; status = (int)value; @@ -427,15 +436,15 @@ int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDLOpenGLContext* nscontext = (__bridge SDLOpenGLContext*)SDL_GL_GetCurrentContext(); - SDL_VideoData *videodata = (__bridge SDL_VideoData *) _this->driverdata; + SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; /* on 10.14 ("Mojave") and later, this deadlocks if two contexts in two threads try to swap at the same time, so put a mutex around it. */ - SDL_LockMutex(videodata.swaplock); + SDL_LockMutex(videodata->swaplock); [nscontext flushBuffer]; [nscontext updateIfNeeded]; - SDL_UnlockMutex(videodata.swaplock); + SDL_UnlockMutex(videodata->swaplock); return 0; }} @@ -443,8 +452,10 @@ void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context) { @autoreleasepool { - SDLOpenGLContext *nscontext = (SDLOpenGLContext *)CFBridgingRelease(context); + SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; + [nscontext setWindow:NULL]; + [nscontext release]; }} /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ diff --git a/externals/SDL/src/video/cocoa/SDL_cocoaopengles.m b/externals/SDL/src/video/cocoa/SDL_cocoaopengles.m index 63d013d8f..13102f8c0 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoaopengles.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoaopengles.m @@ -29,8 +29,8 @@ /* EGL implementation of SDL OpenGL support */ int -Cocoa_GLES_LoadLibrary(_THIS, const char *path) -{ +Cocoa_GLES_LoadLibrary(_THIS, const char *path) { + /* If the profile requested is not GL ES, switch over to WIN_GL functions */ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { #if SDL_VIDEO_OPENGL_CGL @@ -59,10 +59,9 @@ Cocoa_GLES_LoadLibrary(_THIS, const char *path) SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) -{ @autoreleasepool { SDL_GLContext context; - SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; #if SDL_VIDEO_OPENGL_CGL if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { @@ -86,37 +85,25 @@ Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) } #endif - context = SDL_EGL_CreateContext(_this, data.egl_surface); + context = SDL_EGL_CreateContext(_this, data->egl_surface); return context; -}} +} void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context) -{ @autoreleasepool { SDL_EGL_DeleteContext(_this, context); Cocoa_GLES_UnloadLibrary(_this); -}} +} -int -Cocoa_GLES_SwapWindow(_THIS, SDL_Window * window) -{ @autoreleasepool -{ - return SDL_EGL_SwapBuffers(_this, ((__bridge SDL_WindowData *) window->driverdata).egl_surface); -}} - -int -Cocoa_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) -{ @autoreleasepool -{ - return SDL_EGL_MakeCurrent(_this, window ? ((__bridge SDL_WindowData *) window->driverdata).egl_surface : EGL_NO_SURFACE, context); -}} +SDL_EGL_SwapWindow_impl(Cocoa) +SDL_EGL_MakeCurrent_impl(Cocoa) int Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window) { /* The current context is lost in here; save it and reset it. */ - SDL_WindowData *windowdata = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; SDL_Window *current_win = SDL_GL_GetCurrentWindow(); SDL_GLContext current_ctx = SDL_GL_GetCurrentContext(); @@ -134,10 +121,10 @@ Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window) } /* Create the GLES window surface */ - NSView* v = windowdata.nswindow.contentView; - windowdata.egl_surface = SDL_EGL_CreateSurface(_this, (__bridge NativeWindowType)[v layer]); + NSView* v = windowdata->nswindow.contentView; + windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)[v layer]); - if (windowdata.egl_surface == EGL_NO_SURFACE) { + if (windowdata->egl_surface == EGL_NO_SURFACE) { return SDL_SetError("Could not create GLES window surface"); } diff --git a/externals/SDL/src/video/cocoa/SDL_cocoashape.m b/externals/SDL/src/video/cocoa/SDL_cocoashape.m index 2fa5cab0f..1176036ac 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoashape.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoashape.m @@ -29,12 +29,11 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) -{ @autoreleasepool { - SDL_WindowData* windata = (__bridge SDL_WindowData*)window->driverdata; - [windata.nswindow setOpaque:NO]; + SDL_WindowData* windata = (SDL_WindowData*)window->driverdata; + [windata->nswindow setOpaque:NO]; - [windata.nswindow setStyleMask:NSWindowStyleMaskBorderless]; + [windata->nswindow setStyleMask:NSWindowStyleMaskBorderless]; SDL_WindowShaper* result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); result->window = window; @@ -45,14 +44,14 @@ Cocoa_CreateShaper(SDL_Window* window) SDL_ShapeData* data = (SDL_ShapeData *)SDL_malloc(sizeof(SDL_ShapeData)); result->driverdata = data; - data->context = [windata.nswindow graphicsContext]; + data->context = [windata->nswindow graphicsContext]; data->saved = SDL_FALSE; data->shape = NULL; int resized_properly = Cocoa_ResizeWindowShape(window); SDL_assert(resized_properly == 0); return result; -}} +} typedef struct { NSView* view; @@ -75,7 +74,7 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowSha { @autoreleasepool { SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata; - SDL_WindowData* windata = (__bridge SDL_WindowData*)shaper->window->driverdata; + SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata; SDL_CocoaClosure closure; if(data->saved == SDL_TRUE) { [data->context restoreGraphicsState]; @@ -87,10 +86,10 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowSha [NSGraphicsContext setCurrentContext:data->context]; [[NSColor clearColor] set]; - NSRectFill([windata.sdlContentView frame]); + NSRectFill([windata->sdlContentView frame]); data->shape = SDL_CalculateShapeTree(*shape_mode,shape); - closure.view = windata.sdlContentView; + closure.view = windata->sdlContentView; closure.path = [NSBezierPath bezierPath]; closure.window = shaper->window; SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure); diff --git a/externals/SDL/src/video/cocoa/SDL_cocoavideo.h b/externals/SDL/src/video/cocoa/SDL_cocoavideo.h index 4de8511a3..af0abe5cc 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoavideo.h +++ b/externals/SDL/src/video/cocoa/SDL_cocoavideo.h @@ -97,15 +97,18 @@ DECLARE_ALERT_STYLE(Critical); @class SDLTranslatorResponder; -@interface SDL_VideoData : NSObject - @property (nonatomic) int allow_spaces; - @property (nonatomic) unsigned int modifierFlags; - @property (nonatomic) void *key_layout; - @property (nonatomic) SDLTranslatorResponder *fieldEdit; - @property (nonatomic) NSInteger clipboard_count; - @property (nonatomic) IOPMAssertionID screensaver_assertion; - @property (nonatomic) SDL_mutex *swaplock; -@end +typedef struct SDL_VideoData +{ + int allow_spaces; + unsigned int modifierFlags; + void *key_layout; + SDLTranslatorResponder *fieldEdit; + NSInteger clipboard_count; + Uint32 screensaver_activity; + BOOL screensaver_use_iopm; + IOPMAssertionID screensaver_assertion; + SDL_mutex *swaplock; +} SDL_VideoData; /* Utility functions */ extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); diff --git a/externals/SDL/src/video/cocoa/SDL_cocoavideo.m b/externals/SDL/src/video/cocoa/SDL_cocoavideo.m index 1df31f648..231b2de5c 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoavideo.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoavideo.m @@ -22,10 +22,6 @@ #if SDL_VIDEO_DRIVER_COCOA -#if !__has_feature(objc_arc) -#error SDL must be built with Objective-C ARC (automatic reference counting) enabled -#endif - #include "SDL.h" #include "SDL_endian.h" #include "SDL_cocoavideo.h" @@ -33,10 +29,6 @@ #include "SDL_cocoavulkan.h" #include "SDL_cocoametalview.h" -@implementation SDL_VideoData - -@end - /* Initialization/Query functions */ static int Cocoa_VideoInit(_THIS); static void Cocoa_VideoQuit(_THIS); @@ -45,18 +37,16 @@ static void Cocoa_VideoQuit(_THIS); static void Cocoa_DeleteDevice(SDL_VideoDevice * device) -{ @autoreleasepool { if (device->wakeup_lock) { SDL_DestroyMutex(device->wakeup_lock); } - CFBridgingRelease(device->driverdata); + SDL_free(device->driverdata); SDL_free(device); -}} +} static SDL_VideoDevice * Cocoa_CreateDevice(int devindex) -{ @autoreleasepool { SDL_VideoDevice *device; SDL_VideoData *data; @@ -66,16 +56,16 @@ Cocoa_CreateDevice(int devindex) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (device) { - data = [[SDL_VideoData alloc] init]; + data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); } else { - data = nil; + data = NULL; } if (!data) { SDL_OutOfMemory(); SDL_free(device); return NULL; } - device->driverdata = (void *)CFBridgingRetain(data); + device->driverdata = data; device->wakeup_lock = SDL_CreateMutex(); /* Set the function pointers */ @@ -113,7 +103,6 @@ Cocoa_CreateDevice(int devindex) device->SetWindowGammaRamp = Cocoa_SetWindowGammaRamp; device->GetWindowGammaRamp = Cocoa_GetWindowGammaRamp; device->GetWindowICCProfile = Cocoa_GetWindowICCProfile; - device->GetWindowDisplayIndex = Cocoa_GetWindowDisplayIndex; device->SetWindowMouseRect = Cocoa_SetWindowMouseRect; device->SetWindowMouseGrab = Cocoa_SetWindowMouseGrab; device->SetWindowKeyboardGrab = Cocoa_SetWindowKeyboardGrab; @@ -176,7 +165,7 @@ Cocoa_CreateDevice(int devindex) device->free = Cocoa_DeleteDevice; return device; -}} +} VideoBootStrap COCOA_bootstrap = { "cocoa", "SDL Cocoa video driver", @@ -186,9 +175,8 @@ VideoBootStrap COCOA_bootstrap = { int Cocoa_VideoInit(_THIS) -{ @autoreleasepool { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; Cocoa_InitModes(_this); Cocoa_InitKeyboard(_this); @@ -196,27 +184,29 @@ Cocoa_VideoInit(_THIS) return -1; } - data.allow_spaces = SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE); + data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); - data.swaplock = SDL_CreateMutex(); - if (!data.swaplock) { + /* The IOPM assertion API can disable the screensaver as of 10.7. */ + data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; + + data->swaplock = SDL_CreateMutex(); + if (!data->swaplock) { return -1; } return 0; -}} +} void Cocoa_VideoQuit(_THIS) -{ @autoreleasepool { - SDL_VideoData *data = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; Cocoa_QuitModes(_this); Cocoa_QuitKeyboard(_this); Cocoa_QuitMouse(_this); - SDL_DestroyMutex(data.swaplock); - data.swaplock = NULL; -}} + SDL_DestroyMutex(data->swaplock); + data->swaplock = NULL; +} /* This function assumes that it's called from within an autorelease pool */ NSImage * @@ -233,7 +223,7 @@ Cocoa_CreateImage(SDL_Surface * surface) return nil; } - imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL + imgrep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL pixelsWide: converted->w pixelsHigh: converted->h bitsPerSample: 8 @@ -242,7 +232,7 @@ Cocoa_CreateImage(SDL_Surface * surface) isPlanar: NO colorSpaceName: NSDeviceRGBColorSpace bytesPerRow: converted->pitch - bitsPerPixel: converted->format->BitsPerPixel]; + bitsPerPixel: converted->format->BitsPerPixel] autorelease]; if (imgrep == nil) { SDL_FreeSurface(converted); return nil; @@ -262,7 +252,7 @@ Cocoa_CreateImage(SDL_Surface * surface) pixels += 4; } - img = [[NSImage alloc] initWithSize: NSMakeSize(surface->w, surface->h)]; + img = [[[NSImage alloc] initWithSize: NSMakeSize(surface->w, surface->h)] autorelease]; if (img != nil) { [img addRepresentation: imgrep]; } @@ -279,16 +269,11 @@ Cocoa_CreateImage(SDL_Surface * surface) * versions remain identical! */ -void SDL_NSLog(const char *prefix, const char *text) +void SDL_NSLog(const char *text) { @autoreleasepool { - NSString *nsText = [NSString stringWithUTF8String:text]; - if (prefix) { - NSString *nsPrefix = [NSString stringWithUTF8String:prefix]; - NSLog(@"%@: %@", nsPrefix, nsText); - } else { - NSLog(@"%@", nsText); - } + NSString *str = [NSString stringWithUTF8String:text]; + NSLog(@"%@", str); } } diff --git a/externals/SDL/src/video/cocoa/SDL_cocoawindow.h b/externals/SDL/src/video/cocoa/SDL_cocoawindow.h index 61324550a..a42d9c87b 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoawindow.h +++ b/externals/SDL/src/video/cocoa/SDL_cocoawindow.h @@ -29,7 +29,7 @@ #include "../SDL_egl_c.h" #endif -@class SDL_WindowData; +typedef struct SDL_WindowData SDL_WindowData; typedef enum { @@ -40,10 +40,7 @@ typedef enum } PendingWindowOperation; @interface Cocoa_WindowListener : NSResponder { - /* SDL_WindowData owns this Listener and has a strong reference to it. - * To avoid reference cycles, we could have either a weak or an - * unretained ref to the WindowData. */ - __weak SDL_WindowData *_data; + SDL_WindowData *_data; BOOL observingVisible; BOOL wasCtrlLeft; BOOL wasVisible; @@ -117,22 +114,22 @@ typedef enum /* *INDENT-ON* */ @class SDLOpenGLContext; -@class SDL_VideoData; -@interface SDL_WindowData : NSObject - @property (nonatomic) SDL_Window *window; - @property (nonatomic) NSWindow *nswindow; - @property (nonatomic) NSView *sdlContentView; - @property (nonatomic) NSMutableArray *nscontexts; - @property (nonatomic) SDL_bool created; - @property (nonatomic) SDL_bool inWindowFullscreenTransition; - @property (nonatomic) NSInteger flash_request; - @property (nonatomic) Cocoa_WindowListener *listener; - @property (nonatomic) SDL_VideoData *videodata; +struct SDL_WindowData +{ + SDL_Window *window; + NSWindow *nswindow; + NSView *sdlContentView; + NSMutableArray *nscontexts; + SDL_bool created; + SDL_bool inWindowFullscreenTransition; + NSInteger flash_request; + Cocoa_WindowListener *listener; + struct SDL_VideoData *videodata; #if SDL_VIDEO_OPENGL_EGL - @property (nonatomic) EGLSurface egl_surface; + EGLSurface egl_surface; #endif -@end +}; extern int Cocoa_CreateWindow(_THIS, SDL_Window * window); extern int Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, @@ -156,7 +153,6 @@ extern void Cocoa_SetWindowAlwaysOnTop(_THIS, SDL_Window * window, SDL_bool on_t extern void Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern int Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp); extern void* Cocoa_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size); -extern int Cocoa_GetWindowDisplayIndex(_THIS, SDL_Window * window); extern int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp); extern void Cocoa_SetWindowMouseRect(_THIS, SDL_Window * window); extern void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed); diff --git a/externals/SDL/src/video/cocoa/SDL_cocoawindow.m b/externals/SDL/src/video/cocoa/SDL_cocoawindow.m index 30791b0e2..bf86d7b68 100755 --- a/externals/SDL/src/video/cocoa/SDL_cocoawindow.m +++ b/externals/SDL/src/video/cocoa/SDL_cocoawindow.m @@ -62,10 +62,6 @@ #define NSAppKitVersionNumber10_14 1671 #endif -@implementation SDL_WindowData - -@end - @interface NSWindow (SDL) #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 /* Added in the 10.10 SDK */ @property (readonly) NSRect contentLayoutRect; @@ -231,7 +227,7 @@ /* !!! FIXME: is there a better way to do this? */ if (_this) { for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) { - NSWindow *nswindow = ((__bridge SDL_WindowData *) sdlwindow->driverdata).nswindow; + NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; if (nswindow == self) { break; } @@ -254,7 +250,7 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r) static void ScheduleContextUpdates(SDL_WindowData *data) { - if (!data || !data.nscontexts) { + if (!data || !data->nscontexts) { return; } @@ -265,7 +261,7 @@ ScheduleContextUpdates(SDL_WindowData *data) #endif NSOpenGLContext *currentContext = [NSOpenGLContext currentContext]; - NSMutableArray *contexts = data.nscontexts; + NSMutableArray *contexts = data->nscontexts; @synchronized (contexts) { for (SDLOpenGLContext *context in contexts) { if (context == currentContext) { @@ -320,19 +316,19 @@ GetWindowStyle(SDL_Window * window) static SDL_bool SetWindowStyle(SDL_Window * window, NSUInteger style) { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data.nswindow; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; /* The view responder chain gets messed with during setStyleMask */ - if ([data.sdlContentView nextResponder] == data.listener) { - [data.sdlContentView setNextResponder:nil]; + if ([data->sdlContentView nextResponder] == data->listener) { + [data->sdlContentView setNextResponder:nil]; } [nswindow setStyleMask:style]; /* The view responder chain gets messed with during setStyleMask */ - if ([data.sdlContentView nextResponder] != data.listener) { - [data.sdlContentView setNextResponder:data.listener]; + if ([data->sdlContentView nextResponder] != data->listener) { + [data->sdlContentView setNextResponder:data->listener]; } return SDL_TRUE; @@ -341,9 +337,9 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) static SDL_bool ShouldAdjustCoordinatesForGrab(SDL_Window * window) { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - if (!data || [data.listener isMovingOrFocusClickPending]) { + if (!data || [data->listener isMovingOrFocusClickPending]) { return SDL_FALSE; } @@ -400,10 +396,10 @@ AdjustCoordinatesForGrab(SDL_Window * window, int x, int y, CGPoint *adjusted) static void Cocoa_UpdateClipCursor(SDL_Window * window) { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_13_2) { - NSWindow *nswindow = data.nswindow; + NSWindow *nswindow = data->nswindow; SDL_Rect mouse_rect; SDL_zero(mouse_rect); @@ -457,8 +453,8 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)listen:(SDL_WindowData *)data { NSNotificationCenter *center; - NSWindow *window = data.nswindow; - NSView *view = data.sdlContentView; + NSWindow *window = data->nswindow; + NSView *view = data->sdlContentView; _data = data; observingVisible = YES; @@ -519,12 +515,12 @@ Cocoa_UpdateClipCursor(SDL_Window * window) return; } - if (object == _data.nswindow && [keyPath isEqualToString:@"visible"]) { + if (object == _data->nswindow && [keyPath isEqualToString:@"visible"]) { int newVisibility = [[change objectForKey:@"new"] intValue]; if (newVisibility) { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_SHOWN, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); } else { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIDDEN, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } } } @@ -532,18 +528,18 @@ Cocoa_UpdateClipCursor(SDL_Window * window) -(void) pauseVisibleObservation { observingVisible = NO; - wasVisible = [_data.nswindow isVisible]; + wasVisible = [_data->nswindow isVisible]; } -(void) resumeVisibleObservation { - BOOL isVisible = [_data.nswindow isVisible]; + BOOL isVisible = [_data->nswindow isVisible]; observingVisible = YES; if (wasVisible != isVisible) { if (isVisible) { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_SHOWN, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_SHOWN, 0, 0); } else { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIDDEN, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } wasVisible = isVisible; @@ -552,11 +548,11 @@ Cocoa_UpdateClipCursor(SDL_Window * window) -(BOOL) setFullscreenSpace:(BOOL) state { - SDL_Window *window = _data.window; - NSWindow *nswindow = _data.nswindow; - SDL_VideoData *videodata = ((__bridge SDL_WindowData *) window->driverdata).videodata; + SDL_Window *window = _data->window; + NSWindow *nswindow = _data->nswindow; + SDL_VideoData *videodata = ((SDL_WindowData *) window->driverdata)->videodata; - if (!videodata.allow_spaces) { + if (!videodata->allow_spaces) { return NO; /* Spaces are forcibly disabled. */ } else if (state && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP)) { return NO; /* we only allow you to make a Space on FULLSCREEN_DESKTOP windows. */ @@ -600,7 +596,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)close { NSNotificationCenter *center; - NSWindow *window = _data.nswindow; + NSWindow *window = _data->nswindow; NSView *view = [window contentView]; center = [NSNotificationCenter defaultCenter]; @@ -682,15 +678,15 @@ Cocoa_UpdateClipCursor(SDL_Window * window) mouse->WarpMouseGlobal(pendingWindowWarpX, pendingWindowWarpY); pendingWindowWarpX = pendingWindowWarpY = INT_MAX; } - if (mouse->relative_mode && !mouse->relative_mode_warp && mouse->focus == _data.window) { + if (mouse->relative_mode && !mouse->relative_mode_warp && mouse->focus == _data->window) { /* Move the cursor to the nearest point in the window */ { int x, y; CGPoint cgpoint; SDL_GetMouseState(&x, &y); - cgpoint.x = _data.window->x + x; - cgpoint.y = _data.window->y + y; + cgpoint.x = _data->window->x + x; + cgpoint.y = _data->window->y + y; Cocoa_HandleMouseWarp(cgpoint.x, cgpoint.y); @@ -700,25 +696,25 @@ Cocoa_UpdateClipCursor(SDL_Window * window) mouse->SetRelativeMouseMode(SDL_TRUE); } else { - Cocoa_UpdateClipCursor(_data.window); + Cocoa_UpdateClipCursor(_data->window); } } } - (BOOL)windowShouldClose:(id)sender { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_CLOSE, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); return NO; } - (void)windowDidExpose:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_EXPOSED, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0); } - (void)windowWillMove:(NSNotification *)aNotification { - if ([_data.nswindow isKindOfClass:[SDLWindow class]]) { + if ([_data->nswindow isKindOfClass:[SDLWindow class]]) { pendingWindowWarpX = pendingWindowWarpY = INT_MAX; isMoving = YES; } @@ -727,8 +723,8 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowDidMove:(NSNotification *)aNotification { int x, y; - SDL_Window *window = _data.window; - NSWindow *nswindow = _data.nswindow; + SDL_Window *window = _data->window; + NSWindow *nswindow = _data->nswindow; BOOL fullscreen = window->flags & FULLSCREEN_MASK; NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; ConvertNSRect([nswindow screen], fullscreen, &rect); @@ -768,8 +764,8 @@ Cocoa_UpdateClipCursor(SDL_Window * window) return; } - SDL_Window *window = _data.window; - NSWindow *nswindow = _data.nswindow; + SDL_Window *window = _data->window; + NSWindow *nswindow = _data->nswindow; int x, y, w, h; NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect); @@ -803,17 +799,17 @@ Cocoa_UpdateClipCursor(SDL_Window * window) focusClickPending = 0; [self onMovingOrFocusClickPendingStateCleared]; } - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } - (void)windowDidDeminiaturize:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_RESTORED, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESTORED, 0, 0); } - (void)windowDidBecomeKey:(NSNotification *)aNotification { - SDL_Window *window = _data.window; + SDL_Window *window = _data->window; SDL_Mouse *mouse = SDL_GetMouse(); /* We're going to get keyboard events, since we're key. */ @@ -829,7 +825,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) NSPoint point; int x, y; - point = [_data.nswindow mouseLocationOutsideOfEventStream]; + point = [_data->nswindow mouseLocationOutsideOfEventStream]; x = (int)point.x; y = (int)(window->h - point.y); @@ -839,14 +835,14 @@ Cocoa_UpdateClipCursor(SDL_Window * window) } /* Check to see if someone updated the clipboard */ - Cocoa_CheckClipboardUpdate(_data.videodata); + Cocoa_CheckClipboardUpdate(_data->videodata); if ((isFullscreenSpace) && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { [NSMenu setMenuBarVisible:NO]; } const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; - _data.videodata.modifierFlags = (_data.videodata.modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; + _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; SDL_ToggleModState(KMOD_CAPS, newflags != 0); } @@ -858,12 +854,12 @@ Cocoa_UpdateClipCursor(SDL_Window * window) } /* Some other window will get mouse events, since we're not key. */ - if (SDL_GetMouseFocus() == _data.window) { + if (SDL_GetMouseFocus() == _data->window) { SDL_SetMouseFocus(NULL); } /* Some other window will get keyboard events, since we're not key. */ - if (SDL_GetKeyboardFocus() == _data.window) { + if (SDL_GetKeyboardFocus() == _data->window) { SDL_SetKeyboardFocus(NULL); } @@ -880,22 +876,22 @@ Cocoa_UpdateClipCursor(SDL_Window * window) return; } - if ([oldscale doubleValue] != [_data.nswindow backingScaleFactor]) { + if ([oldscale doubleValue] != [_data->nswindow backingScaleFactor]) { /* Force a resize event when the backing scale factor changes. */ - _data.window->w = 0; - _data.window->h = 0; + _data->window->w = 0; + _data->window->h = 0; [self windowDidResize:aNotification]; } } - (void)windowDidChangeScreenProfile:(NSNotification *)aNotification { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_ICCPROF_CHANGED, 0, 0); } - (void)windowWillEnterFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data.window; + SDL_Window *window = _data->window; SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable)); @@ -905,7 +901,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data.window; + SDL_Window *window = _data->window; if (window->is_destroying) { return; @@ -921,9 +917,9 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowDidEnterFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data.window; - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data.nswindow; + SDL_Window *window = _data->window; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; inFullscreenTransition = NO; @@ -953,7 +949,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowWillExitFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data.window; + SDL_Window *window = _data->window; isFullscreenSpace = NO; inFullscreenTransition = YES; @@ -971,7 +967,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data.window; + SDL_Window *window = _data->window; if (window->is_destroying) { return; @@ -987,8 +983,8 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (void)windowDidExitFullScreen:(NSNotification *)aNotification { - SDL_Window *window = _data.window; - NSWindow *nswindow = _data.nswindow; + SDL_Window *window = _data->window; + NSWindow *nswindow = _data->nswindow; NSButton *button = nil; inFullscreenTransition = NO; @@ -1081,7 +1077,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions { - if ((_data.window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { + if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { return NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar; } else { return proposedOptions; @@ -1131,16 +1127,16 @@ Cocoa_UpdateClipCursor(SDL_Window * window) - (BOOL)processHitTest:(NSEvent *)theEvent { - SDL_assert(isDragAreaRunning == [_data.nswindow isMovableByWindowBackground]); + SDL_assert(isDragAreaRunning == [_data->nswindow isMovableByWindowBackground]); - if (_data.window->hit_test) { /* if no hit-test, skip this. */ + if (_data->window->hit_test) { /* if no hit-test, skip this. */ const NSPoint location = [theEvent locationInWindow]; - const SDL_Point point = { (int) location.x, _data.window->h - (((int) location.y)-1) }; - const SDL_HitTestResult rc = _data.window->hit_test(_data.window, &point, _data.window->hit_test_data); + const SDL_Point point = { (int) location.x, _data->window->h - (((int) location.y)-1) }; + const SDL_HitTestResult rc = _data->window->hit_test(_data->window, &point, _data->window->hit_test_data); if (rc == SDL_HITTEST_DRAGGABLE) { if (!isDragAreaRunning) { isDragAreaRunning = YES; - [_data.nswindow setMovableByWindowBackground:YES]; + [_data->nswindow setMovableByWindowBackground:YES]; } return YES; /* dragging! */ } @@ -1148,7 +1144,7 @@ Cocoa_UpdateClipCursor(SDL_Window * window) if (isDragAreaRunning) { isDragAreaRunning = NO; - [_data.nswindow setMovableByWindowBackground:NO]; + [_data->nswindow setMovableByWindowBackground:NO]; return YES; /* was dragging, drop event. */ } @@ -1168,7 +1164,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w // the position in the currently-focused window. We don't (currently) send a mousemove // event for the background window, this just makes sure the button is reported at the // correct position in its own event. - if ( focus && ([theEvent window] == ((__bridge SDL_WindowData *) focus->driverdata).nswindow) ) { + if ( focus && ([theEvent window] == ((SDL_WindowData *) focus->driverdata)->nswindow) ) { rc = SDL_SendMouseButtonClicks(window, mouseID, state, button, clicks); } else { const int orig_x = mouse->x; @@ -1202,7 +1198,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w } if ([self processHitTest:theEvent]) { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* dragging, drop event. */ } @@ -1228,7 +1224,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w break; } - Cocoa_SendMouseButtonClicks(mouse, theEvent, _data.window, SDL_PRESSED, button); + Cocoa_SendMouseButtonClicks(mouse, theEvent, _data->window, SDL_PRESSED, button); } - (void)rightMouseDown:(NSEvent *)theEvent @@ -1251,7 +1247,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w int button; if ([self processHitTest:theEvent]) { - SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); + SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return; /* stopped dragging, drop event. */ } @@ -1275,7 +1271,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w break; } - Cocoa_SendMouseButtonClicks(mouse, theEvent, _data.window, SDL_RELEASED, button); + Cocoa_SendMouseButtonClicks(mouse, theEvent, _data->window, SDL_RELEASED, button); } - (void)rightMouseUp:(NSEvent *)theEvent @@ -1296,7 +1292,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w } const SDL_MouseID mouseID = mouse->mouseID; - SDL_Window *window = _data.window; + SDL_Window *window = _data->window; NSPoint point; int x, y; @@ -1345,7 +1341,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w - (void)scrollWheel:(NSEvent *)theEvent { - Cocoa_HandleMouseWheel(_data.window, theEvent); + Cocoa_HandleMouseWheel(_data->window, theEvent); } - (void)touchesBeganWithEvent:(NSEvent *) theEvent @@ -1535,7 +1531,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w white until the app is ready to draw. In practice on modern macOS, this only gets called for window creation and other extraordinary events. */ self.layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack); - ScheduleContextUpdates((__bridge SDL_WindowData *) _sdlWindow->driverdata); + ScheduleContextUpdates((SDL_WindowData *) _sdlWindow->driverdata); SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0); } @@ -1559,7 +1555,7 @@ Cocoa_SendMouseButtonClicks(SDL_Mouse * mouse, NSEvent *theEvent, SDL_Window * w if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) { [self addCursorRect:[self bounds] - cursor:(__bridge NSCursor *)mouse->cur_cursor->driverdata]; + cursor:mouse->cur_cursor->driverdata]; } else { [self addCursorRect:[self bounds] cursor:[NSCursor invisibleCursor]]; @@ -1580,23 +1576,23 @@ static int SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview, SDL_bool created) { @autoreleasepool { - SDL_VideoData *videodata = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *data; /* Allocate the window data */ - data = [[SDL_WindowData alloc] init]; + window->driverdata = data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data)); if (!data) { return SDL_OutOfMemory(); } - data.window = window; - data.nswindow = nswindow; - data.created = created; - data.videodata = videodata; - data.nscontexts = [[NSMutableArray alloc] init]; - data.sdlContentView = nsview; + data->window = window; + data->nswindow = nswindow; + data->created = created; + data->videodata = videodata; + data->nscontexts = [[NSMutableArray alloc] init]; + data->sdlContentView = nsview; /* Create an event listener for the window */ - data.listener = [[Cocoa_WindowListener alloc] init]; + data->listener = [[Cocoa_WindowListener alloc] init]; /* Fill in the SDL window with the window data */ { @@ -1609,7 +1605,7 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview, } /* Set up the listener after we create the view */ - [data.listener listen:data]; + [data->listener listen:data]; if ([nswindow isVisible]) { window->flags |= SDL_WINDOW_SHOWN; @@ -1650,22 +1646,16 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview, if ([nswindow isKeyWindow]) { window->flags |= SDL_WINDOW_INPUT_FOCUS; - SDL_SetKeyboardFocus(data.window); + SDL_SetKeyboardFocus(data->window); } - /* SDL_WindowData will be holding a strong reference to the NSWindow, and - * it will also call [NSWindow close] in DestroyWindow before releasing the - * NSWindow, so the extra release provided by releasedWhenClosed isn't - * necessary. */ - nswindow.releasedWhenClosed = NO; - /* Prevents the window's "window device" from being destroyed when it is * hidden. See http://www.mikeash.com/pyblog/nsopenglcontext-and-one-shot.html */ [nswindow setOneShot:NO]; /* All done! */ - window->driverdata = (void *)CFBridgingRetain(data); + window->driverdata = data; return 0; }} @@ -1673,7 +1663,7 @@ int Cocoa_CreateWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_VideoData *videodata = (__bridge SDL_VideoData *) _this->driverdata; + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; NSWindow *nswindow; SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); NSRect rect; @@ -1718,7 +1708,9 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) } #endif - if (videodata.allow_spaces) { + if (videodata->allow_spaces) { + SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); + SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]); /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */ if (window->flags & SDL_WINDOW_RESIZABLE) { /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ @@ -1742,8 +1734,10 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) #endif /* Note: as of the macOS 10.15 SDK, this defaults to YES instead of NO when * the NSHighResolutionCapable boolean is set in Info.plist. */ - BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; - [contentView setWantsBestResolutionOpenGLSurface:highdpi]; + if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { + BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; + [contentView setWantsBestResolutionOpenGLSurface:highdpi]; + } #ifdef __clang__ #pragma clang diagnostic pop #endif @@ -1757,8 +1751,10 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) #endif /* SDL_VIDEO_OPENGL_EGL */ #endif /* SDL_VIDEO_OPENGL_ES2 */ [nswindow setContentView:contentView]; + [contentView release]; if (SetupWindowData(_this, window, nswindow, contentView, SDL_TRUE) < 0) { + [nswindow release]; return -1; } @@ -1790,11 +1786,11 @@ Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) NSView* nsview = nil; NSWindow *nswindow = nil; - if ([(__bridge id)data isKindOfClass:[NSWindow class]]) { - nswindow = (__bridge NSWindow*)data; + if ([(id)data isKindOfClass:[NSWindow class]]) { + nswindow = (NSWindow*)data; nsview = [nswindow contentView]; - } else if ([(__bridge id)data isKindOfClass:[NSView class]]) { - nsview = (__bridge NSView*)data; + } else if ([(id)data isKindOfClass:[NSView class]]) { + nsview = (NSView*)data; nswindow = [nsview window]; } else { SDL_assert(false); @@ -1815,8 +1811,10 @@ Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) #endif /* Note: as of the macOS 10.15 SDK, this defaults to YES instead of NO when * the NSHighResolutionCapable boolean is set in Info.plist. */ - BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; - [nsview setWantsBestResolutionOpenGLSurface:highdpi]; + if ([nsview respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) { + BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; + [nsview setWantsBestResolutionOpenGLSurface:highdpi]; + } #ifdef __clang__ #pragma clang diagnostic pop #endif @@ -1829,9 +1827,10 @@ Cocoa_SetWindowTitle(_THIS, SDL_Window * window) { @autoreleasepool { const char *title = window->title ? window->title : ""; - NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; + NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; NSString *string = [[NSString alloc] initWithUTF8String:title]; [nswindow setTitle:string]; + [string release]; }} void @@ -1849,8 +1848,8 @@ void Cocoa_SetWindowPosition(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; - NSWindow *nswindow = windata.nswindow; + SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = windata->nswindow; NSRect rect; Uint32 moveHack; @@ -1872,8 +1871,8 @@ void Cocoa_SetWindowSize(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; - NSWindow *nswindow = windata.nswindow; + SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = windata->nswindow; NSRect rect; Uint32 moveHack; @@ -1899,39 +1898,39 @@ void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; NSSize minSize; minSize.width = window->min_w; minSize.height = window->min_h; - [windata.nswindow setContentMinSize:minSize]; + [windata->nswindow setContentMinSize:minSize]; }} void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; NSSize maxSize; maxSize.width = window->max_w; maxSize.height = window->max_h; - [windata.nswindow setContentMaxSize:maxSize]; + [windata->nswindow setContentMaxSize:maxSize]; }} void Cocoa_ShowWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windowData = ((__bridge SDL_WindowData *) window->driverdata); - NSWindow *nswindow = windowData.nswindow; + SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); + NSWindow *nswindow = windowData->nswindow; if (![nswindow isMiniaturized]) { - [windowData.listener pauseVisibleObservation]; + [windowData->listener pauseVisibleObservation]; [nswindow makeKeyAndOrderFront:nil]; - [windowData.listener resumeVisibleObservation]; + [windowData->listener resumeVisibleObservation]; } }} @@ -1939,7 +1938,7 @@ void Cocoa_HideWindow(_THIS, SDL_Window * window) { @autoreleasepool { - NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; + NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; [nswindow orderOut:nil]; }} @@ -1948,26 +1947,26 @@ void Cocoa_RaiseWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windowData = ((__bridge SDL_WindowData *) window->driverdata); - NSWindow *nswindow = windowData.nswindow; + SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); + NSWindow *nswindow = windowData->nswindow; /* makeKeyAndOrderFront: has the side-effect of deminiaturizing and showing a minimized or hidden window, so check for that before showing it. */ - [windowData.listener pauseVisibleObservation]; + [windowData->listener pauseVisibleObservation]; if (![nswindow isMiniaturized] && [nswindow isVisible]) { [NSApp activateIgnoringOtherApps:YES]; [nswindow makeKeyAndOrderFront:nil]; } - [windowData.listener resumeVisibleObservation]; + [windowData->listener resumeVisibleObservation]; }} void Cocoa_MaximizeWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata; - NSWindow *nswindow = windata.nswindow; + SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = windata->nswindow; [nswindow zoom:nil]; @@ -1978,10 +1977,10 @@ void Cocoa_MinimizeWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data.nswindow; - if ([data.listener isInFullscreenSpaceTransition]) { - [data.listener addPendingWindowOperation:PENDING_OPERATION_MINIMIZE]; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; + if ([data->listener isInFullscreenSpaceTransition]) { + [data->listener addPendingWindowOperation:PENDING_OPERATION_MINIMIZE]; } else { [nswindow miniaturize:nil]; } @@ -1991,7 +1990,7 @@ void Cocoa_RestoreWindow(_THIS, SDL_Window * window) { @autoreleasepool { - NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; + NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; if ([nswindow isMiniaturized]) { [nswindow deminiaturize:nil]; @@ -2019,28 +2018,18 @@ Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) * The window will get permanently stuck if resizable is false. * -flibit */ - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - Cocoa_WindowListener *listener = data.listener; - NSWindow *nswindow = data.nswindow; - SDL_VideoData *videodata = data.videodata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + Cocoa_WindowListener *listener = data->listener; if (![listener isInFullscreenSpace]) { SetWindowStyle(window, GetWindowStyle(window)); } - if (videodata.allow_spaces) { - if (resizable) { - /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ - [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; - } else { - [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged]; - } - } }} void Cocoa_SetWindowAlwaysOnTop(_THIS, SDL_Window * window, SDL_bool on_top) { @autoreleasepool { - NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; + NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; if (on_top) { [nswindow setLevel:NSFloatingWindowLevel]; } else { @@ -2052,13 +2041,13 @@ void Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) { @autoreleasepool { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data.nswindow; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; NSRect rect; /* The view responder chain gets messed with during setStyleMask */ - if ([data.sdlContentView nextResponder] == data.listener) { - [data.sdlContentView setNextResponder:nil]; + if ([data->sdlContentView nextResponder] == data->listener) { + [data->sdlContentView setNextResponder:nil]; } if (fullscreen) { @@ -2104,8 +2093,8 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display } /* The view responder chain gets messed with during setStyleMask */ - if ([data.sdlContentView nextResponder] != data.listener) { - [data.sdlContentView setNextResponder:data.listener]; + if ([data->sdlContentView nextResponder] != data->listener) { + [data->sdlContentView setNextResponder:data->listener]; } s_moveHack = 0; @@ -2128,9 +2117,9 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display } if ([nswindow isVisible] || fullscreen) { - [data.listener pauseVisibleObservation]; + [data->listener pauseVisibleObservation]; [nswindow makeKeyAndOrderFront:nil]; - [data.listener resumeVisibleObservation]; + [data->listener resumeVisibleObservation]; } ScheduleContextUpdates(data); @@ -2138,7 +2127,6 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display int Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) -{ @autoreleasepool { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); CGDirectDisplayID display_id = ((SDL_DisplayData *)display->driverdata)->display; @@ -2161,14 +2149,13 @@ Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) return SDL_SetError("CGSetDisplayTransferByTable()"); } return 0; -}} +} void* Cocoa_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size) -{ @autoreleasepool { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - NSWindow *nswindow = data.nswindow; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; NSScreen *screen = [nswindow screen]; NSData* iccProfileData = nil; void* retIccProfileData = NULL; @@ -2198,40 +2185,7 @@ Cocoa_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size) [iccProfileData getBytes:retIccProfileData length:[iccProfileData length]]; *size = [iccProfileData length]; return retIccProfileData; -}} - -int -Cocoa_GetWindowDisplayIndex(_THIS, SDL_Window * window) -{ @autoreleasepool -{ - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - - /* Not recognized via CHECK_WINDOW_MAGIC */ - if (data == NULL){ - return 0; - } - - /* - Considering that we already have the display coordinates in which the window is placed (described via displayframe) - instead of checking in which display the window is placed, we should check which SDL display matches the display described - via displayframe. - */ - NSRect displayframe = data.nswindow.screen.frame; - SDL_Point display_center; - SDL_Rect sdl_display_rect; - - display_center.x = displayframe.origin.x + displayframe.size.width / 2; - display_center.y = displayframe.origin.y + displayframe.size.height / 2; - - for (int i = 0; i < SDL_GetNumVideoDisplays(); i++){ - SDL_GetDisplayBounds(i, &sdl_display_rect); - if (SDL_EnclosePoints(&display_center, 1, &sdl_display_rect, NULL)) { - return i; - } - } - SDL_SetError("Couldn't find the display where the window is attached to."); - return -1; -}} +} int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) @@ -2265,96 +2219,96 @@ Cocoa_SetWindowMouseRect(_THIS, SDL_Window * window) void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) -{ @autoreleasepool { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Cocoa_UpdateClipCursor(window); if (data && (window->flags & SDL_WINDOW_FULLSCREEN)) { if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS) - && ![data.listener isInFullscreenSpace]) { + && ![data->listener isInFullscreenSpace]) { /* OpenGL is rendering to the window, so make it visible! */ /* Doing this in 10.11 while in a Space breaks things (bug #3152) */ - [data.nswindow setLevel:CGShieldingWindowLevel()]; + [data->nswindow setLevel:CGShieldingWindowLevel()]; } else if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { - [data.nswindow setLevel:NSFloatingWindowLevel]; + [data->nswindow setLevel:NSFloatingWindowLevel]; } else { - [data.nswindow setLevel:kCGNormalWindowLevel]; + [data->nswindow setLevel:kCGNormalWindowLevel]; } } -}} +} void Cocoa_DestroyWindow(_THIS, SDL_Window * window) { @autoreleasepool { - SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata); + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; if (data) { - if ([data.listener isInFullscreenSpace]) { + if ([data->listener isInFullscreenSpace]) { [NSMenu setMenuBarVisible:YES]; } - [data.listener close]; - data.listener = nil; - if (data.created) { + [data->listener close]; + [data->listener release]; + if (data->created) { /* Release the content view to avoid further updateLayer callbacks */ - [data.nswindow setContentView:nil]; - [data.nswindow close]; + [data->nswindow setContentView:nil]; + [data->nswindow close]; } - NSArray *contexts = [data.nscontexts copy]; + NSArray *contexts = [[data->nscontexts copy] autorelease]; for (SDLOpenGLContext *context in contexts) { /* Calling setWindow:NULL causes the context to remove itself from the context list. */ [context setWindow:NULL]; } + [data->nscontexts release]; + + SDL_free(data); } window->driverdata = NULL; }} SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) -{ @autoreleasepool { - NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow; + NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; if (info->version.major <= SDL_MAJOR_VERSION) { info->subsystem = SDL_SYSWM_COCOA; info->info.cocoa.window = nswindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } -}} +} SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window * window) -{ @autoreleasepool { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - if ([data.listener isInFullscreenSpace]) { + if ([data->listener isInFullscreenSpace]) { return SDL_TRUE; } else { return SDL_FALSE; } -}} +} SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) { @autoreleasepool { SDL_bool succeeded = SDL_FALSE; - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - if (data.inWindowFullscreenTransition) { + if (data->inWindowFullscreenTransition) { return SDL_FALSE; } - data.inWindowFullscreenTransition = SDL_TRUE; - if ([data.listener setFullscreenSpace:(state ? YES : NO)]) { + data->inWindowFullscreenTransition = SDL_TRUE; + if ([data->listener setFullscreenSpace:(state ? YES : NO)]) { const int maxattempts = 3; int attempt = 0; while (++attempt <= maxattempts) { @@ -2363,7 +2317,7 @@ Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) */ const int limit = 10000; int count = 0; - while ([data.listener isInFullscreenSpaceTransition]) { + while ([data->listener isInFullscreenSpaceTransition]) { if ( ++count == limit ) { /* Uh oh, transition isn't completing. Should we assert? */ break; @@ -2371,16 +2325,16 @@ Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) SDL_Delay(1); SDL_PumpEvents(); } - if ([data.listener isInFullscreenSpace] == (state ? YES : NO)) + if ([data->listener isInFullscreenSpace] == (state ? YES : NO)) break; /* Try again, the last attempt was interrupted by user gestures */ - if (![data.listener setFullscreenSpace:(state ? YES : NO)]) + if (![data->listener setFullscreenSpace:(state ? YES : NO)]) break; /* ??? */ } /* Return TRUE to prevent non-space fullscreen logic from running */ succeeded = SDL_TRUE; } - data.inWindowFullscreenTransition = SDL_FALSE; + data->inWindowFullscreenTransition = SDL_FALSE; return succeeded; }} @@ -2393,26 +2347,25 @@ Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled) void Cocoa_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept) -{ @autoreleasepool { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; if (accept) { - [data.nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; + [data->nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; } else { - [data.nswindow unregisterDraggedTypes]; + [data->nswindow unregisterDraggedTypes]; } -}} +} int Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation) { @autoreleasepool { /* Note that this is app-wide and not window-specific! */ - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - if (data.flash_request) { - [NSApp cancelUserAttentionRequest:data.flash_request]; - data.flash_request = 0; + if (data->flash_request) { + [NSApp cancelUserAttentionRequest:data->flash_request]; + data->flash_request = 0; } switch (operation) { @@ -2420,10 +2373,10 @@ Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation) /* Canceled above */ break; case SDL_FLASH_BRIEFLY: - data.flash_request = [NSApp requestUserAttention:NSInformationalRequest]; + data->flash_request = [NSApp requestUserAttention:NSInformationalRequest]; break; case SDL_FLASH_UNTIL_FOCUSED: - data.flash_request = [NSApp requestUserAttention:NSCriticalRequest]; + data->flash_request = [NSApp requestUserAttention:NSCriticalRequest]; break; default: return SDL_Unsupported(); @@ -2433,12 +2386,11 @@ Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation) int Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) -{ @autoreleasepool { - SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; - [data.nswindow setAlphaValue:opacity]; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + [data->nswindow setAlphaValue:opacity]; return 0; -}} +} #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/externals/SDL/src/video/directfb/SDL_DirectFB_window.c b/externals/SDL/src/video/directfb/SDL_DirectFB_window.c index 999f21d5c..7dfda6472 100755 --- a/externals/SDL/src/video/directfb/SDL_DirectFB_window.c +++ b/externals/SDL/src/video/directfb/SDL_DirectFB_window.c @@ -482,15 +482,16 @@ DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, return SDL_FALSE; } - if (info->version.major == SDL_MAJOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION && + info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_DIRECTFB; info->info.dfb.dfb = devdata->dfb; info->info.dfb.window = windata->dfbwin; info->info.dfb.surface = windata->surface; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } diff --git a/externals/SDL/src/video/dummy/SDL_nullframebuffer.c b/externals/SDL/src/video/dummy/SDL_nullframebuffer.c index dd7cbbd16..f11ee3fe4 100755 --- a/externals/SDL/src/video/dummy/SDL_nullframebuffer.c +++ b/externals/SDL/src/video/dummy/SDL_nullframebuffer.c @@ -33,13 +33,17 @@ int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * forma SDL_Surface *surface; const Uint32 surface_format = SDL_PIXELFORMAT_RGB888; int w, h; + int bpp; + Uint32 Rmask, Gmask, Bmask, Amask; /* Free the old framebuffer surface */ - SDL_DUMMY_DestroyWindowFramebuffer(_this, window); + surface = (SDL_Surface *) SDL_GetWindowData(window, DUMMY_SURFACE); + SDL_FreeSurface(surface); /* Create a new one */ + SDL_PixelFormatEnumToMasks(surface_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); SDL_GetWindowSize(window, &w, &h); - surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format); + surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask); if (!surface) { return -1; } diff --git a/externals/SDL/src/video/dummy/SDL_nullvideo.c b/externals/SDL/src/video/dummy/SDL_nullvideo.c index a7fb1aac2..aafed848d 100755 --- a/externals/SDL/src/video/dummy/SDL_nullvideo.c +++ b/externals/SDL/src/video/dummy/SDL_nullvideo.c @@ -46,7 +46,6 @@ #include "SDL_nullvideo.h" #include "SDL_nullevents_c.h" #include "SDL_nullframebuffer_c.h" -#include "SDL_hints.h" #define DUMMYVID_DRIVER_NAME "dummy" @@ -60,7 +59,7 @@ static void DUMMY_VideoQuit(_THIS); static int DUMMY_Available(void) { - const char *envr = SDL_GetHint(SDL_HINT_VIDEODRIVER); + const char *envr = SDL_getenv("SDL_VIDEODRIVER"); if ((envr) && (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) { return (1); } diff --git a/externals/SDL/src/video/emscripten/SDL_emscriptenevents.c b/externals/SDL/src/video/emscripten/SDL_emscriptenevents.c index 39578f854..0f7da8e3f 100755 --- a/externals/SDL/src/video/emscripten/SDL_emscriptenevents.c +++ b/externals/SDL/src/video/emscripten/SDL_emscriptenevents.c @@ -493,7 +493,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { Uint32 scancode; - SDL_bool prevent_default = SDL_FALSE; + SDL_bool prevent_default; SDL_bool is_nav_key; /* .keyCode is deprecated, but still the most reliable way to get keys */ @@ -577,10 +577,12 @@ Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, voi break; } } - prevent_default = SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode); + SDL_SendKeyboardKey(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_PRESSED : SDL_RELEASED, scancode); } } + prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE; + /* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress * we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX */ diff --git a/externals/SDL/src/video/emscripten/SDL_emscriptenframebuffer.c b/externals/SDL/src/video/emscripten/SDL_emscriptenframebuffer.c index 03fea04ef..d4e9cb8e8 100755 --- a/externals/SDL/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/externals/SDL/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -26,8 +26,6 @@ #include "SDL_emscriptenframebuffer.h" #include "SDL_hints.h" -#include - int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch) { @@ -71,7 +69,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec /* Send the data to the display */ - MAIN_THREAD_EM_ASM({ + EM_ASM_INT({ var w = $0; var h = $1; var pixels = $2; @@ -156,6 +154,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec } SDL2.ctx.putImageData(SDL2.image, 0, 0); + return 0; }, surface->w, surface->h, surface->pixels); if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { diff --git a/externals/SDL/src/video/emscripten/SDL_emscriptenmouse.c b/externals/SDL/src/video/emscripten/SDL_emscriptenmouse.c index 38e394ac1..e73072590 100755 --- a/externals/SDL/src/video/emscripten/SDL_emscriptenmouse.c +++ b/externals/SDL/src/video/emscripten/SDL_emscriptenmouse.c @@ -24,7 +24,6 @@ #include #include -#include #include "SDL_emscriptenmouse.h" #include "SDL_emscriptenvideo.h" @@ -63,7 +62,6 @@ Emscripten_CreateDefaultCursor() return Emscripten_CreateCursorFromString("default", SDL_FALSE); } - static SDL_Cursor* Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) { @@ -76,7 +74,7 @@ Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) return NULL; } - cursor_url = (const char *)MAIN_THREAD_EM_ASM_INT({ + cursor_url = (const char *)EM_ASM_INT({ var w = $0; var h = $1; var hot_x = $2; @@ -208,15 +206,16 @@ Emscripten_ShowCursor(SDL_Cursor* cursor) curdata = (Emscripten_CursorData *) cursor->driverdata; if(curdata->system_cursor) { - MAIN_THREAD_EM_ASM({ + EM_ASM_INT({ if (Module['canvas']) { Module['canvas'].style['cursor'] = UTF8ToString($0); } + return 0; }, curdata->system_cursor); } } else { - MAIN_THREAD_EM_ASM( + EM_ASM( if (Module['canvas']) { Module['canvas'].style['cursor'] = 'none'; } diff --git a/externals/SDL/src/video/emscripten/SDL_emscriptenvideo.c b/externals/SDL/src/video/emscripten/SDL_emscriptenvideo.c index 4c6038f09..8f4227667 100755 --- a/externals/SDL/src/video/emscripten/SDL_emscriptenvideo.c +++ b/externals/SDL/src/video/emscripten/SDL_emscriptenvideo.c @@ -43,7 +43,6 @@ static int Emscripten_VideoInit(_THIS); static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); static void Emscripten_VideoQuit(_THIS); static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); -static int Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); static int Emscripten_CreateWindow(_THIS, SDL_Window * window); static void Emscripten_SetWindowSize(_THIS, SDL_Window * window); @@ -83,7 +82,6 @@ Emscripten_CreateDevice(int devindex) device->VideoInit = Emscripten_VideoInit; device->VideoQuit = Emscripten_VideoQuit; device->GetDisplayUsableBounds = Emscripten_GetDisplayUsableBounds; - device->GetDisplayDPI = Emscripten_GetDisplayDPI; device->SetDisplayMode = Emscripten_SetDisplayMode; @@ -174,37 +172,16 @@ Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * if (rect) { rect->x = 0; rect->y = 0; - rect->w = MAIN_THREAD_EM_ASM_INT({ + rect->w = EM_ASM_INT_V({ return window.innerWidth; }); - rect->h = MAIN_THREAD_EM_ASM_INT({ + rect->h = EM_ASM_INT_V({ return window.innerHeight; }); } return 0; } -static int -Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi_out, float * hdpi_out, float * vdpi_out) -{ - const float dpi_reference = 96.0f; - float dpi; - - dpi = (float)emscripten_get_device_pixel_ratio() * dpi_reference; - - if (ddpi_out) { - *ddpi_out = dpi; - } - if (hdpi_out) { - *hdpi_out = dpi; - } - if (vdpi_out) { - *vdpi_out = dpi; - } - - return 0; -} - static void Emscripten_PumpEvents(_THIS) { diff --git a/externals/SDL/src/video/haiku/SDL_BWin.h b/externals/SDL/src/video/haiku/SDL_BWin.h index 1ac517164..dc6e442a8 100755 --- a/externals/SDL/src/video/haiku/SDL_BWin.h +++ b/externals/SDL/src/video/haiku/SDL_BWin.h @@ -39,6 +39,7 @@ extern "C" { #include #include #include +#include #if SDL_VIDEO_OPENGL #include #endif @@ -57,48 +58,19 @@ enum WinCommands { BWIN_SET_TITLE, BWIN_SET_BORDERED, BWIN_SET_RESIZABLE, - BWIN_FULLSCREEN, - BWIN_UPDATE_FRAMEBUFFER, - BWIN_MINIMUM_SIZE_WINDOW + BWIN_FULLSCREEN }; -// non-OpenGL framebuffer view -class SDL_BView: public BView -{ -public: - SDL_BView(BRect frame, const char* name, uint32 resizingMode) - : BView(frame, name, resizingMode, B_WILL_DRAW), - fBitmap(NULL) - { - } - void Draw(BRect dirty) - { - if (fBitmap != NULL) - DrawBitmap(fBitmap, B_ORIGIN); - } - - void SetBitmap(BBitmap *bitmap) - { - fBitmap = bitmap; - } - -private: - BBitmap *fBitmap; -}; - -class SDL_BWin: public BWindow +class SDL_BWin:public BDirectWindow { public: /* Constructor/Destructor */ SDL_BWin(BRect bounds, window_look look, uint32 flags) - : BWindow(bounds, "Untitled", look, B_NORMAL_WINDOW_FEEL, flags) + : BDirectWindow(bounds, "Untitled", look, B_NORMAL_WINDOW_FEEL, flags) { _last_buttons = 0; - _cur_view = NULL; - _SDL_View = NULL; - #if SDL_VIDEO_OPENGL _SDL_GLView = NULL; _gl_type = 0; @@ -107,88 +79,59 @@ class SDL_BWin: public BWindow _inhibit_resize = false; _mouse_focused = false; _prev_frame = NULL; - _fullscreen = NULL; /* Handle framebuffer stuff */ + _connected = _connection_disabled = false; + _buffer_created = _buffer_dirty = false; + _trash_window_buffer = false; _buffer_locker = new BLocker(); _bitmap = NULL; + _clips = NULL; + _num_clips = 0; + +#ifdef DRAWTHREAD + _draw_thread_id = spawn_thread(HAIKU_DrawThread, "drawing_thread", + B_NORMAL_PRIORITY, (void*) this); + resume_thread(_draw_thread_id); +#endif } virtual ~ SDL_BWin() { Lock(); - - if (_SDL_View != NULL && _SDL_View != _cur_view) { - delete _SDL_View; - _SDL_View = NULL; - } + _connection_disabled = true; + int32 result; #if SDL_VIDEO_OPENGL if (_SDL_GLView) { - if (((SDL_BApp*)be_app)->GetCurrentContext() == _SDL_GLView) - ((SDL_BApp*)be_app)->SetCurrentContext(NULL); - if (_SDL_GLView == _cur_view) - RemoveChild(_SDL_GLView); - _SDL_GLView = NULL; - // _SDL_GLView deleted by HAIKU_GL_DeleteContext + _SDL_GLView->UnlockGL(); + RemoveChild(_SDL_GLView); /* Why was this outside the if + statement before? */ } #endif Unlock(); +#if SDL_VIDEO_OPENGL + if (_SDL_GLView) { + delete _SDL_GLView; + } +#endif delete _prev_frame; /* Clean up framebuffer stuff */ _buffer_locker->Lock(); +#ifdef DRAWTHREAD + wait_for_thread(_draw_thread_id, &result); +#endif + SDL_free(_clips); delete _buffer_locker; } - - void SetCurrentView(BView *view) - { - if (_cur_view != view) { - if (_cur_view != NULL) - RemoveChild(_cur_view); - _cur_view = view; - if (_cur_view != NULL) - AddChild(_cur_view); - } - } - void UpdateCurrentView() - { - if (_SDL_GLView != NULL) { - SetCurrentView(_SDL_GLView); - } else if (_SDL_View != NULL) { - SetCurrentView(_SDL_View); - } else { - SetCurrentView(NULL); - } - } - - SDL_BView *CreateView() { - Lock(); - if (_SDL_View == NULL) { - _SDL_View = new SDL_BView(Bounds(), "SDL View", B_FOLLOW_ALL_SIDES); - UpdateCurrentView(); - } - Unlock(); - return _SDL_View; - } - - void RemoveView() { - Lock(); - if(_SDL_View != NULL) { - SDL_BView *oldView = _SDL_View; - _SDL_View = NULL; - UpdateCurrentView(); - delete oldView; - } - Unlock(); - } /* * * * * OpenGL functionality * * * * */ #if SDL_VIDEO_OPENGL - BGLView *CreateGLView(Uint32 gl_flags) { + virtual BGLView *CreateGLView(Uint32 gl_flags) { Lock(); if (_SDL_GLView == NULL) { _SDL_GLView = new BGLView(Bounds(), "SDL GLView", @@ -196,29 +139,92 @@ class SDL_BWin: public BWindow (B_WILL_DRAW | B_FRAME_EVENTS), gl_flags); _gl_type = gl_flags; - UpdateCurrentView(); } + AddChild(_SDL_GLView); + _SDL_GLView->EnableDirectMode(false); /* Disable direct mode */ + _SDL_GLView->LockGL(); /* "New" GLViews are created */ Unlock(); - return _SDL_GLView; + return (_SDL_GLView); } - void RemoveGLView() { + virtual void RemoveGLView() { Lock(); - if(_SDL_GLView != NULL) { - if (((SDL_BApp*)be_app)->GetCurrentContext() == _SDL_GLView) - ((SDL_BApp*)be_app)->SetCurrentContext(NULL); - _SDL_GLView = NULL; - UpdateCurrentView(); - // _SDL_GLView deleted by HAIKU_GL_DeleteContext + if(_SDL_GLView) { + _SDL_GLView->UnlockGL(); + RemoveChild(_SDL_GLView); } Unlock(); } - void SwapBuffers(void) { + virtual void SwapBuffers(void) { + _SDL_GLView->UnlockGL(); + _SDL_GLView->LockGL(); _SDL_GLView->SwapBuffers(); } #endif + /* * * * * Framebuffering* * * * */ + virtual void DirectConnected(direct_buffer_info *info) { + if(!_connected && _connection_disabled) { + return; + } + + /* Determine if the pixel buffer is usable after this update */ + _trash_window_buffer = _trash_window_buffer + || ((info->buffer_state & B_BUFFER_RESIZED) + || (info->buffer_state & B_BUFFER_RESET) + || (info->driver_state == B_MODE_CHANGED)); + LockBuffer(); + + switch(info->buffer_state & B_DIRECT_MODE_MASK) { + case B_DIRECT_START: + _connected = true; + + case B_DIRECT_MODIFY: + if (info->clip_list_count > _num_clips) + { + if(_clips) { + SDL_free(_clips); + _clips = NULL; + } + } + + _num_clips = info->clip_list_count; + if (_clips == NULL) + _clips = (clipping_rect *)SDL_malloc(_num_clips*sizeof(clipping_rect)); + if(_clips) { + SDL_memcpy(_clips, info->clip_list, + _num_clips*sizeof(clipping_rect)); + + _bits = (uint8*) info->bits; + _row_bytes = info->bytes_per_row; + _bounds = info->window_bounds; + _bytes_per_px = info->bits_per_pixel / 8; + _buffer_dirty = true; + } + break; + + case B_DIRECT_STOP: + _connected = false; + break; + } +#if SDL_VIDEO_OPENGL + if(_SDL_GLView) { + _SDL_GLView->DirectConnected(info); + } +#endif + + + /* Call the base object directconnected */ + BDirectWindow::DirectConnected(info); + + UnlockBuffer(); + + } + + + + /* * * * * Event sending * * * * */ /* Hook functions */ virtual void FrameMoved(BPoint origin) { @@ -229,10 +235,10 @@ class SDL_BWin: public BWindow _PostWindowEvent(msg); /* Perform normal hook operations */ - BWindow::FrameMoved(origin); + BDirectWindow::FrameMoved(origin); } - void FrameResized(float width, float height) { + virtual void FrameResized(float width, float height) { /* Post a message to the BApp so that it can handle the window event */ BMessage msg(BAPP_WINDOW_RESIZED); @@ -241,10 +247,10 @@ class SDL_BWin: public BWindow _PostWindowEvent(msg); /* Perform normal hook operations */ - BWindow::FrameResized(width, height); + BDirectWindow::FrameResized(width, height); } - bool QuitRequested() { + virtual bool QuitRequested() { BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED); _PostWindowEvent(msg); @@ -252,13 +258,13 @@ class SDL_BWin: public BWindow return false; } - void WindowActivated(bool active) { + virtual void WindowActivated(bool active) { BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */ msg.AddBool("focusGained", active); _PostWindowEvent(msg); } - void Zoom(BPoint origin, + virtual void Zoom(BPoint origin, float width, float height) { BMessage msg(BAPP_MAXIMIZE); /* Closest thing to maximization Haiku has */ @@ -269,13 +275,13 @@ class SDL_BWin: public BWindow _prev_frame = new BRect(Frame()); /* Perform normal hook operations */ - BWindow::Zoom(origin, width, height); + BDirectWindow::Zoom(origin, width, height); } /* Member functions */ - void Show() { + virtual void Show() { while(IsHidden()) { - BWindow::Show(); + BDirectWindow::Show(); } _shown = true; @@ -283,33 +289,25 @@ class SDL_BWin: public BWindow _PostWindowEvent(msg); } - void Hide() { - BWindow::Hide(); + virtual void Hide() { + BDirectWindow::Hide(); _shown = false; BMessage msg(BAPP_HIDE); _PostWindowEvent(msg); } - void Minimize(bool minimize) { - BWindow::Minimize(minimize); + virtual void Minimize(bool minimize) { + BDirectWindow::Minimize(minimize); int32 minState = (minimize ? BAPP_MINIMIZE : BAPP_RESTORE); BMessage msg(minState); _PostWindowEvent(msg); } - void ScreenChanged(BRect screenFrame, color_space depth) - { - if (_fullscreen) { - MoveTo(screenFrame.left, screenFrame.top); - ResizeTo(screenFrame.Width(), screenFrame.Height()); - } - } - /* BView message interruption */ - void DispatchMessage(BMessage * msg, BHandler * target) + virtual void DispatchMessage(BMessage * msg, BHandler * target) { BPoint where; /* Used by mouse moved */ int32 buttons; /* Used for mouse button events */ @@ -358,7 +356,7 @@ class SDL_BWin: public BWindow } } break; - + case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */ if (msg->FindInt32("key", &key) == B_OK) { _KeyEvent((SDL_Scancode)key, NULL, 0, SDL_PRESSED); @@ -378,15 +376,15 @@ class SDL_BWin: public BWindow - CTRL+Q to close window (and other shortcuts) - PrintScreen to make screenshot into /boot/home - etc.. */ - /* BWindow::DispatchMessage(msg, target); */ + /* BDirectWindow::DispatchMessage(msg, target); */ break; } - BWindow::DispatchMessage(msg, target); + BDirectWindow::DispatchMessage(msg, target); } /* Handle command messages */ - void MessageReceived(BMessage* message) { + virtual void MessageReceived(BMessage* message) { switch (message->what) { /* Handle commands from SDL */ case BWIN_SET_TITLE: @@ -398,18 +396,12 @@ class SDL_BWin: public BWindow case BWIN_RESIZE_WINDOW: _ResizeTo(message); break; - case BWIN_SET_BORDERED: { - bool bEnabled; - if (message->FindBool("window-border", &bEnabled) == B_OK) - _SetBordered(bEnabled); + case BWIN_SET_BORDERED: + _SetBordered(message); break; - } - case BWIN_SET_RESIZABLE: { - bool bEnabled; - if (message->FindBool("window-resizable", &bEnabled) == B_OK) - _SetResizable(bEnabled); + case BWIN_SET_RESIZABLE: + _SetResizable(message); break; - } case BWIN_SHOW_WINDOW: Show(); break; @@ -425,34 +417,12 @@ class SDL_BWin: public BWindow case BWIN_RESTORE_WINDOW: _Restore(); break; - case BWIN_FULLSCREEN: { - bool fullscreen; - if (message->FindBool("fullscreen", &fullscreen) == B_OK) - _SetFullScreen(fullscreen); + case BWIN_FULLSCREEN: + _SetFullScreen(message); break; - } - case BWIN_MINIMUM_SIZE_WINDOW: - _SetMinimumSize(message); - break; - case BWIN_UPDATE_FRAMEBUFFER: { - BMessage* pendingMessage; - while ((pendingMessage - = MessageQueue()->FindMessage(BWIN_UPDATE_FRAMEBUFFER, 0))) { - MessageQueue()->RemoveMessage(pendingMessage); - delete pendingMessage; - } - if (_bitmap != NULL) { - if (_SDL_View != NULL && _cur_view == _SDL_View) - _SDL_View->Draw(Bounds()); - else if (_SDL_GLView != NULL && _cur_view == _SDL_GLView) { - _SDL_GLView->CopyPixelsIn(_bitmap, B_ORIGIN); - } - } - break; - } default: /* Perform normal message handling */ - BWindow::MessageReceived(message); + BDirectWindow::MessageReceived(message); break; } @@ -463,9 +433,19 @@ class SDL_BWin: public BWindow /* Accessor methods */ bool IsShown() { return _shown; } int32 GetID() { return _id; } + uint32 GetRowBytes() { return _row_bytes; } + int32 GetFbX() { return _bounds.left; } + int32 GetFbY() { return _bounds.top; } + bool ConnectionEnabled() { return !_connection_disabled; } + bool Connected() { return _connected; } + clipping_rect *GetClips() { return _clips; } + int32 GetNumClips() { return _num_clips; } + uint8* GetBufferPx() { return _bits; } + int32 GetBytesPerPx() { return _bytes_per_px; } + bool CanTrashWindowBuffer() { return _trash_window_buffer; } + bool BufferExists() { return _buffer_created; } + bool BufferIsDirty() { return _buffer_dirty; } BBitmap *GetBitmap() { return _bitmap; } - BView *GetCurView() { return _cur_view; } - SDL_BView *GetView() { return _SDL_View; } #if SDL_VIDEO_OPENGL BGLView *GetGLView() { return _SDL_GLView; } Uint32 GetGLType() { return _gl_type; } @@ -473,9 +453,12 @@ class SDL_BWin: public BWindow /* Setter methods */ void SetID(int32 id) { _id = id; } + void SetBufferExists(bool bufferExists) { _buffer_created = bufferExists; } void LockBuffer() { _buffer_locker->Lock(); } void UnlockBuffer() { _buffer_locker->Unlock(); } - void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; if (_SDL_View != NULL) _SDL_View->SetBitmap(bitmap); } + void SetBufferDirty(bool bufferDirty) { _buffer_dirty = bufferDirty; } + void SetTrashBuffer(bool trash) { _trash_window_buffer = trash; } + void SetBitmap(BBitmap *bitmap) { _bitmap = bitmap; } private: @@ -581,10 +564,7 @@ private: ) { return; } - if (_fullscreen) - _non_fullscreen_frame.OffsetTo(x, y); - else - MoveTo(x, y); + MoveTo(x, y); } void _ResizeTo(BMessage *msg) { @@ -595,48 +575,27 @@ private: ) { return; } - if (_fullscreen) { - _non_fullscreen_frame.right = _non_fullscreen_frame.left + w; - _non_fullscreen_frame.bottom = _non_fullscreen_frame.top + h; - } else - ResizeTo(w, h); + ResizeTo(w, h); } - void _SetBordered(bool bEnabled) { - if (_fullscreen) - _bordered = bEnabled; - else - SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); - } - - void _SetResizable(bool bEnabled) { - if (_fullscreen) - _resizable = bEnabled; - else { - if (bEnabled) { - SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); - } else { - SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); - } + void _SetBordered(BMessage *msg) { + bool bEnabled; + if(msg->FindBool("window-border", &bEnabled) != B_OK) { + return; } + SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); } - void _SetMinimumSize(BMessage *msg) { - float maxHeight; - float maxWidth; - float _; - int32 minHeight; - int32 minWidth; - - // This is a bit convoluted, we only want to set the minimum not the maximum - // But there is no direct call to do that, so store the maximum size beforehand - GetSizeLimits(&_, &maxWidth, &_, &maxHeight); - if (msg->FindInt32("window-w", &minWidth) != B_OK) + void _SetResizable(BMessage *msg) { + bool bEnabled; + if(msg->FindBool("window-resizable", &bEnabled) != B_OK) { return; - if (msg->FindInt32("window-h", &minHeight) != B_OK) - return; - SetSizeLimits((float)minWidth, maxWidth, (float)minHeight, maxHeight); - UpdateSizeLimits(); + } + if (bEnabled) { + SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); + } else { + SetFlags(Flags() | (B_NOT_RESIZABLE | B_NOT_ZOOMABLE)); + } } void _Restore() { @@ -644,42 +603,23 @@ private: Minimize(false); } else if(IsHidden()) { Show(); - } else if (_fullscreen) { - } else if(_prev_frame != NULL) { /* Zoomed */ MoveTo(_prev_frame->left, _prev_frame->top); ResizeTo(_prev_frame->Width(), _prev_frame->Height()); } } - void _SetFullScreen(bool fullscreen) { - if (fullscreen != _fullscreen) { - if (fullscreen) { - BScreen screen(this); - BRect screenFrame = screen.Frame(); - printf("screen frame: "); screenFrame.PrintToStream(); printf("\n"); - _bordered = Look() != B_NO_BORDER_WINDOW_LOOK; - _resizable = !(Flags() & B_NOT_RESIZABLE); - _non_fullscreen_frame = Frame(); - _SetBordered(false); - _SetResizable(false); - MoveTo(screenFrame.left, screenFrame.top); - ResizeTo(screenFrame.Width(), screenFrame.Height()); - _fullscreen = fullscreen; - } else { - _fullscreen = fullscreen; - MoveTo(_non_fullscreen_frame.left, _non_fullscreen_frame.top); - ResizeTo(_non_fullscreen_frame.Width(), _non_fullscreen_frame.Height()); - _SetBordered(_bordered); - _SetResizable(_resizable); - } + void _SetFullScreen(BMessage *msg) { + bool fullscreen; + if( + msg->FindBool("fullscreen", &fullscreen) != B_OK + ) { + return; } + SetFullScreen(fullscreen); } /* Members */ - - BView* _cur_view; - SDL_BView* _SDL_View; #if SDL_VIDEO_OPENGL BGLView * _SDL_GLView; Uint32 _gl_type; @@ -692,15 +632,23 @@ private: bool _inhibit_resize; BRect *_prev_frame; /* Previous position and size of the window */ - bool _fullscreen; - // valid only if fullscreen - BRect _non_fullscreen_frame; - bool _bordered; - bool _resizable; /* Framebuffer members */ - BLocker *_buffer_locker; - BBitmap *_bitmap; + bool _connected, + _connection_disabled, + _buffer_created, + _buffer_dirty, + _trash_window_buffer; + uint8 *_bits; + uint32 _row_bytes; + clipping_rect _bounds; + BLocker *_buffer_locker; + clipping_rect *_clips; + uint32 _num_clips; + int32 _bytes_per_px; + thread_id _draw_thread_id; + + BBitmap *_bitmap; }; diff --git a/externals/SDL/src/video/haiku/SDL_bframebuffer.cc b/externals/SDL/src/video/haiku/SDL_bframebuffer.cc index 971231924..c1017eb46 100755 --- a/externals/SDL/src/video/haiku/SDL_bframebuffer.cc +++ b/externals/SDL/src/video/haiku/SDL_bframebuffer.cc @@ -35,6 +35,10 @@ extern "C" { #endif +#ifndef DRAWTHREAD +static int32 HAIKU_UpdateOnce(SDL_Window *window); +#endif + static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { return ((SDL_BWin*)(window->driverdata)); } @@ -52,11 +56,11 @@ int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window, return -1; } + while(!bwin->Connected()) { snooze(100); } + /* Make sure we have exclusive access to frame buffer data */ bwin->LockBuffer(); - bwin->CreateView(); - /* format */ display_mode bmode; bscreen.GetMode(&bmode); @@ -72,7 +76,7 @@ int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window, bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space, false, /* Views not accepted */ true); /* Contiguous memory required */ - + if(bitmap->InitCheck() != B_OK) { delete bitmap; return SDL_SetError("Could not initialize back buffer!"); @@ -80,13 +84,15 @@ int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window, bwin->SetBitmap(bitmap); - + /* Set the pixel pointer */ *pixels = bitmap->Bits(); /* pitch = width of window, in bytes */ *pitch = bitmap->BytesPerRow(); + bwin->SetBufferExists(true); + bwin->SetTrashBuffer(false); bwin->UnlockBuffer(); return 0; } @@ -100,26 +106,150 @@ int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_BWin *bwin = _ToBeWin(window); - bwin->PostMessage(BWIN_UPDATE_FRAMEBUFFER); +#ifdef DRAWTHREAD + bwin->LockBuffer(); + bwin->SetBufferDirty(true); + bwin->UnlockBuffer(); +#else + bwin->SetBufferDirty(true); + HAIKU_UpdateOnce(window); +#endif return 0; } +int32 HAIKU_DrawThread(void *data) { + SDL_BWin *bwin = (SDL_BWin*)data; + + BScreen bscreen; + if(!bscreen.IsValid()) { + return -1; + } + + while(bwin->ConnectionEnabled()) { + if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) { + bwin->LockBuffer(); + BBitmap *bitmap = NULL; + bitmap = bwin->GetBitmap(); + int32 windowPitch = bitmap->BytesPerRow(); + int32 bufferPitch = bwin->GetRowBytes(); + uint8 *windowpx; + uint8 *bufferpx; + + int32 BPP = bwin->GetBytesPerPx(); + int32 windowSub = bwin->GetFbX() * BPP + + bwin->GetFbY() * windowPitch; + clipping_rect *clips = bwin->GetClips(); + int32 numClips = bwin->GetNumClips(); + int i, y; + + /* Blit each clipping rectangle */ + bscreen.WaitForRetrace(); + for(i = 0; i < numClips; ++i) { + /* Get addresses of the start of each clipping rectangle */ + int32 width = clips[i].right - clips[i].left + 1; + int32 height = clips[i].bottom - clips[i].top + 1; + bufferpx = bwin->GetBufferPx() + + clips[i].top * bufferPitch + clips[i].left * BPP; + windowpx = (uint8*)bitmap->Bits() + + clips[i].top * windowPitch + clips[i].left * BPP - + windowSub; + + /* Copy each row of pixels from the window buffer into the frame + buffer */ + for(y = 0; y < height; ++y) + { + + if(bwin->CanTrashWindowBuffer()) { + goto escape; /* Break out before the buffer is killed */ + } + + memcpy(bufferpx, windowpx, width * BPP); + bufferpx += bufferPitch; + windowpx += windowPitch; + } + } + + bwin->SetBufferDirty(false); +escape: + bwin->UnlockBuffer(); + } else { + snooze(16000); + } + } + + return B_OK; +} + void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) { SDL_BWin *bwin = _ToBeWin(window); - + bwin->LockBuffer(); - + /* Free and clear the window buffer */ BBitmap *bitmap = bwin->GetBitmap(); delete bitmap; bwin->SetBitmap(NULL); - - bwin->RemoveView(); - + bwin->SetBufferExists(false); bwin->UnlockBuffer(); } + +/* + * TODO: + * This was written to test if certain errors were caused by threading issues. + * The specific issues have since become rare enough that they may have been + * solved, but I doubt it- they were pretty sporadic before now. + */ +#ifndef DRAWTHREAD +static int32 HAIKU_UpdateOnce(SDL_Window *window) { + SDL_BWin *bwin = _ToBeWin(window); + BScreen bscreen; + if(!bscreen.IsValid()) { + return -1; + } + + if(bwin->ConnectionEnabled() && bwin->Connected()) { + bwin->LockBuffer(); + int32 windowPitch = window->surface->pitch; + int32 bufferPitch = bwin->GetRowBytes(); + uint8 *windowpx; + uint8 *bufferpx; + + int32 BPP = bwin->GetBytesPerPx(); + uint8 *windowBaseAddress = (uint8*)window->surface->pixels; + int32 windowSub = bwin->GetFbX() * BPP + + bwin->GetFbY() * windowPitch; + clipping_rect *clips = bwin->GetClips(); + int32 numClips = bwin->GetNumClips(); + int i, y; + + /* Blit each clipping rectangle */ + bscreen.WaitForRetrace(); + for(i = 0; i < numClips; ++i) { + /* Get addresses of the start of each clipping rectangle */ + int32 width = clips[i].right - clips[i].left + 1; + int32 height = clips[i].bottom - clips[i].top + 1; + bufferpx = bwin->GetBufferPx() + + clips[i].top * bufferPitch + clips[i].left * BPP; + windowpx = windowBaseAddress + + clips[i].top * windowPitch + clips[i].left * BPP - windowSub; + + /* Copy each row of pixels from the window buffer into the frame + buffer */ + for(y = 0; y < height; ++y) + { + memcpy(bufferpx, windowpx, width * BPP); + bufferpx += bufferPitch; + windowpx += windowPitch; + } + } + bwin->UnlockBuffer(); + } + return 0; +} +#endif + #ifdef __cplusplus } #endif diff --git a/externals/SDL/src/video/haiku/SDL_bopengl.cc b/externals/SDL/src/video/haiku/SDL_bopengl.cc index 0c7a704d8..e221177f4 100755 --- a/externals/SDL/src/video/haiku/SDL_bopengl.cc +++ b/externals/SDL/src/video/haiku/SDL_bopengl.cc @@ -84,21 +84,16 @@ void *HAIKU_GL_GetProcAddress(_THIS, const char *proc) } + + int HAIKU_GL_SwapWindow(_THIS, SDL_Window * window) { _ToBeWin(window)->SwapBuffers(); return 0; } int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - BGLView* glView = (BGLView*)context; - // printf("HAIKU_GL_MakeCurrent(%llx), win = %llx, thread = %d\n", (uint64)context, (uint64)window, find_thread(NULL)); - if (glView != NULL) { - if ((glView->Window() == NULL) || (window == NULL) || (_ToBeWin(window)->GetGLView() != glView)) { - SDL_SetError("MakeCurrent failed"); - return -1; - } - } - _GetBeApp()->SetCurrentContext(glView); + SDL_BWin* win = (SDL_BWin*)context; + _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL); return 0; } @@ -107,11 +102,6 @@ SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window) { /* FIXME: Not sure what flags should be included here; may want to have most of them */ SDL_BWin *bwin = _ToBeWin(window); - // printf("HAIKU_GL_CreateContext, win = %llx, thread = %d\n", (uint64)window, find_thread(NULL)); - if (bwin->GetGLView() != NULL) { - SDL_SetError("Context already creaded"); - return NULL; - } Uint32 gl_flags = BGL_RGB; if (_this->gl_config.alpha_size) { gl_flags |= BGL_ALPHA; @@ -133,25 +123,13 @@ SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window) { _this->gl_config.accum_alpha_size) { gl_flags |= BGL_ACCUM; } -#if __GNUC__ > 3 - if (_this->gl_config.share_with_current_context) { - gl_flags |= BGL_SHARE_CONTEXT; - } -#endif bwin->CreateGLView(gl_flags); - _GetBeApp()->SetCurrentContext(bwin->GetGLView()); - return (SDL_GLContext)(bwin->GetGLView()); + return (SDL_GLContext)(bwin); } void HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) { - // printf("HAIKU_GL_DeleteContext(%llx), thread = %d\n", (uint64)context, find_thread(NULL)); - BGLView* glView = (BGLView*)context; - SDL_BWin *bwin = (SDL_BWin*)glView->Window(); - if (bwin == NULL) { - delete glView; - } else { - bwin->RemoveGLView(); - } + /* Currently, automatically unlocks the view */ + ((SDL_BWin*)context)->RemoveGLView(); } diff --git a/externals/SDL/src/video/haiku/SDL_bvideo.cc b/externals/SDL/src/video/haiku/SDL_bvideo.cc index 1ac3201f2..77259f908 100755 --- a/externals/SDL/src/video/haiku/SDL_bvideo.cc +++ b/externals/SDL/src/video/haiku/SDL_bvideo.cc @@ -94,7 +94,6 @@ HAIKU_CreateDevice(int devindex) device->SetWindowGammaRamp = HAIKU_SetWindowGammaRamp; device->GetWindowGammaRamp = HAIKU_GetWindowGammaRamp; device->SetWindowMouseGrab = HAIKU_SetWindowMouseGrab; - device->SetWindowMinimumSize = HAIKU_SetWindowMinimumSize; device->DestroyWindow = HAIKU_DestroyWindow; device->GetWindowWMInfo = HAIKU_GetWindowWMInfo; device->CreateWindowFramebuffer = HAIKU_CreateWindowFramebuffer; @@ -191,31 +190,6 @@ HAIKU_FreeCursor(SDL_Cursor * cursor) SDL_free(cursor); } -static SDL_Cursor * -HAIKU_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) -{ - SDL_Cursor *cursor; - SDL_Surface *converted; - - converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0); - if (!converted) { - return NULL; - } - - BBitmap *cursorBitmap = new BBitmap(BRect(0, 0, surface->w - 1, surface->h - 1), B_RGBA32); - cursorBitmap->SetBits(converted->pixels, converted->h * converted->pitch, 0, B_RGBA32); - SDL_FreeSurface(converted); - - cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - cursor->driverdata = (void *)new BCursor(cursorBitmap, BPoint(hot_x, hot_y)); - } else { - return NULL; - } - - return cursor; -} - static int HAIKU_ShowCursor(SDL_Cursor *cursor) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -248,7 +222,7 @@ HAIKU_SetRelativeMouseMode(SDL_bool enabled) bewin->Lock(); if (enabled) - _SDL_GLView->SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); + _SDL_GLView->SetEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, B_NO_POINTER_HISTORY); else _SDL_GLView->SetEventMask(0, 0); bewin->Unlock(); @@ -261,7 +235,6 @@ static void HAIKU_MouseInit(_THIS) SDL_Mouse *mouse = SDL_GetMouse(); if (!mouse) return; - mouse->CreateCursor = HAIKU_CreateCursor; mouse->CreateSystemCursor = HAIKU_CreateSystemCursor; mouse->ShowCursor = HAIKU_ShowCursor; mouse->FreeCursor = HAIKU_FreeCursor; diff --git a/externals/SDL/src/video/haiku/SDL_bwindow.cc b/externals/SDL/src/video/haiku/SDL_bwindow.cc index 24625337d..57aba1741 100755 --- a/externals/SDL/src/video/haiku/SDL_bwindow.cc +++ b/externals/SDL/src/video/haiku/SDL_bwindow.cc @@ -205,13 +205,6 @@ int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) { } -void HAIKU_SetWindowMinimumSize(_THIS, SDL_Window * window){ - BMessage msg(BWIN_MINIMUM_SIZE_WINDOW); - msg.AddInt32("window-w", window->w -1); - msg.AddInt32("window-h", window->h -1); - _ToBeWin(window)->PostMessage(&msg); -} - void HAIKU_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { /* TODO: Implement this! */ } @@ -226,12 +219,13 @@ void HAIKU_DestroyWindow(_THIS, SDL_Window * window) { SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { /* FIXME: What is the point of this? What information should be included? */ - if (info->version.major == SDL_MAJOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION && + info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_HAIKU; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } diff --git a/externals/SDL/src/video/haiku/SDL_bwindow.h b/externals/SDL/src/video/haiku/SDL_bwindow.h index 58a85d872..1d6a3c591 100755 --- a/externals/SDL/src/video/haiku/SDL_bwindow.h +++ b/externals/SDL/src/video/haiku/SDL_bwindow.h @@ -32,7 +32,6 @@ extern void HAIKU_SetWindowTitle(_THIS, SDL_Window * window); extern void HAIKU_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void HAIKU_SetWindowPosition(_THIS, SDL_Window * window); extern void HAIKU_SetWindowSize(_THIS, SDL_Window * window); -extern void HAIKU_SetWindowMinimumSize(_THIS, SDL_Window * window); extern void HAIKU_ShowWindow(_THIS, SDL_Window * window); extern void HAIKU_HideWindow(_THIS, SDL_Window * window); extern void HAIKU_RaiseWindow(_THIS, SDL_Window * window); diff --git a/externals/SDL/src/video/kmsdrm/SDL_kmsdrmsym.h b/externals/SDL/src/video/kmsdrm/SDL_kmsdrmsym.h index f53c5c8ea..52c78de5e 100755 --- a/externals/SDL/src/video/kmsdrm/SDL_kmsdrmsym.h +++ b/externals/SDL/src/video/kmsdrm/SDL_kmsdrmsym.h @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ #ifndef SDL_KMSDRM_MODULE #define SDL_KMSDRM_MODULE(modname) @@ -125,6 +125,6 @@ SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct #undef SDL_KMSDRM_SYM #undef SDL_KMSDRM_SYM_CONST -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/externals/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c index d404fd802..b9ab13c58 100755 --- a/externals/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c +++ b/externals/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c @@ -476,9 +476,9 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS, } } - /* If we couldn't find an appropriate plane, error out. */ + /* If we couldn't find an appropiate plane, error out. */ if (plane == UINT32_MAX) { - SDL_SetError("Vulkan couldn't find an appropriate plane."); + SDL_SetError("Vulkan couldn't find an appropiate plane."); goto clean; } diff --git a/externals/SDL/src/video/nacl/SDL_naclwindow.c b/externals/SDL/src/video/nacl/SDL_naclwindow.c index f0245aef2..255ac084b 100755 --- a/externals/SDL/src/video/nacl/SDL_naclwindow.c +++ b/externals/SDL/src/video/nacl/SDL_naclwindow.c @@ -35,7 +35,8 @@ NACL_CreateWindow(_THIS, SDL_Window * window) SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; if (driverdata->window) { - return SDL_SetError("NaCl only supports one window"); + SDL_SetError("NaCl only supports one window"); + return -1; } driverdata->window = window; diff --git a/externals/SDL/src/video/offscreen/SDL_offscreenframebuffer.c b/externals/SDL/src/video/offscreen/SDL_offscreenframebuffer.c index 3ca57e897..9b774896b 100755 --- a/externals/SDL/src/video/offscreen/SDL_offscreenframebuffer.c +++ b/externals/SDL/src/video/offscreen/SDL_offscreenframebuffer.c @@ -34,13 +34,17 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * f SDL_Surface *surface; const Uint32 surface_format = SDL_PIXELFORMAT_RGB888; int w, h; + int bpp; + Uint32 Rmask, Gmask, Bmask, Amask; /* Free the old framebuffer surface */ - SDL_OFFSCREEN_DestroyWindowFramebuffer(_this, window); + surface = (SDL_Surface *) SDL_GetWindowData(window, OFFSCREEN_SURFACE); + SDL_FreeSurface(surface); /* Create a new one */ + SDL_PixelFormatEnumToMasks(surface_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); SDL_GetWindowSize(window, &w, &h); - surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format); + surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask); if (!surface) { return -1; } diff --git a/externals/SDL/src/video/os2/SDL_os2dive.c b/externals/SDL/src/video/os2/SDL_os2dive.c index 95aae6f05..52f1483b8 100755 --- a/externals/SDL/src/video/os2/SDL_os2dive.c +++ b/externals/SDL/src/video/os2/SDL_os2dive.c @@ -67,12 +67,10 @@ OS2VIDEOOUTPUT voDive = { static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo) { - DIVE_CAPS sDiveCaps; - FOURCC fccFormats[100]; + DIVE_CAPS sDiveCaps = { 0 }; + FOURCC fccFormats[100] = { 0 }; /* Query information about display hardware from DIVE. */ - SDL_zeroa(fccFormats); - SDL_zero(sDiveCaps); sDiveCaps.pFormatData = fccFormats; sDiveCaps.ulFormatLength = 100; sDiveCaps.ulStructLen = sizeof(DIVE_CAPS); @@ -174,7 +172,7 @@ static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, /* Setup DIVE blitter. */ SETUP_BLITTER sSetupBlitter; SWP swp; - POINTL pointl = { 0,0 }; + POINTL pointl = { 0 }; WinQueryWindowPos(hwnd, &swp); WinMapWindowPoints(hwnd, HWND_DESKTOP, &pointl, 1); diff --git a/externals/SDL/src/video/os2/SDL_os2messagebox.c b/externals/SDL/src/video/os2/SDL_os2messagebox.c index c904fa5cb..94bc5e30f 100755 --- a/externals/SDL/src/video/os2/SDL_os2messagebox.c +++ b/externals/SDL/src/video/os2/SDL_os2messagebox.c @@ -35,8 +35,8 @@ #define IDD_PB_FIRST 1003 typedef struct _MSGBOXDLGDATA { - USHORT cb; - HWND hwndUnder; + USHORT cb; + HWND hwndUnder; } MSGBOXDLGDATA; static VOID _wmInitDlg(HWND hwnd, MSGBOXDLGDATA *pDlgData) @@ -205,9 +205,9 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons; ULONG cSDLBtnData = messageboxdata->numbuttons; - PSZ pszTitle = OS2_UTF8ToSys(messageboxdata->title); + PSZ pszTitle = OS2_UTF8ToSys((PSZ) messageboxdata->title); ULONG cbTitle = (pszTitle == NULL)? 1 : (SDL_strlen(pszTitle) + 1); - PSZ pszText = OS2_UTF8ToSys(messageboxdata->message); + PSZ pszText = OS2_UTF8ToSys((PSZ) messageboxdata->message); ULONG cbText = (pszText == NULL)? 1 : (SDL_strlen(pszText) + 1); PDLGTEMPLATE pTemplate; @@ -406,7 +406,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) pDlgItem->cchClassName = 0; /* 0 - offClassname is WC_ constant. */ pDlgItem->offClassName = (USHORT)WC_BUTTON; - pszBtnText = OS2_UTF8ToSys(pSDLBtnData[ulIdx].text); + pszBtnText = OS2_UTF8ToSys((PSZ)pSDLBtnData[ulIdx].text); cbBtnText = (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1); pDlgItem->cchText = cbBtnText; pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */ diff --git a/externals/SDL/src/video/os2/SDL_os2util.c b/externals/SDL/src/video/os2/SDL_os2util.c index bcc6c54e8..adc2fd5e0 100755 --- a/externals/SDL/src/video/os2/SDL_os2util.c +++ b/externals/SDL/src/video/os2/SDL_os2util.c @@ -27,8 +27,8 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) { HBITMAP hbm; - BITMAPINFOHEADER2 bmih; - BITMAPINFO bmi; + BITMAPINFOHEADER2 bmih = { 0 }; + BITMAPINFO bmi = { 0 }; HPS hps; PULONG pulBitmap; PULONG pulDst, pulSrc, pulDstMask; @@ -40,7 +40,7 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) return NULLHANDLE; } - pulBitmap = (PULONG) SDL_malloc(surface->h * surface->w * 2 * sizeof(ULONG)); + pulBitmap = SDL_malloc(surface->h * surface->w * 4 * 2); if (pulBitmap == NULL) { SDL_OutOfMemory(); return NULLHANDLE; @@ -72,9 +72,6 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) } /* Create system bitmap object. */ - SDL_zero(bmih); - SDL_zero(bmi); - bmih.cbFix = sizeof(BITMAPINFOHEADER2); bmih.cx = surface->w; bmih.cy = 2 * surface->h; diff --git a/externals/SDL/src/video/os2/SDL_os2video.c b/externals/SDL/src/video/os2/SDL_os2video.c index 65428da65..d624575cf 100755 --- a/externals/SDL/src/video/os2/SDL_os2video.c +++ b/externals/SDL/src/video/os2/SDL_os2video.c @@ -335,7 +335,7 @@ static VOID _wmChar(WINDATA *pWinData, MPARAM mp1, MPARAM mp2) static VOID _wmMove(WINDATA *pWinData) { SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(pWinData->window); - POINTL pointl = { 0,0 }; + POINTL pointl = { 0 }; RECTL rectl; WinQueryWindowRect(pWinData->hwnd, &rectl); @@ -1137,8 +1137,8 @@ static SDL_bool OS2_GetWindowWMInfo(_THIS, SDL_Window * window, return SDL_TRUE; } - SDL_SetError("Application not compiled with SDL %u", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %u.%u", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -1219,7 +1219,7 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, { SDL_ShapeTree *pShapeTree; WINDATA *pWinData; - SHAPERECTS stShapeRects; + SHAPERECTS stShapeRects = { 0 }; HPS hps; debug_os2("Enter"); @@ -1235,7 +1235,6 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, pShapeTree = SDL_CalculateShapeTree(*shape_mode, shape); shaper->driverdata = pShapeTree; - SDL_zero(stShapeRects); stShapeRects.ulWinHeight = shaper->window->h; SDL_TraverseShapeTree(pShapeTree, &_combineRectRegions, &stShapeRects); @@ -1402,19 +1401,18 @@ static char *OS2_GetClipboardText(_THIS) static SDL_bool OS2_HasClipboardText(_THIS) { SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; - PSZ pszClipboard; - SDL_bool result; + SDL_bool fClipboard; if (!WinOpenClipbrd(pVData->hab)) { debug_os2("WinOpenClipbrd() failed"); return SDL_FALSE; } - pszClipboard = (PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT); - result = (pszClipboard && *pszClipboard) ? SDL_TRUE : SDL_FALSE; + fClipboard = ((PSZ)WinQueryClipbrdData(pVData->hab, CF_TEXT) != NULL)? + SDL_TRUE : SDL_FALSE; WinCloseClipbrd(pVData->hab); - return result; + return fClipboard; } diff --git a/externals/SDL/src/video/os2/SDL_os2vman.c b/externals/SDL/src/video/os2/SDL_os2vman.c index acb920061..3fb93f13e 100755 --- a/externals/SDL/src/video/os2/SDL_os2vman.c +++ b/externals/SDL/src/video/os2/SDL_os2vman.c @@ -91,10 +91,10 @@ static VOID APIENTRY ExitVMan(VOID) static BOOL _vmanInit(void) { ULONG ulRC; - CHAR acBuf[256]; + CHAR acBuf[255]; INITPROCOUT stInitProcOut; - if (hmodVMan != NULLHANDLE) /* already initialized */ + if (hmodVMan != NULLHANDLE) /* Already was initialized */ return TRUE; /* Load vman.dll */ @@ -108,7 +108,8 @@ static BOOL _vmanInit(void) /* Get VMIEntry */ ulRC = DosQueryProcAddr(hmodVMan, 0L, "VMIEntry", (PFN *)&pfnVMIEntry); if (ulRC != NO_ERROR) { - debug_os2("Could not query address of VMIEntry from VMAN.DLL (Err: %lu)", ulRC); + debug_os2("Could not query address of pfnVMIEntry func. of VMAN.DLL, " + "rc = %u", ulRC); DosFreeModule(hmodVMan); hmodVMan = NULLHANDLE; return FALSE; @@ -326,8 +327,9 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, PPOINTL pptlSrcOrg; PBLTRECT pbrDst; HWREQIN sHWReqIn; - BITBLTINFO sBitbltInfo; + BITBLTINFO sBitbltInfo = { 0 }; ULONG ulIdx; +/* RECTL rectlScreenUpdate;*/ if (pVOData->pBuffer == NULL) return FALSE; @@ -452,7 +454,6 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, rclSrcBounds.xRight = bmiSrc.ulWidth; rclSrcBounds.yTop = bmiSrc.ulHeight; - SDL_zero(sBitbltInfo); sBitbltInfo.ulLength = sizeof(BITBLTINFO); sBitbltInfo.ulBltFlags = BF_DEFAULT_STATE | BF_ROP_INCL_SRC | BF_PAT_HOLLOW; sBitbltInfo.cBlits = cSDLRects; diff --git a/externals/SDL/src/video/pandora/SDL_pandora.c b/externals/SDL/src/video/pandora/SDL_pandora.c index 834083838..16349f875 100755 --- a/externals/SDL/src/video/pandora/SDL_pandora.c +++ b/externals/SDL/src/video/pandora/SDL_pandora.c @@ -302,8 +302,8 @@ PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/externals/SDL/src/video/psp/SDL_pspvideo.c b/externals/SDL/src/video/psp/SDL_pspvideo.c index de31a2012..a5c86ecc3 100755 --- a/externals/SDL/src/video/psp/SDL_pspvideo.c +++ b/externals/SDL/src/video/psp/SDL_pspvideo.c @@ -287,8 +287,8 @@ PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/externals/SDL/src/video/raspberry/SDL_rpivideo.c b/externals/SDL/src/video/raspberry/SDL_rpivideo.c index 4503f56df..1a0a4ce19 100755 --- a/externals/SDL/src/video/raspberry/SDL_rpivideo.c +++ b/externals/SDL/src/video/raspberry/SDL_rpivideo.c @@ -431,8 +431,8 @@ RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/externals/SDL/src/video/riscos/SDL_riscosevents.c b/externals/SDL/src/video/riscos/SDL_riscosevents.c index 56fe39882..b7ae62e9e 100755 --- a/externals/SDL/src/video/riscos/SDL_riscosevents.c +++ b/externals/SDL/src/video/riscos/SDL_riscosevents.c @@ -67,6 +67,7 @@ RISCOS_PollKeyboard(_THIS) /* Check for key presses */ while (key < 0xff) { + SDL_bool already_pressed = SDL_FALSE; key = _kernel_osbyte(121, key + 1, 0) & 0xff; switch (key) { case 255: @@ -82,16 +83,22 @@ RISCOS_PollKeyboard(_THIS) break; default: - SDL_SendKeyboardKey(SDL_PRESSED, SDL_RISCOS_translate_keycode(key)); - - /* Record the press so we can detect release later. */ + /* Do we already know of this key? */ for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) { if (driverdata->key_pressed[i] == key) { + already_pressed = SDL_TRUE; break; } - if (driverdata->key_pressed[i] == 255) { - driverdata->key_pressed[i] = key; - break; + } + + if (!already_pressed) { + SDL_SendKeyboardKey(SDL_PRESSED, SDL_RISCOS_translate_keycode(key)); + /* Record the press so we can detect release later. */ + for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) { + if (driverdata->key_pressed[i] == 255) { + driverdata->key_pressed[i] = key; + break; + } } } } @@ -143,7 +150,6 @@ int RISCOS_InitEvents(_THIS) { SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; - _kernel_swi_regs regs; int i, status; for (i = 0; i < RISCOS_MAX_KEYS_PRESSED; i++) @@ -154,9 +160,6 @@ RISCOS_InitEvents(_THIS) SDL_ToggleModState(KMOD_CAPS, (status & (1 << 4)) == 0); SDL_ToggleModState(KMOD_SCROLL, (status & (1 << 1)) != 0); - _kernel_swi(OS_Mouse, ®s, ®s); - driverdata->last_mouse_buttons = regs.r[2]; - /* Disable escape. */ _kernel_osbyte(229, 1, 0); diff --git a/externals/SDL/src/video/riscos/SDL_riscosmodes.c b/externals/SDL/src/video/riscos/SDL_riscosmodes.c index 9500b2229..0e87c140e 100755 --- a/externals/SDL/src/video/riscos/SDL_riscosmodes.c +++ b/externals/SDL/src/video/riscos/SDL_riscosmodes.c @@ -23,7 +23,6 @@ #if SDL_VIDEO_DRIVER_RISCOS #include "../SDL_sysvideo.h" -#include "../../events/SDL_mouse_c.h" #include "SDL_riscosvideo.h" #include "SDL_riscosmodes.h" @@ -305,8 +304,8 @@ RISCOS_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) _kernel_oswrch(disable_cursor[i]); } - /* Update cursor visibility, since it may have been disabled by the mode change. */ - SDL_SetCursor(NULL); + /* Turn the mouse pointer on */ + /* _kernel_osbyte(106, 1, 0); */ return 0; } diff --git a/externals/SDL/src/video/riscos/SDL_riscosvideo.c b/externals/SDL/src/video/riscos/SDL_riscosvideo.c index ebd4952a5..1d8bd3d95 100755 --- a/externals/SDL/src/video/riscos/SDL_riscosvideo.c +++ b/externals/SDL/src/video/riscos/SDL_riscosvideo.c @@ -31,7 +31,6 @@ #include "SDL_riscosvideo.h" #include "SDL_riscosevents_c.h" #include "SDL_riscosframebuffer_c.h" -#include "SDL_riscosmouse.h" #include "SDL_riscosmodes.h" #include "SDL_riscoswindow.h" @@ -106,10 +105,6 @@ RISCOS_VideoInit(_THIS) return -1; } - if (RISCOS_InitMouse(_this) < 0) { - return -1; - } - if (RISCOS_InitModes(_this) < 0) { return -1; } diff --git a/externals/SDL/src/video/riscos/SDL_riscoswindow.c b/externals/SDL/src/video/riscos/SDL_riscoswindow.c index f47d33ad7..84e4de03e 100755 --- a/externals/SDL/src/video/riscos/SDL_riscoswindow.c +++ b/externals/SDL/src/video/riscos/SDL_riscoswindow.c @@ -25,8 +25,6 @@ #include "SDL_version.h" #include "SDL_syswm.h" #include "../SDL_sysvideo.h" -#include "../../events/SDL_mouse_c.h" - #include "SDL_riscosvideo.h" #include "SDL_riscoswindow.h" @@ -44,8 +42,6 @@ RISCOS_CreateWindow(_THIS, SDL_Window * window) window->flags |= SDL_WINDOW_FULLSCREEN; - SDL_SetMouseFocus(window); - /* All done! */ window->driverdata = driverdata; return 0; @@ -66,12 +62,13 @@ RISCOS_DestroyWindow(_THIS, SDL_Window * window) SDL_bool RISCOS_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { - if (info->version.major == SDL_MAJOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION && + info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_RISCOS; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } diff --git a/externals/SDL/src/video/riscos/scancodes_riscos.h b/externals/SDL/src/video/riscos/scancodes_riscos.h index dbba9d1a1..ced6b0d1b 100755 --- a/externals/SDL/src/video/riscos/scancodes_riscos.h +++ b/externals/SDL/src/video/riscos/scancodes_riscos.h @@ -24,7 +24,7 @@ Sources: - https://www.riscosopen.org/wiki/documentation/show/Keyboard Scan Codes */ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ static SDL_Scancode const riscos_scancode_table[] = { /* 0 */ SDL_SCANCODE_UNKNOWN, /* Shift */ /* 1 */ SDL_SCANCODE_UNKNOWN, /* Ctrl */ @@ -155,4 +155,4 @@ static SDL_Scancode const riscos_scancode_table[] = { /* 126 */ SDL_SCANCODE_RGUI, /* 127 */ SDL_SCANCODE_MENU }; -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ diff --git a/externals/SDL/src/video/sdlgenblit.pl b/externals/SDL/src/video/sdlgenblit.pl index de07b19e5..bb70cebb6 100755 --- a/externals/SDL/src/video/sdlgenblit.pl +++ b/externals/SDL/src/video/sdlgenblit.pl @@ -114,7 +114,7 @@ sub open_file { #if SDL_HAVE_BLIT_AUTO -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ __EOF__ } @@ -122,7 +122,7 @@ __EOF__ sub close_file { my $name = shift; print FILE <<__EOF__; -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ #endif /* SDL_HAVE_BLIT_AUTO */ @@ -220,82 +220,16 @@ sub output_copycore my $A_is_const_FF = shift; my $s = ""; my $d = ""; - my $dst_has_alpha = ($dst =~ /A/) ? 1 : 0; - my $src_has_alpha = ($src =~ /A/) ? 1 : 0; - my $sa = ""; - my $da = ""; - if (!$modulate && !$blend) { - # Nice and easy... - if ( $src eq $dst ) { - print FILE <<__EOF__; + # Nice and easy... + if ( $src eq $dst && !$modulate && !$blend ) { + print FILE <<__EOF__; *dst = *src; __EOF__ - return; - } - - # Matching color-order - $sa = $src; - $sa =~ s/[A8]//g; - $da = $dst; - $da =~ s/[A8]//g; - if ($sa eq $da) { - if ($dst_has_alpha && $src_has_alpha) { - $da = substr $dst, 0, 1; - if ($da eq "A") { - # RGBA -> ARGB - print FILE <<__EOF__; - pixel = *src; - pixel = (pixel >> 8) | (pixel << 24); - *dst = pixel; -__EOF__ - } else { - # ARGB -> RGBA -- unused - print FILE <<__EOF__; - pixel = *src; - pixel = (pixel << 8) | A; - *dst = pixel; -__EOF__ - } - } elsif ($dst_has_alpha) { - $da = substr $dst, 0, 1; - if ($da eq "A") { - # RGB -> ARGB - print FILE <<__EOF__; - pixel = *src; - pixel |= (A << 24); - *dst = pixel; -__EOF__ - } else { - # RGB -> RGBA -- unused - print FILE <<__EOF__; - pixel = *src; - pixel = (pixel << 8) | A; - *dst = pixel; -__EOF__ - } - } else { - $sa = substr $src, 0, 1; - if ($sa eq "A") { - # ARGB -> RGB - print FILE <<__EOF__; - pixel = *src; - pixel &= 0xFFFFFF; - *dst = pixel; -__EOF__ - } else { - # RGBA -> RGB - print FILE <<__EOF__; - pixel = *src; - pixel >>= 8; - *dst = pixel; -__EOF__ - } - } - return; - } + return; } + my $dst_has_alpha = ($dst =~ /A/) ? 1 : 0; my $ignore_dst_alpha = !$dst_has_alpha && !$blend; if ( $blend ) { @@ -432,14 +366,6 @@ sub output_copyfunc my $is_modulateA_done = 0; my $A_is_const_FF = 0; - my $sa = $src; - my $da = $dst; - my $matching_colors = 0; - - $sa =~ s/[A8]//g; - $da =~ s/[A8]//g; - $matching_colors = (!$modulate && !$blend && ($sa eq $da)) ? 1 : 0; - output_copyfuncname("static void", $src, $dst, $modulate, $blend, $scale, 1, "\n"); print FILE <<__EOF__; { @@ -498,8 +424,8 @@ __EOF__ print FILE <<__EOF__; Uint32 pixel; __EOF__ - if ( !$ignore_dst_alpha && !$src_has_alpha ) { - if ( $modulate ) { + if (!$ignore_dst_alpha && !$src_has_alpha) { + if ($modulate){ $is_modulateA_done = 1; print FILE <<__EOF__; const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; @@ -510,18 +436,14 @@ __EOF__ const Uint32 A = 0xFF; __EOF__ } - if ( !$matching_colors ) { - print FILE <<__EOF__; + print FILE <<__EOF__; Uint32 R, G, B; __EOF__ - } - } elsif ( !$ignore_dst_alpha ) { - if ( !$matching_colors ) { - print FILE <<__EOF__; + } elsif (!$ignore_dst_alpha) { + print FILE <<__EOF__; Uint32 R, G, B, A; __EOF__ - } - } elsif ( !$matching_colors ) { + } else { print FILE <<__EOF__; Uint32 R, G, B; __EOF__ diff --git a/externals/SDL/src/video/uikit/SDL_uikitevents.m b/externals/SDL/src/video/uikit/SDL_uikitevents.m index b7ef0bf40..5253aa75a 100755 --- a/externals/SDL/src/video/uikit/SDL_uikitevents.m +++ b/externals/SDL/src/video/uikit/SDL_uikitevents.m @@ -87,7 +87,7 @@ static id keyboard_disconnect_observer = nil; static void OnGCKeyboardConnected(GCKeyboard *keyboard) API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0)) { keyboard_connected = SDL_TRUE; - keyboard.keyboardInput.keyChangedHandler = ^(GCKeyboardInput *kbrd, GCControllerButtonInput *key, GCKeyCode keyCode, BOOL pressed) + keyboard.keyboardInput.keyChangedHandler = ^(GCKeyboardInput *keyboard, GCControllerButtonInput *key, GCKeyCode keyCode, BOOL pressed) { SDL_SendKeyboardKey(pressed ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)keyCode); }; @@ -225,15 +225,15 @@ static void OnGCMouseConnected(GCMouse *mouse) API_AVAILABLE(macos(11.0), ios(14 }; int auxiliary_button = SDL_BUTTON_X1; - for (GCControllerButtonInput *btn in mouse.mouseInput.auxiliaryButtons) { - btn.pressedChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) + for (GCControllerButtonInput *button in mouse.mouseInput.auxiliaryButtons) { + button.pressedChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { OnGCMouseButtonChanged(mouseID, auxiliary_button, pressed); }; ++auxiliary_button; } - mouse.mouseInput.mouseMovedHandler = ^(GCMouseInput *mouseInput, float deltaX, float deltaY) + mouse.mouseInput.mouseMovedHandler = ^(GCMouseInput *mouse, float deltaX, float deltaY) { if (SDL_GCMouseRelativeMode()) { SDL_SendMouseMotion(SDL_GetMouseFocus(), mouseID, 1, (int)deltaX, -(int)deltaY); diff --git a/externals/SDL/src/video/uikit/SDL_uikitmessagebox.m b/externals/SDL/src/video/uikit/SDL_uikitmessagebox.m index b6d56f350..7aecea803 100755 --- a/externals/SDL/src/video/uikit/SDL_uikitmessagebox.m +++ b/externals/SDL/src/video/uikit/SDL_uikitmessagebox.m @@ -86,7 +86,7 @@ UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, in action = [UIAlertAction actionWithTitle:@(sdlButton->text) style:style - handler:^(UIAlertAction *alertAction) { + handler:^(UIAlertAction *action) { clickedindex = (int)(sdlButton - messageboxdata->buttons); }]; [alert addAction:action]; @@ -186,8 +186,8 @@ UIKit_ShowMessageBoxAlertView(const SDL_MessageBoxData *messageboxdata, int *but #endif /* __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 */ } -static void -UIKit_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid, int *returnValue) +int +UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { BOOL success = NO; @@ -199,26 +199,12 @@ UIKit_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid } if (!success) { - *returnValue = SDL_SetError("Could not show message box."); - } else { - *returnValue = 0; + return SDL_SetError("Could not show message box."); } + + return 0; } -int -UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) -{ @autoreleasepool -{ - __block int returnValue = 0; - - if ([NSThread isMainThread]) { - UIKit_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue); - } else { - dispatch_sync(dispatch_get_main_queue(), ^{ UIKit_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue); }); - } - return returnValue; -}} - #endif /* SDL_VIDEO_DRIVER_UIKIT */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/uikit/SDL_uikitopengles.m b/externals/SDL/src/video/uikit/SDL_uikitopengles.m index 86fefd76c..8722dca93 100755 --- a/externals/SDL/src/video/uikit/SDL_uikitopengles.m +++ b/externals/SDL/src/video/uikit/SDL_uikitopengles.m @@ -162,8 +162,8 @@ UIKit_GL_CreateContext(_THIS, SDL_Window * window) } if (_this->gl_config.share_with_current_context) { - EAGLContext *currContext = (__bridge EAGLContext *) SDL_GL_GetCurrentContext(); - sharegroup = currContext.sharegroup; + EAGLContext *context = (__bridge EAGLContext *) SDL_GL_GetCurrentContext(); + sharegroup = context.sharegroup; } if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { diff --git a/externals/SDL/src/video/uikit/SDL_uikitopenglview.m b/externals/SDL/src/video/uikit/SDL_uikitopenglview.m index ef5ca74e5..52158f8d7 100755 --- a/externals/SDL/src/video/uikit/SDL_uikitopenglview.m +++ b/externals/SDL/src/video/uikit/SDL_uikitopenglview.m @@ -89,7 +89,7 @@ glGetIntegerv(GL_MAX_SAMPLES, &maxsamples); /* Clamp the samples to the max supported count. */ - samples = SDL_min(samples, maxsamples); + samples = MIN(samples, maxsamples); } if (sRGB) { diff --git a/externals/SDL/src/video/uikit/SDL_uikitvideo.m b/externals/SDL/src/video/uikit/SDL_uikitvideo.m index 81d7bf647..5d2b96e38 100755 --- a/externals/SDL/src/video/uikit/SDL_uikitvideo.m +++ b/externals/SDL/src/video/uikit/SDL_uikitvideo.m @@ -278,16 +278,11 @@ UIKit_ForceUpdateHomeIndicator() */ #if !defined(SDL_VIDEO_DRIVER_COCOA) -void SDL_NSLog(const char *prefix, const char *text) +void SDL_NSLog(const char *text) { @autoreleasepool { - NSString *nsText = [NSString stringWithUTF8String:text]; - if (prefix) { - NSString *nsPrefix = [NSString stringWithUTF8String:prefix]; - NSLog(@"%@: %@", nsPrefix, nsText); - } else { - NSLog(@"%@", nsText); - } + NSString *str = [NSString stringWithUTF8String:text]; + NSLog(@"%@", str); } } #endif /* SDL_VIDEO_DRIVER_COCOA */ diff --git a/externals/SDL/src/video/uikit/SDL_uikitwindow.m b/externals/SDL/src/video/uikit/SDL_uikitwindow.m index d68e6e732..6808de4eb 100755 --- a/externals/SDL/src/video/uikit/SDL_uikitwindow.m +++ b/externals/SDL/src/video/uikit/SDL_uikitwindow.m @@ -403,8 +403,8 @@ UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } diff --git a/externals/SDL/src/video/vita/SDL_vitaframebuffer.c b/externals/SDL/src/video/vita/SDL_vitaframebuffer.c index 1c558486b..992c7af84 100755 --- a/externals/SDL/src/video/vita/SDL_vitaframebuffer.c +++ b/externals/SDL/src/video/vita/SDL_vitaframebuffer.c @@ -31,7 +31,7 @@ #define ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) #define DISPLAY_PIXEL_FORMAT SCE_DISPLAY_PIXELFORMAT_A8B8G8R8 -void *vita_gpu_alloc(unsigned int type, unsigned int size, SceUID *uid) +void *vita_gpu_alloc(SceKernelMemBlockType type, unsigned int size, SceUID *uid) { void *mem; diff --git a/externals/SDL/src/video/vita/SDL_vitagl.c b/externals/SDL/src/video/vita/SDL_vitagl.c index f4d905f7a..f65022865 100755 --- a/externals/SDL/src/video/vita/SDL_vitagl.c +++ b/externals/SDL/src/video/vita/SDL_vitagl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2021 Sam Lantinga + Copyright (C) 1997-2022 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/externals/SDL/src/video/vita/SDL_vitagl_c.h b/externals/SDL/src/video/vita/SDL_vitagl_c.h index 8fc19abf6..272653d70 100755 --- a/externals/SDL/src/video/vita/SDL_vitagl_c.h +++ b/externals/SDL/src/video/vita/SDL_vitagl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2021 Sam Lantinga + Copyright (C) 1997-2022 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/externals/SDL/src/video/vita/SDL_vitagl_pvr.c b/externals/SDL/src/video/vita/SDL_vitagl_pvr.c index d51150c03..3b7fb7477 100755 --- a/externals/SDL/src/video/vita/SDL_vitagl_pvr.c +++ b/externals/SDL/src/video/vita/SDL_vitagl_pvr.c @@ -20,12 +20,11 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR && SDL_VIDEO_VITA_PVR_OGL +#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR #include #include #include #include -#include #include "SDL_error.h" #include "SDL_log.h" @@ -35,16 +34,6 @@ #define MAX_PATH 256 // vita limits are somehow wrong -/* Defaults */ -int FB_WIDTH = 960; -int FB_HEIGHT = 544; - -void getFBSize(int *width, int *height) -{ - *width = FB_WIDTH; - *height = FB_HEIGHT; -} - int VITA_GL_LoadLibrary(_THIS, const char *path) { @@ -64,9 +53,6 @@ VITA_GL_LoadLibrary(_THIS, const char *path) sceKernelLoadStartModule("vs0:sys/external/libfios2.suprx", 0, NULL, 0, NULL, NULL); sceKernelLoadStartModule("vs0:sys/external/libc.suprx", 0, NULL, 0, NULL, NULL); - SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libGL.suprx"); - sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL); - SDL_snprintf(target_path, MAX_PATH, "%s/%s", default_path, "libgpu_es4_ext.suprx"); sceKernelLoadStartModule(target_path, 0, NULL, 0, NULL, NULL); @@ -88,45 +74,30 @@ VITA_GL_LoadLibrary(_THIS, const char *path) SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window * window) { - char gl_version[3]; - SDL_GLContext context = NULL; - int temp_major = _this->gl_config.major_version; - int temp_minor = _this->gl_config.minor_version; - int temp_profile = _this->gl_config.profile_mask; - - /* Set version to 2.0 and PROFILE to ES */ - _this->gl_config.major_version = 2; - _this->gl_config.minor_version = 0; - _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; - - context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); - - if (context != NULL) - { - FB_WIDTH = window->w; - FB_HEIGHT = window->h; - set_getprocaddress((void *(*)(const char *))eglGetProcAddress); - set_getmainfbsize(getFBSize); - SDL_snprintf(gl_version, 3, "%d%d", temp_major, temp_minor); - gl4es_setenv("LIBGL_NOTEXRECT", "1", 1); /* Currently broken in driver */ - gl4es_setenv("LIBGL_GL", gl_version, 1); - initialize_gl4es(); - } - - /* Restore gl_config */ - _this->gl_config.major_version = temp_major; - _this->gl_config.minor_version = temp_minor; - _this->gl_config.profile_mask = temp_profile; - - return context; + return SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); } -void * -VITA_GL_GetProcAddress(_THIS, const char *proc) +int +VITA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - return gl4es_GetProcAddress(proc); + if (window && context) { + return SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context); + } else { + return SDL_EGL_MakeCurrent(_this, NULL, NULL); + } } +int +VITA_GL_SwapWindow(_THIS, SDL_Window * window) +{ + SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; + if (videodata->ime_active) { + sceImeUpdate(); + } + return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); +} + + #endif /* SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/vita/SDL_vitagl_pvr_c.h b/externals/SDL/src/video/vita/SDL_vitagl_pvr_c.h index 2329d472b..670eaebb0 100755 --- a/externals/SDL/src/video/vita/SDL_vitagl_pvr_c.h +++ b/externals/SDL/src/video/vita/SDL_vitagl_pvr_c.h @@ -19,16 +19,17 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef SDL_vitagl_pvr_c_h_ -#define SDL_vitagl_pvr_c_h_ +#ifndef SDL_vitagl_c_h_ +#define SDL_vitagl_c_h_ #include "SDL_vitavideo.h" +extern int VITA_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); +extern int VITA_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window * window); extern int VITA_GL_LoadLibrary(_THIS, const char *path); -extern void *VITA_GL_GetProcAddress(_THIS, const char *proc); -#endif /* SDL_vitagl_pvr_c_h_ */ +#endif /* SDL_vitagl_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/vita/SDL_vitatouch.c b/externals/SDL/src/video/vita/SDL_vitatouch.c index 43a3ecbd2..f28c880bd 100755 --- a/externals/SDL/src/video/vita/SDL_vitatouch.c +++ b/externals/SDL/src/video/vita/SDL_vitatouch.c @@ -108,30 +108,17 @@ VITA_PollTouch(void) float x = 0; float y = 0; float force = (touch[port].report[i].force - force_info[port].min) / force_info[port].range; - int finger_down = 0; - - if (touch_old[port].reportNum > 0) { - for (int j = 0; j < touch_old[port].reportNum; j++) { - if (touch[port].report[i].id == touch_old[port].report[j].id ) { - finger_down = 1; - } - } - } - VITA_ConvertTouchXYToSDLXY(&x, &y, touch[port].report[i].x, touch[port].report[i].y, port); finger_id = (SDL_FingerID) touch[port].report[i].id; - // Skip if finger was already previously down - if(!finger_down) { - // Send an initial touch - SDL_SendTouch((SDL_TouchID)port, - finger_id, - Vita_Window, - SDL_TRUE, - x, - y, - force); - } + // Send an initial touch + SDL_SendTouch((SDL_TouchID)port, + finger_id, + Vita_Window, + SDL_TRUE, + x, + y, + force); // Always send the motion SDL_SendTouchMotion((SDL_TouchID)port, diff --git a/externals/SDL/src/video/vita/SDL_vitavideo.c b/externals/SDL/src/video/vita/SDL_vitavideo.c index 33758d691..ad9e559a3 100755 --- a/externals/SDL/src/video/vita/SDL_vitavideo.c +++ b/externals/SDL/src/video/vita/SDL_vitavideo.c @@ -41,17 +41,15 @@ #include "SDL_vitaframebuffer.h" #if defined(SDL_VIDEO_VITA_PIB) - #include "SDL_vitagles_c.h" + #include "SDL_vitagl_c.h" #elif defined(SDL_VIDEO_VITA_PVR) - #include "SDL_vitagles_pvr_c.h" -#if defined(SDL_VIDEO_VITA_PVR_OGL) #include "SDL_vitagl_pvr_c.h" -#endif - #define VITA_GLES_GetProcAddress SDL_EGL_GetProcAddress - #define VITA_GLES_UnloadLibrary SDL_EGL_UnloadLibrary - #define VITA_GLES_SetSwapInterval SDL_EGL_SetSwapInterval - #define VITA_GLES_GetSwapInterval SDL_EGL_GetSwapInterval - #define VITA_GLES_DeleteContext SDL_EGL_DeleteContext + #include "../SDL_egl_c.h" + #define VITA_GL_GetProcAddress SDL_EGL_GetProcAddress + #define VITA_GL_UnloadLibrary SDL_EGL_UnloadLibrary + #define VITA_GL_SetSwapInterval SDL_EGL_SetSwapInterval + #define VITA_GL_GetSwapInterval SDL_EGL_GetSwapInterval + #define VITA_GL_DeleteContext SDL_EGL_DeleteContext #endif SDL_Window *Vita_Window; @@ -142,26 +140,15 @@ VITA_Create() */ #if defined(SDL_VIDEO_VITA_PIB) || defined(SDL_VIDEO_VITA_PVR) -#if defined(SDL_VIDEO_VITA_PVR_OGL) -if(SDL_getenv("VITA_PVR_OGL") != NULL) { device->GL_LoadLibrary = VITA_GL_LoadLibrary; - device->GL_CreateContext = VITA_GL_CreateContext; device->GL_GetProcAddress = VITA_GL_GetProcAddress; -} else { -#endif - device->GL_LoadLibrary = VITA_GLES_LoadLibrary; - device->GL_CreateContext = VITA_GLES_CreateContext; - device->GL_GetProcAddress = VITA_GLES_GetProcAddress; -#if defined(SDL_VIDEO_VITA_PVR_OGL) -} -#endif - - device->GL_UnloadLibrary = VITA_GLES_UnloadLibrary; - device->GL_MakeCurrent = VITA_GLES_MakeCurrent; - device->GL_SetSwapInterval = VITA_GLES_SetSwapInterval; - device->GL_GetSwapInterval = VITA_GLES_GetSwapInterval; - device->GL_SwapWindow = VITA_GLES_SwapWindow; - device->GL_DeleteContext = VITA_GLES_DeleteContext; + device->GL_UnloadLibrary = VITA_GL_UnloadLibrary; + device->GL_CreateContext = VITA_GL_CreateContext; + device->GL_MakeCurrent = VITA_GL_MakeCurrent; + device->GL_SetSwapInterval = VITA_GL_SetSwapInterval; + device->GL_GetSwapInterval = VITA_GL_GetSwapInterval; + device->GL_SwapWindow = VITA_GL_SwapWindow; + device->GL_DeleteContext = VITA_GL_DeleteContext; #endif device->HasScreenKeyboardSupport = VITA_HasScreenKeyboardSupport; @@ -258,9 +245,6 @@ VITA_CreateWindow(_THIS, SDL_Window * window) SDL_WindowData *wdata; #if defined(SDL_VIDEO_VITA_PVR) Psp2NativeWindow win; - int temp_major = 2; - int temp_minor = 1; - int temp_profile = 0; #endif /* Allocate window internal data */ @@ -275,7 +259,8 @@ VITA_CreateWindow(_THIS, SDL_Window * window) // Vita can only have one window if (Vita_Window != NULL) { - return SDL_SetError("Only one window supported"); + SDL_SetError("Only one window supported"); + return -1; } Vita_Window = window; @@ -298,26 +283,11 @@ VITA_CreateWindow(_THIS, SDL_Window * window) win.windowSize = PSP2_WINDOW_960X544; } if ((window->flags & SDL_WINDOW_OPENGL) != 0) { - if(SDL_getenv("VITA_PVR_OGL") != NULL) { - /* Set version to 2.1 and PROFILE to ES */ - temp_major = _this->gl_config.major_version; - temp_minor = _this->gl_config.minor_version; - temp_profile = _this->gl_config.profile_mask; - - _this->gl_config.major_version = 2; - _this->gl_config.minor_version = 1; - _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; - } wdata->egl_surface = SDL_EGL_CreateSurface(_this, &win); + if (wdata->egl_surface == EGL_NO_SURFACE) { return SDL_SetError("Could not create GLES window surface"); } - if(SDL_getenv("VITA_PVR_OGL") != NULL) { - /* Revert */ - _this->gl_config.major_version = temp_major; - _this->gl_config.minor_version = temp_minor; - _this->gl_config.profile_mask = temp_profile; - } } #endif @@ -404,8 +374,8 @@ VITA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d\n", - SDL_MAJOR_VERSION); + SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/externals/SDL/src/video/vita/SDL_vitavideo.h b/externals/SDL/src/video/vita/SDL_vitavideo.h index 9fdf7e69c..04488dde3 100755 --- a/externals/SDL/src/video/vita/SDL_vitavideo.h +++ b/externals/SDL/src/video/vita/SDL_vitavideo.h @@ -90,23 +90,16 @@ SDL_bool VITA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); #if SDL_VIDEO_DRIVER_VITA -#if defined(SDL_VIDEO_VITA_PVR_OGL) /* OpenGL functions */ int VITA_GL_LoadLibrary(_THIS, const char *path); -SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window * window); void *VITA_GL_GetProcAddress(_THIS, const char *proc); -#endif - -/* OpenGLES functions */ -int VITA_GLES_LoadLibrary(_THIS, const char *path); -void *VITA_GLES_GetProcAddress(_THIS, const char *proc); -void VITA_GLES_UnloadLibrary(_THIS); -SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window * window); -int VITA_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -int VITA_GLES_SetSwapInterval(_THIS, int interval); -int VITA_GLES_GetSwapInterval(_THIS); -int VITA_GLES_SwapWindow(_THIS, SDL_Window * window); -void VITA_GLES_DeleteContext(_THIS, SDL_GLContext context); +void VITA_GL_UnloadLibrary(_THIS); +SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window * window); +int VITA_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int VITA_GL_SetSwapInterval(_THIS, int interval); +int VITA_GL_GetSwapInterval(_THIS); +int VITA_GL_SwapWindow(_THIS, SDL_Window * window); +void VITA_GL_DeleteContext(_THIS, SDL_GLContext context); #endif /* VITA on screen keyboard */ diff --git a/externals/SDL/src/video/vivante/SDL_vivantevideo.c b/externals/SDL/src/video/vivante/SDL_vivantevideo.c index 3b18b7db8..de2fdbfd1 100755 --- a/externals/SDL/src/video/vivante/SDL_vivantevideo.c +++ b/externals/SDL/src/video/vivante/SDL_vivantevideo.c @@ -382,14 +382,15 @@ VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_DisplayData *displaydata = SDL_GetDisplayDriverData(0); - if (info->version.major == SDL_MAJOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION && + info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_VIVANTE; info->info.vivante.display = displaydata->native_display; info->info.vivante.window = data->native_window; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } diff --git a/externals/SDL/src/video/wayland/SDL_waylanddyn.h b/externals/SDL/src/video/wayland/SDL_waylanddyn.h index 43a3372d6..c867ec001 100755 --- a/externals/SDL/src/video/wayland/SDL_waylanddyn.h +++ b/externals/SDL/src/video/wayland/SDL_waylanddyn.h @@ -52,14 +52,6 @@ enum libdecor_window_state; #include "xkbcommon/xkbcommon.h" #include "xkbcommon/xkbcommon-compose.h" -/* Must be included before our #defines, see Bugzilla #4957 */ -#include "wayland-client-core.h" - -#define SDL_WAYLAND_CHECK_VERSION(x, y, z) \ - (WAYLAND_VERSION_MAJOR > x || \ - (WAYLAND_VERSION_MAJOR == x && WAYLAND_VERSION_MINOR > y) || \ - (WAYLAND_VERSION_MAJOR == x && WAYLAND_VERSION_MINOR == y && WAYLAND_VERSION_MICRO >= z)) - #ifdef __cplusplus extern "C" { @@ -79,6 +71,9 @@ void SDL_WAYLAND_UnloadSymbols(void); } #endif +/* Must be included before our #defines, see Bugzilla #4957 */ +#include "wayland-client-core.h" + #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC #if defined(_WAYLAND_CLIENT_H) || defined(WAYLAND_CLIENT_H) @@ -153,7 +148,6 @@ void SDL_WAYLAND_UnloadSymbols(void); #define libdecor_state_free (*WAYLAND_libdecor_state_free) #define libdecor_configuration_get_content_size (*WAYLAND_libdecor_configuration_get_content_size) #define libdecor_configuration_get_window_state (*WAYLAND_libdecor_configuration_get_window_state) -#define libdecor_dispatch (*WAYLAND_libdecor_dispatch) #endif #else /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ diff --git a/externals/SDL/src/video/wayland/SDL_waylandevents.c b/externals/SDL/src/video/wayland/SDL_waylandevents.c index 17981db2b..dfa62ec69 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandevents.c +++ b/externals/SDL/src/video/wayland/SDL_waylandevents.c @@ -25,7 +25,6 @@ #include "SDL_stdinc.h" #include "SDL_timer.h" -#include "SDL_hints.h" #include "../../core/unix/SDL_poll.h" #include "../../events/SDL_sysevents.h" @@ -41,7 +40,6 @@ #include "xdg-shell-client-protocol.h" #include "keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h" #include "text-input-unstable-v3-client-protocol.h" -#include "tablet-unstable-v2-client-protocol.h" #ifdef HAVE_LIBDECOR_H #include @@ -85,7 +83,6 @@ static const struct { { XKB_KEY_Super_R, SDLK_RGUI }, { XKB_KEY_Hyper_L, SDLK_LGUI }, { XKB_KEY_Hyper_R, SDLK_RGUI }, - { XKB_KEY_BackSpace, SDLK_BACKSPACE }, }; struct SDL_WaylandTouchPoint { @@ -295,12 +292,6 @@ Wayland_WaitEventTimeout(_THIS, int timeout) } } -#ifdef HAVE_LIBDECOR_H - if (d->shell.libdecor) { - libdecor_dispatch(d->shell.libdecor, timeout); - } -#endif - /* wl_display_prepare_read() will return -1 if the default queue is not empty. * If the default queue is empty, it will prepare us for our SDL_IOReady() call. */ if (WAYLAND_wl_display_prepare_read(d->display) == 0) { @@ -396,10 +387,8 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer, input->sx_w = sx_w; input->sy_w = sy_w; if (input->pointer_focus) { - const float sx_f = (float)wl_fixed_to_double(sx_w); - const float sy_f = (float)wl_fixed_to_double(sy_w); - const int sx = (int)SDL_floorf(sx_f * window->pointer_scale_x); - const int sy = (int)SDL_floorf(sy_f * window->pointer_scale_y); + const int sx = wl_fixed_to_int(sx_w); + const int sy = wl_fixed_to_int(sy_w); SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy); } } @@ -479,24 +468,20 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) }; #ifdef HAVE_LIBDECOR_H - static const uint32_t directions_libdecor[] = { - LIBDECOR_RESIZE_EDGE_TOP_LEFT, LIBDECOR_RESIZE_EDGE_TOP, - LIBDECOR_RESIZE_EDGE_TOP_RIGHT, LIBDECOR_RESIZE_EDGE_RIGHT, - LIBDECOR_RESIZE_EDGE_BOTTOM_RIGHT, LIBDECOR_RESIZE_EDGE_BOTTOM, - LIBDECOR_RESIZE_EDGE_BOTTOM_LEFT, LIBDECOR_RESIZE_EDGE_LEFT - }; + /* ditto for libdecor. */ + const uint32_t *directions_libdecor = directions; #endif switch (rc) { case SDL_HITTEST_DRAGGABLE: #ifdef HAVE_LIBDECOR_H - if (window_data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { + if (input->display->shell.libdecor) { if (window_data->shell_surface.libdecor.frame) { libdecor_frame_move(window_data->shell_surface.libdecor.frame, input->seat, serial); } } else #endif - if (window_data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { + if (input->display->shell.xdg) { if (window_data->shell_surface.xdg.roleobj.toplevel) { xdg_toplevel_move(window_data->shell_surface.xdg.roleobj.toplevel, input->seat, @@ -514,13 +499,13 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) case SDL_HITTEST_RESIZE_BOTTOMLEFT: case SDL_HITTEST_RESIZE_LEFT: #ifdef HAVE_LIBDECOR_H - if (window_data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { + if (input->display->shell.libdecor) { if (window_data->shell_surface.libdecor.frame) { libdecor_frame_resize(window_data->shell_surface.libdecor.frame, input->seat, serial, directions_libdecor[rc - SDL_HITTEST_RESIZE_TOPLEFT]); } } else #endif - if (window_data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { + if (input->display->shell.xdg) { if (window_data->shell_surface.xdg.roleobj.toplevel) { xdg_toplevel_resize(window_data->shell_surface.xdg.roleobj.toplevel, input->seat, @@ -730,8 +715,8 @@ touch_handler_down(void *data, struct wl_touch *touch, unsigned int serial, int id, wl_fixed_t fx, wl_fixed_t fy) { SDL_WindowData *window_data = (SDL_WindowData *)wl_surface_get_user_data(surface); - const double dblx = wl_fixed_to_double(fx) * window_data->pointer_scale_x; - const double dbly = wl_fixed_to_double(fy) * window_data->pointer_scale_y; + const double dblx = wl_fixed_to_double(fx); + const double dbly = wl_fixed_to_double(fy); const float x = dblx / window_data->sdlwindow->w; const float y = dbly / window_data->sdlwindow->h; @@ -763,8 +748,8 @@ touch_handler_motion(void *data, struct wl_touch *touch, unsigned int timestamp, int id, wl_fixed_t fx, wl_fixed_t fy) { SDL_WindowData *window_data = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id)); - const double dblx = wl_fixed_to_double(fx) * window_data->pointer_scale_x; - const double dbly = wl_fixed_to_double(fy) * window_data->pointer_scale_y; + const double dblx = wl_fixed_to_double(fx); + const double dbly = wl_fixed_to_double(fy); const float x = dblx / window_data->sdlwindow->w; const float y = dbly / window_data->sdlwindow->h; @@ -830,16 +815,6 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } - #define GET_MOD_INDEX(mod) \ - WAYLAND_xkb_keymap_mod_get_index(input->xkb.keymap, XKB_MOD_NAME_##mod) - input->xkb.idx_shift = 1 << GET_MOD_INDEX(SHIFT); - input->xkb.idx_ctrl = 1 << GET_MOD_INDEX(CTRL); - input->xkb.idx_alt = 1 << GET_MOD_INDEX(ALT); - input->xkb.idx_gui = 1 << GET_MOD_INDEX(LOGO); - input->xkb.idx_num = 1 << GET_MOD_INDEX(NUM); - input->xkb.idx_caps = 1 << GET_MOD_INDEX(CAPS); - #undef GET_MOD_INDEX - input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!input->xkb.state) { fprintf(stderr, "failed to create XKB state\n"); @@ -854,14 +829,10 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, */ /* Look up the preferred locale, falling back to "C" as default */ - if (!(locale = SDL_getenv("LC_ALL"))) { - if (!(locale = SDL_getenv("LC_CTYPE"))) { - if (!(locale = SDL_getenv("LANG"))) { + if (!(locale = SDL_getenv("LC_ALL"))) + if (!(locale = SDL_getenv("LC_CTYPE"))) + if (!(locale = SDL_getenv("LANG"))) locale = "C"; - } - } - } - /* Set up XKB compose table */ input->xkb.compose_table = WAYLAND_xkb_compose_table_new_from_locale(input->display->xkb_context, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); @@ -932,7 +903,7 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, } static SDL_bool -keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint32_t key, Uint8 state, SDL_bool *handled_by_ime) +keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint32_t key, SDL_bool *handled_by_ime) { SDL_WindowData *window = input->keyboard_focus; const xkb_keysym_t *syms; @@ -949,16 +920,12 @@ keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint sym = syms[0]; #ifdef SDL_USE_IME - if (SDL_IME_ProcessKeyEvent(sym, key + 8, state)) { + if (SDL_IME_ProcessKeyEvent(sym, key + 8)) { *handled_by_ime = SDL_TRUE; return SDL_TRUE; } #endif - if (state == SDL_RELEASED) { - return SDL_FALSE; - } - if (input->xkb.compose_state && WAYLAND_xkb_compose_state_feed(input->xkb.compose_state, sym) == XKB_COMPOSE_FEED_ACCEPTED) { switch(WAYLAND_xkb_compose_state_get_status(input->xkb.compose_state)) { case XKB_COMPOSE_COMPOSING: @@ -992,7 +959,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, SDL_bool handled_by_ime = SDL_FALSE; if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { - has_text = keyboard_input_get_text(text, input, key, SDL_PRESSED, &handled_by_ime); + has_text = keyboard_input_get_text(text, input, key, &handled_by_ime); } else { if (keyboard_repeat_is_set(&input->keyboard_repeat)) { // Send any due key repeat events before stopping the repeat and generating the key up event @@ -1002,7 +969,6 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, keyboard_repeat_handle(&input->keyboard_repeat, time - input->keyboard_repeat.wl_press_time); keyboard_repeat_clear(&input->keyboard_repeat); } - keyboard_input_get_text(text, input, key, SDL_RELEASED, &handled_by_ime); } if (!handled_by_ime && key < SDL_arraysize(xfree86_scancode_table2)) { @@ -1021,9 +987,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, SDL_SendKeyboardText(text); } } - if (input->xkb.keymap && WAYLAND_xkb_keymap_key_repeats(input->xkb.keymap, key + 8)) { - keyboard_repeat_set(&input->keyboard_repeat, time, scancode, has_text, text); - } + keyboard_repeat_set(&input->keyboard_repeat, time, scancode, has_text, text); } } @@ -1088,24 +1052,10 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, { struct SDL_WaylandInput *input = data; Wayland_Keymap keymap; - uint32_t modstate = (mods_depressed | mods_latched | mods_locked); WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, mods_locked, 0, 0, group); - SDL_ToggleModState(KMOD_SHIFT, modstate & input->xkb.idx_shift); - SDL_ToggleModState(KMOD_CTRL, modstate & input->xkb.idx_ctrl); - SDL_ToggleModState(KMOD_ALT, modstate & input->xkb.idx_alt); - SDL_ToggleModState(KMOD_GUI, modstate & input->xkb.idx_gui); - SDL_ToggleModState(KMOD_NUM, modstate & input->xkb.idx_num); - SDL_ToggleModState(KMOD_CAPS, modstate & input->xkb.idx_caps); - - if (group == input->xkb.current_group) { - return; - } - - /* The layout changed, remap and fire an event */ - input->xkb.current_group = group; keymap.layout = group; SDL_GetDefaultKeymap(keymap.keymap); WAYLAND_xkb_keymap_key_for_each(input->xkb.keymap, @@ -1362,145 +1312,36 @@ data_device_handle_motion(void *data, struct wl_data_device *wl_data_device, { } -/* Decodes URI escape sequences in string buf of len bytes - (excluding the terminating NULL byte) in-place. Since - URI-encoded characters take three times the space of - normal characters, this should not be an issue. - - Returns the number of decoded bytes that wound up in - the buffer, excluding the terminating NULL byte. - - The buffer is guaranteed to be NULL-terminated but - may contain embedded NULL bytes. - - On error, -1 is returned. - - FIXME: This was shamelessly copied from SDL_x11events.c - */ -static int Wayland_URIDecode(char *buf, int len) { - int ri, wi, di; - char decode = '\0'; - if (buf == NULL || len < 0) { - errno = EINVAL; - return -1; - } - if (len == 0) { - len = SDL_strlen(buf); - } - for (ri = 0, wi = 0, di = 0; ri < len && wi < len; ri += 1) { - if (di == 0) { - /* start decoding */ - if (buf[ri] == '%') { - decode = '\0'; - di += 1; - continue; - } - /* normal write */ - buf[wi] = buf[ri]; - wi += 1; - continue; - } else if (di == 1 || di == 2) { - char off = '\0'; - char isa = buf[ri] >= 'a' && buf[ri] <= 'f'; - char isA = buf[ri] >= 'A' && buf[ri] <= 'F'; - char isn = buf[ri] >= '0' && buf[ri] <= '9'; - if (!(isa || isA || isn)) { - /* not a hexadecimal */ - int sri; - for (sri = ri - di; sri <= ri; sri += 1) { - buf[wi] = buf[sri]; - wi += 1; - } - di = 0; - continue; - } - /* itsy bitsy magicsy */ - if (isn) { - off = 0 - '0'; - } else if (isa) { - off = 10 - 'a'; - } else if (isA) { - off = 10 - 'A'; - } - decode |= (buf[ri] + off) << (2 - di) * 4; - if (di == 2) { - buf[wi] = decode; - wi += 1; - di = 0; - } else { - di += 1; - } - continue; - } - } - buf[wi] = '\0'; - return wi; -} - -/* Convert URI to local filename - return filename if possible, else NULL - - FIXME: This was shamelessly copied from SDL_x11events.c -*/ -static char* Wayland_URIToLocal(char* uri) { - char *file = NULL; - SDL_bool local; - - if (SDL_memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */ - else if (SDL_strstr(uri,":/") != NULL) return file; /* wrong scheme */ - - local = uri[0] != '/' || (uri[0] != '\0' && uri[1] == '/'); - - /* got a hostname? */ - if (!local && uri[0] == '/' && uri[2] != '/') { - char* hostname_end = SDL_strchr(uri+1, '/'); - if (hostname_end != NULL) { - char hostname[ 257 ]; - if (gethostname(hostname, 255) == 0) { - hostname[ 256 ] = '\0'; - if (SDL_memcmp(uri+1, hostname, hostname_end - (uri+1)) == 0) { - uri = hostname_end + 1; - local = SDL_TRUE; - } - } - } - } - if (local) { - file = uri; - /* Convert URI escape sequences to real characters */ - Wayland_URIDecode(file, 0); - if (uri[1] == '/') { - file++; - } else { - file--; - } - } - return file; -} - static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_device) { SDL_WaylandDataDevice *data_device = data; + void *buffer = NULL; + size_t length = 0; + + const char *current_uri = NULL; + const char *last_char = NULL; + char *current_char = NULL; if (data_device->drag_offer != NULL) { /* TODO: SDL Support more mime types */ - size_t length; - void *buffer = Wayland_data_offer_receive(data_device->drag_offer, - &length, FILE_MIME, SDL_FALSE); - if (buffer) { - char *saveptr = NULL; - char *token = SDL_strtokr((char *) buffer, "\r\n", &saveptr); - while (token != NULL) { - char *fn = Wayland_URIToLocal(token); - if (fn) { - SDL_SendDropFile(NULL, fn); /* FIXME: Window? */ + buffer = Wayland_data_offer_receive(data_device->drag_offer, + &length, FILE_MIME, SDL_FALSE); + + /* uri-list */ + current_uri = (const char *)buffer; + last_char = (const char *)buffer + length; + for (current_char = buffer; current_char < last_char; ++current_char) { + if (*current_char == '\n' || *current_char == 0) { + if (*current_uri != 0 && *current_uri != '#') { + *current_char = 0; + SDL_SendDropFile(NULL, current_uri); } - token = SDL_strtokr(NULL, "\r\n", &saveptr); + current_uri = (const char *)current_char + 1; } - SDL_SendDropComplete(NULL); /* FIXME: Window? */ - SDL_free(buffer); } + + SDL_free(buffer); } } @@ -1555,37 +1396,20 @@ text_input_preedit_string(void *data, int32_t cursor_begin, int32_t cursor_end) { - SDL_WaylandTextInput *text_input = data; char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; - text_input->has_preedit = SDL_TRUE; if (text) { - if (SDL_GetHintBoolean(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, SDL_FALSE)) { - size_t cursor_begin_utf8 = cursor_begin >= 0 ? SDL_utf8strnlen(text, cursor_begin) : -1; - size_t cursor_end_utf8 = cursor_end >= 0 ? SDL_utf8strnlen(text, cursor_end) : -1; - size_t cursor_size_utf8; - if (cursor_end_utf8 >= 0) { - if (cursor_begin_utf8 >= 0) { - cursor_size_utf8 = cursor_end_utf8 - cursor_begin_utf8; - } else { - cursor_size_utf8 = cursor_end_utf8; - } - } else { - cursor_size_utf8 = -1; - } - SDL_SendEditingText(text, cursor_begin_utf8, cursor_size_utf8); - } else { - size_t text_bytes = SDL_strlen(text), i = 0; - size_t cursor = 0; - do { - const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); - const size_t chars = SDL_utf8strlen(buf); - - SDL_SendEditingText(buf, cursor, chars); - - i += sz; - cursor += chars; - } while (i < text_bytes); - } + size_t text_bytes = SDL_strlen(text), i = 0; + size_t cursor = 0; + + do { + const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); + + SDL_SendEditingText(buf, cursor, chars); + + i += sz; + cursor += chars; + } while (i < text_bytes); } else { buf[0] = '\0'; SDL_SendEditingText(buf, 0, 0); @@ -1624,11 +1448,7 @@ text_input_done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, uint32_t serial) { - SDL_WaylandTextInput *text_input = data; - if (!text_input->has_preedit) { - SDL_SendEditingText("", 0, 0); - } - text_input->has_preedit = SDL_FALSE; + /* No-op */ } static const struct zwp_text_input_v3_listener text_input_listener = { @@ -1709,363 +1529,6 @@ Wayland_add_text_input_manager(SDL_VideoData *d, uint32_t id, uint32_t version) } } -static void -tablet_tool_handle_type(void* data, struct zwp_tablet_tool_v2* tool, uint32_t type) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_hardware_serial(void* data, struct zwp_tablet_tool_v2* tool, uint32_t serial_hi, uint32_t serial_lo) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_hardware_id_wacom(void* data, struct zwp_tablet_tool_v2* tool, uint32_t id_hi, uint32_t id_lo) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_capability(void* data, struct zwp_tablet_tool_v2* tool, uint32_t capability) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_done(void* data, struct zwp_tablet_tool_v2* tool) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_removed(void* data, struct zwp_tablet_tool_v2* tool) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_proximity_in(void* data, struct zwp_tablet_tool_v2* tool, uint32_t serial, struct zwp_tablet_v2* tablet, struct wl_surface* surface) -{ - struct SDL_WaylandTabletInput* input = data; - SDL_WindowData* window; - - if (!surface) { - return; - } - - if (!SDL_WAYLAND_own_surface(surface)) { - return; - } - - window = (SDL_WindowData*)wl_surface_get_user_data(surface); - - if (window) { - input->tool_focus = window; - input->tool_prox_serial = serial; - - input->is_down = SDL_FALSE; - - input->btn_stylus = SDL_FALSE; - input->btn_stylus2 = SDL_FALSE; - input->btn_stylus3 = SDL_FALSE; - - SDL_SetMouseFocus(window->sdlwindow); - SDL_SetCursor(NULL); - } -} - -static void -tablet_tool_handle_proximity_out(void* data, struct zwp_tablet_tool_v2* tool) -{ - struct SDL_WaylandTabletInput* input = data; - - if (input->tool_focus) { - SDL_SetMouseFocus(NULL); - input->tool_focus = NULL; - } -} - -uint32_t -tablet_tool_btn_to_sdl_button(struct SDL_WaylandTabletInput* input) -{ - unsigned int tool_btn = input->btn_stylus3 << 2 | input->btn_stylus2 << 1 | input->btn_stylus << 0; - switch (tool_btn) { - case 0b000: - return SDL_BUTTON_LEFT; - case 0b001: - return SDL_BUTTON_RIGHT; - case 0b010: - return SDL_BUTTON_MIDDLE; - case 0b100: - return SDL_BUTTON_X1; - default: - return SDL_BUTTON_LEFT; - } -} - -static void -tablet_tool_handle_down(void* data, struct zwp_tablet_tool_v2* tool, uint32_t serial) -{ - struct SDL_WaylandTabletInput* input = data; - SDL_WindowData* window = input->tool_focus; - input->is_down = SDL_TRUE; - if (!window) { - /* tablet_tool_handle_proximity_out gets called when moving over the libdecoration csd. - * that sets input->tool_focus (window) to NULL, but handle_{down,up} events are still - * received. To prevent SIGSEGV this returns when this is the case. - */ - return; - } - - SDL_SendMouseButton(window->sdlwindow, 0, SDL_PRESSED, tablet_tool_btn_to_sdl_button(input)); -} - -static void -tablet_tool_handle_up(void* data, struct zwp_tablet_tool_v2* tool) -{ - struct SDL_WaylandTabletInput* input = data; - SDL_WindowData* window = input->tool_focus; - - input->is_down = SDL_FALSE; - - if (!window) { - /* tablet_tool_handle_proximity_out gets called when moving over the libdecoration csd. - * that sets input->tool_focus (window) to NULL, but handle_{down,up} events are still - * received. To prevent SIGSEGV this returns when this is the case. - */ - return; - } - - SDL_SendMouseButton(window->sdlwindow, 0, SDL_RELEASED, tablet_tool_btn_to_sdl_button(input)); -} - -static void -tablet_tool_handle_motion(void* data, struct zwp_tablet_tool_v2* tool, wl_fixed_t sx_w, wl_fixed_t sy_w) -{ - struct SDL_WaylandTabletInput* input = data; - SDL_WindowData* window = input->tool_focus; - - input->sx_w = sx_w; - input->sy_w = sy_w; - if (input->tool_focus) { - const float sx_f = (float)wl_fixed_to_double(sx_w); - const float sy_f = (float)wl_fixed_to_double(sy_w); - const int sx = (int)SDL_floorf(sx_f * window->pointer_scale_x); - const int sy = (int)SDL_floorf(sy_f * window->pointer_scale_y); - SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy); - } -} - -static void -tablet_tool_handle_pressure(void* data, struct zwp_tablet_tool_v2* tool, uint32_t pressure) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_distance(void* data, struct zwp_tablet_tool_v2* tool, uint32_t distance) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_tilt(void* data, struct zwp_tablet_tool_v2* tool, wl_fixed_t xtilt, wl_fixed_t ytilt) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_button(void* data, struct zwp_tablet_tool_v2* tool, uint32_t serial, uint32_t button, uint32_t state) -{ - struct SDL_WaylandTabletInput* input = data; - - if (input->is_down) { - tablet_tool_handle_up(data, tool); - input->is_down = SDL_TRUE; - } - - switch (button) { - /* see %{_includedir}/linux/input-event-codes.h */ - case 0x14b: /* BTN_STYLUS */ - input->btn_stylus = state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ? SDL_TRUE : SDL_FALSE; - break; - case 0x14c: /* BTN_STYLUS2 */ - input->btn_stylus2 = state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ? SDL_TRUE : SDL_FALSE; - break; - case 0x149: /* BTN_STYLUS3 */ - input->btn_stylus3 = state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED ? SDL_TRUE : SDL_FALSE; - break; - } - - if (input->is_down) { - tablet_tool_handle_down(data, tool, serial); - } -} - -static void -tablet_tool_handle_rotation(void* data, struct zwp_tablet_tool_v2* tool, wl_fixed_t degrees) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_slider(void* data, struct zwp_tablet_tool_v2* tool, int32_t position) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_wheel(void* data, struct zwp_tablet_tool_v2* tool, int32_t degrees, int32_t clicks) -{ - /* unimplemented */ -} - -static void -tablet_tool_handle_frame(void* data, struct zwp_tablet_tool_v2* tool, uint32_t time) -{ - /* unimplemented */ -} - - -static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = { - tablet_tool_handle_type, - tablet_tool_handle_hardware_serial, - tablet_tool_handle_hardware_id_wacom, - tablet_tool_handle_capability, - tablet_tool_handle_done, - tablet_tool_handle_removed, - tablet_tool_handle_proximity_in, - tablet_tool_handle_proximity_out, - tablet_tool_handle_down, - tablet_tool_handle_up, - tablet_tool_handle_motion, - tablet_tool_handle_pressure, - tablet_tool_handle_distance, - tablet_tool_handle_tilt, - tablet_tool_handle_rotation, - tablet_tool_handle_slider, - tablet_tool_handle_wheel, - tablet_tool_handle_button, - tablet_tool_handle_frame -}; - -struct SDL_WaylandTabletObjectListNode* -tablet_object_list_new_node(void* object) -{ - struct SDL_WaylandTabletObjectListNode* node; - - node = SDL_calloc(1, sizeof *node); - if (node == NULL) { - return NULL; - } - - node->next = NULL; - node->object = object; - - return node; -} - -void tablet_object_list_append(struct SDL_WaylandTabletObjectListNode* head, void* object) -{ - if (head->object == NULL) { - head->object = object; - return; - } - - while (head->next) { - head = head->next; - } - - head->next = tablet_object_list_new_node(object); -} - -void tablet_object_list_destroy(struct SDL_WaylandTabletObjectListNode* head, void (*deleter)(void* object)) -{ - while (head) { - struct SDL_WaylandTabletObjectListNode* next = head->next; - if (head->object) { - (*deleter)(head->object); - } - SDL_free(head); - head = next; - } -} - - -static void -tablet_seat_handle_tablet_added(void* data, struct zwp_tablet_seat_v2* seat, struct zwp_tablet_v2* tablet) -{ - struct SDL_WaylandTabletInput* input = data; - - tablet_object_list_append(input->tablets, tablet); -} - -static void -tablet_seat_handle_tool_added(void* data, struct zwp_tablet_seat_v2* seat, struct zwp_tablet_tool_v2* tool) -{ - struct SDL_WaylandTabletInput* input = data; - - zwp_tablet_tool_v2_add_listener(tool, &tablet_tool_listener, data); - zwp_tablet_tool_v2_set_user_data(tool, data); - - tablet_object_list_append(input->tools, tool); -} - -static void -tablet_seat_handle_pad_added(void* data, struct zwp_tablet_seat_v2* seat, struct zwp_tablet_pad_v2* pad) -{ - struct SDL_WaylandTabletInput* input = data; - - tablet_object_list_append(input->pads, pad); -} - -static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = { - tablet_seat_handle_tablet_added, - tablet_seat_handle_tool_added, - tablet_seat_handle_pad_added -}; - -void -Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_WaylandTabletManager* tablet_manager) -{ - struct SDL_WaylandTabletInput* tablet_input; - - if (!tablet_manager || !input || !input->seat) { - return; - } - - tablet_input = SDL_calloc(1, sizeof *tablet_input); - if (tablet_input == NULL) { - return; - } - - input->tablet = tablet_input; - - tablet_input->seat = (struct SDL_WaylandTabletSeat*)zwp_tablet_manager_v2_get_tablet_seat((struct zwp_tablet_manager_v2*)tablet_manager, input->seat); - - tablet_input->tablets = tablet_object_list_new_node(NULL); - tablet_input->tools = tablet_object_list_new_node(NULL); - tablet_input->pads = tablet_object_list_new_node(NULL); - - zwp_tablet_seat_v2_add_listener((struct zwp_tablet_seat_v2*)tablet_input->seat, &tablet_seat_listener, tablet_input); -} - -#define TABLET_OBJECT_LIST_DELETER(fun) (void (*)(void*))fun -void -Wayland_input_destroy_tablet(struct SDL_WaylandInput* input) -{ - tablet_object_list_destroy(input->tablet->pads, TABLET_OBJECT_LIST_DELETER(zwp_tablet_pad_v2_destroy)); - tablet_object_list_destroy(input->tablet->tools, TABLET_OBJECT_LIST_DELETER(zwp_tablet_tool_v2_destroy)); - tablet_object_list_destroy(input->tablet->tablets, TABLET_OBJECT_LIST_DELETER(zwp_tablet_v2_destroy)); - - zwp_tablet_seat_v2_destroy((struct zwp_tablet_seat_v2*)input->tablet->seat); - - SDL_free(input->tablet); - input->tablet = NULL; -} - void Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) { @@ -2079,7 +1542,6 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(5, version)); input->sx_w = wl_fixed_from_int(0); input->sy_w = wl_fixed_from_int(0); - input->xkb.current_group = ~0; d->input = input; if (d->data_device_manager != NULL) { @@ -2092,10 +1554,6 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) wl_seat_add_listener(input->seat, &seat_listener, input); wl_seat_set_user_data(input->seat, input); - if (d->tablet_manager) { - Wayland_input_add_tablet(input, d->tablet_manager); - } - WAYLAND_wl_display_flush(d->display); } @@ -2136,10 +1594,6 @@ void Wayland_display_destroy_input(SDL_VideoData *d) wl_touch_destroy(input->touch); } - if (input->tablet) { - Wayland_input_destroy_tablet(input); - } - if (input->seat) wl_seat_destroy(input->seat); @@ -2380,19 +1834,12 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi if (SDL_RectEmpty(&window->mouse_rect)) { confine_rect = NULL; } else { - SDL_Rect scaled_mouse_rect; - - scaled_mouse_rect.x = (int)SDL_floorf((float)window->mouse_rect.x / w->pointer_scale_x); - scaled_mouse_rect.y = (int)SDL_floorf((float)window->mouse_rect.y / w->pointer_scale_y); - scaled_mouse_rect.w = (int)SDL_ceilf((float)window->mouse_rect.w / w->pointer_scale_x); - scaled_mouse_rect.h = (int)SDL_ceilf((float)window->mouse_rect.h / w->pointer_scale_y); - confine_rect = wl_compositor_create_region(d->compositor); wl_region_add(confine_rect, - scaled_mouse_rect.x, - scaled_mouse_rect.y, - scaled_mouse_rect.w, - scaled_mouse_rect.h); + window->mouse_rect.x, + window->mouse_rect.y, + window->mouse_rect.w, + window->mouse_rect.h); } confined_pointer = diff --git a/externals/SDL/src/video/wayland/SDL_waylandevents_c.h b/externals/SDL/src/video/wayland/SDL_waylandevents_c.h index 59dc0c8af..24256a7d0 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandevents_c.h +++ b/externals/SDL/src/video/wayland/SDL_waylandevents_c.h @@ -29,34 +29,6 @@ #include "SDL_waylanddatamanager.h" #include "SDL_waylandkeyboard.h" -struct SDL_WaylandTabletSeat; - -struct SDL_WaylandTabletObjectListNode { - void* object; - struct SDL_WaylandTabletObjectListNode* next; -}; - -struct SDL_WaylandTabletInput { - struct SDL_WaylandTabletSeat* seat; - - struct SDL_WaylandTabletObjectListNode* tablets; - struct SDL_WaylandTabletObjectListNode* tools; - struct SDL_WaylandTabletObjectListNode* pads; - - SDL_WindowData *tool_focus; - uint32_t tool_prox_serial; - - /* Last motion location */ - wl_fixed_t sx_w; - wl_fixed_t sy_w; - - SDL_bool is_down; - - SDL_bool btn_stylus; - SDL_bool btn_stylus2; - SDL_bool btn_stylus3; -}; - typedef struct { // repeat_rate in range of [1, 1000] int32_t repeat_rate; @@ -96,17 +68,6 @@ struct SDL_WaylandInput { struct xkb_state *state; struct xkb_compose_table *compose_table; struct xkb_compose_state *compose_state; - - /* Keyboard layout "group" */ - uint32_t current_group; - - /* Modifier bitshift values */ - uint32_t idx_shift; - uint32_t idx_ctrl; - uint32_t idx_alt; - uint32_t idx_gui; - uint32_t idx_num; - uint32_t idx_caps; } xkb; /* information about axis events on current frame */ @@ -119,8 +80,6 @@ struct SDL_WaylandInput { } pointer_curr_axis_info; SDL_WaylandKeyboardRepeat keyboard_repeat; - - struct SDL_WaylandTabletInput* tablet; }; extern void Wayland_PumpEvents(_THIS); @@ -148,9 +107,6 @@ extern void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d); extern int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *input); extern int Wayland_input_ungrab_keyboard(SDL_Window *window); -extern void Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_WaylandTabletManager* tablet_manager); -extern void Wayland_input_destroy_tablet(struct SDL_WaylandInput *input); - #endif /* SDL_waylandevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/wayland/SDL_waylandkeyboard.h b/externals/SDL/src/video/wayland/SDL_waylandkeyboard.h index 604e0f37f..dd8c146e6 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandkeyboard.h +++ b/externals/SDL/src/video/wayland/SDL_waylandkeyboard.h @@ -27,7 +27,6 @@ typedef struct SDL_WaylandTextInput { struct zwp_text_input_v3 *text_input; SDL_Rect cursor_rect; - SDL_bool has_preedit; } SDL_WaylandTextInput; extern int Wayland_InitKeyboard(_THIS); diff --git a/externals/SDL/src/video/wayland/SDL_waylandopengles.c b/externals/SDL/src/video/wayland/SDL_waylandopengles.c index 26626ee51..6b10cbee7 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandopengles.c +++ b/externals/SDL/src/video/wayland/SDL_waylandopengles.c @@ -140,9 +140,9 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) /* wl_display_prepare_read_queue() will return -1 if the event queue is not empty. * If the event queue is empty, it will prepare us for our SDL_IOReady() call. */ - if (WAYLAND_wl_display_prepare_read_queue(display, data->gles_swap_frame_event_queue) != 0) { + if (WAYLAND_wl_display_prepare_read_queue(display, data->frame_event_queue) != 0) { /* We have some pending events. Check if the frame callback happened. */ - WAYLAND_wl_display_dispatch_queue_pending(display, data->gles_swap_frame_event_queue); + WAYLAND_wl_display_dispatch_queue_pending(display, data->frame_event_queue); continue; } @@ -163,7 +163,7 @@ Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) /* We have events. Read and dispatch them. */ WAYLAND_wl_display_read_events(display); - WAYLAND_wl_display_dispatch_queue_pending(display, data->gles_swap_frame_event_queue); + WAYLAND_wl_display_dispatch_queue_pending(display, data->frame_event_queue); } SDL_AtomicSet(&data->swap_interval_ready, 0); } @@ -205,11 +205,11 @@ Wayland_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) data = (SDL_WindowData *) window->driverdata; if (w) { - *w = data->drawable_width; + *w = window->w * data->scale_factor; } if (h) { - *h = data->drawable_height; + *h = window->h * data->scale_factor; } } } diff --git a/externals/SDL/src/video/wayland/SDL_waylandsym.h b/externals/SDL/src/video/wayland/SDL_waylandsym.h index 0473fa1b1..366ce9e94 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandsym.h +++ b/externals/SDL/src/video/wayland/SDL_waylandsym.h @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ #ifndef SDL_WAYLAND_MODULE #define SDL_WAYLAND_MODULE(modname) @@ -72,19 +72,21 @@ SDL_WAYLAND_SYM(void, wl_list_remove, (struct wl_list *)) SDL_WAYLAND_SYM(int, wl_list_length, (const struct wl_list *)) SDL_WAYLAND_SYM(int, wl_list_empty, (const struct wl_list *)) SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *)) + +/* These functions are available in Wayland >= 1.4 */ +SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...)) + +SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_10) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor_versioned, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...)) + +SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_18) SDL_WAYLAND_SYM(void, wl_proxy_set_tag, (struct wl_proxy *, const char * const *)) SDL_WAYLAND_SYM(const char * const *, wl_proxy_get_tag, (struct wl_proxy *)) -#if SDL_WAYLAND_CHECK_VERSION(1, 20, 0) -/* wayland-scanner 1.20 generates code that will call these, so these are - * non-optional when we are compiling against Wayland 1.20. We don't - * explicitly call them ourselves, though, so if we are only compiling - * against Wayland 1.18, they're unnecessary. */ +SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_20) SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interfac, uint32_t version, uint32_t flags, ...)) SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_array_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, uint32_t flags, union wl_argument *args)) -#endif SDL_WAYLAND_INTERFACE(wl_seat_interface) SDL_WAYLAND_INTERFACE(wl_surface_interface) @@ -120,7 +122,6 @@ SDL_WAYLAND_SYM(int, xkb_state_key_get_syms, (struct xkb_state *, xkb_keycode_t, SDL_WAYLAND_SYM(int, xkb_keysym_to_utf8, (xkb_keysym_t, char *, size_t) ) SDL_WAYLAND_SYM(struct xkb_keymap *, xkb_keymap_new_from_string, (struct xkb_context *, const char *, enum xkb_keymap_format, enum xkb_keymap_compile_flags)) SDL_WAYLAND_SYM(struct xkb_state *, xkb_state_new, (struct xkb_keymap *) ) -SDL_WAYLAND_SYM(int, xkb_keymap_key_repeats, (struct xkb_keymap *keymap, xkb_keycode_t key) ); SDL_WAYLAND_SYM(void, xkb_keymap_unref, (struct xkb_keymap *) ) SDL_WAYLAND_SYM(void, xkb_state_unref, (struct xkb_state *) ) SDL_WAYLAND_SYM(void, xkb_context_unref, (struct xkb_context *) ) @@ -147,8 +148,6 @@ SDL_WAYLAND_SYM(int, xkb_keymap_key_get_syms_by_level, (struct xkb_keymap *, xkb_layout_index_t, const xkb_keysym_t **) ) SDL_WAYLAND_SYM(uint32_t, xkb_keysym_to_utf32, (xkb_keysym_t) ) -SDL_WAYLAND_SYM(uint32_t, xkb_keymap_mod_get_index, (struct xkb_keymap *, - const char *) ) #ifdef HAVE_LIBDECOR_H SDL_WAYLAND_MODULE(WAYLAND_LIBDECOR) @@ -204,13 +203,12 @@ SDL_WAYLAND_SYM(bool, libdecor_configuration_get_content_size, (struct libdecor_ int *)) SDL_WAYLAND_SYM(bool, libdecor_configuration_get_window_state, (struct libdecor_configuration *,\ enum libdecor_window_state *)) -SDL_WAYLAND_SYM(bool, libdecor_dispatch, (struct libdecor *, int)) #endif #undef SDL_WAYLAND_MODULE #undef SDL_WAYLAND_SYM #undef SDL_WAYLAND_INTERFACE -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/wayland/SDL_waylandvideo.c b/externals/SDL/src/video/wayland/SDL_waylandvideo.c index 1bed2b238..f009fb7c6 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandvideo.c +++ b/externals/SDL/src/video/wayland/SDL_waylandvideo.c @@ -52,9 +52,6 @@ #include "idle-inhibit-unstable-v1-client-protocol.h" #include "xdg-activation-v1-client-protocol.h" #include "text-input-unstable-v3-client-protocol.h" -#include "tablet-unstable-v2-client-protocol.h" -#include "xdg-output-unstable-v1-client-protocol.h" -#include "viewporter-client-protocol.h" #ifdef HAVE_LIBDECOR_H #include @@ -62,9 +59,6 @@ #define WAYLANDVID_DRIVER_NAME "wayland" -static void -display_handle_done(void *data, struct wl_output *output); - /* Initialization/Query functions */ static int Wayland_VideoInit(_THIS); @@ -139,22 +133,32 @@ static const char *SDL_WAYLAND_output_tag = "sdl-output"; void SDL_WAYLAND_register_surface(struct wl_surface *surface) { - wl_proxy_set_tag((struct wl_proxy *)surface, &SDL_WAYLAND_surface_tag); + if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_18) { + wl_proxy_set_tag((struct wl_proxy *)surface, &SDL_WAYLAND_surface_tag); + } } void SDL_WAYLAND_register_output(struct wl_output *output) { - wl_proxy_set_tag((struct wl_proxy *)output, &SDL_WAYLAND_output_tag); + if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_18) { + wl_proxy_set_tag((struct wl_proxy *)output, &SDL_WAYLAND_output_tag); + } } SDL_bool SDL_WAYLAND_own_surface(struct wl_surface *surface) { - return wl_proxy_get_tag((struct wl_proxy *) surface) == &SDL_WAYLAND_surface_tag; + if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_18) { + return wl_proxy_get_tag((struct wl_proxy *) surface) == &SDL_WAYLAND_surface_tag; + } + return SDL_TRUE; /* For older clients we have to assume this is us... */ } SDL_bool SDL_WAYLAND_own_output(struct wl_output *output) { - return wl_proxy_get_tag((struct wl_proxy *) output) == &SDL_WAYLAND_output_tag; + if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT_1_18) { + return wl_proxy_get_tag((struct wl_proxy *) output) == &SDL_WAYLAND_output_tag; + } + return SDL_TRUE; /* For older clients we have to assume this is us... */ } static void @@ -226,7 +230,6 @@ Wayland_CreateDevice(int devindex) device->WaitEventTimeout = Wayland_WaitEventTimeout; device->SendWakeupEvent = Wayland_SendWakeupEvent; -#if SDL_VIDEO_OPENGL_EGL device->GL_SwapWindow = Wayland_GLES_SwapWindow; device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval; device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval; @@ -237,7 +240,6 @@ Wayland_CreateDevice(int devindex) device->GL_UnloadLibrary = Wayland_GLES_UnloadLibrary; device->GL_GetProcAddress = Wayland_GLES_GetProcAddress; device->GL_DeleteContext = Wayland_GLES_DeleteContext; -#endif device->CreateSDLWindow = Wayland_CreateWindow; device->ShowWindow = Wayland_ShowWindow; @@ -279,8 +281,6 @@ Wayland_CreateDevice(int devindex) device->free = Wayland_DeleteDevice; - device->disable_display_mode_switching = SDL_TRUE; - return device; } @@ -289,167 +289,6 @@ VideoBootStrap Wayland_bootstrap = { Wayland_CreateDevice }; -static void -xdg_output_handle_logical_position(void *data, struct zxdg_output_v1 *xdg_output, - int32_t x, int32_t y) -{ - SDL_WaylandOutputData* driverdata = data; - - driverdata->x = x; - driverdata->y = y; - driverdata->has_logical_position = SDL_TRUE; -} - -static void -xdg_output_handle_logical_size(void *data, struct zxdg_output_v1 *xdg_output, - int32_t width, int32_t height) -{ - SDL_WaylandOutputData* driverdata = data; - - if (driverdata->width != 0 && driverdata->height != 0) { - /* FIXME: GNOME has a bug where the logical size does not account for - * scale, resulting in bogus viewport sizes. - * - * Until this is fixed, validate that _some_ kind of scaling is being - * done (we can't match exactly because fractional scaling can't be - * detected otherwise), then override if necessary. - * -flibit - */ - const float scale = (float) driverdata->width / (float) width; - if ((scale == 1.0f) && (driverdata->scale_factor != 1.0f)) { - SDL_LogWarn( - SDL_LOG_CATEGORY_VIDEO, - "xdg_output scale did not match, overriding with wl_output scale" - ); - return; - } - } - - driverdata->width = width; - driverdata->height = height; - driverdata->has_logical_size = SDL_TRUE; -} - -static void -xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output) -{ - SDL_WaylandOutputData* driverdata = data; - - /* - * xdg-output.done events are deprecated and only apply below version 3 of the protocol. - * A wl-output.done event will be emitted in version 3 or higher. - */ - if (zxdg_output_v1_get_version(driverdata->xdg_output) < 3) { - display_handle_done(data, driverdata->output); - } -} - -static void -xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output, - const char *name) -{ -} - -static void -xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output, - const char *description) -{ - SDL_WaylandOutputData* driverdata = data; - - if (driverdata->index == -1) { - /* xdg-output descriptions, if available, supersede wl-output model names. */ - if (driverdata->placeholder.name != NULL) { - SDL_free(driverdata->placeholder.name); - } - - driverdata->placeholder.name = SDL_strdup(description); - } -} - -static const struct zxdg_output_v1_listener xdg_output_listener = { - xdg_output_handle_logical_position, - xdg_output_handle_logical_size, - xdg_output_handle_done, - xdg_output_handle_name, - xdg_output_handle_description, -}; - -static void -AddEmulatedModes(SDL_VideoDisplay *dpy, SDL_bool rot_90) -{ - struct EmulatedMode - { - int w; - int h; - }; - - /* Resolution lists courtesy of XWayland */ - const struct EmulatedMode mode_list[] = { - /* 16:9 (1.77) */ - { 7680, 4320 }, - { 6144, 3160 }, - { 5120, 2880 }, - { 4096, 2304 }, - { 3840, 2160 }, - { 3200, 1800 }, - { 2880, 1620 }, - { 2560, 1440 }, - { 2048, 1152 }, - { 1920, 1080 }, - { 1600, 900 }, - { 1368, 768 }, - { 1280, 720 }, - { 864, 486 }, - - /* 16:10 (1.6) */ - { 2560, 1600 }, - { 1920, 1200 }, - { 1680, 1050 }, - { 1440, 900 }, - { 1280, 800 }, - - /* 3:2 (1.5) */ - { 720, 480 }, - - /* 4:3 (1.33) */ - { 2048, 1536 }, - { 1920, 1440 }, - { 1600, 1200 }, - { 1440, 1080 }, - { 1400, 1050 }, - { 1280, 1024 }, - { 1280, 960 }, - { 1152, 864 }, - { 1024, 768 }, - { 800, 600 }, - { 640, 480 } - }; - - int i; - SDL_DisplayMode mode; - const int native_width = dpy->display_modes->w; - const int native_height = dpy->display_modes->h; - - for (i = 0; i < SDL_arraysize(mode_list); ++i) { - mode = *dpy->display_modes; - - if (rot_90) { - mode.w = mode_list[i].h; - mode.h = mode_list[i].w; - } else { - mode.w = mode_list[i].w; - mode.h = mode_list[i].h; - } - - /* Only add modes that are smaller than the native mode. */ - if ((mode.w < native_width && mode.h < native_height) || - (mode.w < native_width && mode.h == native_height) || - (mode.w == native_width && mode.h < native_height)) { - SDL_AddDisplayMode(dpy, &mode); - } - } -} - static void display_handle_geometry(void *data, struct wl_output *output, @@ -466,7 +305,7 @@ display_handle_geometry(void *data, SDL_VideoDisplay *display; int i; - if (driverdata->wl_output_done_count) { + if (driverdata->done) { /* Clear the wl_output ref so Reset doesn't free it */ display = SDL_GetDisplay(driverdata->index); for (i = 0; i < display->num_display_modes; i += 1) { @@ -477,19 +316,14 @@ display_handle_geometry(void *data, SDL_ResetDisplayModes(driverdata->index); /* The display has officially started over. */ - driverdata->wl_output_done_count = 0; + driverdata->done = SDL_FALSE; } - /* Apply the change from wl-output only if xdg-output is not supported */ - if (!driverdata->has_logical_position) { - driverdata->x = x; - driverdata->y = y; - } + driverdata->x = x; + driverdata->y = y; driverdata->physical_width = physical_width; driverdata->physical_height = physical_height; - - /* The output name is only set if xdg-output hasn't provided a description. */ - if (driverdata->index == -1 && driverdata->placeholder.name == NULL) { + if (driverdata->index == -1) { driverdata->placeholder.name = SDL_strdup(model); } @@ -533,22 +367,37 @@ display_handle_mode(void *data, int refresh) { SDL_WaylandOutputData* driverdata = data; + SDL_DisplayMode mode; if (flags & WL_OUTPUT_MODE_CURRENT) { - driverdata->native_width = width; - driverdata->native_height = height; - - /* - * Don't rotate this yet, wl-output coordinates are transformed in - * handle_done and xdg-output coordinates are pre-transformed. - */ - if (!driverdata->has_logical_size) { - driverdata->width = width; - driverdata->height = height; - } - + /* Don't rotate this yet, handle_done will do it later */ + driverdata->width = width; + driverdata->height = height; driverdata->refresh = refresh; } + + /* Note that the width/height are NOT multiplied by scale_factor! + * This is intentional and is designed to get the unscaled modes, which is + * important for high-DPI games intending to use the display mode as the + * target drawable size. The scaled desktop mode will be added at the end + * when display_handle_done is called (see below). + */ + SDL_zero(mode); + mode.format = SDL_PIXELFORMAT_RGB888; + if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) { + mode.w = height; + mode.h = width; + } else { + mode.w = width; + mode.h = height; + } + mode.refresh_rate = refresh / 1000; /* mHz to Hz */ + mode.driverdata = driverdata->output; + if (driverdata->index > -1) { + SDL_AddDisplayMode(SDL_GetDisplay(driverdata->index), &mode); + } else { + SDL_AddDisplayMode(&driverdata->placeholder, &mode); + } } static void @@ -556,75 +405,20 @@ display_handle_done(void *data, struct wl_output *output) { SDL_WaylandOutputData* driverdata = data; - SDL_VideoData* video = driverdata->videodata; - SDL_DisplayMode native_mode, desktop_mode; + SDL_DisplayMode mode; SDL_VideoDisplay *dpy; - const SDL_bool mode_emulation_enabled = SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION, SDL_TRUE); - /* - * When using xdg-output, two wl-output.done events will be emitted: - * one at the completion of wl-display and one at the completion of xdg-output. - * - * All required events must be received before proceeding. - */ - const int event_await_count = 1 + (driverdata->xdg_output != NULL); - - driverdata->wl_output_done_count = SDL_min(driverdata->wl_output_done_count + 1, event_await_count + 1); - - if (driverdata->wl_output_done_count != event_await_count) { + if (driverdata->done) return; - } - /* The native display resolution */ - SDL_zero(native_mode); - native_mode.format = SDL_PIXELFORMAT_RGB888; + driverdata->done = SDL_TRUE; + SDL_zero(mode); + mode.format = SDL_PIXELFORMAT_RGB888; if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) { - native_mode.w = driverdata->native_height; - native_mode.h = driverdata->native_width; - } else { - native_mode.w = driverdata->native_width; - native_mode.h = driverdata->native_height; - } - native_mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ - native_mode.driverdata = driverdata->output; + mode.w = driverdata->height / driverdata->scale_factor; + mode.h = driverdata->width / driverdata->scale_factor; - /* The scaled desktop mode */ - SDL_zero(desktop_mode); - desktop_mode.format = SDL_PIXELFORMAT_RGB888; - - if (driverdata->has_logical_size) { /* If xdg-output is present, calculate the true scale of the desktop */ - driverdata->scale_factor = (float)native_mode.w / (float)driverdata->width; - } else { /* Scale the desktop coordinates, if xdg-output isn't present */ - driverdata->width /= driverdata->scale_factor; - driverdata->height /= driverdata->scale_factor; - } - - /* xdg-output dimensions are already transformed, so no need to rotate. */ - if (driverdata->has_logical_size || !(driverdata->transform & WL_OUTPUT_TRANSFORM_90)) { - desktop_mode.w = driverdata->width; - desktop_mode.h = driverdata->height; - } else { - desktop_mode.w = driverdata->height; - desktop_mode.h = driverdata->width; - } - desktop_mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ - desktop_mode.driverdata = driverdata->output; - - /* - * The native display mode is only exposed separately from the desktop size if the - * desktop is scaled and the wp_viewporter protocol is supported. - */ - if (driverdata->scale_factor > 1.0f && video->viewporter != NULL) { - if (driverdata->index > -1) { - SDL_AddDisplayMode(SDL_GetDisplay(driverdata->index), &native_mode); - } else { - SDL_AddDisplayMode(&driverdata->placeholder, &native_mode); - } - } - - /* Calculate the display DPI */ - if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) { driverdata->hdpi = driverdata->physical_height ? (((float) driverdata->height) * 25.4f / driverdata->physical_height) : 0.0f; @@ -636,6 +430,9 @@ display_handle_done(void *data, ((float) driverdata->physical_height) / 25.4f, ((float) driverdata->physical_width) / 25.4f); } else { + mode.w = driverdata->width / driverdata->scale_factor; + mode.h = driverdata->height / driverdata->scale_factor; + driverdata->hdpi = driverdata->physical_width ? (((float) driverdata->width) * 25.4f / driverdata->physical_width) : 0.0f; @@ -647,6 +444,8 @@ display_handle_done(void *data, ((float) driverdata->physical_width) / 25.4f, ((float) driverdata->physical_height) / 25.4f); } + mode.refresh_rate = driverdata->refresh / 1000; /* mHz to Hz */ + mode.driverdata = driverdata->output; if (driverdata->index > -1) { dpy = SDL_GetDisplay(driverdata->index); @@ -654,16 +453,9 @@ display_handle_done(void *data, dpy = &driverdata->placeholder; } - SDL_AddDisplayMode(dpy, &desktop_mode); - SDL_SetCurrentDisplayMode(dpy, &desktop_mode); - SDL_SetDesktopDisplayMode(dpy, &desktop_mode); - - /* Add emulated modes if wp_viewporter is supported and mode emulation is enabled. */ - if (video->viewporter && mode_emulation_enabled) { - const SDL_bool rot_90 = ((driverdata->transform & WL_OUTPUT_TRANSFORM_90) != 0) || - (driverdata->width < driverdata->height); - AddEmulatedModes(dpy, rot_90); - } + SDL_AddDisplayMode(dpy, &mode); + SDL_SetCurrentDisplayMode(dpy, &mode); + SDL_SetDesktopDisplayMode(dpy, &mode); if (driverdata->index == -1) { /* First time getting display info, create the VideoDisplay */ @@ -710,29 +502,11 @@ Wayland_add_display(SDL_VideoData *d, uint32_t id) data->videodata = d; data->output = output; data->registry_id = id; - data->scale_factor = 1.0f; + data->scale_factor = 1.0; data->index = -1; wl_output_add_listener(output, &output_listener, data); SDL_WAYLAND_register_output(output); - - /* Keep a list of outputs for deferred xdg-output initialization. */ - if (d->output_list != NULL) { - SDL_WaylandOutputData *node = (SDL_WaylandOutputData*)d->output_list; - - while (node->next != NULL) { - node = (SDL_WaylandOutputData*)node->next; - } - - node->next = (struct SDL_WaylandOutputData*)data; - } else { - d->output_list = (struct SDL_WaylandOutputData*)data; - } - - if (data->videodata->xdg_output_manager) { - data->xdg_output = zxdg_output_manager_v1_get_xdg_output(data->videodata->xdg_output_manager, output); - zxdg_output_v1_add_listener(data->xdg_output, &xdg_output_listener, data); - } } static void @@ -748,9 +522,6 @@ Wayland_free_display(uint32_t id) data = (SDL_WaylandOutputData *) display->driverdata; if (data->registry_id == id) { SDL_DelVideoDisplay(i); - if (data->xdg_output) { - zxdg_output_v1_destroy(data->xdg_output); - } wl_output_destroy(data->output); SDL_free(data); @@ -767,16 +538,6 @@ Wayland_free_display(uint32_t id) } } -static void -Wayland_init_xdg_output(SDL_VideoData *d) -{ - SDL_WaylandOutputData *node; - for (node = d->output_list; node != NULL; node = node->next) { - node->xdg_output = zxdg_output_manager_v1_get_xdg_output(node->videodata->xdg_output_manager, node->output); - zxdg_output_v1_add_listener(node->xdg_output, &xdg_output_listener, node); - } -} - #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH static void windowmanager_hints(void *data, struct qt_windowmanager *qt_windowmanager, @@ -837,7 +598,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, } else if (SDL_strcmp(interface, "wl_seat") == 0) { Wayland_display_add_input(d, id, version); } else if (SDL_strcmp(interface, "xdg_wm_base") == 0) { - d->shell.xdg = wl_registry_bind(d->registry, id, &xdg_wm_base_interface, SDL_min(version, 3)); + d->shell.xdg = wl_registry_bind(d->registry, id, &xdg_wm_base_interface, 1); xdg_wm_base_add_listener(d->shell.xdg, &shell_listener_xdg, NULL); } else if (SDL_strcmp(interface, "wl_shm") == 0) { d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); @@ -857,17 +618,6 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, Wayland_add_data_device_manager(d, id, version); } else if (SDL_strcmp(interface, "zxdg_decoration_manager_v1") == 0) { d->decoration_manager = wl_registry_bind(d->registry, id, &zxdg_decoration_manager_v1_interface, 1); - } else if (SDL_strcmp(interface, "zwp_tablet_manager_v2") == 0) { - d->tablet_manager = wl_registry_bind(d->registry, id, &zwp_tablet_manager_v2_interface, 1); - if (d->input) { - Wayland_input_add_tablet(d->input, d->tablet_manager); - } - } else if (SDL_strcmp(interface, "zxdg_output_manager_v1") == 0) { - version = SDL_min(version, 3); /* Versions 1 through 3 are supported. */ - d->xdg_output_manager = wl_registry_bind(d->registry, id, &zxdg_output_manager_v1_interface, version); - Wayland_init_xdg_output(d); - } else if (SDL_strcmp(interface, "wp_viewporter") == 0) { - d->viewporter = wl_registry_bind(d->registry, id, &wp_viewporter_interface, 1); #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH } else if (SDL_strcmp(interface, "qt_touch_extension") == 0) { @@ -894,48 +644,6 @@ static const struct wl_registry_listener registry_listener = { display_handle_global, display_remove_global }; - -#ifdef HAVE_LIBDECOR_H -static SDL_bool should_use_libdecor(SDL_VideoData *data, SDL_bool ignore_xdg) -{ - if (!SDL_WAYLAND_HAVE_WAYLAND_LIBDECOR) { - return SDL_FALSE; - } - - if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR, SDL_TRUE)) { - return SDL_FALSE; - } - - if (SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR, SDL_FALSE)) { - return SDL_TRUE; - } - - if (ignore_xdg) { - return SDL_TRUE; - } - - if (data->decoration_manager) { - return SDL_FALSE; - } - - return SDL_TRUE; -} -#endif - -SDL_bool -Wayland_LoadLibdecor(SDL_VideoData *data, SDL_bool ignore_xdg) -{ -#ifdef HAVE_LIBDECOR_H - if (data->shell.libdecor != NULL) { - return SDL_TRUE; /* Already loaded! */ - } - if (should_use_libdecor(data, ignore_xdg)) { - data->shell.libdecor = libdecor_new(data->display, &libdecor_interface); - return data->shell.libdecor != NULL; - } -#endif - return SDL_FALSE; -} int Wayland_VideoInit(_THIS) @@ -957,8 +665,18 @@ Wayland_VideoInit(_THIS) // First roundtrip to receive all registry objects. WAYLAND_wl_display_roundtrip(data->display); - /* Now that we have all the protocols, load libdecor if applicable */ - Wayland_LoadLibdecor(data, SDL_FALSE); +#ifdef HAVE_LIBDECOR_H + /* Don't have server-side decorations? Try client-side instead. */ + if (!data->decoration_manager && SDL_WAYLAND_HAVE_WAYLAND_LIBDECOR && SDL_GetHintBoolean(SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR, SDL_TRUE)) { + data->shell.libdecor = libdecor_new(data->display, &libdecor_interface); + + /* If libdecor works, we don't need xdg-shell anymore. */ + if (data->shell.libdecor && data->shell.xdg) { + xdg_wm_base_destroy(data->shell.xdg); + data->shell.xdg = NULL; + } + } +#endif // Second roundtrip to receive all output events. WAYLAND_wl_display_roundtrip(data->display); @@ -1017,10 +735,6 @@ Wayland_VideoQuit(_THIS) for (i = 0; i < _this->num_displays; ++i) { SDL_VideoDisplay *display = &_this->displays[i]; - if (((SDL_WaylandOutputData*)display->driverdata)->xdg_output) { - zxdg_output_v1_destroy(((SDL_WaylandOutputData*)display->driverdata)->xdg_output); - } - wl_output_destroy(((SDL_WaylandOutputData*)display->driverdata)->output); SDL_free(display->driverdata); display->driverdata = NULL; @@ -1063,9 +777,6 @@ Wayland_VideoQuit(_THIS) Wayland_touch_destroy(data); #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - if (data->tablet_manager) - zwp_tablet_manager_v2_destroy((struct zwp_tablet_manager_v2*)data->tablet_manager); - if (data->data_device_manager) wl_data_device_manager_destroy(data->data_device_manager); @@ -1085,14 +796,6 @@ Wayland_VideoQuit(_THIS) } #endif - if (data->xdg_output_manager) { - zxdg_output_manager_v1_destroy(data->xdg_output_manager); - } - - if (data->viewporter) { - wp_viewporter_destroy(data->viewporter); - } - if (data->compositor) wl_compositor_destroy(data->compositor); diff --git a/externals/SDL/src/video/wayland/SDL_waylandvideo.h b/externals/SDL/src/video/wayland/SDL_waylandvideo.h index 9b2d6835f..31168a9d5 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandvideo.h +++ b/externals/SDL/src/video/wayland/SDL_waylandvideo.h @@ -34,7 +34,6 @@ struct xkb_context; struct SDL_WaylandInput; -struct SDL_WaylandTabletManager; #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH struct SDL_WaylandTouch; @@ -47,8 +46,6 @@ typedef struct { int size; } SDL_WaylandCursorTheme; -typedef struct SDL_WaylandOutputData SDL_WaylandOutputData; - typedef struct { SDL_bool initializing; struct wl_display *display; @@ -73,8 +70,6 @@ typedef struct { struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager; struct xdg_activation_v1 *activation_manager; struct zwp_text_input_manager_v3 *text_input_manager; - struct zxdg_output_manager_v1 *xdg_output_manager; - struct wp_viewporter *viewporter; EGLDisplay edpy; EGLContext context; @@ -82,8 +77,6 @@ typedef struct { struct xkb_context *xkb_context; struct SDL_WaylandInput *input; - struct SDL_WaylandTabletManager *tablet_manager; - SDL_WaylandOutputData *output_list; #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH struct SDL_WaylandTouch *touch; @@ -96,23 +89,19 @@ typedef struct { int relative_mouse_mode; } SDL_VideoData; -struct SDL_WaylandOutputData { +typedef struct { SDL_VideoData *videodata; struct wl_output *output; - struct zxdg_output_v1 *xdg_output; uint32_t registry_id; float scale_factor; - int native_width, native_height; int x, y, width, height, refresh, transform; SDL_DisplayOrientation orientation; int physical_width, physical_height; float ddpi, hdpi, vdpi; - SDL_bool has_logical_position, has_logical_size; int index; SDL_VideoDisplay placeholder; - int wl_output_done_count; - SDL_WaylandOutputData *next; -}; + SDL_bool done; +} SDL_WaylandOutputData; /* Needed here to get wl_surface declaration, fixes GitHub#4594 */ #include "SDL_waylanddyn.h" @@ -122,8 +111,6 @@ extern void SDL_WAYLAND_register_output(struct wl_output *output); extern SDL_bool SDL_WAYLAND_own_surface(struct wl_surface *surface); extern SDL_bool SDL_WAYLAND_own_output(struct wl_output *output); -extern SDL_bool Wayland_LoadLibdecor(SDL_VideoData *data, SDL_bool ignore_xdg); - #endif /* SDL_waylandvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/wayland/SDL_waylandvulkan.c b/externals/SDL/src/video/wayland/SDL_waylandvulkan.c index 90b318fc8..eb4435131 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandvulkan.c +++ b/externals/SDL/src/video/wayland/SDL_waylandvulkan.c @@ -139,11 +139,11 @@ void Wayland_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) data = (SDL_WindowData *) window->driverdata; if (w) { - *w = data->drawable_width; + *w = window->w * data->scale_factor; } if (h) { - *h = data->drawable_height; + *h = window->h * data->scale_factor; } } } diff --git a/externals/SDL/src/video/wayland/SDL_waylandwindow.c b/externals/SDL/src/video/wayland/SDL_waylandwindow.c index cfd835b76..3eae22bf7 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandwindow.c +++ b/externals/SDL/src/video/wayland/SDL_waylandwindow.c @@ -21,308 +21,33 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL #include "../SDL_sysvideo.h" #include "../../events/SDL_windowevents_c.h" -#include "../../events/SDL_mouse_c.h" #include "../SDL_egl_c.h" #include "SDL_waylandevents_c.h" #include "SDL_waylandwindow.h" #include "SDL_waylandvideo.h" #include "SDL_waylandtouch.h" #include "SDL_hints.h" -#include "SDL_events.h" #include "xdg-shell-client-protocol.h" #include "xdg-decoration-unstable-v1-client-protocol.h" #include "idle-inhibit-unstable-v1-client-protocol.h" #include "xdg-activation-v1-client-protocol.h" -#include "viewporter-client-protocol.h" #ifdef HAVE_LIBDECOR_H #include #endif -SDL_FORCE_INLINE SDL_bool -EGLTransparencyEnabled() -{ - return SDL_GetHintBoolean(SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY, SDL_FALSE); -} - -SDL_FORCE_INLINE SDL_bool -FloatEqual(float a, float b) -{ - const float diff = SDL_fabsf(a - b); - const float largest = SDL_max(SDL_fabsf(a), SDL_fabsf(b)); - - return diff <= largest * SDL_FLT_EPSILON; -} - static void -GetFullScreenDimensions(SDL_Window *window, int *width, int *height, int *drawable_width, int *drawable_height) -{ - SDL_WaylandOutputData *output = (SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata; - - int fs_width, fs_height; - int buf_width, buf_height; - - /* - * Fullscreen desktop mandates a desktop sized window, so that's what applications will get. - * If the application is DPI aware, it will need to handle the transformations between the - * differently sized window and backbuffer spaces on its own. - */ - if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { - fs_width = output->width; - fs_height = output->height; - - /* If the application is DPI aware, we can expose the true backbuffer size */ - if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - buf_width = output->native_width; - buf_height = output->native_height; - } else { - buf_width = fs_width; - buf_height = fs_height; - } - } else { - /* - * If a mode was set, use it, otherwise use the native resolution - * for DPI aware apps and the desktop size for legacy apps. - */ - if (window->fullscreen_mode.w != 0 && window->fullscreen_mode.h != 0) { - fs_width = window->fullscreen_mode.w; - fs_height = window->fullscreen_mode.h; - } else if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - fs_width = output->native_width; - fs_height = output->native_height; - } else { - fs_width = output->width; - fs_height = output->height; - } - - buf_width = fs_width; - buf_height = fs_height; - } - - if (width) { - *width = fs_width; - } - if (height) { - *height = fs_height; - } - if (drawable_width) { - *drawable_width = buf_width; - } - if (drawable_height) { - *drawable_height = buf_height; - } -} - -SDL_FORCE_INLINE SDL_bool -SurfaceScaleIsFractional(SDL_Window *window) -{ - SDL_WindowData *data = window->driverdata; - return !FloatEqual(SDL_roundf(data->scale_factor), data->scale_factor); -} - -SDL_FORCE_INLINE SDL_bool -FullscreenModeEmulation(SDL_Window *window) -{ - return (window->flags & SDL_WINDOW_FULLSCREEN) && - ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP); -} - -SDL_bool -NeedViewport(SDL_Window *window) -{ - SDL_WindowData *wind = window->driverdata; - SDL_VideoData *video = wind->waylandData; - SDL_WaylandOutputData *output = ((SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata); - int fs_width, fs_height; - - /* - * A viewport is only required when scaling is enabled and: - * - A fullscreen mode is being emulated and the mode does not match the logical desktop dimensions. - * - The desktop uses fractional scaling and the high-DPI flag is set. - */ - if (video->viewporter != NULL) { - if (FullscreenModeEmulation(window)) { - GetFullScreenDimensions(window, &fs_width, &fs_height, NULL, NULL); - if (fs_width != output->width || fs_height != output->height) { - return SDL_TRUE; - } - } else if (SurfaceScaleIsFractional(window) && (window->flags & SDL_WINDOW_ALLOW_HIGHDPI)) { - return SDL_TRUE; - } - } - - return SDL_FALSE; -} - -/* If a viewport is active, use the width and height for the window dimensions. */ -SDL_FORCE_INLINE int -GetWindowWidth(SDL_Window *window) -{ - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - return SDL_RectEmpty(&data->viewport_rect) ? window->w : data->viewport_rect.w; -} - -SDL_FORCE_INLINE int -GetWindowHeight(SDL_Window *window) -{ - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - return SDL_RectEmpty(&data->viewport_rect) ? window->h : data->viewport_rect.h; -} - -static void -GetBufferSize(SDL_Window *window, int *width, int *height) -{ - SDL_WindowData *data = window->driverdata; - int buf_width; - int buf_height; - - if (FullscreenModeEmulation(window)) { - GetFullScreenDimensions(window, NULL, NULL, &buf_width, &buf_height); - } else if (NeedViewport(window)) { - buf_width = (int)SDL_ceil(window->w * data->scale_factor); - buf_height = (int)SDL_ceil(window->h * data->scale_factor); - } else { - /* - * Integer scaled windowed or fullscreen with no viewport - * - * Round the scale factor up in the unlikely scenario of a compositor - * that supports fractional scaling, but not viewports. - */ - int scale_factor = (int)SDL_ceilf(data->scale_factor); - - buf_width = window->w * scale_factor; - buf_height = window->h * scale_factor; - } - - if (width) { - *width = buf_width; - } - if (height) { - *height = buf_height; - } -} - -static void -SetDrawSurfaceViewport(SDL_Window *window, int src_width, int src_height, int dst_width, int dst_height) -{ - SDL_WindowData *wind = window->driverdata; - SDL_VideoData *video = wind->waylandData; - - if (video->viewporter) { - if (wind->draw_viewport == NULL) { - wind->draw_viewport = wp_viewporter_get_viewport(video->viewporter, wind->surface); - } - - wp_viewport_set_source(wind->draw_viewport, wl_fixed_from_int(0), wl_fixed_from_int(0), wl_fixed_from_int(src_width), wl_fixed_from_int(src_height)); - wp_viewport_set_destination(wind->draw_viewport, dst_width, dst_height); - } -} - -static void -UnsetDrawSurfaceViewport(SDL_Window *window) -{ - SDL_WindowData *wind = window->driverdata; - - if (wind->draw_viewport) { - wp_viewport_destroy(wind->draw_viewport); - wind->draw_viewport = NULL; - } -} - -static void -ConfigureWindowGeometry(SDL_Window *window) -{ - SDL_WindowData *data = window->driverdata; - SDL_VideoData *viddata = data->waylandData; - SDL_WaylandOutputData *output = (SDL_WaylandOutputData *)SDL_GetDisplayForWindow(window)->driverdata; - struct wl_region *region; - - /* Set the drawable backbuffer size. */ - GetBufferSize(window, &data->drawable_width, &data->drawable_height); - - if (data->egl_window) { - WAYLAND_wl_egl_window_resize(data->egl_window, - data->drawable_width, - data->drawable_height, - 0, 0); - } - - if (FullscreenModeEmulation(window) && NeedViewport(window)) { - int fs_width, fs_height; - int src_width, src_height; - - GetFullScreenDimensions(window, &fs_width, &fs_height, &src_width, &src_height); - - /* Set the buffer scale to 1 since a viewport will be used. */ - wl_surface_set_buffer_scale(data->surface, 1); - SetDrawSurfaceViewport(window, src_width, src_height, output->width, output->height); - - data->viewport_rect.x = 0; - data->viewport_rect.y = 0; - data->viewport_rect.w = output->width; - data->viewport_rect.h = output->height; - - data->pointer_scale_x = (float)fs_width / (float)output->width; - data->pointer_scale_y = (float)fs_height / (float)output->height; - - if (!EGLTransparencyEnabled()) { - region = wl_compositor_create_region(viddata->compositor); - wl_region_add(region, data->viewport_rect.x, data->viewport_rect.y, - data->viewport_rect.w, data->viewport_rect.h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); - } - } else { - if (NeedViewport(window)) { - wl_surface_set_buffer_scale(data->surface, 1); - SetDrawSurfaceViewport(window, data->drawable_width, data->drawable_height, window->w, window->h); - } else { - UnsetDrawSurfaceViewport(window); - - /* Round to the next integer in case of a fractional value. */ - wl_surface_set_buffer_scale(data->surface, (int32_t)SDL_ceilf(data->scale_factor)); - } - - SDL_zero(data->viewport_rect); - - data->pointer_scale_x = 1.0f; - data->pointer_scale_y = 1.0f; - - if (!EGLTransparencyEnabled()) { - region = wl_compositor_create_region(viddata->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); - } - } - - /* Recreate the pointer confinement region when the window geometry changes. */ - if (data->confined_pointer) { - Wayland_input_confine_pointer(viddata->input, window); - } -} - -static void -SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) +CommitMinMaxDimensions(SDL_Window *window) { SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = wind->waylandData; int min_width, min_height, max_width, max_height; - /* Pop-ups don't get to change size */ - if (WINDOW_IS_XDG_POPUP(window)) { - /* ... but we still want to commit, particularly for ShowWindow */ - if (commit) { - wl_surface_commit(wind->surface); - } - return; - } - if (window->flags & SDL_WINDOW_FULLSCREEN) { min_width = 0; min_height = 0; @@ -341,7 +66,7 @@ SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) } #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (viddata->shell.libdecor) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -351,13 +76,6 @@ SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) libdecor_frame_set_max_content_size(wind->shell_surface.libdecor.frame, max_width, max_height); - - if (commit) { - struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); - libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); - libdecor_state_free(state); - wl_surface_commit(wind->surface); - } } else #endif if (viddata->shell.xdg) { @@ -370,64 +88,39 @@ SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) xdg_toplevel_set_max_size(wind->shell_surface.xdg.roleobj.toplevel, max_width, max_height); - if (commit) { - wl_surface_commit(wind->surface); - } + wl_surface_commit(wind->surface); } } static void -SetFullscreen(SDL_Window *window, struct wl_output *output, SDL_bool commit) +SetFullscreen(SDL_Window *window, struct wl_output *output) { SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = wind->waylandData; - /* Pop-ups don't get to be fullscreened */ - if (WINDOW_IS_XDG_POPUP(window)) { - /* ... but we still want to commit, particularly for ShowWindow */ - if (commit) { - wl_surface_commit(wind->surface); - } - return; - } - /* The desktop may try to enforce min/max sizes here, so turn them off for * fullscreen and on (if applicable) for windowed */ - SetMinMaxDimensions(window, SDL_FALSE); + CommitMinMaxDimensions(window); #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (viddata->shell.libdecor) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } if (output) { if (!(window->flags & SDL_WINDOW_RESIZABLE)) { - /* Ensure that window is resizable before going into fullscreen. - * This triggers a frame commit internally, so a separate one is not necessary. - */ + /* ensure that window is resizable before going into fullscreen */ libdecor_frame_set_capabilities(wind->shell_surface.libdecor.frame, LIBDECOR_ACTION_RESIZE); wl_surface_commit(wind->surface); - } else if (commit) { - struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); - libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); - libdecor_state_free(state); - wl_surface_commit(wind->surface); } - libdecor_frame_set_fullscreen(wind->shell_surface.libdecor.frame, output); } else { libdecor_frame_unset_fullscreen(wind->shell_surface.libdecor.frame); - if (!(window->flags & SDL_WINDOW_RESIZABLE)) { /* restore previous RESIZE capability */ libdecor_frame_unset_capabilities(wind->shell_surface.libdecor.frame, LIBDECOR_ACTION_RESIZE); wl_surface_commit(wind->surface); - } else if (commit) { - struct libdecor_state *state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); - libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); - libdecor_state_free(state); - wl_surface_commit(wind->surface); } } } else @@ -436,9 +129,6 @@ SetFullscreen(SDL_Window *window, struct wl_output *output, SDL_bool commit) if (wind->shell_surface.xdg.roleobj.toplevel == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } - if (commit) { - wl_surface_commit(wind->surface); - } if (output) { xdg_toplevel_set_fullscreen(wind->shell_surface.xdg.roleobj.toplevel, output); } else { @@ -447,44 +137,22 @@ SetFullscreen(SDL_Window *window, struct wl_output *output, SDL_bool commit) } } -const struct wl_callback_listener surface_damage_frame_listener; +static const struct wl_callback_listener surface_frame_listener; static void -surface_damage_frame_done(void *data, struct wl_callback *cb, uint32_t time) -{ - SDL_WindowData *wind = (SDL_WindowData *)data; - - /* Manually set the damage region when using a viewport. */ - if (!SDL_RectEmpty(&wind->viewport_rect)) { - wl_surface_damage(wind->surface, wind->viewport_rect.x, wind->viewport_rect.y, - wind->viewport_rect.w, wind->viewport_rect.h); - } - - wl_callback_destroy(cb); - wind->surface_damage_frame_callback = wl_surface_frame(wind->surface); - wl_callback_add_listener(wind->surface_damage_frame_callback, &surface_damage_frame_listener, data); -} - -const struct wl_callback_listener surface_damage_frame_listener = { - surface_damage_frame_done -}; - -static const struct wl_callback_listener gles_swap_frame_listener; - -static void -gles_swap_frame_done(void *data, struct wl_callback *cb, uint32_t time) +handle_surface_frame_done(void *data, struct wl_callback *cb, uint32_t time) { SDL_WindowData *wind = (SDL_WindowData *) data; SDL_AtomicSet(&wind->swap_interval_ready, 1); /* mark window as ready to present again. */ /* reset this callback to fire again once a new frame was presented and compositor wants the next one. */ - wind->gles_swap_frame_callback = wl_surface_frame(wind->gles_swap_frame_surface_wrapper); + wind->frame_callback = wl_surface_frame(wind->frame_surface_wrapper); wl_callback_destroy(cb); - wl_callback_add_listener(wind->gles_swap_frame_callback, &gles_swap_frame_listener, data); + wl_callback_add_listener(wind->frame_callback, &surface_frame_listener, data); } -static const struct wl_callback_listener gles_swap_frame_listener = { - gles_swap_frame_done +static const struct wl_callback_listener surface_frame_listener = { + handle_surface_frame_done }; @@ -547,7 +215,7 @@ handle_configure_xdg_toplevel(void *data, if (!fullscreen) { if (window->flags & SDL_WINDOW_FULLSCREEN) { /* We might need to re-enter fullscreen after being restored from minimized */ - SetFullscreen(window, driverdata->output, SDL_FALSE); + SetFullscreen(window, driverdata->output); /* Foolishly do what the compositor says here. If it's wrong, don't * blame us, we were explicitly instructed to do this. @@ -556,16 +224,14 @@ handle_configure_xdg_toplevel(void *data, * us a completely stateless, sizeless configure, with which we have * to enforce our own state anyway. */ - if (width != 0 && height != 0 && (window->w != width || window->h != height)) { + if (width != 0 && height != 0) { window->w = width; window->h = height; - wind->needs_resize_event = SDL_TRUE; } /* This part is good though. */ - if ((window->flags & SDL_WINDOW_ALLOW_HIGHDPI) && !FloatEqual(wind->scale_factor, driverdata->scale_factor)) { + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { wind->scale_factor = driverdata->scale_factor; - wind->needs_resize_event = SDL_TRUE; } return; @@ -618,11 +284,8 @@ handle_configure_xdg_toplevel(void *data, } /* Store this now so the xdg_surface configure knows what to resize to */ - if (window->w != width || window->h != height) { - window->w = width; - window->h = height; - wind->needs_resize_event = SDL_TRUE; - } + window->w = width; + window->h = height; } else { /* For fullscreen, foolishly do what the compositor says. If it's wrong, * don't blame us, we were explicitly instructed to do this. @@ -630,21 +293,14 @@ handle_configure_xdg_toplevel(void *data, * UPDATE: Nope, sure enough a compositor sends 0,0. This is a known bug: * https://bugs.kde.org/show_bug.cgi?id=444962 */ - if (!FullscreenModeEmulation(window)) { - if (width != 0 && height != 0 && (window->w != width || window->h != height)) { - window->w = width; - window->h = height; - wind->needs_resize_event = SDL_TRUE; - } - } else { - GetFullScreenDimensions(window, &window->w, &window->h, NULL, NULL); - wind->needs_resize_event = SDL_TRUE; + if (width != 0 && height != 0) { + window->w = width; + window->h = height; } /* This part is good though. */ - if ((window->flags & SDL_WINDOW_ALLOW_HIGHDPI) && !FloatEqual(wind->scale_factor, driverdata->scale_factor)) { + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { wind->scale_factor = driverdata->scale_factor; - wind->needs_resize_event = SDL_TRUE; } } } @@ -661,88 +317,6 @@ static const struct xdg_toplevel_listener toplevel_listener_xdg = { handle_close_xdg_toplevel }; -static void -handle_configure_xdg_popup(void *data, - struct xdg_popup *xdg_popup, - int32_t x, - int32_t y, - int32_t width, - int32_t height) -{ - /* No-op, we don't use x/y and width/height are fixed-size */ -} - -static void -handle_done_xdg_popup(void *data, struct xdg_popup *xdg_popup) -{ - SDL_WindowData *window = (SDL_WindowData *)data; - SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0); -} - -static void -handle_repositioned_xdg_popup(void *data, - struct xdg_popup *xdg_popup, - uint32_t token) -{ - /* No-op, configure does all the work we care about */ -} - -static const struct xdg_popup_listener popup_listener_xdg = { - handle_configure_xdg_popup, - handle_done_xdg_popup, - handle_repositioned_xdg_popup -}; - -#define TOOLTIP_CURSOR_OFFSET 8 /* FIXME: Arbitrary, eyeballed from X tooltip */ - -static int -Wayland_PopupWatch(void *data, SDL_Event *event) -{ - if (event->type == SDL_MOUSEMOTION) { - SDL_Window *window = (SDL_Window *) data; - SDL_WindowData *wind = window->driverdata; - - /* Coordinates might be relative to the popup, which we don't want */ - if (event->motion.windowID == wind->shell_surface.xdg.roleobj.popup.parentID) { - xdg_positioner_set_offset(wind->shell_surface.xdg.roleobj.popup.positioner, - event->motion.x + TOOLTIP_CURSOR_OFFSET, - event->motion.y + TOOLTIP_CURSOR_OFFSET); - xdg_popup_reposition(wind->shell_surface.xdg.roleobj.popup.popup, - wind->shell_surface.xdg.roleobj.popup.positioner, - 0); - } - } - return 1; -} - -static void -handle_configure_zxdg_decoration(void *data, - struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, - uint32_t mode) -{ - SDL_Window *window = (SDL_Window *) data; - SDL_WindowData *driverdata = (SDL_WindowData *) window->driverdata; - - /* If the compositor tries to force CSD anyway, bail on direct XDG support - * and fall back to libdecor, it will handle these events from then on. - * - * To do this we have to fully unmap, then map with libdecor loaded. - */ - if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) { - if (!Wayland_LoadLibdecor(driverdata->waylandData, SDL_TRUE)) { - /* libdecor isn't available, so no borders for you... oh well */ - return; - } - SDL_HideWindow(window); - driverdata->shell_surface_type = WAYLAND_SURFACE_LIBDECOR; - SDL_ShowWindow(window); - } -} - -static const struct zxdg_toplevel_decoration_v1_listener decoration_listener = { - handle_configure_zxdg_decoration -}; - #ifdef HAVE_LIBDECOR_H static void decoration_frame_configure(struct libdecor_frame *frame, @@ -756,7 +330,6 @@ decoration_frame_configure(struct libdecor_frame *frame, enum libdecor_window_state window_state; int width, height; - float scale_factor = wind->scale_factor; SDL_bool focused = SDL_FALSE; SDL_bool fullscreen = SDL_FALSE; @@ -783,7 +356,7 @@ decoration_frame_configure(struct libdecor_frame *frame, if (!fullscreen) { if (window->flags & SDL_WINDOW_FULLSCREEN) { /* We might need to re-enter fullscreen after being restored from minimized */ - SetFullscreen(window, driverdata->output, SDL_FALSE); + SetFullscreen(window, driverdata->output); fullscreen = SDL_TRUE; floating = SDL_FALSE; } @@ -813,31 +386,24 @@ decoration_frame_configure(struct libdecor_frame *frame, * Always assume the configure is wrong. */ if (fullscreen) { - if (!FullscreenModeEmulation(window)) { - /* FIXME: We have been explicitly told to respect the fullscreen size - * parameters here, even though they are known to be wrong on GNOME at - * bare minimum. If this is wrong, don't blame us, we were explicitly - * told to do this. - */ - if (!libdecor_configuration_get_content_size(configuration, frame, - &width, &height)) { - width = window->w; - height = window->h; - } - } else { - GetFullScreenDimensions(window, &width, &height, NULL, NULL); + /* FIXME: We have been explicitly told to respect the fullscreen size + * parameters here, even though they are known to be wrong on GNOME at + * bare minimum. If this is wrong, don't blame us, we were explicitly + * told to do this. + */ + if (!libdecor_configuration_get_content_size(configuration, frame, + &width, &height)) { + width = window->w; + height = window->h; } - wind->needs_resize_event = SDL_TRUE; - /* This part is good though. */ if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { - scale_factor = driverdata->scale_factor; + wind->scale_factor = driverdata->scale_factor; } - } else if (!(window->flags & SDL_WINDOW_RESIZABLE) || (floating && wind->floating_resize_pending)) { + } else if (!(window->flags & SDL_WINDOW_RESIZABLE)) { width = window->windowed.w; height = window->windowed.h; - wind->floating_resize_pending = SDL_FALSE; } else { /* This will never set 0 for width/height unless the function returns false */ if (!libdecor_configuration_get_content_size(configuration, frame, &width, &height)) { @@ -861,11 +427,11 @@ decoration_frame_configure(struct libdecor_frame *frame, } /* Do the resize on the SDL side (this will set window->w/h)... */ - Wayland_HandleResize(window, width, height, scale_factor); + Wayland_HandleResize(window, width, height, wind->scale_factor); wind->shell_surface.libdecor.initial_configure_seen = SDL_TRUE; /* ... then commit the changes on the libdecor side. */ - state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + state = libdecor_state_new(width, height); libdecor_frame_commit(frame, state, configuration); libdecor_state_free(state); @@ -952,11 +518,13 @@ update_scale_factor(SDL_WindowData *window) new_factor = 0.0f; for (i = 0; i < window->num_outputs; i++) { SDL_WaylandOutputData* driverdata = window->outputs[i]; - new_factor = SDL_max(new_factor, driverdata->scale_factor); + if (driverdata->scale_factor > new_factor) { + new_factor = driverdata->scale_factor; + } } } - if (!FloatEqual(new_factor, old_factor)) { + if (new_factor != old_factor) { Wayland_HandleResize(window->sdlwindow, window->sdlwindow->w, window->sdlwindow->h, new_factor); } } @@ -972,28 +540,9 @@ Wayland_move_window(SDL_Window *window, int i, numdisplays = SDL_GetNumVideoDisplays(); for (i = 0; i < numdisplays; i += 1) { if (SDL_GetDisplay(i)->driverdata == driverdata) { - /* We want to send a very very specific combination here: - * - * 1. A coordinate that tells the application what display we're on - * 2. Exactly (0, 0) - * - * Part 1 is useful information but is also really important for - * ensuring we end up on the right display for fullscreen, while - * part 2 is important because numerous applications use a specific - * combination of GetWindowPosition and GetGlobalMouseState, and of - * course neither are supported by Wayland. Since global mouse will - * fall back to just GetMouseState, we need the window position to - * be zero so the cursor math works without it going off in some - * random direction. See UE5 Editor for a notable example of this! - * - * This may be an issue some day if we're ever able to implement - * SDL_GetDisplayUsableBounds! - * - * -flibit - */ - SDL_Rect bounds; - SDL_GetDisplayBounds(i, &bounds); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, bounds.x, bounds.y); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, + SDL_WINDOWPOS_CENTERED_DISPLAY(i), + SDL_WINDOWPOS_CENTERED_DISPLAY(i)); break; } } @@ -1061,19 +610,6 @@ static const struct wl_surface_listener surface_listener = { handle_surface_leave }; -static void -Wayland_FillEmptyShellInfo(SDL_SysWMinfo * info, const Uint32 version) -{ - info->info.wl.xdg_surface = NULL; - if (version >= SDL_VERSIONNUM(2, 0, 17)) { - info->info.wl.xdg_toplevel = NULL; - if (version >= SDL_VERSIONNUM(2, 0, 22)) { - info->info.wl.xdg_popup = NULL; - info->info.wl.xdg_positioner = NULL; - } - } -} - SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { @@ -1106,40 +642,23 @@ Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.wl.egl_window = data->egl_window; #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { - if (data->shell_surface.libdecor.frame != NULL) { - info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame); - if (version >= SDL_VERSIONNUM(2, 0, 17)) { - info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame); - if (version >= SDL_VERSIONNUM(2, 0, 22)) { - info->info.wl.xdg_popup = NULL; - info->info.wl.xdg_positioner = NULL; - } - } - } else { - /* Not mapped yet */ - Wayland_FillEmptyShellInfo(info, version); + if (viddata->shell.libdecor && data->shell_surface.libdecor.frame != NULL) { + info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame); + if (version >= SDL_VERSIONNUM(2, 0, 17)) { + info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame); } } else #endif if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) { info->info.wl.xdg_surface = data->shell_surface.xdg.surface; if (version >= SDL_VERSIONNUM(2, 0, 17)) { - SDL_bool popup = WINDOW_IS_XDG_POPUP(window); - info->info.wl.xdg_toplevel = popup ? NULL : data->shell_surface.xdg.roleobj.toplevel; - if (version >= SDL_VERSIONNUM(2, 0, 22)) { - if (popup) { - info->info.wl.xdg_popup = data->shell_surface.xdg.roleobj.popup.popup; - info->info.wl.xdg_positioner = data->shell_surface.xdg.roleobj.popup.positioner; - } else { - info->info.wl.xdg_popup = NULL; - info->info.wl.xdg_positioner = NULL; - } - } + info->info.wl.xdg_toplevel = data->shell_surface.xdg.roleobj.toplevel; } } else { - /* Either it's not mapped yet or we don't have a shell protocol */ - Wayland_FillEmptyShellInfo(info, version); + info->info.wl.xdg_surface = NULL; + if (version >= SDL_VERSIONNUM(2, 0, 17)) { + info->info.wl.xdg_toplevel = NULL; + } } } @@ -1164,10 +683,6 @@ Wayland_SetWindowModalFor(_THIS, SDL_Window *modal_window, SDL_Window *parent_wi SDL_WindowData *modal_data = modal_window->driverdata; SDL_WindowData *parent_data = parent_window->driverdata; - if (WINDOW_IS_XDG_POPUP(modal_window) || WINDOW_IS_XDG_POPUP(parent_window)) { - return SDL_SetError("Modal/Parent was a popup, not a toplevel"); - } - #ifdef HAVE_LIBDECOR_H if (viddata->shell.libdecor) { if (modal_data->shell_surface.libdecor.frame == NULL) { @@ -1201,27 +716,17 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) { SDL_VideoData *c = _this->driverdata; SDL_WindowData *data = window->driverdata; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); /* Detach any previous buffers before resetting everything, otherwise when - * calling this a second time you'll get an annoying protocol error! - * - * FIXME: This was originally moved to HideWindow, which _should_ make - * sense, but for whatever reason UE5's popups require that this actually - * be in both places at once? Possibly from renderers making commits? I can't - * fully remember if this location caused crashes or if I was fixing a pair - * of Hide/Show calls. In any case, UE gives us a pretty good test and having - * both detach calls passes. This bug may be relevant if I'm wrong: - * - * https://bugs.kde.org/show_bug.cgi?id=448856 - * - * -flibit + * calling this a second time you'll get an annoying protocol error */ wl_surface_attach(data->surface, NULL, 0, 0); wl_surface_commit(data->surface); - /* Create the shell surface and map the toplevel/popup */ + /* Create the shell surface and map the toplevel */ #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(c, window)) { + if (c->shell.libdecor) { data->shell_surface.libdecor.frame = libdecor_decorate(c->shell.libdecor, data->surface, &libdecor_frame_interface, @@ -1239,42 +744,10 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) xdg_surface_set_user_data(data->shell_surface.xdg.surface, data); xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data); - if (WINDOW_IS_XDG_POPUP(window)) { - SDL_Mouse *mouse = SDL_GetMouse(); - SDL_Window *focused = SDL_GetMouseFocus(); - SDL_WindowData *focuseddata = focused->driverdata; - - /* This popup may be a child of another popup! */ - data->shell_surface.xdg.roleobj.popup.parentID = SDL_GetWindowID(focused); - data->shell_surface.xdg.roleobj.popup.child = NULL; - if (WINDOW_IS_XDG_POPUP(focused)) { - SDL_assert(focuseddata->shell_surface.xdg.roleobj.popup.child == NULL); - focuseddata->shell_surface.xdg.roleobj.popup.child = window; - } - - /* Set up the positioner for the popup */ - data->shell_surface.xdg.roleobj.popup.positioner = xdg_wm_base_create_positioner(c->shell.xdg); - xdg_positioner_set_offset(data->shell_surface.xdg.roleobj.popup.positioner, - mouse->x + TOOLTIP_CURSOR_OFFSET, - mouse->y + TOOLTIP_CURSOR_OFFSET); - - /* Assign the popup role */ - data->shell_surface.xdg.roleobj.popup.popup = xdg_surface_get_popup(data->shell_surface.xdg.surface, - focuseddata->shell_surface.xdg.surface, - data->shell_surface.xdg.roleobj.popup.positioner); - xdg_popup_add_listener(data->shell_surface.xdg.roleobj.popup.popup, &popup_listener_xdg, data); - - /* For tooltips, track mouse motion so it follows the cursor */ - if (window->flags & SDL_WINDOW_TOOLTIP) { - if (xdg_popup_get_version(data->shell_surface.xdg.roleobj.popup.popup) >= 3) { - SDL_AddEventWatch(Wayland_PopupWatch, window); - } - } - } else { - data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface); - xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, c->classname); - xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data); - } + /* !!! FIXME: add popup role */ + data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface); + xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, c->classname); + xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data); } /* Restore state that was set prior to this call */ @@ -1285,12 +758,13 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) if (window->flags & SDL_WINDOW_MINIMIZED) { Wayland_MinimizeWindow(_this, window); } + Wayland_SetWindowFullscreen(_this, window, display, (window->flags & SDL_WINDOW_FULLSCREEN) != 0); /* We have to wait until the surface gets a "configure" event, or use of * this surface will fail. This is a new rule for xdg_shell. */ #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(c, window)) { + if (c->shell.libdecor) { if (data->shell_surface.libdecor.frame) { while (!data->shell_surface.libdecor.initial_configure_seen) { WAYLAND_wl_display_flush(c->display); @@ -1300,12 +774,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) } else #endif if (c->shell.xdg) { - /* Unlike libdecor we need to call this explicitly to prevent a deadlock. - * libdecor will call this as part of their configure event! - * -flibit - */ - SDL_WaylandOutputData *odata = SDL_GetDisplayForWindow(window)->driverdata; - SetFullscreen(window, (window->flags & SDL_WINDOW_FULLSCREEN) ? odata->output : NULL, SDL_TRUE); if (data->shell_surface.xdg.surface) { while (!data->shell_surface.xdg.initial_configure_seen) { WAYLAND_wl_display_flush(c->display); @@ -1314,15 +782,9 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) } /* Create the window decorations */ - if (!WINDOW_IS_XDG_POPUP(window) && data->shell_surface.xdg.roleobj.toplevel && c->decoration_manager) { + if (data->shell_surface.xdg.roleobj.toplevel && c->decoration_manager) { data->server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(c->decoration_manager, data->shell_surface.xdg.roleobj.toplevel); - zxdg_toplevel_decoration_v1_add_listener(data->server_decoration, - &decoration_listener, - window); } - } else { - /* Nothing to see here, just commit. */ - wl_surface_commit(data->surface); } /* Unlike the rest of window state we have to set this _after_ flushing the @@ -1330,11 +792,11 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) * them immediately afterward. */ #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(c, window)) { + if (c->shell.libdecor) { /* ... but don't call it redundantly for libdecor, the decorator * may not interpret a redundant call nicely and cause weird stuff to happen */ - if (data->shell_surface.libdecor.frame && window->flags & SDL_WINDOW_BORDERLESS) { + if (window->flags & SDL_WINDOW_BORDERLESS) { Wayland_SetWindowBordered(_this, window, SDL_FALSE); } } else @@ -1360,42 +822,6 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) } } -static void -Wayland_ReleasePopup(_THIS, SDL_Window *popup) -{ - SDL_WindowData *popupdata; - - /* Basic sanity checks to weed out the weird popup closures */ - if (popup == NULL || popup->magic != &_this->window_magic) { - return; - } - popupdata = popup->driverdata; - if (popupdata == NULL) { - return; - } - - /* This may already be freed by a parent popup! */ - if (popupdata->shell_surface.xdg.roleobj.popup.popup == NULL) { - return; - } - - /* Release the child _first_, otherwise a protocol error triggers */ - if (popupdata->shell_surface.xdg.roleobj.popup.child != NULL) { - Wayland_ReleasePopup(_this, popupdata->shell_surface.xdg.roleobj.popup.child); - popupdata->shell_surface.xdg.roleobj.popup.child = NULL; - } - - if (popup->flags & SDL_WINDOW_TOOLTIP) { - if (xdg_popup_get_version(popupdata->shell_surface.xdg.roleobj.popup.popup) >= 3) { - SDL_DelEventWatch(Wayland_PopupWatch, popup); - } - } - xdg_popup_destroy(popupdata->shell_surface.xdg.roleobj.popup.popup); - xdg_positioner_destroy(popupdata->shell_surface.xdg.roleobj.popup.positioner); - popupdata->shell_surface.xdg.roleobj.popup.popup = NULL; - popupdata->shell_surface.xdg.roleobj.popup.positioner = NULL; -} - void Wayland_HideWindow(_THIS, SDL_Window *window) { SDL_VideoData *data = _this->driverdata; @@ -1407,7 +833,7 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) } #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(data, window)) { + if (data->shell.libdecor) { if (wind->shell_surface.libdecor.frame) { libdecor_frame_unref(wind->shell_surface.libdecor.frame); wind->shell_surface.libdecor.frame = NULL; @@ -1415,9 +841,7 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) } else #endif if (data->shell.xdg) { - if (WINDOW_IS_XDG_POPUP(window)) { - Wayland_ReleasePopup(_this, window); - } else if (wind->shell_surface.xdg.roleobj.toplevel) { + if (wind->shell_surface.xdg.roleobj.toplevel) { xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel); wind->shell_surface.xdg.roleobj.toplevel = NULL; } @@ -1426,10 +850,6 @@ void Wayland_HideWindow(_THIS, SDL_Window *window) wind->shell_surface.xdg.surface = NULL; } } - - /* Be sure to detach after this is done, otherwise ShowWindow crashes! */ - wl_surface_attach(wind->surface, NULL, 0, 0); - wl_surface_commit(wind->surface); } static void @@ -1623,7 +1043,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, { struct wl_output *output = ((SDL_WaylandOutputData*) _display->driverdata)->output; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - SetFullscreen(window, fullscreen ? output : NULL, SDL_TRUE); + SetFullscreen(window, fullscreen ? output : NULL); WAYLAND_wl_display_flush(viddata->display); } @@ -1634,17 +1054,13 @@ Wayland_RestoreWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - if (WINDOW_IS_XDG_POPUP(window)) { - return; - } - /* Set this flag now even if we never actually maximized, eventually * ShowWindow will take care of it along with the other window state. */ window->flags &= ~SDL_WINDOW_MAXIMIZED; #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (viddata->shell.libdecor) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1667,13 +1083,8 @@ Wayland_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { SDL_WindowData *wind = window->driverdata; const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; - - if (WINDOW_IS_XDG_POPUP(window)) { - return; - } - #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (viddata->shell.libdecor) { if (wind->shell_surface.libdecor.frame) { libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, bordered); } @@ -1689,9 +1100,10 @@ void Wayland_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) { #ifdef HAVE_LIBDECOR_H + SDL_VideoData *data = _this->driverdata; const SDL_WindowData *wind = window->driverdata; - if (WINDOW_IS_LIBDECOR(data, window)) { + if (data->shell.libdecor) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1703,7 +1115,7 @@ Wayland_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) } else #endif { - SetMinMaxDimensions(window, SDL_TRUE); + CommitMinMaxDimensions(window); } } @@ -1713,10 +1125,6 @@ Wayland_MaximizeWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - if (WINDOW_IS_XDG_POPUP(window)) { - return; - } - if (!(window->flags & SDL_WINDOW_RESIZABLE)) { return; } @@ -1727,7 +1135,7 @@ Wayland_MaximizeWindow(_THIS, SDL_Window * window) window->flags |= SDL_WINDOW_MAXIMIZED; #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (viddata->shell.libdecor) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1750,12 +1158,8 @@ Wayland_MinimizeWindow(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - if (WINDOW_IS_XDG_POPUP(window)) { - return; - } - #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (viddata->shell.libdecor) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -1846,15 +1250,15 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) data->waylandData = c; data->sdlwindow = window; - data->scale_factor = 1.0f; - data->pointer_scale_x = 1.0f; - data->pointer_scale_y = 1.0f; + data->scale_factor = 1.0; if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { int i; for (i=0; i < SDL_GetVideoDevice()->num_displays; i++) { float scale = ((SDL_WaylandOutputData*)SDL_GetVideoDevice()->displays[i].driverdata)->scale_factor; - data->scale_factor = SDL_max(data->scale_factor, scale); + if (scale > data->scale_factor) { + data->scale_factor = scale; + } } } @@ -1876,17 +1280,13 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) * window isn't visible. */ if (window->flags & SDL_WINDOW_OPENGL) { - data->gles_swap_frame_event_queue = WAYLAND_wl_display_create_queue(data->waylandData->display); - data->gles_swap_frame_surface_wrapper = WAYLAND_wl_proxy_create_wrapper(data->surface); - WAYLAND_wl_proxy_set_queue((struct wl_proxy *)data->gles_swap_frame_surface_wrapper, data->gles_swap_frame_event_queue); - data->gles_swap_frame_callback = wl_surface_frame(data->gles_swap_frame_surface_wrapper); - wl_callback_add_listener(data->gles_swap_frame_callback, &gles_swap_frame_listener, data); + data->frame_event_queue = WAYLAND_wl_display_create_queue(data->waylandData->display); + data->frame_surface_wrapper = WAYLAND_wl_proxy_create_wrapper(data->surface); + WAYLAND_wl_proxy_set_queue((struct wl_proxy *)data->frame_surface_wrapper, data->frame_event_queue); + data->frame_callback = wl_surface_frame(data->frame_surface_wrapper); + wl_callback_add_listener(data->frame_callback, &surface_frame_listener, data); } - /* Fire a callback when the compositor wants a new frame to set the surface damage region. */ - data->surface_damage_frame_callback = wl_surface_frame(data->surface); - wl_callback_add_listener(data->surface_damage_frame_callback, &surface_damage_frame_listener, data); - #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH if (c->surface_extension) { data->extended_surface = qt_surface_extension_get_extended_surface( @@ -1897,20 +1297,16 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - data->drawable_width = SDL_ceilf(window->w * data->scale_factor); - data->drawable_height = SDL_ceilf(window->h * data->scale_factor); - if (window->flags & SDL_WINDOW_OPENGL) { - data->egl_window = WAYLAND_wl_egl_window_create(data->surface, data->drawable_width, data->drawable_height); + data->egl_window = WAYLAND_wl_egl_window_create(data->surface, + window->w * data->scale_factor, window->h * data->scale_factor); -#if SDL_VIDEO_OPENGL_EGL /* Create the GLES window surface */ data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window); if (data->egl_surface == EGL_NO_SURFACE) { - return -1; /* SDL_EGL_CreateSurface should have set error */ + return SDL_SetError("failed to create an EGL window surface"); } -#endif } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @@ -1921,39 +1317,21 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ - if (!EGLTransparencyEnabled()) { - region = wl_compositor_create_region(c->compositor); - wl_region_add(region, 0, 0, window->w, window->h); - wl_surface_set_opaque_region(data->surface, region); - wl_region_destroy(region); - } + region = wl_compositor_create_region(c->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(data->surface, region); + wl_region_destroy(region); if (c->relative_mouse_mode) { Wayland_input_lock_pointer(c->input); } - /* Moved this call to ShowWindow: wl_surface_commit(data->surface); */ + wl_surface_commit(data->surface); WAYLAND_wl_display_flush(c->display); /* We may need to create an idle inhibitor for this new window */ Wayland_SuspendScreenSaver(_this); - #define IS_POPUP(window) \ - (window->flags & (SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU)) -#ifdef HAVE_LIBDECOR_H - if (c->shell.libdecor && !IS_POPUP(window)) { - data->shell_surface_type = WAYLAND_SURFACE_LIBDECOR; - } else -#endif - if (c->shell.xdg) { - if (IS_POPUP(window)) { - data->shell_surface_type = WAYLAND_SURFACE_XDG_POPUP; - } else { - data->shell_surface_type = WAYLAND_SURFACE_XDG_TOPLEVEL; - } - } /* All other cases will be WAYLAND_SURFACE_UNKNOWN */ - #undef IS_POPUP - return 0; } @@ -1964,74 +1342,80 @@ Wayland_HandleResize(SDL_Window *window, int width, int height, float scale) SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_VideoData *viddata = data->waylandData; - if (data->needs_resize_event || window->w != width || window->h != height || !FloatEqual(data->scale_factor, scale)) { - /* We may have already updated window w/h (or only adjusted scale factor), - * so we must override the deduplication logic in the video core */ - window->w = 0; - window->h = 0; - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); - window->w = width; - window->h = height; - data->scale_factor = scale; - data->needs_resize_event = SDL_FALSE; + struct wl_region *region; + window->w = 0; + window->h = 0; + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); + window->w = width; + window->h = height; + data->scale_factor = scale; + + wl_surface_set_buffer_scale(data->surface, data->scale_factor); + + if (data->egl_window) { + WAYLAND_wl_egl_window_resize(data->egl_window, + window->w * data->scale_factor, + window->h * data->scale_factor, + 0, 0); } - /* Update the window geometry. */ - ConfigureWindowGeometry(window); + region = wl_compositor_create_region(data->waylandData->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(data->surface, region); + wl_region_destroy(region); /* XXX: This workarounds issues with commiting buffers with old size after * already acknowledging the new size, which can cause protocol violations. * It doesn't fix the first frames after resize being glitched visually, * but at least lets us not be terminated by the compositor. * Can be removed once SDL's resize logic becomes compliant. */ - if ( -#ifdef HAVE_LIBDECOR_H - !WINDOW_IS_LIBDECOR(viddata, window) && -#endif - viddata->shell.xdg && - data->shell_surface.xdg.surface) { - xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, - GetWindowWidth(window), GetWindowHeight(window)); + if (viddata->shell.xdg && data->shell_surface.xdg.surface) { + xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, window->w, window->h); } } void Wayland_SetWindowMinimumSize(_THIS, SDL_Window * window) { - SetMinMaxDimensions(window, SDL_TRUE); + CommitMinMaxDimensions(window); } void Wayland_SetWindowMaximumSize(_THIS, SDL_Window * window) { - SetMinMaxDimensions(window, SDL_TRUE); + CommitMinMaxDimensions(window); } void Wayland_SetWindowSize(_THIS, SDL_Window * window) { SDL_VideoData *data = _this->driverdata; SDL_WindowData *wind = window->driverdata; + struct wl_region *region; #ifdef HAVE_LIBDECOR_H struct libdecor_state *state; #endif #ifdef HAVE_LIBDECOR_H /* we must not resize the window while we have a static (non-floating) size */ - if (WINDOW_IS_LIBDECOR(data, window) && + if (data->shell.libdecor && wind->shell_surface.libdecor.frame && !libdecor_frame_is_floating(wind->shell_surface.libdecor.frame)) { - /* Commit the resize when we re-enter floating state */ - wind->floating_resize_pending = SDL_TRUE; return; } #endif - /* Update the window geometry. */ - ConfigureWindowGeometry(window); + wl_surface_set_buffer_scale(wind->surface, wind->scale_factor); + + if (wind->egl_window) { + WAYLAND_wl_egl_window_resize(wind->egl_window, + window->w * wind->scale_factor, + window->h * wind->scale_factor, + 0, 0); + } #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(data, window) && wind->shell_surface.libdecor.frame) { - state = libdecor_state_new(GetWindowWidth(window), GetWindowHeight(window)); + if (data->shell.libdecor && wind->shell_surface.libdecor.frame) { + state = libdecor_state_new(window->w, window->h); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_state_free(state); } @@ -2041,15 +1425,14 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window) wind->floating_width = window->windowed.w; wind->floating_height = window->windowed.h; + region = wl_compositor_create_region(data->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(wind->surface, region); + wl_region_destroy(region); + /* Update the geometry which may have been set by a hack in Wayland_HandleResize */ - if ( -#ifdef HAVE_LIBDECOR_H - !WINDOW_IS_LIBDECOR(data, window) && -#endif - data->shell.xdg && - wind->shell_surface.xdg.surface) { - xdg_surface_set_window_geometry(wind->shell_surface.xdg.surface, 0, 0, - GetWindowWidth(window), GetWindowHeight(window)); + if (data->shell.xdg && wind->shell_surface.xdg.surface) { + xdg_surface_set_window_geometry(wind->shell_surface.xdg.surface, 0, 0, window->w, window->h); } } @@ -2058,13 +1441,9 @@ void Wayland_SetWindowTitle(_THIS, SDL_Window * window) SDL_WindowData *wind = window->driverdata; SDL_VideoData *viddata = _this->driverdata; - if (WINDOW_IS_XDG_POPUP(window)) { - return; - } - if (window->title != NULL) { #ifdef HAVE_LIBDECOR_H - if (WINDOW_IS_LIBDECOR(viddata, window)) { + if (viddata->shell.libdecor) { if (wind->shell_surface.libdecor.frame == NULL) { return; /* Can't do anything yet, wait for ShowWindow */ } @@ -2126,11 +1505,9 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) SDL_WindowData *wind = window->driverdata; if (data) { -#if SDL_VIDEO_OPENGL_EGL if (wind->egl_surface) { SDL_EGL_DestroySurface(_this, wind->egl_surface); } -#endif if (wind->egl_window) { WAYLAND_wl_egl_window_destroy(wind->egl_window); } @@ -2143,20 +1520,12 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) xdg_activation_token_v1_destroy(wind->activation_token); } - if (wind->draw_viewport) { - wp_viewport_destroy(wind->draw_viewport); - } - SDL_free(wind->outputs); - if (wind->gles_swap_frame_callback) { - WAYLAND_wl_event_queue_destroy(wind->gles_swap_frame_event_queue); - WAYLAND_wl_proxy_wrapper_destroy(wind->gles_swap_frame_surface_wrapper); - wl_callback_destroy(wind->gles_swap_frame_callback); - } - - if (wind->surface_damage_frame_callback) { - wl_callback_destroy(wind->surface_damage_frame_callback); + if (wind->frame_callback) { + WAYLAND_wl_event_queue_destroy(wind->frame_event_queue); + WAYLAND_wl_proxy_wrapper_destroy(wind->frame_surface_wrapper); + wl_callback_destroy(wind->frame_callback); } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @@ -2174,6 +1543,6 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) window->driverdata = NULL; } -#endif /* SDL_VIDEO_DRIVER_WAYLAND */ +#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/wayland/SDL_waylandwindow.h b/externals/SDL/src/video/wayland/SDL_waylandwindow.h index 703ec53da..8ca090f0c 100755 --- a/externals/SDL/src/video/wayland/SDL_waylandwindow.h +++ b/externals/SDL/src/video/wayland/SDL_waylandwindow.h @@ -32,61 +32,44 @@ struct SDL_WaylandInput; -/* TODO: Remove these helpers, they're from before we had shell_surface_type */ -#define WINDOW_IS_XDG_POPUP(window) \ - (((SDL_WindowData*) window->driverdata)->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) -#define WINDOW_IS_LIBDECOR(ignoreme, window) \ - (((SDL_WindowData*) window->driverdata)->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) +typedef struct { + struct xdg_surface *surface; + union { + struct xdg_toplevel *toplevel; + struct xdg_popup *popup; + } roleobj; + SDL_bool initial_configure_seen; +} SDL_xdg_shell_surface; + +#ifdef HAVE_LIBDECOR_H +typedef struct { + struct libdecor_frame *frame; + SDL_bool initial_configure_seen; +} SDL_libdecor_surface; +#endif typedef struct { SDL_Window *sdlwindow; SDL_VideoData *waylandData; struct wl_surface *surface; - struct wl_callback *gles_swap_frame_callback; - struct wl_event_queue *gles_swap_frame_event_queue; - struct wl_surface *gles_swap_frame_surface_wrapper; - struct wl_callback *surface_damage_frame_callback; - + struct wl_callback *frame_callback; + struct wl_event_queue *frame_event_queue; + struct wl_surface *frame_surface_wrapper; union { #ifdef HAVE_LIBDECOR_H - struct { - struct libdecor_frame *frame; - SDL_bool initial_configure_seen; - } libdecor; + SDL_libdecor_surface libdecor; #endif - struct { - struct xdg_surface *surface; - union { - struct xdg_toplevel *toplevel; - struct { - struct xdg_popup *popup; - struct xdg_positioner *positioner; - Uint32 parentID; - SDL_Window *child; - } popup; - } roleobj; - SDL_bool initial_configure_seen; - } xdg; + SDL_xdg_shell_surface xdg; } shell_surface; - enum { - WAYLAND_SURFACE_UNKNOWN = 0, - WAYLAND_SURFACE_XDG_TOPLEVEL, - WAYLAND_SURFACE_XDG_POPUP, - WAYLAND_SURFACE_LIBDECOR - } shell_surface_type; - struct wl_egl_window *egl_window; struct SDL_WaylandInput *keyboard_device; -#if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; -#endif struct zwp_locked_pointer_v1 *locked_pointer; struct zwp_confined_pointer_v1 *confined_pointer; struct zxdg_toplevel_decoration_v1 *server_decoration; struct zwp_keyboard_shortcuts_inhibitor_v1 *key_inhibitor; struct zwp_idle_inhibitor_v1 *idle_inhibitor; struct xdg_activation_token_v1 *activation_token; - struct wp_viewport *draw_viewport; /* floating dimensions for restoring from maximized and fullscreen */ int floating_width, floating_height; @@ -101,12 +84,6 @@ typedef struct { int num_outputs; float scale_factor; - float pointer_scale_x; - float pointer_scale_y; - int drawable_width, drawable_height; - SDL_Rect viewport_rect; - SDL_bool needs_resize_event; - SDL_bool floating_resize_pending; } SDL_WindowData; extern void Wayland_ShowWindow(_THIS, SDL_Window *window); diff --git a/externals/SDL/src/video/windows/SDL_windowsevents.c b/externals/SDL/src/video/windows/SDL_windowsevents.c index 69f6d14a2..471bbee86 100755 --- a/externals/SDL/src/video/windows/SDL_windowsevents.c +++ b/externals/SDL/src/video/windows/SDL_windowsevents.c @@ -29,12 +29,10 @@ #include "SDL_timer.h" #include "SDL_vkeys.h" #include "SDL_hints.h" -#include "SDL_main.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_touch_c.h" #include "../../events/scancodes_windows.h" #include "SDL_hints.h" -#include "SDL_log.h" /* Dropfile support */ #include @@ -42,19 +40,12 @@ /* For GET_X_LPARAM, GET_Y_LPARAM. */ #include -/* For WM_TABLET_QUERYSYSTEMGESTURESTATUS et. al. */ -#if HAVE_TPCSHRD_H -#include -#endif /* HAVE_TPCSHRD_H */ - /* #define WMMSG_DEBUG */ #ifdef WMMSG_DEBUG #include #include "wmmsg.h" #endif -/* #define HIGHDPI_DEBUG */ - /* Masks for processing the windows KEYDOWN and KEYUP messages */ #define REPEATED_KEYMASK (1<<30) #define EXTENDED_KEYMASK (1<<24) @@ -89,12 +80,6 @@ #ifndef WM_UNICHAR #define WM_UNICHAR 0x0109 #endif -#ifndef WM_DPICHANGED -#define WM_DPICHANGED 0x02E0 -#endif -#ifndef WM_GETDPISCALEDSIZE -#define WM_GETDPISCALEDSIZE 0x02E4 -#endif #ifndef IS_HIGH_SURROGATE #define IS_HIGH_SURROGATE(x) (((x) >= 0xd800) && ((x) <= 0xdbff)) @@ -384,18 +369,18 @@ WIN_CheckAsyncMouseRelease(SDL_WindowData *data) if (!(keyState & 0x8000)) { WIN_CheckWParamMouseButton(SDL_FALSE, mouseFlags, swapButtons, data, SDL_BUTTON_X2, 0); } - data->mouse_button_flags = (WPARAM)-1; + data->mouse_button_flags = 0; } static void -WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus) +WIN_UpdateFocus(SDL_Window *window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; HWND hwnd = data->hwnd; SDL_bool had_focus = (SDL_GetKeyboardFocus() == window) ? SDL_TRUE : SDL_FALSE; SDL_bool has_focus = (GetForegroundWindow() == hwnd) ? SDL_TRUE : SDL_FALSE; - if (had_focus == has_focus || has_focus != expect_focus) { + if (had_focus == has_focus) { return; } @@ -696,7 +681,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Update the focus here, since it's possible to get WM_ACTIVATE and WM_SETFOCUS without actually being the foreground window, but this appears to get called in all cases where the global foreground window changes to and from this window. */ - WIN_UpdateFocus(data->window, !!wParam); + WIN_UpdateFocus(data->window); WIN_CheckICMProfileChanged(data->window); } break; @@ -704,22 +689,16 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_ACTIVATE: { /* Update the focus in case we changed focus to a child window and then away from the application */ - WIN_UpdateFocus(data->window, !!LOWORD(wParam)); + WIN_UpdateFocus(data->window); } break; case WM_SETFOCUS: - { - /* Update the focus in case it's changing between top-level windows in the same application */ - WIN_UpdateFocus(data->window, SDL_TRUE); - } - break; - case WM_KILLFOCUS: case WM_ENTERIDLE: { /* Update the focus in case it's changing between top-level windows in the same application */ - WIN_UpdateFocus(data->window, SDL_FALSE); + WIN_UpdateFocus(data->window); } break; @@ -749,17 +728,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Only generate mouse events for real mouse */ if (GetMouseMessageSource() != SDL_MOUSE_EVENT_SOURCE_TOUCH && lParam != data->last_pointer_update) { - int x = GET_X_LPARAM(lParam); - int y = GET_Y_LPARAM(lParam); - - WIN_ClientPointToSDL(data->window, &x, &y); - - SDL_SendMouseMotion(data->window, 0, 0, x, y); + SDL_SendMouseMotion(data->window, 0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); } } } - break; - + /* don't break here, fall through to check the wParam like the button presses */ + SDL_FALLTHROUGH; case WM_LBUTTONUP: case WM_RBUTTONUP: case WM_MBUTTONUP: @@ -1073,12 +1047,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_GetWindowMinimumSize(data->window, &min_w, &min_h); SDL_GetWindowMaximumSize(data->window, &max_w, &max_h); - /* Convert w, h, min_w, min_h, max_w, max_h from dpi-scaled points to pixels, - treating them as coordinates within the client area. */ - WIN_ClientPointFromSDL(data->window, &w, &h); - WIN_ClientPointFromSDL(data->window, &min_w, &min_h); - WIN_ClientPointFromSDL(data->window, &max_w, &max_h); - /* Store in min_w and min_h difference between current size and minimal size so we don't need to call AdjustWindowRectEx twice */ min_w -= w; @@ -1099,25 +1067,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) inside their function, so I have to do it here. */ BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - UINT dpi; - - dpi = 96; size.top = 0; size.left = 0; size.bottom = h; size.right = w; - if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) { - dpi = data->videodata->GetDpiForWindow(hwnd); - data->videodata->AdjustWindowRectExForDpi(&size, style, menu, 0, dpi); - } else { - AdjustWindowRectEx(&size, style, menu, 0); - } + AdjustWindowRectEx(&size, style, menu, 0); w = size.right - size.left; h = size.bottom - size.top; -#ifdef HIGHDPI_DEBUG - SDL_Log("WM_GETMINMAXINFO: max window size: %dx%d using dpi: %u", w, h, dpi); -#endif } /* Fix our size to the current size */ @@ -1179,23 +1136,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) x = rect.left; y = rect.top; - WIN_ScreenPointToSDL(&x, &y); - SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y); - /* Convert client area width/height from pixels to dpi-scaled points */ w = rect.right - rect.left; h = rect.bottom - rect.top; - WIN_ClientPointToSDL(data->window, &w, &h); - SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, w, h); -#ifdef HIGHDPI_DEBUG - SDL_Log("WM_WINDOWPOSCHANGED: Windows client rect (pixels): (%d, %d) (%d x %d)\tSDL client rect (points): (%d, %d) (%d x %d) cached dpi %d, windows reported dpi %d", - rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, - x, y, w, h, data->scaling_dpi, data->videodata->GetDpiForWindow ? data->videodata->GetDpiForWindow(data->hwnd) : 0); -#endif - /* Forces a WM_PAINT event */ InvalidateRect(hwnd, NULL, FALSE); @@ -1216,12 +1162,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); break; - case SIZE_RESTORED: + default: SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESTORED, 0, 0); break; - default: - break; } } break; @@ -1341,25 +1285,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } break; -#if HAVE_TPCSHRD_H - - case WM_TABLET_QUERYSYSTEMGESTURESTATUS: - /* See https://msdn.microsoft.com/en-us/library/windows/desktop/bb969148(v=vs.85).aspx . - * If we're handling our own touches, we don't want any gestures. - * Not all of these settings are documented. - * The use of the undocumented ones was suggested by https://github.com/bjarkeck/GCGJ/blob/master/Monogame/Windows/WinFormsGameForm.cs . */ - return TABLET_DISABLE_PRESSANDHOLD | /* disables press and hold (right-click) gesture */ - TABLET_DISABLE_PENTAPFEEDBACK | /* disables UI feedback on pen up (waves) */ - TABLET_DISABLE_PENBARRELFEEDBACK | /* disables UI feedback on pen button down (circle) */ - TABLET_DISABLE_TOUCHUIFORCEON | - TABLET_DISABLE_TOUCHUIFORCEOFF | - TABLET_DISABLE_TOUCHSWITCH | - TABLET_DISABLE_FLICKS | /* disables pen flicks (back, forward, drag down, drag up) */ - TABLET_DISABLE_SMOOTHSCROLLING | - TABLET_DISABLE_FLICKFALLBACKKEYS; - -#endif /* HAVE_TPCSHRD_H */ - case WM_DROPFILES: { UINT i; @@ -1401,7 +1326,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam; w = data->window->windowed.w; h = data->window->windowed.h; - WIN_ClientPointFromSDL(data->window, &w, &h); params->rgrc[0].right = params->rgrc[0].left + w; params->rgrc[0].bottom = params->rgrc[0].top + h; } @@ -1414,16 +1338,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { SDL_Window *window = data->window; if (window->hit_test) { - POINT winpoint; - winpoint.x = GET_X_LPARAM(lParam); - winpoint.y = GET_Y_LPARAM(lParam); + POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if (ScreenToClient(hwnd, &winpoint)) { - SDL_Point point; - SDL_HitTestResult rc; - point.x = winpoint.x; - point.y = winpoint.y; - WIN_ClientPointToSDL(data->window, &point.x, &point.y); - rc = window->hit_test(window, &point, window->hit_test_data); + const SDL_Point point = { (int) winpoint.x, (int) winpoint.y }; + const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); switch (rc) { #define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; } case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION); @@ -1443,169 +1361,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } break; - - case WM_GETDPISCALEDSIZE: - /* Windows 10 Creators Update+ */ - /* Documented as only being sent to windows that are per-monitor V2 DPI aware. - - Experimentation shows it's only sent during interactive dragging, not in response to - SetWindowPos. */ - if (data->videodata->GetDpiForWindow && data->videodata->AdjustWindowRectExForDpi) { - /* Windows expects applications to scale their window rects linearly - when dragging between monitors with different DPI's. - e.g. a 100x100 window dragged to a 200% scaled monitor - becomes 200x200. - - For SDL, we instead want the client size to scale linearly. - This is not the same as the window rect scaling linearly, - because Windows doesn't scale the non-client area (titlebar etc.) - linearly. So, we need to handle this message to request custom - scaling. */ - - const int nextDPI = (int)wParam; - const int prevDPI = (int)data->videodata->GetDpiForWindow(hwnd); - SIZE *sizeInOut = (SIZE *)lParam; - - int frame_w, frame_h; - int query_client_w_win, query_client_h_win; - - const DWORD style = GetWindowLong(hwnd, GWL_STYLE); - const BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - -#ifdef HIGHDPI_DEBUG - SDL_Log("WM_GETDPISCALEDSIZE: current DPI: %d potential DPI: %d input size: (%dx%d)", - prevDPI, nextDPI, sizeInOut->cx, sizeInOut->cy); -#endif - - /* Subtract the window frame size that would have been used at prevDPI */ - { - RECT rect = {0}; - - if (!(data->window->flags & SDL_WINDOW_BORDERLESS)) { - data->videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, prevDPI); - } - - frame_w = -rect.left + rect.right; - frame_h = -rect.top + rect.bottom; - - query_client_w_win = sizeInOut->cx - frame_w; - query_client_h_win = sizeInOut->cy - frame_h; - } - - /* Convert to new dpi if we are using scaling. - * Otherwise leave as pixels. - */ - if (data->videodata->dpi_scaling_enabled) { - query_client_w_win = MulDiv(query_client_w_win, nextDPI, prevDPI); - query_client_h_win = MulDiv(query_client_h_win, nextDPI, prevDPI); - } - - /* Add the window frame size that would be used at nextDPI */ - { - RECT rect = {0}; - rect.right = query_client_w_win; - rect.bottom = query_client_h_win; - - if (!(data->window->flags & SDL_WINDOW_BORDERLESS)) { - data->videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, nextDPI); - } - - /* This is supposed to control the suggested rect param of WM_DPICHANGED */ - sizeInOut->cx = rect.right - rect.left; - sizeInOut->cy = rect.bottom - rect.top; - } - -#ifdef HIGHDPI_DEBUG - SDL_Log("WM_GETDPISCALEDSIZE: output size: (%dx%d)", sizeInOut->cx, sizeInOut->cy); -#endif - return TRUE; - } - break; - - case WM_DPICHANGED: - /* Windows 8.1+ */ - { - const int newDPI = HIWORD(wParam); - RECT* const suggestedRect = (RECT*)lParam; - int w, h; - -#ifdef HIGHDPI_DEBUG - SDL_Log("WM_DPICHANGED: to %d\tsuggested rect: (%d, %d), (%dx%d)\n", newDPI, - suggestedRect->left, suggestedRect->top, suggestedRect->right - suggestedRect->left, suggestedRect->bottom - suggestedRect->top); -#endif - - if (data->videodata->dpi_scaling_enabled) { - /* Update the cached DPI value for this window */ - data->scaling_dpi = newDPI; - - /* Send a SDL_WINDOWEVENT_SIZE_CHANGED saying that the client size (in dpi-scaled points) is unchanged. - Renderers need to get this to know that the framebuffer size changed. */ - SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_SIZE_CHANGED, data->window->w, data->window->h); - } - - if (data->expected_resize) { - /* This DPI change is coming from an explicit SetWindowPos call within SDL. - Assume all call sites are calculating the DPI-aware frame correctly, so - we don't need to do any further adjustment. */ -#ifdef HIGHDPI_DEBUG - SDL_Log("WM_DPICHANGED: Doing nothing, assuming window is already sized correctly"); -#endif - return 0; - } - - /* Interactive user-initiated resizing/movement */ - - if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) { - /* WM_GETDPISCALEDSIZE should have been called prior, so we can trust the given - suggestedRect. */ - w = suggestedRect->right - suggestedRect->left; - h = suggestedRect->bottom - suggestedRect->top; - -#ifdef HIGHDPI_DEBUG - SDL_Log("WM_DPICHANGED: using suggestedRect"); -#endif - } else { - /* permonitor and earlier DPI awareness: calculate the new frame w/h such that - the client area size is maintained. */ - const DWORD style = GetWindowLong(hwnd, GWL_STYLE); - const BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - - RECT rect = {0}; - rect.right = data->window->w; - rect.bottom = data->window->h; - - if (data->videodata->dpi_scaling_enabled) { - /* scale client size to from points to the new DPI */ - rect.right = MulDiv(rect.right, newDPI, 96); - rect.bottom = MulDiv(rect.bottom, newDPI, 96); - } - - if (!(data->window->flags & SDL_WINDOW_BORDERLESS)) { - AdjustWindowRectEx(&rect, style, menu, 0); - } - - w = rect.right - rect.left; - h = rect.bottom - rect.top; - } - -#ifdef HIGHDPI_DEBUG - SDL_Log("WM_DPICHANGED: current SDL window size: (%dx%d)\tcalling SetWindowPos: (%d, %d), (%dx%d)\n", - data->window->w, data->window->h, - suggestedRect->left, suggestedRect->top, w, h); -#endif - - data->expected_resize = SDL_TRUE; - SetWindowPos(hwnd, - NULL, - suggestedRect->left, - suggestedRect->top, - w, - h, - SWP_NOZORDER | SWP_NOACTIVATE); - data->expected_resize = SDL_FALSE; - return 0; - } - break; } /* If there's a window proc, assume it's going to handle messages */ @@ -1800,14 +1555,6 @@ LPTSTR SDL_Appname = NULL; Uint32 SDL_Appstyle = 0; HINSTANCE SDL_Instance = NULL; -static void WIN_CleanRegisterApp(WNDCLASSEX wcex) -{ - if (wcex.hIcon) DestroyIcon(wcex.hIcon); - if (wcex.hIconSm) DestroyIcon(wcex.hIconSm); - SDL_free(SDL_Appname); - SDL_Appname = NULL; -} - /* Register the class for this application */ int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) @@ -1821,16 +1568,19 @@ SDL_RegisterApp(const char *name, Uint32 style, void *hInst) ++app_registered; return (0); } - SDL_assert(SDL_Appname == NULL); - if (!name) { + if (!name && !SDL_Appname) { name = "SDL_app"; #if defined(CS_BYTEALIGNCLIENT) || defined(CS_OWNDC) - style = (CS_BYTEALIGNCLIENT | CS_OWNDC); + SDL_Appstyle = (CS_BYTEALIGNCLIENT | CS_OWNDC); #endif + SDL_Instance = hInst ? hInst : GetModuleHandle(NULL); + } + + if (name) { + SDL_Appname = WIN_UTF8ToString(name); + SDL_Appstyle = style; + SDL_Instance = hInst ? hInst : GetModuleHandle(NULL); } - SDL_Appname = WIN_UTF8ToString(name); - SDL_Appstyle = style; - SDL_Instance = hInst ? hInst : GetModuleHandle(NULL); /* Register the application class */ wcex.cbSize = sizeof(WNDCLASSEX); @@ -1861,7 +1611,6 @@ SDL_RegisterApp(const char *name, Uint32 style, void *hInst) } if (!RegisterClassEx(&wcex)) { - WIN_CleanRegisterApp(wcex); return SDL_SetError("Couldn't register application class"); } @@ -1881,14 +1630,14 @@ SDL_UnregisterApp() } --app_registered; if (app_registered == 0) { - /* Ensure the icons are initialized. */ - wcex.hIcon = NULL; - wcex.hIconSm = NULL; /* Check for any registered window classes. */ if (GetClassInfoEx(SDL_Instance, SDL_Appname, &wcex)) { UnregisterClass(SDL_Appname, SDL_Instance); + if (wcex.hIcon) DestroyIcon(wcex.hIcon); + if (wcex.hIconSm) DestroyIcon(wcex.hIconSm); } - WIN_CleanRegisterApp(wcex); + SDL_free(SDL_Appname); + SDL_Appname = NULL; } } diff --git a/externals/SDL/src/video/windows/SDL_windowskeyboard.c b/externals/SDL/src/video/windows/SDL_windowskeyboard.c index f2deadc7b..929032516 100755 --- a/externals/SDL/src/video/windows/SDL_windowskeyboard.c +++ b/externals/SDL/src/video/windows/SDL_windowskeyboard.c @@ -36,8 +36,6 @@ static void IME_Init(SDL_VideoData *videodata, HWND hwnd); static void IME_Enable(SDL_VideoData *videodata, HWND hwnd); static void IME_Disable(SDL_VideoData *videodata, HWND hwnd); static void IME_Quit(SDL_VideoData *videodata); -static void IME_ClearComposition(SDL_VideoData *videodata); -static SDL_bool IME_IsTextInputShown(SDL_VideoData* videodata); #endif /* !SDL_DISABLE_WINDOWS_IME */ #ifndef MAPVK_VK_TO_VSC @@ -64,14 +62,12 @@ WIN_InitKeyboard(_THIS) data->ime_hwnd_main = 0; data->ime_hwnd_current = 0; data->ime_himc = 0; - data->ime_composition_length = 32 * sizeof(WCHAR); - data->ime_composition = (WCHAR*)SDL_malloc(data->ime_composition_length + sizeof(WCHAR)); data->ime_composition[0] = 0; data->ime_readingstring[0] = 0; data->ime_cursor = 0; data->ime_candlist = SDL_FALSE; - data->ime_candidates = NULL; + SDL_memset(data->ime_candidates, 0, sizeof(data->ime_candidates)); data->ime_candcount = 0; data->ime_candref = 0; data->ime_candsel = 0; @@ -276,17 +272,14 @@ WIN_SetTextInputRect(_THIS, SDL_Rect *rect) } } +static SDL_bool +WIN_ShouldShowNativeUI() +{ + return SDL_GetHintBoolean(SDL_HINT_IME_SHOW_UI, SDL_FALSE); +} #ifdef SDL_DISABLE_WINDOWS_IME -void WIN_ClearComposition(_THIS) -{ -} - -SDL_bool WIN_IsTextInputShown(_THIS) -{ - return SDL_FALSE; -} SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoData *videodata) @@ -356,7 +349,6 @@ DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594 #define SUBLANG() SUBLANGID(LANG()) static void IME_UpdateInputLocale(SDL_VideoData *videodata); -static int IME_ShowCandidateList(SDL_VideoData *videodata); static void IME_ClearComposition(SDL_VideoData *videodata); static void IME_SetWindow(SDL_VideoData* videodata, HWND hwnd); static void IME_SetupAPI(SDL_VideoData *videodata); @@ -369,12 +361,6 @@ static void UILess_ReleaseSinks(SDL_VideoData *videodata); static void UILess_EnableUIUpdates(SDL_VideoData *videodata); static void UILess_DisableUIUpdates(SDL_VideoData *videodata); -static SDL_bool -WIN_ShouldShowNativeUI() -{ - return SDL_GetHintBoolean(SDL_HINT_IME_SHOW_UI, SDL_FALSE); -} - static void IME_Init(SDL_VideoData *videodata, HWND hwnd) { @@ -601,16 +587,16 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex) char szTemp[256]; HKL hkl = 0; DWORD dwLang = 0; - SDL_assert(uIndex < sizeof(dwRet) / sizeof(dwRet[0])); + if (uIndex >= sizeof(dwRet) / sizeof(dwRet[0])) + return 0; hkl = videodata->ime_hkl; if (hklprev == hkl) return dwRet[uIndex]; - hklprev = hkl; - SDL_assert(uIndex == 0); + hklprev = hkl; dwLang = ((DWORD_PTR)hkl & 0xffff); - if (videodata->ime_uiless && dwLang == LANG_CHT) { + if (videodata->ime_uiless && LANG() == LANG_CHT) { dwRet[0] = IMEID_CHT_VER_VISTA; dwRet[1] = 0; return dwRet[0]; @@ -621,11 +607,11 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex) && hkl != CHT_HKL_HK_CANTONESE && hkl != CHS_HKL) { dwRet[0] = dwRet[1] = 0; - return dwRet[0]; + return dwRet[uIndex]; } - if (!ImmGetIMEFileNameA(hkl, szTemp, sizeof(szTemp) - 1)) { + if (ImmGetIMEFileNameA(hkl, szTemp, sizeof(szTemp) - 1) <= 0) { dwRet[0] = dwRet[1] = 0; - return dwRet[0]; + return dwRet[uIndex]; } if (!videodata->GetReadingString) { #define LCID_INVARIANT MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) @@ -635,7 +621,7 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex) && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME1, -1) != 2 && CompareStringA(LCID_INVARIANT, NORM_IGNORECASE, szTemp, -1, CHS_IMEFILENAME2, -1) != 2) { dwRet[0] = dwRet[1] = 0; - return dwRet[0]; + return dwRet[uIndex]; } #undef LCID_INVARIANT dwVerSize = GetFileVersionInfoSizeA(szTemp, &dwVerHandle); @@ -674,7 +660,7 @@ IME_GetId(SDL_VideoData *videodata, UINT uIndex) } } dwRet[0] = dwRet[1] = 0; - return dwRet[0]; + return dwRet[uIndex]; } static void @@ -689,7 +675,7 @@ IME_SetupAPI(SDL_VideoData *videodata) return; hkl = videodata->ime_hkl; - if (!ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1)) + if (ImmGetIMEFileNameA(hkl, ime_file, sizeof(ime_file) - 1) <= 0) return; hime = SDL_LoadObject(ime_file); @@ -726,13 +712,26 @@ IME_SetWindow(SDL_VideoData* videodata, HWND hwnd) static void IME_UpdateInputLocale(SDL_VideoData *videodata) { - HKL hklnext = GetKeyboardLayout(0); - - if (hklnext == videodata->ime_hkl) + static HKL hklprev = 0; + videodata->ime_hkl = GetKeyboardLayout(0); + if (hklprev == videodata->ime_hkl) return; - videodata->ime_hkl = hklnext; - videodata->ime_candvertical = (PRIMLANG() == LANG_KOREAN || LANG() == LANG_CHS) ? SDL_FALSE : SDL_TRUE; + hklprev = videodata->ime_hkl; + switch (PRIMLANG()) { + case LANG_CHINESE: + videodata->ime_candvertical = SDL_TRUE; + if (SUBLANG() == SUBLANG_CHINESE_SIMPLIFIED) + videodata->ime_candvertical = SDL_FALSE; + + break; + case LANG_JAPANESE: + videodata->ime_candvertical = SDL_TRUE; + break; + case LANG_KOREAN: + videodata->ime_candvertical = SDL_FALSE; + break; + } } static void @@ -755,48 +754,18 @@ IME_ClearComposition(SDL_VideoData *videodata) SDL_SendEditingText("", 0, 0); } -static SDL_bool -IME_IsTextInputShown(SDL_VideoData* videodata) -{ - if (!videodata->ime_initialized || !videodata->ime_available || !videodata->ime_enabled) - return SDL_FALSE; - - return videodata->ime_uicontext != 0 ? SDL_TRUE : SDL_FALSE; -} - static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string) { - LONG length; - DWORD dwLang = ((DWORD_PTR)videodata->ime_hkl & 0xffff); - - length = ImmGetCompositionStringW(himc, string, NULL, 0); - if (length > 0 && videodata->ime_composition_length < length) { - if (videodata->ime_composition != NULL) - SDL_free(videodata->ime_composition); - - videodata->ime_composition = (WCHAR*)SDL_malloc(length + sizeof(WCHAR)); - videodata->ime_composition_length = length; - } - - length = ImmGetCompositionStringW( - himc, - string, - videodata->ime_composition, - videodata->ime_composition_length - ); - + LONG length = ImmGetCompositionStringW(himc, string, videodata->ime_composition, sizeof(videodata->ime_composition) - sizeof(videodata->ime_composition[0])); if (length < 0) length = 0; - length /= sizeof(WCHAR); + length /= sizeof(videodata->ime_composition[0]); videodata->ime_cursor = LOWORD(ImmGetCompositionStringW(himc, GCS_CURSORPOS, 0, 0)); - if ((dwLang == LANG_CHT || dwLang == LANG_CHS) && - videodata->ime_cursor > 0 && - videodata->ime_cursor < (int)(videodata->ime_composition_length / sizeof(WCHAR)) && - (videodata->ime_composition[0] == 0x3000 || videodata->ime_composition[0] == 0x0020)) { - // Traditional Chinese IMEs add a placeholder U+3000 - // Simplified Chinese IMEs seem to add a placeholder U+0020 sometimes + if (videodata->ime_cursor > 0 && + videodata->ime_cursor < SDL_arraysize(videodata->ime_composition) && + videodata->ime_composition[videodata->ime_cursor] == 0x3000) { int i; for (i = videodata->ime_cursor + 1; i < length; ++i) videodata->ime_composition[i - 1] = videodata->ime_composition[i]; @@ -805,39 +774,6 @@ IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD string) } videodata->ime_composition[length] = 0; - - // Get the correct caret position if we've selected a candidate from the candidate window - if (videodata->ime_cursor == 0 && length > 0) { - Sint32 start = 0; - Sint32 end = 0; - - length = ImmGetCompositionStringW(himc, GCS_COMPATTR, NULL, 0); - if (length > 0) { - Uint8* attributes = (Uint8*)SDL_malloc(length + sizeof(WCHAR)); - ImmGetCompositionString(himc, GCS_COMPATTR, attributes, length); - - for (start = 0; start < length; ++start) { - if (attributes[start] == ATTR_TARGET_CONVERTED || - attributes[start] == ATTR_TARGET_NOTCONVERTED) - break; - } - - for (end = start; end < length; ++end) { - if (attributes[end] != ATTR_TARGET_CONVERTED && - attributes[end] != ATTR_TARGET_NOTCONVERTED) - break; - } - - if (start == length) { - start = 0; - end = length; - } - - SDL_free(attributes); - } - - videodata->ime_cursor = end; - } } static void @@ -856,66 +792,48 @@ IME_SendInputEvent(SDL_VideoData *videodata) static void IME_SendEditingEvent(SDL_VideoData *videodata) { - char *s = NULL; - WCHAR *buffer = NULL; - size_t size = videodata->ime_composition_length; + char *s = 0; + WCHAR buffer[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + const size_t size = SDL_arraysize(buffer); + buffer[0] = 0; if (videodata->ime_readingstring[0]) { size_t len = SDL_min(SDL_wcslen(videodata->ime_composition), (size_t)videodata->ime_cursor); - - size += sizeof(videodata->ime_readingstring); - buffer = (WCHAR*)SDL_malloc(size + sizeof(WCHAR)); - buffer[0] = 0; - SDL_wcslcpy(buffer, videodata->ime_composition, len + 1); SDL_wcslcat(buffer, videodata->ime_readingstring, size); SDL_wcslcat(buffer, &videodata->ime_composition[len], size); } else { - buffer = (WCHAR*)SDL_malloc(size + sizeof(WCHAR)); - buffer[0] = 0; SDL_wcslcpy(buffer, videodata->ime_composition, size); } - s = WIN_StringToUTF8W(buffer); SDL_SendEditingText(s, videodata->ime_cursor + (int)SDL_wcslen(videodata->ime_readingstring), 0); SDL_free(s); - SDL_free(buffer); } static void IME_AddCandidate(SDL_VideoData *videodata, UINT i, LPCWSTR candidate) { - LPWSTR dst = &videodata->ime_candidates[i * MAX_CANDLENGTH]; - LPWSTR end = &dst[MAX_CANDLENGTH - 1]; - SDL_COMPILE_TIME_ASSERT(IME_CANDIDATE_INDEXING_REQUIRES, MAX_CANDLIST == 10); + LPWSTR dst = videodata->ime_candidates[i]; *dst++ = (WCHAR)(TEXT('0') + ((i + videodata->ime_candlistindexbase) % 10)); if (videodata->ime_candvertical) *dst++ = TEXT(' '); - while (*candidate && dst < end) + while (*candidate && (SDL_arraysize(videodata->ime_candidates[i]) > (dst - videodata->ime_candidates[i]))) *dst++ = *candidate++; *dst = (WCHAR)'\0'; } static void -IME_GetCandidateList(HWND hwnd, SDL_VideoData *videodata) +IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata) { - HIMC himc; - DWORD size; - LPCANDIDATELIST cand_list; - - if (IME_ShowCandidateList(videodata) < 0) - return; - himc = ImmGetContext(hwnd); - if (!himc) - return; - size = ImmGetCandidateListW(himc, 0, 0, 0); - if (size != 0) { + LPCANDIDATELIST cand_list = 0; + DWORD size = ImmGetCandidateListW(himc, 0, 0, 0); + if (size) { cand_list = (LPCANDIDATELIST)SDL_malloc(size); - if (cand_list != NULL) { + if (cand_list) { size = ImmGetCandidateListW(himc, 0, cand_list, size); - if (size != 0) { + if (size) { UINT i, j; UINT page_start = 0; videodata->ime_candsel = cand_list->dwSelection; @@ -940,44 +858,34 @@ IME_GetCandidateList(HWND hwnd, SDL_VideoData *videodata) } videodata->ime_candpgsize = i - page_start; } else { - videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize == 0 ? MAX_CANDLIST : cand_list->dwPageSize, MAX_CANDLIST); - page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; + videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST); + if (videodata->ime_candpgsize > 0) { + page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; + } else { + page_start = 0; + } } - for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < videodata->ime_candpgsize; i++, j++) { + SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); + for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) { LPCWSTR candidate = (LPCWSTR)((DWORD_PTR)cand_list + cand_list->dwOffset[i]); IME_AddCandidate(videodata, j, candidate); } - // TODO: why was this necessary? check ime_candvertical instead? PRIMLANG() never equals LANG_CHT ! - //if (PRIMLANG() == LANG_KOREAN || (PRIMLANG() == LANG_CHT && !IME_GetId(videodata, 0))) - // videodata->ime_candsel = -1; + if (PRIMLANG() == LANG_KOREAN || (PRIMLANG() == LANG_CHT && !IME_GetId(videodata, 0))) + videodata->ime_candsel = -1; } SDL_free(cand_list); } } - ImmReleaseContext(hwnd, himc); } -static int +static void IME_ShowCandidateList(SDL_VideoData *videodata) { - void *candidates; - - videodata->ime_candcount = 0; - candidates = SDL_realloc(videodata->ime_candidates, MAX_CANDSIZE); - if (candidates != NULL) - videodata->ime_candidates = (WCHAR *)candidates; - - if (videodata->ime_candidates == NULL) - return -1; - - SDL_memset(videodata->ime_candidates, 0, MAX_CANDSIZE); - videodata->ime_dirty = SDL_TRUE; videodata->ime_candlist = SDL_TRUE; IME_DestroyTextures(videodata); IME_SendEditingEvent(videodata); - return 0; } static void @@ -998,15 +906,6 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD return SDL_FALSE; switch (msg) { - case WM_KEYDOWN: - if (wParam == VK_PROCESSKEY) - { - videodata->ime_uicontext = 1; - trap = SDL_TRUE; - } - else - videodata->ime_uicontext = 0; - break; case WM_INPUTLANGCHANGE: IME_InputLangChanged(videodata); break; @@ -1015,17 +914,14 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD *lParam = 0; } break; - case WM_IME_STARTCOMPOSITION: - videodata->ime_suppress_endcomposition_event = SDL_FALSE; + case WM_IME_STARTCOMPOSITION: trap = SDL_TRUE; break; case WM_IME_COMPOSITION: trap = SDL_TRUE; himc = ImmGetContext(hwnd); if (*lParam & GCS_RESULTSTR) { - videodata->ime_suppress_endcomposition_event = SDL_TRUE; IME_GetCompositionString(videodata, himc, GCS_RESULTSTR); - SDL_SendEditingText("", 0, 0); IME_SendInputEvent(videodata); } if (*lParam & GCS_COMPSTR) { @@ -1038,13 +934,10 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD ImmReleaseContext(hwnd, himc); break; case WM_IME_ENDCOMPOSITION: - videodata->ime_uicontext = 0; videodata->ime_composition[0] = 0; videodata->ime_readingstring[0] = 0; videodata->ime_cursor = 0; - if (videodata->ime_suppress_endcomposition_event == SDL_FALSE) - SDL_SendEditingText("", 0, 0); - videodata->ime_suppress_endcomposition_event = SDL_FALSE; + SDL_SendEditingText("", 0, 0); break; case WM_IME_NOTIFY: switch (wParam) { @@ -1058,12 +951,16 @@ IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SDL_VideoD break; trap = SDL_TRUE; - videodata->ime_uicontext = 1; - IME_GetCandidateList(hwnd, videodata); + IME_ShowCandidateList(videodata); + himc = ImmGetContext(hwnd); + if (!himc) + break; + + IME_GetCandidateList(himc, videodata); + ImmReleaseContext(hwnd, himc); break; case IMN_CLOSECANDIDATE: trap = SDL_TRUE; - videodata->ime_uicontext = 0; IME_HideCandidateList(videodata); break; case IMN_PRIVATE: @@ -1110,8 +1007,7 @@ IME_CloseCandidateList(SDL_VideoData *videodata) { IME_HideCandidateList(videodata); videodata->ime_candcount = 0; - SDL_free(videodata->ime_candidates); - videodata->ime_candidates = NULL; + SDL_memset(videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); } static void @@ -1124,16 +1020,13 @@ UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pca DWORD pgstart = 0; DWORD pgsize = 0; UINT i, j; - - if (IME_ShowCandidateList(videodata) < 0) - return; - pcandlist->lpVtbl->GetSelection(pcandlist, &selection); pcandlist->lpVtbl->GetCount(pcandlist, &count); pcandlist->lpVtbl->GetCurrentPage(pcandlist, &page); videodata->ime_candsel = selection; videodata->ime_candcount = count; + IME_ShowCandidateList(videodata); pcandlist->lpVtbl->GetPageIndex(pcandlist, 0, 0, &pgcount); if (pgcount > 0) { @@ -1151,6 +1044,8 @@ UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pca } videodata->ime_candpgsize = SDL_min(pgsize, MAX_CANDLIST); videodata->ime_candsel = videodata->ime_candsel - pgstart; + + SDL_memset(videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); for (i = pgstart, j = 0; (DWORD)i < count && j < videodata->ime_candpgsize; i++, j++) { BSTR bstr; if (SUCCEEDED(pcandlist->lpVtbl->GetString(pcandlist, i, &bstr))) { @@ -1160,9 +1055,8 @@ UILess_GetCandidateList(SDL_VideoData *videodata, ITfCandidateListUIElement *pca } } } - // TODO: why was this necessary? check ime_candvertical instead? - //if (PRIMLANG() == LANG_KOREAN) - // videodata->ime_candsel = -1; + if (PRIMLANG() == LANG_KOREAN) + videodata->ime_candsel = -1; } STDMETHODIMP_(ULONG) TSFSink_AddRef(TSFSink *sink) @@ -1579,7 +1473,7 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc) SelectObject(hdc, font); for (i = 0; i < candcount; ++i) { - const WCHAR *s = &videodata->ime_candidates[i * MAX_CANDLENGTH]; + const WCHAR *s = videodata->ime_candidates[i]; if (!*s) break; @@ -1641,7 +1535,7 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc) SetBkMode(hdc, TRANSPARENT); for (i = 0; i < candcount; ++i) { - const WCHAR *s = &videodata->ime_candidates[i * MAX_CANDLENGTH]; + const WCHAR *s = videodata->ime_candidates[i]; int left, top, right, bottom; if (!*s) break; @@ -1711,18 +1605,6 @@ void IME_Present(SDL_VideoData *videodata) /* FIXME: Need to show the IME bitmap */ } -SDL_bool WIN_IsTextInputShown(_THIS) -{ - SDL_VideoData* videodata = (SDL_VideoData*)_this->driverdata; - return IME_IsTextInputShown(videodata); -} - -void WIN_ClearComposition(_THIS) -{ - SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; - IME_ClearComposition(videodata); -} - #endif /* SDL_DISABLE_WINDOWS_IME */ #endif /* SDL_VIDEO_DRIVER_WINDOWS */ diff --git a/externals/SDL/src/video/windows/SDL_windowskeyboard.h b/externals/SDL/src/video/windows/SDL_windowskeyboard.h index 97382c7bd..76048e78a 100755 --- a/externals/SDL/src/video/windows/SDL_windowskeyboard.h +++ b/externals/SDL/src/video/windows/SDL_windowskeyboard.h @@ -32,8 +32,6 @@ extern void WIN_ResetDeadKeys(void); extern void WIN_StartTextInput(_THIS); extern void WIN_StopTextInput(_THIS); extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect); -extern void WIN_ClearComposition(_THIS); -extern SDL_bool WIN_IsTextInputShown(_THIS); extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata); diff --git a/externals/SDL/src/video/windows/SDL_windowsmodes.c b/externals/SDL/src/video/windows/SDL_windowsmodes.c index 8fe46dee3..9080cc895 100755 --- a/externals/SDL/src/video/windows/SDL_windowsmodes.c +++ b/externals/SDL/src/video/windows/SDL_windowsmodes.c @@ -31,7 +31,6 @@ #endif /* #define DEBUG_MODES */ -/* #define HIGHDPI_DEBUG_VERBOSE */ static void WIN_UpdateDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode * mode) @@ -51,15 +50,6 @@ WIN_UpdateDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode * int logical_width = GetDeviceCaps( hdc, HORZRES ); int logical_height = GetDeviceCaps( hdc, VERTRES ); - /* High-DPI notes: - - If DPI-unaware: - - GetDeviceCaps( hdc, HORZRES ) will return the monitor width in points. - - DeviceMode.dmPelsWidth is actual pixels (unlike almost all other Windows API's, - it's not virtualized when DPI unaware). - - If DPI-aware: - - GetDeviceCaps( hdc, HORZRES ) will return pixels, same as DeviceMode.dmPelsWidth */ mode->w = logical_width; mode->h = logical_height; @@ -196,99 +186,6 @@ WIN_GetDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_DisplayMode * mod return SDL_TRUE; } -/* The win32 API calls in this function require Windows Vista or later. */ -typedef LONG (WINAPI *SDL_WIN32PROC_GetDisplayConfigBufferSizes)(UINT32 flags, UINT32* numPathArrayElements, UINT32* numModeInfoArrayElements); -typedef LONG (WINAPI *SDL_WIN32PROC_QueryDisplayConfig)(UINT32 flags, UINT32* numPathArrayElements, DISPLAYCONFIG_PATH_INFO* pathArray, UINT32* numModeInfoArrayElements, DISPLAYCONFIG_MODE_INFO* modeInfoArray, DISPLAYCONFIG_TOPOLOGY_ID* currentTopologyId); -typedef LONG (WINAPI *SDL_WIN32PROC_DisplayConfigGetDeviceInfo)(DISPLAYCONFIG_DEVICE_INFO_HEADER* requestPacket); - -static char * -WIN_GetDisplayNameVista(const WCHAR *deviceName) -{ - void *dll; - SDL_WIN32PROC_GetDisplayConfigBufferSizes pGetDisplayConfigBufferSizes; - SDL_WIN32PROC_QueryDisplayConfig pQueryDisplayConfig; - SDL_WIN32PROC_DisplayConfigGetDeviceInfo pDisplayConfigGetDeviceInfo; - DISPLAYCONFIG_PATH_INFO *paths = NULL; - DISPLAYCONFIG_MODE_INFO *modes = NULL; - char *retval = NULL; - UINT32 pathCount = 0; - UINT32 modeCount = 0; - UINT32 i; - LONG rc; - - dll = SDL_LoadObject("USER32.DLL"); - if (!dll) { - return NULL; - } - - pGetDisplayConfigBufferSizes = (SDL_WIN32PROC_GetDisplayConfigBufferSizes) SDL_LoadFunction(dll, "GetDisplayConfigBufferSizes"); - pQueryDisplayConfig = (SDL_WIN32PROC_QueryDisplayConfig) SDL_LoadFunction(dll, "QueryDisplayConfig"); - pDisplayConfigGetDeviceInfo = (SDL_WIN32PROC_DisplayConfigGetDeviceInfo) SDL_LoadFunction(dll, "DisplayConfigGetDeviceInfo"); - - if (!pGetDisplayConfigBufferSizes || !pQueryDisplayConfig || !pDisplayConfigGetDeviceInfo) { - goto WIN_GetDisplayNameVista_failed; - } - - do { - rc = pGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &pathCount, &modeCount); - if (rc != ERROR_SUCCESS) { - goto WIN_GetDisplayNameVista_failed; - } - - SDL_free(paths); - SDL_free(modes); - - paths = (DISPLAYCONFIG_PATH_INFO *) SDL_malloc(sizeof (DISPLAYCONFIG_PATH_INFO) * pathCount); - modes = (DISPLAYCONFIG_MODE_INFO *) SDL_malloc(sizeof (DISPLAYCONFIG_MODE_INFO) * modeCount); - if ((paths == NULL) || (modes == NULL)) { - goto WIN_GetDisplayNameVista_failed; - } - - rc = pQueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &pathCount, paths, &modeCount, modes, 0); - } while (rc == ERROR_INSUFFICIENT_BUFFER); - - if (rc == ERROR_SUCCESS) { - for (i = 0; i < pathCount; i++) { - DISPLAYCONFIG_SOURCE_DEVICE_NAME sourceName; - DISPLAYCONFIG_TARGET_DEVICE_NAME targetName; - - SDL_zero(sourceName); - sourceName.header.adapterId = paths[i].targetInfo.adapterId; - sourceName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME; - sourceName.header.size = sizeof (sourceName); - rc = pDisplayConfigGetDeviceInfo(&sourceName.header); - if (rc != ERROR_SUCCESS) { - break; - } else if (SDL_wcscmp(deviceName, sourceName.viewGdiDeviceName) != 0) { - continue; - } - - SDL_zero(targetName); - targetName.header.adapterId = paths[i].targetInfo.adapterId; - targetName.header.id = paths[i].targetInfo.id; - targetName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME; - targetName.header.size = sizeof (targetName); - rc = pDisplayConfigGetDeviceInfo(&targetName.header); - if (rc == ERROR_SUCCESS) { - retval = WIN_StringToUTF8W(targetName.monitorFriendlyDeviceName); - } - break; - } - } - - SDL_free(paths); - SDL_free(modes); - SDL_UnloadObject(dll); - return retval; - -WIN_GetDisplayNameVista_failed: - SDL_free(retval); - SDL_free(paths); - SDL_free(modes); - SDL_UnloadObject(dll); - return NULL; -} - static SDL_bool WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_bool send_event) { @@ -297,6 +194,7 @@ WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_bool se SDL_DisplayData *displaydata; SDL_DisplayMode mode; SDL_DisplayOrientation orientation; + DISPLAY_DEVICEW device; #ifdef DEBUG_MODES SDL_Log("Display: %s\n", WIN_StringToUTF8W(info->szDevice)); @@ -335,16 +233,10 @@ WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_bool se displaydata->IsValid = SDL_TRUE; SDL_zero(display); - display.name = WIN_GetDisplayNameVista(info->szDevice); - if (display.name == NULL) { - DISPLAY_DEVICEW device; - SDL_zero(device); - device.cb = sizeof (device); - if (EnumDisplayDevicesW(info->szDevice, 0, &device, 0)) { - display.name = WIN_StringToUTF8W(device.DeviceString); - } + device.cb = sizeof(device); + if (EnumDisplayDevicesW(info->szDevice, 0, &device, 0)) { + display.name = WIN_StringToUTF8W(device.DeviceString); } - display.desktop_mode = mode; display.current_mode = mode; display.orientation = orientation; @@ -409,46 +301,10 @@ WIN_InitModes(_THIS) return 0; } -/** - * Convert the monitor rect and work rect from pixels to the SDL coordinate system (monitor origins are in pixels, - * monitor size in DPI-scaled points). - * - * No-op if DPI scaling is not enabled. - */ -static void -WIN_MonitorInfoToSDL(const SDL_VideoData *videodata, HMONITOR monitor, MONITORINFO *info) -{ - UINT xdpi, ydpi; - - if (!videodata->dpi_scaling_enabled) { - return; - } - - /* Check for Windows < 8.1*/ - if (!videodata->GetDpiForMonitor) { - return; - } - if (videodata->GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &xdpi, &ydpi) != S_OK) { - /* Shouldn't happen? */ - return; - } - - /* Convert monitor size to points, leaving the monitor position in pixels */ - info->rcMonitor.right = info->rcMonitor.left + MulDiv(info->rcMonitor.right - info->rcMonitor.left, 96, xdpi); - info->rcMonitor.bottom = info->rcMonitor.top + MulDiv(info->rcMonitor.bottom - info->rcMonitor.top, 96, ydpi); - - /* Convert monitor work rect to points */ - info->rcWork.left = info->rcMonitor.left + MulDiv(info->rcWork.left - info->rcMonitor.left, 96, xdpi); - info->rcWork.right = info->rcMonitor.left + MulDiv(info->rcWork.right - info->rcMonitor.left, 96, xdpi); - info->rcWork.top = info->rcMonitor.top + MulDiv(info->rcWork.top - info->rcMonitor.top, 96, ydpi); - info->rcWork.bottom = info->rcMonitor.top + MulDiv(info->rcWork.bottom - info->rcMonitor.top, 96, ydpi); -} - int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) { const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; - const SDL_VideoData *videodata = (SDL_VideoData *)display->device->driverdata; MONITORINFO minfo; BOOL rc; @@ -460,7 +316,6 @@ WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return SDL_SetError("Couldn't find monitor data"); } - WIN_MonitorInfoToSDL(videodata, data->MonitorHandle, &minfo); rect->x = minfo.rcMonitor.left; rect->y = minfo.rcMonitor.top; rect->w = minfo.rcMonitor.right - minfo.rcMonitor.left; @@ -532,7 +387,6 @@ int WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) { const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; - const SDL_VideoData *videodata = (SDL_VideoData *)display->device->driverdata; MONITORINFO minfo; BOOL rc; @@ -544,7 +398,6 @@ WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return SDL_SetError("Couldn't find monitor data"); } - WIN_MonitorInfoToSDL(videodata, data->MonitorHandle, &minfo); rect->x = minfo.rcWork.left; rect->y = minfo.rcWork.top; rect->w = minfo.rcWork.right - minfo.rcWork.left; @@ -553,190 +406,6 @@ WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return 0; } -/** - * If x, y are outside of rect, snaps them to the closest point inside rect - * (between rect->x, rect->y, inclusive, and rect->x + w, rect->y + h, exclusive) - */ -static void -SDL_GetClosestPointOnRect(const SDL_Rect *rect, int *x, int *y) -{ - const int right = rect->x + rect->w - 1; - const int bottom = rect->y + rect->h - 1; - - if (*x < rect->x) { - *x = rect->x; - } else if (*x > right) { - *x = right; - } - - if (*y < rect->y) { - *y = rect->y; - } else if (*y > bottom) { - *y = bottom; - } -} - -/** - * Returns the display index of the display which either encloses the given point - * or is closest to it. The point is in SDL screen coordinates. - */ -static int -SDL_GetPointDisplayIndex(int x, int y) -{ - int i, dist; - int closest = -1; - int closest_dist = 0x7FFFFFFF; - SDL_Point closest_point_on_display; - SDL_Point delta; - SDL_Rect rect; - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - SDL_Point point; - point.x = x; - point.y = y; - - for (i = 0; i < _this->num_displays; ++i) { - /* Check for an exact match */ - SDL_GetDisplayBounds(i, &rect); - if (SDL_EnclosePoints(&point, 1, &rect, NULL)) { - return i; - } - - /* Snap x, y to the display rect */ - closest_point_on_display = point; - SDL_GetClosestPointOnRect(&rect, &closest_point_on_display.x, &closest_point_on_display.y); - - delta.x = point.x - closest_point_on_display.x; - delta.y = point.y - closest_point_on_display.y; - dist = (delta.x*delta.x + delta.y*delta.y); - if (dist < closest_dist) { - closest = i; - closest_dist = dist; - } - } - if (closest < 0) { - SDL_SetError("Couldn't find any displays"); - } - return closest; -} - -/** - * Convert a point from the SDL coordinate system (monitor origins are in pixels, - * offset within a monitor in DPI-scaled points) to Windows virtual screen coordinates (pixels). - * - * No-op if DPI scaling is not enabled (returns 96 dpi). - * - * Returns the DPI of the monitor that was closest to x, y and used for the conversion. - */ -void WIN_ScreenPointFromSDL(int *x, int *y, int *dpiOut) -{ - const SDL_VideoDevice *videodevice = SDL_GetVideoDevice(); - const SDL_VideoData *videodata; - int displayIndex; - SDL_Rect bounds; - float ddpi, hdpi, vdpi; - int x_sdl, y_sdl; - - if (dpiOut) { - *dpiOut = 96; - } - - if (!videodevice || !videodevice->driverdata) { - return; - } - - videodata = (SDL_VideoData *)videodevice->driverdata; - if (!videodata->dpi_scaling_enabled) { - return; - } - - /* Can't use MonitorFromPoint for this because we currently have SDL coordinates, not pixels */ - displayIndex = SDL_GetPointDisplayIndex(*x, *y); - - if (displayIndex < 0) { - return; - } - - if (SDL_GetDisplayBounds(displayIndex, &bounds) < 0 - || SDL_GetDisplayDPI(displayIndex, &ddpi, &hdpi, &vdpi) < 0) { - return; - } - - if (dpiOut) { - *dpiOut = (int) ddpi; - } - - /* Undo the DPI-scaling within the monitor bounds to convert back to pixels */ - x_sdl = *x; - y_sdl = *y; - *x = bounds.x + MulDiv(x_sdl - bounds.x, (int)ddpi, 96); - *y = bounds.y + MulDiv(y_sdl - bounds.y, (int)ddpi, 96); - -#ifdef HIGHDPI_DEBUG_VERBOSE - SDL_Log("WIN_ScreenPointFromSDL: (%d, %d) points -> (%d x %d) pixels, using %d DPI monitor", - x_sdl, y_sdl, *x, *y, (int)ddpi); -#endif -} - -/** - * Convert a point from Windows virtual screen coordinates (pixels) to the SDL - * coordinate system (monitor origins are in pixels, offset within a monitor in DPI-scaled points). - * - * No-op if DPI scaling is not enabled. - */ -void WIN_ScreenPointToSDL(int *x, int *y) -{ - const SDL_VideoDevice *videodevice = SDL_GetVideoDevice(); - const SDL_VideoData *videodata; - POINT point; - HMONITOR monitor; - int i, displayIndex; - SDL_Rect bounds; - float ddpi, hdpi, vdpi; - int x_pixels, y_pixels; - - if (!videodevice || !videodevice->driverdata) { - return; - } - - videodata = (SDL_VideoData *)videodevice->driverdata; - if (!videodata->dpi_scaling_enabled) { - return; - } - - point.x = *x; - point.y = *y; - monitor = MonitorFromPoint(point, MONITOR_DEFAULTTONEAREST); - - /* Search for the corresponding SDL monitor */ - displayIndex = -1; - for (i = 0; i < videodevice->num_displays; ++i) { - SDL_DisplayData *driverdata = (SDL_DisplayData *)videodevice->displays[i].driverdata; - if (driverdata->MonitorHandle == monitor) { - displayIndex = i; - } - } - if (displayIndex == -1) { - return; - } - - /* Get SDL display properties */ - if (SDL_GetDisplayBounds(displayIndex, &bounds) < 0 - || SDL_GetDisplayDPI(displayIndex, &ddpi, &hdpi, &vdpi) < 0) { - return; - } - - /* Convert the point's offset within the monitor from pixels to DPI-scaled points */ - x_pixels = *x; - y_pixels = *y; - *x = bounds.x + MulDiv(x_pixels - bounds.x, 96, (int)ddpi); - *y = bounds.y + MulDiv(y_pixels - bounds.y, 96, (int)ddpi); - -#ifdef HIGHDPI_DEBUG_VERBOSE - SDL_Log("WIN_ScreenPointToSDL: (%d, %d) pixels -> (%d x %d) points, using %d DPI monitor", - x_pixels, y_pixels, *x, *y, (int)ddpi); -#endif -} - void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { @@ -763,37 +432,6 @@ WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) } } -#ifdef DEBUG_MODES -static void -WIN_LogMonitor(_THIS, HMONITOR mon) -{ - const SDL_VideoData *vid_data = (const SDL_VideoData *)_this->driverdata; - MONITORINFOEX minfo; - UINT xdpi = 0, ydpi = 0; - char *name_utf8; - - if (vid_data->GetDpiForMonitor) { - vid_data->GetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &xdpi, &ydpi); - } - - SDL_zero(minfo); - minfo.cbSize = sizeof(minfo); - GetMonitorInfo(mon, (LPMONITORINFO)&minfo); - - name_utf8 = WIN_StringToUTF8(minfo.szDevice); - - SDL_Log("WIN_LogMonitor: monitor \"%s\": dpi: %d windows screen coordinates: %d, %d, %dx%d", - name_utf8, - xdpi, - minfo.rcMonitor.left, - minfo.rcMonitor.top, - minfo.rcMonitor.right - minfo.rcMonitor.left, - minfo.rcMonitor.bottom - minfo.rcMonitor.top); - - SDL_free(name_utf8); -} -#endif - int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) { @@ -801,30 +439,9 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; LONG status; -#ifdef DEBUG_MODES - SDL_Log("WIN_SetDisplayMode: monitor state before mode change:"); - WIN_LogMonitor(_this, displaydata->MonitorHandle); -#endif - - /* High-DPI notes: - - - ChangeDisplaySettingsEx always takes pixels. - - e.g. if the display is set to 2880x1800 with 200% scaling in Display Settings - - calling ChangeDisplaySettingsEx with a dmPelsWidth/Height other than 2880x1800 will - change the monitor DPI to 96. (100% scaling) - - calling ChangeDisplaySettingsEx with a dmPelsWidth/Height of 2880x1800 (or a NULL DEVMODE*) will - reset the monitor DPI to 192. (200% scaling) - - NOTE: these are temporary changes in DPI, not modifications to the Control Panel setting. */ if (mode->driverdata == display->desktop_mode.driverdata) { -#ifdef DEBUG_MODES - SDL_Log("WIN_SetDisplayMode: resetting to original resolution"); -#endif status = ChangeDisplaySettingsExW(displaydata->DeviceName, NULL, NULL, CDS_FULLSCREEN, NULL); } else { -#ifdef DEBUG_MODES - SDL_Log("WIN_SetDisplayMode: changing to %dx%d pixels", data->DeviceMode.dmPelsWidth, data->DeviceMode.dmPelsHeight); -#endif status = ChangeDisplaySettingsExW(displaydata->DeviceName, &data->DeviceMode, NULL, CDS_FULLSCREEN, NULL); } if (status != DISP_CHANGE_SUCCESSFUL) { @@ -845,12 +462,6 @@ WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) } return SDL_SetError("ChangeDisplaySettingsEx() failed: %s", reason); } - -#ifdef DEBUG_MODES - SDL_Log("WIN_SetDisplayMode: monitor state after mode change:"); - WIN_LogMonitor(_this, displaydata->MonitorHandle); -#endif - EnumDisplaySettingsW(displaydata->DeviceName, ENUM_CURRENT_SETTINGS, &data->DeviceMode); WIN_UpdateDisplayMode(_this, displaydata->DeviceName, ENUM_CURRENT_SETTINGS, mode); return 0; diff --git a/externals/SDL/src/video/windows/SDL_windowsmodes.h b/externals/SDL/src/video/windows/SDL_windowsmodes.h index 6bf62e586..0f2cdf489 100755 --- a/externals/SDL/src/video/windows/SDL_windowsmodes.h +++ b/externals/SDL/src/video/windows/SDL_windowsmodes.h @@ -38,8 +38,6 @@ typedef struct extern int WIN_InitModes(_THIS); extern int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern int WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); -extern void WIN_ScreenPointFromSDL(int *x, int *y, int *dpiOut); -extern void WIN_ScreenPointToSDL(int *x, int *y); extern int WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); diff --git a/externals/SDL/src/video/windows/SDL_windowsmouse.c b/externals/SDL/src/video/windows/SDL_windowsmouse.c index b13b75faf..19977e214 100755 --- a/externals/SDL/src/video/windows/SDL_windowsmouse.c +++ b/externals/SDL/src/video/windows/SDL_windowsmouse.c @@ -175,13 +175,11 @@ WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) static SDL_Cursor * WIN_CreateBlankCursor() { - SDL_Cursor *cursor = NULL; SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, 32, 32, 32, SDL_PIXELFORMAT_ARGB8888); if (surface) { - cursor = WIN_CreateCursor(surface, 0, 0); - SDL_FreeSurface(surface); + return WIN_CreateCursor(surface, 0, 0); } - return cursor; + return NULL; } static SDL_Cursor * @@ -290,7 +288,6 @@ WIN_WarpMouseGlobal(int x, int y) { POINT pt; - WIN_ScreenPointFromSDL(&x, &y, NULL); pt.x = x; pt.y = y; SetCursorPos(pt.x, pt.y); @@ -334,7 +331,6 @@ WIN_GetGlobalMouseState(int *x, int *y) GetCursorPos(&pt); *x = (int) pt.x; *y = (int) pt.y; - WIN_ScreenPointToSDL(x, y); retval |= GetAsyncKeyState(!swapButtons ? VK_LBUTTON : VK_RBUTTON) & 0x8000 ? SDL_BUTTON_LMASK : 0; retval |= GetAsyncKeyState(!swapButtons ? VK_RBUTTON : VK_LBUTTON) & 0x8000 ? SDL_BUTTON_RMASK : 0; @@ -374,8 +370,7 @@ WIN_QuitMouse(_THIS) } if (SDL_blank_cursor) { - WIN_FreeCursor(SDL_blank_cursor); - SDL_blank_cursor = NULL; + SDL_FreeCursor(SDL_blank_cursor); } } diff --git a/externals/SDL/src/video/windows/SDL_windowsopengl.c b/externals/SDL/src/video/windows/SDL_windowsopengl.c index a35d9728d..0c99ca9a6 100755 --- a/externals/SDL/src/video/windows/SDL_windowsopengl.c +++ b/externals/SDL/src/video/windows/SDL_windowsopengl.c @@ -676,7 +676,6 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) _this->GL_UnloadLibrary = WIN_GLES_UnloadLibrary; _this->GL_CreateContext = WIN_GLES_CreateContext; _this->GL_MakeCurrent = WIN_GLES_MakeCurrent; - _this->GL_GetDrawableSize = WIN_GLES_GetDrawableSize; _this->GL_SetSwapInterval = WIN_GLES_SetSwapInterval; _this->GL_GetSwapInterval = WIN_GLES_GetSwapInterval; _this->GL_SwapWindow = WIN_GLES_SwapWindow; @@ -823,12 +822,6 @@ WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) return 0; } -void -WIN_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) -{ - WIN_GetDrawableSize(window, w, h); -} - int WIN_GL_SetSwapInterval(_THIS, int interval) { diff --git a/externals/SDL/src/video/windows/SDL_windowsopengl.h b/externals/SDL/src/video/windows/SDL_windowsopengl.h index 36779aa4a..2dec0023a 100755 --- a/externals/SDL/src/video/windows/SDL_windowsopengl.h +++ b/externals/SDL/src/video/windows/SDL_windowsopengl.h @@ -71,7 +71,6 @@ extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window); extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window); extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -extern void WIN_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); extern int WIN_GL_SetSwapInterval(_THIS, int interval); extern int WIN_GL_GetSwapInterval(_THIS); extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window); diff --git a/externals/SDL/src/video/windows/SDL_windowsopengles.c b/externals/SDL/src/video/windows/SDL_windowsopengles.c index 493f1aff3..eedc0e6ab 100755 --- a/externals/SDL/src/video/windows/SDL_windowsopengles.c +++ b/externals/SDL/src/video/windows/SDL_windowsopengles.c @@ -25,7 +25,6 @@ #include "SDL_windowsvideo.h" #include "SDL_windowsopengles.h" #include "SDL_windowsopengl.h" -#include "SDL_windowswindow.h" /* EGL implementation of SDL OpenGL support */ @@ -41,7 +40,6 @@ WIN_GLES_LoadLibrary(_THIS, const char *path) { _this->GL_UnloadLibrary = WIN_GL_UnloadLibrary; _this->GL_CreateContext = WIN_GL_CreateContext; _this->GL_MakeCurrent = WIN_GL_MakeCurrent; - _this->GL_GetDrawableSize = WIN_GL_GetDrawableSize; _this->GL_SetSwapInterval = WIN_GL_SetSwapInterval; _this->GL_GetSwapInterval = WIN_GL_GetSwapInterval; _this->GL_SwapWindow = WIN_GL_SwapWindow; @@ -74,7 +72,6 @@ WIN_GLES_CreateContext(_THIS, SDL_Window * window) _this->GL_UnloadLibrary = WIN_GL_UnloadLibrary; _this->GL_CreateContext = WIN_GL_CreateContext; _this->GL_MakeCurrent = WIN_GL_MakeCurrent; - _this->GL_GetDrawableSize = WIN_GL_GetDrawableSize; _this->GL_SetSwapInterval = WIN_GL_SetSwapInterval; _this->GL_GetSwapInterval = WIN_GL_GetSwapInterval; _this->GL_SwapWindow = WIN_GL_SwapWindow; @@ -102,12 +99,6 @@ WIN_GLES_DeleteContext(_THIS, SDL_GLContext context) SDL_EGL_SwapWindow_impl(WIN) SDL_EGL_MakeCurrent_impl(WIN) -void -WIN_GLES_GetDrawableSize(_THIS, SDL_Window* window, int* w, int* h) -{ - WIN_GetDrawableSize(window, w, h); -} - int WIN_GLES_SetupWindow(_THIS, SDL_Window * window) { diff --git a/externals/SDL/src/video/windows/SDL_windowsopengles.h b/externals/SDL/src/video/windows/SDL_windowsopengles.h index e59c02ebd..b21c56f4f 100755 --- a/externals/SDL/src/video/windows/SDL_windowsopengles.h +++ b/externals/SDL/src/video/windows/SDL_windowsopengles.h @@ -39,7 +39,6 @@ extern int WIN_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window); extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window); extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -extern void WIN_GLES_GetDrawableSize(_THIS, SDL_Window* window, int* w, int* h); extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context); extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window); diff --git a/externals/SDL/src/video/windows/SDL_windowsvideo.c b/externals/SDL/src/video/windows/SDL_windowsvideo.c index 32e21fb1f..39806930b 100755 --- a/externals/SDL/src/video/windows/SDL_windowsvideo.c +++ b/externals/SDL/src/video/windows/SDL_windowsvideo.c @@ -35,8 +35,6 @@ #include "SDL_windowsshape.h" #include "SDL_windowsvulkan.h" -/* #define HIGHDPI_DEBUG */ - /* Initialization/Query functions */ static int WIN_VideoInit(_THIS); static void WIN_VideoQuit(_THIS); @@ -124,16 +122,6 @@ WIN_CreateDevice(int devindex) data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle"); data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo"); data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow"); - data->SetProcessDPIAware = (BOOL (WINAPI *)(void)) SDL_LoadFunction(data->userDLL, "SetProcessDPIAware"); - data->SetProcessDpiAwarenessContext = (BOOL (WINAPI *)(DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "SetProcessDpiAwarenessContext"); - data->SetThreadDpiAwarenessContext = (DPI_AWARENESS_CONTEXT (WINAPI *)(DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "SetThreadDpiAwarenessContext"); - data->GetThreadDpiAwarenessContext = (DPI_AWARENESS_CONTEXT (WINAPI *)(void)) SDL_LoadFunction(data->userDLL, "GetThreadDpiAwarenessContext"); - data->GetAwarenessFromDpiAwarenessContext = (DPI_AWARENESS (WINAPI *)(DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "GetAwarenessFromDpiAwarenessContext"); - data->EnableNonClientDpiScaling = (BOOL (WINAPI *)(HWND)) SDL_LoadFunction(data->userDLL, "EnableNonClientDpiScaling"); - data->AdjustWindowRectExForDpi = (BOOL (WINAPI *)(LPRECT, DWORD, BOOL, DWORD, UINT)) SDL_LoadFunction(data->userDLL, "AdjustWindowRectExForDpi"); - data->GetDpiForWindow = (UINT (WINAPI *)(HWND)) SDL_LoadFunction(data->userDLL, "GetDpiForWindow"); - data->AreDpiAwarenessContextsEqual = (BOOL (WINAPI *)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "AreDpiAwarenessContextsEqual"); - data->IsValidDpiAwarenessContext = (BOOL (WINAPI *)(DPI_AWARENESS_CONTEXT)) SDL_LoadFunction(data->userDLL, "IsValidDpiAwarenessContext"); } else { SDL_ClearError(); } @@ -141,7 +129,6 @@ WIN_CreateDevice(int devindex) data->shcoreDLL = SDL_LoadObject("SHCORE.DLL"); if (data->shcoreDLL) { data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor"); - data->SetProcessDpiAwareness = (HRESULT (WINAPI *)(PROCESS_DPI_AWARENESS)) SDL_LoadFunction(data->shcoreDLL, "SetProcessDpiAwareness"); } else { SDL_ClearError(); } @@ -203,7 +190,6 @@ WIN_CreateDevice(int devindex) device->GL_UnloadLibrary = WIN_GL_UnloadLibrary; device->GL_CreateContext = WIN_GL_CreateContext; device->GL_MakeCurrent = WIN_GL_MakeCurrent; - device->GL_GetDrawableSize = WIN_GL_GetDrawableSize; device->GL_SetSwapInterval = WIN_GL_SetSwapInterval; device->GL_GetSwapInterval = WIN_GL_GetSwapInterval; device->GL_SwapWindow = WIN_GL_SwapWindow; @@ -215,7 +201,6 @@ WIN_CreateDevice(int devindex) device->GL_UnloadLibrary = WIN_GLES_UnloadLibrary; device->GL_CreateContext = WIN_GLES_CreateContext; device->GL_MakeCurrent = WIN_GLES_MakeCurrent; - device->GL_GetDrawableSize = WIN_GLES_GetDrawableSize; device->GL_SetSwapInterval = WIN_GLES_SetSwapInterval; device->GL_GetSwapInterval = WIN_GLES_GetSwapInterval; device->GL_SwapWindow = WIN_GLES_SwapWindow; @@ -226,14 +211,11 @@ WIN_CreateDevice(int devindex) device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions; device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface; - device->Vulkan_GetDrawableSize = WIN_GL_GetDrawableSize; #endif device->StartTextInput = WIN_StartTextInput; device->StopTextInput = WIN_StopTextInput; device->SetTextInputRect = WIN_SetTextInputRect; - device->ClearComposition = WIN_ClearComposition; - device->IsTextInputShown = WIN_IsTextInputShown; device->SetClipboardText = WIN_SetClipboardText; device->GetClipboardText = WIN_GetClipboardText; @@ -249,159 +231,11 @@ VideoBootStrap WINDOWS_bootstrap = { "windows", "SDL Windows video driver", WIN_CreateDevice }; -static BOOL -WIN_DeclareDPIAwareUnaware(_THIS) -{ - SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; - - if (data->SetProcessDpiAwarenessContext) { - return data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE); - } else if (data->SetProcessDpiAwareness) { - /* Windows 8.1 */ - return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_DPI_UNAWARE)); - } - return FALSE; -} - -static BOOL -WIN_DeclareDPIAwareSystem(_THIS) -{ - SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; - - if (data->SetProcessDpiAwarenessContext) { - /* Windows 10, version 1607 */ - return data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE); - } else if (data->SetProcessDpiAwareness) { - /* Windows 8.1 */ - return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)); - } else if (data->SetProcessDPIAware) { - /* Windows Vista */ - return data->SetProcessDPIAware(); - } - return FALSE; -} - -static BOOL -WIN_DeclareDPIAwarePerMonitor(_THIS) -{ - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - - if (data->SetProcessDpiAwarenessContext) { - /* Windows 10, version 1607 */ - return data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE); - } else if (data->SetProcessDpiAwareness) { - /* Windows 8.1 */ - return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE)); - } else { - /* Older OS: fall back to system DPI aware */ - return WIN_DeclareDPIAwareSystem(_this); - } - return FALSE; -} - -static BOOL -WIN_DeclareDPIAwarePerMonitorV2(_THIS) -{ - SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; - - /* Declare DPI aware (may have been done in external code or a manifest, as well) */ - if (data->SetProcessDpiAwarenessContext) { - /* Windows 10, version 1607 */ - - /* NOTE: SetThreadDpiAwarenessContext doesn't work here with OpenGL - the OpenGL contents - end up still getting OS scaled. (tested on Windows 10 21H1 19043.1348, NVIDIA 496.49) - - NOTE: Enabling DPI awareness through Windows Explorer - (right click .exe -> Properties -> Compatibility -> High DPI Settings -> - check "Override high DPI Scaling behaviour", select Application) gives - a DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE context (at least on Windows 10 21H1), and - setting DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 will fail. - - NOTE: Entering exclusive fullscreen in a DPI_AWARENESS_CONTEXT_UNAWARE process - appears to cause Windows to change the .exe manifest to DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE - on future launches. This means attempting to use DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 - will fail in the future until you manually clear the "Override high DPI Scaling behaviour" - setting in Windows Explorer (tested on Windows 10 21H2). - */ - if (data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)) { - return TRUE; - } else { - return WIN_DeclareDPIAwarePerMonitor(_this); - } - } else { - /* Older OS: fall back to per-monitor (or system) */ - return WIN_DeclareDPIAwarePerMonitor(_this); - } -} - -#ifdef HIGHDPI_DEBUG -static const char* -WIN_GetDPIAwareness(_THIS) -{ - SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; - - if (data->GetThreadDpiAwarenessContext && data->AreDpiAwarenessContextsEqual) { - DPI_AWARENESS_CONTEXT context = data->GetThreadDpiAwarenessContext(); - - if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_UNAWARE)) { - return "unaware"; - } else if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_SYSTEM_AWARE)) { - return "system"; - } else if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE)) { - return "permonitor"; - } else if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)) { - return "permonitorv2"; - } else if (data->AreDpiAwarenessContextsEqual(context, DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED)) { - return "unaware_gdiscaled"; - } - } - - return ""; -} -#endif - -static void -WIN_InitDPIAwareness(_THIS) -{ - const char* hint = SDL_GetHint(SDL_HINT_WINDOWS_DPI_AWARENESS); - - if (hint != NULL) { - if (SDL_strcmp(hint, "permonitorv2") == 0) { - WIN_DeclareDPIAwarePerMonitorV2(_this); - } else if (SDL_strcmp(hint, "permonitor") == 0) { - WIN_DeclareDPIAwarePerMonitor(_this); - } else if (SDL_strcmp(hint, "system") == 0) { - WIN_DeclareDPIAwareSystem(_this); - } else if (SDL_strcmp(hint, "unaware") == 0) { - WIN_DeclareDPIAwareUnaware(_this); - } - } -} - -static void -WIN_InitDPIScaling(_THIS) -{ - SDL_VideoData* data = (SDL_VideoData*)_this->driverdata; - - if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DPI_SCALING, SDL_FALSE)) { - WIN_DeclareDPIAwarePerMonitorV2(_this); - - data->dpi_scaling_enabled = SDL_TRUE; - } -} - int WIN_VideoInit(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - WIN_InitDPIAwareness(_this); - WIN_InitDPIScaling(_this); - -#ifdef HIGHDPI_DEBUG - SDL_Log("DPI awareness: %s", WIN_GetDPIAwareness(_this)); -#endif - if (WIN_InitModes(_this) < 0) { return -1; } @@ -429,22 +263,6 @@ WIN_VideoQuit(_THIS) #define D3D_DEBUG_INFO #include -#ifdef D3D_DEBUG_INFO -#ifndef D3D_SDK_VERSION -#define D3D_SDK_VERSION (32 | 0x80000000) -#endif -#ifndef D3D9b_SDK_VERSION -#define D3D9b_SDK_VERSION (31 | 0x80000000) -#endif -#else /**/ -#ifndef D3D_SDK_VERSION -#define D3D_SDK_VERSION 32 -#endif -#ifndef D3D9b_SDK_VERSION -#define D3D9b_SDK_VERSION 31 -#endif -#endif - SDL_bool D3D_LoadDLL(void **pD3DDLL, IDirect3D9 **pDirect3D9Interface) { @@ -637,19 +455,6 @@ SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex) #endif } -SDL_bool -WIN_IsPerMonitorV2DPIAware(_THIS) -{ - SDL_VideoData* data = (SDL_VideoData*) _this->driverdata; - - if (data->AreDpiAwarenessContextsEqual && data->GetThreadDpiAwarenessContext) { - /* Windows 10, version 1607 */ - return (SDL_bool)data->AreDpiAwarenessContextsEqual(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, - data->GetThreadDpiAwarenessContext()); - } - return SDL_FALSE; -} - #endif /* SDL_VIDEO_DRIVER_WINDOWS */ /* vim: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/windows/SDL_windowsvideo.h b/externals/SDL/src/video/windows/SDL_windowsvideo.h index 50a4371ac..7dae16a4a 100755 --- a/externals/SDL/src/video/windows/SDL_windowsvideo.h +++ b/externals/SDL/src/video/windows/SDL_windowsvideo.h @@ -37,7 +37,6 @@ #define MAX_CANDLIST 10 #define MAX_CANDLENGTH 256 -#define MAX_CANDSIZE (sizeof(WCHAR) * MAX_CANDLIST * MAX_CANDLENGTH) #include "SDL_windowsclipboard.h" #include "SDL_windowsevents.h" @@ -75,203 +74,6 @@ typedef struct _TOUCHINPUT { DWORD cyContact; } TOUCHINPUT, *PTOUCHINPUT; - -/* More-robust display information in Vista... */ -/* This is a huge amount of data to be stuffing into three API calls. :( */ -typedef struct DISPLAYCONFIG_PATH_SOURCE_INFO -{ - LUID adapterId; - UINT32 id; - union - { - UINT32 modeInfoIdx; - struct - { - UINT32 cloneGroupId : 16; - UINT32 sourceModeInfoIdx : 16; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - - UINT32 statusFlags; -} DISPLAYCONFIG_PATH_SOURCE_INFO; - -typedef struct DISPLAYCONFIG_RATIONAL -{ - UINT32 Numerator; - UINT32 Denominator; -} DISPLAYCONFIG_RATIONAL; - -typedef struct DISPLAYCONFIG_PATH_TARGET_INFO -{ - LUID adapterId; - UINT32 id; - union - { - UINT32 modeInfoIdx; - struct - { - UINT32 desktopModeInfoIdx : 16; - UINT32 targetModeInfoIdx : 16; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; - UINT32 /*DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY*/ outputTechnology; - UINT32 /*DISPLAYCONFIG_ROTATION*/ rotation; - UINT32 /*DISPLAYCONFIG_SCALING*/ scaling; - DISPLAYCONFIG_RATIONAL refreshRate; - UINT32 /*DISPLAYCONFIG_SCANLINE_ORDERING*/ scanLineOrdering; - BOOL targetAvailable; - UINT32 statusFlags; -} DISPLAYCONFIG_PATH_TARGET_INFO; - -typedef struct DISPLAYCONFIG_PATH_INFO -{ - DISPLAYCONFIG_PATH_SOURCE_INFO sourceInfo; - DISPLAYCONFIG_PATH_TARGET_INFO targetInfo; - UINT32 flags; -} DISPLAYCONFIG_PATH_INFO; - -typedef enum -{ - DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE = 1, - DISPLAYCONFIG_MODE_INFO_TYPE_TARGET = 2, - DISPLAYCONFIG_MODE_INFO_TYPE_DESKTOP_IMAGE = 3, - DISPLAYCONFIG_MODE_INFO_TYPE_FORCE_UINT32 = 0xFFFFFFFF -} DISPLAYCONFIG_MODE_INFO_TYPE; - -typedef struct DISPLAYCONFIG_2DREGION -{ - UINT32 cx; - UINT32 cy; -} DISPLAYCONFIG_2DREGION; - -typedef struct DISPLAYCONFIG_VIDEO_SIGNAL_INFO -{ - UINT64 pixelRate; - DISPLAYCONFIG_RATIONAL hSyncFreq; - DISPLAYCONFIG_RATIONAL vSyncFreq; - DISPLAYCONFIG_2DREGION activeSize; - DISPLAYCONFIG_2DREGION totalSize; - - union - { - struct - { - UINT32 videoStandard : 16; - - // Vertical refresh frequency divider - UINT32 vSyncFreqDivider : 6; - - UINT32 reserved : 10; - } AdditionalSignalInfo; - - UINT32 videoStandard; - } DUMMYUNIONNAME; - - // Scan line ordering (e.g. progressive, interlaced). - UINT32 /*DISPLAYCONFIG_SCANLINE_ORDERING*/ scanLineOrdering; -} DISPLAYCONFIG_VIDEO_SIGNAL_INFO; - -typedef struct DISPLAYCONFIG_SOURCE_MODE -{ - UINT32 width; - UINT32 height; - UINT32 /*DISPLAYCONFIG_PIXELFORMAT*/ pixelFormat; - POINTL position; -} DISPLAYCONFIG_SOURCE_MODE; - -typedef struct DISPLAYCONFIG_TARGET_MODE -{ - DISPLAYCONFIG_VIDEO_SIGNAL_INFO targetVideoSignalInfo; -} DISPLAYCONFIG_TARGET_MODE; - -typedef struct DISPLAYCONFIG_DESKTOP_IMAGE_INFO -{ - POINTL PathSourceSize; - RECTL DesktopImageRegion; - RECTL DesktopImageClip; -} DISPLAYCONFIG_DESKTOP_IMAGE_INFO; - -typedef struct DISPLAYCONFIG_MODE_INFO -{ - DISPLAYCONFIG_MODE_INFO_TYPE infoType; - UINT32 id; - LUID adapterId; - union - { - DISPLAYCONFIG_TARGET_MODE targetMode; - DISPLAYCONFIG_SOURCE_MODE sourceMode; - DISPLAYCONFIG_DESKTOP_IMAGE_INFO desktopImageInfo; - } DUMMYUNIONNAME; -} DISPLAYCONFIG_MODE_INFO; - -typedef enum DISPLAYCONFIG_TOPOLOGY_ID -{ - DISPLAYCONFIG_TOPOLOGY_INTERNAL = 0x00000001, - DISPLAYCONFIG_TOPOLOGY_CLONE = 0x00000002, - DISPLAYCONFIG_TOPOLOGY_EXTEND = 0x00000004, - DISPLAYCONFIG_TOPOLOGY_EXTERNAL = 0x00000008, - DISPLAYCONFIG_TOPOLOGY_FORCE_UINT32 = 0xFFFFFFFF -} DISPLAYCONFIG_TOPOLOGY_ID; - -typedef enum -{ - DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME = 1, - DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME = 2, - DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE = 3, - DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME = 4, - DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE = 5, - DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE = 6, - DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION = 7, - DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION = 8, - DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO = 9, - DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE = 10, - DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL = 11, - DISPLAYCONFIG_DEVICE_INFO_FORCE_UINT32 = 0xFFFFFFFF -} DISPLAYCONFIG_DEVICE_INFO_TYPE; - -typedef struct DISPLAYCONFIG_DEVICE_INFO_HEADER -{ - DISPLAYCONFIG_DEVICE_INFO_TYPE type; - UINT32 size; - LUID adapterId; - UINT32 id; -} DISPLAYCONFIG_DEVICE_INFO_HEADER; - -typedef struct DISPLAYCONFIG_SOURCE_DEVICE_NAME -{ - DISPLAYCONFIG_DEVICE_INFO_HEADER header; - WCHAR viewGdiDeviceName[CCHDEVICENAME]; -} DISPLAYCONFIG_SOURCE_DEVICE_NAME; - -typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS -{ - union - { - struct - { - UINT32 friendlyNameFromEdid : 1; - UINT32 friendlyNameForced : 1; - UINT32 edidIdsValid : 1; - UINT32 reserved : 29; - } DUMMYSTRUCTNAME; - UINT32 value; - } DUMMYUNIONNAME; -} DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS; - -typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME -{ - DISPLAYCONFIG_DEVICE_INFO_HEADER header; - DISPLAYCONFIG_TARGET_DEVICE_NAME_FLAGS flags; - UINT32 /*DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY*/ outputTechnology; - UINT16 edidManufactureId; - UINT16 edidProductCodeId; - UINT32 connectorInstance; - WCHAR monitorFriendlyDeviceName[64]; - WCHAR monitorDevicePath[128]; -} DISPLAYCONFIG_TARGET_DEVICE_NAME; - -#define QDC_ONLY_ACTIVE_PATHS 0x00000002 - #endif /* WINVER < 0x0601 */ #if WINVER < 0x0603 @@ -283,43 +85,10 @@ typedef enum MONITOR_DPI_TYPE { MDT_DEFAULT = MDT_EFFECTIVE_DPI } MONITOR_DPI_TYPE; -typedef enum PROCESS_DPI_AWARENESS { - PROCESS_DPI_UNAWARE = 0, - PROCESS_SYSTEM_DPI_AWARE = 1, - PROCESS_PER_MONITOR_DPI_AWARE = 2 -} PROCESS_DPI_AWARENESS; - #else #include #endif /* WINVER < 0x0603 */ -#ifndef _DPI_AWARENESS_CONTEXTS_ - -typedef enum DPI_AWARENESS { - DPI_AWARENESS_INVALID = -1, - DPI_AWARENESS_UNAWARE = 0, - DPI_AWARENESS_SYSTEM_AWARE = 1, - DPI_AWARENESS_PER_MONITOR_AWARE = 2 -} DPI_AWARENESS; - -DECLARE_HANDLE(DPI_AWARENESS_CONTEXT); - -#define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1) -#define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2) -#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3) - -#endif /* _DPI_AWARENESS_CONTEXTS_ */ - -/* Windows 10 Creators Update */ -#if NTDDI_VERSION < 0x0A000003 -#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4) -#endif /* NTDDI_VERSION < 0x0A000003 */ - -/* Windows 10 version 1809 */ -#if NTDDI_VERSION < 0x0A000006 -#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5) -#endif /* NTDDI_VERSION < 0x0A000006 */ - typedef BOOL (*PFNSHFullScreen)(HWND, DWORD); typedef void (*PFCoordTransform)(SDL_Window*, POINT*); @@ -367,26 +136,13 @@ typedef struct SDL_VideoData BOOL (WINAPI *CloseTouchInputHandle)( HTOUCHINPUT ); BOOL (WINAPI *GetTouchInputInfo)( HTOUCHINPUT, UINT, PTOUCHINPUT, int ); BOOL (WINAPI *RegisterTouchWindow)( HWND, ULONG ); - BOOL (WINAPI *SetProcessDPIAware)( void ); - BOOL (WINAPI *SetProcessDpiAwarenessContext)( DPI_AWARENESS_CONTEXT ); - DPI_AWARENESS_CONTEXT (WINAPI *SetThreadDpiAwarenessContext)( DPI_AWARENESS_CONTEXT ); - DPI_AWARENESS_CONTEXT (WINAPI *GetThreadDpiAwarenessContext)( void ); - DPI_AWARENESS (WINAPI *GetAwarenessFromDpiAwarenessContext)( DPI_AWARENESS_CONTEXT ); - BOOL (WINAPI *EnableNonClientDpiScaling)( HWND ); - BOOL (WINAPI *AdjustWindowRectExForDpi)( LPRECT, DWORD, BOOL, DWORD, UINT ); - UINT (WINAPI *GetDpiForWindow)( HWND ); - BOOL (WINAPI *AreDpiAwarenessContextsEqual)(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT); - BOOL (WINAPI *IsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT); void* shcoreDLL; HRESULT (WINAPI *GetDpiForMonitor)( HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT *dpiX, UINT *dpiY ); - HRESULT (WINAPI *SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS dpiAwareness); - - SDL_bool dpi_scaling_enabled; - + SDL_bool ime_com_initialized; struct ITfThreadMgr *ime_threadmgr; SDL_bool ime_initialized; @@ -394,16 +150,14 @@ typedef struct SDL_VideoData SDL_bool ime_available; HWND ime_hwnd_main; HWND ime_hwnd_current; - SDL_bool ime_suppress_endcomposition_event; HIMC ime_himc; - WCHAR* ime_composition; - int ime_composition_length; + WCHAR ime_composition[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; WCHAR ime_readingstring[16]; int ime_cursor; SDL_bool ime_candlist; - WCHAR* ime_candidates; + WCHAR ime_candidates[MAX_CANDLIST][MAX_CANDLENGTH]; DWORD ime_candcount; DWORD ime_candref; DWORD ime_candsel; @@ -434,7 +188,6 @@ typedef struct SDL_VideoData DWORD ime_convmodesinkcookie; TSFSink *ime_uielemsink; TSFSink *ime_ippasink; - LONG ime_uicontext; BYTE pre_hook_key_state[256]; UINT _SDL_WAKEUP; @@ -446,8 +199,6 @@ extern SDL_bool g_WindowFrameUsableWhileCursorHidden; typedef struct IDirect3D9 IDirect3D9; extern SDL_bool D3D_LoadDLL( void **pD3DDLL, IDirect3D9 **pDirect3D9Interface ); -extern SDL_bool WIN_IsPerMonitorV2DPIAware(_THIS); - #endif /* SDL_windowsvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/windows/SDL_windowswindow.c b/externals/SDL/src/video/windows/SDL_windowswindow.c index 49cac8812..e392e5869 100755 --- a/externals/SDL/src/video/windows/SDL_windowswindow.c +++ b/externals/SDL/src/video/windows/SDL_windowswindow.c @@ -24,12 +24,10 @@ #include "../../core/windows/SDL_windows.h" -#include "SDL_log.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" -#include "../../SDL_hints_c.h" #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" @@ -47,25 +45,22 @@ #define SWP_NOCOPYBITS 0 #endif -/* #define HIGHDPI_DEBUG */ - /* Fake window to help with DirectInput events. */ HWND SDL_HelperWindow = NULL; static const TCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); static const TCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); static ATOM SDL_HelperWindowClass = 0; -/* For borderless Windows, still want the following flag: - - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. - Additionally, non-fullscreen windows can add: +/* For borderless Windows, still want the following flags: - WS_CAPTION: this seems to enable the Windows minimize animation - WS_SYSMENU: enables system context menu on task bar + - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen */ #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN) -#define STYLE_FULLSCREEN (WS_POPUP | WS_MINIMIZEBOX) -#define STYLE_BORDERLESS (WS_POPUP | WS_MINIMIZEBOX) +#define STYLE_FULLSCREEN (WS_POPUP) +#define STYLE_BORDERLESS (WS_POPUP) #define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX) @@ -116,87 +111,26 @@ GetWindowStyle(SDL_Window * window) return style; } -/** - * Returns arguments to pass to SetWindowPos - the window rect, including frame, in Windows coordinates. - * Can be called before we have a HWND. - */ static void WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x, int *y, int *width, int *height, SDL_bool use_current) { - SDL_VideoData* videodata = SDL_GetVideoDevice() ? SDL_GetVideoDevice()->driverdata : NULL; RECT rect; - int dpi; - UINT frame_dpi; - /* Client rect, in SDL screen coordinates */ - *x = (use_current ? window->x : window->windowed.x); - *y = (use_current ? window->y : window->windowed.y); - *width = (use_current ? window->w : window->windowed.w); - *height = (use_current ? window->h : window->windowed.h); - - /* Convert client rect from SDL coordinates to pixels (no-op if DPI scaling not enabled) */ - WIN_ScreenPointFromSDL(x, y, &dpi); - /* Note, use the guessed DPI returned from WIN_ScreenPointFromSDL rather than the cached one in - data->scaling_dpi. - - - This is called before the window is created, so we can't rely on data->scaling_dpi - - Bug workaround: when leaving exclusive fullscreen, the cached DPI and window DPI reported - by GetDpiForWindow will be wrong, and would cause windows shrinking slightly when - going from exclusive fullscreen to windowed on a HighDPI monitor with scaling if we used them. - */ - *width = MulDiv(*width, dpi, 96); - *height = MulDiv(*height, dpi, 96); - - /* Copy the client size in pixels into this rect structure, - which we'll then adjust with AdjustWindowRectEx */ rect.left = 0; rect.top = 0; - rect.right = *width; - rect.bottom = *height; + rect.right = (use_current ? window->w : window->windowed.w); + rect.bottom = (use_current ? window->h : window->windowed.h); /* borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles. */ - if (!(window->flags & SDL_WINDOW_BORDERLESS)) { - if (WIN_IsPerMonitorV2DPIAware(SDL_GetVideoDevice())) { - /* With per-monitor v2, the window border/titlebar size depend on the DPI, so we need to call AdjustWindowRectExForDpi instead of - AdjustWindowRectEx. */ - UINT unused; - RECT screen_rect; - HMONITOR mon; + if (!(window->flags & SDL_WINDOW_BORDERLESS)) + AdjustWindowRectEx(&rect, style, menu, 0); - screen_rect.left = *x; - screen_rect.top = *y; - screen_rect.right = *x + *width; - screen_rect.bottom = *y + *height; - - mon = MonitorFromRect(&screen_rect, MONITOR_DEFAULTTONEAREST); - - /* GetDpiForMonitor docs promise to return the same hdpi / vdpi */ - if (videodata->GetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &frame_dpi, &unused) != S_OK) { - frame_dpi = 96; - } - - videodata->AdjustWindowRectExForDpi(&rect, style, menu, 0, frame_dpi); - } else { - AdjustWindowRectEx(&rect, style, menu, 0); - } - } - - /* Final rect in Windows screen space, including the frame */ - *x += rect.left; - *y += rect.top; + *x = (use_current ? window->x : window->windowed.x) + rect.left; + *y = (use_current ? window->y : window->windowed.y) + rect.top; *width = (rect.right - rect.left); *height = (rect.bottom - rect.top); - -#ifdef HIGHDPI_DEBUG - SDL_Log("WIN_AdjustWindowRectWithStyle: in: %d, %d, %dx%d, returning: %d, %d, %dx%d, used dpi %d for frame calculation", - (use_current ? window->x : window->windowed.x), - (use_current ? window->y : window->windowed.y), - (use_current ? window->w : window->windowed.w), - (use_current ? window->h : window->windowed.h), - *x, *y, *width, *height, frame_dpi); -#endif } static void @@ -222,7 +156,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) int w, h; /* Figure out what the window area will be */ - if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { + if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || (window->flags & SDL_WINDOW_ALWAYS_ON_TOP))) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; @@ -235,50 +169,6 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) data->expected_resize = SDL_FALSE; } -static void SDLCALL -WIN_MouseRelativeModeCenterChanged(void *userdata, const char *name, const char *oldValue, const char *hint) -{ - SDL_WindowData *data = (SDL_WindowData *)userdata; - data->mouse_relative_mode_center = SDL_GetStringBoolean(hint, SDL_TRUE); -} - -static int -WIN_GetScalingDPIForHWND(const SDL_VideoData *videodata, HWND hwnd) -{ - /* DPI scaling not requested? */ - if (!videodata->dpi_scaling_enabled) { - return 96; - } - - /* Window 10+ */ - if (videodata->GetDpiForWindow) { - return videodata->GetDpiForWindow(hwnd); - } - - /* Window 8.1+ */ - if (videodata->GetDpiForMonitor) { - HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); - if (monitor) { - UINT dpi_uint, unused; - if (S_OK == videodata->GetDpiForMonitor(monitor, MDT_EFFECTIVE_DPI, &dpi_uint, &unused)) { - return (int)dpi_uint; - } - } - return 96; - } - - /* Windows Vista-8.0 */ - { - HDC hdc = GetDC(NULL); - if (hdc) { - int dpi = GetDeviceCaps(hdc, LOGPIXELSX); - ReleaseDC(NULL, hdc); - return dpi; - } - return 96; - } -} - static int SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool created) { @@ -297,17 +187,10 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE); data->created = created; data->high_surrogate = 0; - data->mouse_button_flags = (WPARAM)-1; + data->mouse_button_flags = 0; data->last_pointer_update = (LPARAM)-1; data->videodata = videodata; data->initializing = SDL_TRUE; - data->scaling_dpi = WIN_GetScalingDPIForHWND(videodata, hwnd); - -#ifdef HIGHDPI_DEBUG - SDL_Log("SetupWindowData: initialized data->scaling_dpi to %d", data->scaling_dpi); -#endif - - SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data); window->driverdata = data; @@ -341,16 +224,12 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre if (GetClientRect(hwnd, &rect)) { int w = rect.right; int h = rect.bottom; - - WIN_ClientPointToSDL(window, &w, &h); if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) { /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */ int x, y; /* Figure out what the window area will be */ WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE); - data->expected_resize = SDL_TRUE; SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); - data->expected_resize = SDL_FALSE; } else { window->w = w; window->h = h; @@ -362,11 +241,8 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre point.x = 0; point.y = 0; if (ClientToScreen(hwnd, &point)) { - int x = point.x; - int y = point.y; - WIN_ScreenPointToSDL(&x, &y); - window->x = x; - window->y = y; + window->x = point.x; + window->y = point.y; } } { @@ -414,50 +290,13 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM)); } - /* Force the SDL_WINDOW_ALLOW_HIGHDPI window flag if we are doing DPI scaling */ - if (videodata->dpi_scaling_enabled) { - window->flags |= SDL_WINDOW_ALLOW_HIGHDPI; - } - data->initializing = SDL_FALSE; /* All done! */ return 0; } -static void CleanupWindowData(_THIS, SDL_Window * window) -{ - SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - if (data) { - SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data); - - if (data->keyboard_hook) { - UnhookWindowsHookEx(data->keyboard_hook); - } - ReleaseDC(data->hwnd, data->hdc); - RemoveProp(data->hwnd, TEXT("SDL_WindowData")); - if (data->created) { - DestroyWindow(data->hwnd); - if (data->parent) { - DestroyWindow(data->parent); - } - } else { - /* Restore any original event handler... */ - if (data->wndproc != NULL) { -#ifdef GWLP_WNDPROC - SetWindowLongPtr(data->hwnd, GWLP_WNDPROC, - (LONG_PTR) data->wndproc); -#else - SetWindowLong(data->hwnd, GWL_WNDPROC, - (LONG_PTR) data->wndproc); -#endif - } - } - SDL_free(data); - } - window->driverdata = NULL; -} int WIN_CreateWindow(_THIS, SDL_Window * window) @@ -582,9 +421,6 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) } } } - } else if (window->flags & SDL_WINDOW_OPENGL) { - /* Try to set up the pixel format, if it hasn't been set by the application */ - WIN_GL_SetupWindow(_this, window); } } #endif @@ -606,40 +442,39 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HICON hicon = NULL; BYTE *icon_bmp; - int icon_len, mask_len, row_len, y; - BITMAPINFOHEADER *bmi; - Uint8 *dst; + int icon_len, mask_len, y; + SDL_RWops *dst; SDL_bool isstack; /* Create temporary buffer for ICONIMAGE structure */ - SDL_COMPILE_TIME_ASSERT(WIN_SetWindowIcon_uses_BITMAPINFOHEADER_to_prepare_an_ICONIMAGE, sizeof(BITMAPINFOHEADER) == 40); mask_len = (icon->h * (icon->w + 7)/8); - icon_len = sizeof(BITMAPINFOHEADER) + icon->h * icon->w * sizeof(Uint32) + mask_len; + icon_len = 40 + icon->h * icon->w * sizeof(Uint32) + mask_len; icon_bmp = SDL_small_alloc(BYTE, icon_len, &isstack); + dst = SDL_RWFromMem(icon_bmp, icon_len); + if (!dst) { + SDL_small_free(icon_bmp, isstack); + return; + } /* Write the BITMAPINFO header */ - bmi = (BITMAPINFOHEADER *)icon_bmp; - bmi->biSize = SDL_SwapLE32(sizeof(BITMAPINFOHEADER)); - bmi->biWidth = SDL_SwapLE32(icon->w); - bmi->biHeight = SDL_SwapLE32(icon->h * 2); - bmi->biPlanes = SDL_SwapLE16(1); - bmi->biBitCount = SDL_SwapLE16(32); - bmi->biCompression = SDL_SwapLE32(BI_RGB); - bmi->biSizeImage = SDL_SwapLE32(icon->h * icon->w * sizeof(Uint32)); - bmi->biXPelsPerMeter = SDL_SwapLE32(0); - bmi->biYPelsPerMeter = SDL_SwapLE32(0); - bmi->biClrUsed = SDL_SwapLE32(0); - bmi->biClrImportant = SDL_SwapLE32(0); + SDL_WriteLE32(dst, 40); + SDL_WriteLE32(dst, icon->w); + SDL_WriteLE32(dst, icon->h * 2); + SDL_WriteLE16(dst, 1); + SDL_WriteLE16(dst, 32); + SDL_WriteLE32(dst, BI_RGB); + SDL_WriteLE32(dst, icon->h * icon->w * sizeof(Uint32)); + SDL_WriteLE32(dst, 0); + SDL_WriteLE32(dst, 0); + SDL_WriteLE32(dst, 0); + SDL_WriteLE32(dst, 0); /* Write the pixels upside down into the bitmap buffer */ SDL_assert(icon->format->format == SDL_PIXELFORMAT_ARGB8888); - dst = &icon_bmp[sizeof(BITMAPINFOHEADER)]; - row_len = icon->w * sizeof(Uint32); y = icon->h; while (y--) { Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch; - SDL_memcpy(dst, src, row_len); - dst += row_len; + SDL_RWwrite(dst, src, icon->w * sizeof(Uint32), 1); } /* Write the mask */ @@ -647,6 +482,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); + SDL_RWclose(dst); SDL_small_free(icon_bmp, isstack); /* Set the icon for the window */ @@ -659,10 +495,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) void WIN_SetWindowPosition(_THIS, SDL_Window * window) { - /* HighDPI support: removed SWP_NOSIZE. If the move results in a DPI change, we need to allow - * the window to resize (e.g. AdjustWindowRectExForDpi frame sizes are different). - */ - WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOACTIVATE); + WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE); } void @@ -740,38 +573,8 @@ WIN_HideWindow(_THIS, SDL_Window * window) void WIN_RaiseWindow(_THIS, SDL_Window * window) { - /* If desired, raise the window more forcefully. - * Technique taken from http://stackoverflow.com/questions/916259/ . - * Specifically, http://stackoverflow.com/a/34414846 . - * - * The issue is that Microsoft has gone through a lot of trouble to make it - * nearly impossible to programmatically move a window to the foreground, - * for "security" reasons. Apparently, the following song-and-dance gets - * around their objections. */ - SDL_bool bForce = SDL_GetHintBoolean(SDL_HINT_FORCE_RAISEWINDOW, SDL_FALSE); - - HWND hCurWnd = NULL; - DWORD dwMyID = 0u; - DWORD dwCurID = 0u; - HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; - if(bForce) - { - hCurWnd = GetForegroundWindow(); - dwMyID = GetCurrentThreadId(); - dwCurID = GetWindowThreadProcessId(hCurWnd, NULL); - ShowWindow(hwnd, SW_RESTORE); - AttachThreadInput(dwCurID, dwMyID, TRUE); - SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - } SetForegroundWindow(hwnd); - if (bForce) - { - AttachThreadInput(dwCurID, dwMyID, FALSE); - SetFocus(hwnd); - SetActiveWindow(hwnd); - } } void @@ -844,38 +647,18 @@ WIN_RestoreWindow(_THIS, SDL_Window * window) data->expected_resize = SDL_FALSE; } -/** - * Reconfigures the window to fill the given display, if fullscreen is true, otherwise restores the window. - */ void WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) { - SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata; HWND hwnd = data->hwnd; - MONITORINFO minfo; + SDL_Rect bounds; DWORD style; HWND top; int x, y; int w, h; - if (!fullscreen && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) { - /* Resizing the window on hide causes problems restoring it in Wine, and it's unnecessary. - * Also, Windows would preview the minimized window with the wrong size. - */ - return; - } - -#ifdef HIGHDPI_DEBUG - SDL_Log("WIN_SetWindowFullscreen: %d", (int)fullscreen); -#endif - - /* Clear the window size, to force SDL_SendWindowEvent to send a SDL_WINDOWEVENT_RESIZED - event in WM_WINDOWPOSCHANGED. */ - data->window->w = 0; - data->window->h = 0; - - if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { + if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; @@ -885,20 +668,13 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, style &= ~STYLE_MASK; style |= GetWindowStyle(window); - /* Use GetMonitorInfo instead of WIN_GetDisplayBounds because we want the - monitor bounds in Windows coordinates (pixels) rather than SDL coordinates (points). */ - SDL_zero(minfo); - minfo.cbSize = sizeof(MONITORINFO); - if (!GetMonitorInfo(displaydata->MonitorHandle, &minfo)) { - SDL_SetError("GetMonitorInfo failed"); - return; - } + WIN_GetDisplayBounds(_this, display, &bounds); if (fullscreen) { - x = minfo.rcMonitor.left; - y = minfo.rcMonitor.top; - w = minfo.rcMonitor.right - minfo.rcMonitor.left; - h = minfo.rcMonitor.bottom - minfo.rcMonitor.top; + x = bounds.x; + y = bounds.y; + w = bounds.w; + h = bounds.h; /* Unset the maximized flag. This fixes https://bugzilla.libsdl.org/show_bug.cgi?id=3215 @@ -928,10 +704,6 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, data->expected_resize = SDL_TRUE; SetWindowPos(hwnd, top, x, y, w, h, SWP_NOCOPYBITS | SWP_NOACTIVATE); data->expected_resize = SDL_FALSE; - -#ifdef HIGHDPI_DEBUG - SDL_Log("WIN_SetWindowFullscreen: %d finished. Set window to %d,%d, %dx%d", (int)fullscreen, x, y, w, h); -#endif } int @@ -1052,6 +824,15 @@ void WIN_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { WIN_UpdateClipCursor(window); + + if (window->flags & SDL_WINDOW_FULLSCREEN) { + UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE; + + if (!(window->flags & SDL_WINDOW_SHOWN)) { + flags |= SWP_NOACTIVATE; + } + WIN_SetWindowPositionInternal(_this, window, flags); + } } void @@ -1067,7 +848,34 @@ WIN_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed) void WIN_DestroyWindow(_THIS, SDL_Window * window) { - CleanupWindowData(_this, window); + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + if (data) { + if (data->keyboard_hook) { + UnhookWindowsHookEx(data->keyboard_hook); + } + ReleaseDC(data->hwnd, data->hdc); + RemoveProp(data->hwnd, TEXT("SDL_WindowData")); + if (data->created) { + DestroyWindow(data->hwnd); + if (data->parent) { + DestroyWindow(data->parent); + } + } else { + /* Restore any original event handler... */ + if (data->wndproc != NULL) { +#ifdef GWLP_WNDPROC + SetWindowLongPtr(data->hwnd, GWLP_WNDPROC, + (LONG_PTR) data->wndproc); +#else + SetWindowLong(data->hwnd, GWL_WNDPROC, + (LONG_PTR) data->wndproc); +#endif + } + } + SDL_free(data); + } + window->driverdata = NULL; } SDL_bool @@ -1090,8 +898,8 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } @@ -1199,7 +1007,7 @@ WIN_UpdateClipCursor(SDL_Window *window) if ((mouse->relative_mode || (window->flags & SDL_WINDOW_MOUSE_GRABBED) || (window->mouse_rect.w > 0 && window->mouse_rect.h > 0)) && (window->flags & SDL_WINDOW_INPUT_FOCUS)) { - if (mouse->relative_mode && !mouse->relative_mode_warp && data->mouse_relative_mode_center) { + if (mouse->relative_mode && !mouse->relative_mode_warp) { if (GetWindowRect(data->hwnd, &rect)) { LONG cx, cy; @@ -1223,19 +1031,12 @@ WIN_UpdateClipCursor(SDL_Window *window) ClientToScreen(data->hwnd, (LPPOINT) & rect); ClientToScreen(data->hwnd, (LPPOINT) & rect + 1); if (window->mouse_rect.w > 0 && window->mouse_rect.h > 0) { - SDL_Rect mouse_rect_win_client; RECT mouse_rect, intersection; - /* mouse_rect_win_client is the mouse rect in Windows client space */ - mouse_rect_win_client = window->mouse_rect; - WIN_ClientPointFromSDL(window, &mouse_rect_win_client.x, &mouse_rect_win_client.y); - WIN_ClientPointFromSDL(window, &mouse_rect_win_client.w, &mouse_rect_win_client.h); - - /* mouse_rect is the rect in Windows screen space */ - mouse_rect.left = rect.left + mouse_rect_win_client.x; - mouse_rect.top = rect.top + mouse_rect_win_client.y; - mouse_rect.right = mouse_rect.left + mouse_rect_win_client.w - 1; - mouse_rect.bottom = mouse_rect.top + mouse_rect_win_client.h - 1; + mouse_rect.left = rect.left + window->mouse_rect.x; + mouse_rect.top = rect.top + window->mouse_rect.y; + mouse_rect.right = mouse_rect.left + window->mouse_rect.w - 1; + mouse_rect.bottom = mouse_rect.top + window->mouse_rect.h - 1; if (IntersectRect(&intersection, &rect, &mouse_rect)) { SDL_memcpy(&rect, &intersection, sizeof(rect)); } else if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) { @@ -1311,61 +1112,6 @@ WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) return 0; } -/** - * Returns the drawable size in pixels (GetClientRect). - */ -void -WIN_GetDrawableSize(const SDL_Window *window, int *w, int *h) -{ - const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata); - HWND hwnd = data->hwnd; - RECT rect; - - if (GetClientRect(hwnd, &rect)) { - *w = rect.right; - *h = rect.bottom; - } else { - *w = 0; - *h = 0; - } -} - -/** - * Convert a point in the client area from pixels to DPI-scaled points. - * - * No-op if DPI scaling is not enabled. - */ -void -WIN_ClientPointToSDL(const SDL_Window *window, int *x, int *y) -{ - const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata); - const SDL_VideoData *videodata = data->videodata; - - if (!videodata->dpi_scaling_enabled) - return; - - *x = MulDiv(*x, 96, data->scaling_dpi); - *y = MulDiv(*y, 96, data->scaling_dpi); -} - -/** - * Convert a point in the client area from DPI-scaled points to pixels. - * - * No-op if DPI scaling is not enabled. - */ -void -WIN_ClientPointFromSDL(const SDL_Window *window, int *x, int *y) -{ - const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata); - const SDL_VideoData *videodata = data->videodata; - - if (!videodata->dpi_scaling_enabled) - return; - - *x = MulDiv(*x, data->scaling_dpi, 96); - *y = MulDiv(*y, data->scaling_dpi, 96); -} - void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept) { diff --git a/externals/SDL/src/video/windows/SDL_windowswindow.h b/externals/SDL/src/video/windows/SDL_windowswindow.h index 2a3653380..d1570fdb0 100755 --- a/externals/SDL/src/video/windows/SDL_windowswindow.h +++ b/externals/SDL/src/video/windows/SDL_windowswindow.h @@ -49,7 +49,6 @@ typedef struct Uint8 focus_click_pending; SDL_bool skip_update_clipcursor; Uint32 last_updated_clipcursor; - SDL_bool mouse_relative_mode_center; SDL_bool windowed_mode_was_maximized; SDL_bool in_window_deactivation; RECT cursor_clipped_rect; @@ -59,11 +58,6 @@ typedef struct #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif - /** - * Cached value of GetDpiForWindow, for use for scaling points in the client area - * between dpi-scaled points and pixels. Only used if videodata->dpi_scaling_enabled. - */ - int scaling_dpi; } SDL_WindowData; extern int WIN_CreateWindow(_THIS, SDL_Window * window); @@ -96,9 +90,6 @@ extern SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window * window, extern void WIN_OnWindowEnter(_THIS, SDL_Window * window); extern void WIN_UpdateClipCursor(SDL_Window *window); extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -extern void WIN_GetDrawableSize(const SDL_Window *window, int *w, int *h); -extern void WIN_ClientPointToSDL(const SDL_Window *window, int *w, int *h); -extern void WIN_ClientPointFromSDL(const SDL_Window *window, int *w, int *h); extern void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept); extern int WIN_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation); diff --git a/externals/SDL/src/video/windows/wmmsg.h b/externals/SDL/src/video/windows/wmmsg.h index 86cae1df9..bd416eb80 100755 --- a/externals/SDL/src/video/windows/wmmsg.h +++ b/externals/SDL/src/video/windows/wmmsg.h @@ -762,7 +762,7 @@ const char *wmtab[] = { "UNKNOWN (737)", "UNKNOWN (738)", "UNKNOWN (739)", - "WM_GETDPISCALEDSIZE", + "UNKNOWN (740)", "UNKNOWN (741)", "UNKNOWN (742)", "UNKNOWN (743)", diff --git a/externals/SDL/src/video/winrt/SDL_winrtopengles.cpp b/externals/SDL/src/video/winrt/SDL_winrtopengles.cpp index d5301006e..9e3c1772b 100755 --- a/externals/SDL/src/video/winrt/SDL_winrtopengles.cpp +++ b/externals/SDL/src/video/winrt/SDL_winrtopengles.cpp @@ -63,7 +63,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) } /* Load ANGLE/WinRT-specific functions */ - CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->opengl_dll_handle, "CreateWinrtEglWindow"); + CreateWinrtEglWindow_Old_Function CreateWinrtEglWindow = (CreateWinrtEglWindow_Old_Function) SDL_LoadFunction(_this->egl_data->egl_dll_handle, "CreateWinrtEglWindow"); if (CreateWinrtEglWindow) { /* 'CreateWinrtEglWindow' was found, which means that an an older * version of ANGLE/WinRT is being used. Continue setting up EGL, diff --git a/externals/SDL/src/video/winrt/SDL_winrtvideo.cpp b/externals/SDL/src/video/winrt/SDL_winrtvideo.cpp index e2d3f9e6d..0b231b792 100755 --- a/externals/SDL/src/video/winrt/SDL_winrtvideo.cpp +++ b/externals/SDL/src/video/winrt/SDL_winrtvideo.cpp @@ -478,7 +478,8 @@ WINRT_InitModes(_THIS) hr = CreateDXGIFactory1(SDL_IID_IDXGIFactory2, (void **)&dxgiFactory2); if (FAILED(hr)) { - return WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr); + WIN_SetErrorFromHRESULT(__FUNCTION__ ", CreateDXGIFactory1() failed", hr); + return -1; } for (int adapterIndex = 0; ; ++adapterIndex) { @@ -629,12 +630,14 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) // Make sure that only one window gets created, at least until multimonitor // support is added. if (WINRT_GlobalSDLWindow != NULL) { - return SDL_SetError("WinRT only supports one window"); + SDL_SetError("WinRT only supports one window"); + return -1; } SDL_WindowData *data = new SDL_WindowData; /* use 'new' here as SDL_WindowData may use WinRT/C++ types */ if (!data) { - return SDL_OutOfMemory(); + SDL_OutOfMemory(); + return -1; } window->driverdata = data; data->sdlWindow = window; @@ -670,8 +673,9 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) * be passed into eglCreateWindowSurface. */ if (SDL_EGL_ChooseConfig(_this) != 0) { - /* SDL_EGL_ChooseConfig failed, SDL_GetError() should have info */ - return -1; + char buf[512]; + SDL_snprintf(buf, sizeof(buf), "SDL_EGL_ChooseConfig failed: %s", SDL_GetError()); + return SDL_SetError("%s", buf); } if (video_data->winrtEglWindow) { /* ... is the 'old' version of ANGLE/WinRT being used? */ @@ -834,8 +838,8 @@ WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.winrt.window = reinterpret_cast(data->coreWindow.Get()); return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } return SDL_FALSE; diff --git a/externals/SDL/src/video/x11/SDL_x11dyn.c b/externals/SDL/src/video/x11/SDL_x11dyn.c index 4bfef21e3..29a8186fa 100755 --- a/externals/SDL/src/video/x11/SDL_x11dyn.c +++ b/externals/SDL/src/video/x11/SDL_x11dyn.c @@ -47,6 +47,9 @@ typedef struct #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR NULL #endif +#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA NULL +#endif #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 NULL #endif @@ -59,15 +62,20 @@ typedef struct #ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS NULL #endif +#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE NULL +#endif static x11dynlib x11libs[] = { {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR}, + {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES}, {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR}, - {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS} + {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS}, + {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE} }; static void * diff --git a/externals/SDL/src/video/x11/SDL_x11dyn.h b/externals/SDL/src/video/x11/SDL_x11dyn.h index feac35fa9..c2678bfed 100755 --- a/externals/SDL/src/video/x11/SDL_x11dyn.h +++ b/externals/SDL/src/video/x11/SDL_x11dyn.h @@ -52,6 +52,9 @@ #if SDL_VIDEO_DRIVER_X11_XDBE #include #endif +#if SDL_VIDEO_DRIVER_X11_XINERAMA +#include +#endif #if SDL_VIDEO_DRIVER_X11_XINPUT2 #include #endif @@ -67,6 +70,9 @@ #if SDL_VIDEO_DRIVER_X11_XSHAPE #include #endif +#if SDL_VIDEO_DRIVER_X11_XVIDMODE +#include +#endif #ifdef __cplusplus extern "C" diff --git a/externals/SDL/src/video/x11/SDL_x11events.c b/externals/SDL/src/video/x11/SDL_x11events.c index 6e3c0679b..c1260215d 100755 --- a/externals/SDL/src/video/x11/SDL_x11events.c +++ b/externals/SDL/src/video/x11/SDL_x11events.c @@ -380,7 +380,7 @@ X11_GetScrollLockModifierMask(_THIS) return num_mask; } -void +static void X11_ReconcileKeyboardState(_THIS) { SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; @@ -408,22 +408,7 @@ X11_ReconcileKeyboardState(_THIS) SDL_bool sdlKeyPressed = keyboardState[scancode] == SDL_PRESSED; if (x11KeyPressed && !sdlKeyPressed) { - /* Only update modifier state for keys that are pressed in another application */ - switch (SDL_GetKeyFromScancode(scancode)) { - case SDLK_LCTRL: - case SDLK_RCTRL: - case SDLK_LSHIFT: - case SDLK_RSHIFT: - case SDLK_LALT: - case SDLK_RALT: - case SDLK_LGUI: - case SDLK_RGUI: - case SDLK_MODE: - SDL_SendKeyboardKey(SDL_PRESSED, scancode); - break; - default: - break; - } + SDL_SendKeyboardKey(SDL_PRESSED, scancode); } else if (!x11KeyPressed && sdlKeyPressed) { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } @@ -733,6 +718,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + XkbEvent* xkbEvent = (XkbEvent*) xevent; Display *display; SDL_WindowData *data; int orig_event_type; @@ -785,12 +771,6 @@ X11_DispatchEvent(_THIS, XEvent *xevent) } #endif -#if SDL_VIDEO_DRIVER_X11_XRANDR - if (videodata->xrandr_event_base && (xevent->type == (videodata->xrandr_event_base + RRNotify))) { - X11_HandleXRandREvent(_this, xevent); - } -#endif - /* Send a SDL_SYSWMEVENT if the application wants them */ if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) { SDL_SysWMmsg wmmsg; @@ -825,13 +805,11 @@ X11_DispatchEvent(_THIS, XEvent *xevent) if (!data) { /* The window for KeymapNotify, etc events is 0 */ if (xevent->type == KeymapNotify) { -#ifdef DEBUG_XEVENTS - printf("window %p: KeymapNotify!\n", data); -#endif if (SDL_GetKeyboardFocus() != NULL) { X11_ReconcileKeyboardState(_this); } - } else if (xevent->type == MappingNotify) { + } else if (xevent->type == MappingNotify || + (xevent->type == videodata->xkb_event && xkbEvent->any.xkb_type == XkbStateNotify)) { /* Has the keyboard layout changed? */ const int request = xevent->xmapping.request; @@ -1018,9 +996,8 @@ X11_DispatchEvent(_THIS, XEvent *xevent) } break; - /* Key press/release? */ - case KeyPress: - case KeyRelease: { + /* Key press? */ + case KeyPress:{ KeyCode keycode = xevent->xkey.keycode; KeySym keysym = NoSymbol; char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; @@ -1028,7 +1005,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent) SDL_bool handled_by_ime = SDL_FALSE; #ifdef DEBUG_XEVENTS - printf("window %p: %s (X11 keycode = 0x%X)\n", data, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode); + printf("window %p: KeyPress (X11 keycode = 0x%X)\n", data, xevent->xkey.keycode); #endif #if 1 if (videodata->key_layout[keycode] == SDL_SCANCODE_UNKNOWN && keycode) { @@ -1044,7 +1021,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent) /* */ SDL_zeroa(text); #ifdef X_HAVE_UTF8_STRING - if (data->ic && xevent->type == KeyPress) { + if (data->ic) { X11_Xutf8LookupString(data->ic, &xevent->xkey, text, sizeof(text), &keysym, &status); } else { @@ -1056,30 +1033,35 @@ X11_DispatchEvent(_THIS, XEvent *xevent) #ifdef SDL_USE_IME if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){ - handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode, (xevent->type == KeyPress ? SDL_PRESSED : SDL_RELEASED)); + handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode); } #endif if (!handled_by_ime) { - if (xevent->type == KeyPress) { - /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */ - if (xevent->xkey.keycode != videodata->filter_code || xevent->xkey.time != videodata->filter_time) { - SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); - } - if(*text) { - SDL_SendKeyboardText(text); - } - } else { - if (X11_KeyRepeat(display, xevent)) { - /* We're about to get a repeated key down, ignore the key up */ - break; - } - SDL_SendKeyboardKey(SDL_RELEASED, videodata->key_layout[keycode]); + /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */ + if (xevent->xkey.keycode != videodata->filter_code || xevent->xkey.time != videodata->filter_time) { + SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); + } + if(*text) { + SDL_SendKeyboardText(text); } } - if (xevent->type == KeyPress) { - X11_UpdateUserTime(data, xevent->xkey.time); + X11_UpdateUserTime(data, xevent->xkey.time); + } + break; + + /* Key release? */ + case KeyRelease:{ + KeyCode keycode = xevent->xkey.keycode; + +#ifdef DEBUG_XEVENTS + printf("window %p: KeyRelease (X11 keycode = 0x%X)\n", data, xevent->xkey.keycode); +#endif + if (X11_KeyRepeat(display, xevent)) { + /* We're about to get a repeated key down, ignore the key up */ + break; } + SDL_SendKeyboardKey(SDL_RELEASED, videodata->key_layout[keycode]); } break; diff --git a/externals/SDL/src/video/x11/SDL_x11events.h b/externals/SDL/src/video/x11/SDL_x11events.h index de89110d0..fc8a57ae2 100755 --- a/externals/SDL/src/video/x11/SDL_x11events.h +++ b/externals/SDL/src/video/x11/SDL_x11events.h @@ -27,7 +27,6 @@ extern void X11_PumpEvents(_THIS); extern int X11_WaitEventTimeout(_THIS, int timeout); extern void X11_SendWakeupEvent(_THIS, SDL_Window *window); extern void X11_SuspendScreenSaver(_THIS); -extern void X11_ReconcileKeyboardState(_THIS); #endif /* SDL_x11events_h_ */ diff --git a/externals/SDL/src/video/x11/SDL_x11keyboard.c b/externals/SDL/src/video/x11/SDL_x11keyboard.c index 9d9f3f9f0..c82570c62 100755 --- a/externals/SDL/src/video/x11/SDL_x11keyboard.c +++ b/externals/SDL/src/video/x11/SDL_x11keyboard.c @@ -37,7 +37,7 @@ #include #endif -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ static const struct { KeySym keysym; SDL_Scancode scancode; @@ -160,7 +160,7 @@ static const struct { xfree86_scancode_table2, SDL_arraysize(xfree86_scancode_table2) }, { xvnc_scancode_table, SDL_arraysize(xvnc_scancode_table) }, }; -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ /* This function only works for keyboards in US QWERTY layout */ static SDL_Scancode @@ -267,6 +267,13 @@ X11_InitKeyboard(_THIS) int best_index; int distance; Bool xkb_repeat = 0; + XKeyboardState values; + SDL_zero(values); + values.global_auto_repeat = AutoRepeatModeOff; + + X11_XGetKeyboardControl(data->display, &values); + if (values.global_auto_repeat != AutoRepeatModeOn) + X11_XAutoRepeatOn(data->display); #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM { @@ -402,8 +409,6 @@ X11_InitKeyboard(_THIS) SDL_IME_Init(); #endif - X11_ReconcileKeyboardState(_this); - return 0; } diff --git a/externals/SDL/src/video/x11/SDL_x11messagebox.c b/externals/SDL/src/video/x11/SDL_x11messagebox.c index 9bc9702c0..aafccca9b 100755 --- a/externals/SDL/src/video/x11/SDL_x11messagebox.c +++ b/externals/SDL/src/video/x11/SDL_x11messagebox.c @@ -830,11 +830,10 @@ X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) int exitcode = 0; close(fds[0]); status = X11_ShowMessageBoxImpl(messageboxdata, buttonid); - if (write(fds[1], &status, sizeof (int)) != sizeof (int)) { + if (write(fds[1], &status, sizeof (int)) != sizeof (int)) exitcode = 1; - } else if (write(fds[1], buttonid, sizeof (int)) != sizeof (int)) { + else if (write(fds[1], buttonid, sizeof (int)) != sizeof (int)) exitcode = 1; - } close(fds[1]); _exit(exitcode); /* don't run atexit() stuff, static destructors, etc. */ } else { /* we're the parent */ @@ -847,12 +846,13 @@ X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) SDL_assert(rc == pid); /* not sure what to do if this fails. */ if ((rc == -1) || (!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) { - status = SDL_SetError("msgbox child process failed"); - } else if ( (read(fds[0], &status, sizeof (int)) != sizeof (int)) || - (read(fds[0], buttonid, sizeof (int)) != sizeof (int)) ) { - status = SDL_SetError("read from msgbox child process failed"); - *buttonid = 0; + return SDL_SetError("msgbox child process failed"); } + + if (read(fds[0], &status, sizeof (int)) != sizeof (int)) + status = -1; + else if (read(fds[0], buttonid, sizeof (int)) != sizeof (int)) + status = -1; close(fds[0]); return status; diff --git a/externals/SDL/src/video/x11/SDL_x11modes.c b/externals/SDL/src/video/x11/SDL_x11modes.c index abfd3878f..c1efe243c 100755 --- a/externals/SDL/src/video/x11/SDL_x11modes.c +++ b/externals/SDL/src/video/x11/SDL_x11modes.c @@ -148,6 +148,62 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo) return SDL_PIXELFORMAT_UNKNOWN; } +#if SDL_VIDEO_DRIVER_X11_XINERAMA +static SDL_bool +CheckXinerama(Display * display, int *major, int *minor) +{ + int event_base = 0; + int error_base = 0; + + /* Default the extension not available */ + *major = *minor = 0; + + /* Allow environment override */ + if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XINERAMA, SDL_TRUE)) { +#ifdef X11MODES_DEBUG + printf("Xinerama disabled due to hint\n"); +#endif + return SDL_FALSE; + } + + if (!SDL_X11_HAVE_XINERAMA) { +#ifdef X11MODES_DEBUG + printf("Xinerama support not available\n"); +#endif + return SDL_FALSE; + } + + /* Query the extension version */ + if (!X11_XineramaQueryExtension(display, &event_base, &error_base) || + !X11_XineramaQueryVersion(display, major, minor) || + !X11_XineramaIsActive(display)) { +#ifdef X11MODES_DEBUG + printf("Xinerama not active on the display\n"); +#endif + return SDL_FALSE; + } +#ifdef X11MODES_DEBUG + printf("Xinerama available at version %d.%d!\n", *major, *minor); +#endif + return SDL_TRUE; +} + +/* !!! FIXME: remove this later. */ +/* we have a weird bug where XineramaQueryScreens() throws an X error, so this + is here to help track it down (and not crash, too!). */ +static SDL_bool xinerama_triggered_error = SDL_FALSE; +static int +X11_XineramaFailed(Display * d, XErrorEvent * e) +{ + xinerama_triggered_error = SDL_TRUE; + fprintf(stderr, "XINERAMA X ERROR: type=%d serial=%lu err=%u req=%u minor=%u\n", + e->type, e->serial, (unsigned int) e->error_code, + (unsigned int) e->request_code, (unsigned int) e->minor_code); + fflush(stderr); + return 0; +} +#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ + #if SDL_VIDEO_DRIVER_X11_XRANDR static SDL_bool CheckXRandR(Display * display, int *major, int *minor) @@ -289,249 +345,6 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, #endif } - -static int -X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput outputid, XRRScreenResources *res) -{ - Atom EDID = X11_XInternAtom(dpy, "EDID", False); - XRROutputInfo *output_info; - int display_x, display_y; - unsigned long display_mm_width, display_mm_height; - SDL_DisplayData *displaydata; - char display_name[128]; - SDL_DisplayMode mode; - SDL_DisplayModeData *modedata; - SDL_VideoDisplay display; - RRMode modeID; - RRCrtc output_crtc; - XRRCrtcInfo *crtc; - XVisualInfo vinfo; - Uint32 pixelformat; - XPixmapFormatValues *pixmapformats; - int scanline_pad; - int i, n; - - if (get_visualinfo(dpy, screen, &vinfo) < 0) { - return 0; /* uh, skip this screen? */ - } - - pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); - if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { - return 0; /* Palettized video modes are no longer supported, ignore this one. */ - } - - scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8; - pixmapformats = X11_XListPixmapFormats(dpy, &n); - if (pixmapformats) { - for (i = 0; i < n; i++) { - if (pixmapformats[i].depth == vinfo.depth) { - scanline_pad = pixmapformats[i].scanline_pad; - break; - } - } - X11_XFree(pixmapformats); - } - - output_info = X11_XRRGetOutputInfo(dpy, res, outputid); - if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) { - X11_XRRFreeOutputInfo(output_info); - return 0; /* ignore this one. */ - } - - SDL_strlcpy(display_name, output_info->name, sizeof(display_name)); - display_mm_width = output_info->mm_width; - display_mm_height = output_info->mm_height; - output_crtc = output_info->crtc; - X11_XRRFreeOutputInfo(output_info); - - crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc); - if (!crtc) { - return 0; /* oh well, ignore it. */ - } - - SDL_zero(mode); - modeID = crtc->mode; - mode.w = crtc->width; - mode.h = crtc->height; - mode.format = pixelformat; - - display_x = crtc->x; - display_y = crtc->y; - - X11_XRRFreeCrtcInfo(crtc); - - displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); - if (!displaydata) { - return SDL_OutOfMemory(); - } - - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (!modedata) { - SDL_free(displaydata); - return SDL_OutOfMemory(); - } - - modedata->xrandr_mode = modeID; - mode.driverdata = modedata; - - displaydata->screen = screen; - displaydata->visual = vinfo.visual; - displaydata->depth = vinfo.depth; - displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; - displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; - displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); - displaydata->scanline_pad = scanline_pad; - displaydata->x = display_x; - displaydata->y = display_y; - displaydata->use_xrandr = SDL_TRUE; - displaydata->xrandr_output = outputid; - - SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode); - SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), outputid, display_mm_width, display_mm_height); - - SDL_zero(display); - if (*display_name) { - display.name = display_name; - } - display.desktop_mode = mode; - display.current_mode = mode; - display.driverdata = displaydata; - return SDL_AddVideoDisplay(&display, SDL_TRUE); -} - -static void -X11_HandleXRandROutputChange(_THIS, const XRROutputChangeNotifyEvent *ev) -{ - const int num_displays = SDL_GetNumVideoDisplays(); - SDL_VideoDisplay *display = NULL; - int displayidx = -1; - int i; - - #if 0 - printf("XRROutputChangeNotifyEvent! [output=%u, crtc=%u, mode=%u, rotation=%u, connection=%u]", (unsigned int) ev->output, (unsigned int) ev->crtc, (unsigned int) ev->mode, (unsigned int) ev->rotation, (unsigned int) ev->connection); - #endif - - for (i = 0; i < num_displays; i++) { - SDL_VideoDisplay *thisdisplay = SDL_GetDisplay(i); - const SDL_DisplayData *displaydata = (const SDL_DisplayData *) thisdisplay->driverdata; - if (displaydata->xrandr_output == ev->output) { - display = thisdisplay; - displayidx = i; - break; - } - } - - SDL_assert((displayidx == -1) == (display == NULL)); - - if (ev->connection == RR_Disconnected) { /* output is going away */ - if (display != NULL) { - SDL_DelVideoDisplay(displayidx); - } - } else if (ev->connection == RR_Connected) { /* output is coming online */ - if (display != NULL) { - /* !!! FIXME: update rotation or current mode of existing display? */ - } else { - Display *dpy = ev->display; - const int screen = DefaultScreen(dpy); - XVisualInfo vinfo; - if (get_visualinfo(dpy, screen, &vinfo) == 0) { - XRRScreenResources *res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); - if (!res || res->noutput == 0) { - if (res) { - X11_XRRFreeScreenResources(res); - } - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - } - - if (res) { - X11_AddXRandRDisplay(_this, dpy, screen, ev->output, res); - X11_XRRFreeScreenResources(res); - } - } - } - } -} - -void -X11_HandleXRandREvent(_THIS, const XEvent *xevent) -{ - SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; - SDL_assert(xevent->type == (videodata->xrandr_event_base + RRNotify)); - - switch (((const XRRNotifyEvent *) xevent)->subtype) { - case RRNotify_OutputChange: - X11_HandleXRandROutputChange(_this, (const XRROutputChangeNotifyEvent *) xevent); - break; - default: - break; - } -} - - -static int -X11_InitModes_XRandR(_THIS) -{ - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - Display *dpy = data->display; - const int screencount = ScreenCount(dpy); - const int default_screen = DefaultScreen(dpy); - RROutput primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, default_screen)); - XRRScreenResources *res = NULL; - int xrandr_error_base = 0; - int looking_for_primary; - int output; - int screen; - - if (!X11_XRRQueryExtension(dpy, &data->xrandr_event_base, &xrandr_error_base)) { - return SDL_SetError("XRRQueryExtension failed"); - } - - for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) { - for (screen = 0; screen < screencount; screen++) { - - /* we want the primary output first, and then skipped later. */ - if (looking_for_primary && (screen != default_screen)) { - continue; - } - - res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); - if (!res || res->noutput == 0) { - if (res) { - X11_XRRFreeScreenResources(res); - } - - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - if (!res) { - continue; - } - } - - for (output = 0; output < res->noutput; output++) { - /* The primary output _should_ always be sorted first, but just in case... */ - if ((looking_for_primary && (res->outputs[output] != primary)) || - (!looking_for_primary && (screen == default_screen) && (res->outputs[output] == primary))) { - continue; - } - if (X11_AddXRandRDisplay(_this, dpy, screen, res->outputs[output], res) == -1) { - break; - } - } - - X11_XRRFreeScreenResources(res); - - /* This will generate events for displays that come and go at runtime. */ - X11_XRRSelectInput(dpy, RootWindow(dpy, screen), RROutputChangeNotifyMask); - } - } - - if (_this->num_displays == 0) { - return SDL_SetError("No available displays"); - } - - return 0; -} -#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ - static int GetXftDPI(Display* dpy) { @@ -556,124 +369,508 @@ GetXftDPI(Display* dpy) return err == ERANGE ? 0 : xft_dpi; } -/* This is used if there's no better functionality--like XRandR--to use. - It won't attempt to supply different display modes at all, but it can - enumerate the current displays and their current sizes. */ -static int X11_InitModes_StdXlib(_THIS) +static int +X11_InitModes_XRandR(_THIS) { - /* !!! FIXME: a lot of copy/paste from X11_InitModes_XRandR in this function. */ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; Display *dpy = data->display; + const int screencount = ScreenCount(dpy); const int default_screen = DefaultScreen(dpy); - Screen *screen = ScreenOfDisplay(dpy, default_screen); - int display_mm_width, display_mm_height, xft_dpi, scanline_pad, n, i; - SDL_DisplayModeData *modedata; - SDL_DisplayData *displaydata; - SDL_DisplayMode mode; - XPixmapFormatValues *pixmapformats; + RROutput primary = X11_XRRGetOutputPrimary(dpy, RootWindow(dpy, default_screen)); + Atom EDID = X11_XInternAtom(dpy, "EDID", False); + XRRScreenResources *res = NULL; Uint32 pixelformat; XVisualInfo vinfo; - SDL_VideoDisplay display; + XPixmapFormatValues *pixmapformats; + int looking_for_primary; + int scanline_pad; + int output; + int screen, i, n; - /* note that generally even if you have a multiple physical monitors, ScreenCount(dpy) still only reports ONE screen. */ + for (looking_for_primary = 1; looking_for_primary >= 0; looking_for_primary--) { + for (screen = 0; screen < screencount; screen++) { - if (get_visualinfo(dpy, default_screen, &vinfo) < 0) { - return SDL_SetError("Failed to find an X11 visual for the primary display"); - } - - pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); - if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { - return SDL_SetError("Palettized video modes are no longer supported"); - } - - SDL_zero(mode); - mode.w = WidthOfScreen(screen); - mode.h = HeightOfScreen(screen); - mode.format = pixelformat; - mode.refresh_rate = 0; /* don't know it, sorry. */ - - displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); - if (!displaydata) { - return SDL_OutOfMemory(); - } - - modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (!modedata) { - SDL_free(displaydata); - return SDL_OutOfMemory(); - } - mode.driverdata = modedata; - - display_mm_width = WidthMMOfScreen(screen); - display_mm_height = HeightMMOfScreen(screen); - - displaydata->screen = default_screen; - displaydata->visual = vinfo.visual; - displaydata->depth = vinfo.depth; - displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; - displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; - displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); - - xft_dpi = GetXftDPI(dpy); - if(xft_dpi > 0) { - displaydata->hdpi = (float)xft_dpi; - displaydata->vdpi = (float)xft_dpi; - } - - scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8; - pixmapformats = X11_XListPixmapFormats(dpy, &n); - if (pixmapformats) { - for (i = 0; i < n; ++i) { - if (pixmapformats[i].depth == vinfo.depth) { - scanline_pad = pixmapformats[i].scanline_pad; - break; + /* we want the primary output first, and then skipped later. */ + if (looking_for_primary && (screen != default_screen)) { + continue; } + + if (get_visualinfo(dpy, screen, &vinfo) < 0) { + continue; /* uh, skip this screen? */ + } + + pixelformat = X11_GetPixelFormatFromVisualInfo(dpy, &vinfo); + if (SDL_ISPIXELFORMAT_INDEXED(pixelformat)) { + continue; /* Palettized video modes are no longer supported */ + } + + scanline_pad = SDL_BYTESPERPIXEL(pixelformat) * 8; + pixmapformats = X11_XListPixmapFormats(dpy, &n); + if (pixmapformats) { + for (i = 0; i < n; ++i) { + if (pixmapformats[i].depth == vinfo.depth) { + scanline_pad = pixmapformats[i].scanline_pad; + break; + } + } + X11_XFree(pixmapformats); + } + + res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); + if (!res || res->noutput == 0) { + if (res) { + X11_XRRFreeScreenResources(res); + } + + res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); + if (!res) { + continue; + } + } + + for (output = 0; output < res->noutput; output++) { + XRROutputInfo *output_info; + int display_x, display_y; + unsigned long display_mm_width, display_mm_height; + SDL_DisplayData *displaydata; + char display_name[128]; + SDL_DisplayMode mode; + SDL_DisplayModeData *modedata; + SDL_VideoDisplay display; + RRMode modeID; + RRCrtc output_crtc; + XRRCrtcInfo *crtc; + int xft_dpi = 0; + + /* The primary output _should_ always be sorted first, but just in case... */ + if ((looking_for_primary && (res->outputs[output] != primary)) || + (!looking_for_primary && (screen == default_screen) && (res->outputs[output] == primary))) { + continue; + } + + output_info = X11_XRRGetOutputInfo(dpy, res, res->outputs[output]); + if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) { + X11_XRRFreeOutputInfo(output_info); + continue; + } + + SDL_strlcpy(display_name, output_info->name, sizeof(display_name)); + display_mm_width = output_info->mm_width; + display_mm_height = output_info->mm_height; + output_crtc = output_info->crtc; + X11_XRRFreeOutputInfo(output_info); + + crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc); + if (!crtc) { + continue; + } + + SDL_zero(mode); + modeID = crtc->mode; + mode.w = crtc->width; + mode.h = crtc->height; + mode.format = pixelformat; + + display_x = crtc->x; + display_y = crtc->y; + + X11_XRRFreeCrtcInfo(crtc); + + displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); + if (!displaydata) { + return SDL_OutOfMemory(); + } + + modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); + if (!modedata) { + SDL_free(displaydata); + return SDL_OutOfMemory(); + } + modedata->xrandr_mode = modeID; + mode.driverdata = modedata; + + displaydata->screen = screen; + displaydata->visual = vinfo.visual; + displaydata->depth = vinfo.depth; + displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; + displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; + displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); + + /* if xft dpi is available we will use this over xrandr */ + xft_dpi = GetXftDPI(dpy); + if(xft_dpi > 0) { + displaydata->hdpi = (float)xft_dpi; + displaydata->vdpi = (float)xft_dpi; + } + + displaydata->scanline_pad = scanline_pad; + displaydata->x = display_x; + displaydata->y = display_y; + displaydata->use_xrandr = 1; + displaydata->xrandr_output = res->outputs[output]; + + SetXRandRModeInfo(dpy, res, output_crtc, modeID, &mode); + SetXRandRDisplayName(dpy, EDID, display_name, sizeof (display_name), res->outputs[output], display_mm_width, display_mm_height); + + SDL_zero(display); + if (*display_name) { + display.name = display_name; + } + display.desktop_mode = mode; + display.current_mode = mode; + display.driverdata = displaydata; + SDL_AddVideoDisplay(&display, SDL_FALSE); + } + + X11_XRRFreeScreenResources(res); } - X11_XFree(pixmapformats); } - displaydata->scanline_pad = scanline_pad; - displaydata->x = 0; - displaydata->y = 0; - displaydata->use_xrandr = SDL_FALSE; - - SDL_zero(display); - display.name = (char *) "Generic X11 Display"; /* this is just copied and thrown away, it's safe to cast to char* here. */ - display.desktop_mode = mode; - display.current_mode = mode; - display.driverdata = displaydata; - SDL_AddVideoDisplay(&display, SDL_TRUE); + if (_this->num_displays == 0) { + return SDL_SetError("No available displays"); + } return 0; } +#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ +#if SDL_VIDEO_DRIVER_X11_XVIDMODE +static SDL_bool +CheckVidMode(Display * display, int *major, int *minor) +{ + int vm_event, vm_error = -1; + /* Default the extension not available */ + *major = *minor = 0; + + /* Allow environment override */ + if (!SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_XVIDMODE, SDL_TRUE)) { +#ifdef X11MODES_DEBUG + printf("XVidMode disabled due to hint\n"); +#endif + return SDL_FALSE; + } + + if (!SDL_X11_HAVE_XVIDMODE) { +#ifdef X11MODES_DEBUG + printf("XVidMode support not available\n"); +#endif + return SDL_FALSE; + } + + /* Query the extension version */ + if (!X11_XF86VidModeQueryExtension(display, &vm_event, &vm_error) + || !X11_XF86VidModeQueryVersion(display, major, minor)) { +#ifdef X11MODES_DEBUG + printf("XVidMode not active on the display\n"); +#endif + return SDL_FALSE; + } +#ifdef X11MODES_DEBUG + printf("XVidMode available at version %d.%d!\n", *major, *minor); +#endif + return SDL_TRUE; +} + +static +Bool XF86VidModeGetModeInfo(Display * dpy, int scr, + XF86VidModeModeInfo* info) +{ + Bool retval; + int dotclock; + XF86VidModeModeLine l; + SDL_zerop(info); + SDL_zero(l); + retval = X11_XF86VidModeGetModeLine(dpy, scr, &dotclock, &l); + info->dotclock = dotclock; + info->hdisplay = l.hdisplay; + info->hsyncstart = l.hsyncstart; + info->hsyncend = l.hsyncend; + info->htotal = l.htotal; + info->hskew = l.hskew; + info->vdisplay = l.vdisplay; + info->vsyncstart = l.vsyncstart; + info->vsyncend = l.vsyncend; + info->vtotal = l.vtotal; + info->flags = l.flags; + info->privsize = l.privsize; + info->private = l.private; + return retval; +} + +static int +CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info) +{ + return (info->htotal + && info->vtotal) ? (1000 * info->dotclock / (info->htotal * + info->vtotal)) : 0; +} + +static SDL_bool +SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode) +{ + mode->w = info->hdisplay; + mode->h = info->vdisplay; + mode->refresh_rate = CalculateXVidModeRefreshRate(info); + ((SDL_DisplayModeData*)mode->driverdata)->vm_mode = *info; + return SDL_TRUE; +} +#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ int X11_InitModes(_THIS) { - /* XRandR is the One True Modern Way to do this on X11. If this - fails, we just won't report any display modes except the current - desktop size. */ + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + int snum, screen, screencount = 0; +#if SDL_VIDEO_DRIVER_X11_XINERAMA + int xinerama_major, xinerama_minor; + int use_xinerama = 0; + XineramaScreenInfo *xinerama = NULL; +#endif #if SDL_VIDEO_DRIVER_X11_XRANDR - { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - int xrandr_major, xrandr_minor; - /* require at least XRandR v1.3 */ - if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && - (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { - return X11_InitModes_XRandR(_this); - } + int xrandr_major, xrandr_minor; +#endif +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + int vm_major, vm_minor; + int use_vidmode = 0; +#endif + +/* XRandR is the One True Modern Way to do this on X11. If it's enabled and + available, don't even look at other ways of doing things. */ +#if SDL_VIDEO_DRIVER_X11_XRANDR + /* require at least XRandR v1.3 */ + if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && + (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { + if (X11_InitModes_XRandR(_this) == 0) + return 0; } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ - /* still here? Just set up an extremely basic display. */ - return X11_InitModes_StdXlib(_this); +/* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */ + + /* This is a workaround for some apps (UnrealEngine4, for example) until + we sort out the ramifications of removing XVidMode support outright. + This block should be removed with the XVidMode support. */ + { + if (SDL_GetHintBoolean("SDL_VIDEO_X11_REQUIRE_XRANDR", SDL_FALSE)) { + #if SDL_VIDEO_DRIVER_X11_XRANDR + return SDL_SetError("XRandR support is required but not available"); + #else + return SDL_SetError("XRandR support is required but not built into SDL!"); + #endif + } + } + +#if SDL_VIDEO_DRIVER_X11_XINERAMA + /* Query Xinerama extention + * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012) + * or newer of the Nvidia binary drivers + */ + if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) { + int (*handler) (Display *, XErrorEvent *); + X11_XSync(data->display, False); + handler = X11_XSetErrorHandler(X11_XineramaFailed); + xinerama = X11_XineramaQueryScreens(data->display, &screencount); + X11_XSync(data->display, False); + X11_XSetErrorHandler(handler); + if (xinerama_triggered_error) { + xinerama = 0; + } + if (xinerama) { + use_xinerama = xinerama_major * 100 + xinerama_minor; + } + } + if (!xinerama) { + screencount = ScreenCount(data->display); + } +#else + screencount = ScreenCount(data->display); +#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ + +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + if (CheckVidMode(data->display, &vm_major, &vm_minor)) { + use_vidmode = vm_major * 100 + vm_minor; + } +#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ + + for (snum = 0; snum < screencount; ++snum) { + XVisualInfo vinfo; + SDL_VideoDisplay display; + SDL_DisplayData *displaydata; + SDL_DisplayMode mode; + SDL_DisplayModeData *modedata; + XPixmapFormatValues *pixmapFormats; + char display_name[128]; + int i, n; + + /* Re-order screens to always put default screen first */ + if (snum == 0) { + screen = DefaultScreen(data->display); + } else if (snum == DefaultScreen(data->display)) { + screen = 0; + } else { + screen = snum; + } + +#if SDL_VIDEO_DRIVER_X11_XINERAMA + if (xinerama) { + if (get_visualinfo(data->display, 0, &vinfo) < 0) { + continue; + } + } else { + if (get_visualinfo(data->display, screen, &vinfo) < 0) { + continue; + } + } +#else + if (get_visualinfo(data->display, screen, &vinfo) < 0) { + continue; + } +#endif + + displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata)); + if (!displaydata) { + continue; + } + display_name[0] = '\0'; + + mode.format = X11_GetPixelFormatFromVisualInfo(data->display, &vinfo); + if (SDL_ISPIXELFORMAT_INDEXED(mode.format)) { + /* We don't support palettized modes now */ + SDL_free(displaydata); + continue; + } +#if SDL_VIDEO_DRIVER_X11_XINERAMA + if (xinerama) { + mode.w = xinerama[screen].width; + mode.h = xinerama[screen].height; + } else { + mode.w = DisplayWidth(data->display, screen); + mode.h = DisplayHeight(data->display, screen); + } +#else + mode.w = DisplayWidth(data->display, screen); + mode.h = DisplayHeight(data->display, screen); +#endif + mode.refresh_rate = 0; + + modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); + if (!modedata) { + SDL_free(displaydata); + continue; + } + mode.driverdata = modedata; + +#if SDL_VIDEO_DRIVER_X11_XINERAMA + /* Most of SDL's calls to X11 are unwaware of Xinerama, and to X11 standard calls, when Xinerama is active, + * there's only one screen available. So we force the screen number to zero and + * let Xinerama specific code handle specific functionality using displaydata->xinerama_info + */ + if (use_xinerama) { + displaydata->screen = 0; + displaydata->use_xinerama = use_xinerama; + displaydata->xinerama_info = xinerama[screen]; + displaydata->xinerama_screen = screen; + } + else displaydata->screen = screen; +#else + displaydata->screen = screen; +#endif + displaydata->visual = vinfo.visual; + displaydata->depth = vinfo.depth; + + /* We use the displaydata screen index here so that this works + for both the Xinerama case, where we get the overall DPI, + and the regular X11 screen info case. */ + displaydata->hdpi = (float)DisplayWidth(data->display, displaydata->screen) * 25.4f / + DisplayWidthMM(data->display, displaydata->screen); + displaydata->vdpi = (float)DisplayHeight(data->display, displaydata->screen) * 25.4f / + DisplayHeightMM(data->display, displaydata->screen); + displaydata->ddpi = SDL_ComputeDiagonalDPI(DisplayWidth(data->display, displaydata->screen), + DisplayHeight(data->display, displaydata->screen), + (float)DisplayWidthMM(data->display, displaydata->screen) / 25.4f, + (float)DisplayHeightMM(data->display, displaydata->screen) / 25.4f); + + displaydata->scanline_pad = SDL_BYTESPERPIXEL(mode.format) * 8; + pixmapFormats = X11_XListPixmapFormats(data->display, &n); + if (pixmapFormats) { + for (i = 0; i < n; ++i) { + if (pixmapFormats[i].depth == displaydata->depth) { + displaydata->scanline_pad = pixmapFormats[i].scanline_pad; + break; + } + } + X11_XFree(pixmapFormats); + } + +#if SDL_VIDEO_DRIVER_X11_XINERAMA + if (use_xinerama) { + displaydata->x = xinerama[screen].x_org; + displaydata->y = xinerama[screen].y_org; + } + else +#endif + { + displaydata->x = 0; + displaydata->y = 0; + } + +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + if (!displaydata->use_xrandr && +#if SDL_VIDEO_DRIVER_X11_XINERAMA + /* XVidMode only works on the screen at the origin */ + (!displaydata->use_xinerama || + (displaydata->x == 0 && displaydata->y == 0)) && +#endif + use_vidmode) { + displaydata->use_vidmode = use_vidmode; + if (displaydata->use_xinerama) { + displaydata->vidmode_screen = 0; + } else { + displaydata->vidmode_screen = screen; + } + XF86VidModeGetModeInfo(data->display, displaydata->vidmode_screen, &modedata->vm_mode); + } +#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ + + SDL_zero(display); + if (*display_name) { + display.name = display_name; + } + display.desktop_mode = mode; + display.current_mode = mode; + display.driverdata = displaydata; + SDL_AddVideoDisplay(&display, SDL_FALSE); + } + +#if SDL_VIDEO_DRIVER_X11_XINERAMA + if (xinerama) X11_XFree(xinerama); +#endif + + if (_this->num_displays == 0) { + return SDL_SetError("No available displays"); + } + +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + if (use_vidmode) { /* we intend to remove support for XVidMode soon. */ + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "SDL is using XVidMode to manage your displays!"); + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "This almost always means either SDL was misbuilt"); + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "or your X server is insufficient. Please check your setup!"); + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Fullscreen and/or multiple displays will not work well."); + } +#endif + + return 0; } void X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) { + Display *display = ((SDL_VideoData *) _this->driverdata)->display; SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata; +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + int nmodes; + XF86VidModeModeInfo ** modes; +#endif SDL_DisplayMode mode; /* Unfortunately X11 requires the window to be created with the correct @@ -685,9 +882,54 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) mode.format = sdl_display->current_mode.format; mode.driverdata = NULL; +#if SDL_VIDEO_DRIVER_X11_XINERAMA + if (data->use_xinerama) { + int screen_w; + int screen_h; + + screen_w = DisplayWidth(display, data->screen); + screen_h = DisplayHeight(display, data->screen); + + if (data->use_vidmode && !data->xinerama_info.x_org && !data->xinerama_info.y_org && + (screen_w > data->xinerama_info.width || screen_h > data->xinerama_info.height)) { + SDL_DisplayModeData *modedata; + /* Add the full (both screens combined) xinerama mode only on the display that starts at 0,0 + * if we're using vidmode. + */ + mode.w = screen_w; + mode.h = screen_h; + mode.refresh_rate = 0; + modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); + if (modedata) { + *modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata; + } + mode.driverdata = modedata; + if (!SDL_AddDisplayMode(sdl_display, &mode)) { + SDL_free(modedata); + } + } + else if (!data->use_xrandr) + { + SDL_DisplayModeData *modedata; + /* Add the current mode of each monitor otherwise if we can't get them from xrandr */ + mode.w = data->xinerama_info.width; + mode.h = data->xinerama_info.height; + mode.refresh_rate = 0; + modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); + if (modedata) { + *modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata; + } + mode.driverdata = modedata; + if (!SDL_AddDisplayMode(sdl_display, &mode)) { + SDL_free(modedata); + } + } + + } +#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ + #if SDL_VIDEO_DRIVER_X11_XRANDR if (data->use_xrandr) { - Display *display = ((SDL_VideoData *) _this->driverdata)->display; XRRScreenResources *res; res = X11_XRRGetScreenResources (display, RootWindow(display, data->screen)); @@ -718,7 +960,37 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ - if (!data->use_xrandr) { +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + if (data->use_vidmode && + X11_XF86VidModeGetAllModeLines(display, data->vidmode_screen, &nmodes, &modes)) { + int i; + SDL_DisplayModeData *modedata; + +#ifdef X11MODES_DEBUG + printf("VidMode modes: (unsorted)\n"); + for (i = 0; i < nmodes; ++i) { + printf("Mode %d: %d x %d @ %d, flags: 0x%x\n", i, + modes[i]->hdisplay, modes[i]->vdisplay, + CalculateXVidModeRefreshRate(modes[i]), modes[i]->flags); + } +#endif + for (i = 0; i < nmodes; ++i) { + modedata = (SDL_DisplayModeData *) SDL_calloc(1, sizeof(SDL_DisplayModeData)); + if (!modedata) { + continue; + } + mode.driverdata = modedata; + + if (!SetXVidModeModeInfo(modes[i], &mode) || !SDL_AddDisplayMode(sdl_display, &mode)) { + SDL_free(modedata); + } + } + X11_XFree(modes); + return; + } +#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ + + if (!data->use_xrandr && !data->use_vidmode) { SDL_DisplayModeData *modedata; /* Add the desktop mode */ mode = sdl_display->desktop_mode; @@ -733,36 +1005,28 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) } } -#if SDL_VIDEO_DRIVER_X11_XRANDR /* This catches an error from XRRSetScreenSize, as a workaround for now. */ /* !!! FIXME: remove this later when we have a better solution. */ static int (*PreXRRSetScreenSizeErrorHandler)(Display *, XErrorEvent *) = NULL; static int SDL_XRRSetScreenSizeErrHandler(Display *d, XErrorEvent *e) { - /* BadMatch: https://github.com/libsdl-org/SDL/issues/4561 */ - /* BadValue: https://github.com/libsdl-org/SDL/issues/4840 */ - if ((e->error_code == BadMatch) || (e->error_code == BadValue)) { - return 0; - } - - return PreXRRSetScreenSizeErrorHandler(d, e); + return (e->error_code == BadMatch) ? 0 : PreXRRSetScreenSizeErrorHandler(d, e); } -#endif int X11_SetDisplayMode(_THIS, SDL_VideoDisplay * sdl_display, SDL_DisplayMode * mode) { SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; + Display *display = viddata->display; SDL_DisplayData *data = (SDL_DisplayData *) sdl_display->driverdata; + SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; + int mm_width, mm_height; viddata->last_mode_change_deadline = SDL_GetTicks() + (PENDING_FOCUS_TIME * 2); #if SDL_VIDEO_DRIVER_X11_XRANDR if (data->use_xrandr) { - Display *display = viddata->display; - SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; - int mm_width, mm_height; XRRScreenResources *res; XRROutputInfo *output_info; XRRCrtcInfo *crtc; @@ -835,6 +1099,12 @@ freeInfo: } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + if (data->use_vidmode) { + X11_XF86VidModeSwitchToMode(display, data->vidmode_screen, &modedata->vm_mode); + } +#endif /* SDL_VIDEO_DRIVER_X11_XVIDMODE */ + return 0; } @@ -853,6 +1123,19 @@ X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect) rect->w = sdl_display->current_mode.w; rect->h = sdl_display->current_mode.h; +#if SDL_VIDEO_DRIVER_X11_XINERAMA + /* Get the real current bounds of the display */ + if (data->use_xinerama) { + Display *display = ((SDL_VideoData *) _this->driverdata)->display; + int screencount; + XineramaScreenInfo *xinerama = X11_XineramaQueryScreens(display, &screencount); + if (xinerama) { + rect->x = xinerama[data->xinerama_screen].x_org; + rect->y = xinerama[data->xinerama_screen].y_org; + X11_XFree(xinerama); + } + } +#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ return 0; } diff --git a/externals/SDL/src/video/x11/SDL_x11modes.h b/externals/SDL/src/video/x11/SDL_x11modes.h index 9a4257e43..554868016 100755 --- a/externals/SDL/src/video/x11/SDL_x11modes.h +++ b/externals/SDL/src/video/x11/SDL_x11modes.h @@ -35,20 +35,35 @@ typedef struct float hdpi; float vdpi; - SDL_bool use_xrandr; + int use_xinerama; + int use_xrandr; + int use_vidmode; + +#if SDL_VIDEO_DRIVER_X11_XINERAMA + XineramaScreenInfo xinerama_info; + int xinerama_screen; +#endif #if SDL_VIDEO_DRIVER_X11_XRANDR RROutput xrandr_output; #endif + +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + int vidmode_screen; +#endif + } SDL_DisplayData; typedef struct { #if SDL_VIDEO_DRIVER_X11_XRANDR RRMode xrandr_mode; -#else - int unused; /* just so struct isn't empty. */ #endif + +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + XF86VidModeModeInfo vm_mode; +#endif + } SDL_DisplayModeData; extern int X11_InitModes(_THIS); @@ -65,10 +80,6 @@ extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); -#if SDL_VIDEO_DRIVER_X11_XRANDR -extern void X11_HandleXRandREvent(_THIS, const XEvent *xevent); -#endif - #endif /* SDL_x11modes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/x11/SDL_x11mouse.c b/externals/SDL/src/video/x11/SDL_x11mouse.c index ed29288c6..033df8d28 100755 --- a/externals/SDL/src/video/x11/SDL_x11mouse.c +++ b/externals/SDL/src/video/x11/SDL_x11mouse.c @@ -244,8 +244,8 @@ X11_CreateSystemCursor(SDL_SystemCursor id) case SDL_SYSTEM_CURSOR_WAIT: shape = XC_watch; break; case SDL_SYSTEM_CURSOR_CROSSHAIR: shape = XC_tcross; break; case SDL_SYSTEM_CURSOR_WAITARROW: shape = XC_watch; break; - case SDL_SYSTEM_CURSOR_SIZENWSE: shape = XC_top_left_corner; break; - case SDL_SYSTEM_CURSOR_SIZENESW: shape = XC_top_right_corner; break; + case SDL_SYSTEM_CURSOR_SIZENWSE: shape = XC_fleur; break; + case SDL_SYSTEM_CURSOR_SIZENESW: shape = XC_fleur; break; case SDL_SYSTEM_CURSOR_SIZEWE: shape = XC_sb_h_double_arrow; break; case SDL_SYSTEM_CURSOR_SIZENS: shape = XC_sb_v_double_arrow; break; case SDL_SYSTEM_CURSOR_SIZEALL: shape = XC_fleur; break; @@ -294,15 +294,14 @@ X11_ShowCursor(SDL_Cursor * cursor) SDL_VideoDevice *video = SDL_GetVideoDevice(); Display *display = GetDisplay(); SDL_Window *window; + SDL_WindowData *data; for (window = video->windows; window; window = window->next) { - SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - if (data) { - if (x11_cursor != None) { - X11_XDefineCursor(display, data->xwindow, x11_cursor); - } else { - X11_XUndefineCursor(display, data->xwindow); - } + data = (SDL_WindowData *)window->driverdata; + if (x11_cursor != None) { + X11_XDefineCursor(display, data->xwindow, x11_cursor); + } else { + X11_XUndefineCursor(display, data->xwindow); } } X11_XFlush(display); @@ -406,8 +405,6 @@ X11_GetGlobalMouseState(int *x, int *y) buttons |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0; buttons |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0; buttons |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0; - /* Use the SDL state for the extended buttons - it's better than nothing */ - buttons |= (SDL_GetMouseState(NULL, NULL) & (SDL_BUTTON_X1MASK|SDL_BUTTON_X2MASK)); /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right). * diff --git a/externals/SDL/src/video/x11/SDL_x11opengl.c b/externals/SDL/src/video/x11/SDL_x11opengl.c index 3e17e97ff..64b06340a 100755 --- a/externals/SDL/src/video/x11/SDL_x11opengl.c +++ b/externals/SDL/src/video/x11/SDL_x11opengl.c @@ -247,6 +247,11 @@ X11_GL_LoadLibrary(_THIS, const char *path) X11_GL_UseEGL(_this) ) { #if SDL_VIDEO_OPENGL_EGL X11_GL_UnloadLibrary(_this); + /* Better avoid conflicts! */ + if (_this->gl_config.dll_handle != NULL ) { + GL_UnloadObject(_this->gl_config.dll_handle); + _this->gl_config.dll_handle = NULL; + } _this->GL_LoadLibrary = X11_GLES_LoadLibrary; _this->GL_GetProcAddress = X11_GLES_GetProcAddress; _this->GL_UnloadLibrary = X11_GLES_UnloadLibrary; diff --git a/externals/SDL/src/video/x11/SDL_x11sym.h b/externals/SDL/src/video/x11/SDL_x11sym.h index 1a1b102ac..67b0a793a 100755 --- a/externals/SDL/src/video/x11/SDL_x11sym.h +++ b/externals/SDL/src/video/x11/SDL_x11sym.h @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* *INDENT-OFF* */ /* clang-format off */ +/* *INDENT-OFF* */ #ifndef SDL_X11_MODULE #define SDL_X11_MODULE(modname) @@ -33,6 +33,8 @@ SDL_X11_MODULE(BASEXLIB) SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return) SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return) SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return) +SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return) +SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return) SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return) SDL_X11_SYM(int,XChangeProperty,(Display* a,Window b,Atom c,Atom d,int e,int f,_Xconst unsigned char* g,int h),(a,b,c,d,e,f,g,h),return) SDL_X11_SYM(Bool,XCheckIfEvent,(Display* a,XEvent *b,Bool (*c)(Display*,XEvent*,XPointer),XPointer d),(a,b,c,d),return) @@ -70,6 +72,7 @@ SDL_X11_SYM(char*,XGetAtomName,(Display *a,Atom b),(a,b),return) SDL_X11_SYM(int,XGetInputFocus,(Display *a,Window *b,int *c),(a,b,c),return) SDL_X11_SYM(int,XGetErrorDatabaseText,(Display* a,_Xconst char* b,_Xconst char* c,_Xconst char* d,char* e,int f),(a,b,c,d,e,f),return) SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return) +SDL_X11_SYM(int,XGetKeyboardControl,(Display* a, XKeyboardState* b),(a,b),return) SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return) SDL_X11_SYM(Window,XGetSelectionOwner,(Display* a,Atom b),(a,b),return) SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return) @@ -182,6 +185,7 @@ SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) SDL_X11_SYM(Bool,XkbSetDetectableAutoRepeat,(Display* a, Bool b, Bool* c),(a,b,c),return) +SDL_X11_SYM(Bool,XkbSelectEvents,(Display* a, unsigned int b, unsigned int c, unsigned int d),(a,b,c,d),return) #endif #if NeedWidePrototypes @@ -260,6 +264,15 @@ SDL_X11_SYM(void,XdbeFreeVisualInfo,(XdbeScreenVisualInfo *visual_info),(visual_ SDL_X11_SYM(XdbeBackBufferAttributes*,XdbeGetBackBufferAttributes,(Display *dpy,XdbeBackBuffer buffer),(dpy,buffer),return) #endif +/* Xinerama support */ +#if SDL_VIDEO_DRIVER_X11_XINERAMA +SDL_X11_MODULE(XINERAMA) +SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),return) +SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),return) +SDL_X11_SYM(Status,XineramaQueryVersion,(Display *a,int *b,int *c),(a,b,c),return) +SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),return) +#endif + /* XInput2 support for multiple mice, tablets, etc. */ #if SDL_VIDEO_DRIVER_X11_XINPUT2 SDL_X11_MODULE(XINPUT2) @@ -276,7 +289,6 @@ SDL_X11_SYM(XIEventMask*,XIGetSelectedEvents,(Display *a,Window b,int *c),(a,b,c #if SDL_VIDEO_DRIVER_X11_XRANDR SDL_X11_MODULE(XRANDR) SDL_X11_SYM(Status,XRRQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return) -SDL_X11_SYM(Bool,XRRQueryExtension,(Display *dpy,int *event_base_return,int *error_base_return),(dpy,event_base_return,error_base_return),return); SDL_X11_SYM(XRRScreenConfiguration *,XRRGetScreenInfo,(Display *dpy,Drawable draw),(dpy,draw),return) SDL_X11_SYM(SizeID,XRRConfigCurrentConfiguration,(XRRScreenConfiguration *config,Rotation *rotation),(config,rotation),return) SDL_X11_SYM(short,XRRConfigCurrentRate,(XRRScreenConfiguration *config),(config),return) @@ -298,7 +310,6 @@ SDL_X11_SYM(Atom*,XRRListOutputProperties,(Display *dpy, RROutput output, int *n SDL_X11_SYM(XRRPropertyInfo*,XRRQueryOutputProperty,(Display *dpy,RROutput output, Atom property),(dpy,output,property),return) SDL_X11_SYM(int,XRRGetOutputProperty,(Display *dpy,RROutput output, Atom property, long offset, long length, Bool _delete, Bool pending, Atom req_type, Atom *actual_type, int *actual_format, unsigned long *nitems, unsigned long *bytes_after, unsigned char **prop),(dpy,output,property,offset,length, _delete, pending, req_type, actual_type, actual_format, nitems, bytes_after, prop),return) SDL_X11_SYM(RROutput,XRRGetOutputPrimary,(Display *dpy,Window window),(dpy,window),return) -SDL_X11_SYM(void,XRRSelectInput,(Display *dpy, Window window, int mask),(dpy,window,mask),) #endif /* MIT-SCREEN-SAVER support */ @@ -314,9 +325,20 @@ SDL_X11_MODULE(XSHAPE) SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x_off,int y_off,Pixmap src,int op),(dpy,dest,dest_kind,x_off,y_off,src,op),) #endif +#if SDL_VIDEO_DRIVER_X11_XVIDMODE +SDL_X11_MODULE(XVIDMODE) +SDL_X11_SYM(Bool,XF86VidModeGetAllModeLines,(Display *a,int b,int *c,XF86VidModeModeInfo ***d),(a,b,c,d),return) +SDL_X11_SYM(Bool,XF86VidModeGetModeLine,(Display *a,int b,int *c,XF86VidModeModeLine *d),(a,b,c,d),return) +SDL_X11_SYM(Bool,XF86VidModeGetViewPort,(Display *a,int b,int *c,int *d),(a,b,c,d),return) +SDL_X11_SYM(Bool,XF86VidModeQueryExtension,(Display *a,int *b,int *c),(a,b,c),return) +SDL_X11_SYM(Bool,XF86VidModeQueryVersion,(Display *a,int *b,int *c),(a,b,c),return) +SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),return) +SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return) +#endif + #undef SDL_X11_MODULE #undef SDL_X11_SYM -/* *INDENT-ON* */ /* clang-format on */ +/* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/externals/SDL/src/video/x11/SDL_x11video.h b/externals/SDL/src/video/x11/SDL_x11video.h index 5360d037f..8c7eb09ec 100755 --- a/externals/SDL/src/video/x11/SDL_x11video.h +++ b/externals/SDL/src/video/x11/SDL_x11video.h @@ -37,6 +37,9 @@ #if SDL_VIDEO_DRIVER_X11_XDBE #include #endif +#if SDL_VIDEO_DRIVER_X11_XINERAMA +#include +#endif #if SDL_VIDEO_DRIVER_X11_XINPUT2 #include #endif @@ -49,6 +52,9 @@ #if SDL_VIDEO_DRIVER_X11_XSHAPE #include #endif +#if SDL_VIDEO_DRIVER_X11_XVIDMODE +#include +#endif #include "../../core/linux/SDL_dbus.h" #include "../../core/linux/SDL_ime.h" @@ -134,8 +140,6 @@ typedef struct SDL_VideoData SDL_Point global_mouse_position; Uint32 global_mouse_buttons; - int xrandr_event_base; - #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM XkbDescPtr xkb; #endif diff --git a/externals/SDL/src/video/x11/SDL_x11window.c b/externals/SDL/src/video/x11/SDL_x11window.c index f7ec281b9..89e9ebbc1 100755 --- a/externals/SDL/src/video/x11/SDL_x11window.c +++ b/externals/SDL/src/video/x11/SDL_x11window.c @@ -27,7 +27,6 @@ #include "../SDL_pixels_c.h" #include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_mouse_c.h" -#include "../../events/SDL_events_c.h" #include "SDL_x11video.h" #include "SDL_x11mouse.h" @@ -73,6 +72,13 @@ X11_XIfEventTimeout(Display *display, XEvent *event_return, Bool (*predicate)(), } */ +static SDL_bool +X11_IsWindowLegacyFullscreen(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + return (data->fswindow != 0); +} + static SDL_bool X11_IsWindowMapped(_THIS, SDL_Window * window) { @@ -386,7 +392,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) long compositor = 1; Atom _NET_WM_PID; long fevent = 0; - const char *hint = NULL; #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL const char *forced_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_WINDOW_VISUALID); @@ -586,8 +591,6 @@ X11_CreateWindow(_THIS, SDL_Window * window) wintype_name = "_NET_WM_WINDOW_TYPE_TOOLTIP"; } else if (window->flags & SDL_WINDOW_POPUP_MENU) { wintype_name = "_NET_WM_WINDOW_TYPE_POPUP_MENU"; - } else if ( ((hint = SDL_GetHint(SDL_HINT_X11_WINDOW_TYPE)) != NULL) && *hint ) { - wintype_name = hint; } else { wintype_name = "_NET_WM_WINDOW_TYPE_NORMAL"; compositor = 1; /* disable compositing for "normal" windows */ @@ -672,6 +675,8 @@ X11_CreateWindow(_THIS, SDL_Window * window) /* For _ICC_PROFILE. */ X11_XSelectInput(display, RootWindow(display, screen), PropertyChangeMask); + X11_XkbSelectEvents(display, XkbUseCoreKbd, XkbStateNotifyMask, XkbStateNotifyMask); + X11_XFlush(display); return 0; @@ -774,22 +779,11 @@ X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) X11_XFlush(display); } -static SDL_bool caught_x11_error = SDL_FALSE; -static int -X11_CatchAnyError(Display * d, XErrorEvent * e) -{ - /* this may happen during tumultuous times when we are polling anyhow, - so just note we had an error and return control. */ - caught_x11_error = SDL_TRUE; - return 0; -} - void X11_SetWindowPosition(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - int (*prev_handler) (Display *, XErrorEvent *) = NULL; unsigned int childCount; Window childReturn, root, parent; Window* children; @@ -808,27 +802,20 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) /* Wait a brief time to see if the window manager decided to let this move happen. If the window changes at all, even to an unexpected value, we break out. */ - X11_XSync(display, False); - prev_handler = X11_XSetErrorHandler(X11_CatchAnyError); - timeout = SDL_GetTicks() + 100; while (SDL_TRUE) { int x, y; - - caught_x11_error = SDL_FALSE; X11_XSync(display, False); X11_XGetWindowAttributes(display, data->xwindow, &attrs); X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display), attrs.x, attrs.y, &x, &y, &childReturn); - if (!caught_x11_error) { - if ((x != orig_x) || (y != orig_y)) { - window->x = x; - window->y = y; - break; /* window moved, time to go. */ - } else if ((x == window->x) && (y == window->y)) { - break; /* we're at the place we wanted to be anyhow, drop out. */ - } + if ((x != orig_x) || (y != orig_y)) { + window->x = x; + window->y = y; + break; /* window moved, time to go. */ + } else if ((x == window->x) && (y == window->y)) { + break; /* we're at the place we wanted to be anyhow, drop out. */ } if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { @@ -837,9 +824,6 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) SDL_Delay(10); } - - X11_XSetErrorHandler(prev_handler); - caught_x11_error = SDL_FALSE; } void @@ -905,7 +889,6 @@ X11_SetWindowSize(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; - int (*prev_handler) (Display *, XErrorEvent *) = NULL; XWindowAttributes attrs; int orig_w, orig_h; Uint32 timeout; @@ -957,25 +940,19 @@ X11_SetWindowSize(_THIS, SDL_Window * window) X11_XResizeWindow(display, data->xwindow, window->w, window->h); } - X11_XSync(display, False); - prev_handler = X11_XSetErrorHandler(X11_CatchAnyError); - /* Wait a brief time to see if the window manager decided to let this resize happen. If the window changes at all, even to an unexpected value, we break out. */ timeout = SDL_GetTicks() + 100; while (SDL_TRUE) { - caught_x11_error = SDL_FALSE; X11_XSync(display, False); X11_XGetWindowAttributes(display, data->xwindow, &attrs); - if (!caught_x11_error) { - if ((attrs.width != orig_w) || (attrs.height != orig_h)) { - window->w = attrs.width; - window->h = attrs.height; - break; /* window changed, time to go. */ - } else if ((attrs.width == window->w) && (attrs.height == window->h)) { - break; /* we're at the place we wanted to be anyhow, drop out. */ - } + if ((attrs.width != orig_w) || (attrs.height != orig_h)) { + window->w = attrs.width; + window->h = attrs.height; + break; /* window changed, time to go. */ + } else if ((attrs.width == window->w) && (attrs.height == window->h)) { + break; /* we're at the place we wanted to be anyhow, drop out. */ } if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { @@ -984,9 +961,6 @@ X11_SetWindowSize(_THIS, SDL_Window * window) SDL_Delay(10); } - - X11_XSetErrorHandler(prev_handler); - caught_x11_error = SDL_FALSE; } int @@ -1074,10 +1048,6 @@ X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) X11_XSync(display, False); X11_XCheckIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow); X11_XCheckIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); - - /* Make sure the window manager didn't resize our window for the difference. */ - X11_XResizeWindow(display, data->xwindow, window->w, window->h); - X11_XSync(display, False); } void @@ -1308,22 +1278,6 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis if (X11_IsWindowMapped(_this, window)) { XEvent e; - /* !!! FIXME: most of this waiting code is copy/pasted from elsewhere. */ - int (*prev_handler) (Display *, XErrorEvent *) = NULL; - unsigned int childCount; - Window childReturn, root, parent; - Window* children; - XWindowAttributes attrs; - int orig_w, orig_h, orig_x, orig_y; - Uint64 timeout; - - X11_XSync(display, False); - X11_XQueryTree(display, data->xwindow, &root, &parent, &children, &childCount); - X11_XGetWindowAttributes(display, data->xwindow, &attrs); - X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display), - attrs.x, attrs.y, &orig_x, &orig_y, &childReturn); - orig_w = attrs.width; - orig_h = attrs.height; if (!(window->flags & SDL_WINDOW_RESIZABLE)) { /* Compiz refuses fullscreen toggle if we're not resizable, so update the hints so we @@ -1373,48 +1327,6 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); } - - /* Wait a brief time to see if the window manager decided to let this happen. - If the window changes at all, even to an unexpected value, we break out. */ - X11_XSync(display, False); - prev_handler = X11_XSetErrorHandler(X11_CatchAnyError); - - timeout = SDL_GetTicks64() + 100; - while (SDL_TRUE) { - int x, y; - - caught_x11_error = SDL_FALSE; - X11_XSync(display, False); - X11_XGetWindowAttributes(display, data->xwindow, &attrs); - X11_XTranslateCoordinates(display, parent, DefaultRootWindow(display), - attrs.x, attrs.y, &x, &y, &childReturn); - - if (!caught_x11_error) { - SDL_bool window_changed = SDL_FALSE; - if ((x != orig_x) || (y != orig_y)) { - SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y); - window_changed = SDL_TRUE; - } - - if ((attrs.width != orig_w) || (attrs.height != orig_h)) { - SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, attrs.width, attrs.height); - window_changed = SDL_TRUE; - } - - if (window_changed) { - break; /* window changed, time to go. */ - } - } - - if (SDL_GetTicks64() >= timeout) { - break; - } - - SDL_Delay(10); - } - - X11_XSetErrorHandler(prev_handler); - caught_x11_error = SDL_FALSE; } else { Uint32 flags; @@ -1438,12 +1350,161 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis X11_XFlush(display); } +/* This handles fullscreen itself, outside the Window Manager. */ +static void +X11_BeginWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _display) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata; + Visual *visual = data->visual; + Display *display = data->videodata->display; + const int screen = displaydata->screen; + Window root = RootWindow(display, screen); + const int def_vis = (visual == DefaultVisual(display, screen)); + unsigned long xattrmask = 0; + XSetWindowAttributes xattr; + XEvent ev; + SDL_Rect rect; + + if ( data->fswindow ) { + return; /* already fullscreen, I hope. */ + } + + X11_GetDisplayBounds(_this, _display, &rect); + + SDL_zero(xattr); + xattr.override_redirect = True; + xattrmask |= CWOverrideRedirect; + xattr.background_pixel = def_vis ? BlackPixel(display, screen) : 0; + xattrmask |= CWBackPixel; + xattr.border_pixel = 0; + xattrmask |= CWBorderPixel; + xattr.colormap = data->colormap; + xattrmask |= CWColormap; + + data->fswindow = X11_XCreateWindow(display, root, + rect.x, rect.y, rect.w, rect.h, 0, + displaydata->depth, InputOutput, + visual, xattrmask, &xattr); + + X11_XSelectInput(display, data->fswindow, StructureNotifyMask); + X11_XSetWindowBackground(display, data->fswindow, 0); + X11_XInstallColormap(display, data->colormap); + X11_XClearWindow(display, data->fswindow); + X11_XMapRaised(display, data->fswindow); + + /* Make sure the fswindow is in view by warping mouse to the corner */ + X11_XUngrabPointer(display, CurrentTime); + X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y); + + /* Wait to be mapped, filter Unmap event out if it arrives. */ + X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->fswindow); + X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->fswindow); + +#if SDL_VIDEO_DRIVER_X11_XVIDMODE + if ( displaydata->use_vidmode ) { + X11_XF86VidModeLockModeSwitch(display, screen, True); + } +#endif + + SetWindowBordered(display, displaydata->screen, data->xwindow, SDL_FALSE); + + /* Center actual window within our cover-the-screen window. */ + X11_XReparentWindow(display, data->xwindow, data->fswindow, + (rect.w - window->w) / 2, (rect.h - window->h) / 2); + + /* Move the mouse to the upper left to make sure it's on-screen */ + X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y); + + /* Center mouse in the fullscreen window. */ + rect.x += (rect.w / 2); + rect.y += (rect.h / 2); + X11_XWarpPointer(display, None, root, 0, 0, 0, 0, rect.x, rect.y); + + /* Wait to be mapped, filter Unmap event out if it arrives. */ + X11_XIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow); + X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow); + + SDL_UpdateWindowGrab(window); +} + +static void +X11_EndWindowFullscreenLegacy(_THIS, SDL_Window * window, SDL_VideoDisplay * _display) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata; + Display *display = data->videodata->display; + const int screen = displaydata->screen; + Window root = RootWindow(display, screen); + Window fswindow = data->fswindow; + XEvent ev; + + if (!data->fswindow) { + return; /* already not fullscreen, I hope. */ + } + + data->fswindow = None; + +#if SDL_VIDEO_DRIVER_X11_VIDMODE + if ( displaydata->use_vidmode ) { + X11_XF86VidModeLockModeSwitch(display, screen, False); + } +#endif + + SDL_UpdateWindowGrab(window); + + X11_XReparentWindow(display, data->xwindow, root, window->x, window->y); + + /* flush these events so they don't confuse normal event handling */ + X11_XSync(display, False); + X11_XCheckIfEvent(display, &ev, &isMapNotify, (XPointer)&data->xwindow); + X11_XCheckIfEvent(display, &ev, &isUnmapNotify, (XPointer)&data->xwindow); + + SetWindowBordered(display, screen, data->xwindow, + (window->flags & SDL_WINDOW_BORDERLESS) == 0); + + X11_XWithdrawWindow(display, fswindow, screen); + + /* Wait to be unmapped. */ + X11_XIfEvent(display, &ev, &isUnmapNotify, (XPointer)&fswindow); + X11_XDestroyWindow(display, fswindow); +} + + void X11_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) { - X11_SetWindowFullscreenViaWM(_this, window, _display, fullscreen); + /* !!! FIXME: SDL_Hint? */ + SDL_bool legacy = SDL_FALSE; + const char *env = SDL_getenv("SDL_VIDEO_X11_LEGACY_FULLSCREEN"); + if (env) { + legacy = SDL_atoi(env); + } else { + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata; + if ( displaydata->use_vidmode ) { + legacy = SDL_TRUE; /* the new stuff only works with XRandR. */ + } else if ( !videodata->net_wm ) { + legacy = SDL_TRUE; /* The window manager doesn't support it */ + } else { + /* !!! FIXME: look at the window manager name, and blacklist certain ones? */ + /* http://stackoverflow.com/questions/758648/find-the-name-of-the-x-window-manager */ + legacy = SDL_FALSE; /* try the new way. */ + } + } + + if (legacy) { + if (fullscreen) { + X11_BeginWindowFullscreenLegacy(_this, window, _display); + } else { + X11_EndWindowFullscreenLegacy(_this, window, _display); + } + } else { + X11_SetWindowFullscreenViaWM(_this, window, _display, fullscreen); + } } + int X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) { @@ -1555,7 +1616,7 @@ X11_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size) unsigned long real_nitems; SDL_x11Prop atomProp; - X11_XGetWindowAttributes(display, data->xwindow, &attributes); + X11_XGetWindowAttributes(display, X11_IsWindowLegacyFullscreen(_this, window) ? data->fswindow : data->xwindow, &attributes); if (X11_XScreenNumberOfScreen(attributes.screen) > 0) { SDL_snprintf(icc_atom_string, sizeof("_ICC_PROFILE_") + 12, "%s%d", "_ICC_PROFILE_", X11_XScreenNumberOfScreen(attributes.screen)); } else { @@ -1595,15 +1656,16 @@ void X11_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Display *display; + Display *display = data->videodata->display; + SDL_bool oldstyle_fullscreen; - if (data == NULL) { - return; - } + /* ICCCM2.0-compliant window managers can handle fullscreen windows + If we're using XVidMode to change resolution we need to confine + the cursor so we don't pan around the virtual desktop. + */ + oldstyle_fullscreen = X11_IsWindowLegacyFullscreen(_this, window); - display = data->videodata->display; - - if (grabbed) { + if (oldstyle_fullscreen || grabbed) { /* If the window is unmapped, XGrab calls return GrabNotViewable, so when we get a MapNotify later, we'll try to update the grab as appropriate. */ @@ -1637,6 +1699,11 @@ X11_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) /* Raise the window if we grab the mouse */ X11_XRaiseWindow(display, data->xwindow); + + /* Now grab the keyboard on old-style fullscreen */ + if (oldstyle_fullscreen) { + X11_SetWindowKeyboardGrab(_this, window, SDL_TRUE); + } } else { X11_XUngrabPointer(display, CurrentTime); @@ -1649,13 +1716,7 @@ void X11_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Display *display; - - if (data == NULL) { - return; - } - - display = data->videodata->display; + Display *display = data->videodata->display; if (grabbed) { /* If the window is unmapped, XGrab calls return GrabNotViewable, @@ -1730,14 +1791,15 @@ X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) display = data->videodata->display; - if (info->version.major == SDL_MAJOR_VERSION) { + if (info->version.major == SDL_MAJOR_VERSION && + info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_X11; info->info.x11.display = display; info->info.x11.window = data->xwindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d", - SDL_MAJOR_VERSION); + SDL_SetError("Application not compiled with SDL %d.%d", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } } @@ -1827,7 +1889,7 @@ int SDL_X11_SetWindowTitle(Display* display, Window xwindow, char* title) { } else if (conv < 0) { return SDL_OutOfMemory(); } else { /* conv > 0 */ - SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "%d characters were not convertible to the current locale!", conv); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "%d characters were not convertable to the current locale!", conv); return 0; } diff --git a/externals/SDL/src/video/x11/SDL_x11window.h b/externals/SDL/src/video/x11/SDL_x11window.h index 6f7560afe..6f1c71c67 100755 --- a/externals/SDL/src/video/x11/SDL_x11window.h +++ b/externals/SDL/src/video/x11/SDL_x11window.h @@ -44,6 +44,7 @@ typedef struct { SDL_Window *window; Window xwindow; + Window fswindow; /* used if we can't have the WM handle fullscreen. */ Visual *visual; Colormap colormap; #ifndef NO_SHARED_MEMORY diff --git a/externals/SDL/src/video/yuv2rgb/yuv_rgb.c b/externals/SDL/src/video/yuv2rgb/yuv_rgb.c index c7415aa72..7908b8c48 100755 --- a/externals/SDL/src/video/yuv2rgb/yuv_rgb.c +++ b/externals/SDL/src/video/yuv2rgb/yuv_rgb.c @@ -687,38 +687,4 @@ void rgb24_yuv420_sseu(uint32_t width, uint32_t height, #endif //__SSE2__ -#ifdef __loongarch_sx - -#define LSX_FUNCTION_NAME yuv420_rgb24_lsx -#define STD_FUNCTION_NAME yuv420_rgb24_std -#define YUV_FORMAT YUV_FORMAT_420 -#define RGB_FORMAT RGB_FORMAT_RGB24 -#include "yuv_rgb_lsx_func.h" - -#define LSX_FUNCTION_NAME yuv420_rgba_lsx -#define STD_FUNCTION_NAME yuv420_rgba_std -#define YUV_FORMAT YUV_FORMAT_420 -#define RGB_FORMAT RGB_FORMAT_RGBA -#include "yuv_rgb_lsx_func.h" - -#define LSX_FUNCTION_NAME yuv420_bgra_lsx -#define STD_FUNCTION_NAME yuv420_bgra_std -#define YUV_FORMAT YUV_FORMAT_420 -#define RGB_FORMAT RGB_FORMAT_BGRA -#include "yuv_rgb_lsx_func.h" - -#define LSX_FUNCTION_NAME yuv420_argb_lsx -#define STD_FUNCTION_NAME yuv420_argb_std -#define YUV_FORMAT YUV_FORMAT_420 -#define RGB_FORMAT RGB_FORMAT_ARGB -#include "yuv_rgb_lsx_func.h" - -#define LSX_FUNCTION_NAME yuv420_abgr_lsx -#define STD_FUNCTION_NAME yuv420_abgr_std -#define YUV_FORMAT YUV_FORMAT_420 -#define RGB_FORMAT RGB_FORMAT_ABGR -#include "yuv_rgb_lsx_func.h" - -#endif //__loongarch_sx - #endif /* SDL_HAVE_YUV */ diff --git a/externals/SDL/src/video/yuv2rgb/yuv_rgb.h b/externals/SDL/src/video/yuv2rgb/yuv_rgb.h index 5668c0fc4..81d97ebdc 100755 --- a/externals/SDL/src/video/yuv2rgb/yuv_rgb.h +++ b/externals/SDL/src/video/yuv2rgb/yuv_rgb.h @@ -379,34 +379,3 @@ void rgb24_yuv420_sseu( uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, YCbCrType yuv_type); - -//yuv420 to bgra, lsx implementation -void yuv420_rgb24_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_rgba_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_bgra_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_argb_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_abgr_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); diff --git a/externals/SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h b/externals/SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h index f541017a4..3c5ee0db4 100755 --- a/externals/SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h +++ b/externals/SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h @@ -426,17 +426,9 @@ void SSE_FUNCTION_NAME(uint32_t width, uint32_t height, const int fix_read_nv12 = 0; #endif -#if YUV_FORMAT == YUV_FORMAT_422 - /* Avoid invalid read on last line */ - const int fix_read_422 = 1; -#else - const int fix_read_422 = 0; -#endif - - if (width >= 32) { uint32_t xpos, ypos; - for(ypos=0; ypos<(height-(uv_y_sample_interval-1)) - fix_read_422; ypos+=uv_y_sample_interval) + for(ypos=0; ypos<(height-(uv_y_sample_interval-1)); ypos+=uv_y_sample_interval) { const uint8_t *y_ptr1=Y+ypos*Y_stride, *y_ptr2=Y+(ypos+1)*Y_stride, @@ -467,15 +459,6 @@ void SSE_FUNCTION_NAME(uint32_t width, uint32_t height, } } - if (fix_read_422) { - const uint8_t *y_ptr=Y+ypos*Y_stride, - *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride, - *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride; - uint8_t *rgb_ptr=RGB+ypos*RGB_stride; - STD_FUNCTION_NAME(width, 1, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); - ypos += uv_y_sample_interval; - } - /* Catch the last line, if needed */ if (uv_y_sample_interval == 2 && ypos == (height-1)) { diff --git a/externals/SDL/src/video/yuv2rgb/yuv_rgb_std_func.h b/externals/SDL/src/video/yuv2rgb/yuv_rgb_std_func.h index 94872ec9f..f0ab5c660 100755 --- a/externals/SDL/src/video/yuv2rgb/yuv_rgb_std_func.h +++ b/externals/SDL/src/video/yuv2rgb/yuv_rgb_std_func.h @@ -97,13 +97,10 @@ void STD_FUNCTION_NAME( for(y=0; y<(height-(uv_y_sample_interval-1)); y+=uv_y_sample_interval) { const uint8_t *y_ptr1=Y+y*Y_stride, + *y_ptr2=Y+(y+1)*Y_stride, *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; - - #if uv_y_sample_interval > 1 - const uint8_t *y_ptr2=Y+(y+1)*Y_stride; - #endif - + uint8_t *rgb_ptr1=RGB+y*RGB_stride; #if uv_y_sample_interval > 1 @@ -138,9 +135,7 @@ void STD_FUNCTION_NAME( #endif y_ptr1+=2*y_pixel_stride; - #if uv_y_sample_interval > 1 y_ptr2+=2*y_pixel_stride; - #endif u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; } diff --git a/externals/SDL/test/CMakeLists.txt b/externals/SDL/test/CMakeLists.txt index 04ad3a1df..665d2d721 100755 --- a/externals/SDL/test/CMakeLists.txt +++ b/externals/SDL/test/CMakeLists.txt @@ -1,10 +1,5 @@ cmake_minimum_required(VERSION 3.0.0) project(SDL2 C) -include(CTest) - -if(SDL_INSTALL_TESTS) - include(GNUInstallDirs) -endif() # Global settings for all of the test targets # FIXME: is this wrong? @@ -44,8 +39,6 @@ endif() # CMake incorrectly detects opengl32.lib being present on MSVC ARM64 if(NOT MSVC OR NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") - # Prefer GLVND, if present - set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL) endif() @@ -55,8 +48,8 @@ endif() add_executable(checkkeys checkkeys.c) add_executable(checkkeysthreads checkkeysthreads.c) -add_executable(loopwave loopwave.c testutils.c) -add_executable(loopwavequeue loopwavequeue.c testutils.c) +add_executable(loopwave loopwave.c) +add_executable(loopwavequeue loopwavequeue.c) add_executable(testsurround testsurround.c) add_executable(testresample testresample.c) add_executable(testaudioinfo testaudioinfo.c) @@ -64,8 +57,8 @@ add_executable(testaudioinfo testaudioinfo.c) file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) -add_executable(testmultiaudio testmultiaudio.c testutils.c) -add_executable(testaudiohotplug testaudiohotplug.c testutils.c) +add_executable(testmultiaudio testmultiaudio.c) +add_executable(testaudiohotplug testaudiohotplug.c) add_executable(testaudiocapture testaudiocapture.c) add_executable(testatomic testatomic.c) add_executable(testintersections testintersections.c) @@ -75,191 +68,73 @@ add_executable(testdraw2 testdraw2.c) add_executable(testdrawchessboard testdrawchessboard.c) add_executable(testdropfile testdropfile.c) add_executable(testerror testerror.c) - -if(LINUX) - add_executable(testevdev testevdev.c) -endif() - add_executable(testfile testfile.c) -add_executable(testgamecontroller testgamecontroller.c testutils.c) -add_executable(testgeometry testgeometry.c testutils.c) +add_executable(testgamecontroller testgamecontroller.c) +add_executable(testgeometry testgeometry.c) add_executable(testgesture testgesture.c) add_executable(testgl2 testgl2.c) add_executable(testgles testgles.c) add_executable(testgles2 testgles2.c) -add_executable(testguid testguid.c) add_executable(testhaptic testhaptic.c) add_executable(testhotplug testhotplug.c) add_executable(testrumble testrumble.c) add_executable(testthread testthread.c) -add_executable(testiconv testiconv.c testutils.c) -add_executable(testime testime.c testutils.c) +add_executable(testiconv testiconv.c) +add_executable(testime testime.c) add_executable(testjoystick testjoystick.c) add_executable(testkeys testkeys.c) add_executable(testloadso testloadso.c) -add_executable(testlocale testlocale.c) add_executable(testlock testlock.c) add_executable(testmouse testmouse.c) if(APPLE) add_executable(testnative testnative.c testnativecocoa.m - testnativex11.c - testutils.c) + testnativex11.c) elseif(WINDOWS) - add_executable(testnative testnative.c testnativew32.c testutils.c) -elseif(SDL_X11) - add_executable(testnative testnative.c testnativex11.c testutils.c) - target_link_libraries(testnative X11) + add_executable(testnative testnative.c testnativew32.c) +elseif(UNIX) + add_executable(testnative testnative.c testnativex11.c) endif() -add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c testutils.c) +add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c) add_executable(testplatform testplatform.c) add_executable(testpower testpower.c) add_executable(testfilesystem testfilesystem.c) -add_executable(testrendertarget testrendertarget.c testutils.c) -add_executable(testscale testscale.c testutils.c) +add_executable(testrendertarget testrendertarget.c) +add_executable(testscale testscale.c) add_executable(testsem testsem.c) -add_executable(testsensor testsensor.c) add_executable(testshader testshader.c) add_executable(testshape testshape.c) -add_executable(testsprite2 testsprite2.c testutils.c) -add_executable(testspriteminimal testspriteminimal.c testutils.c) -add_executable(teststreaming teststreaming.c testutils.c) +add_executable(testsprite2 testsprite2.c) +add_executable(testspriteminimal testspriteminimal.c) +add_executable(teststreaming teststreaming.c) add_executable(testtimer testtimer.c) -add_executable(testurl testurl.c) add_executable(testver testver.c) -add_executable(testviewport testviewport.c testutils.c) +add_executable(testviewport testviewport.c) add_executable(testwm2 testwm2.c) add_executable(testyuv testyuv.c testyuv_cvt.c) add_executable(torturethread torturethread.c) -add_executable(testrendercopyex testrendercopyex.c testutils.c) +add_executable(testrendercopyex testrendercopyex.c) add_executable(testmessage testmessage.c) add_executable(testdisplayinfo testdisplayinfo.c) add_executable(testqsort testqsort.c) add_executable(testbounds testbounds.c) add_executable(testcustomcursor testcustomcursor.c) -add_executable(controllermap controllermap.c testutils.c) +add_executable(controllermap controllermap.c) add_executable(testvulkan testvulkan.c) add_executable(testoffscreen testoffscreen.c) -SET(ALL_TESTS - checkkeys - checkkeysthreads - controllermap - loopwave - loopwavequeue - testatomic - testaudiocapture - testaudiohotplug - testaudioinfo - testautomation - testbounds - testcustomcursor - testdisplayinfo - testdraw2 - testdrawchessboard - testdropfile - testerror - testfile - testfilesystem - testgamecontroller - testgeometry - testgesture - testgl2 - testgles - testgles2 - testguid - testhaptic - testhittesting - testhotplug - testiconv - testime - testintersections - testjoystick - testkeys - testloadso - testlocale - testlock - testmessage - testmouse - testmultiaudio - testoffscreen - testoverlay2 - testplatform - testpower - testqsort - testrelative - testrendercopyex - testrendertarget - testresample - testrumble - testscale - testsem - testsensor - testshader - testshape - testsprite2 - testspriteminimal - teststreaming - testsurround - testthread - testtimer - testurl - testver - testviewport - testvulkan - testwm2 - testyuv - torturethread -) - -set(NONINTERACTIVE - testatomic - testerror - testfilesystem - testguid - testlocale - testplatform - testpower - testqsort - testthread - testtimer - testver -) - -if(WINDOWS OR APPLE OR SDL_X11) - list(APPEND ALL_TESTS testnative) -endif() - -if(LINUX) - list(APPEND ALL_TESTS testevdev) - list(APPEND NONINTERACTIVE testevdev) -endif() - -if(SDL_DUMMYAUDIO) - set(NEEDS_AUDIO - testaudioinfo - testsurround - ) -endif() - -if(SDL_DUMMYVIDEO) - set(NEEDS_DISPLAY - testkeys - testbounds - testdisplayinfo - ) -endif() - if(OPENGL_FOUND) - target_link_libraries(testshader OpenGL::GL) - target_link_libraries(testgl2 OpenGL::GL) +add_dependencies(testshader OpenGL::GL) +add_dependencies(testgl2 OpenGL::GL) +target_link_libraries(testshader OpenGL::GL) +target_link_libraries(testgl2 OpenGL::GL) endif() file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt) file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -if(PSP OR PS2) +if(PSP) set(NEEDS_RESOURCES testscale testrendercopyex @@ -302,50 +177,48 @@ else() testaudiohotplug testmultiaudio testime + testnative testiconv testoverlay2 teststreaming testviewport ) - if(WINDOWS OR APPLE OR SDL_X11) - list(APPEND NEEDS_RESOURCES testnative) - endif() endif() if(PSP) # Build EBOOT files if building for PSP set(BUILD_EBOOT ${NEEDS_RESOURCES} - testatomic - testaudiocapture - testaudioinfo testbounds - testdisplayinfo - testdraw2 - testdrawchessboard - testerror - testfile - testfilesystem - testgeometry testgl2 - testguid - testhittesting - testiconv - testintersections - testjoystick - testlock - testmessage - testoverlay2 - testplatform - testpower - testqsort testsem + testdisplayinfo teststreaming - testsurround - testthread - testtimer - testver + testgeometry + testfile + testdraw2 testviewport + testhittesting + testoverlay2 + testver + testdrawchessboard + testsurround + testintersections + testmessage + testaudiocapture + testerror + testatomic + testjoystick + testiconv + testfilesystem + testplatform + testthread + testloadso + testqsort + testaudioinfo + testlock + testtimer + testpower testwm2 torturethread ) @@ -390,23 +263,9 @@ if(PSP) endforeach() endif() -if(RISCOS) - set(ALL_TESTS_AIF "") - foreach(APP IN LISTS ALL_TESTS) - target_link_options(${APP} PRIVATE -static) - add_custom_command( - OUTPUT ${APP},ff8 - COMMAND elf2aif ${APP} ${APP},ff8 - DEPENDS ${APP} - ) - add_custom_target(${APP}-aif ALL DEPENDS ${APP},ff8) - list(APPEND ALL_TESTS_AIF ${CMAKE_CURRENT_BINARY_DIR}/${APP},ff8) - endforeach() -endif() - foreach(APP IN LISTS NEEDS_RESOURCES) foreach(RESOURCE_FILE ${RESOURCE_FILES}) - if(PSP OR PS2) + if(PSP) add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $/sdl-${APP}) else() add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $) @@ -440,47 +299,3 @@ if(APPLE) endforeach() endif() endif() - -set(TESTS_ENVIRONMENT - SDL_AUDIODRIVER=dummy - SDL_VIDEODRIVER=dummy -) - -foreach(TESTCASE ${NONINTERACTIVE} ${NEEDS_AUDIO} ${NEEDS_DISPLAY}) - add_test( - NAME ${TESTCASE} - COMMAND ${TESTCASE} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - set_tests_properties( - ${TESTCASE} - PROPERTIES ENVIRONMENT "${TESTS_ENVIRONMENT}" - ) - if(SDL_INSTALL_TESTS) - set(exe ${TESTCASE}) - set(installedtestsdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/installed-tests/SDL2") - configure_file(template.test.in "${exe}.test" @ONLY) - install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/${exe}.test" - DESTINATION ${CMAKE_INSTALL_DATADIR}/installed-tests/SDL2 - ) - endif() -endforeach() - -if(SDL_INSTALL_TESTS) - if(RISCOS) - install( - FILES ${ALL_TESTS_AIF} - DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 - ) - else() - install( - TARGETS ${ALL_TESTS} - DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 - ) - endif() - install( - FILES ${RESOURCE_FILES} - DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 - ) -endif() diff --git a/externals/SDL/test/Makefile.in b/externals/SDL/test/Makefile.in index 2bcfa92b4..d29dc6ecf 100755 --- a/externals/SDL/test/Makefile.in +++ b/externals/SDL/test/Makefile.in @@ -2,15 +2,6 @@ srcdir = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -libexecdir = @libexecdir@ -includedir = @includedir@ -datarootdir = @datarootdir@ -datadir = @datadir@ - CC = @CC@ EXE = @EXE@ CFLAGS = @CFLAGS@ -g @@ -40,7 +31,6 @@ TARGETS = \ testgamecontroller$(EXE) \ testgeometry$(EXE) \ testgesture$(EXE) \ - testguid$(EXE) \ testhaptic$(EXE) \ testhittesting$(EXE) \ testhotplug$(EXE) \ @@ -89,26 +79,7 @@ TARGETS = \ @OPENGLES2_TARGETS@ += testgles2$(EXE) -all: Makefile $(TARGETS) copydatafiles generatetestmeta - -installedtestsdir = $(libexecdir)/installed-tests/SDL2 -installedtestsmetadir = $(datadir)/installed-tests/SDL2 - -generatetestmeta: - rm -f *.test - set -e; for exe in $(noninteractive) $(needs_audio) $(needs_display); do \ - sed \ - -e 's#@installedtestsdir@#$(installedtestsdir)#g' \ - -e "s#@exe@#$$exe#g" \ - < $(srcdir)/template.test.in > $$exe.test; \ - done - -install: all - install -d $(DESTDIR)$(installedtestsdir) - install $(TARGETS) $(DESTDIR)$(installedtestsdir) - install -m644 $(DATA) $(DESTDIR)$(installedtestsdir) - install -d $(DESTDIR)$(installedtestsmetadir) - install -m644 *.test $(DESTDIR)$(installedtestsmetadir) +all: Makefile $(TARGETS) copydatafiles Makefile: $(srcdir)/Makefile.in $(SHELL) config.status $@ @@ -119,10 +90,10 @@ checkkeys$(EXE): $(srcdir)/checkkeys.c checkkeysthreads$(EXE): $(srcdir)/checkkeysthreads.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -loopwave$(EXE): $(srcdir)/loopwave.c $(srcdir)/testutils.c +loopwave$(EXE): $(srcdir)/loopwave.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -loopwavequeue$(EXE): $(srcdir)/loopwavequeue.c $(srcdir)/testutils.c +loopwavequeue$(EXE): $(srcdir)/loopwavequeue.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testsurround$(EXE): $(srcdir)/testsurround.c @@ -152,14 +123,13 @@ testautomation$(EXE): $(srcdir)/testautomation.c \ $(srcdir)/testautomation_syswm.c \ $(srcdir)/testautomation_timer.c \ $(srcdir)/testautomation_video.c \ - $(srcdir)/testautomation_hints.c \ - $(srcdir)/testautomation_math.c + $(srcdir)/testautomation_hints.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c $(srcdir)/testutils.c +testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c $(srcdir)/testutils.c +testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testaudiocapture$(EXE): $(srcdir)/testaudiocapture.c @@ -195,15 +165,15 @@ testevdev$(EXE): $(srcdir)/testevdev.c testfile$(EXE): $(srcdir)/testfile.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testgamecontroller$(EXE): $(srcdir)/testgamecontroller.c $(srcdir)/testutils.c +testgamecontroller$(EXE): $(srcdir)/testgamecontroller.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testgeometry$(EXE): $(srcdir)/testgeometry.c $(srcdir)/testutils.c +testgeometry$(EXE): $(srcdir)/testgeometry.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testgesture$(EXE): $(srcdir)/testgesture.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ - + testgl2$(EXE): $(srcdir)/testgl2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ @@ -213,12 +183,9 @@ testgles$(EXE): $(srcdir)/testgles.c testgles2$(EXE): $(srcdir)/testgles2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ -testgles2_sdf$(EXE): $(srcdir)/testgles2_sdf.c $(srcdir)/testutils.c +testgles2_sdf$(EXE): $(srcdir)/testgles2_sdf.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ -testguid$(EXE): $(srcdir)/testguid.c - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - testhaptic$(EXE): $(srcdir)/testhaptic.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @@ -231,10 +198,10 @@ testrumble$(EXE): $(srcdir)/testrumble.c testthread$(EXE): $(srcdir)/testthread.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testiconv$(EXE): $(srcdir)/testiconv.c $(srcdir)/testutils.c +testiconv$(EXE): $(srcdir)/testiconv.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testime$(EXE): $(srcdir)/testime.c $(srcdir)/testutils.c +testime$(EXE): $(srcdir)/testime.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @SDL_TTF_LIB@ testjoystick$(EXE): $(srcdir)/testjoystick.c @@ -252,21 +219,18 @@ testlock$(EXE): $(srcdir)/testlock.c ifeq (@ISMACOSX@,true) testnative$(EXE): $(srcdir)/testnative.c \ $(srcdir)/testnativecocoa.m \ - $(srcdir)/testutils.c \ $(srcdir)/testnativex11.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -framework Cocoa @XLIB@ endif ifeq (@ISWINDOWS@,true) testnative$(EXE): $(srcdir)/testnative.c \ - $(srcdir)/testutils.c \ $(srcdir)/testnativew32.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) endif ifeq (@ISUNIX@,true) testnative$(EXE): $(srcdir)/testnative.c \ - $(srcdir)/testutils.c \ $(srcdir)/testnativex11.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @XLIB@ endif @@ -288,7 +252,7 @@ endif endif endif -testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(srcdir)/testutils.c +testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testplatform$(EXE): $(srcdir)/testplatform.c @@ -300,10 +264,10 @@ testpower$(EXE): $(srcdir)/testpower.c testfilesystem$(EXE): $(srcdir)/testfilesystem.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testrendertarget$(EXE): $(srcdir)/testrendertarget.c $(srcdir)/testutils.c +testrendertarget$(EXE): $(srcdir)/testrendertarget.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testscale$(EXE): $(srcdir)/testscale.c $(srcdir)/testutils.c +testscale$(EXE): $(srcdir)/testscale.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testsem$(EXE): $(srcdir)/testsem.c @@ -318,13 +282,13 @@ testshader$(EXE): $(srcdir)/testshader.c testshape$(EXE): $(srcdir)/testshape.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testsprite2$(EXE): $(srcdir)/testsprite2.c $(srcdir)/testutils.c +testsprite2$(EXE): $(srcdir)/testsprite2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c $(srcdir)/testutils.c +testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ -teststreaming$(EXE): $(srcdir)/teststreaming.c $(srcdir)/testutils.c +teststreaming$(EXE): $(srcdir)/teststreaming.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ testtimer$(EXE): $(srcdir)/testtimer.c @@ -336,7 +300,7 @@ testurl$(EXE): $(srcdir)/testurl.c testver$(EXE): $(srcdir)/testver.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testviewport$(EXE): $(srcdir)/testviewport.c $(srcdir)/testutils.c +testviewport$(EXE): $(srcdir)/testviewport.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testwm2$(EXE): $(srcdir)/testwm2.c @@ -348,7 +312,7 @@ testyuv$(EXE): $(srcdir)/testyuv.c $(srcdir)/testyuv_cvt.c torturethread$(EXE): $(srcdir)/torturethread.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c $(srcdir)/testutils.c +testrendercopyex$(EXE): $(srcdir)/testrendercopyex.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ testmessage$(EXE): $(srcdir)/testmessage.c @@ -366,7 +330,7 @@ testbounds$(EXE): $(srcdir)/testbounds.c testcustomcursor$(EXE): $(srcdir)/testcustomcursor.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) -controllermap$(EXE): $(srcdir)/controllermap.c $(srcdir)/testutils.c +controllermap$(EXE): $(srcdir)/controllermap.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testvulkan$(EXE): $(srcdir)/testvulkan.c @@ -380,56 +344,13 @@ testmouse$(EXE): $(srcdir)/testmouse.c clean: - rm -f $(TARGETS) *.test + rm -f $(TARGETS) distclean: clean rm -f Makefile rm -f config.status config.cache config.log rm -rf $(srcdir)/autom4te* -noninteractive = \ - testatomic$(EXE) \ - testerror$(EXE) \ - testevdev$(EXE) \ - testfilesystem$(EXE) \ - testkeys$(EXE) \ - testlocale$(EXE) \ - testplatform$(EXE) \ - testpower$(EXE) \ - testqsort$(EXE) \ - testthread$(EXE) \ - testtimer$(EXE) \ - testver$(EXE) \ - $(NULL) - -needs_audio = \ - testaudioinfo$(EXE) \ - testsurround$(EXE) \ - $(NULL) - -needs_display = \ - testbounds$(EXE) \ - testdisplayinfo$(EXE) \ - $(NULL) - -TESTS = $(noninteractive) $(needs_audio) $(needs_display) - -check: - @set -e; \ - status=0; \ - export SDL_AUDIODRIVER=dummy; \ - export SDL_VIDEODRIVER=dummy; \ - for exe in $(TESTS); do \ - echo "$$exe..."; \ - if ./"$$exe"; then \ - echo "$$exe: OK"; \ - else \ - echo "$$exe: FAILED: $$?"; \ - status=1; \ - fi; \ - done; \ - exit "$$status" - DATA = \ axis.bmp \ button.bmp \ @@ -443,7 +364,6 @@ DATA = \ testgles2_sdf_img_sdf.bmp \ testyuv.bmp \ unifont-13.0.06.hex \ - utf8.txt \ $(NULL) ifneq ($(srcdir), .) diff --git a/externals/SDL/test/Makefile.os2 b/externals/SDL/test/Makefile.os2 index 75aaeedfd..e238af4be 100755 --- a/externals/SDL/test/Makefile.os2 +++ b/externals/SDL/test/Makefile.os2 @@ -1,13 +1,77 @@ # Open Watcom makefile to build SDL2 tests for OS/2 # wmake -f Makefile.os2 -SYSTEM = os2v2 +INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" -I"../include" -INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" - -CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei +CFLAGS = $(INCPATH) -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei CFLAGS+= -wx -wcd=303 -TNSRCS = testnative.c testnativeos2.c +LIBPATH = .. +LIBS = SDL2.lib SDL2test.lib -!include watcom.mif +#CFLAGS+= -DHAVE_SDL_TTF +#TTFLIBS = SDL2ttf.lib + +TARGETS = testatomic.exe testdisplayinfo.exe testbounds.exe testdraw2.exe & + testdrawchessboard.exe testdropfile.exe testerror.exe testfile.exe & + testfilesystem.exe testgamecontroller.exe testgeometry.exe testgesture.exe & + testhittesting.exe testhotplug.exe testiconv.exe testime.exe testlocale.exe & + testintersections.exe testjoystick.exe testkeys.exe testloadso.exe & + testlock.exe testmessage.exe testoverlay2.exe testplatform.exe & + testpower.exe testsensor.exe testrelative.exe testrendercopyex.exe & + testrendertarget.exe testrumble.exe testscale.exe testsem.exe & + testshader.exe testshape.exe testsprite2.exe testspriteminimal.exe & + teststreaming.exe testthread.exe testtimer.exe testver.exe & + testviewport.exe testwm2.exe torturethread.exe checkkeys.exe & + checkkeysthreads.exe testmouse.exe & + controllermap.exe testhaptic.exe testqsort.exe testresample.exe & + testaudioinfo.exe testaudiocapture.exe loopwave.exe loopwavequeue.exe & + testsurround.exe testyuv.exe testgl2.exe testvulkan.exe testnative.exe & + testautomation.exe + +# testautomation sources +TASRCS = testautomation.c testautomation_audio.c testautomation_clipboard.c & + testautomation_events.c testautomation_hints.c & + testautomation_keyboard.c testautomation_main.c & + testautomation_mouse.c testautomation_pixels.c & + testautomation_platform.c testautomation_rect.c & + testautomation_render.c testautomation_rwops.c & + testautomation_sdltest.c testautomation_stdlib.c & + testautomation_surface.c testautomation_syswm.c & + testautomation_timer.c testautomation_video.c + +OBJS = $(TARGETS:.exe=.obj) +COBJS = $(CSRCS:.c=.obj) +TAOBJS = $(TASRCS:.c=.obj) + +all: $(TARGETS) + +.c: ../src/test + +.obj.exe: + wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +.c.obj: + wcc386 $(CFLAGS) -fo=$^@ $< + +# specials +testautomation.exe: $(TAOBJS) + wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +testnative.exe: testnative.obj testnativeos2.obj + wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +testoverlay2.exe: testoverlay2.obj testyuv_cvt.obj + wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +testyuv.exe: testyuv.obj testyuv_cvt.obj + wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ + +testime.exe: testime.obj + wlink SYS os2v2 libpath $(LIBPATH) lib {$(LIBS) $(TTFLIBS)} op q op el file {$<} name $@ + +clean: .SYMBOLIC + @if exist *.obj rm *.obj + @if exist *.err rm *.err +distclean: .SYMBOLIC clean + @if exist *.exe rm *.exe diff --git a/externals/SDL/test/autogen.sh b/externals/SDL/test/autogen.sh index f1716a597..988d41760 100755 --- a/externals/SDL/test/autogen.sh +++ b/externals/SDL/test/autogen.sh @@ -1,9 +1,11 @@ #!/bin/sh -set -e - cp acinclude.m4 aclocal.m4 -"${AUTOCONF:-autoconf}" +if test "$AUTOCONF"x = x; then + AUTOCONF=autoconf +fi + +$AUTOCONF || exit 1 rm aclocal.m4 rm -rf autom4te.cache diff --git a/externals/SDL/test/checkkeys.c b/externals/SDL/test/checkkeys.c index 74bd7953c..caec4b955 100755 --- a/externals/SDL/test/checkkeys.c +++ b/externals/SDL/test/checkkeys.c @@ -165,11 +165,7 @@ loop() PrintKey(&event.key.keysym, (event.key.state == SDL_PRESSED) ? SDL_TRUE : SDL_FALSE, (event.key.repeat) ? SDL_TRUE : SDL_FALSE); break; case SDL_TEXTEDITING: - PrintText("EDIT", event.edit.text); - break; - case SDL_TEXTEDITING_EXT: - PrintText("EDIT_EXT", event.editExt.text); - SDL_free(event.editExt.text); + PrintText("EDIT", event.text.text); break; case SDL_TEXTINPUT: PrintText("INPUT", event.text.text); @@ -211,9 +207,6 @@ main(int argc, char *argv[]) /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - /* Enable extended text editing events */ - SDL_SetHint(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, "1"); - /* Initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); diff --git a/externals/SDL/test/configure b/externals/SDL/test/configure index b598ebe08..60344e3ec 100755 --- a/externals/SDL/test/configure +++ b/externals/SDL/test/configure @@ -1,10 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71. +# Generated by GNU Autoconf 2.69. # # -# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, -# Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -15,16 +14,14 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop +else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -34,46 +31,46 @@ esac fi - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi # The user is always right. -if ${PATH_SEPARATOR+false} :; then +if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -82,6 +79,13 @@ if ${PATH_SEPARATOR+false} :; then fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -90,12 +94,8 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS @@ -107,10 +107,30 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -132,22 +152,20 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="as_nop=: -if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else \$as_nop +else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -167,52 +185,41 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ) -then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : -else \$as_nop +else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 -blah=\$(echo \$(echo blah)) -test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" - if (eval "$as_required") 2>/dev/null -then : + if (eval "$as_required") 2>/dev/null; then : as_have_required=yes -else $as_nop +else as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null -then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : -else $as_nop +else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir$as_base + as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes - if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null -then : + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi @@ -220,21 +227,14 @@ fi esac as_found=false done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes -fi -fi +fi; } +IFS=$as_save_IFS - if test "x$CONFIG_SHELL" != x -then : + if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -252,19 +252,18 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno -then : - printf "%s\n" "$0: This script requires a shell more modern than all" - printf "%s\n" "$0: the shells that I found on your system." - if test ${ZSH_VERSION+y} ; then - printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" - printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." @@ -291,7 +290,6 @@ as_fn_unset () } as_unset=as_fn_unset - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -309,14 +307,6 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -331,7 +321,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -340,7 +330,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | +$as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -379,13 +369,12 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' -else $as_nop +else as_fn_append () { eval $1=\$$1\$2 @@ -397,27 +386,18 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else $as_nop +else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -429,9 +409,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - printf "%s\n" "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -458,7 +438,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -502,7 +482,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -516,10 +496,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -533,13 +509,6 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -605,12 +574,12 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='' -PACKAGE_TARNAME='' -PACKAGE_VERSION='' -PACKAGE_STRING='' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= ac_unique_file="loopwave.c" ac_subst_vars='LTLIBOBJS @@ -674,7 +643,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -757,7 +725,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -787,6 +754,8 @@ do *) ac_optarg=yes ;; esac + # Accept the important Cygnus configure options, so we can diagnose typos. + case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -827,9 +796,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -853,9 +822,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1008,15 +977,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1066,9 +1026,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1082,9 +1042,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: \`$ac_useropt'" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1128,9 +1088,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1146,7 +1106,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1154,7 +1114,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1210,7 +1170,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_myself" | +$as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1307,7 +1267,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1393,9 +1352,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1423,8 +1382,7 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for configure.gnu first; this name is used for a wrapper for - # Metaconfig's "Configure" on case-insensitive file systems. + # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1432,7 +1390,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1442,9 +1400,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.71 +generated by GNU Autoconf 2.69 -Copyright (C) 2021 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1461,14 +1419,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam + rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1476,15 +1434,14 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext -then : + } && test -s conftest.$ac_objext; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1500,14 +1457,14 @@ fi ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1515,18 +1472,17 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - } -then : + }; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1543,8 +1499,8 @@ fi # ac_fn_c_try_run LINENO # ---------------------- -# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that -# executables *can* be run. +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack @@ -1554,26 +1510,25 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: program exited with status $ac_status" >&5 - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status @@ -1596,7 +1551,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1604,15 +1559,14 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - } -then : + }; then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1621,34 +1575,14 @@ fi as_fn_set_status $ac_retval } # ac_fn_c_try_cpp -ac_configure_args_raw= -for ac_arg -do - case $ac_arg in - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_configure_args_raw " '$ac_arg'" -done - -case $ac_configure_args_raw in - *$as_nl*) - ac_safe_unquote= ;; - *) - ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. - ac_unsafe_a="$ac_unsafe_z#~" - ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" - ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; -esac - cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.71. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was - $ $0$ac_configure_args_raw + $ $0 $@ _ACEOF exec 5>>config.log @@ -1681,12 +1615,8 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - printf "%s\n" "PATH: $as_dir" + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" done IFS=$as_save_IFS @@ -1721,7 +1651,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -1756,13 +1686,11 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? - # Sanitize IFS. - IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - printf "%s\n" "## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -1773,8 +1701,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -1798,7 +1726,7 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ) echo - printf "%s\n" "## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -1806,14 +1734,14 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - printf "%s\n" "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - printf "%s\n" "## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -1821,15 +1749,15 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - printf "%s\n" "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - printf "%s\n" "## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -1837,8 +1765,8 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} echo fi test "$ac_signal" != 0 && - printf "%s\n" "$as_me: caught signal $ac_signal" - printf "%s\n" "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -1852,48 +1780,63 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -printf "%s\n" "/* confdefs.h */" > confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF -printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF -printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF -printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF -printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF -printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_files="$CONFIG_SITE" + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then - ac_site_files="$prefix/share/config.site $prefix/etc/config.site" + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site else - ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi - -for ac_site_file in $ac_site_files +for ac_site_file in "$ac_site_file1" "$ac_site_file2" do - case $ac_site_file in #( - */*) : - ;; #( - *) : - ac_site_file=./$ac_site_file ;; -esac - if test -f "$ac_site_file" && test -r "$ac_site_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -1903,425 +1846,19 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Test code for whether the C compiler supports C89 (global declarations) -ac_c_conftest_c89_globals=' -/* Does the compiler advertise C89 conformance? - Do not test the value of __STDC__, because some compilers set it to 0 - while being otherwise adequately conformant. */ -#if !defined __STDC__ -# error "Compiler does not advertise C89 conformance" -#endif - -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ -struct buf { int x; }; -struct buf * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not \xHH hex character constants. - These do not provoke an error unfortunately, instead are silently treated - as an "x". The following induces an error, until -std is added to get - proper ANSI mode. Curiously \x00 != x always comes out true, for an - array size at least. It is necessary to write \x00 == 0 to get something - that is true only with -std. */ -int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) '\''x'\'' -int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), - int, int);' - -# Test code for whether the C compiler supports C89 (body of main). -ac_c_conftest_c89_main=' -ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); -' - -# Test code for whether the C compiler supports C99 (global declarations) -ac_c_conftest_c99_globals=' -// Does the compiler advertise C99 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L -# error "Compiler does not advertise C99 conformance" -#endif - -#include -extern int puts (const char *); -extern int printf (const char *, ...); -extern int dprintf (int, const char *, ...); -extern void *malloc (size_t); - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -// dprintf is used instead of fprintf to avoid needing to declare -// FILE and stderr. -#define debug(...) dprintf (2, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - #error "your preprocessor is broken" -#endif -#if BIG_OK -#else - #error "your preprocessor is broken" -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static bool -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str = ""; - int number = 0; - float fnumber = 0; - - while (*format) - { - switch (*format++) - { - case '\''s'\'': // string - str = va_arg (args_copy, const char *); - break; - case '\''d'\'': // int - number = va_arg (args_copy, int); - break; - case '\''f'\'': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); - - return *str && number && fnumber; -} -' - -# Test code for whether the C compiler supports C99 (body of main). -ac_c_conftest_c99_main=' - // Check bool. - _Bool success = false; - success |= (argc != 0); - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[0] = argv[0][0]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' - || dynamic_array[ni.number - 1] != 543); -' - -# Test code for whether the C compiler supports C11 (global declarations) -ac_c_conftest_c11_globals=' -// Does the compiler advertise C11 conformance? -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L -# error "Compiler does not advertise C11 conformance" -#endif - -// Check _Alignas. -char _Alignas (double) aligned_as_double; -char _Alignas (0) no_special_alignment; -extern char aligned_as_int; -char _Alignas (0) _Alignas (int) aligned_as_int; - -// Check _Alignof. -enum -{ - int_alignment = _Alignof (int), - int_array_alignment = _Alignof (int[100]), - char_alignment = _Alignof (char) -}; -_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); - -// Check _Noreturn. -int _Noreturn does_not_return (void) { for (;;) continue; } - -// Check _Static_assert. -struct test_static_assert -{ - int x; - _Static_assert (sizeof (int) <= sizeof (long int), - "_Static_assert does not work in struct"); - long int y; -}; - -// Check UTF-8 literals. -#define u8 syntax error! -char const utf8_literal[] = u8"happens to be ASCII" "another string"; - -// Check duplicate typedefs. -typedef long *long_ptr; -typedef long int *long_ptr; -typedef long_ptr long_ptr; - -// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. -struct anonymous -{ - union { - struct { int i; int j; }; - struct { int k; long int l; } w; - }; - int m; -} v1; -' - -# Test code for whether the C compiler supports C11 (body of main). -ac_c_conftest_c11_main=' - _Static_assert ((offsetof (struct anonymous, i) - == offsetof (struct anonymous, w.k)), - "Anonymous union alignment botch"); - v1.i = 2; - v1.w.k = 5; - ok |= v1.i != 5; -' - -# Test code for whether the C compiler supports C11 (complete). -ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} -${ac_c_conftest_c11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - ${ac_c_conftest_c11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C99 (complete). -ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - return ok; -} -" - -# Test code for whether the C compiler supports C89 (complete). -ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - return ok; -} -" - - -# Auxiliary files required by this configure script. -ac_aux_files="config.guess config.sub" - -# Locations in which to look for auxiliary files. -ac_aux_dir_candidates="${srcdir}/../build-scripts" - -# Search for a directory containing all of the required auxiliary files, -# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. -# If we don't find one directory that contains all the files we need, -# we report the set of missing files from the *first* directory in -# $ac_aux_dir_candidates and give up. -ac_missing_aux_files="" -ac_first_candidate=: -printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in $ac_aux_dir_candidates -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - - printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 - ac_aux_dir_found=yes - ac_install_sh= - for ac_aux in $ac_aux_files - do - # As a special case, if "install-sh" is required, that requirement - # can be satisfied by any of "install-sh", "install.sh", or "shtool", - # and $ac_install_sh is set appropriately for whichever one is found. - if test x"$ac_aux" = x"install-sh" - then - if test -f "${as_dir}install-sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 - ac_install_sh="${as_dir}install-sh -c" - elif test -f "${as_dir}install.sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 - ac_install_sh="${as_dir}install.sh -c" - elif test -f "${as_dir}shtool"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 - ac_install_sh="${as_dir}shtool install -c" - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} install-sh" - else - break - fi - fi - else - if test -f "${as_dir}${ac_aux}"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" - else - break - fi - fi - fi - done - if test "$ac_aux_dir_found" = yes; then - ac_aux_dir="$as_dir" - break - fi - ac_first_candidate=false - - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else $as_nop - as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 -fi - - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -if test -f "${ac_aux_dir}config.guess"; then - ac_config_guess="$SHELL ${ac_aux_dir}config.guess" -fi -if test -f "${ac_aux_dir}config.sub"; then - ac_config_sub="$SHELL ${ac_aux_dir}config.sub" -fi -if test -f "$ac_aux_dir/configure"; then - ac_configure="$SHELL ${ac_aux_dir}configure" -fi - # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2332,12 +1869,12 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -2346,24 +1883,24 @@ printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -2373,12 +1910,11 @@ printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' - and start over" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2393,31 +1929,55 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_aux_dir= +for ac_dir in ../build-scripts "$srcdir"/../build-scripts; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in ../build-scripts \"$srcdir\"/../build-scripts" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - - # Make sure we can run config.sub. -$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -printf %s "checking build system type... " >&6; } -if test ${ac_cv_build+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_build_alias=$build_alias test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -printf "%s\n" "$ac_cv_build" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; @@ -2436,22 +1996,21 @@ IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -printf %s "checking host system type... " >&6; } -if test ${ac_cv_host+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -printf "%s\n" "$ac_cv_host" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -2471,15 +2030,6 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - - - - - - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2488,12 +2038,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2501,15 +2050,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2520,11 +2065,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2533,12 +2078,11 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2546,15 +2090,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2565,11 +2105,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2577,8 +2117,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2591,12 +2131,11 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2604,15 +2143,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2623,11 +2158,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2636,12 +2171,11 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2650,19 +2184,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2678,18 +2208,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2700,12 +2230,11 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2713,15 +2242,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2732,11 +2257,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2749,12 +2274,11 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2762,15 +2286,11 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2781,11 +2301,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2797,8 +2317,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2806,129 +2326,25 @@ esac fi fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -fi - - -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do +for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2938,7 +2354,7 @@ printf "%s\n" "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -2946,7 +2362,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; @@ -2958,9 +2374,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -printf %s "checking whether the C compiler works... " >&6; } -ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -2981,12 +2397,11 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -3003,7 +2418,7 @@ do # certainly right. break;; *.* ) - if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -3019,46 +2434,44 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else $as_nop +else ac_file='' fi -if test -z "$ac_file" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -printf "%s\n" "$as_me: failed program was:" >&5 +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -printf %s "checking for C compiler default output file name... " >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -printf "%s\n" "$ac_file" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -printf %s "checking for suffix of executables... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3072,15 +2485,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -printf "%s\n" "$ac_cv_exeext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -3089,7 +2502,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -3101,8 +2514,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -printf %s "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -3110,10 +2523,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -3121,40 +2534,39 @@ printf "%s\n" "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot run C compiled programs. + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -printf "%s\n" "$cross_compiling" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -printf %s "checking for suffix of object files... " >&6; } -if test ${ac_cv_objext+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; @@ -3168,12 +2580,11 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3182,32 +2593,31 @@ then : break;; esac done -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -printf "%s\n" "$ac_cv_objext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -3217,33 +2627,29 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes -else $as_nop +else ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+y} +ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -printf %s "checking whether $CC accepts -g... " >&6; } -if test ${ac_cv_prog_cc_g+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3252,60 +2658,57 @@ else $as_nop /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes -else $as_nop +else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : -else $as_nop +else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3320,144 +2723,94 @@ else CFLAGS= fi fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -printf %s "checking for $CC option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c11=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC -fi - -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c99" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -printf %s "checking for $CC option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_c_conftest_c89_program +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext conftest.beam +rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC -fi -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c89" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + fi ac_ext=c @@ -3468,17 +2821,16 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -printf %s "checking for an ANSI C-conforming const... " >&6; } -if test ${ac_cv_c_const+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { #ifndef __cplusplus @@ -3491,7 +2843,7 @@ main (void) /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; - /* IBM XL C 1.02.0.0 rejects this. + /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ @@ -3519,7 +2871,7 @@ main (void) iptr p = 0; ++p; } - { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; @@ -3535,19 +2887,18 @@ main (void) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes -else $as_nop +else ac_cv_c_const=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -printf "%s\n" "$ac_cv_c_const" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -printf "%s\n" "#define const /**/" >>confdefs.h +$as_echo "#define const /**/" >>confdefs.h fi @@ -3588,12 +2939,11 @@ case "$host" in MATHLIB="" # Extract the first word of "osmesa-config", so it can be a program name with args. set dummy osmesa-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_OSMESA_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_OSMESA_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else case $OSMESA_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_OSMESA_CONFIG="$OSMESA_CONFIG" # Let the user override the test with a path. @@ -3603,15 +2953,11 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_OSMESA_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_OSMESA_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3624,11 +2970,11 @@ esac fi OSMESA_CONFIG=$ac_cv_path_OSMESA_CONFIG if test -n "$OSMESA_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OSMESA_CONFIG" >&5 -printf "%s\n" "$OSMESA_CONFIG" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OSMESA_CONFIG" >&5 +$as_echo "$OSMESA_CONFIG" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3666,12 +3012,11 @@ fi ISUNIX="true" EXE="" MATHLIB="-lm" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for glBegin in -lOpenGL" >&5 -printf %s "checking for glBegin in -lOpenGL... " >&6; } -if test ${ac_cv_lib_OpenGL_glBegin+y} -then : - printf %s "(cached) " >&6 -else $as_nop + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBegin in -lOpenGL" >&5 +$as_echo_n "checking for glBegin in -lOpenGL... " >&6; } +if ${ac_cv_lib_OpenGL_glBegin+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lOpenGL $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3680,31 +3025,32 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char glBegin (); int -main (void) +main () { return glBegin (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_OpenGL_glBegin=yes -else $as_nop +else ac_cv_lib_OpenGL_glBegin=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_OpenGL_glBegin" >&5 -printf "%s\n" "$ac_cv_lib_OpenGL_glBegin" >&6; } -if test "x$ac_cv_lib_OpenGL_glBegin" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_OpenGL_glBegin" >&5 +$as_echo "$ac_cv_lib_OpenGL_glBegin" >&6; } +if test "x$ac_cv_lib_OpenGL_glBegin" = xyes; then : SYS_GL_LIBS="-lOpenGL" -else $as_nop +else SYS_GL_LIBS="-lGL" fi @@ -3728,12 +3074,11 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. @@ -3743,15 +3088,11 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3763,11 +3104,11 @@ esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -printf "%s\n" "$PKG_CONFIG" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3776,12 +3117,11 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. @@ -3791,15 +3131,11 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3811,11 +3147,11 @@ esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then @@ -3823,8 +3159,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG @@ -3836,40 +3172,37 @@ fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } PKG_CONFIG="" fi fi # Check whether --with-sdl-prefix was given. -if test ${with_sdl_prefix+y} -then : +if test "${with_sdl_prefix+set}" = set; then : withval=$with_sdl_prefix; sdl_prefix="$withval" -else $as_nop +else sdl_prefix="" fi # Check whether --with-sdl-exec-prefix was given. -if test ${with_sdl_exec_prefix+y} -then : +if test "${with_sdl_exec_prefix+set}" = set; then : withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" -else $as_nop +else sdl_exec_prefix="" fi # Check whether --enable-sdltest was given. -if test ${enable_sdltest+y} -then : +if test "${enable_sdltest+set}" = set; then : enableval=$enable_sdltest; -else $as_nop +else enable_sdltest=yes fi @@ -3879,17 +3212,17 @@ fi if test "x$sdl_prefix$sdl_exec_prefix" = x ; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5 -printf %s "checking for sdl2 >= $min_sdl_version... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5 +$as_echo_n "checking for sdl2 >= $min_sdl_version... " >&6; } if test -n "$SDL_CFLAGS"; then pkg_cv_SDL_CFLAGS="$SDL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null` else @@ -3902,10 +3235,10 @@ if test -n "$SDL_LIBS"; then pkg_cv_SDL_LIBS="$SDL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5 ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null` else @@ -3918,8 +3251,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -3936,14 +3269,14 @@ fi sdl_pc=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } sdl_pc=no else SDL_CFLAGS=$pkg_cv_SDL_CFLAGS SDL_LIBS=$pkg_cv_SDL_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } sdl_pc=yes fi else @@ -3972,12 +3305,11 @@ fi fi # Extract the first word of "sdl2-config", so it can be a program name with args. set dummy sdl2-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_SDL2_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_SDL2_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else case $SDL2_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path. @@ -3987,15 +3319,11 @@ else $as_nop for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac + test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_SDL2_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SDL2_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4008,17 +3336,17 @@ esac fi SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG if test -n "$SDL2_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5 -printf "%s\n" "$SDL2_CONFIG" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5 +$as_echo "$SDL2_CONFIG" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi PATH="$as_save_PATH" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5 -printf %s "checking for SDL - version >= $min_sdl_version... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5 +$as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; } no_sdl="" if test "$SDL2_CONFIG" = "no" ; then @@ -4041,10 +3369,9 @@ printf %s "checking for SDL - version >= $min_sdl_version... " >&6; } CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" rm -f conf.sdltest - if test "$cross_compiling" = yes -then : + if test "$cross_compiling" = yes; then : echo $ac_n "cross compiling; assumed OK... $ac_c" -else $as_nop +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4084,10 +3411,9 @@ int main (int argc, char *argv[]) _ACEOF -if ac_fn_c_try_run "$LINENO" -then : +if ac_fn_c_try_run "$LINENO"; then : -else $as_nop +else no_sdl=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4100,11 +3426,11 @@ fi fi fi if test "x$no_sdl" = x ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi fi if test "x$no_sdl" = x ; then @@ -4135,15 +3461,14 @@ int main(int argc, char *argv[]) #define main K_and_R_C_main int -main (void) +main () { return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" @@ -4153,13 +3478,13 @@ then : echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else $as_nop +else echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" @@ -4183,36 +3508,40 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -printf %s "checking how to run the C preprocessor... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test ${ac_cv_prog_CPP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CC needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#ifdef __STDC__ +# include +#else +# include +#endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : -else $as_nop +else # Broken: fails on valid input. continue fi @@ -4224,11 +3553,10 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue -else $as_nop +else # Passes both tests. ac_preproc_ok=: break @@ -4238,8 +3566,7 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : +if $ac_preproc_ok; then : break fi @@ -4251,24 +3578,29 @@ fi else ac_cv_prog_CPP=$CPP fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -printf "%s\n" "$CPP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#ifdef __STDC__ +# include +#else +# include +#endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : -else $as_nop +else # Broken: fails on valid input. continue fi @@ -4280,11 +3612,10 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue -else $as_nop +else # Passes both tests. ac_preproc_ok=: break @@ -4294,12 +3625,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : +if $ac_preproc_ok; then : -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi @@ -4311,13 +3641,12 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X" >&5 -printf %s "checking for X... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +$as_echo_n "checking for X... " >&6; } # Check whether --with-x was given. -if test ${with_x+y} -then : +if test "${with_x+set}" = set; then : withval=$with_x; fi @@ -4328,10 +3657,9 @@ if test "x$with_x" = xno; then else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( - *,NONE | NONE,*) if test ${ac_cv_have_x+y} -then : - printf %s "(cached) " >&6 -else $as_nop + *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : + $as_echo_n "(cached) " >&6 +else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no @@ -4342,26 +3670,24 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : # We can compile and link X programs with no special options. ac_x_includes= ac_x_libraries= fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_save_LIBS" -# If that didn't work, only try xmkmf and file system searches +# If that didn't work, only try xmkmf and filesystem searches # for native compilation. -if test x"$ac_x_includes" = xno && test "$cross_compiling" = no -then : +if test x"$ac_x_includes" = xno && test "$cross_compiling" = no; then : rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir @@ -4451,11 +3777,10 @@ if test "$ac_x_includes" = no; then /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : +if ac_fn_c_try_cpp "$LINENO"; then : # We can compile using X headers with no special include directory. ac_x_includes= -else $as_nop +else for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir @@ -4476,21 +3801,20 @@ if test "$ac_x_libraries" = no; then /* end confdefs.h. */ #include int -main (void) +main () { XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= -else $as_nop +else LIBS=$ac_save_LIBS -for ac_dir in `printf "%s\n" "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do @@ -4501,7 +3825,7 @@ do done done fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no @@ -4525,8 +3849,8 @@ fi fi # $with_x != no if test "$have_x" != yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 -printf "%s\n" "$have_x" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +$as_echo "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. @@ -4536,8 +3860,8 @@ else ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 -printf "%s\n" "libraries $x_libraries, headers $x_includes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +$as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi if test x$have_x = xyes; then @@ -4559,8 +3883,8 @@ if test x$have_x = xyes; then fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL support" >&5 -printf %s "checking for OpenGL support... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL support" >&5 +$as_echo_n "checking for OpenGL support... " >&6; } have_opengl=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4571,23 +3895,22 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_opengl=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_opengl" >&5 -printf "%s\n" "$have_opengl" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengl" >&5 +$as_echo "$have_opengl" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES support" >&5 -printf %s "checking for OpenGL ES support... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES support" >&5 +$as_echo_n "checking for OpenGL ES support... " >&6; } have_opengles=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4598,23 +3921,22 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_opengles=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_opengles" >&5 -printf "%s\n" "$have_opengles" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles" >&5 +$as_echo "$have_opengles" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES2 support" >&5 -printf %s "checking for OpenGL ES2 support... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES2 support" >&5 +$as_echo_n "checking for OpenGL ES2 support... " >&6; } have_opengles2=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4625,20 +3947,19 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #endif int -main (void) +main () { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" -then : +if ac_fn_c_try_compile "$LINENO"; then : have_opengles2=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_opengles2" >&5 -printf "%s\n" "$have_opengles2" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles2" >&5 +$as_echo "$have_opengles2" >&6; } GLLIB="" GLESLIB="" @@ -4670,12 +3991,11 @@ fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5 -printf %s "checking for TTF_Init in -lSDL2_ttf... " >&6; } -if test ${ac_cv_lib_SDL2_ttf_TTF_Init+y} -then : - printf %s "(cached) " >&6 -else $as_nop +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5 +$as_echo_n "checking for TTF_Init in -lSDL2_ttf... " >&6; } +if ${ac_cv_lib_SDL2_ttf_TTF_Init+:} false; then : + $as_echo_n "(cached) " >&6 +else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL2_ttf $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4684,29 +4004,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif char TTF_Init (); int -main (void) +main () { return TTF_Init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" -then : +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_SDL2_ttf_TTF_Init=yes -else $as_nop +else ac_cv_lib_SDL2_ttf_TTF_Init=no fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ +rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL2_ttf_TTF_Init" >&5 -printf "%s\n" "$ac_cv_lib_SDL2_ttf_TTF_Init" >&6; } -if test "x$ac_cv_lib_SDL2_ttf_TTF_Init" = xyes -then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL2_ttf_TTF_Init" >&5 +$as_echo "$ac_cv_lib_SDL2_ttf_TTF_Init" >&6; } +if test "x$ac_cv_lib_SDL2_ttf_TTF_Init" = xyes; then : have_SDL_ttf=yes fi @@ -4718,17 +4039,17 @@ fi pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libunwind" >&5 -printf %s "checking for libunwind... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libunwind" >&5 +$as_echo_n "checking for libunwind... " >&6; } if test -n "$LIBUNWIND_CFLAGS"; then pkg_cv_LIBUNWIND_CFLAGS="$LIBUNWIND_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUNWIND_CFLAGS=`$PKG_CONFIG --cflags "libunwind" 2>/dev/null` else @@ -4741,10 +4062,10 @@ if test -n "$LIBUNWIND_LIBS"; then pkg_cv_LIBUNWIND_LIBS="$LIBUNWIND_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUNWIND_LIBS=`$PKG_CONFIG --libs "libunwind" 2>/dev/null` else @@ -4757,8 +4078,8 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -4775,14 +4096,14 @@ fi have_libunwind=no elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } have_libunwind=no else LIBUNWIND_CFLAGS=$pkg_cv_LIBUNWIND_CFLAGS LIBUNWIND_LIBS=$pkg_cv_LIBUNWIND_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } have_libunwind=yes fi if test x$have_libunwind = xyes ; then @@ -4818,8 +4139,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -4849,15 +4170,15 @@ printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -4871,8 +4192,8 @@ printf "%s\n" "$as_me: updating cache $cache_file" >&6;} fi fi else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -4925,7 +4246,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -4941,8 +4262,8 @@ LTLIBOBJS=$ac_ltlibobjs ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -4965,16 +4286,14 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop +else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -4984,46 +4303,46 @@ esac fi - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi # The user is always right. -if ${PATH_SEPARATOR+false} :; then +if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -5032,6 +4351,13 @@ if ${PATH_SEPARATOR+false} :; then fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -5040,12 +4366,8 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS @@ -5057,10 +4379,30 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -5073,14 +4415,13 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - printf "%s\n" "$as_me: error: $2" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -5107,20 +4448,18 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset - # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' -else $as_nop +else as_fn_append () { eval $1=\$$1\$2 @@ -5132,13 +4471,12 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else $as_nop +else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -5169,7 +4507,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -5191,10 +4529,6 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -5208,12 +4542,6 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -5255,7 +4583,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -5264,7 +4592,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | +$as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5327,7 +4655,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.71. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5376,16 +4704,14 @@ $config_files Report bugs to the package provider." _ACEOF -ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` -ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config='$ac_cs_config_escaped' +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.71, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2021 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5422,21 +4748,21 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - printf "%s\n" "$ac_cs_version"; exit ;; + $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - printf "%s\n" "$ac_cs_config"; exit ;; + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - printf "%s\n" "$ac_cs_usage"; exit ;; + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -5464,7 +4790,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -5478,7 +4804,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - printf "%s\n" "$ac_log" + $as_echo "$ac_log" } >&5 _ACEOF @@ -5503,7 +4829,7 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree @@ -5731,7 +5057,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -5739,17 +5065,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -printf "%s\n" "$as_me: creating $ac_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`printf "%s\n" "$configure_input" | + ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -5766,7 +5092,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$ac_file" | +$as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5790,9 +5116,9 @@ printf "%s\n" X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -5845,8 +5171,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -5888,9 +5214,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -5937,8 +5263,7 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/externals/SDL/test/controllermap.c b/externals/SDL/test/controllermap.c index 429125a19..308ddf51a 100755 --- a/externals/SDL/test/controllermap.c +++ b/externals/SDL/test/controllermap.c @@ -18,7 +18,6 @@ #include #include "SDL.h" -#include "testutils.h" #ifndef SDL_JOYSTICK_DISABLED @@ -170,6 +169,39 @@ static SDL_Renderer *screen; static SDL_bool done = SDL_FALSE; static SDL_bool bind_touchpad = SDL_FALSE; +SDL_Texture * +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) +{ + SDL_Surface *temp; + SDL_Texture *texture; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + return NULL; + } + + /* Set transparent pixel as the pixel at (0,0) */ + if (transparent) { + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); + } + } + + /* Create textures from the image */ + texture = SDL_CreateTextureFromSurface(renderer, temp); + if (!texture) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return NULL; + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return texture; +} + static int StandardizeAxisValue(int nValue) { @@ -360,10 +392,10 @@ WatchJoystick(SDL_Joystick * joystick) Uint32 alpha_ticks = 0; SDL_JoystickID nJoystickID; - background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL); - background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL); - button = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); - axis = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); + background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); + background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE); + button = LoadTexture(screen, "button.bmp", SDL_TRUE); + axis = LoadTexture(screen, "axis.bmp", SDL_TRUE); SDL_RaiseWindow(window); /* scale for platforms that don't give you the window size you asked for. */ diff --git a/externals/SDL/test/loopwave.c b/externals/SDL/test/loopwave.c index 354ac2cb7..14ac4dbaf 100755 --- a/externals/SDL/test/loopwave.c +++ b/externals/SDL/test/loopwave.c @@ -25,7 +25,6 @@ #endif #include "SDL.h" -#include "testutils.h" static struct { @@ -115,7 +114,7 @@ int main(int argc, char *argv[]) { int i; - char *filename = NULL; + char filename[4096]; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -126,13 +125,11 @@ main(int argc, char *argv[]) return (1); } - filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); - - if (filename == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); - quit(1); + if (argc > 1) { + SDL_strlcpy(filename, argv[1], sizeof(filename)); + } else { + SDL_strlcpy(filename, "sample.wav", sizeof(filename)); } - /* Load the wave file into memory */ if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); @@ -175,7 +172,6 @@ main(int argc, char *argv[]) /* Clean up on signal */ close_audio(); SDL_FreeWAV(wave.sound); - SDL_free(filename); SDL_Quit(); return (0); } diff --git a/externals/SDL/test/loopwavequeue.c b/externals/SDL/test/loopwavequeue.c index 1996d784a..a5d0ea3cc 100755 --- a/externals/SDL/test/loopwavequeue.c +++ b/externals/SDL/test/loopwavequeue.c @@ -25,8 +25,6 @@ #include #endif -#include "testutils.h" - static struct { SDL_AudioSpec spec; @@ -76,7 +74,7 @@ loop() int main(int argc, char *argv[]) { - char *filename = NULL; + char filename[4096]; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -87,13 +85,11 @@ main(int argc, char *argv[]) return (1); } - filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); - - if (filename == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); - quit(1); + if (argc > 1) { + SDL_strlcpy(filename, argv[1], sizeof(filename)); + } else { + SDL_strlcpy(filename, "sample.wav", sizeof(filename)); } - /* Load the wave file into memory */ if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); @@ -146,7 +142,6 @@ main(int argc, char *argv[]) /* Clean up on signal */ SDL_CloseAudio(); SDL_FreeWAV(wave.sound); - SDL_free(filename); SDL_Quit(); return 0; } diff --git a/externals/SDL/test/testatomic.c b/externals/SDL/test/testatomic.c index 9efbb29c0..16678db5d 100755 --- a/externals/SDL/test/testatomic.c +++ b/externals/SDL/test/testatomic.c @@ -471,6 +471,9 @@ static SDL_bool DequeueEvent_Mutex(SDL_EventQueue *queue, SDL_Event *event) return status; } +static SDL_sem *writersDone; +static SDL_sem *readersDone; + typedef struct { SDL_EventQueue *queue; @@ -479,7 +482,6 @@ typedef struct int waits; SDL_bool lock_free; char padding2[SDL_CACHELINE_SIZE-sizeof(int)-sizeof(SDL_bool)]; - SDL_Thread *thread; } WriterData; typedef struct @@ -489,7 +491,6 @@ typedef struct int waits; SDL_bool lock_free; char padding[SDL_CACHELINE_SIZE-(sizeof(SDL_EventQueue*)+sizeof(int)*NUM_WRITERS+sizeof(int)+sizeof(SDL_bool))%SDL_CACHELINE_SIZE]; - SDL_Thread *thread; } ReaderData; static int SDLCALL FIFO_Writer(void* _data) @@ -522,6 +523,7 @@ static int SDLCALL FIFO_Writer(void* _data) } } } + SDL_SemPost(writersDone); return 0; } @@ -558,6 +560,7 @@ static int SDLCALL FIFO_Reader(void* _data) } } } + SDL_SemPost(readersDone); return 0; } @@ -587,7 +590,6 @@ static int SDLCALL FIFO_Watcher(void* _data) static void RunFIFOTest(SDL_bool lock_free) { SDL_EventQueue queue; - SDL_Thread *fifo_thread = NULL; WriterData writerData[NUM_WRITERS]; ReaderData readerData[NUM_READERS]; Uint32 start, end; @@ -599,6 +601,9 @@ static void RunFIFOTest(SDL_bool lock_free) SDL_Log("\nFIFO test---------------------------------------\n\n"); SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex"); + readersDone = SDL_CreateSemaphore(0); + writersDone = SDL_CreateSemaphore(0); + SDL_memset(&queue, 0xff, sizeof(queue)); InitEventQueue(&queue); @@ -611,7 +616,7 @@ static void RunFIFOTest(SDL_bool lock_free) #ifdef TEST_SPINLOCK_FIFO /* Start a monitoring thread */ if (lock_free) { - fifo_thread = SDL_CreateThread(FIFO_Watcher, "FIFOWatcher", &queue); + SDL_CreateThread(FIFO_Watcher, "FIFOWatcher", &queue); } #endif @@ -623,7 +628,7 @@ static void RunFIFOTest(SDL_bool lock_free) SDL_snprintf(name, sizeof (name), "FIFOReader%d", i); readerData[i].queue = &queue; readerData[i].lock_free = lock_free; - readerData[i].thread = SDL_CreateThread(FIFO_Reader, name, &readerData[i]); + SDL_CreateThread(FIFO_Reader, name, &readerData[i]); } /* Start up the writers */ @@ -635,12 +640,12 @@ static void RunFIFOTest(SDL_bool lock_free) writerData[i].queue = &queue; writerData[i].index = i; writerData[i].lock_free = lock_free; - writerData[i].thread = SDL_CreateThread(FIFO_Writer, name, &writerData[i]); + SDL_CreateThread(FIFO_Writer, name, &writerData[i]); } /* Wait for the writers */ for (i = 0; i < NUM_WRITERS; ++i) { - SDL_WaitThread(writerData[i].thread, NULL); + SDL_SemWait(writersDone); } /* Shut down the queue so readers exit */ @@ -648,15 +653,13 @@ static void RunFIFOTest(SDL_bool lock_free) /* Wait for the readers */ for (i = 0; i < NUM_READERS; ++i) { - SDL_WaitThread(readerData[i].thread, NULL); + SDL_SemWait(readersDone); } end = SDL_GetTicks(); - /* Wait for the FIFO thread */ - if (fifo_thread) { - SDL_WaitThread(fifo_thread, NULL); - } + SDL_DestroySemaphore(readersDone); + SDL_DestroySemaphore(writersDone); if (!lock_free) { SDL_DestroyMutex(queue.mutex); @@ -706,12 +709,6 @@ main(int argc, char *argv[]) SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); RunBasicTest(); - - if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { - SDL_Log("Not running slower tests"); - return 0; - } - RunEpicTest(); /* This test is really slow, so don't run it by default */ #if 0 diff --git a/externals/SDL/test/testaudiohotplug.c b/externals/SDL/test/testaudiohotplug.c index dc84a782f..536cc4c3b 100755 --- a/externals/SDL/test/testaudiohotplug.c +++ b/externals/SDL/test/testaudiohotplug.c @@ -26,7 +26,6 @@ #endif #include "SDL.h" -#include "testutils.h" static SDL_AudioSpec spec; static Uint8 *sound = NULL; /* Pointer to wave data */ @@ -138,7 +137,7 @@ int main(int argc, char *argv[]) { int i; - char *filename = NULL; + char filename[4096]; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -152,13 +151,11 @@ main(int argc, char *argv[]) /* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */ SDL_MinimizeWindow(SDL_CreateWindow("testaudiohotplug", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0)); - filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); - - if (filename == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); - quit(1); + if (argc > 1) { + SDL_strlcpy(filename, argv[1], sizeof(filename)); + } else { + SDL_strlcpy(filename, "sample.wav", sizeof(filename)); } - /* Load the wave file into memory */ if (SDL_LoadWAV(filename, &spec, &sound, &soundlen) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); @@ -199,7 +196,6 @@ main(int argc, char *argv[]) /* Quit audio first, then free WAV. This prevents access violations in the audio threads. */ SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_FreeWAV(sound); - SDL_free(filename); SDL_Quit(); return (0); } diff --git a/externals/SDL/test/testautomation_hints.c b/externals/SDL/test/testautomation_hints.c index 91b8c02ab..0d1b7b6f5 100755 --- a/externals/SDL/test/testautomation_hints.c +++ b/externals/SDL/test/testautomation_hints.c @@ -8,6 +8,7 @@ #include "SDL_test.h" +const int _numHintsEnum = 25; const char* _HintsEnum[] = { SDL_HINT_ACCELEROMETER_AS_JOYSTICK, @@ -31,7 +32,9 @@ const char* _HintsEnum[] = SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT, SDL_HINT_VIDEO_WIN_D3DCOMPILER, + SDL_HINT_VIDEO_X11_XINERAMA, SDL_HINT_VIDEO_X11_XRANDR, + SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_XINPUT_ENABLED, }; const char* _HintsVerbose[] = @@ -57,13 +60,12 @@ const char* _HintsVerbose[] = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS", "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT", "SDL_VIDEO_WIN_D3DCOMPILER", + "SDL_VIDEO_X11_XINERAMA", "SDL_VIDEO_X11_XRANDR", + "SDL_VIDEO_X11_XVIDMODE", "SDL_XINPUT_ENABLED" }; -SDL_COMPILE_TIME_ASSERT(HintsEnum, SDL_arraysize(_HintsEnum) == SDL_arraysize(_HintsVerbose)); - -const int _numHintsEnum = SDL_arraysize(_HintsEnum); /* Test case functions */ diff --git a/externals/SDL/test/testautomation_platform.c b/externals/SDL/test/testautomation_platform.c index 5eb37b332..4e28ba166 100755 --- a/externals/SDL/test/testautomation_platform.c +++ b/externals/SDL/test/testautomation_platform.c @@ -54,18 +54,12 @@ int platform_testTypes(void *arg) int platform_testEndianessAndSwap(void *arg) { int real_byteorder; - int real_floatwordorder = 0; Uint16 value = 0x1234; Uint16 value16 = 0xCDAB; Uint16 swapped16 = 0xABCD; Uint32 value32 = 0xEFBEADDE; Uint32 swapped32 = 0xDEADBEEF; - union { - double d; - Uint32 ui32[2]; - } value_double; - Uint64 value64, swapped64; value64 = 0xEFBEADDE; value64 <<= 32; @@ -73,7 +67,6 @@ int platform_testEndianessAndSwap(void *arg) swapped64 = 0x1234ABCD; swapped64 <<= 32; swapped64 |= 0xDEADBEEF; - value_double.d = 3.141593; if ((*((char *) &value) >> 4) == 0x1) { real_byteorder = SDL_BIG_ENDIAN; @@ -87,18 +80,6 @@ int platform_testEndianessAndSwap(void *arg) (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big", (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big" ); - if (value_double.ui32[0] == 0x82c2bd7f && value_double.ui32[1] == 0x400921fb) { - real_floatwordorder = SDL_LIL_ENDIAN; - } else if (value_double.ui32[0] == 0x400921fb && value_double.ui32[1] == 0x82c2bd7f) { - real_floatwordorder = SDL_BIG_ENDIAN; - } - - /* Test endianness. */ - SDLTest_AssertCheck( real_floatwordorder == SDL_FLOATWORDORDER, - "Machine detected as having %s endian float word order, appears to be %s endian.", - (SDL_FLOATWORDORDER == SDL_LIL_ENDIAN) ? "little" : "big", - (real_floatwordorder == SDL_LIL_ENDIAN) ? "little" : (real_floatwordorder == SDL_BIG_ENDIAN) ? "big" : "unknown" ); - /* Test 16 swap. */ SDLTest_AssertCheck( SDL_Swap16(value16) == swapped16, "SDL_Swap16(): 16 bit swapped: 0x%X => 0x%X", @@ -544,7 +525,7 @@ static const SDLTest_TestCaseReference platformTest1 = { (SDLTest_TestCaseFp)platform_testTypes, "platform_testTypes", "Tests predefined types", TEST_ENABLED}; static const SDLTest_TestCaseReference platformTest2 = - { (SDLTest_TestCaseFp)platform_testEndianessAndSwap, "platform_testEndianessAndSwap", "Tests endianness and swap functions", TEST_ENABLED}; + { (SDLTest_TestCaseFp)platform_testEndianessAndSwap, "platform_testEndianessAndSwap", "Tests endianess and swap functions", TEST_ENABLED}; static const SDLTest_TestCaseReference platformTest3 = { (SDLTest_TestCaseFp)platform_testGetFunctions, "platform_testGetFunctions", "Tests various SDL_GetXYZ functions", TEST_ENABLED}; diff --git a/externals/SDL/test/testautomation_rect.c b/externals/SDL/test/testautomation_rect.c index 729ff29d7..26f03e9bb 100755 --- a/externals/SDL/test/testautomation_rect.c +++ b/externals/SDL/test/testautomation_rect.c @@ -408,32 +408,6 @@ void _validateRectEqualsResults( refRectB->x, refRectB->y, refRectB->w, refRectB->h); } -/* ! - * \brief Private helper to check SDL_FRectEquals results - */ -void _validateFRectEqualsResults( - SDL_bool equals, SDL_bool expectedEquals, - SDL_FRect *rectA, SDL_FRect *rectB, SDL_FRect *refRectA, SDL_FRect *refRectB) -{ - int cmpRes; - SDLTest_AssertCheck(equals == expectedEquals, - "Check for correct equals result: expected %s, got %s testing (%f,%f,%f,%f) and (%f,%f,%f,%f)", - (expectedEquals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", - (equals == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE", - rectA->x, rectA->y, rectA->w, rectA->h, - rectB->x, rectB->y, rectB->w, rectB->h); - cmpRes = SDL_memcmp(rectA, refRectA, sizeof(*rectA)); - SDLTest_AssertCheck(cmpRes == 0, - "Check that source rectangle A was not modified: got (%f,%f,%f,%f) expected (%f,%f,%f,%f)", - rectA->x, rectA->y, rectA->w, rectA->h, - refRectA->x, refRectA->y, refRectA->w, refRectA->h); - cmpRes = SDL_memcmp(rectB, refRectB, sizeof(*rectB)); - SDLTest_AssertCheck(cmpRes == 0, - "Check that source rectangle B was not modified: got (%f,%f,%f,%f) expected (%f,%f,%f,%f)", - rectB->x, rectB->y, rectB->w, rectB->h, - refRectB->x, refRectB->y, refRectB->w, refRectB->h); -} - /* ! * \brief Tests SDL_IntersectRect() with B fully inside A * @@ -707,7 +681,7 @@ int rect_testIntersectRectEmpty (void *arg) int rect_testIntersectRectParam(void *arg) { SDL_Rect rectA; - SDL_Rect rectB = {0}; + SDL_Rect rectB; SDL_Rect result; SDL_bool intersection; @@ -962,7 +936,7 @@ int rect_testHasIntersectionEmpty (void *arg) int rect_testHasIntersectionParam(void *arg) { SDL_Rect rectA; - SDL_Rect rectB = {0}; + SDL_Rect rectB; SDL_bool intersection; /* invalid parameter combinations */ @@ -1231,7 +1205,7 @@ int rect_testEnclosePointsParam(void *arg) { SDL_Point points[1]; int count; - SDL_Rect clip = { 0 }; + SDL_Rect clip; SDL_Rect result; SDL_bool anyEnclosed; @@ -1457,7 +1431,7 @@ int rect_testUnionRectInside(void *arg) */ int rect_testUnionRectParam(void *arg) { - SDL_Rect rectA, rectB = { 0 }; + SDL_Rect rectA, rectB; SDL_Rect result; /* invalid parameter combinations */ @@ -1600,69 +1574,6 @@ int rect_testRectEqualsParam(void *arg) return TEST_COMPLETED; } -/* ! - * \brief Tests SDL_FRectEquals() with various inputs - * - * \sa - * http://wiki.libsdl.org/SDL_FRectEquals - */ -int rect_testFRectEquals(void *arg) -{ - SDL_FRect refRectA; - SDL_FRect refRectB; - SDL_FRect rectA; - SDL_FRect rectB; - SDL_bool expectedResult; - SDL_bool result; - - /* Equals */ - refRectA.x=(float)SDLTest_RandomIntegerInRange(-1024, 1024); - refRectA.y=(float)SDLTest_RandomIntegerInRange(-1024, 1024); - refRectA.w=(float)SDLTest_RandomIntegerInRange(1, 1024); - refRectA.h=(float)SDLTest_RandomIntegerInRange(1, 1024); - refRectB = refRectA; - expectedResult = SDL_TRUE; - rectA = refRectA; - rectB = refRectB; - result = (SDL_bool)SDL_FRectEquals((const SDL_FRect *)&rectA, (const SDL_FRect *)&rectB); - _validateFRectEqualsResults(result, expectedResult, &rectA, &rectB, &refRectA, &refRectB); - - return TEST_COMPLETED; -} - -/* ! - * \brief Negative tests against SDL_FRectEquals() with invalid parameters - * - * \sa - * http://wiki.libsdl.org/SDL_FRectEquals - */ -int rect_testFRectEqualsParam(void *arg) -{ - SDL_FRect rectA; - SDL_FRect rectB; - SDL_bool result; - - /* data setup -- For the purpose of this test, the values don't matter. */ - rectA.x=SDLTest_RandomFloat(); - rectA.y=SDLTest_RandomFloat(); - rectA.w=SDLTest_RandomFloat(); - rectA.h=SDLTest_RandomFloat(); - rectB.x=SDLTest_RandomFloat(); - rectB.y=SDLTest_RandomFloat(); - rectB.w=SDLTest_RandomFloat(); - rectB.h=SDLTest_RandomFloat(); - - /* invalid parameter combinations */ - result = (SDL_bool)SDL_FRectEquals((const SDL_FRect *)NULL, (const SDL_FRect *)&rectB); - SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL"); - result = (SDL_bool)SDL_FRectEquals((const SDL_FRect *)&rectA, (const SDL_FRect *)NULL); - SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 2nd parameter is NULL"); - result = (SDL_bool)SDL_FRectEquals((const SDL_FRect *)NULL, (const SDL_FRect *)NULL); - SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st and 2nd parameter are NULL"); - - return TEST_COMPLETED; -} - /* ================= Test References ================== */ /* Rect test cases */ @@ -1762,13 +1673,6 @@ static const SDLTest_TestCaseReference rectTest28 = static const SDLTest_TestCaseReference rectTest29 = { (SDLTest_TestCaseFp)rect_testRectEqualsParam, "rect_testRectEqualsParam", "Negative tests against SDL_RectEquals with invalid parameters", TEST_ENABLED }; -/* SDL_FRectEquals */ - -static const SDLTest_TestCaseReference rectTest30 = - { (SDLTest_TestCaseFp)rect_testFRectEquals, "rect_testFRectEquals", "Tests SDL_FRectEquals with various inputs", TEST_ENABLED }; - -static const SDLTest_TestCaseReference rectTest31 = - { (SDLTest_TestCaseFp)rect_testFRectEqualsParam, "rect_testFRectEqualsParam", "Negative tests against SDL_FRectEquals with invalid parameters", TEST_ENABLED }; /* ! * \brief Sequence of Rect test cases; functions that handle simple rectangles including overlaps and merges. @@ -1779,7 +1683,7 @@ static const SDLTest_TestCaseReference rectTest31 = static const SDLTest_TestCaseReference *rectTests[] = { &rectTest1, &rectTest2, &rectTest3, &rectTest4, &rectTest5, &rectTest6, &rectTest7, &rectTest8, &rectTest9, &rectTest10, &rectTest11, &rectTest12, &rectTest13, &rectTest14, &rectTest15, &rectTest16, &rectTest17, &rectTest18, &rectTest19, &rectTest20, &rectTest21, &rectTest22, &rectTest23, &rectTest24, &rectTest25, &rectTest26, &rectTest27, - &rectTest28, &rectTest29, &rectTest30, &rectTest31, NULL + &rectTest28, &rectTest29, NULL }; diff --git a/externals/SDL/test/testautomation_render.c b/externals/SDL/test/testautomation_render.c index 0117334a2..42fc54dee 100755 --- a/externals/SDL/test/testautomation_render.c +++ b/externals/SDL/test/testautomation_render.c @@ -187,14 +187,14 @@ int render_testPrimitives (void *arg) ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 ); SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret); - + + /* Make current */ + SDL_RenderPresent(renderer); + /* See if it's the same. */ referenceSurface = SDLTest_ImagePrimitives(); _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); - /* Make current */ - SDL_RenderPresent(renderer); - /* Clean up. */ SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -335,13 +335,13 @@ int render_testPrimitivesBlend (void *arg) SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2); SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3); + /* Make current */ + SDL_RenderPresent(renderer); + /* See if it's the same. */ referenceSurface = SDLTest_ImagePrimitivesBlend(); _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); - /* Make current */ - SDL_RenderPresent(renderer); - /* Clean up. */ SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -404,13 +404,13 @@ render_testBlit(void *arg) } SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1); + /* Make current */ + SDL_RenderPresent(renderer); + /* See if it's the same */ referenceSurface = SDLTest_ImageBlit(); _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); - /* Make current */ - SDL_RenderPresent(renderer); - /* Clean up. */ SDL_DestroyTexture( tface ); SDL_FreeSurface(referenceSurface); @@ -478,13 +478,13 @@ render_testBlitColor (void *arg) SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1); SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2); + /* Make current */ + SDL_RenderPresent(renderer); + /* See if it's the same. */ referenceSurface = SDLTest_ImageBlitColor(); _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); - /* Make current */ - SDL_RenderPresent(renderer); - /* Clean up. */ SDL_DestroyTexture( tface ); SDL_FreeSurface(referenceSurface); @@ -555,13 +555,13 @@ render_testBlitAlpha (void *arg) SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1); SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2); + /* Make current */ + SDL_RenderPresent(renderer); + /* See if it's the same. */ referenceSurface = SDLTest_ImageBlitAlpha(); _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); - /* Make current */ - SDL_RenderPresent(renderer); - /* Clean up. */ SDL_DestroyTexture( tface ); SDL_FreeSurface(referenceSurface); @@ -674,10 +674,9 @@ render_testBlitBlend (void *arg) _testBlitBlendMode( tface, SDL_BLENDMODE_NONE ); referenceSurface = SDLTest_ImageBlitBlendNone(); - /* Compare, then Present */ - _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); + /* Make current and compare */ SDL_RenderPresent(renderer); - + _compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE ); SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -685,10 +684,9 @@ render_testBlitBlend (void *arg) _testBlitBlendMode( tface, SDL_BLENDMODE_BLEND ); referenceSurface = SDLTest_ImageBlitBlend(); - /* Compare, then Present */ - _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); + /* Make current and compare */ SDL_RenderPresent(renderer); - + _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -696,10 +694,9 @@ render_testBlitBlend (void *arg) _testBlitBlendMode( tface, SDL_BLENDMODE_ADD ); referenceSurface = SDLTest_ImageBlitBlendAdd(); - /* Compare, then Present */ - _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); + /* Make current and compare */ SDL_RenderPresent(renderer); - + _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -707,10 +704,9 @@ render_testBlitBlend (void *arg) _testBlitBlendMode( tface, SDL_BLENDMODE_MOD); referenceSurface = SDLTest_ImageBlitBlendMod(); - /* Compare, then Present */ - _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); + /* Make current and compare */ SDL_RenderPresent(renderer); - + _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED ); SDL_FreeSurface(referenceSurface); referenceSurface = NULL; @@ -757,13 +753,12 @@ render_testBlitBlend (void *arg) /* Clean up. */ SDL_DestroyTexture( tface ); - /* Check to see if final image matches. */ - referenceSurface = SDLTest_ImageBlitBlendAll(); - _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED); - /* Make current */ SDL_RenderPresent(renderer); + /* Check to see if final image matches. */ + referenceSurface = SDLTest_ImageBlitBlendAll(); + _compare(referenceSurface, ALLOWABLE_ERROR_BLENDED); SDL_FreeSurface(referenceSurface); referenceSurface = NULL; diff --git a/externals/SDL/test/testautomation_stdlib.c b/externals/SDL/test/testautomation_stdlib.c index 4c978fa9b..bfc8ad373 100755 --- a/externals/SDL/test/testautomation_stdlib.c +++ b/externals/SDL/test/testautomation_stdlib.c @@ -322,168 +322,6 @@ stdlib_sscanf(void *arg) return TEST_COMPLETED; } -#if defined(_WIN64) -# define SIZE_FORMAT "I64u" -#elif defined(__WIN32__) -# define SIZE_FORMAT "I32u" -#else -# define SIZE_FORMAT "zu" -#endif - -typedef struct -{ - size_t a; - size_t b; - size_t result; - int status; -} overflow_test; - -static const overflow_test multiplications[] = -{ - { 1, 1, 1, 0 }, - { 0, 0, 0, 0 }, - { SDL_SIZE_MAX, 0, 0, 0 }, - { SDL_SIZE_MAX, 1, SDL_SIZE_MAX, 0 }, - { SDL_SIZE_MAX / 2, 2, SDL_SIZE_MAX - (SDL_SIZE_MAX % 2), 0 }, - { SDL_SIZE_MAX / 23, 23, SDL_SIZE_MAX - (SDL_SIZE_MAX % 23), 0 }, - - { (SDL_SIZE_MAX / 2) + 1, 2, 0, -1 }, - { (SDL_SIZE_MAX / 23) + 42, 23, 0, -1 }, - { SDL_SIZE_MAX, SDL_SIZE_MAX, 0, -1 }, -}; - -static const overflow_test additions[] = -{ - { 1, 1, 2, 0 }, - { 0, 0, 0, 0 }, - { SDL_SIZE_MAX, 0, SDL_SIZE_MAX, 0 }, - { SDL_SIZE_MAX - 1, 1, SDL_SIZE_MAX, 0 }, - { SDL_SIZE_MAX - 42, 23, SDL_SIZE_MAX - (42 - 23), 0 }, - - { SDL_SIZE_MAX, 1, 0, -1 }, - { SDL_SIZE_MAX, 23, 0, -1 }, - { SDL_SIZE_MAX, SDL_SIZE_MAX, 0, -1 }, -}; - -static int -stdlib_overflow(void *arg) -{ - size_t i; - size_t useBuiltin; - - for (useBuiltin = 0; useBuiltin < 2; useBuiltin++) { - if (useBuiltin) { - SDLTest_Log("Using gcc/clang builtins if possible"); - } else { - SDLTest_Log("Not using gcc/clang builtins"); - } - - for (i = 0; i < SDL_arraysize(multiplications); i++) { - const overflow_test *t = &multiplications[i]; - int status; - size_t result = ~t->result; - - if (useBuiltin) { - status = SDL_size_mul_overflow(t->a, t->b, &result); - } else { - /* This disables the macro that tries to use a gcc/clang - * builtin, so we test the fallback implementation instead. */ - status = (SDL_size_mul_overflow)(t->a, t->b, &result); - } - - if (t->status == 0) { - SDLTest_AssertCheck(status == 0, - "(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should succeed", - t->a, t->b); - SDLTest_AssertCheck(result == t->result, - "(%" SIZE_FORMAT " * %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT, - t->a, t->b, t->result, result); - } else { - SDLTest_AssertCheck(status == -1, - "(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should fail", - t->a, t->b); - } - - if (t->a == t->b) { - continue; - } - - result = ~t->result; - - if (useBuiltin) { - status = SDL_size_mul_overflow(t->b, t->a, &result); - } else { - status = (SDL_size_mul_overflow)(t->b, t->a, &result); - } - - if (t->status == 0) { - SDLTest_AssertCheck(status == 0, - "(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should succeed", - t->b, t->a); - SDLTest_AssertCheck(result == t->result, - "(%" SIZE_FORMAT " * %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT, - t->b, t->a, t->result, result); - } else { - SDLTest_AssertCheck(status == -1, - "(%" SIZE_FORMAT " * %" SIZE_FORMAT ") should fail", - t->b, t->a); - } - } - - for (i = 0; i < SDL_arraysize(additions); i++) { - const overflow_test *t = &additions[i]; - int status; - size_t result = ~t->result; - - if (useBuiltin) { - status = SDL_size_add_overflow(t->a, t->b, &result); - } else { - status = (SDL_size_add_overflow)(t->a, t->b, &result); - } - - if (t->status == 0) { - SDLTest_AssertCheck(status == 0, - "(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should succeed", - t->a, t->b); - SDLTest_AssertCheck(result == t->result, - "(%" SIZE_FORMAT " + %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT, - t->a, t->b, t->result, result); - } else { - SDLTest_AssertCheck(status == -1, - "(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should fail", - t->a, t->b); - } - - if (t->a == t->b) { - continue; - } - - result = ~t->result; - - if (useBuiltin) { - status = SDL_size_add_overflow(t->b, t->a, &result); - } else { - status = (SDL_size_add_overflow)(t->b, t->a, &result); - } - - if (t->status == 0) { - SDLTest_AssertCheck(status == 0, - "(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should succeed", - t->b, t->a); - SDLTest_AssertCheck(result == t->result, - "(%" SIZE_FORMAT " + %" SIZE_FORMAT "): expected %" SIZE_FORMAT ", got %" SIZE_FORMAT, - t->b, t->a, t->result, result); - } else { - SDLTest_AssertCheck(status == -1, - "(%" SIZE_FORMAT " + %" SIZE_FORMAT ") should fail", - t->b, t->a); - } - } - } - - return TEST_COMPLETED; -} - /* ================= Test References ================== */ /* Standard C routine test cases */ @@ -499,17 +337,9 @@ static const SDLTest_TestCaseReference stdlibTest3 = static const SDLTest_TestCaseReference stdlibTest4 = { (SDLTest_TestCaseFp)stdlib_sscanf, "stdlib_sscanf", "Call to SDL_sscanf", TEST_ENABLED }; -static const SDLTest_TestCaseReference stdlibTestOverflow = - { stdlib_overflow, "stdlib_overflow", "Overflow detection", TEST_ENABLED }; - /* Sequence of Standard C routine test cases */ static const SDLTest_TestCaseReference *stdlibTests[] = { - &stdlibTest1, - &stdlibTest2, - &stdlibTest3, - &stdlibTest4, - &stdlibTestOverflow, - NULL + &stdlibTest1, &stdlibTest2, &stdlibTest3, &stdlibTest4, NULL }; /* Standard C routine test suite (global) */ diff --git a/externals/SDL/test/testautomation_suites.h b/externals/SDL/test/testautomation_suites.h index a8c886384..b5f921e3d 100755 --- a/externals/SDL/test/testautomation_suites.h +++ b/externals/SDL/test/testautomation_suites.h @@ -27,7 +27,6 @@ extern SDLTest_TestSuiteReference syswmTestSuite; extern SDLTest_TestSuiteReference timerTestSuite; extern SDLTest_TestSuiteReference videoTestSuite; extern SDLTest_TestSuiteReference hintsTestSuite; -extern SDLTest_TestSuiteReference mathTestSuite; /* All test suites */ SDLTest_TestSuiteReference *testSuites[] = { @@ -49,7 +48,6 @@ SDLTest_TestSuiteReference *testSuites[] = { &timerTestSuite, &videoTestSuite, &hintsTestSuite, - &mathTestSuite, NULL }; diff --git a/externals/SDL/test/testautomation_surface.c b/externals/SDL/test/testautomation_surface.c index 63d4c294d..fcfaad661 100755 --- a/externals/SDL/test/testautomation_surface.c +++ b/externals/SDL/test/testautomation_surface.c @@ -178,10 +178,6 @@ void _testBlitBlendMode(int mode) bmode = SDL_BLENDMODE_ADD; } else if (nmode==3) { bmode = SDL_BLENDMODE_MOD; - } else { - /* Should be impossible, but some static checkers are too imprecise and will complain */ - SDLTest_LogError("Invalid: nmode=%d", nmode); - return; } ret = SDL_SetSurfaceBlendMode( face, bmode ); if (ret != 0) checkFailCount4++; @@ -337,7 +333,7 @@ surface_testCompleteSurfaceConversion(void *arg) SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGRA8888, - SDL_PIXELFORMAT_ARGB2101010, + /*SDL_PIXELFORMAT_ARGB2101010,*/ /* SDL_PIXELFORMAT_ARGB2101010 isn't fully supported yet */ }; SDL_Surface *face = NULL, *cvt1, *cvt2, *final; SDL_PixelFormat *fmt1, *fmt2; @@ -593,177 +589,6 @@ surface_testBlitBlendLoop(void *arg) { } -int -surface_testOverflow(void *arg) -{ - char buf[1024]; - const char *expectedError; - SDL_Surface *surface; - - SDL_memset(buf, '\0', sizeof(buf)); - - expectedError = "Parameter 'width' is invalid"; - surface = SDL_CreateRGBSurfaceWithFormat(0, -3, 100, 8, SDL_PIXELFORMAT_INDEX8); - SDLTest_AssertCheck(surface == NULL, "Should detect negative width"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, -1, 1, 8, 4, SDL_PIXELFORMAT_INDEX8); - SDLTest_AssertCheck(surface == NULL, "Should detect negative width"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceFrom(buf, -1, 1, 32, 4, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); - SDLTest_AssertCheck(surface == NULL, "Should detect negative width"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - - expectedError = "Parameter 'height' is invalid"; - surface = SDL_CreateRGBSurfaceWithFormat(0, 100, -3, 8, SDL_PIXELFORMAT_INDEX8); - SDLTest_AssertCheck(surface == NULL, "Should detect negative height"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 1, -1, 8, 4, SDL_PIXELFORMAT_INDEX8); - SDLTest_AssertCheck(surface == NULL, "Should detect negative height"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceFrom(buf, 1, -1, 32, 4, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); - SDLTest_AssertCheck(surface == NULL, "Should detect negative height"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - - expectedError = "Parameter 'pitch' is invalid"; - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 4, 1, 8, -1, SDL_PIXELFORMAT_INDEX8); - SDLTest_AssertCheck(surface == NULL, "Should detect negative pitch"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceFrom(buf, 1, 1, 32, -1, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); - SDLTest_AssertCheck(surface == NULL, "Should detect negative pitch"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - - /* Less than 1 byte per pixel: the pitch can legitimately be less than - * the width, but it must be enough to hold the appropriate number of - * bits per pixel. SDL_PIXELFORMAT_INDEX4* needs 1 byte per 2 pixels. */ - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 6, 1, 4, 3, SDL_PIXELFORMAT_INDEX4LSB); - SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - surface = SDL_CreateRGBSurfaceFrom(buf, 6, 1, 4, 3, 0, 0, 0, 0); - SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 7, 1, 4, 3, SDL_PIXELFORMAT_INDEX4LSB); - SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceFrom(buf, 7, 1, 4, 3, 0, 0, 0, 0); - SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 7, 1, 4, 4, SDL_PIXELFORMAT_INDEX4LSB); - SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - surface = SDL_CreateRGBSurfaceFrom(buf, 7, 1, 4, 4, 0, 0, 0, 0); - SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - - /* SDL_PIXELFORMAT_INDEX1* needs 1 byte per 8 pixels. */ - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 16, 1, 1, 2, SDL_PIXELFORMAT_INDEX1LSB); - SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - surface = SDL_CreateRGBSurfaceFrom(buf, 16, 1, 1, 2, 0, 0, 0, 0); - SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 17, 1, 1, 2, SDL_PIXELFORMAT_INDEX1LSB); - SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceFrom(buf, 17, 1, 1, 2, 0, 0, 0, 0); - SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 17, 1, 1, 3, SDL_PIXELFORMAT_INDEX1LSB); - SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - surface = SDL_CreateRGBSurfaceFrom(buf, 7, 1, 1, 3, 0, 0, 0, 0); - SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - - /* SDL_PIXELFORMAT_INDEX8 and SDL_PIXELFORMAT_RGB332 require 1 byte per pixel. */ - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 5, 1, 8, 5, SDL_PIXELFORMAT_RGB332); - SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - surface = SDL_CreateRGBSurfaceFrom(buf, 5, 1, 8, 5, 0, 0, 0, 0); - SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 6, 1, 8, 5, SDL_PIXELFORMAT_RGB332); - SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceFrom(buf, 6, 1, 8, 5, 0, 0, 0, 0); - SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - - /* Everything else requires more than 1 byte per pixel, and rounds up - * each pixel to an integer number of bytes (e.g. RGB555 is really - * XRGB1555, with 1 bit per pixel wasted). */ - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 3, 1, 15, 6, SDL_PIXELFORMAT_RGB555); - SDLTest_AssertCheck(surface != NULL, "3px * 15 (really 16) bits per px fits in 6 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - surface = SDL_CreateRGBSurfaceFrom(buf, 3, 1, 15, 6, 0, 0, 0, 0); - SDLTest_AssertCheck(surface != NULL, "5px * 15 (really 16) bits per px fits in 6 bytes: %s", - surface != NULL ? "(success)" : SDL_GetError()); - SDL_FreeSurface(surface); - - surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 4, 1, 15, 6, SDL_PIXELFORMAT_RGB555); - SDLTest_AssertCheck(surface == NULL, "4px * 15 (really 16) bits per px doesn't fit in 6 bytes"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceFrom(buf, 4, 1, 15, 6, 0, 0, 0, 0); - SDLTest_AssertCheck(surface == NULL, "4px * 15 (really 16) bits per px doesn't fit in 6 bytes"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - - if (sizeof (size_t) == 4 && sizeof (int) >= 4) { - expectedError = "Out of memory"; - surface = SDL_CreateRGBSurfaceWithFormat(0, SDL_MAX_SINT32, 1, 8, SDL_PIXELFORMAT_INDEX8); - SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width + alignment"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceWithFormat(0, SDL_MAX_SINT32 / 2, 1, 32, SDL_PIXELFORMAT_ARGB8888); - SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * bytes per pixel"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 29) - 1, (1 << 29) - 1, 8, SDL_PIXELFORMAT_INDEX8); - SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 15) + 1, (1 << 15) + 1, 32, SDL_PIXELFORMAT_ARGB8888); - SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height * bytes per pixel"); - SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, - "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - } - else { - SDLTest_Log("Can't easily overflow size_t on this platform"); - } - - return TEST_COMPLETED; -} - /* ================= Test References ================== */ /* Surface test cases */ @@ -806,14 +631,11 @@ static const SDLTest_TestCaseReference surfaceTest11 = static const SDLTest_TestCaseReference surfaceTest12 = { (SDLTest_TestCaseFp)surface_testBlitBlendMod, "surface_testBlitBlendMod", "Tests blitting routines with mod blending mode.", TEST_ENABLED}; -static const SDLTest_TestCaseReference surfaceTestOverflow = - { surface_testOverflow, "surface_testOverflow", "Test overflow detection.", TEST_ENABLED}; - /* Sequence of Surface test cases */ static const SDLTest_TestCaseReference *surfaceTests[] = { &surfaceTest1, &surfaceTest2, &surfaceTest3, &surfaceTest4, &surfaceTest5, &surfaceTest6, &surfaceTest7, &surfaceTest8, &surfaceTest9, &surfaceTest10, - &surfaceTest11, &surfaceTest12, &surfaceTestOverflow, NULL + &surfaceTest11, &surfaceTest12, NULL }; /* Surface test suite (global) */ diff --git a/externals/SDL/test/testautomation_video.c b/externals/SDL/test/testautomation_video.c index c5b648cfd..342848ac0 100755 --- a/externals/SDL/test/testautomation_video.c +++ b/externals/SDL/test/testautomation_video.c @@ -1372,8 +1372,7 @@ video_getSetWindowMinimumSize(void *arg) int wVariation, hVariation; int referenceW, referenceH; int currentW, currentH; - int desiredW = 1; - int desiredH = 1; + int desiredW, desiredH; /* Get display bounds for size range */ result = SDL_GetDisplayBounds(0, &display); @@ -1849,129 +1848,6 @@ video_getSetWindowData(void *arg) return returnValue; } -/** -* @brief Tests the functionality of the SDL_WINDOWPOS_CENTERED_DISPLAY along with SDL_WINDOW_FULLSCREEN_DESKTOP. -* -* Espeically useful when run on a multi-monitor system with different DPI scales per monitor, -* to test that the window size is maintained when moving between monitors. -*/ -int -video_setWindowCenteredOnDisplay(void *arg) -{ - SDL_Window *window; - const char *title = "video_setWindowCenteredOnDisplay Test Window"; - int x, y, w, h; - int xVariation, yVariation; - int displayNum; - int result; - SDL_Rect display0, display1; - - displayNum = SDL_GetNumVideoDisplays(); - - /* Get display bounds */ - result = SDL_GetDisplayBounds(0 % displayNum, &display0); - SDLTest_AssertPass("SDL_GetDisplayBounds()"); - SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); - if (result != 0) - return TEST_ABORTED; - - result = SDL_GetDisplayBounds(1 % displayNum, &display1); - SDLTest_AssertPass("SDL_GetDisplayBounds()"); - SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); - if (result != 0) - return TEST_ABORTED; - - for (xVariation = 0; xVariation < 2; xVariation++) { - for (yVariation = 0; yVariation < 2; yVariation++) { - int currentX = 0, currentY = 0; - int currentW = 0, currentH = 0; - int expectedX = 0, expectedY = 0; - int currentDisplay; - int expectedDisplay; - SDL_Rect expectedDisplayRect; - - /* xVariation is the display we start on */ - expectedDisplay = xVariation % displayNum; - x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay); - y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay); - w = SDLTest_RandomIntegerInRange(640, 800); - h = SDLTest_RandomIntegerInRange(400, 600); - expectedDisplayRect = (xVariation == 0) ? display0 : display1; - expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2)); - expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2)); - - window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI); - SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h); - SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL"); - - /* Check the window is centered on the requested display */ - currentDisplay = SDL_GetWindowDisplayIndex(window); - SDL_GetWindowSize(window, ¤tW, ¤tH); - SDL_GetWindowPosition(window, ¤tX, ¤tY); - - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); - SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); - SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); - SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); - - /* Enter fullscreen desktop */ - result = SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); - SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); - - /* Check we are filling the full display */ - currentDisplay = SDL_GetWindowDisplayIndex(window); - SDL_GetWindowSize(window, ¤tW, ¤tH); - SDL_GetWindowPosition(window, ¤tX, ¤tY); - - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); - SDLTest_AssertCheck(currentW == expectedDisplayRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedDisplayRect.w); - SDLTest_AssertCheck(currentH == expectedDisplayRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedDisplayRect.h); - SDLTest_AssertCheck(currentX == expectedDisplayRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedDisplayRect.x); - SDLTest_AssertCheck(currentY == expectedDisplayRect.y, "Validate y (current: %d, expected: %d)", currentY, expectedDisplayRect.y); - - /* Leave fullscreen desktop */ - result = SDL_SetWindowFullscreen(window, 0); - SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); - - /* Check window was restored correctly */ - currentDisplay = SDL_GetWindowDisplayIndex(window); - SDL_GetWindowSize(window, ¤tW, ¤tH); - SDL_GetWindowPosition(window, ¤tX, ¤tY); - - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); - SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); - SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); - SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); - - /* Center on display yVariation, and check window properties */ - - expectedDisplay = yVariation % displayNum; - x = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay); - y = SDL_WINDOWPOS_CENTERED_DISPLAY(expectedDisplay); - expectedDisplayRect = (expectedDisplay == 0) ? display0 : display1; - expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2)); - expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2)); - SDL_SetWindowPosition(window, x, y); - - currentDisplay = SDL_GetWindowDisplayIndex(window); - SDL_GetWindowSize(window, ¤tW, ¤tH); - SDL_GetWindowPosition(window, ¤tX, ¤tY); - - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); - SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); - SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); - SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); - - /* Clean up */ - _destroyVideoSuiteTestWindow(window); - } - } - - return TEST_COMPLETED; -} /* ================= Test References ================== */ @@ -2045,16 +1921,13 @@ static const SDLTest_TestCaseReference videoTest22 = static const SDLTest_TestCaseReference videoTest23 = { (SDLTest_TestCaseFp)video_getSetWindowData, "video_getSetWindowData", "Checks SDL_SetWindowData and SDL_GetWindowData positive and negative cases", TEST_ENABLED }; -static const SDLTest_TestCaseReference videoTest24 = - { (SDLTest_TestCaseFp) video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED }; - /* Sequence of Video test cases */ static const SDLTest_TestCaseReference *videoTests[] = { &videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6, &videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12, &videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17, &videoTest18, &videoTest19, &videoTest20, &videoTest21, &videoTest22, - &videoTest23, &videoTest24, NULL + &videoTest23, NULL }; /* Video test suite (global) */ diff --git a/externals/SDL/test/testcustomcursor.c b/externals/SDL/test/testcustomcursor.c index 698d31f9b..2feee81a2 100755 --- a/externals/SDL/test/testcustomcursor.c +++ b/externals/SDL/test/testcustomcursor.c @@ -135,8 +135,6 @@ init_system_cursor(const char *image[]) static SDLTest_CommonState *state; int done; static SDL_Cursor *cursors[1+SDL_NUM_SYSTEM_CURSORS]; -static SDL_SystemCursor cursor_types[1+SDL_NUM_SYSTEM_CURSORS]; -static int num_cursors; static int current_cursor; static int show_cursor; @@ -158,34 +156,11 @@ loop() SDLTest_CommonEvent(state, &event, &done); if (event.type == SDL_MOUSEBUTTONDOWN) { if (event.button.button == SDL_BUTTON_LEFT) { - if (num_cursors == 0) { - continue; - } - ++current_cursor; - if (current_cursor == num_cursors) { + if (current_cursor == SDL_arraysize(cursors)) { current_cursor = 0; } - SDL_SetCursor(cursors[current_cursor]); - - switch (cursor_types[current_cursor]) { - case (SDL_SystemCursor)-1: SDL_Log("Custom cursor"); break; - case SDL_SYSTEM_CURSOR_ARROW: SDL_Log("Arrow"); break; - case SDL_SYSTEM_CURSOR_IBEAM: SDL_Log("I-beam"); break; - case SDL_SYSTEM_CURSOR_WAIT: SDL_Log("Wait"); break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: SDL_Log("Crosshair"); break; - case SDL_SYSTEM_CURSOR_WAITARROW: SDL_Log("Small wait cursor (or Wait if not available)"); break; - case SDL_SYSTEM_CURSOR_SIZENWSE: SDL_Log("Double arrow pointing northwest and southeast"); break; - case SDL_SYSTEM_CURSOR_SIZENESW: SDL_Log("Double arrow pointing northeast and southwest"); break; - case SDL_SYSTEM_CURSOR_SIZEWE: SDL_Log("Double arrow pointing west and east"); break; - case SDL_SYSTEM_CURSOR_SIZENS: SDL_Log("Double arrow pointing north and south"); break; - case SDL_SYSTEM_CURSOR_SIZEALL: SDL_Log("Four pointed arrow pointing north, south, east, and west"); break; - case SDL_SYSTEM_CURSOR_NO: SDL_Log("Slashed circle or crossbones"); break; - case SDL_SYSTEM_CURSOR_HAND: SDL_Log("Hand"); break; - default: SDL_Log("UNKNOWN CURSOR TYPE, FIX THIS PROGRAM."); break; - } - } else { show_cursor = !show_cursor; SDL_ShowCursor(show_cursor); @@ -244,38 +219,23 @@ main(int argc, char *argv[]) SDL_RenderClear(renderer); } - num_cursors = 0; - if (color_cursor) { - SDL_Cursor *cursor = init_color_cursor(color_cursor); - if (cursor) { - cursors[num_cursors] = cursor; - cursor_types[num_cursors] = (SDL_SystemCursor)-1; - num_cursors++; - } + cursors[0] = init_color_cursor(color_cursor); } else { - SDL_Cursor *cursor = init_system_cursor(arrow); - if (cursor) { - cursors[num_cursors] = cursor; - cursor_types[num_cursors] = (SDL_SystemCursor)-1; - num_cursors++; - } + cursors[0] = init_system_cursor(arrow); + } + if (!cursors[0]) { + SDL_Log("Error, couldn't create cursor\n"); + quit(2); } - for (i = 0; i < SDL_NUM_SYSTEM_CURSORS; ++i) { - SDL_Cursor *cursor = SDL_CreateSystemCursor((SDL_SystemCursor)i); - if (cursor) { - cursors[num_cursors] = cursor; - cursor_types[num_cursors] = i; - num_cursors++; + cursors[1+i] = SDL_CreateSystemCursor((SDL_SystemCursor)i); + if (!cursors[1+i]) { + SDL_Log("Error, couldn't create system cursor %d\n", i); + quit(2); } } - - if (num_cursors > 0) { - SDL_SetCursor(cursors[0]); - } - - show_cursor = SDL_ShowCursor(SDL_QUERY); + SDL_SetCursor(cursors[0]); /* Main render loop */ done = 0; @@ -287,7 +247,7 @@ main(int argc, char *argv[]) } #endif - for (i = 0; i < num_cursors; ++i) { + for (i = 0; i < SDL_arraysize(cursors); ++i) { SDL_FreeCursor(cursors[i]); } quit(0); diff --git a/externals/SDL/test/testerror.c b/externals/SDL/test/testerror.c index c118abdee..e847c2824 100755 --- a/externals/SDL/test/testerror.c +++ b/externals/SDL/test/testerror.c @@ -58,12 +58,6 @@ main(int argc, char *argv[]) /* Set the error value for the main thread */ SDL_SetError("No worries"); - if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { - SDL_Log("Not running slower tests"); - SDL_Quit(); - return 0; - } - alive = 1; thread = SDL_CreateThread(ThreadFunc, NULL, "#1"); if (thread == NULL) { diff --git a/externals/SDL/test/testevdev.c b/externals/SDL/test/testevdev.c index 938a9a504..572c60a05 100755 --- a/externals/SDL/test/testevdev.c +++ b/externals/SDL/test/testevdev.c @@ -41,7 +41,6 @@ static const struct CLS(SOUND), CLS(TOUCHSCREEN), CLS(ACCELEROMETER), - CLS(TOUCHPAD), #undef CLS { 0, NULL } }; @@ -186,7 +185,9 @@ static const GuessTest guess_tests[] = .bus_type = 0x0003, .vendor_id = 0x054c, .product_id = 0x09cc, - .expected = SDL_UDEV_DEVICE_TOUCHPAD, + /* TODO: Should this be MOUSE? That's what it most closely + * resembles */ + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY, ABS */ .ev = { 0x0b }, /* X, Y, multitouch */ @@ -595,7 +596,7 @@ static const GuessTest guess_tests[] = * to the arrow, page up and page down keys, so it's a joystick * with a subset of a keyboard attached. */ /* TODO: Should this be JOYSTICK, or even JOYSTICK|KEYBOARD? */ - .expected = SDL_UDEV_DEVICE_KEYBOARD, + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -607,7 +608,7 @@ static const GuessTest guess_tests[] = /* BTN_1, BTN_2, BTN_A, BTN_B, BTN_MODE */ /* 0x100 */ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x10, /* 0x140 */ ZEROx8, - /* next (keyboard page down), previous (keyboard page up) */ + /* next, previous */ /* 0x180 */ 0x00, 0x00, 0x80, 0x10, ZEROx4, }, }, @@ -658,7 +659,7 @@ static const GuessTest guess_tests[] = .name = "Wiimote - Classic Controller", /* TODO: Should this be JOYSTICK, or maybe JOYSTICK|KEYBOARD? * It's unusual in the same ways as the Wiimote */ - .expected = SDL_UDEV_DEVICE_KEYBOARD, + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY, ABS */ .ev = { 0x0b }, /* Hat 1-3 */ @@ -672,7 +673,7 @@ static const GuessTest guess_tests[] = /* A, B, X, Y, MODE, TL, TL2, TR, TR2 */ /* 0x100 */ ZEROx4, 0x00, 0x13, 0xdb, 0x10, /* 0x140 */ ZEROx8, - /* next (keyboard page down), previous (keyboard page up) */ + /* next, previous */ /* 0x180 */ 0x00, 0x00, 0x80, 0x10, ZEROx4, }, }, @@ -717,7 +718,9 @@ static const GuessTest guess_tests[] = .vendor_id = 0x06cb, .product_id = 0x0000, .version = 0x0000, - .expected = SDL_UDEV_DEVICE_TOUCHPAD, + /* TODO: Should this be MOUSE? That's what it most closely + * resembles */ + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY, ABS */ .ev = { 0x0b }, /* X, Y, pressure, multitouch */ @@ -753,8 +756,7 @@ static const GuessTest guess_tests[] = }, { .name = "Thinkpad ACPI buttons", - /* SDL treats this as a keyboard because it has a power button */ - .expected = SDL_UDEV_DEVICE_KEYBOARD, + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY, MSC, SW */ .ev = { 0x33 }, .keys = { @@ -813,8 +815,7 @@ static const GuessTest guess_tests[] = .vendor_id = 0x0000, .product_id = 0x0003, .version = 0x0000, - /* SDL treats KEY_SLEEP as indicating a keyboard */ - .expected = SDL_UDEV_DEVICE_KEYBOARD, + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -840,8 +841,7 @@ static const GuessTest guess_tests[] = .vendor_id = 0x0000, .product_id = 0x0001, .version = 0x0000, - /* SDL treats KEY_POWER as indicating a keyboard */ - .expected = SDL_UDEV_DEVICE_KEYBOARD, + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -856,8 +856,7 @@ static const GuessTest guess_tests[] = .vendor_id = 0x0000, .product_id = 0x0006, .version = 0x0000, - /* SDL treats brightness control, etc. as keyboard keys */ - .expected = SDL_UDEV_DEVICE_KEYBOARD, + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -874,7 +873,7 @@ static const GuessTest guess_tests[] = .vendor_id = 0x17aa, .product_id = 0x5054, .version = 0x4101, - .expected = SDL_UDEV_DEVICE_KEYBOARD, + .expected = SDL_UDEV_DEVICE_UNKNOWN, /* SYN, KEY */ .ev = { 0x03 }, .keys = { @@ -912,8 +911,9 @@ static const GuessTest guess_tests[] = .product_id = 0x6009, /* For some reason the special keys like mute and wlan toggle * show up here instead of, or in addition to, as part of - * the keyboard - so both udev and SDL report this as having keys too. */ - .expected = SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD, + * the keyboard - so udev reports this as having keys too. + * SDL currently doesn't. */ + .expected = SDL_UDEV_DEVICE_MOUSE, /* SYN, KEY, REL, MSC, LED */ .ev = { 0x17, 0x00, 0x02 }, /* X, Y */ @@ -1019,7 +1019,7 @@ static int run_test(void) { printf("SDL compiled without evdev capability check.\n"); - return 1; + return 0; } #endif diff --git a/externals/SDL/test/testgamecontroller.c b/externals/SDL/test/testgamecontroller.c index bd2281077..077a6abd3 100755 --- a/externals/SDL/test/testgamecontroller.c +++ b/externals/SDL/test/testgamecontroller.c @@ -17,7 +17,6 @@ #include #include "SDL.h" -#include "testutils.h" #ifdef __EMSCRIPTEN__ #include @@ -28,10 +27,6 @@ #define SCREEN_WIDTH 512 #define SCREEN_HEIGHT 320 -#define BUTTON_SIZE 50 -#define AXIS_SIZE 50 - - /* This is indexed by SDL_GameControllerButton. */ static const struct { int x; int y; } button_positions[] = { {387, 167}, /* SDL_CONTROLLER_BUTTON_A */ @@ -54,9 +49,7 @@ static const struct { int x; int y; } button_positions[] = { {330, 135}, /* SDL_CONTROLLER_BUTTON_PADDLE2 */ {132, 175}, /* SDL_CONTROLLER_BUTTON_PADDLE3 */ {330, 175}, /* SDL_CONTROLLER_BUTTON_PADDLE4 */ - {0, 0}, /* SDL_CONTROLLER_BUTTON_TOUCHPAD */ }; -SDL_COMPILE_TIME_ASSERT(button_positions, SDL_arraysize(button_positions) == SDL_CONTROLLER_BUTTON_MAX); /* This is indexed by SDL_GameControllerAxis. */ static const struct { int x; int y; double angle; } axis_positions[] = { @@ -67,7 +60,6 @@ static const struct { int x; int y; double angle; } axis_positions[] = { {91, -20, 0.0}, /* TRIGGERLEFT */ {375, -20, 0.0}, /* TRIGGERRIGHT */ }; -SDL_COMPILE_TIME_ASSERT(axis_positions, SDL_arraysize(axis_positions) == SDL_CONTROLLER_AXIS_MAX); static SDL_Window *window = NULL; static SDL_Renderer *screen = NULL; @@ -79,11 +71,6 @@ static SDL_Texture *background_front, *background_back, *button, *axis; static SDL_GameController *gamecontroller; static SDL_GameController **gamecontrollers; static int num_controllers = 0; -static SDL_Joystick *virtual_joystick = NULL; -static SDL_GameControllerAxis virtual_axis_active = SDL_CONTROLLER_AXIS_INVALID; -static int virtual_axis_start_x; -static int virtual_axis_start_y; -static SDL_GameControllerButton virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID; static void UpdateWindowTitle() { @@ -133,7 +120,6 @@ static void AddController(int device_index, SDL_bool verbose) SDL_JoystickID controller_id = SDL_JoystickGetDeviceInstanceID(device_index); SDL_GameController *controller; SDL_GameController **controllers; - Uint16 firmware_version; controller_id = SDL_JoystickGetDeviceInstanceID(device_index); if (controller_id < 0) { @@ -165,15 +151,7 @@ static void AddController(int device_index, SDL_bool verbose) if (verbose) { const char *name = SDL_GameControllerName(gamecontroller); - const char *path = SDL_GameControllerPath(gamecontroller); - SDL_Log("Opened game controller %s%s%s\n", name, path ? ", " : "", path ? path : ""); - } - - firmware_version = SDL_GameControllerGetFirmwareVersion(gamecontroller); - if (firmware_version) { - if (verbose) { - SDL_Log("Firmware version: 0x%x (%d)\n", firmware_version, firmware_version); - } + SDL_Log("Opened game controller %s\n", name); } if (SDL_GameControllerHasSensor(gamecontroller, SDL_SENSOR_ACCEL)) { @@ -238,6 +216,34 @@ static void DelController(SDL_JoystickID controller) UpdateWindowTitle(); } +static SDL_Texture * +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) +{ + SDL_Surface *temp = NULL; + SDL_Texture *texture = NULL; + + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + } else { + /* Set transparent pixel as the pixel at (0,0) */ + if (transparent) { + if (temp->format->BytesPerPixel == 1) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels); + } + } + + texture = SDL_CreateTextureFromSurface(renderer, temp); + if (!texture) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + } + } + if (temp) { + SDL_FreeSurface(temp); + } + return texture; +} + static Uint16 ConvertAxisToRumble(Sint16 axisval) { /* Only start rumbling if the axis is past the halfway point */ @@ -300,223 +306,12 @@ static void CyclePS5TriggerEffect() SDL_GameControllerSendEffect(gamecontroller, &state, sizeof(state)); } -static SDL_bool ShowingFront() -{ - SDL_bool showing_front = SDL_TRUE; - int i; - - if (gamecontroller) { - /* Show the back of the controller if the paddles are being held */ - for (i = SDL_CONTROLLER_BUTTON_PADDLE1; i <= SDL_CONTROLLER_BUTTON_PADDLE4; ++i) { - if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) { - showing_front = SDL_FALSE; - break; - } - } - } - if ((SDL_GetModState() & KMOD_SHIFT) != 0) { - showing_front = SDL_FALSE; - } - return showing_front; -} - -static void SDLCALL VirtualControllerSetPlayerIndex(void *userdata, int player_index) -{ - SDL_Log("Virtual Controller: player index set to %d\n", player_index); -} - -static int SDLCALL VirtualControllerRumble(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) -{ - SDL_Log("Virtual Controller: rumble set to %d/%d\n", low_frequency_rumble, high_frequency_rumble); - return 0; -} - -static int SDLCALL VirtualControllerRumbleTriggers(void *userdata, Uint16 left_rumble, Uint16 right_rumble) -{ - SDL_Log("Virtual Controller: trigger rumble set to %d/%d\n", left_rumble, right_rumble); - return 0; -} - -static int SDLCALL VirtualControllerSetLED(void *userdata, Uint8 red, Uint8 green, Uint8 blue) -{ - SDL_Log("Virtual Controller: LED set to RGB %d,%d,%d\n", red, green, blue); - return 0; -} - -static void OpenVirtualController() -{ - SDL_VirtualJoystickDesc desc; - int virtual_index; - - SDL_zero(desc); - desc.version = SDL_VIRTUAL_JOYSTICK_DESC_VERSION; - desc.type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; - desc.naxes = SDL_CONTROLLER_AXIS_MAX; - desc.nbuttons = SDL_CONTROLLER_BUTTON_MAX; - desc.SetPlayerIndex = VirtualControllerSetPlayerIndex; - desc.Rumble = VirtualControllerRumble; - desc.RumbleTriggers = VirtualControllerRumbleTriggers; - desc.SetLED = VirtualControllerSetLED; - - virtual_index = SDL_JoystickAttachVirtualEx(&desc); - if (virtual_index < 0) { - SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError()); - } else { - virtual_joystick = SDL_JoystickOpen(virtual_index); - if (!virtual_joystick) { - SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError()); - } - } -} - -static void CloseVirtualController() -{ - int i; - - for (i = SDL_NumJoysticks(); i--; ) { - if (SDL_JoystickIsVirtual(i)) { - SDL_JoystickDetachVirtual(i); - } - } - - if (virtual_joystick) { - SDL_JoystickClose(virtual_joystick); - virtual_joystick = NULL; - } -} - -static SDL_GameControllerButton FindButtonAtPosition(int x, int y) -{ - SDL_Point point; - int i; - SDL_bool showing_front = ShowingFront(); - - point.x = x; - point.y = y; - for (i = 0; i < SDL_CONTROLLER_BUTTON_TOUCHPAD; ++i) { - SDL_bool on_front = (i < SDL_CONTROLLER_BUTTON_PADDLE1 || i > SDL_CONTROLLER_BUTTON_PADDLE4); - if (on_front == showing_front) { - SDL_Rect rect; - rect.x = button_positions[i].x; - rect.y = button_positions[i].y; - rect.w = BUTTON_SIZE; - rect.h = BUTTON_SIZE; - if (SDL_PointInRect(&point, &rect)) { - return (SDL_GameControllerButton)i; - } - } - } - return SDL_CONTROLLER_BUTTON_INVALID; -} - -static SDL_GameControllerAxis FindAxisAtPosition(int x, int y) -{ - SDL_Point point; - int i; - SDL_bool showing_front = ShowingFront(); - - point.x = x; - point.y = y; - for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; ++i) { - if (showing_front) { - SDL_Rect rect; - rect.x = axis_positions[i].x; - rect.y = axis_positions[i].y; - rect.w = AXIS_SIZE; - rect.h = AXIS_SIZE; - if (SDL_PointInRect(&point, &rect)) { - return (SDL_GameControllerAxis)i; - } - } - } - return SDL_CONTROLLER_AXIS_INVALID; -} - -static void VirtualControllerMouseMotion(int x, int y) -{ - if (virtual_button_active != SDL_CONTROLLER_BUTTON_INVALID) { - if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) { - const int MOVING_DISTANCE = 2; - if (SDL_abs(x - virtual_axis_start_x) >= MOVING_DISTANCE || - SDL_abs(y - virtual_axis_start_y) >= MOVING_DISTANCE) { - SDL_JoystickSetVirtualButton(virtual_joystick, virtual_button_active, SDL_RELEASED); - virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID; - } - } - } - - if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) { - if (virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERLEFT || - virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { - int range = (SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN); - float distance = SDL_clamp(((float)y - virtual_axis_start_y) / AXIS_SIZE, 0.0f, 1.0f); - Sint16 value = (Sint16)(SDL_JOYSTICK_AXIS_MIN + (distance * range)); - SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active, value); - } else { - float distanceX = SDL_clamp(((float)x - virtual_axis_start_x) / AXIS_SIZE, -1.0f, 1.0f); - float distanceY = SDL_clamp(((float)y - virtual_axis_start_y) / AXIS_SIZE, -1.0f, 1.0f); - Sint16 valueX, valueY; - - if (distanceX >= 0) { - valueX = (Sint16)(distanceX * SDL_JOYSTICK_AXIS_MAX); - } else { - valueX = (Sint16)(distanceX * -SDL_JOYSTICK_AXIS_MIN); - } - if (distanceY >= 0) { - valueY = (Sint16)(distanceY * SDL_JOYSTICK_AXIS_MAX); - } else { - valueY = (Sint16)(distanceY * -SDL_JOYSTICK_AXIS_MIN); - } - SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active, valueX); - SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active+1, valueY); - } - } -} - -static void VirtualControllerMouseDown(int x, int y) -{ - SDL_GameControllerButton button; - SDL_GameControllerAxis axis; - - button = FindButtonAtPosition(x, y); - if (button != SDL_CONTROLLER_BUTTON_INVALID) { - virtual_button_active = button; - SDL_JoystickSetVirtualButton(virtual_joystick, virtual_button_active, SDL_PRESSED); - } - - axis = FindAxisAtPosition(x, y); - if (axis != SDL_CONTROLLER_AXIS_INVALID) { - virtual_axis_active = axis; - virtual_axis_start_x = x; - virtual_axis_start_y = y; - } -} - -static void VirtualControllerMouseUp(int x, int y) -{ - if (virtual_button_active != SDL_CONTROLLER_BUTTON_INVALID) { - SDL_JoystickSetVirtualButton(virtual_joystick, virtual_button_active, SDL_RELEASED); - virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID; - } - - if (virtual_axis_active != SDL_CONTROLLER_AXIS_INVALID) { - if (virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERLEFT || - virtual_axis_active == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { - SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active, SDL_JOYSTICK_AXIS_MIN); - } else { - SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active, 0); - SDL_JoystickSetVirtualAxis(virtual_joystick, virtual_axis_active+1, 0); - } - virtual_axis_active = SDL_CONTROLLER_AXIS_INVALID; - } -} - void loop(void *arg) { SDL_Event event; int i; - SDL_bool showing_front; + SDL_bool showing_front = SDL_TRUE; /* Update to get the current event state */ SDL_PumpEvents(); @@ -587,24 +382,6 @@ loop(void *arg) } break; - case SDL_MOUSEBUTTONDOWN: - if (virtual_joystick) { - VirtualControllerMouseDown(event.button.x, event.button.y); - } - break; - - case SDL_MOUSEBUTTONUP: - if (virtual_joystick) { - VirtualControllerMouseUp(event.button.x, event.button.y); - } - break; - - case SDL_MOUSEMOTION: - if (virtual_joystick) { - VirtualControllerMouseMotion(event.motion.x, event.motion.y); - } - break; - case SDL_KEYDOWN: if (event.key.keysym.sym >= SDLK_0 && event.key.keysym.sym <= SDLK_9) { if (gamecontroller) { @@ -614,14 +391,6 @@ loop(void *arg) } break; } - if (event.key.keysym.sym == SDLK_a) { - OpenVirtualController(); - break; - } - if (event.key.keysym.sym == SDLK_d) { - CloseVirtualController(); - break; - } if (event.key.keysym.sym != SDLK_ESCAPE) { break; } @@ -634,7 +403,15 @@ loop(void *arg) } } - showing_front = ShowingFront(); + if (gamecontroller) { + /* Show the back of the controller if the paddles are being held */ + for (i = SDL_CONTROLLER_BUTTON_PADDLE1; i <= SDL_CONTROLLER_BUTTON_PADDLE4; ++i) { + if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) { + showing_front = SDL_FALSE; + break; + } + } + } /* blank screen, set up for drawing this frame. */ SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE); @@ -650,8 +427,8 @@ loop(void *arg) SDL_Rect dst; dst.x = button_positions[i].x; dst.y = button_positions[i].y; - dst.w = BUTTON_SIZE; - dst.h = BUTTON_SIZE; + dst.w = 50; + dst.h = 50; SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, SDL_FLIP_NONE); } } @@ -666,16 +443,16 @@ loop(void *arg) SDL_Rect dst; dst.x = axis_positions[i].x; dst.y = axis_positions[i].y; - dst.w = AXIS_SIZE; - dst.h = AXIS_SIZE; + dst.w = 50; + dst.h = 50; SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } else if (value > deadzone) { const double angle = axis_positions[i].angle + 180.0; SDL_Rect dst; dst.x = axis_positions[i].x; dst.y = axis_positions[i].y; - dst.w = AXIS_SIZE; - dst.h = AXIS_SIZE; + dst.w = 50; + dst.h = 50; SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } } @@ -730,7 +507,7 @@ loop(void *arg) } } } - SDL_Delay(16); + SDL_RenderPresent(screen); #ifdef __EMSCRIPTEN__ @@ -752,7 +529,6 @@ main(int argc, char *argv[]) SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); - SDL_SetHint(SDL_HINT_JOYSTICK_ROG_CHAKRAM, "1"); SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); SDL_SetHint(SDL_HINT_LINUX_JOYSTICK_DEADZONES, "1"); @@ -783,7 +559,6 @@ main(int argc, char *argv[]) /* Print information about the controller */ for (i = 0; i < SDL_NumJoysticks(); ++i) { const char *name; - const char *path; const char *description; SDL_JoystickGetGUIDString(SDL_JoystickGetDeviceGUID(i), @@ -792,7 +567,6 @@ main(int argc, char *argv[]) if (SDL_IsGameController(i)) { controller_count++; name = SDL_GameControllerNameForIndex(i); - path = SDL_GameControllerPathForIndex(i); switch (SDL_GameControllerTypeForIndex(i)) { case SDL_CONTROLLER_TYPE_AMAZON_LUNA: description = "Amazon Luna Controller"; @@ -828,11 +602,10 @@ main(int argc, char *argv[]) AddController(i, SDL_FALSE); } else { name = SDL_JoystickNameForIndex(i); - path = SDL_JoystickPathForIndex(i); description = "Joystick"; } - SDL_Log("%s %d: %s%s%s (guid %s, VID 0x%.4x, PID 0x%.4x, player index = %d)\n", - description, i, name ? name : "Unknown", path ? ", " : "", path ? path : "", guid, + SDL_Log("%s %d: %s (guid %s, VID 0x%.4x, PID 0x%.4x, player index = %d)\n", + description, i, name ? name : "Unknown", guid, SDL_JoystickGetDeviceVendor(i), SDL_JoystickGetDeviceProduct(i), SDL_JoystickGetDevicePlayerIndex(i)); } SDL_Log("There are %d game controller(s) attached (%d joystick(s))\n", controller_count, SDL_NumJoysticks()); @@ -860,10 +633,10 @@ main(int argc, char *argv[]) /* scale for platforms that don't give you the window size you asked for. */ SDL_RenderSetLogicalSize(screen, SCREEN_WIDTH, SCREEN_HEIGHT); - background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE, NULL, NULL); - background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE, NULL, NULL); - button = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); - axis = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); + background_front = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); + background_back = LoadTexture(screen, "controllermap_back.bmp", SDL_FALSE); + button = LoadTexture(screen, "button.bmp", SDL_TRUE); + axis = LoadTexture(screen, "axis.bmp", SDL_TRUE); if (!background_front || !background_back || !button || !axis) { SDL_DestroyRenderer(screen); @@ -876,14 +649,8 @@ main(int argc, char *argv[]) /* !!! FIXME: */ /*SDL_RenderSetLogicalSize(screen, background->w, background->h);*/ - for (i = 1; i < argc; ++i) { - if (SDL_strcmp(argv[i], "--virtual") == 0) { - OpenVirtualController(); - } - if (argv[i] && *argv[i] != '-') { - controller_index = SDL_atoi(argv[i]); - break; - } + if (argv[1] && *argv[1] != '-') { + controller_index = SDL_atoi(argv[1]); } if (controller_index < num_controllers) { gamecontroller = gamecontrollers[controller_index]; @@ -907,7 +674,6 @@ main(int argc, char *argv[]) CyclePS5TriggerEffect(); } - CloseVirtualController(); SDL_DestroyRenderer(screen); SDL_DestroyWindow(window); SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER); diff --git a/externals/SDL/test/testgeometry.c b/externals/SDL/test/testgeometry.c index f0f07eed6..3a87e3d2e 100755 --- a/externals/SDL/test/testgeometry.c +++ b/externals/SDL/test/testgeometry.c @@ -21,7 +21,6 @@ #endif #include "SDL_test_common.h" -#include "testutils.h" static SDLTest_CommonState *state; static SDL_bool use_texture = SDL_FALSE; @@ -45,19 +44,54 @@ int LoadSprite(const char *file) { int i; + SDL_Surface *temp; + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + return (-1); + } + sprite_w = temp->w; + sprite_h = temp->h; + + /* Set transparent pixel as the pixel at (0,0) */ + if (temp->format->palette) { + SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, 1, (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, 1, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, 1, (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, 1, *(Uint32 *) temp->pixels); + break; + } + } + + /* Create textures from the image */ for (i = 0; i < state->num_windows; ++i) { - /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */ - sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h); + SDL_Renderer *renderer = state->renderers[i]; + sprites[i] = SDL_CreateTextureFromSurface(renderer, temp); if (!sprites[i]) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); return (-1); } if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); SDL_DestroyTexture(sprites[i]); return (-1); } } + SDL_FreeSurface(temp); /* We're ready to roll. :) */ return (0); diff --git a/externals/SDL/test/testgesture.c b/externals/SDL/test/testgesture.c index 856fd6a2d..b4bce6965 100755 --- a/externals/SDL/test/testgesture.c +++ b/externals/SDL/test/testgesture.c @@ -190,8 +190,7 @@ loop(void) case SDLK_i: { for (i = 0; i < SDL_GetNumTouchDevices(); ++i) { const SDL_TouchID id = SDL_GetTouchDevice(i); - const char *name = SDL_GetTouchName(i); - SDL_Log("Fingers Down on device %"SDL_PRIs64" (%s): %d", id, name, SDL_GetNumTouchFingers(id)); + SDL_Log("Fingers Down on device %"SDL_PRIs64": %d", id, SDL_GetNumTouchFingers(id)); } break; } diff --git a/externals/SDL/test/testgles2.c b/externals/SDL/test/testgles2.c index 4b9e5d250..b6180aeaa 100755 --- a/externals/SDL/test/testgles2.c +++ b/externals/SDL/test/testgles2.c @@ -38,18 +38,6 @@ typedef struct GLES2_Context #undef SDL_PROC } GLES2_Context; -typedef struct shader_data -{ - GLuint shader_program, shader_frag, shader_vert; - - GLint attr_position; - GLint attr_color, attr_mvp; - - int angle_x, angle_y, angle_z; - - GLuint position_buffer; - GLuint color_buffer; -} shader_data; static SDLTest_CommonState *state; static SDL_GLContext *context = NULL; @@ -209,13 +197,13 @@ multiply_matrix(float *lhs, float *rhs, float *r) * source: Passed-in shader source code. * shader_type: Passed to GL, e.g. GL_VERTEX_SHADER. */ -static void +void process_shader(GLuint *shader, const char * source, GLint shader_type) { GLint status = GL_FALSE; const char *shaders[1] = { NULL }; char buffer[1024]; - GLsizei length = 0; + GLsizei length; /* Create shader and load into GL. */ *shader = GL_CHECK(ctx.glCreateShader(shader_type)); @@ -233,35 +221,13 @@ process_shader(GLuint *shader, const char * source, GLint shader_type) /* Dump debug info (source and log) if compilation failed. */ if(status != GL_TRUE) { - ctx.glGetShaderInfoLog(*shader, sizeof(buffer), &length, &buffer[0]); + ctx.glGetProgramInfoLog(*shader, sizeof(buffer), &length, &buffer[0]); buffer[length] = '\0'; - SDL_Log("Shader compilation failed: %s", buffer); - fflush(stderr); + SDL_Log("Shader compilation failed: %s", buffer);fflush(stderr); quit(-1); } } -static void -link_program(struct shader_data *data) -{ - GLint status = GL_FALSE; - char buffer[1024]; - GLsizei length = 0; - - GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_vert)); - GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_frag)); - GL_CHECK(ctx.glLinkProgram(data->shader_program)); - GL_CHECK(ctx.glGetProgramiv(data->shader_program, GL_LINK_STATUS, &status)); - - if(status != GL_TRUE) { - ctx.glGetProgramInfoLog(data->shader_program, sizeof(buffer), &length, &buffer[0]); - buffer[length] = '\0'; - SDL_Log("Program linking failed: %s", buffer); - fflush(stderr); - quit(-1); - } -} - /* 3D data. Vertex range -0.5..0.5 in all axes. * Z -0.5 is near, 0.5 is far. */ const float _vertices[] = @@ -397,6 +363,17 @@ const char* _shader_frag_src = " gl_FragColor = vec4(vv3color, 1.0); " " } "; +typedef struct shader_data +{ + GLuint shader_program, shader_frag, shader_vert; + + GLint attr_position; + GLint attr_color, attr_mvp; + + int angle_x, angle_y, angle_z; + +} shader_data; + static void Render(unsigned int width, unsigned int height, shader_data* data) { @@ -454,7 +431,7 @@ void loop() switch (event.type) { case SDL_WINDOWEVENT: switch (event.window.event) { - case SDL_WINDOWEVENT_SIZE_CHANGED: + case SDL_WINDOWEVENT_RESIZED: for (i = 0; i < state->num_windows; ++i) { if (event.window.windowID == SDL_GetWindowID(state->windows[i])) { int w, h; @@ -693,7 +670,9 @@ main(int argc, char *argv[]) data->shader_program = GL_CHECK(ctx.glCreateProgram()); /* Attach shaders and link shader_program */ - link_program(data); + GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_vert)); + GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_frag)); + GL_CHECK(ctx.glLinkProgram(data->shader_program)); /* Get attribute locations of non-fixed attributes like color and texture coordinates. */ data->attr_position = GL_CHECK(ctx.glGetAttribLocation(data->shader_program, "av4position")); @@ -709,18 +688,8 @@ main(int argc, char *argv[]) GL_CHECK(ctx.glEnableVertexAttribArray(data->attr_color)); /* Populate attributes for position, color and texture coordinates etc. */ - - GL_CHECK(ctx.glGenBuffers(1, &data->position_buffer)); - GL_CHECK(ctx.glBindBuffer(GL_ARRAY_BUFFER, data->position_buffer)); - GL_CHECK(ctx.glBufferData(GL_ARRAY_BUFFER, sizeof(_vertices), _vertices, GL_STATIC_DRAW)); - GL_CHECK(ctx.glVertexAttribPointer(data->attr_position, 3, GL_FLOAT, GL_FALSE, 0, 0)); - GL_CHECK(ctx.glBindBuffer(GL_ARRAY_BUFFER, 0)); - - GL_CHECK(ctx.glGenBuffers(1, &data->color_buffer)); - GL_CHECK(ctx.glBindBuffer(GL_ARRAY_BUFFER, data->color_buffer)); - GL_CHECK(ctx.glBufferData(GL_ARRAY_BUFFER, sizeof(_colors), _colors, GL_STATIC_DRAW)); - GL_CHECK(ctx.glVertexAttribPointer(data->attr_color, 3, GL_FLOAT, GL_FALSE, 0, 0)); - GL_CHECK(ctx.glBindBuffer(GL_ARRAY_BUFFER, 0)); + GL_CHECK(ctx.glVertexAttribPointer(data->attr_position, 3, GL_FLOAT, GL_FALSE, 0, _vertices)); + GL_CHECK(ctx.glVertexAttribPointer(data->attr_color, 3, GL_FLOAT, GL_FALSE, 0, _colors)); GL_CHECK(ctx.glEnable(GL_CULL_FACE)); GL_CHECK(ctx.glEnable(GL_DEPTH_TEST)); diff --git a/externals/SDL/test/testgles2_sdf.c b/externals/SDL/test/testgles2_sdf.c index 064b6bc2c..a7f8016ea 100755 --- a/externals/SDL/test/testgles2_sdf.c +++ b/externals/SDL/test/testgles2_sdf.c @@ -458,7 +458,6 @@ main(int argc, char *argv[]) Uint32 then, now; int status; shader_data *data; - char *path = NULL; /* Initialize parameters */ fsaa = 0; @@ -562,25 +561,14 @@ main(int argc, char *argv[]) /* Load SDF BMP image */ #if 1 - path = GetNearbyFilename(f); - - if (path == NULL) - path = SDL_strdup(f); - - if (path == NULL) { - SDL_Log("out of memory\n"); - exit(-1); - } - - tmp = SDL_LoadBMP(path); + tmp = SDL_LoadBMP(f); if (tmp == NULL) { - SDL_Log("missing image file: %s", path); + SDL_Log("missing image file: %s", f); exit(-1); } else { - SDL_Log("Load image file: %s", path); + SDL_Log("Load image file: %s", f); } - SDL_free(path); #else /* Generate SDF image using SDL_ttf */ diff --git a/externals/SDL/test/testiconv.c b/externals/SDL/test/testiconv.c index 31d05e195..bf9ad3b92 100755 --- a/externals/SDL/test/testiconv.c +++ b/externals/SDL/test/testiconv.c @@ -13,7 +13,6 @@ #include #include "SDL.h" -#include "testutils.h" static size_t widelen(char *data) @@ -44,7 +43,7 @@ main(int argc, char *argv[]) "UCS-4", }; - char * fname; + const char * fname; char buffer[BUFSIZ]; char *ucs4; char *test[2]; @@ -55,13 +54,12 @@ main(int argc, char *argv[]) /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - fname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "utf8.txt"); + fname = (argc < 2) ? "utf8.txt" : argv[1]; file = fopen(fname, "rb"); if (!file) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname); return (1); } - SDL_free(fname); while (fgets(buffer, sizeof(buffer), file)) { /* Convert to UCS-4 */ diff --git a/externals/SDL/test/testime.c b/externals/SDL/test/testime.c index 155834229..5541d484f 100755 --- a/externals/SDL/test/testime.c +++ b/externals/SDL/test/testime.c @@ -23,7 +23,6 @@ #endif #include "SDL_test_common.h" -#include "testutils.h" #define DEFAULT_PTSIZE 30 #ifdef HAVE_SDL_TTF @@ -109,7 +108,6 @@ static int unifont_init(const char *fontname) SDL_RWops *hexFile; const size_t unifontGlyphSize = UNIFONT_NUM_GLYPHS * sizeof(struct UnifontGlyph); const size_t unifontTextureSize = UNIFONT_NUM_TEXTURES * state->num_windows * sizeof(void *); - char *filename; /* Allocate memory for the glyph data so the file can be closed after initialization. */ unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize); @@ -129,13 +127,7 @@ static int unifont_init(const char *fontname) } SDL_memset(unifontTexture, 0, unifontTextureSize); - filename = GetResourceFilename(NULL, fontname); - if (filename == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); - return -1; - } - hexFile = SDL_RWFromFile(filename, "rb"); - SDL_free(filename); + hexFile = SDL_RWFromFile(fontname, "rb"); if (hexFile == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); diff --git a/externals/SDL/test/testmouse.c b/externals/SDL/test/testmouse.c index 11a176066..0c9f7ee10 100755 --- a/externals/SDL/test/testmouse.c +++ b/externals/SDL/test/testmouse.c @@ -39,11 +39,6 @@ static Line *active = NULL; static Line *lines = NULL; static int buttons = 0; -static SDL_bool wheel_x_active = SDL_FALSE; -static SDL_bool wheel_y_active = SDL_FALSE; -static float wheel_x = SCREEN_WIDTH * 0.5f; -static float wheel_y = SCREEN_HEIGHT * 0.5f; - static SDL_bool done = SDL_FALSE; void @@ -86,25 +81,6 @@ loop(void *arg) /* Check for events */ while (SDL_PollEvent(&event)) { switch (event.type) { - case SDL_MOUSEWHEEL: - if (event.wheel.direction == SDL_MOUSEWHEEL_FLIPPED) { - event.wheel.preciseX *= -1.0f; - event.wheel.preciseY *= -1.0f; - event.wheel.x *= -1; - event.wheel.y *= -1; - } - if (event.wheel.preciseX != 0.0f) { - wheel_x_active = SDL_TRUE; - /* "positive to the right and negative to the left" */ - wheel_x += event.wheel.preciseX * 10.0f; - } - if (event.wheel.preciseY != 0.0f) { - wheel_y_active = SDL_TRUE; - /* "positive away from the user and negative towards the user" */ - wheel_y -= event.wheel.preciseY * 10.0f; - } - break; - case SDL_MOUSEMOTION: if (!active) break; @@ -124,8 +100,6 @@ loop(void *arg) case SDL_BUTTON_LEFT: active->r = 255; buttons |= SDL_BUTTON_LMASK; break; case SDL_BUTTON_MIDDLE: active->g = 255; buttons |= SDL_BUTTON_MMASK; break; case SDL_BUTTON_RIGHT: active->b = 255; buttons |= SDL_BUTTON_RMASK; break; - case SDL_BUTTON_X1: active->r = 255; active->b = 255; buttons |= SDL_BUTTON_X1MASK; break; - case SDL_BUTTON_X2: active->g = 255; active->b = 255; buttons |= SDL_BUTTON_X2MASK; break; } break; case SDL_MOUSEBUTTONUP: @@ -136,8 +110,6 @@ loop(void *arg) case SDL_BUTTON_LEFT: buttons &= ~SDL_BUTTON_LMASK; break; case SDL_BUTTON_MIDDLE: buttons &= ~SDL_BUTTON_MMASK; break; case SDL_BUTTON_RIGHT: buttons &= ~SDL_BUTTON_RMASK; break; - case SDL_BUTTON_X1: buttons &= ~SDL_BUTTON_X1MASK; break; - case SDL_BUTTON_X2: buttons &= ~SDL_BUTTON_X2MASK; break; } if (buttons == 0) { @@ -158,16 +130,6 @@ loop(void *arg) SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_RenderClear(renderer); - /* Mouse wheel */ - SDL_SetRenderDrawColor(renderer, 0, 255, 128, 255); - if (wheel_x_active) { - SDL_RenderDrawLine(renderer, wheel_x, 0, wheel_x, SCREEN_HEIGHT); - } - if (wheel_y_active) { - SDL_RenderDrawLine(renderer, 0, wheel_y, SCREEN_WIDTH, wheel_y); - } - - /* Lines from mouse clicks */ DrawLines(renderer); if (active) DrawLine(renderer, active); diff --git a/externals/SDL/test/testmultiaudio.c b/externals/SDL/test/testmultiaudio.c index 1154b83af..51a7ff03c 100755 --- a/externals/SDL/test/testmultiaudio.c +++ b/externals/SDL/test/testmultiaudio.c @@ -17,8 +17,6 @@ #include #endif -#include "testutils.h" - static SDL_AudioSpec spec; static Uint8 *sound = NULL; /* Pointer to wave data */ static Uint32 soundlen = 0; /* Length of wave data */ @@ -182,7 +180,7 @@ main(int argc, char **argv) if (devcount < 1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n"); } else { - char *file = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); + const char *file = (argc < 2) ? "sample.wav" : argv[1]; /* Load the wave file into memory */ if (SDL_LoadWAV(file, &spec, &sound, &soundlen) == NULL) { @@ -192,8 +190,6 @@ main(int argc, char **argv) test_multi_audio(devcount); SDL_FreeWAV(sound); } - - SDL_free(file); } SDL_Quit(); diff --git a/externals/SDL/test/testnative.c b/externals/SDL/test/testnative.c index 34ee661f9..48f6f0ea5 100755 --- a/externals/SDL/test/testnative.c +++ b/externals/SDL/test/testnative.c @@ -16,7 +16,6 @@ #include /* for time() */ #include "testnative.h" -#include "testutils.h" #define WINDOW_W 640 #define WINDOW_H 480 @@ -53,6 +52,37 @@ quit(int rc) exit(rc); } +SDL_Texture * +LoadSprite(SDL_Renderer *renderer, const char *file) +{ + SDL_Surface *temp; + SDL_Texture *sprite; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + return 0; + } + + /* Set transparent pixel as the pixel at (0,0) */ + if (temp->format->palette) { + SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); + } + + /* Create textures from the image */ + sprite = SDL_CreateTextureFromSurface(renderer, temp); + if (!sprite) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return 0; + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return sprite; +} + void MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite) { @@ -150,7 +180,7 @@ main(int argc, char *argv[]) SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); SDL_RenderClear(renderer); - sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, NULL, NULL); + sprite = LoadSprite(renderer, "icon.bmp"); if (!sprite) { quit(6); } diff --git a/externals/SDL/test/testoverlay2.c b/externals/SDL/test/testoverlay2.c index ab0fd82db..8bb59a9fa 100755 --- a/externals/SDL/test/testoverlay2.c +++ b/externals/SDL/test/testoverlay2.c @@ -25,7 +25,6 @@ #include "SDL.h" #include "testyuv_cvt.h" -#include "testutils.h" #define MOOSEPIC_W 64 #define MOOSEPIC_H 88 @@ -244,7 +243,6 @@ main(int argc, char **argv) int fps = 12; int nodelay = 0; int scale = 5; - char *filename = NULL; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -317,13 +315,7 @@ main(int argc, char **argv) } /* load the trojan moose images */ - filename = GetResourceFilename(NULL, "moose.dat"); - if (filename == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); - return -1; - } - handle = SDL_RWFromFile(filename, "rb"); - SDL_free(filename); + handle = SDL_RWFromFile("moose.dat", "rb"); if (handle == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); SDL_free(RawMooseData); diff --git a/externals/SDL/test/testplatform.c b/externals/SDL/test/testplatform.c index f5b524d57..107c277b6 100755 --- a/externals/SDL/test/testplatform.c +++ b/externals/SDL/test/testplatform.c @@ -25,31 +25,31 @@ badsize(size_t sizeoftype, size_t hardcodetype) return sizeoftype != hardcodetype; } -SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT8, SDL_MAX_SINT8 == 127); -SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT8, SDL_MIN_SINT8 == -128); -SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT8, SDL_MAX_UINT8 == 255); -SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT8, SDL_MIN_UINT8 == 0); - -SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT16, SDL_MAX_SINT16 == 32767); -SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT16, SDL_MIN_SINT16 == -32768); -SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT16, SDL_MAX_UINT16 == 65535); -SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT16, SDL_MIN_UINT16 == 0); - -SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT32, SDL_MAX_SINT32 == 2147483647); -SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT32, SDL_MIN_SINT32 == ~0x7fffffff); /* Instead of -2147483648, which is treated as unsigned by some compilers */ -SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT32, SDL_MAX_UINT32 == 4294967295u); -SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT32, SDL_MIN_UINT32 == 0); - -SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT64, SDL_MAX_SINT64 == 9223372036854775807ll); -SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT64, SDL_MIN_SINT64 == ~0x7fffffffffffffffll); /* Instead of -9223372036854775808, which is treated as unsigned by compilers */ -SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT64, SDL_MAX_UINT64 == 18446744073709551615ull); -SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT64, SDL_MIN_UINT64 == 0); - int TestTypes(SDL_bool verbose) { int error = 0; + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT8, SDL_MAX_SINT8 == 127); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT8, SDL_MIN_SINT8 == -128); + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT8, SDL_MAX_UINT8 == 255); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT8, SDL_MIN_UINT8 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT16, SDL_MAX_SINT16 == 32767); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT16, SDL_MIN_SINT16 == -32768); + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT16, SDL_MAX_UINT16 == 65535); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT16, SDL_MIN_UINT16 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT32, SDL_MAX_SINT32 == 2147483647); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT32, SDL_MIN_SINT32 == ~0x7fffffff); /* Instead of -2147483648, which is treated as unsigned by some compilers */ + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT32, SDL_MAX_UINT32 == 4294967295u); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT32, SDL_MIN_UINT32 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT64, SDL_MAX_SINT64 == 9223372036854775807ll); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT64, SDL_MIN_SINT64 == ~0x7fffffffffffffffll); /* Instead of -9223372036854775808, which is treated as unsigned by compilers */ + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT64, SDL_MAX_UINT64 == 18446744073709551615ull); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT64, SDL_MIN_UINT64 == 0); + if (badsize(sizeof(Uint8), 1)) { if (verbose) SDL_Log("sizeof(Uint8) != 1, instead = %u\n", @@ -86,25 +86,18 @@ TestEndian(SDL_bool verbose) int error = 0; Uint16 value = 0x1234; int real_byteorder; - int real_floatwordorder = 0; Uint16 value16 = 0xCDAB; Uint16 swapped16 = 0xABCD; Uint32 value32 = 0xEFBEADDE; Uint32 swapped32 = 0xDEADBEEF; Uint64 value64, swapped64; - union { - double d; - Uint32 ui32[2]; - } value_double; - value64 = 0xEFBEADDE; value64 <<= 32; value64 |= 0xCDAB3412; swapped64 = 0x1234ABCD; swapped64 <<= 32; swapped64 |= 0xDEADBEEF; - value_double.d = 3.141593; if (verbose) { SDL_Log("Detected a %s endian machine.\n", @@ -122,22 +115,6 @@ TestEndian(SDL_bool verbose) } ++error; } - if (verbose) { - SDL_Log("Detected a %s endian float word order machine.\n", - (SDL_FLOATWORDORDER == SDL_LIL_ENDIAN) ? "little" : "big"); - } - if (value_double.ui32[0] == 0x82c2bd7f && value_double.ui32[1] == 0x400921fb) { - real_floatwordorder = SDL_LIL_ENDIAN; - } else if (value_double.ui32[0] == 0x400921fb && value_double.ui32[1] == 0x82c2bd7f) { - real_floatwordorder = SDL_BIG_ENDIAN; - } - if (real_floatwordorder != SDL_FLOATWORDORDER) { - if (verbose) { - SDL_Log("Actually a %s endian float word order machine!\n", - (real_floatwordorder == SDL_LIL_ENDIAN) ? "little" : (real_floatwordorder == SDL_BIG_ENDIAN) ? "big" : "unknown" ); - } - ++error; - } if (verbose) { SDL_Log("Value 16 = 0x%X, swapped = 0x%X\n", value16, SDL_Swap16(value16)); diff --git a/externals/SDL/test/testqsort.c b/externals/SDL/test/testqsort.c index 29ea05627..d28daebd4 100755 --- a/externals/SDL/test/testqsort.c +++ b/externals/SDL/test/testqsort.c @@ -12,7 +12,7 @@ #include "SDL_test.h" -static int SDLCALL +static int num_compare(const void *_a, const void *_b) { const int a = *((const int *) _a); diff --git a/externals/SDL/test/testrendercopyex.c b/externals/SDL/test/testrendercopyex.c index b954499e3..47d3ae96f 100755 --- a/externals/SDL/test/testrendercopyex.c +++ b/externals/SDL/test/testrendercopyex.c @@ -20,7 +20,7 @@ #endif #include "SDL_test_common.h" -#include "testutils.h" + static SDLTest_CommonState *state; @@ -44,6 +44,56 @@ quit(int rc) exit(rc); } +SDL_Texture * +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) +{ + SDL_Surface *temp; + SDL_Texture *texture; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + return NULL; + } + + /* Set transparent pixel as the pixel at (0,0) */ + if (transparent) { + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); + break; + } + } + } + + /* Create textures from the image */ + texture = SDL_CreateTextureFromSurface(renderer, temp); + if (!texture) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return NULL; + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return texture; +} + void Draw(DrawState *s) { @@ -136,8 +186,8 @@ main(int argc, char *argv[]) drawstate->window = state->windows[i]; drawstate->renderer = state->renderers[i]; - drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); - drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); + drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); + drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); if (!drawstate->sprite || !drawstate->background) { quit(2); } diff --git a/externals/SDL/test/testrendertarget.c b/externals/SDL/test/testrendertarget.c index 98ceb1607..3fb611270 100755 --- a/externals/SDL/test/testrendertarget.c +++ b/externals/SDL/test/testrendertarget.c @@ -20,7 +20,7 @@ #endif #include "SDL_test_common.h" -#include "testutils.h" + static SDLTest_CommonState *state; @@ -45,6 +45,56 @@ quit(int rc) exit(rc); } +SDL_Texture * +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) +{ + SDL_Surface *temp; + SDL_Texture *texture; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + return NULL; + } + + /* Set transparent pixel as the pixel at (0,0) */ + if (transparent) { + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); + break; + } + } + } + + /* Create textures from the image */ + texture = SDL_CreateTextureFromSurface(renderer, temp); + if (!texture) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return NULL; + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return texture; +} + SDL_bool DrawComposite(DrawState *s) { @@ -242,11 +292,11 @@ main(int argc, char *argv[]) drawstate->window = state->windows[i]; drawstate->renderer = state->renderers[i]; if (test_composite) { - drawstate->sprite = LoadTexture(drawstate->renderer, "icon-alpha.bmp", SDL_TRUE, NULL, NULL); + drawstate->sprite = LoadTexture(drawstate->renderer, "icon-alpha.bmp", SDL_TRUE); } else { - drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); + drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); } - drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); + drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); if (!drawstate->sprite || !drawstate->background) { quit(2); } diff --git a/externals/SDL/test/testscale.c b/externals/SDL/test/testscale.c index 0f1d21bfe..1235c811d 100755 --- a/externals/SDL/test/testscale.c +++ b/externals/SDL/test/testscale.c @@ -20,7 +20,6 @@ #endif #include "SDL_test_common.h" -#include "testutils.h" #define WINDOW_WIDTH 640 #define WINDOW_HEIGHT 480 @@ -47,6 +46,56 @@ quit(int rc) exit(rc); } +SDL_Texture * +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) +{ + SDL_Surface *temp; + SDL_Texture *texture; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + return NULL; + } + + /* Set transparent pixel as the pixel at (0,0) */ + if (transparent) { + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); + break; + } + } + } + + /* Create textures from the image */ + texture = SDL_CreateTextureFromSurface(renderer, temp); + if (!texture) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return NULL; + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return texture; +} + void Draw(DrawState *s) { @@ -127,8 +176,8 @@ main(int argc, char *argv[]) drawstate->window = state->windows[i]; drawstate->renderer = state->renderers[i]; - drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE, NULL, NULL); - drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE, NULL, NULL); + drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); + drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); if (!drawstate->sprite || !drawstate->background) { quit(2); } diff --git a/externals/SDL/test/testshader.c b/externals/SDL/test/testshader.c index 3c2da590f..2cee7d9b3 100755 --- a/externals/SDL/test/testshader.c +++ b/externals/SDL/test/testshader.c @@ -126,52 +126,21 @@ static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; static SDL_bool CompileShader(GLhandleARB shader, const char *source) { - GLint status = 0; + GLint status; glShaderSourceARB(shader, 1, &source, NULL); glCompileShaderARB(shader); glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); if (status == 0) { - GLint length = 0; + GLint length; char *info; glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); - info = (char *) SDL_malloc(length + 1); - if (!info) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); - } else { - glGetInfoLogARB(shader, length, NULL, info); - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to compile shader:\n%s\n%s", source, info); - SDL_free(info); - } - return SDL_FALSE; - } else { - return SDL_TRUE; - } -} + info = SDL_stack_alloc(char, length+1); + glGetInfoLogARB(shader, length, NULL, info); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to compile shader:\n%s\n%s", source, info); + SDL_stack_free(info); -static SDL_bool LinkProgram(ShaderData *data) -{ - GLint status = 0; - - glAttachObjectARB(data->program, data->vert_shader); - glAttachObjectARB(data->program, data->frag_shader); - glLinkProgramARB(data->program); - - glGetObjectParameterivARB(data->program, GL_OBJECT_LINK_STATUS_ARB, &status); - if (status == 0) { - GLint length = 0; - char *info; - - glGetObjectParameterivARB(data->program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); - info = (char *) SDL_malloc(length + 1); - if (!info) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); - } else { - glGetInfoLogARB(data->program, length, NULL, info); - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to link program:\n%s", info); - SDL_free(info); - } return SDL_FALSE; } else { return SDL_TRUE; @@ -202,9 +171,9 @@ static SDL_bool CompileShaderProgram(ShaderData *data) } /* ... and in the darkness bind them */ - if (!LinkProgram(data)) { - return SDL_FALSE; - } + glAttachObjectARB(data->program, data->vert_shader); + glAttachObjectARB(data->program, data->frag_shader); + glLinkProgramARB(data->program); /* Set up some uniform variables */ glUseProgramObjectARB(data->program); diff --git a/externals/SDL/test/testsprite2.c b/externals/SDL/test/testsprite2.c index fa709e349..88419ffcf 100755 --- a/externals/SDL/test/testsprite2.c +++ b/externals/SDL/test/testsprite2.c @@ -21,7 +21,6 @@ #include "SDL_test.h" #include "SDL_test_common.h" -#include "testutils.h" #define NUM_SPRITES 100 #define MAX_SPEED 1 @@ -63,19 +62,54 @@ int LoadSprite(const char *file) { int i; + SDL_Surface *temp; + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); + return (-1); + } + sprite_w = temp->w; + sprite_h = temp->h; + + /* Set transparent pixel as the pixel at (0,0) */ + if (temp->format->palette) { + SDL_SetColorKey(temp, 1, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, 1, (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, 1, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, 1, (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, 1, *(Uint32 *) temp->pixels); + break; + } + } + + /* Create textures from the image */ for (i = 0; i < state->num_windows; ++i) { - /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */ - sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h); + SDL_Renderer *renderer = state->renderers[i]; + sprites[i] = SDL_CreateTextureFromSurface(renderer, temp); if (!sprites[i]) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); return (-1); } if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); SDL_DestroyTexture(sprites[i]); return (-1); } } + SDL_FreeSurface(temp); /* We're ready to roll. :) */ return (0); diff --git a/externals/SDL/test/testspriteminimal.c b/externals/SDL/test/testspriteminimal.c index 36ea373b0..b9762cab3 100755 --- a/externals/SDL/test/testspriteminimal.c +++ b/externals/SDL/test/testspriteminimal.c @@ -20,7 +20,6 @@ #endif #include "SDL.h" -#include "testutils.h" #define WINDOW_WIDTH 640 #define WINDOW_HEIGHT 480 @@ -43,6 +42,55 @@ quit(int rc) exit(rc); } +int +LoadSprite(const char *file) +{ + SDL_Surface *temp; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file, SDL_GetError()); + return (-1); + } + sprite_w = temp->w; + sprite_h = temp->h; + + /* Set transparent pixel as the pixel at (0,0) */ + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); + break; + } + } + + /* Create textures from the image */ + sprite = SDL_CreateTextureFromSurface(renderer, temp); + if (!sprite) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return (-1); + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return (0); +} + void MoveSprites() { @@ -110,9 +158,7 @@ main(int argc, char *argv[]) quit(2); } - sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h); - - if (sprite == NULL) { + if (LoadSprite("icon.bmp") < 0) { quit(2); } diff --git a/externals/SDL/test/teststreaming.c b/externals/SDL/test/teststreaming.c index dc3ae61d6..72444f80e 100755 --- a/externals/SDL/test/teststreaming.c +++ b/externals/SDL/test/teststreaming.c @@ -23,7 +23,6 @@ #endif #include "SDL.h" -#include "testutils.h" #define MOOSEPIC_W 64 #define MOOSEPIC_H 88 @@ -129,7 +128,6 @@ main(int argc, char **argv) { SDL_Window *window; SDL_RWops *handle; - char *filename = NULL; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -140,13 +138,7 @@ main(int argc, char **argv) } /* load the moose images */ - filename = GetResourceFilename(NULL, "moose.dat"); - if (filename == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); - return -1; - } - handle = SDL_RWFromFile(filename, "rb"); - SDL_free(filename); + handle = SDL_RWFromFile("moose.dat", "rb"); if (handle == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); quit(2); diff --git a/externals/SDL/test/testsurround.c b/externals/SDL/test/testsurround.c index 1537b35fe..168415aca 100755 --- a/externals/SDL/test/testsurround.c +++ b/externals/SDL/test/testsurround.c @@ -19,7 +19,6 @@ static int total_channels; static int active_channel; #define SAMPLE_RATE_HZ 48000 -#define QUICK_TEST_TIME_MSEC 100 #define CHANNEL_TEST_TIME_SEC 5 #define MAX_AMPLITUDE SDL_MAX_SINT16 @@ -189,11 +188,7 @@ main(int argc, char *argv[]) SDL_Log("Playing %d Hz test tone on channel: %s\n", sine_freq, get_channel_name(j, total_channels)); /* fill_buffer() will increment the active channel */ - if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { - SDL_Delay(QUICK_TEST_TIME_MSEC); - } else { - SDL_Delay(CHANNEL_TEST_TIME_SEC * 1000); - } + SDL_Delay(CHANNEL_TEST_TIME_SEC * 1000); } SDL_CloseAudioDevice(dev); diff --git a/externals/SDL/test/testthread.c b/externals/SDL/test/testthread.c index ea94dfb2e..bf201e8e4 100755 --- a/externals/SDL/test/testthread.c +++ b/externals/SDL/test/testthread.c @@ -91,12 +91,6 @@ main(int argc, char *argv[]) return (1); } - if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { - SDL_Log("Not running slower tests"); - SDL_Quit(); - return 0; - } - while (argv[arg] && *argv[arg] == '-') { if (SDL_strcmp(argv[arg], "--prio") == 0) { testprio = 1; diff --git a/externals/SDL/test/testtimer.c b/externals/SDL/test/testtimer.c index 62c5cd5f9..d696097c8 100755 --- a/externals/SDL/test/testtimer.c +++ b/externals/SDL/test/testtimer.c @@ -54,12 +54,6 @@ main(int argc, char *argv[]) return (1); } - if (SDL_getenv("SDL_TESTS_QUICK") != NULL) { - SDL_Log("Not running slower tests"); - SDL_Quit(); - return 0; - } - /* Verify SDL_GetTicks* acts monotonically increasing, and not erratic. */ SDL_Log("Sanity-checking GetTicks\n"); for (i = 0; i < 1000; ++i) { diff --git a/externals/SDL/test/testviewport.c b/externals/SDL/test/testviewport.c index 162b31069..0e39d852d 100755 --- a/externals/SDL/test/testviewport.c +++ b/externals/SDL/test/testviewport.c @@ -21,7 +21,7 @@ #include "SDL_test.h" #include "SDL_test_common.h" -#include "testutils.h" + static SDLTest_CommonState *state; @@ -42,6 +42,55 @@ quit(int rc) exit(rc); } +int +LoadSprite(const char *file, SDL_Renderer *renderer) +{ + SDL_Surface *temp; + + /* Load the sprite image */ + temp = SDL_LoadBMP(file); + if (temp == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file, SDL_GetError()); + return (-1); + } + sprite_w = temp->w; + sprite_h = temp->h; + + /* Set transparent pixel as the pixel at (0,0) */ + if (temp->format->palette) { + SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); + } else { + switch (temp->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint16 *) temp->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); + break; + case 24: + SDL_SetColorKey(temp, SDL_TRUE, + (*(Uint32 *) temp->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); + break; + } + } + + /* Create textures from the image */ + sprite = SDL_CreateTextureFromSurface(renderer, temp); + if (!sprite) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + return (-1); + } + SDL_FreeSurface(temp); + + /* We're ready to roll. :) */ + return (0); +} + void DrawOnViewport(SDL_Renderer * renderer) { @@ -180,9 +229,7 @@ main(int argc, char *argv[]) quit(2); } - sprite = LoadTexture(state->renderers[0], "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h); - - if (sprite == NULL) { + if (LoadSprite("icon.bmp", state->renderers[0]) < 0) { quit(2); }