浏览代码

obsolete file removal

AzaezelX 4 年之前
父节点
当前提交
80f184e73d
共有 28 个文件被更改,包括 0 次插入10371 次删除
  1. 0 119
      Engine/lib/sdl/SDL2.spec
  2. 0 79
      Engine/lib/sdl/acinclude/ax_gcc_x86_cpuid.m4.htm
  3. 0 4175
      Engine/lib/sdl/configure.in
  4. 0 784
      Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c
  5. 0 1066
      Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c
  6. 0 79
      Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h
  7. 0 863
      Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m
  8. 0 59
      Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h
  9. 0 65
      Engine/lib/sdl/src/video/khronos/vulkan/vulkan_mir.h
  10. 0 170
      Engine/lib/sdl/src/video/mir/SDL_mirdyn.c
  11. 0 53
      Engine/lib/sdl/src/video/mir/SDL_mirdyn.h
  12. 0 321
      Engine/lib/sdl/src/video/mir/SDL_mirevents.c
  13. 0 37
      Engine/lib/sdl/src/video/mir/SDL_mirevents.h
  14. 0 134
      Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c
  15. 0 47
      Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h
  16. 0 292
      Engine/lib/sdl/src/video/mir/SDL_mirmouse.c
  17. 0 37
      Engine/lib/sdl/src/video/mir/SDL_mirmouse.h
  18. 0 78
      Engine/lib/sdl/src/video/mir/SDL_miropengl.c
  19. 0 53
      Engine/lib/sdl/src/video/mir/SDL_miropengl.h
  20. 0 143
      Engine/lib/sdl/src/video/mir/SDL_mirsym.h
  21. 0 423
      Engine/lib/sdl/src/video/mir/SDL_mirvideo.c
  22. 0 49
      Engine/lib/sdl/src/video/mir/SDL_mirvideo.h
  23. 0 176
      Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c
  24. 0 52
      Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h
  25. 0 374
      Engine/lib/sdl/src/video/mir/SDL_mirwindow.c
  26. 0 93
      Engine/lib/sdl/src/video/mir/SDL_mirwindow.h
  27. 0 359
      Engine/lib/sdl/test/aclocal.m4
  28. 0 191
      Engine/lib/sdl/test/configure.in

+ 0 - 119
Engine/lib/sdl/SDL2.spec

@@ -1,119 +0,0 @@
-Summary: Simple DirectMedia Layer
-Name: SDL2
-Version: 2.0.12
-Release: 2
-Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
-URL: http://www.libsdl.org/
-License: zlib
-Group: System Environment/Libraries
-BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
-Prefix: %{_prefix}
-%ifos linux
-Provides: libSDL2-2.0.so.0
-%endif
-
-%define __defattr %defattr(-,root,root)
-%define __soext so
-
-%description
-This is the Simple DirectMedia Layer, a generic API that provides low
-level access to audio, keyboard, mouse, and display framebuffer across
-multiple platforms.
-
-%package devel
-Summary: Libraries, includes and more to develop SDL applications.
-Group: Development/Libraries
-Requires: %{name} = %{version}
-
-%description devel
-This is the Simple DirectMedia Layer, a generic API that provides low
-level access to audio, keyboard, mouse, and display framebuffer across
-multiple platforms.
-
-This is the libraries, include files and other resources you can use
-to develop SDL applications.
-
-
-%prep
-%setup -q 
-
-%build
-%ifos linux
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-directfb
-%else
-%configure
-%endif
-make
-
-%install
-rm -rf $RPM_BUILD_ROOT
-%ifos linux
-make install prefix=$RPM_BUILD_ROOT%{prefix} \
-             bindir=$RPM_BUILD_ROOT%{_bindir} \
-             libdir=$RPM_BUILD_ROOT%{_libdir} \
-             includedir=$RPM_BUILD_ROOT%{_includedir} \
-             datadir=$RPM_BUILD_ROOT%{_datadir} \
-             mandir=$RPM_BUILD_ROOT%{_mandir}
-%else
-%makeinstall
-%endif
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%{__defattr}
-%doc README*.txt COPYING.txt CREDITS.txt BUGS.txt
-%{_libdir}/lib*.%{__soext}.*
-
-%files devel
-%{__defattr}
-%doc docs/README*.md
-%{_bindir}/*-config
-%{_libdir}/lib*.a
-%{_libdir}/lib*.la
-%{_libdir}/lib*.%{__soext}
-%{_includedir}/*/*.h
-%{_libdir}/cmake/*
-%{_libdir}/pkgconfig/SDL2/*
-%{_datadir}/aclocal/*
-
-%changelog
-* Thu Jun 04 2015 Ryan C. Gordon <[email protected]>
-- Fixed README paths.
-
-* Sun Dec 07 2014 Simone Contini <[email protected]>
-- Fixed changelog date issue and docs filenames
-
-* Sun Jan 22 2012 Sam Lantinga <[email protected]>
-- Updated for SDL 2.0
-
-* Tue May 16 2006 Sam Lantinga <[email protected]>
-- Removed support for Darwin, due to build problems on ps2linux
-
-* Sat Jan 03 2004 Anders Bjorklund <[email protected]>
-- Added support for Darwin, updated spec file
-
-* Wed Jan 19 2000 Sam Lantinga <[email protected]>
-- Re-integrated spec file into SDL distribution
-- 'name' and 'version' come from configure 
-- Some of the documentation is devel specific
-- Removed SMP support from %build - it doesn't work with libtool anyway
-
-* Tue Jan 18 2000 Hakan Tandogan <[email protected]>
-- Hacked Mandrake sdl spec to build 1.1
-
-* Sun Dec 19 1999 John Buswell <[email protected]>
-- Build Release
-
-* Sat Dec 18 1999 John Buswell <[email protected]>
-- Add symlink for libSDL-1.0.so.0 required by sdlbomber
-- Added docs
-
-* Thu Dec 09 1999 Lenny Cartier <[email protected]>
-- v 1.0.0
-
-* Mon Nov  1 1999 Chmouel Boudjnah <[email protected]>
-- First spec file for Mandrake distribution.
-
-# end of file

+ 0 - 79
Engine/lib/sdl/acinclude/ax_gcc_x86_cpuid.m4.htm

@@ -1,79 +0,0 @@
-# ===========================================================================
-#     http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_GCC_X86_CPUID(OP)
-#
-# DESCRIPTION
-#
-#   On Pentium and later x86 processors, with gcc or a compiler that has a
-#   compatible syntax for inline assembly instructions, run a small program
-#   that executes the cpuid instruction with input OP. This can be used to
-#   detect the CPU type.
-#
-#   On output, the values of the eax, ebx, ecx, and edx registers are stored
-#   as hexadecimal strings as "eax:ebx:ecx:edx" in the cache variable
-#   ax_cv_gcc_x86_cpuid_OP.
-#
-#   If the cpuid instruction fails (because you are running a
-#   cross-compiler, or because you are not using gcc, or because you are on
-#   a processor that doesn't have this instruction), ax_cv_gcc_x86_cpuid_OP
-#   is set to the string "unknown".
-#
-#   This macro mainly exists to be used in AX_GCC_ARCHFLAG.
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Steven G. Johnson <[email protected]>
-#   Copyright (c) 2008 Matteo Frigo
-#
-#   This program is free software: you can redistribute it and/or modify it
-#   under the terms of the GNU General Public License as published by the
-#   Free Software Foundation, either version 3 of the License, or (at your
-#   option) any later version.
-#
-#   This program is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-#   Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License along
-#   with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#   As a special exception, the respective Autoconf Macro's copyright owner
-#   gives unlimited permission to copy, distribute and modify the configure
-#   scripts that are the output of Autoconf when processing the Macro. You
-#   need not follow the terms of the GNU General Public License when using
-#   or distributing such scripts, even though portions of the text of the
-#   Macro appear in them. The GNU General Public License (GPL) does govern
-#   all other use of the material that constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the Autoconf
-#   Macro released by the Autoconf Archive. When you make and distribute a
-#   modified version of the Autoconf Macro, you may extend this special
-#   exception to the GPL to apply to your modified version as well.
-
-#serial 7
-
-AC_DEFUN([AX_GCC_X86_CPUID],
-[AC_REQUIRE([AC_PROG_CC])
-AC_LANG_PUSH([C])
-AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1,
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [
-     int op = $1, eax, ebx, ecx, edx;
-     FILE *f;
-      __asm__("cpuid"
-        : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
-        : "a" (op));
-     f = fopen("conftest_cpuid", "w"); if (!f) return 1;
-     fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx);
-     fclose(f);
-     return 0;
-])],
-     [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid],
-     [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid],
-     [ax_cv_gcc_x86_cpuid_$1=unknown])])
-AC_LANG_POP([C])
-])

+ 0 - 4175
Engine/lib/sdl/configure.in

@@ -1,4175 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(README.txt)
-AC_CONFIG_HEADER(include/SDL_config.h)
-AC_CONFIG_AUX_DIR(build-scripts)
-AC_CONFIG_MACRO_DIR([acinclude])
-
-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
-#
-# 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=0
-SDL_MICRO_VERSION=8
-SDL_INTERFACE_AGE=0
-SDL_BINARY_AGE=8
-SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
-
-AC_SUBST(SDL_MAJOR_VERSION)
-AC_SUBST(SDL_MINOR_VERSION)
-AC_SUBST(SDL_MICRO_VERSION)
-AC_SUBST(SDL_INTERFACE_AGE)
-AC_SUBST(SDL_BINARY_AGE)
-AC_SUBST(SDL_VERSION)
-
-# libtool versioning
-LT_INIT([win32-dll])
-
-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)
-AC_SUBST(LT_CURRENT)
-AC_SUBST(LT_REVISION)
-AC_SUBST(LT_AGE)
-
-dnl Detect the canonical build and host environments
-dnl AC_CANONICAL_HOST
-
-dnl Check for tools
-AC_PROG_LIBTOOL
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-AC_CHECK_TOOL(WINDRES, [windres], [:])
-
-dnl Make sure that srcdir is a full pathname
-case "$host" in
-    *-*-mingw32*)
-        # Except on msys, where make can't handle full pathnames (bug 1972)
-        ;;
-    *)
-        srcdir=`cd $srcdir && pwd`
-        ;;
-esac
-
-dnl Set up the compiler and linker flags
-INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos"
-if test x$srcdir != x.; then
-    INCLUDE="-Iinclude $INCLUDE"
-elif test -d .hg; then
-    AC_MSG_ERROR([
-*** When building from Mercurial you should configure and build in a
-    separate directory so you don't clobber SDL_config.h, SDL_revision.h
-])
-fi
-BASE_CFLAGS=""
-BASE_LDFLAGS=""
-case "$host" in
-    *-*-cygwin*)
-        # We build SDL on cygwin without the UNIX emulation layer
-        save_CFLAGS="$CFLAGS"
-        have_no_cygwin=no
-        AC_MSG_CHECKING(for GCC -mno-cygwin option)
-        CFLAGS="$save_CFLAGS -mno-cygwin"
-
-        AC_TRY_COMPILE([
-        ],[
-        ],[
-        have_no_cygwin=yes
-        ])
-        AC_MSG_RESULT($have_no_cygwin)
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_no_cygwin = xyes; then
-            BASE_CFLAGS="-mno-cygwin"
-            BASE_LDFLAGS="-mno-cygwin"
-        fi
-        BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw"
-        ;;
-esac
-# Uncomment the following line if you want to force SDL and applications
-# built with it to be compiled for a particular architecture.
-#AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
-BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H"
-# The default optimization for SDL is -O3 (Bug #31)
-if test "x$orig_CFLAGS" = x; then
-    BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
-fi
-EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
-BUILD_LDFLAGS="$LDFLAGS"
-EXTRA_LDFLAGS="$BASE_LDFLAGS"
-## These are common directories to find software packages
-#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
-#    if test -d $path/include; then
-#        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
-#    fi
-#    if test -d $path/lib; then
-#        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
-#    fi
-#done
-SDL_CFLAGS="$BASE_CFLAGS"
-SDL_LIBS="-lSDL2 $BASE_LDFLAGS"
-CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
-CFLAGS="$CFLAGS $EXTRA_CFLAGS"
-LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
-
-dnl set this to use on systems that use lib64 instead of lib
-base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
-
-dnl Function to find a library in the compiler search path
-find_lib()
-{
-    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
-    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
-    env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
-    if test "$cross_compiling" = yes; then
-        host_lib_path=""
-    else
-        host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
-    fi
-    for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
-        lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
-        if test x$lib != x; then
-            echo $lib
-            return
-        fi
-    done
-}
-
-dnl Check for compiler characteristics
-AC_C_CONST
-AC_C_INLINE
-AC_C_VOLATILE
-
-dnl See whether we want assertions for debugging/sanity checking SDL itself.
-AC_ARG_ENABLE(assertions,
-AC_HELP_STRING([--enable-assertions],
-               [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
-              , enable_assertions=auto)
-case "$enable_assertions" in
-    auto) # Use optimization settings to determine assertion level
-        ;;
-    disabled)
-        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
-        ;;
-    release)
-        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
-        ;;
-    enabled)
-        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
-        ;;
-    paranoid)
-        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
-        ;;
-    *)
-        AC_MSG_ERROR([*** unknown assertion level. stop.])
-        ;;
-esac
-
-dnl See whether we can use gcc style dependency tracking
-AC_ARG_ENABLE(dependency-tracking,
-AC_HELP_STRING([--enable-dependency-tracking],
-               [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
-              , enable_dependency_tracking=yes)
-if test x$enable_dependency_tracking = xyes; then
-    have_gcc_mmd_mt=no
-    AC_MSG_CHECKING(for GCC -MMD -MT option)
-    AC_TRY_COMPILE([
-    #if !defined(__GNUC__) || __GNUC__ < 3
-    #error Dependency tracking requires GCC 3.0 or newer
-    #endif
-    ],[
-    ],[
-    have_gcc_mmd_mt=yes
-    ])
-    AC_MSG_RESULT($have_gcc_mmd_mt)
-
-    if test x$have_gcc_mmd_mt = xyes; then
-        DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
-    fi
-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.
-    *-*-openbsd*)
-        ;;
-
-    *)
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -Wl,--no-undefined"
-        AC_TRY_LINK([
-        ],[
-        ],[
-        have_no_undefined=yes
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined"
-        ])
-        LDFLAGS="$save_LDFLAGS"
-        ;;
-esac
-AC_MSG_RESULT($have_no_undefined)
-
-dnl See whether we are allowed to use the system C library
-AC_ARG_ENABLE(libc,
-AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
-              , enable_libc=yes)
-if test x$enable_libc = xyes; then
-    AC_DEFINE(HAVE_LIBC, 1, [ ])
-
-    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.
-    AC_TYPE_SIZE_T
-
-    dnl Check for defines
-    AC_CHECK_DEFINE(M_PI, math.h)
-
-    dnl Checks for library functions.
-    case "$host" in
-    *-*-cygwin* | *-*-mingw32*)
-        ;;
-    *)
-        AC_FUNC_ALLOCA
-        ;;
-    esac
-
-    AC_FUNC_MEMCMP
-    if test x$ac_cv_func_memcmp_working = xyes; then
-        AC_DEFINE(HAVE_MEMCMP, 1, [ ])
-    fi
-    AC_FUNC_STRTOD
-    if test x$ac_cv_func_strtod = xyes; then
-        AC_DEFINE(HAVE_STRTOD, 1, [ ])
-    fi
-    AC_CHECK_FUNC(mprotect,
-        AC_TRY_COMPILE([
-          #include <sys/types.h>
-          #include <sys/mman.h>
-        ],[
-        ],[
-        AC_DEFINE(HAVE_MPROTECT, 1, [ ])
-        ]),
-    )
-    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr 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 poll)
-
-    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 fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
-
-    AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
-    AC_CHECK_FUNCS(iconv)
-
-    AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
-
-	dnl Check for additional non-standard headers
-    AC_CHECK_HEADERS(libunwind.h)
-fi
-
-dnl AC_CHECK_SIZEOF(void*)
-
-dnl See whether we can use gcc atomic operations on this architecture
-AC_ARG_ENABLE(gcc-atomics,
-AC_HELP_STRING([--enable-gcc-atomics],
-               [Use gcc builtin atomics [[default=yes]]]),
-              , enable_gcc_atomics=yes)
-if test x$enable_gcc_atomics = xyes; then
-    have_gcc_atomics=no
-    AC_MSG_CHECKING(for GCC builtin atomic operations)
-    AC_TRY_LINK([
-    ],[
-    int a;
-    void *x, *y, *z;
-    __sync_lock_test_and_set(&a, 4);
-    __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);
-    ],[
-    have_gcc_atomics=yes
-    ])
-    AC_MSG_RESULT($have_gcc_atomics)
-
-    if test x$have_gcc_atomics = xyes; then
-        AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
-    else
-        # See if we have the minimum operation needed for GCC atomics
-        AC_TRY_LINK([
-        ],[
-        int a;
-        __sync_lock_test_and_set(&a, 1);
-        __sync_lock_release(&a);
-        ],[
-        have_gcc_sync_lock_test_and_set=yes
-        ])
-        if test x$have_gcc_sync_lock_test_and_set = xyes; then
-            AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
-        fi
-    fi
-fi
-
-# Standard C sources
-SOURCES="$SOURCES $srcdir/src/*.c"
-SOURCES="$SOURCES $srcdir/src/atomic/*.c"
-SOURCES="$SOURCES $srcdir/src/audio/*.c"
-SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
-SOURCES="$SOURCES $srcdir/src/dynapi/*.c"
-SOURCES="$SOURCES $srcdir/src/events/*.c"
-SOURCES="$SOURCES $srcdir/src/file/*.c"
-SOURCES="$SOURCES $srcdir/src/haptic/*.c"
-SOURCES="$SOURCES $srcdir/src/joystick/*.c"
-SOURCES="$SOURCES $srcdir/src/libm/*.c"
-SOURCES="$SOURCES $srcdir/src/power/*.c"
-#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
-SOURCES="$SOURCES $srcdir/src/render/*.c"
-SOURCES="$SOURCES $srcdir/src/render/*/*.c"
-SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
-SOURCES="$SOURCES $srcdir/src/thread/*.c"
-SOURCES="$SOURCES $srcdir/src/timer/*.c"
-SOURCES="$SOURCES $srcdir/src/video/*.c"
-SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
-
-dnl Enable/disable various subsystems of the SDL library
-
-AC_ARG_ENABLE(atomic,
-AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
-              , enable_atomic=yes)
-if test x$enable_atomic != xyes; then
-    AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} atomic"
-fi
-AC_ARG_ENABLE(audio,
-AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
-              , enable_audio=yes)
-if test x$enable_audio != xyes; then
-    AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} audio"
-fi
-AC_ARG_ENABLE(video,
-AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
-              , enable_video=yes)
-if test x$enable_video != xyes; then
-    AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} video"
-fi
-AC_ARG_ENABLE(render,
-AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
-              , enable_render=yes)
-if test x$enable_render != xyes; then
-    AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} render"
-fi
-AC_ARG_ENABLE(events,
-AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
-              , enable_events=yes)
-if test x$enable_events != xyes; then
-    AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} events"
-fi
-AC_ARG_ENABLE(joystick,
-AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
-              , enable_joystick=yes)
-if test x$enable_joystick != xyes; then
-    AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} joystick"
-fi
-AC_ARG_ENABLE(haptic,
-AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
-              , enable_haptic=yes)
-if test x$enable_haptic != xyes; then
-    AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} haptic"
-fi
-AC_ARG_ENABLE(power,
-AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
-              , enable_power=yes)
-if test x$enable_power != xyes; then
-    AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} power"
-fi
-AC_ARG_ENABLE(filesystem,
-AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
-              , enable_filesystem=yes)
-if test x$enable_filesystem != xyes; then
-    AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} filesystem"
-fi
-AC_ARG_ENABLE(threads,
-AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
-              , enable_threads=yes)
-if test x$enable_threads != xyes; then
-    AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} threads"
-fi
-AC_ARG_ENABLE(timers,
-AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
-              , enable_timers=yes)
-if test x$enable_timers != xyes; then
-    AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} timers"
-fi
-AC_ARG_ENABLE(file,
-AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
-              , enable_file=yes)
-if test x$enable_file != xyes; then
-    AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} file"
-fi
-AC_ARG_ENABLE(loadso,
-AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
-              , enable_loadso=yes)
-if test x$enable_loadso != xyes; then
-    AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} loadso"
-fi
-AC_ARG_ENABLE(cpuinfo,
-AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
-              , enable_cpuinfo=yes)
-if test x$enable_cpuinfo != xyes; then
-    AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
-else
-    SUMMARY_modules="${SUMMARY_modules} cpuinfo"
-fi
-AC_ARG_ENABLE(assembly,
-AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
-              , enable_assembly=yes)
-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
-        *-*-darwin*)
-            # Don't need to worry about Apple hardware, it's all SSE capable
-            default_ssemath=yes
-            ;;
-        *64-*-*)
-            # x86 64-bit architectures all have SSE instructions
-            default_ssemath=yes
-            ;;
-        *)
-            default_ssemath=no
-            ;;
-    esac
-    AC_ARG_ENABLE(ssemath,
-AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]),
-                  , enable_ssemath=$default_ssemath)
-    if test x$enable_ssemath = xno; then
-        if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
-        fi
-    fi
-
-    dnl Check for various instruction support
-    AC_ARG_ENABLE(mmx,
-AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
-                  , enable_mmx=yes)
-    if test x$enable_mmx = xyes; then
-        save_CFLAGS="$CFLAGS"
-        have_gcc_mmx=no
-        AC_MSG_CHECKING(for GCC -mmmx option)
-        mmx_CFLAGS="-mmmx"
-        CFLAGS="$save_CFLAGS $mmx_CFLAGS"
-
-        AC_TRY_COMPILE([
-        #ifdef __MINGW32__
-        #include <_mingw.h>
-        #ifdef __MINGW64_VERSION_MAJOR
-        #include <intrin.h>
-        #else
-        #include <mmintrin.h>
-        #endif
-        #else
-        #include <mmintrin.h>
-        #endif
-        #ifndef __MMX__
-        #error Assembler CPP flag not enabled
-        #endif
-        ],[
-        ],[
-        have_gcc_mmx=yes
-        ])
-        AC_MSG_RESULT($have_gcc_mmx)
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_gcc_mmx = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
-            SUMMARY_math="${SUMMARY_math} mmx"
-        fi
-    fi
-
-    AC_ARG_ENABLE(3dnow,
-AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
-                  , enable_3dnow=yes)
-    if test x$enable_3dnow = xyes; then
-        save_CFLAGS="$CFLAGS"
-        have_gcc_3dnow=no
-        AC_MSG_CHECKING(for GCC -m3dnow option)
-        amd3dnow_CFLAGS="-m3dnow"
-        CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
-
-        AC_TRY_LINK([
-        #include <mm3dnow.h>
-        #ifndef __3dNOW__
-        #error Assembler CPP flag not enabled
-        #endif
-        ],[
-        void *p = 0;
-        _m_prefetch(p);
-        ],[
-        have_gcc_3dnow=yes
-        ])
-        AC_MSG_RESULT($have_gcc_3dnow)
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_gcc_3dnow = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
-            SUMMARY_math="${SUMMARY_math} 3dnow"
-        fi
-    fi
-
-    AC_ARG_ENABLE(sse,
-AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
-                  , enable_sse=yes)
-    if test x$enable_sse = xyes; then
-        save_CFLAGS="$CFLAGS"
-        have_gcc_sse=no
-        AC_MSG_CHECKING(for GCC -msse option)
-        sse_CFLAGS="-msse"
-        CFLAGS="$save_CFLAGS $sse_CFLAGS"
-
-        AC_TRY_COMPILE([
-        #ifdef __MINGW32__
-        #include <_mingw.h>
-        #ifdef __MINGW64_VERSION_MAJOR
-        #include <intrin.h>
-        #else
-        #include <xmmintrin.h>
-        #endif
-        #else
-        #include <xmmintrin.h>
-        #endif
-        #ifndef __SSE__
-        #error Assembler CPP flag not enabled
-        #endif
-        ],[
-        ],[
-        have_gcc_sse=yes
-        ])
-        AC_MSG_RESULT($have_gcc_sse)
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_gcc_sse = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
-            SUMMARY_math="${SUMMARY_math} sse"
-        fi
-    fi
-
-    AC_ARG_ENABLE(sse2,
-AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]),
-                  , enable_sse2=$default_ssemath)
-    if test x$enable_sse2 = xyes; then
-        save_CFLAGS="$CFLAGS"
-        have_gcc_sse2=no
-        AC_MSG_CHECKING(for GCC -msse2 option)
-        sse2_CFLAGS="-msse2"
-        CFLAGS="$save_CFLAGS $sse2_CFLAGS"
-
-        AC_TRY_COMPILE([
-        #ifdef __MINGW32__
-        #include <_mingw.h>
-        #ifdef __MINGW64_VERSION_MAJOR
-        #include <intrin.h>
-        #else
-        #include <emmintrin.h>
-        #endif
-        #else
-        #include <emmintrin.h>
-        #endif
-        #ifndef __SSE2__
-        #error Assembler CPP flag not enabled
-        #endif
-        ],[
-        ],[
-        have_gcc_sse2=yes
-        ])
-        AC_MSG_RESULT($have_gcc_sse2)
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_gcc_sse2 = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
-            SUMMARY_math="${SUMMARY_math} sse2"
-        fi
-    fi
-
-    AC_ARG_ENABLE(sse3,
-AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]),
-                  , enable_sse3=$default_ssemath)
-    if test x$enable_sse3 = xyes; then
-        save_CFLAGS="$CFLAGS"
-        have_gcc_sse3=no
-        AC_MSG_CHECKING(for GCC -msse3 option)
-        sse3_CFLAGS="-msse3"
-        CFLAGS="$save_CFLAGS $sse3_CFLAGS"
-
-        AC_TRY_COMPILE([
-        #ifdef __MINGW32__
-        #include <_mingw.h>
-        #ifdef __MINGW64_VERSION_MAJOR
-        #include <intrin.h>
-        #else
-        #include <pmmintrin.h>
-        #endif
-        #else
-        #include <pmmintrin.h>
-        #endif
-        #ifndef __SSE2__
-        #error Assembler CPP flag not enabled
-        #endif
-        ],[
-        ],[
-        have_gcc_sse3=yes
-        ])
-        AC_MSG_RESULT($have_gcc_sse3)
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_gcc_sse3 = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS"
-            SUMMARY_math="${SUMMARY_math} sse3"
-        fi
-    fi
-
-    AC_CHECK_HEADER(immintrin.h,
-                    have_immintrin_h_hdr=yes,
-                    have_immintrin_h_hdr=no)
-    if test x$have_immintrin_h_hdr = xyes; then
-        AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ])
-    fi
-
-    AC_ARG_ENABLE(altivec,
-AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
-                  , enable_altivec=yes)
-    if test x$enable_altivec = xyes; then
-        save_CFLAGS="$CFLAGS"
-        have_gcc_altivec=no
-        have_altivec_h_hdr=no
-        altivec_CFLAGS="-maltivec"
-        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
-
-        AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
-        AC_TRY_COMPILE([
-        #include <altivec.h>
-        vector unsigned int vzero() {
-            return vec_splat_u32(0);
-        }
-        ],[
-        ],[
-        have_gcc_altivec=yes
-        have_altivec_h_hdr=yes
-        ])
-        AC_MSG_RESULT($have_gcc_altivec)
-
-        if test x$have_gcc_altivec = xno; then
-            AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
-            AC_TRY_COMPILE([
-            vector unsigned int vzero() {
-                return vec_splat_u32(0);
-            }
-            ],[
-            ],[
-            have_gcc_altivec=yes
-            ])
-            AC_MSG_RESULT($have_gcc_altivec)
-        fi
-
-        if test x$have_gcc_altivec = xno; then
-            AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
-            altivec_CFLAGS="-faltivec"
-            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
-            AC_TRY_COMPILE([
-            #include <altivec.h>
-            vector unsigned int vzero() {
-                return vec_splat_u32(0);
-            }
-            ],[
-            ],[
-            have_gcc_altivec=yes
-            have_altivec_h_hdr=yes
-            ])
-            AC_MSG_RESULT($have_gcc_altivec)
-        fi
-
-        if test x$have_gcc_altivec = xno; then
-            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
-            AC_TRY_COMPILE([
-            vector unsigned int vzero() {
-                return vec_splat_u32(0);
-            }
-            ],[
-            ],[
-            have_gcc_altivec=yes
-            ])
-            AC_MSG_RESULT($have_gcc_altivec)
-        fi
-        CFLAGS="$save_CFLAGS"
-
-        if test x$have_gcc_altivec = xyes; then
-            AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
-            if test x$have_altivec_h_hdr = xyes; then
-              AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
-            fi
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
-            SUMMARY_math="${SUMMARY_math} altivec"
-        fi
-    fi
-fi
-
-dnl See if the OSS audio interface is supported
-CheckOSS()
-{
-    AC_ARG_ENABLE(oss,
-AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
-                  , enable_oss=maybe)
-
-    # OpenBSD "has" OSS, but it's not really for app use. They want you to
-    #  use sndio instead. So on there, we default to disabled. You can force
-    #  it on if you really want, though.
-    if test x$enable_oss = xmaybe; then
-        enable_oss=yes
-        case "$host" in
-            *-*-openbsd*)
-                enable_oss=no;;
-        esac
-    fi
-
-    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
-        AC_MSG_CHECKING(for OSS audio support)
-        have_oss=no
-        if test x$have_oss != xyes; then
-            AC_TRY_COMPILE([
-              #include <sys/soundcard.h>
-            ],[
-              int arg = SNDCTL_DSP_SETFRAGMENT;
-            ],[
-            have_oss=yes
-            ])
-        fi
-        if test x$have_oss != xyes; then
-            AC_TRY_COMPILE([
-              #include <soundcard.h>
-            ],[
-              int arg = SNDCTL_DSP_SETFRAGMENT;
-            ],[
-            have_oss=yes
-            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
-            ])
-        fi
-        AC_MSG_RESULT($have_oss)
-        if test x$have_oss = xyes; then
-            SUMMARY_audio="${SUMMARY_audio} oss"
-            AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
-            have_audio=yes
-
-            # We may need to link with ossaudio emulation library
-            case "$host" in
-                *-*-openbsd*|*-*-netbsd*)
-                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
-            esac
-        fi
-    fi
-}
-
-dnl See if the ALSA audio interface is supported
-CheckALSA()
-{
-    AC_ARG_ENABLE(alsa,
-AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
-                  , enable_alsa=yes)
-    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
-        AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no)
-        # Restore all flags from before the ALSA detection runs
-        CFLAGS="$alsa_save_CFLAGS"
-        LDFLAGS="$alsa_save_LDFLAGS"
-        LIBS="$alsa_save_LIBS"
-        if test x$have_alsa = xyes; then
-            AC_ARG_ENABLE(alsa-shared,
-AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
-                          , enable_alsa_shared=yes)
-            alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
-            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
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
-                echo "-- dynamic libasound -> $alsa_lib"
-                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
-                SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)"
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
-                SUMMARY_audio="${SUMMARY_audio} alsa"
-            fi
-            have_audio=yes
-        fi
-    fi
-}
-
-dnl Find JACK Audio
-CheckJACK()
-{
-    AC_ARG_ENABLE(jack,
-AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]),
-                  , enable_jack=yes)
-    if test x$enable_audio = xyes -a x$enable_jack = xyes; then
-        audio_jack=no
-
-        JACK_REQUIRED_VERSION=0.125
-
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support)
-        if test x$PKG_CONFIG != xno; then
-        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then
-                JACK_CFLAGS=`$PKG_CONFIG --cflags jack`
-                JACK_LIBS=`$PKG_CONFIG --libs jack`
-                audio_jack=yes
-            fi
-        fi
-        AC_MSG_RESULT($audio_jack)
-
-        if test x$audio_jack = xyes; then
-            AC_ARG_ENABLE(jack-shared,
-AC_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]),
-                          , enable_jack_shared=yes)
-            jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-            AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ])
-            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
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_jack_shared = xyes && test x$jack_lib != x; then
-                echo "-- dynamic libjack -> $jack_lib"
-                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ])
-                SUMMARY_audio="${SUMMARY_audio} jack(dynamic)"
-
-                case "$host" in
-                    # On Solaris, jack must be linked deferred explicitly
-                    # to prevent undefined symbol failures.
-                    *-*-solaris*)
-                        JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'`
-                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred"
-                esac
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS"
-                SUMMARY_audio="${SUMMARY_audio} jack"
-            fi
-            have_audio=yes
-        fi
-    fi
-}
-
-dnl Find the ESD includes and libraries
-CheckESD()
-{
-    AC_ARG_ENABLE(esd,
-AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
-                  , enable_esd=yes)
-    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
-        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
-        if test x$have_esd = xyes; then
-            AC_ARG_ENABLE(esd-shared,
-AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
-                          , enable_esd_shared=yes)
-            esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-            AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
-            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
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
-                echo "-- dynamic libesd -> $esd_lib"
-                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
-                SUMMARY_audio="${SUMMARY_audio} esd(dynamic)"
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
-                SUMMARY_audio="${SUMMARY_audio} esd"
-            fi
-            have_audio=yes
-        fi
-    fi
-}
-
-dnl Find PulseAudio
-CheckPulseAudio()
-{
-    AC_ARG_ENABLE(pulseaudio,
-AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
-                  , enable_pulseaudio=yes)
-    if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
-        audio_pulseaudio=no
-
-        PULSEAUDIO_REQUIRED_VERSION=0.9
-
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
-        if test x$PKG_CONFIG != xno; then
-        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
-                PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
-                PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
-                audio_pulseaudio=yes
-            fi
-        fi
-        AC_MSG_RESULT($audio_pulseaudio)
-
-        if test x$audio_pulseaudio = xyes; then
-            AC_ARG_ENABLE(pulseaudio-shared,
-AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
-                          , enable_pulseaudio_shared=yes)
-            pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-            AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
-            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
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
-            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"
-                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
-                SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)"
-
-                case "$host" in
-                    # On Solaris, pulseaudio must be linked deferred explicitly
-                    # to prevent undefined symbol failures.
-                    *-*-solaris*)
-                        PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
-                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
-                esac
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
-                SUMMARY_audio="${SUMMARY_audio} pulse"
-            fi
-            have_audio=yes
-        fi
-    fi
-}
-
-CheckARTSC()
-{
-    AC_ARG_ENABLE(arts,
-AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
-                  , enable_arts=yes)
-    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
-        AC_PATH_PROG(ARTSCONFIG, artsc-config)
-        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
-            : # arts isn't installed
-        else
-            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
-            ARTS_LIBS=`$ARTSCONFIG --libs`
-            AC_MSG_CHECKING(for aRts development environment)
-            audio_arts=no
-            save_CFLAGS="$CFLAGS"
-            CFLAGS="$CFLAGS $ARTS_CFLAGS"
-            AC_TRY_COMPILE([
-             #include <artsc.h>
-            ],[
-             arts_stream_t stream;
-            ],[
-            audio_arts=yes
-            ])
-            CFLAGS="$save_CFLAGS"
-            AC_MSG_RESULT($audio_arts)
-            if test x$audio_arts = xyes; then
-                AC_ARG_ENABLE(arts-shared,
-AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
-                              , enable_arts_shared=yes)
-                arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
-                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
-                    AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
-                fi
-                if test x$have_loadso = xyes && \
-                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
-                    echo "-- dynamic libartsc -> $arts_lib"
-                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
-                    SUMMARY_audio="${SUMMARY_audio} arts(dynamic)"
-                else
-                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
-                    SUMMARY_audio="${SUMMARY_audio} arts"
-                fi
-                have_audio=yes
-            fi
-        fi
-    fi
-}
-
-dnl See if the NAS audio interface is supported
-CheckNAS()
-{
-    AC_ARG_ENABLE(nas,
-AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
-                  , enable_nas=yes)
-    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
-        AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
-        AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
-
-        AC_MSG_CHECKING(for NAS audio support)
-        have_nas=no
-
-        if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
-            have_nas=yes
-            NAS_LIBS="-laudio"
-
-        elif test -r /usr/X11R6/include/audio/audiolib.h; then
-            have_nas=yes
-            NAS_CFLAGS="-I/usr/X11R6/include/"
-            NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
-
-        fi
-
-        AC_MSG_RESULT($have_nas)
-
-        if test x$have_nas = xyes; then
-            AC_ARG_ENABLE(nas-shared,
-AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
-                          , enable_nas_shared=yes)
-            nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-            if test x$have_loadso != xyes && \
-               test x$enable_nas_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_nas_shared = xyes && test x$nas_lib != x; then
-                echo "-- dynamic libaudio -> $nas_lib"
-                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
-                SUMMARY_audio="${SUMMARY_audio} nas(dynamic)"
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
-                SUMMARY_audio="${SUMMARY_audio} nas"
-            fi
-
-            AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
-            have_audio=yes
-        fi
-    fi
-}
-
-dnl See if the sndio audio interface is supported
-CheckSNDIO()
-{
-    AC_ARG_ENABLE(sndio,
-AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
-                  , enable_sndio=yes)
-    if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
-        AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
-        AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
-
-        AC_MSG_CHECKING(for sndio audio support)
-        have_sndio=no
-
-        if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
-            have_sndio=yes
-            SNDIO_LIBS="-lsndio"
-        fi
-
-        AC_MSG_RESULT($have_sndio)
-
-        if test x$have_sndio = xyes; then
-            AC_ARG_ENABLE(sndio-shared,
-AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
-                          , enable_sndio_shared=yes)
-            sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-            if test x$have_loadso != xyes && \
-               test x$enable_sndio_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
-                echo "-- dynamic libsndio -> $sndio_lib"
-                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
-                SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)"
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
-                SUMMARY_audio="${SUMMARY_audio} sndio"
-            fi
-
-            AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
-            have_audio=yes
-        fi
-    fi
-}
-
-dnl Find FusionSound
-CheckFusionSound()
-{
-    AC_ARG_ENABLE(fusionsound,
-AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
-                  , enable_fusionsound=no)
-    if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
-        fusionsound=no
-
-        FUSIONSOUND_REQUIRED_VERSION=1.1.1
-
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
-        if test x$PKG_CONFIG != xno; then
-            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
-                FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
-                FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
-                fusionsound=yes
-            fi
-        fi
-        AC_MSG_RESULT($fusionsound)
-
-        if test x$fusionsound = xyes; then
-            AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
-            
-            AC_ARG_ENABLE(fusionsound-shared,
-AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
-                          , enable_fusionsound_shared=yes)
-            fusionsound_shared=no
-            AC_MSG_CHECKING(for FusionSound dynamic loading support)
-            if test x$have_loadso != xyes && \
-               test x$enable_fusionsound_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_fusionsound_shared = xyes; then
-                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
-                fusionsound_shared=yes
-                SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
-                SUMMARY_audio="${SUMMARY_audio} fusionsound"
-            fi
-            AC_MSG_RESULT($fusionsound_shared)
-            
-            have_audio=yes
-        fi
-    fi
-}
-
-dnl rcg07142001 See if the user wants the disk writer audio driver...
-CheckDiskAudio()
-{
-    AC_ARG_ENABLE(diskaudio,
-AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
-                  , enable_diskaudio=yes)
-    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
-        AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
-        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
-        SUMMARY_audio="${SUMMARY_audio} disk"
-    fi
-}
-
-dnl rcg03142006 See if the user wants the dummy audio driver...
-CheckDummyAudio()
-{
-    AC_ARG_ENABLE(dummyaudio,
-AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
-                  , enable_dummyaudio=yes)
-    if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
-        AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
-        SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
-        SUMMARY_audio="${SUMMARY_audio} dummy"
-    fi
-}
-
-dnl See if libsamplerate is available
-CheckLibSampleRate()
-{
-    AC_ARG_ENABLE(libsamplerate,
-AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]),
-                  , enable_libsamplerate=yes)
-    if test x$enable_libsamplerate = xyes; then
-        AC_CHECK_HEADER(samplerate.h,
-                        have_samplerate_h_hdr=yes,
-                        have_samplerate_h_hdr=no)
-        if test x$have_samplerate_h_hdr = xyes; then
-            AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ])
-
-            AC_ARG_ENABLE(libsamplerate-shared,
-AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]),
-                          , enable_libsamplerate_shared=yes)
-
-            samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-            if test x$have_loadso != xyes && \
-               test x$enable_libsamplerate_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then
-                echo "-- dynamic libsamplerate -> $samplerate_lib"
-                AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ])
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate"
-            fi
-        fi
-    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()
-{
-    AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
-    have_gcc_fvisibility=no
-
-    visibility_CFLAGS="-fvisibility=hidden"
-    save_CFLAGS="$CFLAGS"
-    CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
-    AC_TRY_COMPILE([
-    #if !defined(__GNUC__) || __GNUC__ < 4
-    #error SDL only uses visibility attributes in GCC 4 or newer
-    #endif
-    ],[
-    ],[
-    have_gcc_fvisibility=yes
-    ])
-    AC_MSG_RESULT($have_gcc_fvisibility)
-    CFLAGS="$save_CFLAGS"
-
-    if test x$have_gcc_fvisibility = xyes; then
-        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
-    fi
-}
-
-dnl See if GCC's -mpreferred-stack-boundary is supported.
-dnl  Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
-CheckStackBoundary()
-{
-    AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
-    have_gcc_preferred_stack_boundary=no
-
-    save_CFLAGS="$CFLAGS"
-    CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
-    AC_TRY_COMPILE([
-    int x = 0;
-    ],[
-    ],[
-    have_gcc_preferred_stack_boundary=yes
-    ])
-    AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
-    CFLAGS="$save_CFLAGS"
-
-    if test x$have_gcc_preferred_stack_boundary = xyes; then
-        EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
-    fi
-}
-
-dnl See if GCC's -Wdeclaration-after-statement is supported.
-dnl  This lets us catch things that would fail on a C89 compiler when using
-dnl  a modern GCC.
-CheckDeclarationAfterStatement()
-{
-    AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option)
-    have_gcc_declaration_after_statement=no
-
-    save_CFLAGS="$CFLAGS"
-    CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
-    AC_TRY_COMPILE([
-    int x = 0;
-    ],[
-    ],[
-    have_gcc_declaration_after_statement=yes
-    ])
-    AC_MSG_RESULT($have_gcc_declaration_after_statement)
-    CFLAGS="$save_CFLAGS"
-
-    if test x$have_gcc_declaration_after_statement = xyes; then
-        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
-    fi
-}
-
-dnl See if GCC's -Wall is supported.
-CheckWarnAll()
-{
-    AC_MSG_CHECKING(for GCC -Wall option)
-    have_gcc_Wall=no
-
-    save_CFLAGS="$CFLAGS"
-    CFLAGS="$save_CFLAGS -Wall"
-    AC_TRY_COMPILE([
-    int x = 0;
-    ],[
-    ],[
-    have_gcc_Wall=yes
-    ])
-    AC_MSG_RESULT($have_gcc_Wall)
-    CFLAGS="$save_CFLAGS"
-
-    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.
-        AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
-        need_gcc_Wno_multichar=no
-        case "$host" in
-            *-*-haiku*)
-                need_gcc_Wno_multichar=yes
-                ;;
-        esac
-        AC_MSG_RESULT($need_gcc_Wno_multichar)
-        if test x$need_gcc_Wno_multichar = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
-        fi
-    fi
-}
-
-dnl Check for Wayland
-CheckWayland()
-{
-    AC_ARG_ENABLE(video-wayland,
-AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]),
-                  ,enable_video_wayland=yes)
-
-    AC_ARG_ENABLE(video-wayland-qt-touch,
-AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]),
-                  ,enable_video_wayland_qt_touch=yes)
-
-    if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        AC_MSG_CHECKING(for Wayland support)
-        video_wayland=no
-        if  test x$PKG_CONFIG != xno && \
-            test x$video_opengl_egl = xyes && \
-            test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; 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`
-                WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client`
-                WAYLAND_PROTOCOLS_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
-                video_wayland=yes
-            fi
-        fi
-        AC_MSG_RESULT($video_wayland)
-
-        if test x$video_wayland = xyes; then
-            AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
-            if test x$enable_video_wayland_qt_touch = xyes; then
-                AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
-            fi
-
-            WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1 xdg-shell-unstable-v6"
-
-            SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
-            AC_ARG_ENABLE(wayland-shared,
-AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
-                          , enable_wayland_shared=maybe)
-
-            dnl FIXME: Do BSD and OS X need special cases?
-            case "$host" in
-                *)
-                    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
-                        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'`]
-                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-                    ;;
-            esac
-
-            if test x$enable_wayland_shared = xmaybe; then
-                enable_wayland_shared=yes
-            fi
-            if test x$have_loadso != xyes && \
-               test x$enable_wayland_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Wayland loading])
-                enable_wayland_shared=no
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_wayland_shared = xyes && \
-               test x$wayland_client_lib != x && \
-               test x$wayland_egl_lib != x && \
-               test x$wayland_cursor_lib != x && \
-               test x$xkbcommon_lib != x; then
-                echo "-- dynamic libwayland-client -> $wayland_client_lib"
-                echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
-                echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
-                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
-                SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
-            else
-                enable_wayland_shared=no
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
-                SUMMARY_video="${SUMMARY_video} wayland"
-            fi
-            have_video=yes
-        fi
-    fi
-}
-
-dnl Check for Mir
-CheckMir()
-{
-    AC_ARG_ENABLE(video-mir,
-AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=no]]]),
-                  ,enable_video_mir=no)
-
-    if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        AC_MSG_CHECKING(for Mir support)
-        video_mir=no
-        if test x$PKG_CONFIG != xno; then
-            if $PKG_CONFIG --exists mirclient egl xkbcommon ; then
-                MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon`
-                MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
-                save_CFLAGS="$CFLAGS"
-                CFLAGS="$save_CFLAGS $MIR_CFLAGS"
-
-                dnl This will disable Mir if >= v0.26 is not available
-                AC_TRY_COMPILE([
-                #include <mir_toolkit/mir_client_library.h>
-                ],[
-                    MirWindowAttrib attrib = mir_window_attrib_state
-                ],[
-                video_mir=yes
-                ])
-                CFLAGS="$save_CFLAGS"
-            fi
-        fi
-        AC_MSG_RESULT($video_mir)
-
-        if test x$video_mir = xyes; then
-            AC_DEFINE(SDL_VIDEO_DRIVER_MIR, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS"
-            AC_ARG_ENABLE(mir-shared,
-AC_HELP_STRING([--enable-mir-shared], [dynamically load Mir support [[default=maybe]]]),
-                          , enable_mir_shared=maybe)
-
-            dnl FIXME: Do BSD and OS X need special cases?
-            case "$host" in
-                *)
-                    mirclient_lib=[`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
-                    ;;
-            esac
-
-            if test x$enable_mir_shared = xmaybe; then
-                enable_mir_shared=yes
-            fi
-            if test x$have_loadso != xyes && \
-               test x$enable_mir_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Mir loading])
-                enable_mir_shared=no
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_mir_shared = xyes && \
-               test x$mirclient_lib != x && \
-               test x$xkbcommon_lib != x; then
-                echo "-- dynamic libmirclient -> $mirclient_lib"
-                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC, "$mirclient_lib", [ ])
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
-                SUMMARY_video="${SUMMARY_video} mir(dynamic)"
-            else
-                enable_mir_shared=no
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS"
-                SUMMARY_video="${SUMMARY_video} mir"
-            fi
-            have_video=yes
-        fi
-    fi
-}
-
-dnl Check for Native Client stuff
-CheckNativeClient()
-{
-        AC_TRY_COMPILE([
-          #if !defined(__native_client__)
-          #error "NO NACL"
-          #endif
-        ],[
-        ],[
-        AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ])
-        AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ])
-        AC_DEFINE(HAVE_POW, 1, [ ])
-        AC_DEFINE(HAVE_OPENGLES2, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
-
-        SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS"
-
-        SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
-        SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
-        SUMMARY_audio="${SUMMARY_audio} nacl"
-        SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
-        SUMMARY_video="${SUMMARY_video} nacl opengles2"
-        ])
-}
-
-
-CheckRPI()
-{
-    AC_ARG_ENABLE(video-rpi,
-AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
-                  , enable_video_rpi=yes)
-    if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then
-            RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl`
-            RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl`
-        elif test x$ARCH = xnetbsd; then
-            RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
-            RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
-        else
-            RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
-            RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
-        fi
-
-        # Save the original compiler flags and libraries
-        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
-
-        # Add the Raspberry Pi compiler flags and libraries
-        CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
-
-        AC_MSG_CHECKING(for Raspberry Pi)
-        have_video_rpi=no
-        AC_TRY_LINK([
-          #include <bcm_host.h>
-        ],[
-          bcm_host_init();
-        ],[
-        have_video_rpi=yes
-        ],[
-        ])
-        AC_MSG_RESULT($have_video_rpi)
-
-        # Restore the compiler flags and libraries
-        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
-        
-        if test x$have_video_rpi = xyes; then
-            CFLAGS="$CFLAGS $RPI_CFLAGS"
-            SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
-            SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
-            AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
-            SUMMARY_video="${SUMMARY_video} rpi"
-        fi
-    fi
-}
-
-dnl Find the X11 include and library directories
-CheckX11()
-{
-    AC_ARG_ENABLE(video-x11,
-AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
-                  , enable_video_x11=yes)
-    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
-        case "$host" in
-            *-*-darwin*)
-                # This isn't necessary for X11, but fixes GLX detection
-                if test "x$x_includes" = xNONE && \
-                   test "x$x_libraries" = xNONE && \
-                   test -d /usr/X11R6/include && \
-                   test -d /usr/X11R6/lib; then
-                    x_includes="/usr/X11R6/include"
-                    x_libraries="/usr/X11R6/lib"
-                fi
-                ;;
-        esac
-        AC_PATH_X
-        AC_PATH_XTRA
-        if test x$have_x = xyes; then
-            AC_ARG_ENABLE(x11-shared,
-AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
-                          , enable_x11_shared=maybe)
-
-            case "$host" in
-                *-*-darwin*)
-                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
-                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
-                    xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
-                    xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
-                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
-                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
-                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
-                    xss_lib='/usr/X11R6/lib/libXss.1.dylib'
-                    xvidmode_lib='/usr/X11R6/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'
-                    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'`]
-                    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
-
-            if test x$ac_cv_func_shmat != xyes; then
-                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
-            fi
-            CFLAGS="$CFLAGS $X_CFLAGS"
-            LDFLAGS="$LDFLAGS $X_LIBS"
-
-            AC_CHECK_HEADER(X11/extensions/Xext.h,
-                            have_xext_h_hdr=yes,
-                            have_xext_h_hdr=no,
-                            [#include <X11/Xlib.h>
-                             #include <X11/Xproto.h>
-                            ])
-            if test x$have_xext_h_hdr != xyes; then
-               AC_MSG_ERROR([
-*** Missing Xext.h, maybe you need to install the libxext-dev package?
-               ])
-            fi
-
-            AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
-
-            # Needed so SDL applications can include SDL_syswm.h
-            SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
-
-            if test x$enable_x11_shared = xmaybe; then
-                enable_x11_shared=yes
-            fi
-            if test x$have_loadso != xyes && \
-               test x$enable_x11_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
-                enable_x11_shared=no
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
-                echo "-- dynamic libX11 -> $x11_lib"
-                echo "-- dynamic libX11ext -> $x11ext_lib"
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
-                SUMMARY_video="${SUMMARY_video} x11(dynamic)"
-            else
-                enable_x11_shared=no
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
-                SUMMARY_video="${SUMMARY_video} x11"
-            fi
-            have_video=yes
-
-            AC_MSG_CHECKING(for const parameter to XextAddDisplay)
-            have_const_param_XextAddDisplay=no
-            AC_TRY_COMPILE([
-              #include <X11/Xlib.h>
-              #include <X11/Xproto.h>
-              #include <X11/extensions/Xext.h>
-              #include <X11/extensions/extutil.h>
-              extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
-            ],[
-            ],[
-            have_const_param_XextAddDisplay=yes
-            AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ])
-            ])
-            AC_MSG_RESULT($have_const_param_XextAddDisplay)
-
-            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_TRY_COMPILE([
-              	#include <X11/Xlib.h>
-            ],[
-Display *display;
-XEvent event;
-XGenericEventCookie *cookie = &event.xcookie;
-XNextEvent(display, &event);
-XGetEventData(display, cookie);
-XFreeEventData(display, cookie);
-            ],[
-                have_XGenericEvent=yes
-                AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ])
-            ])
-            AC_MSG_RESULT($have_XGenericEvent)
-
-            AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
-
-            AC_ARG_ENABLE(video-x11-xcursor,
-AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
-                            , enable_video_x11_xcursor=yes)
-            if test x$enable_video_x11_xcursor = xyes; then
-                definitely_enable_video_x11_xcursor=no
-                AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
-                                have_xcursor_h_hdr=yes,
-                                have_xcursor_h_hdr=no,
-                                [#include <X11/Xlib.h>
-                                ])
-                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"
-                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
-                        definitely_enable_video_x11_xcursor=yes
-                    else
-                        AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
-                        if test x$have_xcursor_lib = xyes ; then
-                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
-                            definitely_enable_video_x11_xcursor=yes
-                        fi
-                    fi
-                fi
-            fi
-            if test x$definitely_enable_video_x11_xcursor = xyes; then
-                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
-                SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
-            fi
-            AC_ARG_ENABLE(video-x11-xdbe,
-AC_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]),
-                            , enable_video_x11_xdbe=yes)
-            if test x$enable_video_x11_xdbe = xyes; then
-                AC_CHECK_HEADER(X11/extensions/Xdbe.h,
-                                have_dbe_h_hdr=yes,
-                                have_dbe_h_hdr=no,
-                                [#include <X11/Xlib.h>
-                                ])
-                if test x$have_dbe_h_hdr = xyes; then
-                    AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ])
-                    SUMMARY_video_x11="${SUMMARY_video_x11} xdbe"
-                fi
-            fi
-            AC_ARG_ENABLE(video-x11-xinerama,
-AC_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 <X11/Xlib.h>
-                                ])
-                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,
-AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
-                            , enable_video_x11_xinput=yes)
-            if test x$enable_video_x11_xinput = xyes; then
-                definitely_enable_video_x11_xinput=no
-                AC_CHECK_HEADER(X11/extensions/XInput2.h,
-                                have_xinput_h_hdr=yes,
-                                have_xinput_h_hdr=no,
-                                [#include <X11/Xlib.h>
-                                ])
-                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"
-                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
-                        definitely_enable_video_x11_xinput=yes
-                    else
-                        AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
-                        if test x$have_xinput_lib = xyes ; then
-                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
-                            definitely_enable_video_x11_xinput=yes
-                        fi
-                    fi
-                fi
-            fi
-            if test x$definitely_enable_video_x11_xinput = xyes; then
-                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
-                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
-                AC_MSG_CHECKING(for xinput2 multitouch)
-            	have_xinput2_multitouch=no
-            	AC_TRY_COMPILE([
-              		#include <X11/Xlib.h>
-             		#include <X11/Xproto.h>
-			#include <X11/extensions/XInput2.h>
-            	],[
-int event_type = XI_TouchBegin;
-XITouchClassInfo *t;
-            	],[
-            	have_xinput2_multitouch=yes
-            	AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [])
-                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
-            	])
-            	AC_MSG_RESULT($have_xinput2_multitouch)
-            fi
-            AC_ARG_ENABLE(video-x11-xrandr,
-AC_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.
-                definitely_enable_video_x11_xrandr=no
-                have_xrandr_h_hdr=no
-                AC_TRY_COMPILE([
-                #include <X11/Xlib.h>
-                #include <X11/extensions/Xrandr.h>
-                ],[
-                XRRScreenResources *res = NULL;
-                ],[
-                have_xrandr_h_hdr=yes
-                ])
-                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"
-                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
-                        definitely_enable_video_x11_xrandr=yes
-                    else
-                        AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
-                        if test x$have_xrandr_lib = xyes ; then
-                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
-                            definitely_enable_video_x11_xrandr=yes
-                        fi
-                    fi
-                fi
-            fi
-            if test x$definitely_enable_video_x11_xrandr = xyes; then
-                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
-                SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
-            fi
-            AC_ARG_ENABLE(video-x11-scrnsaver,
-AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
-                            , enable_video_x11_scrnsaver=yes)
-            if test x$enable_video_x11_scrnsaver = xyes; then
-                AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
-                                have_scrnsaver_h_hdr=yes,
-                                have_scrnsaver_h_hdr=no,
-                                [#include <X11/Xlib.h>
-                                ])
-                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"
-                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
-                        definitely_enable_video_x11_scrnsaver=yes
-                    else
-                        AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
-                        if test x$have_xss_lib = xyes ; then
-                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
-                            definitely_enable_video_x11_scrnsaver=yes
-                        fi
-                    fi
-                fi
-            fi
-            if test x$definitely_enable_video_x11_scrnsaver = xyes; then
-                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
-                SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
-            fi
-            AC_ARG_ENABLE(video-x11-xshape,
-AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
-                            , enable_video_x11_xshape=yes)
-            if test x$enable_video_x11_xshape = xyes; then
-                AC_CHECK_HEADER(X11/extensions/shape.h,
-                                have_shape_h_hdr=yes,
-                                have_shape_h_hdr=no,
-                                [#include <X11/Xlib.h>
-                                ])
-                if test x$have_shape_h_hdr = xyes; then
-                    AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
-                    SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
-                fi
-            fi
-            AC_ARG_ENABLE(video-x11-vm,
-AC_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 <X11/Xlib.h>
-                                ])
-                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
-}
-
-dnl Set up the Vivante video driver if enabled
-CheckVivanteVideo()
-{
-    AC_ARG_ENABLE(video-vivante,
-AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]),
-                  , enable_video_vivante=yes)
-    if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then
-        AC_MSG_CHECKING(for Vivante VDK API)
-        have_vivante_vdk=no
-        AC_TRY_COMPILE([
-          #define LINUX
-          #define EGL_API_FB
-          #include <gc_vdk.h>
-        ],[
-        ],[
-        have_vivante_vdk=yes
-        ])
-        AC_MSG_RESULT($have_vivante_vdk)
-
-        AC_MSG_CHECKING(for Vivante FB API)
-        have_vivante_egl=no
-        AC_TRY_COMPILE([
-          #define LINUX
-          #define EGL_API_FB
-          #include <EGL/eglvivante.h>
-        ],[
-        ],[
-        have_vivante_egl=yes
-        ])
-        AC_MSG_RESULT($have_vivante_egl)
-
-        if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then
-            AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ])
-            EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
-            if test x$have_vivante_vdk = xyes; then
-                AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ])
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK"
-            fi
-            SOURCES="$SOURCES $srcdir/src/video/vivante/*.c"
-            SUMMARY_video="${SUMMARY_video} vivante"
-            have_video=yes
-        fi
-    fi
-}
-
-dnl Set up the Haiku video driver if enabled
-CheckHaikuVideo()
-{
-    if test x$enable_video = xyes; then
-        AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
-        SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
-        have_video=yes
-        SUMMARY_video="${SUMMARY_video} haiku"
-    fi
-}
-
-dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
-CheckCOCOA()
-{
-    AC_ARG_ENABLE(video-cocoa,
-AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
-                  , 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
-        CFLAGS="$CFLAGS -x objective-c"
-        AC_MSG_CHECKING(for Cocoa framework)
-        have_cocoa=no
-        AC_TRY_COMPILE([
-          #import <Cocoa/Cocoa.h>
-        ],[
-        ],[
-        have_cocoa=yes
-        ])
-        AC_MSG_RESULT($have_cocoa)
-        CFLAGS="$save_CFLAGS"
-        if test x$have_cocoa = xyes; then
-            AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
-            SUMMARY_video="${SUMMARY_video} cocoa"
-            have_video=yes
-        fi
-    fi
-}
-
-CheckMETAL()
-{
-    AC_ARG_ENABLE(render-metal,
-AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]),
-                                , enable_render_metal=yes)
-    if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
-        save_CFLAGS="$CFLAGS"
-        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
-        AC_TRY_COMPILE([
-          #import <Cocoa/Cocoa.h>
-          #import <Metal/Metal.h>
-          #import <QuartzCore/CAMetalLayer.h>
-
-          #if !TARGET_CPU_X86_64
-          #error Metal doesn't work on this configuration
-          #endif
-        ],[
-        ],[
-        have_metal=yes
-        ])
-        CFLAGS="$save_CFLAGS"
-        AC_MSG_RESULT($have_metal)
-        if test x$have_metal = xyes; then
-            AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
-            SUMMARY_video="${SUMMARY_video} metal"
-        else
-            enable_render_metal=no
-        fi
-    fi
-}
-
-
-dnl Find DirectFB
-CheckDirectFB()
-{
-    AC_ARG_ENABLE(video-directfb,
-AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
-                  , enable_video_directfb=no)
-    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
-        video_directfb=no
-
-        DIRECTFB_REQUIRED_VERSION=1.0.0
-        AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
-        if test x$DIRECTFBCONFIG = xno; then
-            AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-            if test x$PKG_CONFIG != xno; then
-                if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
-                    DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
-                    DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
-                    DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
-                    video_directfb=yes
-                fi
-            fi
-        else
-            set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
-            NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
-            set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
-            HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
-            if test $HAVE_VERSION -ge $NEED_VERSION; then
-                DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
-                DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
-                DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
-                video_directfb=yes
-            fi
-        fi
-        if test x$video_directfb = xyes; then
-            # SuSE 11.1 installs directfb-config without directfb-devel
-            save_CPPFLAGS="$CPPFLAGS"
-            CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
-            AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
-            CPPFLAGS="$save_CPPFLAGS"
-            video_directfb=$have_directfb_hdr
-        fi
-        AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
-        AC_MSG_RESULT($video_directfb)
-
-        if test x$video_directfb = xyes; then
-            AC_ARG_ENABLE(directfb-shared,
-AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
-                              , enable_directfb_shared=yes)
-
-            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
-
-            AC_MSG_CHECKING(for directfb dynamic loading support)
-            directfb_shared=no
-            directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`]
-            # | sed 's/.*\/\(.*\)/\1/; q'`]
-AC_MSG_WARN("directfb $directfb_lib")
-            if test x$have_loadso != xyes && \
-               test x$enable_directfb_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
-            fi
-            if test x$have_loadso = xyes && \
-               test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
-                directfb_shared=yes
-                echo "-- $directfb_lib_spec -> $directfb_lib"
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
-                SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
-                SUMMARY_video="${SUMMARY_video} directfb"
-            fi
-            AC_MSG_RESULT($directfb_shared)
-            SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
-            have_video=yes
-        fi
-    fi
-}
-
-dnl Find KMSDRM
-CheckKMSDRM()
-{
-    AC_ARG_ENABLE(video-kmsdrm,
-AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]),
-                  , enable_video_kmsdrm=no)
-
-    if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
-        video_kmsdrm=no
-        libdrm_avail=no
-        libgbm_avail=no
-
-        LIBDRM_REQUIRED_VERSION=2.4.46
-        LIBGBM_REQUIRED_VERSION=9.0.0
-
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        if test x$PKG_CONFIG != xno; then
-            if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then
-                if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then
-                    LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm`
-                    LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm`
-                    LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm`
-                    libdrm_avail=yes
-                fi
-                if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then
-                    LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm`
-                    LIBGBM_LIBS=`$PKG_CONFIG --libs gbm`
-                    LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm`
-                    libgbm_avail=yes
-                fi
-                if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
-                    video_kmsdrm=yes
-                fi
- 
-                AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support)
-                AC_MSG_RESULT($libdrm_avail)
-                AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support)
-                AC_MSG_RESULT($libgbm_avail)
-
-                if test x$video_kmsdrm = xyes; then
-                    AC_ARG_ENABLE(kmsdrm-shared,
-AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]),
-                              , enable_kmsdrm_shared=yes)
-
-                    AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
-                    SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
-                    EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
-
-                    AC_MSG_CHECKING(for kmsdrm dynamic loading support)
-                    kmsdrm_shared=no
-                    drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
-                    gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
-                    if test x$have_loadso != xyes && \
-                       test x$enable_kmsdrm_shared = xyes; then
-                        AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
-                    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
-                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
-                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
-                        AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
-                        SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
-                    else
-                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
-                        SUMMARY_video="${SUMMARY_video} kmsdrm"
-                    fi
-                    AC_MSG_RESULT($kmsdrm_shared)
-                    have_video=yes
-                fi
-            fi
-        fi
-    fi
-}
-
-dnl rcg04172001 Set up the Null video driver.
-CheckDummyVideo()
-{
-    AC_ARG_ENABLE(video-dummy,
-AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
-                  , enable_video_dummy=yes)
-    if test x$enable_video_dummy = xyes; then
-        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
-        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
-        have_video=yes
-        SUMMARY_video="${SUMMARY_video} dummy"
-    fi
-}
-
-dnl Set up the QNX video driver if enabled
-CheckQNXVideo()
-{
-    if test x$enable_video = xyes; then
-        AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
-        SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
-        have_video=yes
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
-        SUMMARY_video="${SUMMARY_video} qnx"
-    fi
-}
-
-dnl Set up the QNX audio driver if enabled
-CheckQNXAudio()
-{
-    if test x$enable_audio = xyes; then
-        AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
-        SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
-        have_audio=yes
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
-        SUMMARY_audio="${SUMMARY_audio} qsa"
-    fi
-}
-
-dnl Check to see if OpenGL support is desired
-AC_ARG_ENABLE(video-opengl,
-AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
-              , enable_video_opengl=yes)
-
-dnl Find OpenGL
-CheckOpenGLX11()
-{
-    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
-        AC_MSG_CHECKING(for OpenGL (GLX) support)
-        video_opengl=no
-        AC_TRY_COMPILE([
-         #include <GL/gl.h>
-         #include <GL/glx.h>
-        ],[
-        ],[
-        video_opengl=yes
-        ])
-        AC_MSG_RESULT($video_opengl)
-        if test x$video_opengl = xyes; then
-            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
-            AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
-            AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
-            SUMMARY_video="${SUMMARY_video} opengl"
-        fi
-    fi
-}
-
-dnl Check to see if OpenGL ES support is desired
-AC_ARG_ENABLE(video-opengles,
-AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
-              , enable_video_opengles=yes)
-AC_ARG_ENABLE(video-opengles1,
-AC_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]),
-              , enable_video_opengles1=yes)
-AC_ARG_ENABLE(video-opengles2,
-AC_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]),
-              , enable_video_opengles2=yes)
-
-dnl Find OpenGL ES
-CheckOpenGLESX11()
-{
-    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
-        AC_MSG_CHECKING(for EGL support)
-        video_opengl_egl=no
-        AC_TRY_COMPILE([
-          #define LINUX
-          #define EGL_API_FB
-          #include <EGL/egl.h>
-          #include <EGL/eglext.h>
-        ],[
-        ],[
-        video_opengl_egl=yes
-        ])
-        AC_MSG_RESULT($video_opengl_egl)
-        if test x$video_opengl_egl = xyes; then
-            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
-        fi
-            
-        if test x$enable_video_opengles1 = xyes; then
-            AC_MSG_CHECKING(for OpenGL ES v1 headers)
-            video_opengles_v1=no
-            AC_TRY_COMPILE([
-             #include <GLES/gl.h>
-             #include <GLES/glext.h>
-            ],[
-            ],[
-            video_opengles_v1=yes
-            ])
-            AC_MSG_RESULT($video_opengles_v1)
-            if test x$video_opengles_v1 = xyes; then
-                AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
-                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
-                SUMMARY_video="${SUMMARY_video} opengl_es1"
-            fi
-        fi
-        
-        if test x$enable_video_opengles2 = xyes; then
-            AC_MSG_CHECKING(for OpenGL ES v2 headers)
-            video_opengles_v2=no
-            AC_TRY_COMPILE([
-             #include <GLES2/gl2.h>
-             #include <GLES2/gl2ext.h>
-            ],[
-            ],[
-            video_opengles_v2=yes
-            ])
-            AC_MSG_RESULT($video_opengles_v2)
-            if test x$video_opengles_v2 = xyes; then
-                AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
-                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
-                SUMMARY_video="${SUMMARY_video} opengl_es2"
-            fi
-        fi
-    fi
-}
-
-dnl Check for Windows OpenGL
-CheckWINDOWSGL()
-{
-    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
-        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
-        SUMMARY_video="${SUMMARY_video} opengl"
-    fi
-}
-
-dnl Check for Windows OpenGL
-CheckWINDOWSGLES()
-{
-    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
-
-        AC_MSG_CHECKING(for EGL support)
-        video_opengl_egl=no
-        AC_TRY_COMPILE([
-         #include <EGL/egl.h>
-        ],[
-        ],[
-        video_opengl_egl=yes
-        ])
-        AC_MSG_RESULT($video_opengl_egl)
-        if test x$video_opengl_egl = xyes; then
-            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
-            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
-            SUMMARY_video="${SUMMARY_video} opengl_es1"
-        fi
-       
-        AC_MSG_CHECKING(for OpenGL ES v2 headers)
-        video_opengles_v2=no
-        AC_TRY_COMPILE([
-         #include <GLES2/gl2.h>
-         #include <GLES2/gl2ext.h>
-        ],[
-        ],[
-        video_opengles_v2=yes
-        ])
-        AC_MSG_RESULT($video_opengles_v2)
-        if test x$video_opengles_v2 = xyes; then
-            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
-            AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
-            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
-            SUMMARY_video="${SUMMARY_video} opengl_es2"
-        fi
-    fi
-}
-
-dnl Check for Haiku OpenGL
-CheckHaikuGL()
-{
-    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
-        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
-        SUMMARY_video="${SUMMARY_video} opengl"
-    fi
-}
-
-dnl Check for MacOS OpenGL
-CheckMacGL()
-{
-    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
-        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
-        SUMMARY_video="${SUMMARY_video} opengl"
-    fi
-}
-
-CheckEmscriptenGLES()
-{
-    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
-        AC_MSG_CHECKING(for EGL support)
-        video_opengl_egl=no
-        AC_TRY_COMPILE([
-         #include <EGL/egl.h>
-        ],[
-        ],[
-        video_opengl_egl=yes
-        ])
-        AC_MSG_RESULT($video_opengl_egl)
-        if test x$video_opengl_egl = xyes; then
-            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
-        fi
-
-        AC_MSG_CHECKING(for OpenGL ES v2 headers)
-        video_opengles_v2=no
-        AC_TRY_COMPILE([
-         #include <GLES2/gl2.h>
-         #include <GLES2/gl2ext.h>
-        ],[
-        ],[
-        video_opengles_v2=yes
-        ])
-        AC_MSG_RESULT($video_opengles_v2)
-        if test x$video_opengles_v2 = xyes; then
-            AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
-            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
-            SUMMARY_video="${SUMMARY_video} opengl_es2"
-        fi
-    fi
-}
-
-dnl Check to see if Vulkan support is desired
-AC_ARG_ENABLE(video-vulkan,
-AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
-              , enable_video_vulkan=yes)
-
-dnl Find Vulkan Header
-CheckVulkan()
-{
-    if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
-        case "$host" in
-            *-*-android*)
-                AC_TRY_COMPILE([
-                  #if defined(__ARM_ARCH) && __ARM_ARCH < 7
-                  #error Vulkan doesn't work on this configuration
-                  #endif
-                ],[
-                ],[
-                ],[
-                    enable_video_vulkan=no
-                ])
-                ;;
-            *-*-darwin*)
-                save_CFLAGS="$CFLAGS"
-                dnl Work around that we don't have Objective-C support in autoconf
-                CFLAGS="$CFLAGS -x objective-c"
-                AC_TRY_COMPILE([
-                  #include <Cocoa/Cocoa.h>
-                  #include <Metal/Metal.h>
-                  #include <QuartzCore/CAMetalLayer.h>
-
-                  #if !TARGET_CPU_X86_64
-                  #error Vulkan doesn't work on this configuration
-                  #endif
-                ],[
-                ],[
-                ],[
-                    enable_video_vulkan=no
-                ])
-                CFLAGS="$save_CFLAGS"
-                ;;
-            *)
-                ;;
-        esac
-        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.
-            AC_MSG_WARN([Vulkan does not work on this configuration.])
-        fi
-    fi
-    if test x$enable_video_vulkan = xyes; then
-        AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
-        SUMMARY_video="${SUMMARY_video} vulkan"
-    fi
-}
-
-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
-        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
-        use_input_events=no
-        AC_TRY_COMPILE([
-          #include <linux/input.h>
-        ],[
-          #ifndef EVIOCGNAME
-          #error EVIOCGNAME() ioctl not available
-          #endif
-        ],[
-        use_input_events=yes
-        ])
-        AC_MSG_RESULT($use_input_events)
-        if test x$use_input_events = xyes; then
-            AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
-            SUMMARY_input="${SUMMARY_input} linuxev"
-        fi
-}
-
-dnl See if we can use the kernel kd.h header
-CheckInputKD()
-{
-
-    AC_MSG_CHECKING(for Linux kd.h)
-    use_input_kd=no
-    AC_TRY_COMPILE([
-      #include <linux/kd.h>
-      #include <linux/keyboard.h>
-    ],[
-        struct kbentry kbe;
-        kbe.kb_table = KG_CTRL;
-        ioctl(0, KDGKBENT, &kbe);
-    ],[
-    use_input_kd=yes
-    ])
-    AC_MSG_RESULT($use_input_kd)
-    if test x$use_input_kd = xyes; then
-        AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
-        SUMMARY_input="${SUMMARY_input} linuxkd"
-    fi
-}
-
-dnl See if the platform offers libudev for device enumeration and hotplugging.
-CheckLibUDev()
-{
-    AC_ARG_ENABLE(libudev,
-AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
-                        , enable_libudev=yes)
-    if test x$enable_libudev = xyes; then
-        AC_CHECK_HEADER(libudev.h,
-                        have_libudev_h_hdr=yes,
-                        have_libudev_h_hdr=no)
-        if test x$have_libudev_h_hdr = xyes; then
-            AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
-
-            udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
-            if test x$udev_lib != x; then
-                echo "-- dynamic udev -> $udev_lib"
-                AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ])
-            fi
-        fi
-    fi
-}
-
-dnl See if the platform offers libdbus for various IPC techniques.
-CheckDBus()
-{
-    AC_ARG_ENABLE(dbus,
-AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
-                        , enable_dbus=yes)
-    if test x$enable_dbus = xyes; then
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        if test x$PKG_CONFIG != xno; then
-            DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
-            save_CFLAGS="$CFLAGS"
-            CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
-            AC_CHECK_HEADER(dbus/dbus.h,
-                            have_dbus_dbus_h_hdr=yes,
-                            have_dbus_dbus_h_hdr=no)
-            CFLAGS="$save_CFLAGS"
-            if test x$have_dbus_dbus_h_hdr = xyes; then
-                AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
-                EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
-                SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
-            fi
-        fi
-    fi
-}
-
-dnl See if the platform wanna IME support.
-CheckIME()
-{
-    AC_ARG_ENABLE(ime,
-AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
-                  , enable_ime=yes)
-    if test x$enable_ime = xyes; then
-        AC_DEFINE(SDL_USE_IME, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
-    fi
-}
-
-dnl See if the platform has libibus IME support.
-CheckIBus()
-{
-    AC_ARG_ENABLE(ibus,
-AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
-                  , enable_ibus=yes)
-    if test x$enable_ibus = xyes; then
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        if test x$PKG_CONFIG != xno; then
-            IBUS_CFLAGS=`$PKG_CONFIG --cflags ibus-1.0`
-            save_CFLAGS="$CFLAGS"
-            CFLAGS="$save_CFLAGS $IBUS_CFLAGS"
-            AC_CHECK_HEADER(ibus-1.0/ibus.h,
-                            have_ibus_ibus_h_hdr=yes,
-                            have_ibus_ibus_h_hdr=no)
-            AC_CHECK_HEADER(sys/inotify.h,
-                            have_inotify_inotify_h_hdr=yes,
-                            have_inotify_inotify_h_hdr=no)
-            CFLAGS="$save_CFLAGS"
-            if test x$have_ibus_ibus_h_hdr = xyes; then
-                if test x$enable_ime != xyes; then
-                    AC_MSG_WARN([IME support is required for IBus.])
-                    have_ibus_ibus_h_hdr=no
-                elif test x$enable_dbus != xyes; then
-                    AC_MSG_WARN([DBus support is required for IBus.])
-                    have_ibus_ibus_h_hdr=no
-                elif test x$have_inotify_inotify_h_hdr != xyes; then
-                    AC_MSG_WARN([INotify support is required for IBus.])
-                    have_ibus_ibus_h_hdr=no
-                else
-                    AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
-                    EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
-                    SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
-               fi
-            fi
-        fi
-    fi
-}
-
-dnl See if the platform has fcitx IME support.
-CheckFcitx()
-{
-    AC_ARG_ENABLE(fcitx,
-AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
-                  , enable_fcitx=yes)
-    if test x$enable_fcitx = xyes; then
-        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-        if test x$PKG_CONFIG != xno; then
-            FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
-            CFLAGS="$CFLAGS $FCITX_CFLAGS"
-            AC_CHECK_HEADER(fcitx/frontend.h,
-                            have_fcitx_frontend_h_hdr=yes,
-                            have_fcitx_frontend_h_hdr=no)
-            CFLAGS="$save_CFLAGS"
-            if test x$have_fcitx_frontend_h_hdr = xyes; then
-                if test x$enable_ime != xyes; then
-                    AC_MSG_WARN([IME support is required for fcitx.])
-                    have_fcitx_frontend_h_hdr=no
-                elif test x$enable_dbus != xyes; then
-                    AC_MSG_WARN([DBus support is required for fcitx.])
-                    have_fcitx_frontend_h_hdr=no
-                else
-                    AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ])
-                    EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
-                    SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
-               fi
-            fi
-        fi
-    fi
-}
-
-dnl See if we can use the Touchscreen input library
-CheckTslib()
-{
-    AC_ARG_ENABLE(input-tslib,
-AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
-                  , enable_input_tslib=yes)
-    if test x$enable_input_tslib = xyes; then
-        AC_MSG_CHECKING(for Touchscreen library support)
-        enable_input_tslib=no
-        AC_TRY_COMPILE([
-          #include "tslib.h"
-        ],[
-        ],[
-        enable_input_tslib=yes
-        ])
-        AC_MSG_RESULT($enable_input_tslib)
-        if test x$enable_input_tslib = xyes; then
-            AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
-            SUMMARY_input="${SUMMARY_input} ts"
-        fi
-    fi
-}
-
-dnl See what type of thread model to use on Linux and Solaris
-CheckPTHREAD()
-{
-    dnl Check for pthread support
-    AC_ARG_ENABLE(pthreads,
-AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
-                  , enable_pthreads=yes)
-    dnl This is used on Linux for glibc binary compatibility (Doh!)
-    AC_ARG_ENABLE(pthread-sem,
-AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
-                  , enable_pthread_sem=yes)
-    case "$host" in
-         *-*-android*)
-            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
-            pthread_lib=""
-            ;;
-        *-*-linux*|*-*-uclinux*)
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib="-lpthread"
-            ;;
-        *-*-bsdi*)
-            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
-            pthread_lib=""
-            ;;
-        *-*-darwin*)
-            pthread_cflags="-D_THREAD_SAFE"
-# causes Carbon.p complaints?
-#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
-            ;;
-        *-*-freebsd*|*-*-dragonfly*)
-            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
-            pthread_lib="-pthread"
-            ;;
-        *-*-netbsd*)
-            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
-            pthread_lib="-lpthread"
-            ;;
-        *-*-openbsd*)
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib="-pthread"
-            ;;
-        *-*-solaris2.9)
-            # From Solaris 9+, posix4's preferred name is rt.
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib="-lpthread -lrt"
-            ;;
-        *-*-solaris2.10)
-            # Solaris 10+ merged pthread into libc.
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib="-lrt"
-            ;;
-        *-*-solaris*)
-            # Solaris 11+ merged rt into libc.
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib=""
-            ;;
-        *-*-sysv5*)
-            pthread_cflags="-D_REENTRANT -Kthread"
-            pthread_lib=""
-            ;;
-        *-*-aix*)
-            pthread_cflags="-D_REENTRANT -mthreads"
-            pthread_lib="-lpthread"
-            ;;
-        *-*-hpux11*)
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib="-L/usr/lib -lpthread"
-            ;;
-        *-*-haiku*)
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib=""
-            ;;
-        *-*-nto*)
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib=""
-            ;;
-        *)
-            pthread_cflags="-D_REENTRANT"
-            pthread_lib="-lpthread"
-            ;;
-    esac
-    if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
-        # Save the original compiler flags and libraries
-        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
-        # 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
-        AC_MSG_CHECKING(for pthreads)
-        use_pthreads=no
-        AC_TRY_LINK([
-         #include <pthread.h>
-        ],[
-         pthread_attr_t type;
-         pthread_attr_init(&type);
-        ],[
-        use_pthreads=yes
-        ])
-        AC_MSG_RESULT($use_pthreads)
-        # 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
-            AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
-            EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
-            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
-
-            # Save the original compiler flags and libraries
-            ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
-            # Add the pthread compiler flags and libraries
-            CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
-
-            # Check to see if recursive mutexes are available
-            AC_MSG_CHECKING(for recursive mutexes)
-            has_recursive_mutexes=no
-            if test x$has_recursive_mutexes = xno; then
-                AC_TRY_LINK([
-                  #define _GNU_SOURCE 1
-                  #include <pthread.h>
-                ],[
-                  pthread_mutexattr_t attr;
-                  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
-                ],[
-                has_recursive_mutexes=yes
-                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
-                ])
-            fi
-            if test x$has_recursive_mutexes = xno; then
-                AC_TRY_LINK([
-                  #define _GNU_SOURCE 1
-                  #include <pthread.h>
-                ],[
-                  pthread_mutexattr_t attr;
-                  pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
-                ],[
-                has_recursive_mutexes=yes
-                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
-                ])
-            fi
-            AC_MSG_RESULT($has_recursive_mutexes)
-
-            # Check to see if pthread semaphore support is missing
-            if test x$enable_pthread_sem = xyes; then
-                AC_MSG_CHECKING(for pthread semaphores)
-                have_pthread_sem=no
-                AC_TRY_COMPILE([
-                  #include <pthread.h>
-                  #include <semaphore.h>
-                ],[
-                ],[
-                have_pthread_sem=yes
-                ])
-                AC_MSG_RESULT($have_pthread_sem)
-            fi
-            if test x$have_pthread_sem = xyes; then
-                AC_MSG_CHECKING(for sem_timedwait)
-                have_sem_timedwait=no
-                AC_TRY_LINK([
-                  #include <pthread.h>
-                  #include <semaphore.h>
-                ],[
-                  sem_timedwait(NULL, NULL);
-                ],[
-                have_sem_timedwait=yes
-                AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ])
-                ])
-                AC_MSG_RESULT($have_sem_timedwait)
-            fi
-
-            AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
-            if test x$have_pthread_np_h = xyes; then
-                AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
-            fi
-
-            # Check to see if pthread naming is available
-            AC_MSG_CHECKING(for pthread_setname_np)
-            AC_TRY_LINK_FUNC(pthread_setname_np, [
-              has_pthread_setname_np=yes
-              AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
-            ],[
-              has_pthread_setname_np=no
-            ])
-            AC_MSG_RESULT($has_pthread_setname_np)
-
-            AC_MSG_CHECKING(for pthread_set_name_np)
-            AC_TRY_LINK_FUNC(pthread_set_name_np, [
-              has_pthread_set_name_np=yes
-              AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
-            ],[
-              has_pthread_set_name_np=no
-            ])
-            AC_MSG_RESULT($has_pthread_set_name_np)
-
-            # Restore the compiler flags and libraries
-            CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
-
-            # Basic thread creation functions
-            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
-
-            # Semaphores
-            # We can fake these with mutexes and condition variables if necessary
-            if test x$have_pthread_sem = xyes; then
-                SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
-            else
-                SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
-            fi
-
-            # Mutexes
-            # We can fake these with semaphores if necessary
-            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
-
-            # Condition variables
-            # We can fake these with semaphores and mutexes if necessary
-            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
-
-            # Thread local storage
-            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
-
-            have_threads=yes
-        fi
-    fi
-}
-
-dnl Determine whether the compiler can produce Windows executables
-CheckWINDOWS()
-{
-    AC_MSG_CHECKING(Windows compiler)
-    have_win32_gcc=no
-    AC_TRY_COMPILE([
-     #include <windows.h>
-    ],[
-    ],[
-    have_win32_gcc=yes
-    ])
-    AC_MSG_RESULT($have_win32_gcc)
-    if test x$have_win32_gcc != xyes; then
-       AC_MSG_ERROR([
-*** Your compiler ($CC) does not produce Windows executables!
-       ])
-    fi
-
-    AC_MSG_CHECKING(Windows CE)
-    have_wince=no
-    AC_TRY_COMPILE([
-#if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
-#error This is not Windows CE
-#endif
-    ],[
-    ],[
-    have_wince=yes
-       AC_MSG_ERROR([
-*** Sorry, Windows CE is no longer supported.
-       ])
-    ])
-    AC_MSG_RESULT($have_wince)
-
-    # This fixes Windows stack alignment with newer GCC
-    CheckStackBoundary
-}
-
-dnl Find the DirectX includes and libraries
-CheckDIRECTX()
-{
-    AC_ARG_ENABLE(directx,
-AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
-                  , enable_directx=yes)
-    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_CHECK_HEADER(ddraw.h, have_ddraw=yes)
-        AC_CHECK_HEADER(dsound.h, have_dsound=yes)
-        AC_CHECK_HEADER(dinput.h, have_dinput=yes)
-        AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
-        AC_CHECK_HEADER(xinput.h, have_xinput=yes)
-        AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
-        AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
-        AC_TRY_COMPILE([
-#include <windows.h>
-#include <xinput.h>
-XINPUT_GAMEPAD_EX x1;
-        ],[],[have_xinput_gamepadex=yes])
-        AC_TRY_COMPILE([
-#include <windows.h>
-#include <xinput.h>
-XINPUT_STATE_EX s1;
-        ],[],[have_xinput_stateex=yes])
-
-        if test x$have_ddraw = xyes; then
-            AC_DEFINE(HAVE_DDRAW_H, 1, [ ])
-        fi
-        if test x$have_dinput = xyes; then
-            AC_DEFINE(HAVE_DINPUT_H, 1, [ ])
-        fi
-        if test x$have_dsound = xyes; then
-            AC_DEFINE(HAVE_DSOUND_H, 1, [ ])
-        fi
-        if test x$have_dxgi = xyes; then
-            AC_DEFINE(HAVE_DXGI_H, 1, [ ])
-        fi
-        if test x$have_xinput = xyes; then
-            AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
-        fi
-        if test x$have_xinput_gamepadex = xyes; then
-            AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
-        fi
-        if test x$have_xinput_stateex = xyes; then
-            AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
-        fi
-
-        SUMMARY_video="${SUMMARY_video} directx"
-        SUMMARY_audio="${SUMMARY_audio} directx"
-
-        # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
-        # FIXME:  ...so force it off for now.
-        case "$host" in
-            *-*-cygwin*)
-            have_dinput=false
-            ;;
-        esac
-    fi
-}
-
-dnl Check for the dlfcn.h interface for dynamically loading objects
-CheckDLOPEN()
-{
-    AC_ARG_ENABLE(sdl-dlopen,
-AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
-                  , enable_sdl_dlopen=yes)
-    if test x$enable_sdl_dlopen = xyes; then
-        AC_MSG_CHECKING(for dlopen)
-        have_dlopen=no
-        AC_TRY_COMPILE([
-         #include <dlfcn.h>
-        ],[
-         void *handle = dlopen("", RTLD_NOW);
-         const char *loaderror = (char *) dlerror();
-        ],[
-        have_dlopen=yes
-        ])
-        AC_MSG_RESULT($have_dlopen)
-
-        if test x$have_dlopen = xyes; then
-            AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
-               AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
-                  AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
-            AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
-            have_loadso=yes
-        fi
-    fi
-}
-
-dnl Check for the usbhid(3) library on *BSD
-CheckUSBHID()
-{
-    case "$host" in
-        *-*-*bsd*)
-            if test x$enable_joystick = xyes; then
-                AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
-                if test x$have_libusbhid = xyes; then
-                    AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
-                    AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
-                    USB_LIBS="$USB_LIBS -lusbhid"
-                else
-                    AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
-                    AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
-                    AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
-                fi
-                    
-                save_CFLAGS="$CFLAGS"
-                CFLAGS="$CFLAGS $USB_CFLAGS"
-
-                AC_MSG_CHECKING(for usbhid)
-                have_usbhid=no
-                AC_TRY_COMPILE([
-                  #include <sys/types.h>
-                  #if defined(HAVE_USB_H)
-                  #include <usb.h>
-                  #endif
-                  #ifdef __DragonFly__
-                  # include <bus/usb/usb.h>
-                  # include <bus/usb/usbhid.h>
-                  #else
-                  # include <dev/usb/usb.h>
-                  # include <dev/usb/usbhid.h>
-                  #endif
-                  #if defined(HAVE_USBHID_H)
-                  #include <usbhid.h>
-                  #elif defined(HAVE_LIBUSB_H)
-                  #include <libusb.h>
-                  #elif defined(HAVE_LIBUSBHID_H)
-                  #include <libusbhid.h>
-                  #endif
-                ],[
-                  struct report_desc *repdesc;
-                  struct usb_ctl_report *repbuf;
-                  hid_kind_t hidkind;
-                ],[
-                have_usbhid=yes
-                ])
-                AC_MSG_RESULT($have_usbhid)
-
-                if test x$have_usbhid = xyes; then
-                    AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
-                    have_usbhid_ucr_data=no
-                    AC_TRY_COMPILE([
-                      #include <sys/types.h>
-                      #if defined(HAVE_USB_H)
-                      #include <usb.h>
-                      #endif
-                      #ifdef __DragonFly__
-                      # include <bus/usb/usb.h>
-                      # include <bus/usb/usbhid.h>
-                      #else
-                      # include <dev/usb/usb.h>
-                      # include <dev/usb/usbhid.h>
-                      #endif
-                      #if defined(HAVE_USBHID_H)
-                      #include <usbhid.h>
-                      #elif defined(HAVE_LIBUSB_H)
-                      #include <libusb.h>
-                      #elif defined(HAVE_LIBUSBHID_H)
-                      #include <libusbhid.h>
-                      #endif
-                    ],[
-                      struct usb_ctl_report buf;
-                      if (buf.ucr_data) { }
-                    ],[
-                    have_usbhid_ucr_data=yes
-                    ])
-                    if test x$have_usbhid_ucr_data = xyes; then
-                        USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
-                    fi
-                    AC_MSG_RESULT($have_usbhid_ucr_data)
-                    
-                    AC_MSG_CHECKING(for new usbhid API)
-                    have_usbhid_new=no
-                    AC_TRY_COMPILE([
-                      #include <sys/types.h>
-                      #if defined(HAVE_USB_H)
-                      #include <usb.h>
-                      #endif
-                      #ifdef __DragonFly__
-                      #include <bus/usb/usb.h>
-                      #include <bus/usb/usbhid.h>
-                      #else
-                      #include <dev/usb/usb.h>
-                      #include <dev/usb/usbhid.h>
-                      #endif
-                      #if defined(HAVE_USBHID_H)
-                      #include <usbhid.h>
-                      #elif defined(HAVE_LIBUSB_H)
-                      #include <libusb.h>
-                      #elif defined(HAVE_LIBUSBHID_H)
-                      #include <libusbhid.h>
-                      #endif
-                    ],[
-                      report_desc_t d;
-                      hid_start_parse(d, 1, 1);
-                    ],[
-                    have_usbhid_new=yes
-                    ])
-                    if test x$have_usbhid_new = xyes; then
-                        USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
-                    fi
-                    AC_MSG_RESULT($have_usbhid_new)
-
-                    AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
-                    have_machine_joystick=no
-                    AC_TRY_COMPILE([
-                      #include <machine/joystick.h>
-                    ],[
-                      struct joystick t;
-                    ],[
-                    have_machine_joystick=yes
-                    ])
-                    if test x$have_machine_joystick = xyes; then
-                        AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
-                    fi
-                    AC_MSG_RESULT($have_machine_joystick)
-
-                    AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
-                    SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
-                    EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
-                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
-                    have_joystick=yes
-                fi
-                CFLAGS="$save_CFLAGS"
-            fi
-        ;;
-    esac
-}
-
-dnl Check for clock_gettime()
-CheckClockGettime()
-{
-    AC_ARG_ENABLE(clock_gettime,
-AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
-                  , enable_clock_gettime=yes)
-    if test x$enable_clock_gettime = xyes; then
-        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
-        if test x$have_clock_gettime = xyes; then
-            AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
-        else
-            AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
-            if test x$have_clock_gettime = xyes; then
-               AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
-               EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
-            fi
-        fi
-    fi
-}
-
-dnl Check for a valid linux/version.h
-CheckLinuxVersion()
-{
-    AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
-    if test x$have_linux_version_h = xyes; then
-        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
-    fi
-}
-
-dnl Check if we want to use RPATH
-CheckRPATH()
-{
-    AC_ARG_ENABLE(rpath,
-AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
-                  , enable_rpath=yes)
-}
-
-dnl Do this on all platforms, before everything else (other things might want to override it).
-CheckWarnAll
-
-dnl Set up the configuration based on the host platform!
-case "$host" in
-    *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
-        case "$host" in
-            *-*-android*)
-                # Android
-                ARCH=android
-                ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES"
-                CFLAGS="$CFLAGS $ANDROID_CFLAGS"
-                SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS"
-                EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS"
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid"
-                SDLMAIN_SOURCES="$srcdir/src/main/android/*.c"
-
-                if test x$enable_video = xyes; then
-                    SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
-                    # FIXME: confdefs? Not AC_DEFINE?
-                    $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
-                    SUMMARY_video="${SUMMARY_video} android"
-                fi
-                ;;
-            *-*-linux*)         ARCH=linux ;;
-            *-*-uclinux*)       ARCH=linux ;;
-            *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
-            *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
-            *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
-            *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
-            *-*-bsdi*)          ARCH=bsdi ;;
-            *-*-freebsd*)       ARCH=freebsd ;;
-            *-*-dragonfly*)     ARCH=freebsd ;;
-            *-*-netbsd*)        ARCH=netbsd ;;
-            *-*-openbsd*)       ARCH=openbsd ;;
-            *-*-sysv5*)         ARCH=sysv5 ;;
-            *-*-solaris*)       ARCH=solaris ;;
-            *-*-hpux*)          ARCH=hpux ;;
-            *-*-aix*)           ARCH=aix ;;
-            *-*-minix*)         ARCH=minix ;;
-            *-*-nto*)           ARCH=nto
-                CheckQNXVideo
-                ;;
-        esac
-        CheckVisibilityHidden
-        CheckDeclarationAfterStatement
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDummyAudio
-        CheckDLOPEN
-        CheckOSS
-        CheckALSA
-        CheckPulseAudio
-        CheckJACK
-        CheckARTSC
-        CheckESD
-        CheckNAS
-        CheckSNDIO
-        CheckFusionSound
-        CheckLibSampleRate
-        # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
-        CheckRPI
-        CheckX11
-        CheckDirectFB
-        CheckKMSDRM
-        CheckOpenGLX11
-        CheckOpenGLESX11
-        CheckVulkan
-        CheckMir
-        CheckWayland
-        CheckLibUDev
-        CheckDBus
-        CheckIME
-        CheckIBus
-        CheckFcitx
-        case $ARCH in
-          linux)
-              CheckInputEvents
-              CheckInputKD
-          ;;
-        esac
-        CheckTslib
-        CheckUSBHID
-        CheckPTHREAD
-        CheckClockGettime
-        CheckLinuxVersion
-        CheckRPATH
-        CheckVivanteVideo
-
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-          case $ARCH in
-            sysv5|solaris|hpux)
-                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
-                SUMMARY_audio="${SUMMARY_audio} sun"
-                have_audio=yes
-            ;;
-            netbsd)  # Don't use this on OpenBSD, it's busted.
-                AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c"
-                SUMMARY_audio="${SUMMARY_audio} netbsd"
-                have_audio=yes
-            ;;
-            aix)
-                AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
-                SUMMARY_audio="${SUMMARY_audio} paudio"
-                have_audio=yes
-            ;;
-            android)
-                AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
-                SUMMARY_audio="${SUMMARY_audio} android"
-                have_audio=yes
-            ;;
-            nto)
-                CheckQNXAudio
-            ;;
-          esac
-        fi
-        # Set up files for the joystick library
-        if test x$enable_joystick = xyes; then
-          case $ARCH in
-            linux)
-                AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
-                SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
-                have_joystick=yes
-            ;;
-            android)
-                AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/joystick/android/*.c"
-                SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
-                have_joystick=yes
-            ;;
-          esac
-        fi
-        # Set up files for the haptic library
-        if test x$enable_haptic = xyes; then
-          case $ARCH in
-            linux)
-                if test x$use_input_events = xyes; then
-                    AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
-                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
-                    have_haptic=yes
-                fi
-            ;;
-            android)
-                AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/haptic/android/*.c"
-                have_haptic=yes
-            ;;
-          esac
-        fi
-        # Set up files for the power library
-        if test x$enable_power = xyes; then
-             case $ARCH in
-               linux)
-                   AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
-                   SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
-                   have_power=yes
-               ;;
-               android)
-                   AC_DEFINE(SDL_POWER_ANDROID, 1, [ ])
-                   SOURCES="$SOURCES $srcdir/src/power/android/*.c"
-                   have_power=yes
-               ;;
-             esac
-        fi
-        # Set up files for the filesystem library
-        if test x$enable_filesystem = xyes; then
-             case $ARCH in
-               android)
-                   AC_DEFINE(SDL_FILESYSTEM_ANDROID, 1, [ ])
-                   SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c"
-                   have_filesystem=yes
-               ;;
-               *)
-                   AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
-                   SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
-                   have_filesystem=yes
-               ;;
-             esac
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
-            have_timers=yes
-        fi
-        # Set up files for udev hotplugging support
-        if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
-            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"               
-        fi
-        # Set up files for evdev input
-        if test x$use_input_events = xyes; then
-            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c"
-        fi       
-        # Set up other core UNIX files
-        SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
-        ;;
-    *-*-cygwin* | *-*-mingw32*)
-        ARCH=win32
-        if test "$build" != "$host"; then # cross-compiling
-            # Default cross-compile location
-            ac_default_prefix=/usr/local/cross-tools/$host
-        else
-            # Look for the location of the tools and install there
-            if test "$BUILD_PREFIX" != ""; then
-                ac_default_prefix=$BUILD_PREFIX
-            fi
-        fi
-        CheckDeclarationAfterStatement
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDummyAudio
-        CheckWINDOWS
-        CheckWINDOWSGL
-        CheckWINDOWSGLES
-        CheckVulkan
-        CheckDIRECTX
-
-        # Set up the core platform files
-        SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
-
-        # Set up files for the video library
-        if test x$enable_video = xyes; then
-            AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
-            have_video=yes
-            AC_ARG_ENABLE(render-d3d,
-AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
-                                , enable_render_d3d=yes)
-            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
-                AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
-            fi
-            if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then
-                AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ])
-            fi
-        fi
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
-            if test x$have_dsound = xyes; then
-                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
-            fi
-            if test x$have_wasapi = xyes; then
-                AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
-                SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
-            fi
-            have_audio=yes
-        fi
-        # Set up files for the joystick library
-        if test x$enable_joystick = xyes; then
-            if test x$have_dinput = xyes -o x$have_xinput = xyes; then
-                if test x$have_xinput = xyes; then
-                    AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ])
-                fi
-                if test x$have_dinput = xyes; then
-                    AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
-                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
-                fi
-            else
-                AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
-            fi
-            SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
-            have_joystick=yes
-        fi
-        if test x$enable_haptic = xyes; then
-            if test x$have_dinput = xyes -o x$have_xinput = xyes; then
-                if test x$have_xinput = xyes; then
-                    AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ])
-                fi
-                if test x$have_dinput = xyes; then
-                    AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
-                fi
-                SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
-                have_haptic=yes
-            fi
-        fi
-        if test x$enable_power = xyes; then
-            AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
-            have_power=yes
-        fi
-        if test x$enable_filesystem = xyes; then
-            AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
-            have_filesystem=yes
-        fi
-        # Set up files for the thread library
-        if test x$enable_threads = xyes; then
-            AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
-            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
-            have_threads=yes
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
-            have_timers=yes
-        fi
-        # Set up files for the shared object loading library
-        if test x$enable_loadso = xyes; then
-            AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
-            have_loadso=yes
-        fi
-        # Set up the system libraries we need
-        if test -f /lib/w32api/libuuid.a; then
-            LIBUUID=/lib/w32api/libuuid.a
-        else
-            LIBUUID=-luuid
-        fi
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc"
-        # The Windows platform requires special setup
-        VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
-        SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
-        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
-        SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
-
-        # Check to see if this is a mingw or cygwin build
-        have_mingw32=
-        AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
-        if test x$have_mingw32 = xyes; then
-            SDL_LIBS="-lmingw32 $SDL_LIBS"
-        else
-            SDL_LIBS="-lcygwin $SDL_LIBS"
-        fi
-        ;;
-
-    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
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDummyAudio
-        CheckDLOPEN
-        CheckHaikuVideo
-        CheckHaikuGL
-        CheckPTHREAD
-
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
-            SUMMARY_audio="${SUMMARY_audio} haiku"
-            have_audio=yes
-        fi
-        # Set up files for the joystick library
-        if test x$enable_joystick = xyes; then
-            AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
-            have_joystick=yes
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
-            have_timers=yes
-        fi
-        # Set up files for the system power library
-        if test x$enable_power = xyes; then
-            AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
-            have_power=yes
-        fi
-        # Set up files for the system filesystem library
-        if test x$enable_filesystem = xyes; then
-            AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
-            have_filesystem=yes
-        fi
-        # The Haiku platform requires special setup.
-        SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
-        # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but
-        #  other spins, like x86-64, use a more standard "libstdc++.so.*"
-        AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++")
-        ;;
-    arm*-apple-darwin*|*-ios-*)
-        ARCH=ios
-
-        CheckVisibilityHidden
-        CheckDeclarationAfterStatement
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDummyAudio
-        CheckDLOPEN
-        CheckMETAL
-        CheckVulkan
-        CheckPTHREAD
-
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
-            SUMMARY_audio="${SUMMARY_audio} coreaudio"
-            have_audio=yes
-        fi
-        # Set up files for the joystick library
-        if test x$enable_joystick = xyes; then
-            AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
-            SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
-            have_joystick=yes
-        fi
-        # Set up files for the haptic library
-        #if test x$enable_haptic = xyes; then
-        #    SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
-        #    have_haptic=yes
-        #    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
-        #fi
-        # Set up files for the power library
-        if test x$enable_power = xyes; then
-            AC_DEFINE(SDL_POWER_UIKIT, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
-            have_power=yes
-        fi
-        # Set up files for the filesystem library
-        if test x$enable_filesystem = xyes; then
-            SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
-            have_filesystem=yes
-        fi
-        # Set up additional files for the file library
-        if test x$enable_file = xyes; then
-            AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
-            have_timers=yes
-        fi
-        # Set up other core UNIX files
-        SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
-        # The iOS platform requires special setup.
-        AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
-        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
-        SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
-
-        if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
-        fi
-        ;;
-    *-*-darwin* )
-        # This could be either full "Mac OS X", or plain "Darwin" which is
-        # just the OS X kernel sans upper layers like Carbon and Cocoa.
-        # Next line is broken, and a few files below require Mac OS X (full)
-        ARCH=macosx
-
-        # Mac OS X builds with both the Carbon and OSX APIs at the moment
-        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
-        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
-
-        CheckVisibilityHidden
-        CheckDeclarationAfterStatement
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDummyAudio
-        CheckDLOPEN
-        CheckCOCOA
-        CheckMETAL
-        CheckX11
-        CheckMacGL
-        CheckOpenGLX11
-        CheckVulkan
-        CheckPTHREAD
-
-        # Set up files for the audio library
-        if test x$enable_audio = xyes; then
-            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox"
-            SUMMARY_audio="${SUMMARY_audio} coreaudio"
-            have_audio=yes
-        fi
-        # Set up files for the joystick library
-        if test x$enable_joystick = xyes; then
-            AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
-            have_joystick=yes
-        fi
-        # Set up files for the haptic library
-        if test x$enable_haptic = xyes; then
-            AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
-            have_haptic=yes
-        fi
-        # Set up files for the power library
-        if test x$enable_power = xyes; then
-            AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
-            have_power=yes
-        fi
-        # Set up files for the filesystem library
-        if test x$enable_filesystem = xyes; then
-            AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
-            have_filesystem=yes
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
-            have_timers=yes
-        fi
-        # Set up additional files for the file library
-        if test x$enable_file = xyes; then
-            SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
-        fi
-        # Set up other core UNIX files
-        SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
-        # The Mac OS X platform requires special setup.
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
-        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
-
-        if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
-        fi
-        ;;
-    *-nacl|*-pnacl)
-        ARCH=nacl
-        CheckNativeClient
-        CheckDummyAudio
-        CheckDummyVideo
-        CheckInputEvents
-        CheckPTHREAD
-        
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
-            have_timers=yes
-        fi
-        
-        if test x$enable_filesystem = xyes; then
-            AC_DEFINE(SDL_FILESYSTEM_NACL, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c"
-            have_filesystem=yes
-        fi
-        ;;
-    *-*-emscripten* )
-        if test x$enable_video = xyes; then
-            AC_DEFINE(SDL_VIDEO_DRIVER_EMSCRIPTEN, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c"
-            have_video=yes
-            SUMMARY_video="${SUMMARY_video} emscripten"
-        fi
-
-        if test x$enable_audio = xyes; then
-            AC_DEFINE(SDL_AUDIO_DRIVER_EMSCRIPTEN, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c"
-            have_audio=yes
-            SUMMARY_audio="${SUMMARY_audio} emscripten"
-        fi
-
-        CheckVisibilityHidden
-        CheckDeclarationAfterStatement
-        CheckDummyVideo
-        CheckDiskAudio
-        CheckDummyAudio
-        CheckDLOPEN
-        CheckClockGettime
-        CheckEmscriptenGLES
-
-         # Set up files for the power library
-        if test x$enable_power = xyes; then
-            AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c"
-            have_power=yes
-        fi
-        
-        # 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"
-            have_joystick=yes
-        fi
-
-        # Set up files for the filesystem library
-        if test x$enable_filesystem = xyes; then
-            AC_DEFINE(SDL_FILESYSTEM_EMSCRIPTEN, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c"
-            have_filesystem=yes
-        fi
-        # Set up files for the timer library
-        if test x$enable_timers = xyes; then
-            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
-            have_timers=yes
-        fi
-        ;;
-    *)
-        AC_MSG_ERROR([
-*** Unsupported host:  Please add to configure.in
-        ])
-        ;;
-esac
-
-# Verify that we have all the platform specific files we need
-
-if test x$have_joystick != xyes; then
-    if test x$enable_joystick = xyes; then
-        AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
-    fi
-    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
-fi
-if test x$have_haptic != xyes; then
-    if test x$enable_haptic = xyes; then
-        AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
-    fi
-    SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
-fi
-if test x$have_threads != xyes; then
-    if test x$enable_threads = xyes; then
-        AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
-    fi
-    SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
-fi
-if test x$have_timers != xyes; then
-    if test x$enable_timers = xyes; then
-        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_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_DISABLED, 1, [ ])
-    fi
-    SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
-fi
-if test x$SDLMAIN_SOURCES = x; then
-    SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
-fi
-SDLTEST_SOURCES="$srcdir/src/test/*.c"
-
-if test x$video_wayland = xyes; then
-    WAYLAND_CORE_PROTOCOL_SOURCE='$(gen)/wayland-protocol.c'
-    WAYLAND_CORE_PROTOCOL_HEADER='$(gen)/wayland-client-protocol.h'
-    WAYLAND_PROTOCOLS_UNSTABLE_SOURCES=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\
-        sed 's,[[^ ]]\+,\\$(gen)/&-protocol.c,g'`
-    WAYLAND_PROTOCOLS_UNSTABLE_HEADERS=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\
-        sed 's,[[^ ]]\+,\\$(gen)/&-client-protocol.h,g'`
-    GEN_SOURCES="$GEN_SOURCES $WAYLAND_CORE_PROTOCOL_SOURCE $WAYLAND_PROTOCOLS_UNSTABLE_SOURCES"
-    GEN_HEADERS="$GEN_HEADERS $WAYLAND_CORE_PROTOCOL_HEADER $WAYLAND_PROTOCOLS_UNSTABLE_HEADERS"
-
-    WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS="
-$WAYLAND_CORE_PROTOCOL_SOURCE: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
-	\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
-	\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) code \$< \$@"
-
-    WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS="
-$WAYLAND_CORE_PROTOCOL_HEADER: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml
-	\$(SHELL) \$(auxdir)/mkinstalldirs \$(gen)
-	\$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) client-header \$< \$@"
-
-    WAYLAND_CORE_PROTOCOL_OBJECT="
-\$(objects)/`echo $WAYLAND_CORE_PROTOCOL_SOURCE | sed 's/\$(gen)\/\(.*\).c$/\1.lo/'`: $WAYLAND_CORE_PROTOCOL_SOURCE
-	\$(RUN_CMD_CC)\$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \$< -o \$@"
-
-    WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
-        do echo ; echo \$p | sed\
-        "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\$(gen)/&-client-protocol.h: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\
-	\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\
-	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@," ; done`
-
-    WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
-        do echo ; echo \$p | sed\
-        "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\$(gen)/&-protocol.c: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\
-	\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\
-	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@," ; done`
-
-    WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\
-        do echo ; echo \$p | sed\
-        "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\\$(objects)/&-protocol.lo: \\$(gen)/&-protocol.c \\$(gen)/&-client-protocol.h\\\\
-	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@," ; done`
-
-    WAYLAND_PROTOCOLS_DEPENDS="
-$WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS
-$WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS
-$WAYLAND_CORE_PROTOCOL_OBJECT
-$WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS
-$WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS
-$WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE
-"
-fi
-
-OBJECTS=`echo $SOURCES`
-DEPENDS=`echo $SOURCES | tr ' ' '\n'`
-for EXT in asm cc m c S; do
-    OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
-    DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
-\\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
-	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
-done
-
-GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
-
-VERSION_OBJECTS=`echo $VERSION_SOURCES`
-VERSION_DEPENDS=`echo $VERSION_SOURCES`
-VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
-VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
-\\$(objects)/\\2.o: \\1/\\2.rc\\\\
-	\\$(WINDRES) \\$< \\$@,g"`
-
-SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
-SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
-SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
-SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
-\\$(objects)/\\2.lo: \\1/\\2.c\\\\
-	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
-
-SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
-SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
-SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
-SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
-\\$(objects)/\\2.lo: \\1/\\2.c\\\\
-	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
-
-# Set runtime shared library paths as needed
-
-if test "x$enable_rpath" = "xyes"; then
-  if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
-    SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
-
-    AC_MSG_CHECKING(for linker option --enable-new-dtags)
-    have_enable_new_dtags=no
-    save_LDFLAGS="$LDFLAGS"
-    LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
-    AC_TRY_LINK([
-    ],[
-    ],[
-    have_enable_new_dtags=yes
-    SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
-    ])
-    LDFLAGS="$save_LDFLAGS"
-    AC_MSG_RESULT($have_enable_new_dtags)
-  fi
-  if test $ARCH = solaris; then
-    SDL_RLD_FLAGS="-R\${libdir}"
-  fi
-else
-  SDL_RLD_FLAGS=""
-fi
-
-SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
-
-dnl Expand the cflags and libraries needed by apps using SDL
-AC_SUBST(SDL_CFLAGS)
-AC_SUBST(SDL_LIBS)
-AC_SUBST(SDL_STATIC_LIBS)
-AC_SUBST(SDL_RLD_FLAGS)
-if test x$enable_shared = xyes; then
-    ENABLE_SHARED_TRUE=
-    ENABLE_SHARED_FALSE="#"
-else
-    ENABLE_SHARED_TRUE="#"
-    ENABLE_SHARED_FALSE=
-fi
-if test x$enable_static = xyes; then
-    ENABLE_STATIC_TRUE=
-    ENABLE_STATIC_FALSE="#"
-else
-    ENABLE_STATIC_TRUE="#"
-    ENABLE_STATIC_FALSE=
-fi
-AC_SUBST(ENABLE_SHARED_TRUE)
-AC_SUBST(ENABLE_SHARED_FALSE)
-AC_SUBST(ENABLE_STATIC_TRUE)
-AC_SUBST(ENABLE_STATIC_FALSE)
-
-dnl Expand the sources and objects needed to build the library
-AC_SUBST(ac_aux_dir)
-AC_SUBST(INCLUDE)
-AC_SUBST(OBJECTS)
-AC_SUBST(GEN_HEADERS)
-AC_SUBST(GEN_OBJECTS)
-AC_SUBST(VERSION_OBJECTS)
-AC_SUBST(SDLMAIN_OBJECTS)
-AC_SUBST(SDLTEST_OBJECTS)
-AC_SUBST(BUILD_CFLAGS)
-AC_SUBST(EXTRA_CFLAGS)
-AC_SUBST(BUILD_LDFLAGS)
-AC_SUBST(EXTRA_LDFLAGS)
-AC_SUBST(WINDRES)
-AC_SUBST(WAYLAND_SCANNER)
-
-cat >Makefile.rules <<__EOF__
-
-# Build rules for objects
--include \$(OBJECTS:.lo=.d)
-
-# Special dependency for SDL.c, since it depends on SDL_revision.h
-$srcdir/src/SDL.c: update-revision
-$DEPENDS
-$VERSION_DEPENDS
-$SDLMAIN_DEPENDS
-$SDLTEST_DEPENDS
-$WAYLAND_PROTOCOLS_DEPENDS
-__EOF__
-
-AC_CONFIG_FILES([
-    Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc
-])
-AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])
-
-SUMMARY="SDL2 Configure Summary:\n"
-if test x$enable_shared = xyes; then
-    SUMMARY="${SUMMARY}Building Shared Libraries\n"
-fi
-if test x$enable_static = xyes; then
-    SUMMARY="${SUMMARY}Building Static Libraries\n"
-fi
-SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n"
-SUMMARY="${SUMMARY}Assembly Math   :${SUMMARY_math}\n" 
-SUMMARY="${SUMMARY}Audio drivers   :${SUMMARY_audio}\n"
-SUMMARY="${SUMMARY}Video drivers   :${SUMMARY_video}\n"
-if test x$have_x = xyes; then
-    SUMMARY="${SUMMARY}X11 libraries   :${SUMMARY_video_x11}\n"
-fi
-SUMMARY="${SUMMARY}Input drivers   :${SUMMARY_input}\n"
-if test x$have_samplerate_h_hdr = xyes; then
-    SUMMARY="${SUMMARY}Using libsamplerate : YES\n"
-else
-    SUMMARY="${SUMMARY}Using libsamplerate : NO\n"
-fi
-if test x$have_libudev_h_hdr = xyes; then
-    SUMMARY="${SUMMARY}Using libudev       : YES\n"
-else
-    SUMMARY="${SUMMARY}Using libudev       : NO\n"
-fi
-if test x$have_dbus_dbus_h_hdr = xyes; then
-    SUMMARY="${SUMMARY}Using dbus          : YES\n"
-else
-    SUMMARY="${SUMMARY}Using dbus          : NO\n"
-fi
-if test x$enable_ime = xyes; then
-    SUMMARY="${SUMMARY}Using ime           : YES\n"
-else
-    SUMMARY="${SUMMARY}Using ime           : NO\n"
-fi
-if test x$have_ibus_ibus_h_hdr = xyes; then
-    SUMMARY="${SUMMARY}Using ibus          : YES\n"
-else
-    SUMMARY="${SUMMARY}Using ibus          : NO\n"
-fi
-if test x$have_fcitx_frontend_h_hdr = xyes; then
-    SUMMARY="${SUMMARY}Using fcitx         : YES\n"
-else
-    SUMMARY="${SUMMARY}Using fcitx         : NO\n"
-fi
-AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
-
-AC_OUTPUT

+ 0 - 784
Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c

@@ -1,784 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2020 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#ifdef SDL_JOYSTICK_USBHID
-
-/*
- * Joystick driver for the uhid(4) interface found in OpenBSD,
- * NetBSD and FreeBSD.
- *
- * Maintainer: <vedge at csoft.org>
- */
-
-#include <sys/param.h>
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#ifndef __FreeBSD_kernel_version
-#define __FreeBSD_kernel_version __FreeBSD_version
-#endif
-
-#if defined(HAVE_USB_H)
-#include <usb.h>
-#endif
-#ifdef __DragonFly__
-#include <bus/usb/usb.h>
-#include <bus/usb/usbhid.h>
-#else
-#include <dev/usb/usb.h>
-#include <dev/usb/usbhid.h>
-#endif
-
-#if defined(HAVE_USBHID_H)
-#include <usbhid.h>
-#elif defined(HAVE_LIBUSB_H)
-#include <libusb.h>
-#elif defined(HAVE_LIBUSBHID_H)
-#include <libusbhid.h>
-#endif
-
-#if defined(__FREEBSD__) || defined(__FreeBSD_kernel__)
-#ifndef __DragonFly__
-#include <osreldate.h>
-#endif
-#if __FreeBSD_kernel_version > 800063
-#include <dev/usb/usb_ioctl.h>
-#endif
-#include <sys/joystick.h>
-#endif
-
-#if SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
-#include <machine/joystick.h>
-#endif
-
-#include "SDL_joystick.h"
-#include "../SDL_sysjoystick.h"
-#include "../SDL_joystick_c.h"
-
-#define MAX_UHID_JOYS   64
-#define MAX_JOY_JOYS    2
-#define MAX_JOYS    (MAX_UHID_JOYS + MAX_JOY_JOYS)
-
-#ifdef __OpenBSD__
-
-#define HUG_DPAD_UP         0x90
-#define HUG_DPAD_DOWN       0x91
-#define HUG_DPAD_RIGHT      0x92
-#define HUG_DPAD_LEFT       0x93
-
-#define HAT_CENTERED        0x00
-#define HAT_UP              0x01
-#define HAT_RIGHT           0x02
-#define HAT_DOWN            0x04
-#define HAT_LEFT            0x08
-#define HAT_RIGHTUP         (HAT_RIGHT|HAT_UP)
-#define HAT_RIGHTDOWN       (HAT_RIGHT|HAT_DOWN)
-#define HAT_LEFTUP          (HAT_LEFT|HAT_UP)
-#define HAT_LEFTDOWN        (HAT_LEFT|HAT_DOWN)
-
-/* calculate the value from the state of the dpad */
-int
-dpad_to_sdl(Sint32 *dpad)
-{
-    if (dpad[2]) {
-        if (dpad[0])
-            return HAT_RIGHTUP;
-        else if (dpad[1])
-            return HAT_RIGHTDOWN;
-        else
-            return HAT_RIGHT;
-    } else if (dpad[3]) {
-        if (dpad[0])
-            return HAT_LEFTUP;
-        else if (dpad[1])
-            return HAT_LEFTDOWN;
-        else
-            return HAT_LEFT;
-    } else if (dpad[0]) {
-        return HAT_UP;
-    } else if (dpad[1]) {
-        return HAT_DOWN;
-    }
-    return HAT_CENTERED;
-}
-#endif
-
-struct report
-{
-#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)
-    void *buf; /* Buffer */
-#elif defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063)
-    struct usb_gen_descriptor *buf; /* Buffer */
-#else
-    struct usb_ctl_report *buf; /* Buffer */
-#endif
-    size_t size;                /* Buffer size */
-    int rid;                    /* Report ID */
-    enum
-    {
-        SREPORT_UNINIT,
-        SREPORT_CLEAN,
-        SREPORT_DIRTY
-    } status;
-};
-
-static struct
-{
-    int uhid_report;
-    hid_kind_t kind;
-    const char *name;
-} const repinfo[] = {
-    {UHID_INPUT_REPORT, hid_input, "input"},
-    {UHID_OUTPUT_REPORT, hid_output, "output"},
-    {UHID_FEATURE_REPORT, hid_feature, "feature"}
-};
-
-enum
-{
-    REPORT_INPUT = 0,
-    REPORT_OUTPUT = 1,
-    REPORT_FEATURE = 2
-};
-
-enum
-{
-    JOYAXE_X,
-    JOYAXE_Y,
-    JOYAXE_Z,
-    JOYAXE_SLIDER,
-    JOYAXE_WHEEL,
-    JOYAXE_RX,
-    JOYAXE_RY,
-    JOYAXE_RZ,
-    JOYAXE_count
-};
-
-struct joystick_hwdata
-{
-    int fd;
-    char *path;
-    enum
-    {
-        BSDJOY_UHID,            /* uhid(4) */
-        BSDJOY_JOY              /* joy(4) */
-    } type;
-    struct report_desc *repdesc;
-    struct report inreport;
-    int axis_map[JOYAXE_count]; /* map present JOYAXE_* to 0,1,.. */
-};
-
-static char *joynames[MAX_JOYS];
-static char *joydevnames[MAX_JOYS];
-
-static int report_alloc(struct report *, struct report_desc *, int);
-static void report_free(struct report *);
-
-#if defined(USBHID_UCR_DATA) || (defined(__FreeBSD_kernel__) && __FreeBSD_kernel_version <= 800063)
-#define REP_BUF_DATA(rep) ((rep)->buf->ucr_data)
-#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000))
-#define REP_BUF_DATA(rep) ((rep)->buf)
-#elif (defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063))
-#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
-#else
-#define REP_BUF_DATA(rep) ((rep)->buf->data)
-#endif
-
-static int numjoysticks = 0;
-
-static int BSD_JoystickOpen(SDL_Joystick * joy, int device_index);
-static void BSD_JoystickClose(SDL_Joystick * joy);
-
-static int
-BSD_JoystickInit(void)
-{
-    char s[16];
-    int i, fd;
-
-    numjoysticks = 0;
-
-    SDL_memset(joynames, 0, sizeof(joynames));
-    SDL_memset(joydevnames, 0, sizeof(joydevnames));
-
-    for (i = 0; i < MAX_UHID_JOYS; i++) {
-        SDL_Joystick nj;
-
-        SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
-
-        joynames[numjoysticks] = SDL_strdup(s);
-
-        if (BSD_JoystickOpen(&nj, numjoysticks) == 0) {
-            BSD_JoystickClose(&nj);
-            numjoysticks++;
-        } else {
-            SDL_free(joynames[numjoysticks]);
-            joynames[numjoysticks] = NULL;
-        }
-    }
-    for (i = 0; i < MAX_JOY_JOYS; i++) {
-        SDL_snprintf(s, SDL_arraysize(s), "/dev/joy%d", i);
-        fd = open(s, O_RDONLY);
-        if (fd != -1) {
-            joynames[numjoysticks++] = SDL_strdup(s);
-            close(fd);
-        }
-    }
-
-    /* Read the default USB HID usage table. */
-    hid_init(NULL);
-
-    return (numjoysticks);
-}
-
-static int
-BSD_JoystickGetCount(void)
-{
-    return numjoysticks;
-}
-
-static void
-BSD_JoystickDetect(void)
-{
-}
-
-static const char *
-BSD_JoystickGetDeviceName(int device_index)
-{
-    if (joydevnames[device_index] != NULL) {
-        return (joydevnames[device_index]);
-    }
-    return (joynames[device_index]);
-}
-
-static int
-BSD_JoystickGetDevicePlayerIndex(int device_index)
-{
-    return -1;
-}
-
-static void
-BSD_JoystickSetDevicePlayerIndex(int device_index, int player_index)
-{
-}
-
-/* Function to perform the mapping from device index to the instance id for this index */
-static SDL_JoystickID
-BSD_JoystickGetDeviceInstanceID(int device_index)
-{
-    return device_index;
-}
-
-static int
-usage_to_joyaxe(unsigned usage)
-{
-    int joyaxe;
-    switch (usage) {
-    case HUG_X:
-        joyaxe = JOYAXE_X;
-        break;
-    case HUG_Y:
-        joyaxe = JOYAXE_Y;
-        break;
-    case HUG_Z:
-        joyaxe = JOYAXE_Z;
-        break;
-    case HUG_SLIDER:
-        joyaxe = JOYAXE_SLIDER;
-        break;
-    case HUG_WHEEL:
-        joyaxe = JOYAXE_WHEEL;
-        break;
-    case HUG_RX:
-        joyaxe = JOYAXE_RX;
-        break;
-    case HUG_RY:
-        joyaxe = JOYAXE_RY;
-        break;
-    case HUG_RZ:
-        joyaxe = JOYAXE_RZ;
-        break;
-    default:
-        joyaxe = -1;
-    }
-    return joyaxe;
-}
-
-static unsigned
-hatval_to_sdl(Sint32 hatval)
-{
-    static const unsigned hat_dir_map[8] = {
-        SDL_HAT_UP, SDL_HAT_RIGHTUP, SDL_HAT_RIGHT, SDL_HAT_RIGHTDOWN,
-        SDL_HAT_DOWN, SDL_HAT_LEFTDOWN, SDL_HAT_LEFT, SDL_HAT_LEFTUP
-    };
-    unsigned result;
-    if ((hatval & 7) == hatval)
-        result = hat_dir_map[hatval];
-    else
-        result = SDL_HAT_CENTERED;
-    return result;
-}
-
-
-static int
-BSD_JoystickOpen(SDL_Joystick * joy, int device_index)
-{
-    char *path = joynames[device_index];
-    struct joystick_hwdata *hw;
-    struct hid_item hitem;
-    struct hid_data *hdata;
-    struct report *rep = NULL;
-#if defined(__NetBSD__)
-    usb_device_descriptor_t udd;
-    struct usb_string_desc usd;
-#endif
-    int fd;
-    int i;
-
-    fd = open(path, O_RDONLY);
-    if (fd == -1) {
-        return SDL_SetError("%s: %s", path, strerror(errno));
-    }
-
-    joy->instance_id = device_index;
-    hw = (struct joystick_hwdata *)
-        SDL_malloc(sizeof(struct joystick_hwdata));
-    if (hw == NULL) {
-        close(fd);
-        return SDL_OutOfMemory();
-    }
-    joy->hwdata = hw;
-    hw->fd = fd;
-    hw->path = SDL_strdup(path);
-    if (!SDL_strncmp(path, "/dev/joy", 8)) {
-        hw->type = BSDJOY_JOY;
-        joy->naxes = 2;
-        joy->nbuttons = 2;
-        joy->nhats = 0;
-        joy->nballs = 0;
-        joydevnames[device_index] = SDL_strdup("Gameport joystick");
-        goto usbend;
-    } else {
-        hw->type = BSDJOY_UHID;
-    }
-
-    {
-        int ax;
-        for (ax = 0; ax < JOYAXE_count; ax++)
-            hw->axis_map[ax] = -1;
-    }
-    hw->repdesc = hid_get_report_desc(fd);
-    if (hw->repdesc == NULL) {
-        SDL_SetError("%s: USB_GET_REPORT_DESC: %s", hw->path,
-                     strerror(errno));
-        goto usberr;
-    }
-    rep = &hw->inreport;
-#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 800063) || defined(__FreeBSD_kernel__)
-    rep->rid = hid_get_report_id(fd);
-    if (rep->rid < 0) {
-#else
-    if (ioctl(fd, USB_GET_REPORT_ID, &rep->rid) < 0) {
-#endif
-        rep->rid = -1;          /* XXX */
-    }
-#if defined(__NetBSD__)
-    if (ioctl(fd, USB_GET_DEVICE_DESC, &udd) == -1)
-        goto desc_failed;
-
-    /* Get default language */
-    usd.usd_string_index = USB_LANGUAGE_TABLE;
-    usd.usd_language_id = 0;
-    if (ioctl(fd, USB_GET_STRING_DESC, &usd) == -1 || usd.usd_desc.bLength < 4) {
-        usd.usd_language_id = 0;
-    } else {
-        usd.usd_language_id = UGETW(usd.usd_desc.bString[0]);
-    }
-
-    usd.usd_string_index = udd.iProduct;
-    if (ioctl(fd, USB_GET_STRING_DESC, &usd) == 0) {
-        char str[128];
-        char *new_name = NULL;
-        int i;
-        for (i = 0; i < (usd.usd_desc.bLength >> 1) - 1 && i < sizeof(str) - 1; i++) {
-            str[i] = UGETW(usd.usd_desc.bString[i]);
-        }
-        str[i] = '\0';
-        asprintf(&new_name, "%s @ %s", str, path);
-        if (new_name != NULL) {
-            SDL_free(joydevnames[numjoysticks]);
-            joydevnames[numjoysticks] = new_name;
-        }
-    }
-desc_failed:
-#endif
-    if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
-        goto usberr;
-    }
-    if (rep->size <= 0) {
-        SDL_SetError("%s: Input report descriptor has invalid length",
-                     hw->path);
-        goto usberr;
-    }
-#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__)
-    hdata = hid_start_parse(hw->repdesc, 1 << hid_input, rep->rid);
-#else
-    hdata = hid_start_parse(hw->repdesc, 1 << hid_input);
-#endif
-    if (hdata == NULL) {
-        SDL_SetError("%s: Cannot start HID parser", hw->path);
-        goto usberr;
-    }
-    joy->naxes = 0;
-    joy->nbuttons = 0;
-    joy->nhats = 0;
-    joy->nballs = 0;
-    for (i = 0; i < JOYAXE_count; i++)
-        hw->axis_map[i] = -1;
-
-    while (hid_get_item(hdata, &hitem) > 0) {
-        char *sp;
-        const char *s;
-
-        switch (hitem.kind) {
-        case hid_collection:
-            switch (HID_PAGE(hitem.usage)) {
-            case HUP_GENERIC_DESKTOP:
-                switch (HID_USAGE(hitem.usage)) {
-                case HUG_JOYSTICK:
-                case HUG_GAME_PAD:
-                    s = hid_usage_in_page(hitem.usage);
-                    sp = SDL_malloc(SDL_strlen(s) + 5);
-                    SDL_snprintf(sp, SDL_strlen(s) + 5, "%s (%d)",
-                                 s, device_index);
-                    joydevnames[device_index] = sp;
-                }
-            }
-            break;
-        case hid_input:
-            switch (HID_PAGE(hitem.usage)) {
-            case HUP_GENERIC_DESKTOP:
-                {
-                    unsigned usage = HID_USAGE(hitem.usage);
-                    int joyaxe = usage_to_joyaxe(usage);
-                    if (joyaxe >= 0) {
-                        hw->axis_map[joyaxe] = 1;
-                    } else if (usage == HUG_HAT_SWITCH
-#ifdef __OpenBSD__
-                               || usage == HUG_DPAD_UP
-#endif
-                               ) {
-                        joy->nhats++;
-                    }
-                    break;
-                }
-            case HUP_BUTTON:
-                joy->nbuttons++;
-                break;
-            default:
-                break;
-            }
-            break;
-        default:
-            break;
-        }
-    }
-    hid_end_parse(hdata);
-    for (i = 0; i < JOYAXE_count; i++)
-        if (hw->axis_map[i] > 0)
-            hw->axis_map[i] = joy->naxes++;
-
-    if (joy->naxes == 0 && joy->nbuttons == 0 && joy->nhats == 0 && joy->nballs == 0) {
-        SDL_SetError("%s: Not a joystick, ignoring", hw->path);
-        goto usberr;
-    }
-
-  usbend:
-    /* The poll blocks the event thread. */
-    fcntl(fd, F_SETFL, O_NONBLOCK);
-#ifdef __NetBSD__
-    /* Flush pending events */
-    if (rep) {
-        while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size)
-            ;
-    }
-#endif
-
-    return (0);
-  usberr:
-    close(hw->fd);
-    SDL_free(hw->path);
-    SDL_free(hw);
-    return (-1);
-}
-
-static void
-BSD_JoystickUpdate(SDL_Joystick * joy)
-{
-    struct hid_item hitem;
-    struct hid_data *hdata;
-    struct report *rep;
-    int nbutton, naxe = -1;
-    Sint32 v;
-#ifdef __OpenBSD__
-    Sint32 dpad[4] = {0, 0, 0, 0};
-#endif
-
-#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H || defined(__FreeBSD_kernel__)
-    struct joystick gameport;
-    static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0;
-
-    if (joy->hwdata->type == BSDJOY_JOY) {
-        while (read(joy->hwdata->fd, &gameport, sizeof gameport) == sizeof gameport) {
-            if (abs(x - gameport.x) > 8) {
-                x = gameport.x;
-                if (x < xmin) {
-                    xmin = x;
-                }
-                if (x > xmax) {
-                    xmax = x;
-                }
-                if (xmin == xmax) {
-                    xmin--;
-                    xmax++;
-                }
-                v = (Sint32) x;
-                v -= (xmax + xmin + 1) / 2;
-                v *= 32768 / ((xmax - xmin + 1) / 2);
-                SDL_PrivateJoystickAxis(joy, 0, v);
-            }
-            if (abs(y - gameport.y) > 8) {
-                y = gameport.y;
-                if (y < ymin) {
-                    ymin = y;
-                }
-                if (y > ymax) {
-                    ymax = y;
-                }
-                if (ymin == ymax) {
-                    ymin--;
-                    ymax++;
-                }
-                v = (Sint32) y;
-                v -= (ymax + ymin + 1) / 2;
-                v *= 32768 / ((ymax - ymin + 1) / 2);
-                SDL_PrivateJoystickAxis(joy, 1, v);
-            }
-            SDL_PrivateJoystickButton(joy, 0, gameport.b1);
-            SDL_PrivateJoystickButton(joy, 1, gameport.b2);
-        }
-        return;
-    }
-#endif /* defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
-
-    rep = &joy->hwdata->inreport;
-
-    while (read(joy->hwdata->fd, REP_BUF_DATA(rep), rep->size) == rep->size) {
-#if defined(USBHID_NEW) || (defined(__FREEBSD__) && __FreeBSD_kernel_version >= 500111) || defined(__FreeBSD_kernel__)
-        hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input, rep->rid);
-#else
-        hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input);
-#endif
-        if (hdata == NULL) {
-            /*fprintf(stderr, "%s: Cannot start HID parser\n", joy->hwdata->path);*/
-            continue;
-        }
-
-        for (nbutton = 0; hid_get_item(hdata, &hitem) > 0;) {
-            switch (hitem.kind) {
-            case hid_input:
-                switch (HID_PAGE(hitem.usage)) {
-                case HUP_GENERIC_DESKTOP:
-                    {
-                        unsigned usage = HID_USAGE(hitem.usage);
-                        int joyaxe = usage_to_joyaxe(usage);
-                        if (joyaxe >= 0) {
-                            naxe = joy->hwdata->axis_map[joyaxe];
-                            /* scaleaxe */
-                            v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
-                            v -= (hitem.logical_maximum +
-                                  hitem.logical_minimum + 1) / 2;
-                            v *= 32768 /
-                                ((hitem.logical_maximum -
-                                  hitem.logical_minimum + 1) / 2);
-                            SDL_PrivateJoystickAxis(joy, naxe, v);
-                        } else if (usage == HUG_HAT_SWITCH) {
-                            v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
-                            SDL_PrivateJoystickHat(joy, 0,
-                                                   hatval_to_sdl(v) -
-                                                   hitem.logical_minimum);
-                        }
-#ifdef __OpenBSD__
-                        else if (usage == HUG_DPAD_UP) {
-                            dpad[0] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
-                            SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
-                        }
-                        else if (usage == HUG_DPAD_DOWN) {
-                            dpad[1] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
-                            SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
-                        }
-                        else if (usage == HUG_DPAD_RIGHT) {
-                            dpad[2] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
-                            SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
-                        }
-                        else if (usage == HUG_DPAD_LEFT) {
-                            dpad[3] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
-                            SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
-                        }
-#endif
-                        break;
-                    }
-                case HUP_BUTTON:
-                    v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
-                    SDL_PrivateJoystickButton(joy, nbutton, v);
-                    nbutton++;
-                    break;
-                default:
-                    continue;
-                }
-                break;
-            default:
-                break;
-            }
-        }
-        hid_end_parse(hdata);
-    }
-}
-
-/* Function to close a joystick after use */
-static void
-BSD_JoystickClose(SDL_Joystick * joy)
-{
-    if (SDL_strncmp(joy->hwdata->path, "/dev/joy", 8)) {
-        report_free(&joy->hwdata->inreport);
-        hid_dispose_report_desc(joy->hwdata->repdesc);
-    }
-    close(joy->hwdata->fd);
-    SDL_free(joy->hwdata->path);
-    SDL_free(joy->hwdata);
-}
-
-static void
-BSD_JoystickQuit(void)
-{
-    int i;
-
-    for (i = 0; i < MAX_JOYS; i++) {
-        SDL_free(joynames[i]);
-        SDL_free(joydevnames[i]);
-    }
-
-    return;
-}
-
-static SDL_JoystickGUID
-BSD_JoystickGetDeviceGUID( int device_index )
-{
-    SDL_JoystickGUID guid;
-    /* the GUID is just the first 16 chars of the name for now */
-    const char *name = BSD_JoystickGetDeviceName( device_index );
-    SDL_zero( guid );
-    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
-    return guid;
-}
-
-static int
-report_alloc(struct report *r, struct report_desc *rd, int repind)
-{
-    int len;
-
-#ifdef __DragonFly__
-    len = hid_report_size(rd, r->rid, repinfo[repind].kind);
-#elif __FREEBSD__
-# if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__)
-#  if (__FreeBSD_kernel_version <= 500111)
-    len = hid_report_size(rd, r->rid, repinfo[repind].kind);
-#  else
-    len = hid_report_size(rd, repinfo[repind].kind, r->rid);
-#  endif
-# else
-    len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
-# endif
-#else
-# ifdef USBHID_NEW
-    len = hid_report_size(rd, repinfo[repind].kind, r->rid);
-# else
-    len = hid_report_size(rd, repinfo[repind].kind, &r->rid);
-# endif
-#endif
-
-    if (len < 0) {
-        return SDL_SetError("Negative HID report size");
-    }
-    r->size = len;
-
-    if (r->size > 0) {
-#if defined(__FREEBSD__) && (__FreeBSD_kernel_version > 900000)
-        r->buf = SDL_malloc(r->size);
-#else
-        r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) +
-                            r->size);
-#endif
-        if (r->buf == NULL) {
-            return SDL_OutOfMemory();
-        }
-    } else {
-        r->buf = NULL;
-    }
-
-    r->status = SREPORT_CLEAN;
-    return 0;
-}
-
-static void
-report_free(struct report *r)
-{
-    SDL_free(r->buf);
-    r->status = SREPORT_UNINIT;
-}
-
-static int
-BSD_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
-{
-    return SDL_Unsupported();
-}
-
-SDL_JoystickDriver SDL_BSD_JoystickDriver =
-{
-    BSD_JoystickInit,
-    BSD_JoystickGetCount,
-    BSD_JoystickDetect,
-    BSD_JoystickGetDeviceName,
-    BSD_JoystickGetDevicePlayerIndex,
-    BSD_JoystickSetDevicePlayerIndex,
-    BSD_JoystickGetDeviceGUID,
-    BSD_JoystickGetDeviceInstanceID,
-    BSD_JoystickOpen,
-    BSD_JoystickRumble,
-    BSD_JoystickUpdate,
-    BSD_JoystickClose,
-    BSD_JoystickQuit,
-};
-
-#endif /* SDL_JOYSTICK_USBHID */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 1066
Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c

@@ -1,1066 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2020 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#ifdef SDL_JOYSTICK_IOKIT
-
-#include "SDL_events.h"
-#include "SDL_joystick.h"
-#include "../SDL_sysjoystick.h"
-#include "../SDL_joystick_c.h"
-#include "SDL_sysjoystick_c.h"
-#include "../hidapi/SDL_hidapijoystick_c.h"
-#include "../../haptic/darwin/SDL_syshaptic_c.h"    /* For haptic hot plugging */
-
-
-#define SDL_JOYSTICK_RUNLOOP_MODE CFSTR("SDLJoystick")
-
-#define CONVERT_MAGNITUDE(x)    (((x)*10000) / 0x7FFF)
-
-/* The base object of the HID Manager API */
-static IOHIDManagerRef hidman = NULL;
-
-/* Linked list of all available devices */
-static recDevice *gpDeviceList = NULL;
-
-void FreeRumbleEffectData(FFEFFECT *effect)
-{
-    if (!effect) {
-        return;
-    }
-    SDL_free(effect->rgdwAxes);
-    SDL_free(effect->rglDirection);
-    SDL_free(effect->lpvTypeSpecificParams);
-    SDL_free(effect);
-}
-
-FFEFFECT *CreateRumbleEffectData(Sint16 magnitude)
-{
-    FFEFFECT *effect;
-    FFPERIODIC *periodic;
-
-    /* Create the effect */
-    effect = (FFEFFECT *)SDL_calloc(1, sizeof(*effect));
-    if (!effect) {
-        return NULL;
-    }
-    effect->dwSize = sizeof(*effect);
-    effect->dwGain = 10000;
-    effect->dwFlags = FFEFF_OBJECTOFFSETS;
-    effect->dwDuration = SDL_MAX_RUMBLE_DURATION_MS * 1000; /* In microseconds. */
-    effect->dwTriggerButton = FFEB_NOTRIGGER;
-
-    effect->cAxes = 2;
-    effect->rgdwAxes = (DWORD *)SDL_calloc(effect->cAxes, sizeof(DWORD));
-    if (!effect->rgdwAxes) {
-        FreeRumbleEffectData(effect);
-        return NULL;
-    }
-
-    effect->rglDirection = (LONG *)SDL_calloc(effect->cAxes, sizeof(LONG));
-    if (!effect->rglDirection) {
-        FreeRumbleEffectData(effect);
-        return NULL;
-    }
-    effect->dwFlags |= FFEFF_CARTESIAN;
-
-    periodic = (FFPERIODIC *)SDL_calloc(1, sizeof(*periodic));
-    if (!periodic) {
-        FreeRumbleEffectData(effect);
-        return NULL;
-    }
-    periodic->dwMagnitude = CONVERT_MAGNITUDE(magnitude);
-    periodic->dwPeriod = 1000000;
-
-    effect->cbTypeSpecificParams = sizeof(*periodic);
-    effect->lpvTypeSpecificParams = periodic;
-
-    return effect;
-}
-
-static recDevice *GetDeviceForIndex(int device_index)
-{
-    recDevice *device = gpDeviceList;
-    while (device) {
-        if (!device->removed) {
-            if (device_index == 0)
-                break;
-
-            --device_index;
-        }
-        device = device->pNext;
-    }
-    return device;
-}
-
-static void
-FreeElementList(recElement *pElement)
-{
-    while (pElement) {
-        recElement *pElementNext = pElement->pNext;
-        SDL_free(pElement);
-        pElement = pElementNext;
-    }
-}
-
-static recDevice *
-FreeDevice(recDevice *removeDevice)
-{
-    recDevice *pDeviceNext = NULL;
-    if (removeDevice) {
-        if (removeDevice->deviceRef) {
-            IOHIDDeviceUnscheduleFromRunLoop(removeDevice->deviceRef, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE);
-            CFRelease(removeDevice->deviceRef);
-            removeDevice->deviceRef = NULL;
-        }
-
-        /* save next device prior to disposing of this device */
-        pDeviceNext = removeDevice->pNext;
-
-        if ( gpDeviceList == removeDevice ) {
-            gpDeviceList = pDeviceNext;
-        } else if (gpDeviceList) {
-            recDevice *device = gpDeviceList;
-            while (device->pNext != removeDevice) {
-                device = device->pNext;
-            }
-            device->pNext = pDeviceNext;
-        }
-        removeDevice->pNext = NULL;
-
-        /* free element lists */
-        FreeElementList(removeDevice->firstAxis);
-        FreeElementList(removeDevice->firstButton);
-        FreeElementList(removeDevice->firstHat);
-
-        SDL_free(removeDevice);
-    }
-    return pDeviceNext;
-}
-
-static SDL_bool
-GetHIDElementState(recDevice *pDevice, recElement *pElement, SInt32 *pValue)
-{
-    SInt32 value = 0;
-    int returnValue = SDL_FALSE;
-
-    if (pDevice && pDevice->deviceRef && pElement) {
-        IOHIDValueRef valueRef;
-        if (IOHIDDeviceGetValue(pDevice->deviceRef, pElement->elementRef, &valueRef) == kIOReturnSuccess) {
-            value = (SInt32) IOHIDValueGetIntegerValue(valueRef);
-
-            /* record min and max for auto calibration */
-            if (value < pElement->minReport) {
-                pElement->minReport = value;
-            }
-            if (value > pElement->maxReport) {
-                pElement->maxReport = value;
-            }
-            *pValue = value;
-
-            returnValue = SDL_TRUE;
-        }
-    }
-    return returnValue;
-}
-
-static SDL_bool
-GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 min, SInt32 max, SInt32 *pValue)
-{
-    const float deviceScale = max - min;
-    const float readScale = pElement->maxReport - pElement->minReport;
-    int returnValue = SDL_FALSE;
-    if (GetHIDElementState(pDevice, pElement, pValue))
-    {
-        if (readScale == 0) {
-            returnValue = SDL_TRUE;           /* no scaling at all */
-        }
-        else
-        {
-            *pValue = ((*pValue - pElement->minReport) * deviceScale / readScale) + min;
-            returnValue = SDL_TRUE;
-        }
-    } 
-    return returnValue;
-}
-
-static void
-JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *sender)
-{
-    recDevice *device = (recDevice *) ctx;
-    device->removed = SDL_TRUE;
-    if (device->deviceRef) {
-        // deviceRef was invalidated due to the remove
-        CFRelease(device->deviceRef);
-        device->deviceRef = NULL;
-    }
-    if (device->ffeffect_ref) {
-        FFDeviceReleaseEffect(device->ffdevice, device->ffeffect_ref);
-        device->ffeffect_ref = NULL;
-    }
-    if (device->ffeffect) {
-        FreeRumbleEffectData(device->ffeffect);
-        device->ffeffect = NULL;
-    }
-    if (device->ffdevice) {
-        FFReleaseDevice(device->ffdevice);
-        device->ffdevice = NULL;
-        device->ff_initialized = SDL_FALSE;
-    }
-#if SDL_HAPTIC_IOKIT
-    MacHaptic_MaybeRemoveDevice(device->ffservice);
-#endif
-
-    SDL_PrivateJoystickRemoved(device->instance_id);
-}
-
-
-static void AddHIDElement(const void *value, void *parameter);
-
-/* Call AddHIDElement() on all elements in an array of IOHIDElementRefs */
-static void
-AddHIDElements(CFArrayRef array, recDevice *pDevice)
-{
-    const CFRange range = { 0, CFArrayGetCount(array) };
-    CFArrayApplyFunction(array, range, AddHIDElement, pDevice);
-}
-
-static SDL_bool
-ElementAlreadyAdded(const IOHIDElementCookie cookie, const recElement *listitem) {
-    while (listitem) {
-        if (listitem->cookie == cookie) {
-            return SDL_TRUE;
-        }
-        listitem = listitem->pNext;
-    }
-    return SDL_FALSE;
-}
-
-/* See if we care about this HID element, and if so, note it in our recDevice. */
-static void
-AddHIDElement(const void *value, void *parameter)
-{
-    recDevice *pDevice = (recDevice *) parameter;
-    IOHIDElementRef refElement = (IOHIDElementRef) value;
-    const CFTypeID elementTypeID = refElement ? CFGetTypeID(refElement) : 0;
-
-    if (refElement && (elementTypeID == IOHIDElementGetTypeID())) {
-        const IOHIDElementCookie cookie = IOHIDElementGetCookie(refElement);
-        const uint32_t usagePage = IOHIDElementGetUsagePage(refElement);
-        const uint32_t usage = IOHIDElementGetUsage(refElement);
-        recElement *element = NULL;
-        recElement **headElement = NULL;
-
-        /* look at types of interest */
-        switch (IOHIDElementGetType(refElement)) {
-            case kIOHIDElementTypeInput_Misc:
-            case kIOHIDElementTypeInput_Button:
-            case kIOHIDElementTypeInput_Axis: {
-                switch (usagePage) {    /* only interested in kHIDPage_GenericDesktop and kHIDPage_Button */
-                    case kHIDPage_GenericDesktop:
-                        switch (usage) {
-                            case kHIDUsage_GD_X:
-                            case kHIDUsage_GD_Y:
-                            case kHIDUsage_GD_Z:
-                            case kHIDUsage_GD_Rx:
-                            case kHIDUsage_GD_Ry:
-                            case kHIDUsage_GD_Rz:
-                            case kHIDUsage_GD_Slider:
-                            case kHIDUsage_GD_Dial:
-                            case kHIDUsage_GD_Wheel:
-                                if (!ElementAlreadyAdded(cookie, pDevice->firstAxis)) {
-                                    element = (recElement *) SDL_calloc(1, sizeof (recElement));
-                                    if (element) {
-                                        pDevice->axes++;
-                                        headElement = &(pDevice->firstAxis);
-                                    }
-                                }
-                                break;
-
-                            case kHIDUsage_GD_Hatswitch:
-                                if (!ElementAlreadyAdded(cookie, pDevice->firstHat)) {
-                                    element = (recElement *) SDL_calloc(1, sizeof (recElement));
-                                    if (element) {
-                                        pDevice->hats++;
-                                        headElement = &(pDevice->firstHat);
-                                    }
-                                }
-                                break;
-                            case kHIDUsage_GD_DPadUp:
-                            case kHIDUsage_GD_DPadDown:
-                            case kHIDUsage_GD_DPadRight:
-                            case kHIDUsage_GD_DPadLeft:
-                            case kHIDUsage_GD_Start:
-                            case kHIDUsage_GD_Select:
-                            case kHIDUsage_GD_SystemMainMenu:
-                                if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) {
-                                    element = (recElement *) SDL_calloc(1, sizeof (recElement));
-                                    if (element) {
-                                        pDevice->buttons++;
-                                        headElement = &(pDevice->firstButton);
-                                    }
-                                }
-                                break;
-                        }
-                        break;
-
-                    case kHIDPage_Simulation:
-                        switch (usage) {
-                            case kHIDUsage_Sim_Rudder:
-                            case kHIDUsage_Sim_Throttle:
-                            case kHIDUsage_Sim_Accelerator:
-                            case kHIDUsage_Sim_Brake:
-                                if (!ElementAlreadyAdded(cookie, pDevice->firstAxis)) {
-                                    element = (recElement *) SDL_calloc(1, sizeof (recElement));
-                                    if (element) {
-                                        pDevice->axes++;
-                                        headElement = &(pDevice->firstAxis);
-                                    }
-                                }
-                                break;
-
-                            default:
-                                break;
-                        }
-                        break;
-
-                    case kHIDPage_Button:
-                    case kHIDPage_Consumer: /* e.g. 'pause' button on Steelseries MFi gamepads. */
-                        if (!ElementAlreadyAdded(cookie, pDevice->firstButton)) {
-                            element = (recElement *) SDL_calloc(1, sizeof (recElement));
-                            if (element) {
-                                pDevice->buttons++;
-                                headElement = &(pDevice->firstButton);
-                            }
-                        }
-                        break;
-
-                    default:
-                        break;
-                }
-            }
-            break;
-
-            case kIOHIDElementTypeCollection: {
-                CFArrayRef array = IOHIDElementGetChildren(refElement);
-                if (array) {
-                    AddHIDElements(array, pDevice);
-                }
-            }
-            break;
-
-            default:
-                break;
-        }
-
-        if (element && headElement) {       /* add to list */
-            recElement *elementPrevious = NULL;
-            recElement *elementCurrent = *headElement;
-            while (elementCurrent && usage >= elementCurrent->usage) {
-                elementPrevious = elementCurrent;
-                elementCurrent = elementCurrent->pNext;
-            }
-            if (elementPrevious) {
-                elementPrevious->pNext = element;
-            } else {
-                *headElement = element;
-            }
-
-            element->elementRef = refElement;
-            element->usagePage = usagePage;
-            element->usage = usage;
-            element->pNext = elementCurrent;
-
-            element->minReport = element->min = (SInt32) IOHIDElementGetLogicalMin(refElement);
-            element->maxReport = element->max = (SInt32) IOHIDElementGetLogicalMax(refElement);
-            element->cookie = IOHIDElementGetCookie(refElement);
-
-            pDevice->elements++;
-        }
-    }
-}
-
-static SDL_bool
-GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice)
-{
-    Sint32 vendor = 0;
-    Sint32 product = 0;
-    Sint32 version = 0;
-    const char *name;
-    const char *manufacturer_remapped;
-    char manufacturer_string[256];
-    char product_string[256];
-    CFTypeRef refCF = NULL;
-    CFArrayRef array = NULL;
-    Uint16 *guid16 = (Uint16 *)pDevice->guid.data;
-    int i;
-
-    /* get usage page and usage */
-    refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsagePageKey));
-    if (refCF) {
-        CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->usagePage);
-    }
-    if (pDevice->usagePage != kHIDPage_GenericDesktop) {
-        return SDL_FALSE; /* Filter device list to non-keyboard/mouse stuff */
-    }
-
-    refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsageKey));
-    if (refCF) {
-        CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->usage);
-    }
-
-    if ((pDevice->usage != kHIDUsage_GD_Joystick &&
-         pDevice->usage != kHIDUsage_GD_GamePad &&
-         pDevice->usage != kHIDUsage_GD_MultiAxisController)) {
-        return SDL_FALSE; /* Filter device list to non-keyboard/mouse stuff */
-    }
-
-    /* Make sure we retain the use of the IOKit-provided device-object,
-       lest the device get disconnected and we try to use it.  (Fixes
-       SDL-Bugzilla #4961, aka. https://bugzilla.libsdl.org/show_bug.cgi?id=4961 )
-    */
-    CFRetain(hidDevice);
-
-    /* Now that we've CFRetain'ed the device-object (for our use), we'll
-       save the reference to it.
-    */
-    pDevice->deviceRef = hidDevice;
-
-    refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVendorIDKey));
-    if (refCF) {
-        CFNumberGetValue(refCF, kCFNumberSInt32Type, &vendor);
-    }
-
-    refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductIDKey));
-    if (refCF) {
-        CFNumberGetValue(refCF, kCFNumberSInt32Type, &product);
-    }
-
-    refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVersionNumberKey));
-    if (refCF) {
-        CFNumberGetValue(refCF, kCFNumberSInt32Type, &version);
-    }
-
-    /* get device name */
-    name = SDL_GetCustomJoystickName(vendor, product);
-    if (name) {
-        SDL_strlcpy(pDevice->product, name, sizeof(pDevice->product));
-    } else {
-        refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDManufacturerKey));
-        if ((!refCF) || (!CFStringGetCString(refCF, manufacturer_string, sizeof(manufacturer_string), kCFStringEncodingUTF8))) {
-            manufacturer_string[0] = '\0';
-        }
-        refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductKey));
-        if ((!refCF) || (!CFStringGetCString(refCF, product_string, sizeof(product_string), kCFStringEncodingUTF8))) {
-            SDL_strlcpy(product_string, "Unidentified joystick", sizeof(product_string));
-        }
-        for (i = (int)SDL_strlen(manufacturer_string) - 1; i > 0; --i) {
-            if (SDL_isspace(manufacturer_string[i])) {
-                manufacturer_string[i] = '\0';
-            } else {
-                break;
-            }
-        }
-
-        manufacturer_remapped = SDL_GetCustomJoystickManufacturer(manufacturer_string);
-        if (manufacturer_remapped != manufacturer_string) {
-            SDL_strlcpy(manufacturer_string, manufacturer_remapped, sizeof(manufacturer_string));
-        }
-
-        if (SDL_strncasecmp(manufacturer_string, product_string, SDL_strlen(manufacturer_string)) == 0) {
-            SDL_strlcpy(pDevice->product, product_string, sizeof(pDevice->product));
-        } else {
-            SDL_snprintf(pDevice->product, sizeof(pDevice->product), "%s %s", manufacturer_string, product_string);
-        }
-    }
-
-#ifdef SDL_JOYSTICK_HIDAPI
-    if (HIDAPI_IsDevicePresent(vendor, product, version, pDevice->product)) {
-        /* The HIDAPI driver is taking care of this device */
-        return 0;
-    }
-#endif
-
-    SDL_memset(pDevice->guid.data, 0, sizeof(pDevice->guid.data));
-
-    if (vendor && product) {
-        *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_USB);
-        *guid16++ = 0;
-        *guid16++ = SDL_SwapLE16((Uint16)vendor);
-        *guid16++ = 0;
-        *guid16++ = SDL_SwapLE16((Uint16)product);
-        *guid16++ = 0;
-        *guid16++ = SDL_SwapLE16((Uint16)version);
-        *guid16++ = 0;
-    } else {
-        *guid16++ = SDL_SwapLE16(SDL_HARDWARE_BUS_BLUETOOTH);
-        *guid16++ = 0;
-        SDL_strlcpy((char*)guid16, pDevice->product, sizeof(pDevice->guid.data) - 4);
-    }
-
-    array = IOHIDDeviceCopyMatchingElements(hidDevice, NULL, kIOHIDOptionsTypeNone);
-    if (array) {
-        AddHIDElements(array, pDevice);
-        CFRelease(array);
-    }
-
-    return SDL_TRUE;
-}
-
-static SDL_bool
-JoystickAlreadyKnown(IOHIDDeviceRef ioHIDDeviceObject)
-{
-    recDevice *i;
-    for (i = gpDeviceList; i != NULL; i = i->pNext) {
-        if (i->deviceRef == ioHIDDeviceObject) {
-            return SDL_TRUE;
-        }
-    }
-    return SDL_FALSE;
-}
-
-
-static void
-JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject)
-{
-    recDevice *device;
-    int device_index = 0;
-    io_service_t ioservice;
-
-    if (res != kIOReturnSuccess) {
-        return;
-    }
-
-    if (JoystickAlreadyKnown(ioHIDDeviceObject)) {
-        return;  /* IOKit sent us a duplicate. */
-    }
-
-    device = (recDevice *) SDL_calloc(1, sizeof(recDevice));
-    if (!device) {
-        SDL_OutOfMemory();
-        return;
-    }
-
-    if (!GetDeviceInfo(ioHIDDeviceObject, device)) {
-        FreeDevice(device);
-        return;   /* not a device we care about, probably. */
-    }
-
-    if (SDL_ShouldIgnoreJoystick(device->product, device->guid)) {
-        FreeDevice(device);
-        return;
-    }
-
-    /* Get notified when this device is disconnected. */
-    IOHIDDeviceRegisterRemovalCallback(ioHIDDeviceObject, JoystickDeviceWasRemovedCallback, device);
-    IOHIDDeviceScheduleWithRunLoop(ioHIDDeviceObject, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE);
-
-    /* Allocate an instance ID for this device */
-    device->instance_id = SDL_GetNextJoystickInstanceID();
-
-    /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */
-    ioservice = IOHIDDeviceGetService(ioHIDDeviceObject);
-    if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) {
-        device->ffservice = ioservice;
-#if SDL_HAPTIC_IOKIT
-        MacHaptic_MaybeAddDevice(ioservice);
-#endif
-    }
-
-    /* Add device to the end of the list */
-    if ( !gpDeviceList ) {
-        gpDeviceList = device;
-    } else {
-        recDevice *curdevice;
-
-        curdevice = gpDeviceList;
-        while ( curdevice->pNext ) {
-            ++device_index;
-            curdevice = curdevice->pNext;
-        }
-        curdevice->pNext = device;
-        ++device_index;  /* bump by one since we counted by pNext. */
-    }
-
-    SDL_PrivateJoystickAdded(device->instance_id);
-}
-
-static SDL_bool
-ConfigHIDManager(CFArrayRef matchingArray)
-{
-    CFRunLoopRef runloop = CFRunLoopGetCurrent();
-
-    if (IOHIDManagerOpen(hidman, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {
-        return SDL_FALSE;
-    }
-
-    IOHIDManagerSetDeviceMatchingMultiple(hidman, matchingArray);
-    IOHIDManagerRegisterDeviceMatchingCallback(hidman, JoystickDeviceWasAddedCallback, NULL);
-    IOHIDManagerScheduleWithRunLoop(hidman, runloop, SDL_JOYSTICK_RUNLOOP_MODE);
-
-    while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
-        /* no-op. Callback fires once per existing device. */
-    }
-
-    /* future hotplug events will come through SDL_JOYSTICK_RUNLOOP_MODE now. */
-
-    return SDL_TRUE;  /* good to go. */
-}
-
-
-static CFDictionaryRef
-CreateHIDDeviceMatchDictionary(const UInt32 page, const UInt32 usage, int *okay)
-{
-    CFDictionaryRef retval = NULL;
-    CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);
-    CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
-    const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) };
-    const void *vals[2] = { (void *) pageNumRef, (void *) usageNumRef };
-
-    if (pageNumRef && usageNumRef) {
-        retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-    }
-
-    if (pageNumRef) {
-        CFRelease(pageNumRef);
-    }
-    if (usageNumRef) {
-        CFRelease(usageNumRef);
-    }
-
-    if (!retval) {
-        *okay = 0;
-    }
-
-    return retval;
-}
-
-static SDL_bool
-CreateHIDManager(void)
-{
-    SDL_bool retval = SDL_FALSE;
-    int okay = 1;
-    const void *vals[] = {
-        (void *) CreateHIDDeviceMatchDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay),
-        (void *) CreateHIDDeviceMatchDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay),
-        (void *) CreateHIDDeviceMatchDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay),
-    };
-    const size_t numElements = SDL_arraysize(vals);
-    CFArrayRef array = okay ? CFArrayCreate(kCFAllocatorDefault, vals, numElements, &kCFTypeArrayCallBacks) : NULL;
-    size_t i;
-
-    for (i = 0; i < numElements; i++) {
-        if (vals[i]) {
-            CFRelease((CFTypeRef) vals[i]);
-        }
-    }
-
-    if (array) {
-        hidman = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
-        if (hidman != NULL) {
-            retval = ConfigHIDManager(array);
-        }
-        CFRelease(array);
-    }
-
-    return retval;
-}
-
-
-static int
-DARWIN_JoystickInit(void)
-{
-    if (gpDeviceList) {
-        return SDL_SetError("Joystick: Device list already inited.");
-    }
-
-    if (!CreateHIDManager()) {
-        return SDL_SetError("Joystick: Couldn't initialize HID Manager");
-    }
-
-    return 0;
-}
-
-static int
-DARWIN_JoystickGetCount(void)
-{
-    recDevice *device = gpDeviceList;
-    int nJoySticks = 0;
-
-    while (device) {
-        if (!device->removed) {
-            nJoySticks++;
-        }
-        device = device->pNext;
-    }
-
-    return nJoySticks;
-}
-
-static void
-DARWIN_JoystickDetect(void)
-{
-    recDevice *device = gpDeviceList;
-    while (device) {
-        if (device->removed) {
-            device = FreeDevice(device);
-        } else {
-            device = device->pNext;
-        }
-    }
-
-    /* run this after the checks above so we don't set device->removed and delete the device before
-       DARWIN_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */
-    while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
-        /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */
-    }
-}
-
-/* Function to get the device-dependent name of a joystick */
-const char *
-DARWIN_JoystickGetDeviceName(int device_index)
-{
-    recDevice *device = GetDeviceForIndex(device_index);
-    return device ? device->product : "UNKNOWN";
-}
-
-static int
-DARWIN_JoystickGetDevicePlayerIndex(int device_index)
-{
-    return -1;
-}
-
-static void
-DARWIN_JoystickSetDevicePlayerIndex(int device_index, int player_index)
-{
-}
-
-static SDL_JoystickGUID
-DARWIN_JoystickGetDeviceGUID( int device_index )
-{
-    recDevice *device = GetDeviceForIndex(device_index);
-    SDL_JoystickGUID guid;
-    if (device) {
-        guid = device->guid;
-    } else {
-        SDL_zero(guid);
-    }
-    return guid;
-}
-
-static SDL_JoystickID
-DARWIN_JoystickGetDeviceInstanceID(int device_index)
-{
-    recDevice *device = GetDeviceForIndex(device_index);
-    return device ? device->instance_id : 0;
-}
-
-static int
-DARWIN_JoystickOpen(SDL_Joystick * joystick, int device_index)
-{
-    recDevice *device = GetDeviceForIndex(device_index);
-
-    joystick->instance_id = device->instance_id;
-    joystick->hwdata = device;
-    joystick->name = device->product;
-
-    joystick->naxes = device->axes;
-    joystick->nhats = device->hats;
-    joystick->nballs = 0;
-    joystick->nbuttons = device->buttons;
-    return 0;
-}
-
-/*
- * Like strerror but for force feedback errors.
- */
-static const char *
-FFStrError(unsigned int err)
-{
-    switch (err) {
-    case FFERR_DEVICEFULL:
-        return "device full";
-    /* This should be valid, but for some reason isn't defined... */
-    /* case FFERR_DEVICENOTREG:
-        return "device not registered"; */
-    case FFERR_DEVICEPAUSED:
-        return "device paused";
-    case FFERR_DEVICERELEASED:
-        return "device released";
-    case FFERR_EFFECTPLAYING:
-        return "effect playing";
-    case FFERR_EFFECTTYPEMISMATCH:
-        return "effect type mismatch";
-    case FFERR_EFFECTTYPENOTSUPPORTED:
-        return "effect type not supported";
-    case FFERR_GENERIC:
-        return "undetermined error";
-    case FFERR_HASEFFECTS:
-        return "device has effects";
-    case FFERR_INCOMPLETEEFFECT:
-        return "incomplete effect";
-    case FFERR_INTERNAL:
-        return "internal fault";
-    case FFERR_INVALIDDOWNLOADID:
-        return "invalid download id";
-    case FFERR_INVALIDPARAM:
-        return "invalid parameter";
-    case FFERR_MOREDATA:
-        return "more data";
-    case FFERR_NOINTERFACE:
-        return "interface not supported";
-    case FFERR_NOTDOWNLOADED:
-        return "effect is not downloaded";
-    case FFERR_NOTINITIALIZED:
-        return "object has not been initialized";
-    case FFERR_OUTOFMEMORY:
-        return "out of memory";
-    case FFERR_UNPLUGGED:
-        return "device is unplugged";
-    case FFERR_UNSUPPORTED:
-        return "function call unsupported";
-    case FFERR_UNSUPPORTEDAXIS:
-        return "axis unsupported";
-
-    default:
-        return "unknown error";
-    }
-}
-
-static int
-DARWIN_JoystickInitRumble(recDevice *device, Sint16 magnitude)
-{
-    HRESULT result;
-
-    if (!device->ffdevice) {
-        result = FFCreateDevice(device->ffservice, &device->ffdevice);
-        if (result != FF_OK) {
-            return SDL_SetError("Unable to create force feedback device from service: %s", FFStrError(result));
-        }
-    }
-
-    /* Reset and then enable actuators */
-    result = FFDeviceSendForceFeedbackCommand(device->ffdevice, FFSFFC_RESET);
-    if (result != FF_OK) {
-        return SDL_SetError("Unable to reset force feedback device: %s", FFStrError(result));
-    }
-
-    result = FFDeviceSendForceFeedbackCommand(device->ffdevice, FFSFFC_SETACTUATORSON);
-    if (result != FF_OK) {
-        return SDL_SetError("Unable to enable force feedback actuators: %s", FFStrError(result));
-    }
-
-    /* Create the effect */
-    device->ffeffect = CreateRumbleEffectData(magnitude);
-    if (!device->ffeffect) {
-        return SDL_OutOfMemory();
-    }
-
-    result = FFDeviceCreateEffect(device->ffdevice, kFFEffectType_Sine_ID,
-                               device->ffeffect, &device->ffeffect_ref);
-    if (result != FF_OK) {
-        return SDL_SetError("Haptic: Unable to create effect: %s", FFStrError(result));
-    }
-    return 0;
-}
-
-static int
-DARWIN_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
-{
-    HRESULT result;
-    recDevice *device = joystick->hwdata;
-
-    /* Scale and average the two rumble strengths */
-    Sint16 magnitude = (Sint16)(((low_frequency_rumble / 2) + (high_frequency_rumble / 2)) / 2);
-
-    if (!device->ffservice) {
-        return SDL_Unsupported();
-    }
-
-    if (device->ff_initialized) {
-        FFPERIODIC *periodic = ((FFPERIODIC *)device->ffeffect->lpvTypeSpecificParams);
-        periodic->dwMagnitude = CONVERT_MAGNITUDE(magnitude);
-
-        result = FFEffectSetParameters(device->ffeffect_ref, device->ffeffect,
-                                    (FFEP_DURATION | FFEP_TYPESPECIFICPARAMS));
-        if (result != FF_OK) {
-            return SDL_SetError("Unable to update rumble effect: %s", FFStrError(result));
-        }
-    } else {
-        if (DARWIN_JoystickInitRumble(device, magnitude) < 0) {
-            return -1;
-        }
-        device->ff_initialized = SDL_TRUE;
-    }
-
-    result = FFEffectStart(device->ffeffect_ref, 1, 0);
-    if (result != FF_OK) {
-        return SDL_SetError("Unable to run the rumble effect: %s", FFStrError(result));
-    }
-    return 0;
-}
-
-static void
-DARWIN_JoystickUpdate(SDL_Joystick * joystick)
-{
-    recDevice *device = joystick->hwdata;
-    recElement *element;
-    SInt32 value, range;
-    int i;
-
-    if (!device) {
-        return;
-    }
-
-    if (device->removed) {      /* device was unplugged; ignore it. */
-        if (joystick->hwdata) {
-            joystick->force_recentering = SDL_TRUE;
-            joystick->hwdata = NULL;
-        }
-        return;
-    }
-
-    element = device->firstAxis;
-    i = 0;
-
-    int goodRead = SDL_FALSE;
-    while (element) {
-        goodRead = GetHIDScaledCalibratedState(device, element, -32768, 32767, &value);
-        if (goodRead) {
-            SDL_PrivateJoystickAxis(joystick, i, value);
-        }
-
-        element = element->pNext;
-        ++i;
-    }
-
-    element = device->firstButton;
-    i = 0;
-    while (element) {
-        goodRead = GetHIDElementState(device, element, &value);
-        if (goodRead) {
-            if (value > 1) {          /* handle pressure-sensitive buttons */
-                value = 1;
-            }
-            SDL_PrivateJoystickButton(joystick, i, value);
-        }
-
-        element = element->pNext;
-        ++i;
-    }
-
-    element = device->firstHat;
-    i = 0;
-    
-    while (element) {
-        Uint8 pos = 0;
-
-        range = (element->max - element->min + 1);
-        goodRead = GetHIDElementState(device, element, &value);
-        if (goodRead) {
-            value -= element->min;
-            if (range == 4) {         /* 4 position hatswitch - scale up value */
-                value *= 2;
-            } else if (range != 8) {    /* Neither a 4 nor 8 positions - fall back to default position (centered) */
-                value = -1;
-            }
-            switch (value) {
-            case 0:
-                pos = SDL_HAT_UP;
-                break;
-            case 1:
-                pos = SDL_HAT_RIGHTUP;
-                break;
-            case 2:
-                pos = SDL_HAT_RIGHT;
-                break;
-            case 3:
-                pos = SDL_HAT_RIGHTDOWN;
-                break;
-            case 4:
-                pos = SDL_HAT_DOWN;
-                break;
-            case 5:
-                pos = SDL_HAT_LEFTDOWN;
-                break;
-            case 6:
-                pos = SDL_HAT_LEFT;
-                break;
-            case 7:
-                pos = SDL_HAT_LEFTUP;
-                break;
-            default:
-                /* Every other value is mapped to center. We do that because some
-                 * joysticks use 8 and some 15 for this value, and apparently
-                 * there are even more variants out there - so we try to be generous.
-                 */
-                pos = SDL_HAT_CENTERED;
-                break;
-            }
-
-            SDL_PrivateJoystickHat(joystick, i, pos);
-        }
-        
-        element = element->pNext;
-        ++i;
-    }
-}
-
-static void
-DARWIN_JoystickClose(SDL_Joystick * joystick)
-{
-}
-
-static void
-DARWIN_JoystickQuit(void)
-{
-    while (FreeDevice(gpDeviceList)) {
-        /* spin */
-    }
-
-    if (hidman) {
-        IOHIDManagerUnscheduleFromRunLoop(hidman, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE);
-        IOHIDManagerClose(hidman, kIOHIDOptionsTypeNone);
-        CFRelease(hidman);
-        hidman = NULL;
-    }
-}
-
-SDL_JoystickDriver SDL_DARWIN_JoystickDriver =
-{
-    DARWIN_JoystickInit,
-    DARWIN_JoystickGetCount,
-    DARWIN_JoystickDetect,
-    DARWIN_JoystickGetDeviceName,
-    DARWIN_JoystickGetDevicePlayerIndex,
-    DARWIN_JoystickSetDevicePlayerIndex,
-    DARWIN_JoystickGetDeviceGUID,
-    DARWIN_JoystickGetDeviceInstanceID,
-    DARWIN_JoystickOpen,
-    DARWIN_JoystickRumble,
-    DARWIN_JoystickUpdate,
-    DARWIN_JoystickClose,
-    DARWIN_JoystickQuit,
-};
-
-#endif /* SDL_JOYSTICK_IOKIT */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 79
Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h

@@ -1,79 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2020 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#ifndef SDL_JOYSTICK_IOKIT_H
-#define SDL_JOYSTICK_IOKIT_H
-
-#include <IOKit/hid/IOHIDLib.h>
-#include <ForceFeedback/ForceFeedback.h>
-#include <ForceFeedback/ForceFeedbackConstants.h>
-
-struct recElement
-{
-    IOHIDElementRef elementRef;
-    IOHIDElementCookie cookie;
-    uint32_t usagePage, usage;      /* HID usage */
-    SInt32 min;                   /* reported min value possible */
-    SInt32 max;                   /* reported max value possible */
-
-    /* runtime variables used for auto-calibration */
-    SInt32 minReport;             /* min returned value */
-    SInt32 maxReport;             /* max returned value */
-
-    struct recElement *pNext;   /* next element in list */
-};
-typedef struct recElement recElement;
-
-struct joystick_hwdata
-{
-    IOHIDDeviceRef deviceRef;   /* HIDManager device handle */
-    io_service_t ffservice;     /* Interface for force feedback, 0 = no ff */
-    FFDeviceObjectReference ffdevice;
-    FFEFFECT *ffeffect;
-    FFEffectObjectReference ffeffect_ref;
-    SDL_bool ff_initialized;
-
-    char product[256];          /* name of product */
-    uint32_t usage;                 /* usage page from IOUSBHID Parser.h which defines general usage */
-    uint32_t usagePage;             /* usage within above page from IOUSBHID Parser.h which defines specific usage */
-
-    int axes;                  /* number of axis (calculated, not reported by device) */
-    int buttons;               /* number of buttons (calculated, not reported by device) */
-    int hats;                  /* number of hat switches (calculated, not reported by device) */
-    int elements;              /* number of total elements (should be total of above) (calculated, not reported by device) */
-
-    recElement *firstAxis;
-    recElement *firstButton;
-    recElement *firstHat;
-
-    SDL_bool removed;
-
-    int instance_id;
-    SDL_JoystickGUID guid;
-
-    struct joystick_hwdata *pNext;      /* next device */
-};
-typedef struct joystick_hwdata recDevice;
-
-#endif /* SDL_JOYSTICK_IOKIT_H */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 863
Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m

@@ -1,863 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2020 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-/* This is the iOS implementation of the SDL joystick API */
-#include "SDL_sysjoystick_c.h"
-
-/* needed for SDL_IPHONE_MAX_GFORCE macro */
-#include "../../../include/SDL_config_iphoneos.h"
-
-#include "SDL_assert.h"
-#include "SDL_events.h"
-#include "SDL_joystick.h"
-#include "SDL_hints.h"
-#include "SDL_stdinc.h"
-#include "../SDL_sysjoystick.h"
-#include "../SDL_joystick_c.h"
-
-
-#if !SDL_EVENTS_DISABLED
-#include "../../events/SDL_events_c.h"
-#endif
-
-#if !TARGET_OS_TV
-#import <CoreMotion/CoreMotion.h>
-#endif
-
-#ifdef SDL_JOYSTICK_MFI
-#import <GameController/GameController.h>
-
-static id connectObserver = nil;
-static id disconnectObserver = nil;
-
-#include <Availability.h>
-#include <objc/message.h>
-
-/* remove compilation warnings for strict builds by defining these selectors, even though
- * they are only ever used indirectly through objc_msgSend
- */
-@interface GCExtendedGamepad (SDL)
-#if (__IPHONE_OS_VERSION_MAX_ALLOWED < 121000) || (__APPLETV_OS_VERSION_MAX_ALLOWED < 121000) || (__MAC_OS_VERSION_MAX_ALLOWED < 1401000)
-@property (nonatomic, readonly, nullable) GCControllerButtonInput *leftThumbstickButton;
-@property (nonatomic, readonly, nullable) GCControllerButtonInput *rightThumbstickButton;
-#endif
-#if (__IPHONE_OS_VERSION_MAX_ALLOWED < 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED < 130000) || (__MAC_OS_VERSION_MAX_ALLOWED < 1500000)
-@property (nonatomic, readonly) GCControllerButtonInput *buttonMenu;
-@property (nonatomic, readonly, nullable) GCControllerButtonInput *buttonOptions;
-#endif
-@end
-@interface GCMicroGamepad (SDL)
-#if (__IPHONE_OS_VERSION_MAX_ALLOWED < 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED < 130000) || (__MAC_OS_VERSION_MAX_ALLOWED < 1500000)
-@property (nonatomic, readonly) GCControllerButtonInput *buttonMenu;
-#endif
-@end
-
-#endif /* SDL_JOYSTICK_MFI */
-
-#if !TARGET_OS_TV
-static const char *accelerometerName = "iOS Accelerometer";
-static CMMotionManager *motionManager = nil;
-#endif /* !TARGET_OS_TV */
-
-static SDL_JoystickDeviceItem *deviceList = NULL;
-
-static int numjoysticks = 0;
-int SDL_AppleTVRemoteOpenedAsJoystick = 0;
-
-static SDL_JoystickDeviceItem *
-GetDeviceForIndex(int device_index)
-{
-    SDL_JoystickDeviceItem *device = deviceList;
-    int i = 0;
-
-    while (i < device_index) {
-        if (device == NULL) {
-            return NULL;
-        }
-        device = device->next;
-        i++;
-    }
-
-    return device;
-}
-
-static void
-IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller)
-{
-#ifdef SDL_JOYSTICK_MFI
-    const Uint16 VENDOR_APPLE = 0x05AC;
-    const Uint16 VENDOR_MICROSOFT = 0x045e;
-    const Uint16 VENDOR_SONY = 0x054C;
-    Uint16 *guid16 = (Uint16 *)device->guid.data;
-    Uint16 vendor = 0;
-    Uint16 product = 0;
-    Uint8 subtype = 0;
-
-    const char *name = NULL;
-    /* Explicitly retain the controller because SDL_JoystickDeviceItem is a
-     * struct, and ARC doesn't work with structs. */
-    device->controller = (__bridge GCController *) CFBridgingRetain(controller);
-
-    if (controller.vendorName) {
-        name = controller.vendorName.UTF8String;
-    }
-
-    if (!name) {
-        name = "MFi Gamepad";
-    }
-
-    device->name = SDL_strdup(name);
-
-    if (controller.extendedGamepad) {
-        GCExtendedGamepad *gamepad = controller.extendedGamepad;
-        BOOL is_xbox = [controller.vendorName containsString: @"Xbox"];
-        BOOL is_ps4 = [controller.vendorName containsString: @"DUALSHOCK"];
-#if TARGET_OS_TV
-        BOOL is_MFi = (!is_xbox && !is_ps4);
-#endif
-        int nbuttons = 0;
-
-        /* These buttons are part of the original MFi spec */
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
-        nbuttons += 6;
-
-        /* These buttons are available on some newer controllers */
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
-        if ([gamepad respondsToSelector:@selector(leftThumbstickButton)] && gamepad.leftThumbstickButton) {
-            device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK);
-            ++nbuttons;
-        }
-        if ([gamepad respondsToSelector:@selector(rightThumbstickButton)] && gamepad.rightThumbstickButton) {
-            device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK);
-            ++nbuttons;
-        }
-        if ([gamepad respondsToSelector:@selector(buttonOptions)] && gamepad.buttonOptions) {
-            device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_BACK);
-            ++nbuttons;
-        }
-        BOOL has_direct_menu = [gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu;
-#if TARGET_OS_TV
-        /* On tvOS MFi controller menu button brings you to the home screen */
-        if (is_MFi) {
-            has_direct_menu = FALSE;
-        }
-#endif
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START);
-        ++nbuttons;
-        if (!has_direct_menu) {
-            device->uses_pause_handler = SDL_TRUE;
-        }
-#pragma clang diagnostic pop
-
-        if (is_xbox) {
-            vendor = VENDOR_MICROSOFT;
-            product = 0x02E0; /* Assume Xbox One S BLE Controller unless/until GCController flows VID/PID */
-        } else if (is_ps4) {
-            vendor = VENDOR_SONY;
-            product = 0x09CC; /* Assume DS4 Slim unless/until GCController flows VID/PID */
-        } else {
-            vendor = VENDOR_APPLE;
-            product = 1;
-            subtype = 1;
-        }
-
-        device->naxes = 6; /* 2 thumbsticks and 2 triggers */
-        device->nhats = 1; /* d-pad */
-        device->nbuttons = nbuttons;
-
-    } else if (controller.gamepad) {
-        int nbuttons = 0;
-
-        /* These buttons are part of the original MFi spec */
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START);
-        nbuttons += 7;
-        device->uses_pause_handler = SDL_TRUE;
-
-        vendor = VENDOR_APPLE;
-        product = 2;
-        subtype = 2;
-        device->naxes = 0; /* no traditional analog inputs */
-        device->nhats = 1; /* d-pad */
-        device->nbuttons = nbuttons;
-    }
-#if TARGET_OS_TV
-    else if (controller.microGamepad) {
-        int nbuttons = 0;
-
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A);
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); /* Button X on microGamepad */
-        nbuttons += 2;
-
-        device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START);
-        ++nbuttons;
-        device->uses_pause_handler = SDL_TRUE;
-
-        vendor = VENDOR_APPLE;
-        product = 3;
-        subtype = 3;
-        device->naxes = 2; /* treat the touch surface as two axes */
-        device->nhats = 0; /* apparently the touch surface-as-dpad is buggy */
-        device->nbuttons = nbuttons;
-
-        controller.microGamepad.allowsRotation = SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, SDL_FALSE);
-    }
-#endif /* TARGET_OS_TV */
-
-    /* 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++ = SDL_SwapLE16(SDL_HARDWARE_BUS_BLUETOOTH);
-    *guid16++ = 0;
-    *guid16++ = SDL_SwapLE16(vendor);
-    *guid16++ = 0;
-    *guid16++ = SDL_SwapLE16(product);
-    *guid16++ = 0;
-
-    *guid16++ = SDL_SwapLE16(device->button_mask);
-
-    if (subtype != 0) {
-        /* Note that this is an MFI controller and what subtype it is */
-        device->guid.data[14] = 'm';
-        device->guid.data[15] = subtype;
-    }
-
-    /* This will be set when the first button press of the controller is
-     * detected. */
-    controller.playerIndex = -1;
-
-#endif /* SDL_JOYSTICK_MFI */
-}
-
-static void
-IOS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer)
-{
-    SDL_JoystickDeviceItem *device = deviceList;
-
-#if TARGET_OS_TV
-    if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) {
-        /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */
-        if (controller && !controller.extendedGamepad && !controller.gamepad && controller.microGamepad) {
-            return;
-        }
-    }
-#endif
-
-    while (device != NULL) {
-        if (device->controller == controller) {
-            return;
-        }
-        device = device->next;
-    }
-
-    device = (SDL_JoystickDeviceItem *) SDL_calloc(1, sizeof(SDL_JoystickDeviceItem));
-    if (device == NULL) {
-        return;
-    }
-
-    device->accelerometer = accelerometer;
-    device->instance_id = SDL_GetNextJoystickInstanceID();
-
-    if (accelerometer) {
-#if TARGET_OS_TV
-        SDL_free(device);
-        return;
-#else
-        device->name = SDL_strdup(accelerometerName);
-        device->naxes = 3; /* Device acceleration in the x, y, and z axes. */
-        device->nhats = 0;
-        device->nbuttons = 0;
-
-        /* Use the accelerometer name as a GUID. */
-        SDL_memcpy(&device->guid.data, device->name, SDL_min(sizeof(SDL_JoystickGUID), SDL_strlen(device->name)));
-#endif /* TARGET_OS_TV */
-    } else if (controller) {
-        IOS_AddMFIJoystickDevice(device, controller);
-    }
-
-    if (deviceList == NULL) {
-        deviceList = device;
-    } else {
-        SDL_JoystickDeviceItem *lastdevice = deviceList;
-        while (lastdevice->next != NULL) {
-            lastdevice = lastdevice->next;
-        }
-        lastdevice->next = device;
-    }
-
-    ++numjoysticks;
-
-    SDL_PrivateJoystickAdded(device->instance_id);
-}
-
-static SDL_JoystickDeviceItem *
-IOS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device)
-{
-    SDL_JoystickDeviceItem *prev = NULL;
-    SDL_JoystickDeviceItem *next = NULL;
-    SDL_JoystickDeviceItem *item = deviceList;
-
-    if (device == NULL) {
-        return NULL;
-    }
-
-    next = device->next;
-
-    while (item != NULL) {
-        if (item == device) {
-            break;
-        }
-        prev = item;
-        item = item->next;
-    }
-
-    /* Unlink the device item from the device list. */
-    if (prev) {
-        prev->next = device->next;
-    } else if (device == deviceList) {
-        deviceList = device->next;
-    }
-
-    if (device->joystick) {
-        device->joystick->hwdata = NULL;
-    }
-
-#ifdef SDL_JOYSTICK_MFI
-    @autoreleasepool {
-        if (device->controller) {
-            /* The controller was explicitly retained in the struct, so it
-             * should be explicitly released before freeing the struct. */
-            GCController *controller = CFBridgingRelease((__bridge CFTypeRef)(device->controller));
-            controller.controllerPausedHandler = nil;
-            device->controller = nil;
-        }
-    }
-#endif /* SDL_JOYSTICK_MFI */
-
-    --numjoysticks;
-
-    SDL_PrivateJoystickRemoved(device->instance_id);
-
-    SDL_free(device->name);
-    SDL_free(device);
-
-    return next;
-}
-
-#if TARGET_OS_TV
-static void SDLCALL
-SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue)
-{
-    BOOL allowRotation = newValue != NULL && *newValue != '0';
-
-    @autoreleasepool {
-        for (GCController *controller in [GCController controllers]) {
-            if (controller.microGamepad) {
-                controller.microGamepad.allowsRotation = allowRotation;
-            }
-        }
-    }
-}
-#endif /* TARGET_OS_TV */
-
-static int
-IOS_JoystickInit(void)
-{
-    @autoreleasepool {
-        NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
-
-#if !TARGET_OS_TV
-        if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) {
-            /* Default behavior, accelerometer as joystick */
-            IOS_AddJoystickDevice(nil, SDL_TRUE);
-        }
-#endif /* !TARGET_OS_TV */
-
-#ifdef SDL_JOYSTICK_MFI
-        /* GameController.framework was added in iOS 7. */
-        if (![GCController class]) {
-            return 0;
-        }
-
-        for (GCController *controller in [GCController controllers]) {
-            IOS_AddJoystickDevice(controller, SDL_FALSE);
-        }
-
-#if TARGET_OS_TV
-        SDL_AddHintCallback(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION,
-                            SDL_AppleTVRemoteRotationHintChanged, NULL);
-#endif /* TARGET_OS_TV */
-
-        connectObserver = [center addObserverForName:GCControllerDidConnectNotification
-                                              object:nil
-                                               queue:nil
-                                          usingBlock:^(NSNotification *note) {
-                                              GCController *controller = note.object;
-                                              IOS_AddJoystickDevice(controller, SDL_FALSE);
-                                          }];
-
-        disconnectObserver = [center addObserverForName:GCControllerDidDisconnectNotification
-                                                 object:nil
-                                                  queue:nil
-                                             usingBlock:^(NSNotification *note) {
-                                                 GCController *controller = note.object;
-                                                 SDL_JoystickDeviceItem *device = deviceList;
-                                                 while (device != NULL) {
-                                                     if (device->controller == controller) {
-                                                         IOS_RemoveJoystickDevice(device);
-                                                         break;
-                                                     }
-                                                     device = device->next;
-                                                 }
-                                             }];
-#endif /* SDL_JOYSTICK_MFI */
-    }
-
-    return 0;
-}
-
-static int
-IOS_JoystickGetCount(void)
-{
-    return numjoysticks;
-}
-
-static void
-IOS_JoystickDetect(void)
-{
-}
-
-static const char *
-IOS_JoystickGetDeviceName(int device_index)
-{
-    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
-    return device ? device->name : "Unknown";
-}
-
-static int
-IOS_JoystickGetDevicePlayerIndex(int device_index)
-{
-    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
-    return device ? (int)device->controller.playerIndex : -1;
-}
-
-static void
-IOS_JoystickSetDevicePlayerIndex(int device_index, int player_index)
-{
-    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
-    if (device) {
-        device->controller.playerIndex = player_index;
-    }
-}
-
-static SDL_JoystickGUID
-IOS_JoystickGetDeviceGUID( int device_index )
-{
-    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
-    SDL_JoystickGUID guid;
-    if (device) {
-        guid = device->guid;
-    } else {
-        SDL_zero(guid);
-    }
-    return guid;
-}
-
-static SDL_JoystickID
-IOS_JoystickGetDeviceInstanceID(int device_index)
-{
-    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
-    return device ? device->instance_id : -1;
-}
-
-static int
-IOS_JoystickOpen(SDL_Joystick * joystick, int device_index)
-{
-    SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
-    if (device == NULL) {
-        return SDL_SetError("Could not open Joystick: no hardware device for the specified index");
-    }
-
-    joystick->hwdata = device;
-    joystick->instance_id = device->instance_id;
-
-    joystick->naxes = device->naxes;
-    joystick->nhats = device->nhats;
-    joystick->nbuttons = device->nbuttons;
-    joystick->nballs = 0;
-
-    device->joystick = joystick;
-
-    @autoreleasepool {
-        if (device->accelerometer) {
-#if !TARGET_OS_TV
-            if (motionManager == nil) {
-                motionManager = [[CMMotionManager alloc] init];
-            }
-
-            /* Shorter times between updates can significantly increase CPU usage. */
-            motionManager.accelerometerUpdateInterval = 0.1;
-            [motionManager startAccelerometerUpdates];
-#endif /* !TARGET_OS_TV */
-        } else {
-#ifdef SDL_JOYSTICK_MFI
-            if (device->uses_pause_handler) {
-                GCController *controller = device->controller;
-                controller.controllerPausedHandler = ^(GCController *c) {
-                    if (joystick->hwdata) {
-                        ++joystick->hwdata->num_pause_presses;
-                    }
-                };
-            }
-#endif /* SDL_JOYSTICK_MFI */
-        }
-    }
-    if (device->remote) {
-        ++SDL_AppleTVRemoteOpenedAsJoystick;
-    }
-
-    return 0;
-}
-
-static void
-IOS_AccelerometerUpdate(SDL_Joystick * joystick)
-{
-#if !TARGET_OS_TV
-    const float maxgforce = SDL_IPHONE_MAX_GFORCE;
-    const SInt16 maxsint16 = 0x7FFF;
-    CMAcceleration accel;
-
-    @autoreleasepool {
-        if (!motionManager.isAccelerometerActive) {
-            return;
-        }
-
-        accel = motionManager.accelerometerData.acceleration;
-    }
-
-    /*
-     Convert accelerometer data from floating point to Sint16, which is what
-     the joystick system expects.
-
-     To do the conversion, the data is first clamped onto the interval
-     [-SDL_IPHONE_MAX_G_FORCE, SDL_IPHONE_MAX_G_FORCE], then the data is multiplied
-     by MAX_SINT16 so that it is mapped to the full range of an Sint16.
-
-     You can customize the clamped range of this function by modifying the
-     SDL_IPHONE_MAX_GFORCE macro in SDL_config_iphoneos.h.
-
-     Once converted to Sint16, the accelerometer data no longer has coherent
-     units. You can convert the data back to units of g-force by multiplying
-     it in your application's code by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
-     */
-
-    /* clamp the data */
-    accel.x = SDL_min(SDL_max(accel.x, -maxgforce), maxgforce);
-    accel.y = SDL_min(SDL_max(accel.y, -maxgforce), maxgforce);
-    accel.z = SDL_min(SDL_max(accel.z, -maxgforce), maxgforce);
-
-    /* pass in data mapped to range of SInt16 */
-    SDL_PrivateJoystickAxis(joystick, 0,  (accel.x / maxgforce) * maxsint16);
-    SDL_PrivateJoystickAxis(joystick, 1, -(accel.y / maxgforce) * maxsint16);
-    SDL_PrivateJoystickAxis(joystick, 2,  (accel.z / maxgforce) * maxsint16);
-#endif /* !TARGET_OS_TV */
-}
-
-#ifdef SDL_JOYSTICK_MFI
-static Uint8
-IOS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad)
-{
-    Uint8 hat = 0;
-
-    if (dpad.up.isPressed) {
-        hat |= SDL_HAT_UP;
-    } else if (dpad.down.isPressed) {
-        hat |= SDL_HAT_DOWN;
-    }
-
-    if (dpad.left.isPressed) {
-        hat |= SDL_HAT_LEFT;
-    } else if (dpad.right.isPressed) {
-        hat |= SDL_HAT_RIGHT;
-    }
-
-    if (hat == 0) {
-        return SDL_HAT_CENTERED;
-    }
-
-    return hat;
-}
-#endif
-
-static void
-IOS_MFIJoystickUpdate(SDL_Joystick * joystick)
-{
-#if SDL_JOYSTICK_MFI
-    @autoreleasepool {
-        GCController *controller = joystick->hwdata->controller;
-        Uint8 hatstate = SDL_HAT_CENTERED;
-        int i;
-        int pause_button_index = 0;
-
-        if (controller.extendedGamepad) {
-            GCExtendedGamepad *gamepad = controller.extendedGamepad;
-
-            /* Axis order matches the XInput Windows mappings. */
-            Sint16 axes[] = {
-                (Sint16) (gamepad.leftThumbstick.xAxis.value * 32767),
-                (Sint16) (gamepad.leftThumbstick.yAxis.value * -32767),
-                (Sint16) ((gamepad.leftTrigger.value * 65535) - 32768),
-                (Sint16) (gamepad.rightThumbstick.xAxis.value * 32767),
-                (Sint16) (gamepad.rightThumbstick.yAxis.value * -32767),
-                (Sint16) ((gamepad.rightTrigger.value * 65535) - 32768),
-            };
-
-            /* Button order matches the XInput Windows mappings. */
-            Uint8 buttons[joystick->nbuttons];
-            int button_count = 0;
-
-            /* These buttons are part of the original MFi spec */
-            buttons[button_count++] = gamepad.buttonA.isPressed;
-            buttons[button_count++] = gamepad.buttonB.isPressed;
-            buttons[button_count++] = gamepad.buttonX.isPressed;
-            buttons[button_count++] = gamepad.buttonY.isPressed;
-            buttons[button_count++] = gamepad.leftShoulder.isPressed;
-            buttons[button_count++] = gamepad.rightShoulder.isPressed;
-
-            /* These buttons are available on some newer controllers */
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
-            if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK)) {
-                buttons[button_count++] = gamepad.leftThumbstickButton.isPressed;
-            }
-            if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK)) {
-                buttons[button_count++] = gamepad.rightThumbstickButton.isPressed;
-            }
-            if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) {
-                buttons[button_count++] = gamepad.buttonOptions.isPressed;
-            }
-            /* This must be the last button, so we can optionally handle it with pause_button_index below */
-            if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
-                if (joystick->hwdata->uses_pause_handler) {
-                    pause_button_index = button_count;
-                    buttons[button_count++] = joystick->delayed_guide_button;
-                } else {
-                    buttons[button_count++] = gamepad.buttonMenu.isPressed;
-                }
-            }
-#pragma clang diagnostic pop
-
-            hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad);
-
-            for (i = 0; i < SDL_arraysize(axes); i++) {
-                SDL_PrivateJoystickAxis(joystick, i, axes[i]);
-            }
-
-            for (i = 0; i < button_count; i++) {
-                SDL_PrivateJoystickButton(joystick, i, buttons[i]);
-            }
-        } else if (controller.gamepad) {
-            GCGamepad *gamepad = controller.gamepad;
-
-            /* Button order matches the XInput Windows mappings. */
-            Uint8 buttons[joystick->nbuttons];
-            int button_count = 0;
-            buttons[button_count++] = gamepad.buttonA.isPressed;
-            buttons[button_count++] = gamepad.buttonB.isPressed;
-            buttons[button_count++] = gamepad.buttonX.isPressed;
-            buttons[button_count++] = gamepad.buttonY.isPressed;
-            buttons[button_count++] = gamepad.leftShoulder.isPressed;
-            buttons[button_count++] = gamepad.rightShoulder.isPressed;
-            pause_button_index = button_count;
-            buttons[button_count++] = joystick->delayed_guide_button;
-
-            hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad);
-
-            for (i = 0; i < button_count; i++) {
-                SDL_PrivateJoystickButton(joystick, i, buttons[i]);
-            }
-        }
-#if TARGET_OS_TV
-        else if (controller.microGamepad) {
-            GCMicroGamepad *gamepad = controller.microGamepad;
-
-            Sint16 axes[] = {
-                (Sint16) (gamepad.dpad.xAxis.value * 32767),
-                (Sint16) (gamepad.dpad.yAxis.value * -32767),
-            };
-
-            for (i = 0; i < SDL_arraysize(axes); i++) {
-                SDL_PrivateJoystickAxis(joystick, i, axes[i]);
-            }
-
-            Uint8 buttons[joystick->nbuttons];
-            int button_count = 0;
-            buttons[button_count++] = gamepad.buttonA.isPressed;
-            buttons[button_count++] = gamepad.buttonX.isPressed;
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
-            /* This must be the last button, so we can optionally handle it with pause_button_index below */
-            if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) {
-                if (joystick->hwdata->uses_pause_handler) {
-                    pause_button_index = button_count;
-                    buttons[button_count++] = joystick->delayed_guide_button;
-                } else {
-                    buttons[button_count++] = gamepad.buttonMenu.isPressed;
-                }
-            }
-#pragma clang diagnostic pop
-
-            for (i = 0; i < button_count; i++) {
-                SDL_PrivateJoystickButton(joystick, i, buttons[i]);
-            }
-        }
-#endif /* TARGET_OS_TV */
-
-        if (joystick->nhats > 0) {
-            SDL_PrivateJoystickHat(joystick, 0, hatstate);
-        }
-
-        if (joystick->hwdata->uses_pause_handler) {
-            for (i = 0; i < joystick->hwdata->num_pause_presses; i++) {
-                SDL_PrivateJoystickButton(joystick, pause_button_index, SDL_PRESSED);
-                SDL_PrivateJoystickButton(joystick, pause_button_index, SDL_RELEASED);
-            }
-            joystick->hwdata->num_pause_presses = 0;
-        }
-    }
-#endif /* SDL_JOYSTICK_MFI */
-}
-
-static int
-IOS_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
-{
-    return SDL_Unsupported();
-}
-
-static void
-IOS_JoystickUpdate(SDL_Joystick * joystick)
-{
-    SDL_JoystickDeviceItem *device = joystick->hwdata;
-
-    if (device == NULL) {
-        return;
-    }
-    
-    if (device->accelerometer) {
-        IOS_AccelerometerUpdate(joystick);
-    } else if (device->controller) {
-        IOS_MFIJoystickUpdate(joystick);
-    }
-}
-
-static void
-IOS_JoystickClose(SDL_Joystick * joystick)
-{
-    SDL_JoystickDeviceItem *device = joystick->hwdata;
-
-    if (device == NULL) {
-        return;
-    }
-
-    device->joystick = NULL;
-
-    @autoreleasepool {
-        if (device->accelerometer) {
-#if !TARGET_OS_TV
-            [motionManager stopAccelerometerUpdates];
-#endif /* !TARGET_OS_TV */
-        } else if (device->controller) {
-#ifdef SDL_JOYSTICK_MFI
-            GCController *controller = device->controller;
-            controller.controllerPausedHandler = nil;
-            controller.playerIndex = -1;
-#endif
-        }
-    }
-    if (device->remote) {
-        --SDL_AppleTVRemoteOpenedAsJoystick;
-    }
-}
-
-static void
-IOS_JoystickQuit(void)
-{
-    @autoreleasepool {
-#ifdef SDL_JOYSTICK_MFI
-        NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
-
-        if (connectObserver) {
-            [center removeObserver:connectObserver name:GCControllerDidConnectNotification object:nil];
-            connectObserver = nil;
-        }
-
-        if (disconnectObserver) {
-            [center removeObserver:disconnectObserver name:GCControllerDidDisconnectNotification object:nil];
-            disconnectObserver = nil;
-        }
-
-#if TARGET_OS_TV
-        SDL_DelHintCallback(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION,
-                            SDL_AppleTVRemoteRotationHintChanged, NULL);
-#endif /* TARGET_OS_TV */
-#endif /* SDL_JOYSTICK_MFI */
-
-        while (deviceList != NULL) {
-            IOS_RemoveJoystickDevice(deviceList);
-        }
-
-#if !TARGET_OS_TV
-        motionManager = nil;
-#endif /* !TARGET_OS_TV */
-    }
-
-    numjoysticks = 0;
-}
-
-SDL_JoystickDriver SDL_IOS_JoystickDriver =
-{
-    IOS_JoystickInit,
-    IOS_JoystickGetCount,
-    IOS_JoystickDetect,
-    IOS_JoystickGetDeviceName,
-    IOS_JoystickGetDevicePlayerIndex,
-    IOS_JoystickSetDevicePlayerIndex,
-    IOS_JoystickGetDeviceGUID,
-    IOS_JoystickGetDeviceInstanceID,
-    IOS_JoystickOpen,
-    IOS_JoystickRumble,
-    IOS_JoystickUpdate,
-    IOS_JoystickClose,
-    IOS_JoystickQuit,
-};
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 59
Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h

@@ -1,59 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2020 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#ifndef SDL_JOYSTICK_IOS_H
-#define SDL_JOYSTICK_IOS_H
-
-#include "SDL_stdinc.h"
-#include "../SDL_sysjoystick.h"
-
-@class GCController;
-
-typedef struct joystick_hwdata
-{
-    SDL_bool accelerometer;
-    SDL_bool remote;
-
-    GCController __unsafe_unretained *controller;
-    SDL_bool uses_pause_handler;
-    int num_pause_presses;
-    Uint32 pause_button_down_time;
-
-    char *name;
-    SDL_Joystick *joystick;
-    SDL_JoystickID instance_id;
-    SDL_JoystickGUID guid;
-
-    int naxes;
-    int nbuttons;
-    int nhats;
-    Uint16 button_mask;
-
-    struct joystick_hwdata *next;
-} joystick_hwdata;
-
-typedef joystick_hwdata SDL_JoystickDeviceItem;
-
-#endif /* SDL_JOYSTICK_IOS_H */
-
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 65
Engine/lib/sdl/src/video/khronos/vulkan/vulkan_mir.h

@@ -1,65 +0,0 @@
-#ifndef VULKAN_MIR_H_
-#define VULKAN_MIR_H_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2015-2018 The Khronos Group Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-/*
-** This header is generated from the Khronos Vulkan XML API Registry.
-**
-*/
-
-
-#define VK_KHR_mir_surface 1
-#define VK_KHR_MIR_SURFACE_SPEC_VERSION   4
-#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface"
-
-typedef VkFlags VkMirSurfaceCreateFlagsKHR;
-
-typedef struct VkMirSurfaceCreateInfoKHR {
-    VkStructureType               sType;
-    const void*                   pNext;
-    VkMirSurfaceCreateFlagsKHR    flags;
-    MirConnection*                connection;
-    MirSurface*                   mirSurface;
-} VkMirSurfaceCreateInfoKHR;
-
-
-typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
-typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection);
-
-#ifndef VK_NO_PROTOTYPES
-VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(
-    VkInstance                                  instance,
-    const VkMirSurfaceCreateInfoKHR*            pCreateInfo,
-    const VkAllocationCallbacks*                pAllocator,
-    VkSurfaceKHR*                               pSurface);
-
-VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(
-    VkPhysicalDevice                            physicalDevice,
-    uint32_t                                    queueFamilyIndex,
-    MirConnection*                              connection);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif

+ 0 - 170
Engine/lib/sdl/src/video/mir/SDL_mirdyn.c

@@ -1,170 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_DRIVER_MIR
-
-#define DEBUG_DYNAMIC_MIR 0
-
-#include "SDL_mirdyn.h"
-
-#if DEBUG_DYNAMIC_MIR
-#include "SDL_log.h"
-#endif
-
-#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
-
-#include "SDL_name.h"
-#include "SDL_loadso.h"
-
-typedef struct
-{
-    void *lib;
-    const char *libname;
-} mirdynlib;
-
-#ifndef SDL_VIDEO_DRIVER_MIR_DYNAMIC
-#define SDL_VIDEO_DRIVER_MIR_DYNAMIC NULL
-#endif
-#ifndef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
-#define SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON NULL
-#endif
-
-static mirdynlib mirlibs[] = {
-    {NULL, SDL_VIDEO_DRIVER_MIR_DYNAMIC},
-    {NULL, SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON}
-};
-
-static void *
-MIR_GetSym(const char *fnname, int *pHasModule)
-{
-    int i;
-    void *fn = NULL;
-    for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
-        if (mirlibs[i].lib != NULL) {
-            fn = SDL_LoadFunction(mirlibs[i].lib, fnname);
-            if (fn != NULL)
-                break;
-        }
-    }
-
-#if DEBUG_DYNAMIC_MIR
-    if (fn != NULL)
-        SDL_Log("MIR: Found '%s' in %s (%p)\n", fnname, mirlibs[i].libname, fn);
-    else
-        SDL_Log("MIR: Symbol '%s' NOT FOUND!\n", fnname);
-#endif
-
-    if (fn == NULL)
-        *pHasModule = 0;  /* kill this module. */
-
-    return fn;
-}
-
-#endif /* SDL_VIDEO_DRIVER_MIR_DYNAMIC */
-
-/* Define all the function pointers and wrappers... */
-#define SDL_MIR_MODULE(modname) int SDL_MIR_HAVE_##modname = 0;
-#define SDL_MIR_SYM(rc,fn,params) SDL_DYNMIRFN_##fn MIR_##fn = NULL;
-#define SDL_MIR_SYM_CONST(type,name) SDL_DYMMIRCONST_##name MIR_##name = NULL;
-#include "SDL_mirsym.h"
-
-static int mir_load_refcount = 0;
-
-void
-SDL_MIR_UnloadSymbols(void)
-{
-    /* Don't actually unload if more than one module is using the libs... */
-    if (mir_load_refcount > 0) {
-        if (--mir_load_refcount == 0) {
-#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC            
-            int i;
-#endif
-            
-            /* set all the function pointers to NULL. */
-#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 0;
-#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = NULL;
-#define SDL_MIR_SYM_CONST(type,name) MIR_##name = NULL;
-#include "SDL_mirsym.h"
-
-
-#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
-            for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
-                if (mirlibs[i].lib != NULL) {
-                    SDL_UnloadObject(mirlibs[i].lib);
-                    mirlibs[i].lib = NULL;
-                }
-            }
-#endif
-        }
-    }
-}
-
-/* returns non-zero if all needed symbols were loaded. */
-int
-SDL_MIR_LoadSymbols(void)
-{
-    int rc = 1;                 /* always succeed if not using Dynamic MIR stuff. */
-
-    /* deal with multiple modules (dga, wayland, mir, etc) needing these symbols... */
-    if (mir_load_refcount++ == 0) {
-#ifdef SDL_VIDEO_DRIVER_MIR_DYNAMIC
-        int i;
-        int *thismod = NULL;
-        for (i = 0; i < SDL_TABLESIZE(mirlibs); i++) {
-            if (mirlibs[i].libname != NULL) {
-                mirlibs[i].lib = SDL_LoadObject(mirlibs[i].libname);
-            }
-        }
-
-#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
-#include "SDL_mirsym.h"
-
-#define SDL_MIR_MODULE(modname) thismod = &SDL_MIR_HAVE_##modname;
-#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = (SDL_DYNMIRFN_##fn) MIR_GetSym(#fn,thismod);
-#define SDL_MIR_SYM_CONST(type,name) MIR_##name = *(SDL_DYMMIRCONST_##name*) MIR_GetSym(#name,thismod);
-#include "SDL_mirsym.h"
-
-        if ((SDL_MIR_HAVE_MIR_CLIENT) && (SDL_MIR_HAVE_XKBCOMMON)) {
-            /* all required symbols loaded. */
-            SDL_ClearError();
-        } else {
-            /* in case something got loaded... */
-            SDL_MIR_UnloadSymbols();
-            rc = 0;
-        }
-
-#else  /* no dynamic MIR */
-
-#define SDL_MIR_MODULE(modname) SDL_MIR_HAVE_##modname = 1; /* default yes */
-#define SDL_MIR_SYM(rc,fn,params) MIR_##fn = fn;
-#define SDL_MIR_SYM_CONST(type,name) MIR_##name = name;
-#include "SDL_mirsym.h"
-
-#endif
-    }
-
-    return rc;
-}
-
-#endif /* SDL_VIDEO_DRIVER_MIR */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 53
Engine/lib/sdl/src/video/mir/SDL_mirdyn.h

@@ -1,53 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef SDL_mirdyn_h_
-#define SDL_mirdyn_h_
-
-#include "../../SDL_internal.h"
-
-#include <EGL/egl.h>
-#include <mir_toolkit/mir_client_library.h>
-#include <xkbcommon/xkbcommon.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int SDL_MIR_LoadSymbols(void);
-void SDL_MIR_UnloadSymbols(void);
-
-/* Declare all the function pointers and wrappers... */
-#define SDL_MIR_SYM(rc,fn,params) \
-    typedef rc (*SDL_DYNMIRFN_##fn) params; \
-    extern SDL_DYNMIRFN_##fn MIR_##fn;
-#define SDL_MIR_SYM_CONST(type, name) \
-    typedef type SDL_DYMMIRCONST_##name; \
-    extern SDL_DYMMIRCONST_##name MIR_##name;
-#include "SDL_mirsym.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !defined SDL_mirdyn_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 321
Engine/lib/sdl/src/video/mir/SDL_mirevents.c

@@ -1,321 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_DRIVER_MIR
-
-#include "../../events/SDL_events_c.h"
-#include "../../events/SDL_keyboard_c.h"
-#include "../../events/SDL_touch_c.h"
-#include "../../events/scancodes_xfree86.h"
-
-#include "SDL_mirevents.h"
-#include "SDL_mirwindow.h"
-
-#include <xkbcommon/xkbcommon.h>
-
-#include "SDL_mirdyn.h"
-
-static void
-HandleKeyText(int32_t key_code)
-{
-    char text[8];
-    int size = 0;
-
-    size = MIR_xkb_keysym_to_utf8(key_code, text, sizeof text);
-
-    if (size > 0) {
-        text[size] = '\0';
-        SDL_SendKeyboardText(text);
-    }
-}
-
-/* FIXME
-   Mir still needs to implement its IM API, for now we assume
-   a single key press produces a character.
-*/
-static void
-HandleKeyEvent(MirKeyboardEvent const* key_event, SDL_Window* window)
-{
-    xkb_keysym_t key_code;
-    Uint8 key_state;
-    int event_scancode;
-    uint32_t sdl_scancode = SDL_SCANCODE_UNKNOWN;
-
-    MirKeyboardAction action = MIR_mir_keyboard_event_action(key_event);
-
-    key_state      = SDL_PRESSED;
-    key_code       = MIR_mir_keyboard_event_key_code(key_event);
-    event_scancode = MIR_mir_keyboard_event_scan_code(key_event);
-
-    if (action == mir_keyboard_action_up)
-        key_state = SDL_RELEASED;
-
-    if (event_scancode < SDL_arraysize(xfree86_scancode_table2))
-        sdl_scancode = xfree86_scancode_table2[event_scancode];
-
-    if (sdl_scancode != SDL_SCANCODE_UNKNOWN)
-        SDL_SendKeyboardKey(key_state, sdl_scancode);
-
-    if (key_state == SDL_PRESSED)
-        HandleKeyText(key_code);
-}
-
-static void
-HandleMouseButton(SDL_Window* sdl_window, Uint8 state, MirPointerEvent const* pointer)
-{
-    uint32_t sdl_button           = SDL_BUTTON_LEFT;
-    MirPointerButton button_state = mir_pointer_button_primary;
-
-    static uint32_t old_button_states = 0;
-    uint32_t new_button_states = MIR_mir_pointer_event_buttons(pointer);
-
-    // XOR on our old button states vs our new states to get the newley pressed/released button
-    button_state = new_button_states ^ old_button_states;
-
-    switch (button_state) {
-        case mir_pointer_button_primary:
-            sdl_button = SDL_BUTTON_LEFT;
-            break;
-        case mir_pointer_button_secondary:
-            sdl_button = SDL_BUTTON_RIGHT;
-            break;
-        case mir_pointer_button_tertiary:
-            sdl_button = SDL_BUTTON_MIDDLE;
-            break;
-        case mir_pointer_button_forward:
-            sdl_button = SDL_BUTTON_X1;
-            break;
-        case mir_pointer_button_back:
-            sdl_button = SDL_BUTTON_X2;
-            break;
-        default:
-            break;
-    }
-
-    old_button_states = new_button_states;
-
-    SDL_SendMouseButton(sdl_window, 0, state, sdl_button);
-}
-
-static void
-HandleMouseMotion(SDL_Window* sdl_window, int x, int y)
-{
-    SDL_Mouse* mouse = SDL_GetMouse();
-    SDL_SendMouseMotion(sdl_window, 0, mouse->relative_mode, x, y);
-}
-
-static void
-HandleTouchPress(int device_id, int source_id, SDL_bool down, float x, float y, float pressure)
-{
-    SDL_SendTouch(device_id, source_id, down, x, y, pressure);
-}
-
-static void
-HandleTouchMotion(int device_id, int source_id, float x, float y, float pressure)
-{
-    SDL_SendTouchMotion(device_id, source_id, x, y, pressure);
-}
-
-static void
-HandleMouseScroll(SDL_Window* sdl_window, float hscroll, float vscroll)
-{
-    SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL);
-}
-
-static void
-AddTouchDevice(int device_id)
-{
-    if (SDL_AddTouch(device_id, "") < 0)
-        SDL_SetError("Error: can't add touch %s, %d", __FILE__, __LINE__);
-}
-
-static void
-HandleTouchEvent(MirTouchEvent const* touch, int device_id, SDL_Window* sdl_window)
-{
-    int i, point_count;
-    point_count = MIR_mir_touch_event_point_count(touch);
-
-    AddTouchDevice(device_id);
-
-    for (i = 0; i < point_count; i++) {
-        int id = MIR_mir_touch_event_id(touch, i);
-
-        int width  = sdl_window->w;
-        int height = sdl_window->h;
-
-        float x = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_x);
-        float y = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_y);
-
-        float n_x = x / width;
-        float n_y = y / height;
-
-        float pressure = MIR_mir_touch_event_axis_value(touch, i, mir_touch_axis_pressure);
-
-        switch (MIR_mir_touch_event_action(touch, i)) {
-            case mir_touch_action_up:
-                HandleTouchPress(device_id, id, SDL_FALSE, n_x, n_y, pressure);
-                break;
-            case mir_touch_action_down:
-                HandleTouchPress(device_id, id, SDL_TRUE, n_x, n_y, pressure);
-                break;
-            case mir_touch_action_change:
-                HandleTouchMotion(device_id, id, n_x, n_y, pressure);
-                break;
-            case mir_touch_actions:
-                break;
-        }
-    }
-}
-
-static void
-HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window)
-{
-    SDL_SetMouseFocus(sdl_window);
-
-    switch (MIR_mir_pointer_event_action(pointer)) {
-        case mir_pointer_action_button_down:
-            HandleMouseButton(sdl_window, SDL_PRESSED, pointer);
-            break;
-        case mir_pointer_action_button_up:
-            HandleMouseButton(sdl_window, SDL_RELEASED, pointer);
-            break;
-        case mir_pointer_action_motion: {
-            int x, y;
-            float hscroll, vscroll;
-            SDL_Mouse* mouse = SDL_GetMouse();
-            x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x);
-            y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y);
-
-            if (mouse) {
-                if (mouse->relative_mode) {
-                    int relative_x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_x);
-                    int relative_y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_y);
-                    HandleMouseMotion(sdl_window, relative_x, relative_y);
-                }
-                else if (mouse->x != x || mouse->y != y) {
-                    HandleMouseMotion(sdl_window, x, y);
-                }
-            }
-
-            hscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_hscroll);
-            vscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_vscroll);
-            if (vscroll != 0 || hscroll != 0)
-                HandleMouseScroll(sdl_window, hscroll, vscroll);
-        }
-            break;
-        case mir_pointer_action_leave:
-            SDL_SetMouseFocus(NULL);
-            break;
-        case mir_pointer_action_enter:
-        default:
-            break;
-    }
-}
-
-static void
-HandleInput(MirInputEvent const* input_event, SDL_Window* window)
-{
-    switch (MIR_mir_input_event_get_type(input_event)) {
-        case (mir_input_event_type_key):
-            HandleKeyEvent(MIR_mir_input_event_get_keyboard_event(input_event), window);
-            break;
-        case (mir_input_event_type_pointer):
-            HandleMouseEvent(MIR_mir_input_event_get_pointer_event(input_event), window);
-            break;
-        case (mir_input_event_type_touch):
-            HandleTouchEvent(MIR_mir_input_event_get_touch_event(input_event),
-                             MIR_mir_input_event_get_device_id(input_event),
-                             window);
-            break;
-        default:
-            break;
-    }
-}
-
-static void
-HandleResize(MirResizeEvent const* resize_event, SDL_Window* window)
-{
-    int new_w = MIR_mir_resize_event_get_width (resize_event);
-    int new_h = MIR_mir_resize_event_get_height(resize_event);
-
-    int old_w = window->w;
-    int old_h = window->h;
-
-    if (new_w != old_w || new_h != old_h)
-        SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, new_w, new_h);
-}
-
-static void
-HandleWindow(MirWindowEvent const* event, SDL_Window* window)
-{
-    MirWindowAttrib attrib = MIR_mir_window_event_get_attribute(event);
-    int value              = MIR_mir_window_event_get_attribute_value(event);
-
-    if (attrib == mir_window_attrib_focus) {
-        if (value == mir_window_focus_state_focused) {
-            SDL_SetKeyboardFocus(window);
-        }
-        else if (value == mir_window_focus_state_unfocused) {
-            SDL_SetKeyboardFocus(NULL);
-        }
-    }
-}
-
-static void
-MIR_HandleClose(SDL_Window* window) {
-    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, 0);
-}
-
-void
-MIR_HandleEvent(MirWindow* mirwindow, MirEvent const* ev, void* context)
-{
-    MirEventType event_type = MIR_mir_event_get_type(ev);
-    SDL_Window* window      = (SDL_Window*)context;
-
-    if (window) {
-        switch (event_type) {
-            case (mir_event_type_input):
-                HandleInput(MIR_mir_event_get_input_event(ev), window);
-                break;
-            case (mir_event_type_resize):
-                HandleResize(MIR_mir_event_get_resize_event(ev), window);
-                break;
-            case (mir_event_type_window):
-                HandleWindow(MIR_mir_event_get_window_event(ev), window);
-                break;
-            case (mir_event_type_close_window):
-                MIR_HandleClose(window);
-                break;
-            default:
-                break;
-        }
-    }
-}
-
-#endif /* SDL_VIDEO_DRIVER_MIR */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 37
Engine/lib/sdl/src/video/mir/SDL_mirevents.h

@@ -1,37 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#ifndef SDL_mirevents_h_
-#define SDL_mirevents_h_
-
-#include <mir_toolkit/mir_client_library.h>
-
-extern void
-MIR_HandleEvent(MirWindow*, MirEvent const* ev, void* context);
-
-#endif /* SDL_mirevents_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
-

+ 0 - 134
Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c

@@ -1,134 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_DRIVER_MIR
-
-#include "SDL_mirevents.h"
-#include "SDL_mirframebuffer.h"
-#include "SDL_mirwindow.h"
-
-#include "SDL_mirdyn.h"
-
-int
-MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format,
-                            void** pixels, int* pitch)
-{
-    MIR_Data* mir_data = _this->driverdata;
-
-    mir_data->software = SDL_TRUE;
-
-    if (MIR_CreateWindow(_this, window) < 0)
-        return SDL_SetError("Failed to create a mir window.");
-
-    *format = MIR_GetSDLPixelFormat(mir_data->pixel_format);
-    if (*format == SDL_PIXELFORMAT_UNKNOWN)
-        return SDL_SetError("Unknown pixel format");
-
-    *pitch = (((window->w * SDL_BYTESPERPIXEL(*format)) + 3) & ~3);
-
-    *pixels = SDL_malloc(window->h*(*pitch));
-    if (*pixels == NULL)
-        return SDL_OutOfMemory();
-
-    return 0;
-}
-
-int
-MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window,
-                            const SDL_Rect* rects, int numrects)
-{
-    MIR_Window* mir_window = window->driverdata;
-
-    MirGraphicsRegion region;
-    MirBufferStream* bs;
-    int i, j, x, y, w, h, start;
-    int bytes_per_pixel, bytes_per_row, s_stride, d_stride;
-    char* s_dest;
-    char* pixels;
-
-    bs = MIR_mir_window_get_buffer_stream(mir_window->window);
-    MIR_mir_buffer_stream_get_graphics_region(bs, &region);
-
-    s_dest = region.vaddr;
-    pixels = (char*)window->surface->pixels;
-
-    s_stride = window->surface->pitch;
-    d_stride = region.stride;
-    bytes_per_pixel = window->surface->format->BytesPerPixel;
-
-    for (i = 0; i < numrects; i++) {
-        s_dest = region.vaddr;
-        pixels = (char*)window->surface->pixels;
-
-        x = rects[i].x;
-        y = rects[i].y;
-        w = rects[i].w;
-        h = rects[i].h;
-
-        if (w <= 0 || h <= 0 || (x + w) <= 0 || (y + h) <= 0)
-            continue;
-
-        if (x < 0) {
-            x += w;
-            w += rects[i].x;
-        }
-
-        if (y < 0) {
-            y += h;
-            h += rects[i].y;
-        }
-
-        if (x + w > window->w)
-            w = window->w - x;
-        if (y + h > window->h)
-            h = window->h - y;
-
-        start = y * s_stride + x;
-        pixels += start;
-        s_dest += start;
-
-        bytes_per_row =  bytes_per_pixel * w;
-        for (j = 0; j < h; j++) {
-            SDL_memcpy(s_dest, pixels, bytes_per_row);
-            pixels += s_stride;
-            s_dest += d_stride;
-        }
-    }
-
-    MIR_mir_buffer_stream_swap_buffers_sync(bs);
-
-    return 0;
-}
-
-void
-MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* window)
-{
-}
-
-#endif /* SDL_VIDEO_DRIVER_MIR */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 47
Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h

@@ -1,47 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#ifndef SDL_mirframebuffer_h_
-#define SDL_mirframebuffer_h_
-
-#include "../SDL_sysvideo.h"
-
-#include "SDL_mirvideo.h"
-
-extern int
-MIR_CreateWindowFramebuffer(_THIS, SDL_Window* sdl_window, Uint32* format,
-                            void** pixels, int* pitch);
-
-extern int
-MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* sdl_window,
-                            const SDL_Rect* rects, int numrects);
-
-extern void
-MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* sdl_window);
-
-#endif /* SDL_mirframebuffer_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
-

+ 0 - 292
Engine/lib/sdl/src/video/mir/SDL_mirmouse.c

@@ -1,292 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_DRIVER_MIR
-
-#include "../../events/SDL_mouse_c.h"
-#include "../SDL_sysvideo.h"
-#include "SDL_assert.h"
-
-#include "SDL_mirdyn.h"
-
-#include "SDL_mirvideo.h"
-#include "SDL_mirmouse.h"
-#include "SDL_mirwindow.h"
-
-typedef struct
-{
-    MirCursorConfiguration* conf;
-    MirBufferStream*        stream;
-    char const*             name;
-} MIR_Cursor;
-
-static SDL_Cursor*
-MIR_CreateDefaultCursor()
-{
-    SDL_Cursor* cursor;
-
-    cursor = SDL_calloc(1, sizeof(SDL_Cursor));
-    if (cursor) {
-
-        MIR_Cursor* mir_cursor = SDL_calloc(1, sizeof(MIR_Cursor));
-        if (mir_cursor) {
-            mir_cursor->conf   = NULL;
-            mir_cursor->stream = NULL;
-            mir_cursor->name   = NULL;
-            cursor->driverdata = mir_cursor;
-        }
-        else {
-            SDL_OutOfMemory();
-            SDL_free(cursor);
-            cursor = NULL;
-        }
-    }
-    else {
-        SDL_OutOfMemory();
-    }
-
-    return cursor;
-}
-
-static void
-CopySurfacePixelsToMirStream(SDL_Surface* surface, MirBufferStream* stream)
-{
-    char* dest, *pixels;
-    int i, s_w, s_h, r_stride, p_stride, bytes_per_pixel, bytes_per_row;
-
-    MirGraphicsRegion region;
-    MIR_mir_buffer_stream_get_graphics_region(stream, &region);
-
-    s_w = surface->w;
-    s_h = surface->h;
-
-    bytes_per_pixel = surface->format->BytesPerPixel;
-    bytes_per_row   = bytes_per_pixel * s_w;
-
-    dest = region.vaddr;
-    pixels = (char*)surface->pixels;
-
-    r_stride = region.stride;
-    p_stride = surface->pitch;
-
-    for (i = 0; i < s_h; i++)
-    {
-        SDL_memcpy(dest, pixels, bytes_per_row);
-        dest   += r_stride;
-        pixels += p_stride;
-    }
-}
-
-static SDL_Cursor*
-MIR_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y)
-{
-    MirCursorConfiguration* conf;
-    MirBufferStream*        stream;
-
-    int s_w = surface->w;
-    int s_h = surface->h;
-
-    MIR_Data* mir_data     = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
-    SDL_Cursor* cursor     = MIR_CreateDefaultCursor();
-    MIR_Cursor* mir_cursor;
-
-    if (!cursor) {
-        return NULL;
-    }
-
-    mir_cursor = (MIR_Cursor*)cursor->driverdata;
-
-    stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->connection,
-                                                          s_w, s_h, mir_data->pixel_format,
-                                                          mir_buffer_usage_software);
-
-    conf = MIR_mir_cursor_configuration_from_buffer_stream(stream, hot_x, hot_y);
-
-    CopySurfacePixelsToMirStream(surface, stream);
-    MIR_mir_buffer_stream_swap_buffers_sync(stream);
-
-    mir_cursor->conf   = conf;
-    mir_cursor->stream = stream;
-
-    return cursor;
-}
-
-static SDL_Cursor*
-MIR_CreateSystemCursor(SDL_SystemCursor id)
-{
-    char const* cursor_name = NULL;
-    SDL_Cursor* cursor;
-    MIR_Cursor* mir_cursor;
-
-    switch(id) {
-        case SDL_SYSTEM_CURSOR_ARROW:
-            cursor_name = MIR_mir_arrow_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_IBEAM:
-            cursor_name = MIR_mir_caret_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_WAIT:
-            cursor_name = MIR_mir_busy_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_CROSSHAIR:
-            /* Unsupported */
-            cursor_name = MIR_mir_arrow_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_WAITARROW:
-            cursor_name = MIR_mir_busy_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_SIZENWSE:
-            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_SIZENESW:
-            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_SIZEWE:
-            cursor_name = MIR_mir_horizontal_resize_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_SIZENS:
-            cursor_name = MIR_mir_vertical_resize_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_SIZEALL:
-            cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_NO:
-            /* Unsupported */
-            cursor_name = MIR_mir_closed_hand_cursor_name;
-            break;
-        case SDL_SYSTEM_CURSOR_HAND:
-            cursor_name = MIR_mir_open_hand_cursor_name;
-            break;
-        default:
-            SDL_assert(0);
-            return NULL;
-    }
-
-    cursor = MIR_CreateDefaultCursor();
-    if (!cursor) {
-        return NULL;
-    }
-
-    mir_cursor = (MIR_Cursor*)cursor->driverdata;
-    mir_cursor->name = cursor_name;
-
-    return cursor;
-}
-
-static void
-MIR_FreeCursor(SDL_Cursor* cursor)
-{
-    if (cursor) {
-
-        if (cursor->driverdata) {
-            MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
-
-            if (mir_cursor->conf)
-                MIR_mir_cursor_configuration_destroy(mir_cursor->conf);
-            if (mir_cursor->stream)
-                MIR_mir_buffer_stream_release_sync(mir_cursor->stream);
-
-            SDL_free(mir_cursor);
-        }
-
-        SDL_free(cursor);
-    }
-}
-
-static int
-MIR_ShowCursor(SDL_Cursor* cursor)
-{
-    MIR_Data* mir_data      = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
-    MIR_Window* mir_window  = mir_data->current_window;
-
-    if (cursor && cursor->driverdata) {
-        if (mir_window && MIR_mir_window_is_valid(mir_window->window)) {
-            MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
-
-            if (mir_cursor->name != NULL) {
-                MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
-                MIR_mir_window_spec_set_cursor_name(spec, mir_cursor->name);
-                MIR_mir_window_apply_spec(mir_window->window, spec);
-                MIR_mir_window_spec_release(spec);
-            }
-
-            if (mir_cursor->conf) {
-                MIR_mir_window_configure_cursor(mir_window->window, mir_cursor->conf);
-            }
-        }
-    }
-    else if(mir_window && MIR_mir_window_is_valid(mir_window->window)) {
-        MIR_mir_window_configure_cursor(mir_window->window, NULL);
-    }
-
-    return 0;
-}
-
-static void
-MIR_WarpMouse(SDL_Window* window, int x, int y)
-{
-    SDL_Unsupported();
-}
-
-static int
-MIR_WarpMouseGlobal(int x, int y)
-{
-    return SDL_Unsupported();
-}
-
-static int
-MIR_SetRelativeMouseMode(SDL_bool enabled)
-{
-    return 0;
-}
-
-/* TODO Actually implement the cursor, need to wait for mir support */
-void
-MIR_InitMouse()
-{
-    SDL_Mouse* mouse = SDL_GetMouse();
-
-    mouse->CreateCursor         = MIR_CreateCursor;
-    mouse->ShowCursor           = MIR_ShowCursor;
-    mouse->FreeCursor           = MIR_FreeCursor;
-    mouse->WarpMouse            = MIR_WarpMouse;
-    mouse->WarpMouseGlobal      = MIR_WarpMouseGlobal;
-    mouse->CreateSystemCursor   = MIR_CreateSystemCursor;
-    mouse->SetRelativeMouseMode = MIR_SetRelativeMouseMode;
-
-    SDL_SetDefaultCursor(MIR_CreateDefaultCursor());
-}
-
-void
-MIR_FiniMouse()
-{
-}
-
-#endif /* SDL_VIDEO_DRIVER_MIR */
-
-/* vi: set ts=4 sw=4 expandtab: */
-

+ 0 - 37
Engine/lib/sdl/src/video/mir/SDL_mirmouse.h

@@ -1,37 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#ifndef SDL_mirmouse_h_
-#define SDL_mirmouse_h_
-
-extern void
-MIR_InitMouse();
-
-extern void
-MIR_FiniMouse();
-
-#endif /* SDL_mirmouse_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 78
Engine/lib/sdl/src/video/mir/SDL_miropengl.c

@@ -1,78 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_DRIVER_MIR
-
-#include "SDL_miropengl.h"
-
-#include "SDL_mirdyn.h"
-
-int
-MIR_GL_SwapWindow(_THIS, SDL_Window* window)
-{
-    MIR_Window* mir_wind = window->driverdata;
-
-    return SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface);
-}
-
-int
-MIR_GL_MakeCurrent(_THIS, SDL_Window* window, SDL_GLContext context)
-{
-  if (window) {
-      EGLSurface egl_surface = ((MIR_Window*)window->driverdata)->egl_surface;
-      return SDL_EGL_MakeCurrent(_this, egl_surface, context);
-  }
-
-  return SDL_EGL_MakeCurrent(_this, NULL, NULL);
-}
-
-SDL_GLContext
-MIR_GL_CreateContext(_THIS, SDL_Window* window)
-{
-    MIR_Window* mir_window = window->driverdata;
-
-    SDL_GLContext context;
-    context = SDL_EGL_CreateContext(_this, mir_window->egl_surface);
-
-    return context;
-}
-
-int
-MIR_GL_LoadLibrary(_THIS, const char* path)
-{
-    MIR_Data* mir_data = _this->driverdata;
-
-    SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection), 0);
-
-    SDL_EGL_ChooseConfig(_this);
-
-    return 0;
-}
-
-#endif /* SDL_VIDEO_DRIVER_MIR */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 53
Engine/lib/sdl/src/video/mir/SDL_miropengl.h

@@ -1,53 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#ifndef SDL_miropengl_h_
-#define SDL_miropengl_h_
-
-#include "SDL_mirwindow.h"
-
-#include "../SDL_egl_c.h"
-
-#define MIR_GL_DeleteContext   SDL_EGL_DeleteContext
-#define MIR_GL_GetSwapInterval SDL_EGL_GetSwapInterval
-#define MIR_GL_SetSwapInterval SDL_EGL_SetSwapInterval
-#define MIR_GL_UnloadLibrary   SDL_EGL_UnloadLibrary
-#define MIR_GL_GetProcAddress  SDL_EGL_GetProcAddress
-
-extern int
-MIR_GL_SwapWindow(_THIS, SDL_Window* window);
-
-extern int
-MIR_GL_MakeCurrent(_THIS, SDL_Window* window, SDL_GLContext context);
-
-extern SDL_GLContext
-MIR_GL_CreateContext(_THIS, SDL_Window* window);
-
-extern int
-MIR_GL_LoadLibrary(_THIS, const char* path);
-
-#endif /* SDL_miropengl_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 143
Engine/lib/sdl/src/video/mir/SDL_mirsym.h

@@ -1,143 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/* *INDENT-OFF* */
-
-#ifndef SDL_MIR_MODULE
-#define SDL_MIR_MODULE(modname)
-#endif
-
-#ifndef SDL_MIR_SYM
-#define SDL_MIR_SYM(rc,fn,params)
-#endif
-
-#ifndef SDL_MIR_SYM_CONST
-#define SDL_MIR_SYM_CONST(type, name)
-#endif
-
-SDL_MIR_MODULE(MIR_CLIENT)
-SDL_MIR_SYM(MirWindow *,mir_create_window_sync,(MirWindowSpec* spec))
-SDL_MIR_SYM(MirEGLNativeWindowType,mir_buffer_stream_get_egl_native_window,(MirBufferStream *surface))
-SDL_MIR_SYM(bool,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region))
-SDL_MIR_SYM(void,mir_buffer_stream_swap_buffers_sync,(MirBufferStream *stream))
-SDL_MIR_SYM(void,mir_window_set_event_handler,(MirWindow* window, MirWindowEventCallback callback, void* context))
-SDL_MIR_SYM(MirWindowSpec*,mir_create_normal_window_spec,(MirConnection *connection, int width, int height))
-SDL_MIR_SYM(MirWindowSpec*,mir_create_window_spec,(MirConnection *connection))
-SDL_MIR_SYM(void,mir_window_spec_set_buffer_usage,(MirWindowSpec *spec, MirBufferUsage usage))
-SDL_MIR_SYM(void,mir_window_spec_set_name,(MirWindowSpec *spec, char const *name))
-SDL_MIR_SYM(void,mir_window_spec_release,(MirWindowSpec *spec))
-SDL_MIR_SYM(void,mir_window_spec_set_width,(MirWindowSpec *spec, unsigned width))
-SDL_MIR_SYM(void,mir_window_spec_set_height,(MirWindowSpec *spec, unsigned height))
-SDL_MIR_SYM(void,mir_window_spec_set_min_width,(MirWindowSpec *spec, unsigned min_width))
-SDL_MIR_SYM(void,mir_window_spec_set_min_height,(MirWindowSpec *spec, unsigned min_height))
-SDL_MIR_SYM(void,mir_window_spec_set_max_width,(MirWindowSpec *spec, unsigned max_width))
-SDL_MIR_SYM(void,mir_window_spec_set_max_height,(MirWindowSpec *spec, unsigned max_height))
-SDL_MIR_SYM(void,mir_window_spec_set_type,(MirWindowSpec *spec, MirWindowType type))
-SDL_MIR_SYM(void,mir_window_spec_set_state,(MirWindowSpec *spec, MirWindowState state))
-SDL_MIR_SYM(void,mir_window_spec_set_pointer_confinement,(MirWindowSpec *spec, MirPointerConfinementState state))
-SDL_MIR_SYM(void,mir_window_spec_set_pixel_format,(MirWindowSpec *spec, MirPixelFormat pixel_format))
-SDL_MIR_SYM(void,mir_window_spec_set_cursor_name,(MirWindowSpec *spec, char const* cursor_name))
-SDL_MIR_SYM(void,mir_window_apply_spec,(MirWindow* window, MirWindowSpec* spec))
-SDL_MIR_SYM(void,mir_window_get_parameters,(MirWindow *window, MirWindowParameters *params))
-SDL_MIR_SYM(MirBufferStream*,mir_window_get_buffer_stream,(MirWindow* window))
-SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y))
-SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage))
-SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event))
-SDL_MIR_SYM(xkb_keysym_t,mir_keyboard_event_key_code,(MirKeyboardEvent const *event))
-SDL_MIR_SYM(int,mir_keyboard_event_scan_code,(MirKeyboardEvent const *event))
-SDL_MIR_SYM(bool,mir_pointer_event_button_state,(MirPointerEvent const *event, MirPointerButton button))
-SDL_MIR_SYM(MirPointerButtons,mir_pointer_event_buttons,(MirPointerEvent const *event))
-SDL_MIR_SYM(MirInputDeviceId,mir_input_event_get_device_id,(MirInputEvent const* ev))
-SDL_MIR_SYM(MirTouchId,mir_touch_event_id,(MirTouchEvent const *event, size_t touch_index))
-SDL_MIR_SYM(float,mir_touch_event_axis_value,(MirTouchEvent const *event, size_t touch_index, MirTouchAxis axis))
-SDL_MIR_SYM(MirTouchAction,mir_touch_event_action,(MirTouchEvent const *event, size_t touch_index))
-SDL_MIR_SYM(MirPointerAction,mir_pointer_event_action,(MirPointerEvent const *event))
-SDL_MIR_SYM(float,mir_pointer_event_axis_value,(MirPointerEvent const *event, MirPointerAxis))
-SDL_MIR_SYM(MirEventType,mir_event_get_type,(MirEvent const *event))
-SDL_MIR_SYM(MirInputEventType,mir_input_event_get_type,(MirInputEvent const *event))
-SDL_MIR_SYM(MirInputEvent const*,mir_event_get_input_event,(MirEvent const *event))
-SDL_MIR_SYM(MirResizeEvent const*,mir_event_get_resize_event,(MirEvent const *event))
-SDL_MIR_SYM(MirKeyboardEvent const*,mir_input_event_get_keyboard_event,(MirInputEvent const *event))
-SDL_MIR_SYM(MirPointerEvent const*,mir_input_event_get_pointer_event,(MirInputEvent const *event))
-SDL_MIR_SYM(MirTouchEvent const*,mir_input_event_get_touch_event,(MirInputEvent const *event))
-SDL_MIR_SYM(MirWindowEvent const*,mir_event_get_window_event,(MirEvent const *event))
-SDL_MIR_SYM(unsigned int,mir_touch_event_point_count,(MirTouchEvent const *event))
-SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats))
-SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection))
-SDL_MIR_SYM(bool,mir_connection_is_valid,(MirConnection *connection))
-SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection))
-SDL_MIR_SYM(MirPixelFormat,mir_connection_get_egl_pixel_format,(MirConnection* connection, void* egldisplay, void* eglconfig))
-SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name))
-SDL_MIR_SYM(char const *,mir_window_get_error_message,(MirWindow *window))
-SDL_MIR_SYM(bool,mir_window_is_valid,(MirWindow *window))
-SDL_MIR_SYM(void,mir_window_release_sync,(MirWindow* window))
-SDL_MIR_SYM(void,mir_buffer_stream_release_sync,(MirBufferStream *stream))
-SDL_MIR_SYM(void,mir_window_configure_cursor,(MirWindow* window, MirCursorConfiguration const* conf))
-SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf))
-SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event))
-SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event))
-SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection))
-SDL_MIR_SYM(MirWindowAttrib,mir_window_event_get_attribute,(MirWindowEvent const* event))
-SDL_MIR_SYM(int,mir_window_event_get_attribute_value,(MirWindowEvent const* window_event))
-SDL_MIR_SYM(MirDisplayConfig*,mir_connection_create_display_configuration,(MirConnection* connection))
-SDL_MIR_SYM(void,mir_display_config_release,(MirDisplayConfig* config))
-SDL_MIR_SYM(int,mir_display_config_get_num_outputs,(MirDisplayConfig const* config))
-SDL_MIR_SYM(MirOutput*,mir_display_config_get_mutable_output,(MirDisplayConfig* config, size_t index))
-SDL_MIR_SYM(int,mir_output_get_num_modes,(MirOutput const* output))
-SDL_MIR_SYM(MirOutputMode const*,mir_output_get_current_mode,(MirOutput const* output))
-SDL_MIR_SYM(MirPixelFormat,mir_output_get_current_pixel_format,(MirOutput const* output))
-SDL_MIR_SYM(int,mir_output_get_position_x,(MirOutput const* output))
-SDL_MIR_SYM(int,mir_output_get_position_y,(MirOutput const* output))
-SDL_MIR_SYM(bool,mir_output_is_enabled,(MirOutput const* output))
-SDL_MIR_SYM(MirOutputConnectionState,mir_output_get_connection_state,(MirOutput const* output))
-SDL_MIR_SYM(size_t,mir_output_get_preferred_mode_index,(MirOutput const* output))
-SDL_MIR_SYM(MirOutputType,mir_output_get_type,(MirOutput const* output))
-SDL_MIR_SYM(char const*,mir_output_type_name,(MirOutputType type))
-SDL_MIR_SYM(void,mir_output_set_current_mode,(MirOutput* output, MirOutputMode const* mode))
-SDL_MIR_SYM(MirOutputMode const*,mir_output_get_mode,(MirOutput const* output, size_t index))
-SDL_MIR_SYM(int,mir_output_mode_get_width,(MirOutputMode const* mode))
-SDL_MIR_SYM(int,mir_output_mode_get_height,(MirOutputMode const* mode))
-SDL_MIR_SYM(double,mir_output_mode_get_refresh_rate,(MirOutputMode const* mode))
-SDL_MIR_SYM(bool,mir_output_is_gamma_supported,(MirOutput const* output))
-SDL_MIR_SYM(uint32_t,mir_output_get_gamma_size,(MirOutput const* output))
-SDL_MIR_SYM(void,mir_output_get_gamma,(MirOutput const* output, uint16_t* red, uint16_t* green, uint16_t* blue, uint32_t size))
-SDL_MIR_SYM(void,mir_output_set_gamma,(MirOutput* output, uint16_t const* red, uint16_t const* green, uint16_t const* blue, uint32_t size))
-
-SDL_MIR_SYM_CONST(char const*,mir_omnidirectional_resize_cursor_name)
-SDL_MIR_SYM_CONST(char const*,mir_busy_cursor_name)
-SDL_MIR_SYM_CONST(char const*,mir_arrow_cursor_name)
-SDL_MIR_SYM_CONST(char const*,mir_caret_cursor_name)
-SDL_MIR_SYM_CONST(char const*,mir_vertical_resize_cursor_name)
-SDL_MIR_SYM_CONST(char const*,mir_horizontal_resize_cursor_name)
-SDL_MIR_SYM_CONST(char const*,mir_open_hand_cursor_name)
-SDL_MIR_SYM_CONST(char const*,mir_closed_hand_cursor_name)
-SDL_MIR_SYM_CONST(char const*,mir_disabled_cursor_name)
-
-SDL_MIR_MODULE(XKBCOMMON)
-SDL_MIR_SYM(int,xkb_keysym_to_utf8,(xkb_keysym_t keysym, char *buffer, size_t size))
-
-#undef SDL_MIR_MODULE
-#undef SDL_MIR_SYM
-#undef SDL_MIR_SYM_CONST
-
-/* *INDENT-ON* */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 423
Engine/lib/sdl/src/video/mir/SDL_mirvideo.c

@@ -1,423 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_DRIVER_MIR
-
-#include "SDL_assert.h"
-#include "SDL_log.h"
-
-#include "SDL_mirwindow.h"
-#include "SDL_video.h"
-
-#include "SDL_mirframebuffer.h"
-#include "SDL_mirmouse.h"
-#include "SDL_miropengl.h"
-#include "SDL_mirvideo.h"
-#include "SDL_mirvulkan.h"
-
-#include "SDL_mirdyn.h"
-
-#define MIR_DRIVER_NAME "mir"
-
-static const Uint32 mir_pixel_format_to_sdl_format[] = {
-    SDL_PIXELFORMAT_UNKNOWN,  /* mir_pixel_format_invalid   */
-    SDL_PIXELFORMAT_ABGR8888, /* mir_pixel_format_abgr_8888 */
-    SDL_PIXELFORMAT_BGR888,   /* mir_pixel_format_xbgr_8888 */
-    SDL_PIXELFORMAT_ARGB8888, /* mir_pixel_format_argb_8888 */
-    SDL_PIXELFORMAT_RGB888,   /* mir_pixel_format_xrgb_8888 */
-    SDL_PIXELFORMAT_BGR24,    /* mir_pixel_format_bgr_888   */
-    SDL_PIXELFORMAT_RGB24,    /* mir_pixel_format_rgb_888   */
-    SDL_PIXELFORMAT_RGB565,   /* mir_pixel_format_rgb_565   */
-    SDL_PIXELFORMAT_RGBA5551, /* mir_pixel_format_rgba_5551 */
-    SDL_PIXELFORMAT_RGBA4444  /* mir_pixel_format_rgba_4444 */
-};
-
-Uint32
-MIR_GetSDLPixelFormat(MirPixelFormat format)
-{
-    return mir_pixel_format_to_sdl_format[format];
-}
-
-static int
-MIR_VideoInit(_THIS);
-
-static void
-MIR_VideoQuit(_THIS);
-
-static int
-MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect);
-
-static void
-MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* sdl_display);
-
-static int
-MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* sdl_display, SDL_DisplayMode* mode);
-
-static SDL_WindowShaper*
-MIR_CreateShaper(SDL_Window* window)
-{
-    /* FIXME Im not sure if mir support this atm, will have to come back to this */
-    return NULL;
-}
-
-static int
-MIR_SetWindowShape(SDL_WindowShaper* shaper, SDL_Surface* shape, SDL_WindowShapeMode* shape_mode)
-{
-    return SDL_Unsupported();
-}
-
-static int
-MIR_ResizeWindowShape(SDL_Window* window)
-{
-    return SDL_Unsupported();
-}
-
-static int
-MIR_Available()
-{
-    int available = 0;
-
-    if (SDL_MIR_LoadSymbols()) {
-
-        /* Lets ensure we can connect to the mir server */
-        MirConnection* connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION);
-
-        if (!MIR_mir_connection_is_valid(connection)) {
-            SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Unable to connect to the mir server %s",
-                MIR_mir_connection_get_error_message(connection));
-
-            return available;
-        }
-
-        MIR_mir_connection_release(connection);
-
-        available = 1;
-        SDL_MIR_UnloadSymbols();
-    }
-
-    return available;
-}
-
-static void
-MIR_DeleteDevice(SDL_VideoDevice* device)
-{
-    SDL_free(device);
-    SDL_MIR_UnloadSymbols();
-}
-
-static void
-MIR_PumpEvents(_THIS)
-{
-}
-
-static SDL_VideoDevice*
-MIR_CreateDevice(int device_index)
-{
-    MIR_Data* mir_data;
-    SDL_VideoDevice* device = NULL;
-
-    if (!SDL_MIR_LoadSymbols()) {
-        return NULL;
-    }
-
-    device = SDL_calloc(1, sizeof(SDL_VideoDevice));
-    if (!device) {
-        SDL_MIR_UnloadSymbols();
-        SDL_OutOfMemory();
-        return NULL;
-    }
-
-    mir_data = SDL_calloc(1, sizeof(MIR_Data));
-    if (!mir_data) {
-        SDL_free(device);
-        SDL_MIR_UnloadSymbols();
-        SDL_OutOfMemory();
-        return NULL;
-    }
-
-    device->driverdata = mir_data;
-
-    /* mirvideo */
-    device->VideoInit        = MIR_VideoInit;
-    device->VideoQuit        = MIR_VideoQuit;
-    device->GetDisplayBounds = MIR_GetDisplayBounds;
-    device->GetDisplayModes  = MIR_GetDisplayModes;
-    device->SetDisplayMode   = MIR_SetDisplayMode;
-    device->free             = MIR_DeleteDevice;
-
-    /* miropengles */
-    device->GL_SwapWindow      = MIR_GL_SwapWindow;
-    device->GL_MakeCurrent     = MIR_GL_MakeCurrent;
-    device->GL_CreateContext   = MIR_GL_CreateContext;
-    device->GL_DeleteContext   = MIR_GL_DeleteContext;
-    device->GL_LoadLibrary     = MIR_GL_LoadLibrary;
-    device->GL_UnloadLibrary   = MIR_GL_UnloadLibrary;
-    device->GL_GetSwapInterval = MIR_GL_GetSwapInterval;
-    device->GL_SetSwapInterval = MIR_GL_SetSwapInterval;
-    device->GL_GetProcAddress  = MIR_GL_GetProcAddress;
-
-    /* mirwindow */
-    device->CreateSDLWindow         = MIR_CreateWindow;
-    device->DestroyWindow        = MIR_DestroyWindow;
-    device->GetWindowWMInfo      = MIR_GetWindowWMInfo;
-    device->SetWindowFullscreen  = MIR_SetWindowFullscreen;
-    device->MaximizeWindow       = MIR_MaximizeWindow;
-    device->MinimizeWindow       = MIR_MinimizeWindow;
-    device->RestoreWindow        = MIR_RestoreWindow;
-    device->ShowWindow           = MIR_RestoreWindow;
-    device->HideWindow           = MIR_HideWindow;
-    device->SetWindowSize        = MIR_SetWindowSize;
-    device->SetWindowMinimumSize = MIR_SetWindowMinimumSize;
-    device->SetWindowMaximumSize = MIR_SetWindowMaximumSize;
-    device->SetWindowTitle       = MIR_SetWindowTitle;
-    device->SetWindowGrab        = MIR_SetWindowGrab;
-    device->SetWindowGammaRamp   = MIR_SetWindowGammaRamp;
-    device->GetWindowGammaRamp   = MIR_GetWindowGammaRamp;
-
-    device->CreateSDLWindowFrom     = NULL;
-    device->SetWindowIcon        = NULL;
-    device->RaiseWindow          = NULL;
-    device->SetWindowBordered    = NULL;
-    device->SetWindowResizable   = NULL;
-    device->OnWindowEnter        = NULL;
-    device->SetWindowPosition    = NULL;
-
-    /* mirframebuffer */
-    device->CreateWindowFramebuffer  = MIR_CreateWindowFramebuffer;
-    device->UpdateWindowFramebuffer  = MIR_UpdateWindowFramebuffer;
-    device->DestroyWindowFramebuffer = MIR_DestroyWindowFramebuffer;
-
-    device->shape_driver.CreateShaper      = MIR_CreateShaper;
-    device->shape_driver.SetWindowShape    = MIR_SetWindowShape;
-    device->shape_driver.ResizeWindowShape = MIR_ResizeWindowShape;
-
-    device->PumpEvents = MIR_PumpEvents;
-
-    device->SuspendScreenSaver = NULL;
-
-    device->StartTextInput   = NULL;
-    device->StopTextInput    = NULL;
-    device->SetTextInputRect = NULL;
-
-    device->HasScreenKeyboardSupport = NULL;
-    device->ShowScreenKeyboard       = NULL;
-    device->HideScreenKeyboard       = NULL;
-    device->IsScreenKeyboardShown    = NULL;
-
-    device->SetClipboardText = NULL;
-    device->GetClipboardText = NULL;
-    device->HasClipboardText = NULL;
-
-    device->ShowMessageBox = NULL;
-
-#if SDL_VIDEO_VULKAN
-    device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary;
-    device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary;
-    device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions;
-    device->Vulkan_CreateSurface = MIR_Vulkan_CreateSurface;
-#endif
-
-    return device;
-}
-
-VideoBootStrap MIR_bootstrap = {
-    MIR_DRIVER_NAME, "SDL Mir video driver",
-    MIR_Available, MIR_CreateDevice
-};
-
-static SDL_DisplayMode
-MIR_ConvertModeToSDLMode(MirOutputMode const* mode, MirPixelFormat format)
-{
-    SDL_DisplayMode sdl_mode  = {
-        .format = MIR_GetSDLPixelFormat(format),
-        .w      = MIR_mir_output_mode_get_width(mode),
-        .h      = MIR_mir_output_mode_get_height(mode),
-        .refresh_rate = MIR_mir_output_mode_get_refresh_rate(mode),
-        .driverdata   = NULL
-    };
-
-    return sdl_mode;
-}
-
-static void
-MIR_AddModeToDisplay(SDL_VideoDisplay* display, MirOutputMode const* mode, MirPixelFormat format)
-{
-    SDL_DisplayMode sdl_mode = MIR_ConvertModeToSDLMode(mode, format);
-    SDL_AddDisplayMode(display, &sdl_mode);
-}
-
-static void
-MIR_InitDisplayFromOutput(_THIS, MirOutput* output)
-{
-    SDL_VideoDisplay display;
-    int m;
-
-    MirPixelFormat format = MIR_mir_output_get_current_pixel_format(output);
-    int num_modes         = MIR_mir_output_get_num_modes(output);
-    SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(MIR_mir_output_get_current_mode(output), format);
-
-    SDL_zero(display);
-
-    // Unfortunate cast, but SDL_AddVideoDisplay will strdup this pointer so its read-only in this case.
-    display.name = (char*)MIR_mir_output_type_name(MIR_mir_output_get_type(output));
-
-    for (m = 0; m < num_modes; m++) {
-        MirOutputMode const* mode = MIR_mir_output_get_mode(output, m);
-        MIR_AddModeToDisplay(&display, mode, format);
-    }
-
-    display.desktop_mode = current_mode;
-    display.current_mode = current_mode;
-
-    display.driverdata = output;
-    SDL_AddVideoDisplay(&display);
-}
-
-static void
-MIR_InitDisplays(_THIS)
-{
-    MIR_Data* mir_data = _this->driverdata;
-    int num_outputs    = MIR_mir_display_config_get_num_outputs(mir_data->display_config);
-    int d;
-
-    for (d = 0; d < num_outputs; d++) {
-        MirOutput* output = MIR_mir_display_config_get_mutable_output(mir_data->display_config, d);
-        SDL_bool enabled  = MIR_mir_output_is_enabled(output);
-        MirOutputConnectionState state = MIR_mir_output_get_connection_state(output);
-
-        if (enabled && state == mir_output_connection_state_connected) {
-            MIR_InitDisplayFromOutput(_this, output);
-        }
-    }
-}
-
-static int
-MIR_VideoInit(_THIS)
-{
-    MIR_Data* mir_data = _this->driverdata;
-
-    mir_data->connection     = MIR_mir_connect_sync(NULL, SDL_FUNCTION);
-    mir_data->current_window = NULL;
-    mir_data->software       = SDL_FALSE;
-    mir_data->pixel_format   = mir_pixel_format_invalid;
-
-    if (!MIR_mir_connection_is_valid(mir_data->connection)) {
-        return SDL_SetError("Failed to connect to the mir server: %s",
-            MIR_mir_connection_get_error_message(mir_data->connection));
-    }
-
-    mir_data->display_config = MIR_mir_connection_create_display_configuration(mir_data->connection);
-
-    MIR_InitDisplays(_this);
-    MIR_InitMouse();
-
-    return 0;
-}
-
-static void
-MIR_CleanUpDisplayConfig(_THIS)
-{
-    MIR_Data* mir_data = _this->driverdata;
-    int i;
-
-    // SDL_VideoQuit frees the display driverdata, we own it not them
-    for (i = 0; i < _this->num_displays; ++i) {
-        _this->displays[i].driverdata = NULL;
-    }
-
-    MIR_mir_display_config_release(mir_data->display_config);
-}
-
-static void
-MIR_VideoQuit(_THIS)
-{
-    MIR_Data* mir_data = _this->driverdata;
-
-    MIR_CleanUpDisplayConfig(_this);
-
-    MIR_FiniMouse();
-
-    MIR_GL_DeleteContext(_this, NULL);
-    MIR_GL_UnloadLibrary(_this);
-
-    MIR_mir_connection_release(mir_data->connection);
-
-    SDL_free(mir_data);
-    _this->driverdata = NULL;
-}
-
-static int
-MIR_GetDisplayBounds(_THIS, SDL_VideoDisplay* display, SDL_Rect* rect)
-{
-    MirOutput const* output = display->driverdata;
-
-    rect->x = MIR_mir_output_get_position_x(output);
-    rect->y = MIR_mir_output_get_position_y(output);
-    rect->w = display->current_mode.w;
-    rect->h = display->current_mode.h;
-
-    return 0;
-}
-
-static void
-MIR_GetDisplayModes(_THIS, SDL_VideoDisplay* display)
-{
-}
-
-static int
-MIR_SetDisplayMode(_THIS, SDL_VideoDisplay* display, SDL_DisplayMode* mode)
-{
-    int m;
-    MirOutput* output = display->driverdata;
-    int num_modes     = MIR_mir_output_get_num_modes(output);
-    Uint32 sdl_format = MIR_GetSDLPixelFormat(
-                            MIR_mir_output_get_current_pixel_format(output));
-
-    for (m = 0; m < num_modes; m++) {
-        MirOutputMode const* mir_mode = MIR_mir_output_get_mode(output, m);
-        int width  = MIR_mir_output_mode_get_width(mir_mode);
-        int height = MIR_mir_output_mode_get_height(mir_mode);
-        double refresh_rate = MIR_mir_output_mode_get_refresh_rate(mir_mode);
-
-        if (mode->format == sdl_format &&
-            mode->w      == width &&
-            mode->h      == height &&
-            mode->refresh_rate == refresh_rate) {
-
-            // FIXME Currently wont actually *set* anything. Need to wait for applying display changes
-            MIR_mir_output_set_current_mode(output, mir_mode);
-            return 0;
-        }
-    }
-
-    return -1;
-}
-
-#endif /* SDL_VIDEO_DRIVER_MIR */
-
-/* vi: set ts=4 sw=4 expandtab: */
-

+ 0 - 49
Engine/lib/sdl/src/video/mir/SDL_mirvideo.h

@@ -1,49 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#ifndef SDL_mirvideo_h__
-#define SDL_mirvideo_h__
-
-#include <EGL/egl.h>
-#include <mir_toolkit/mir_client_library.h>
-#include "SDL_stdinc.h"
-
-typedef struct MIR_Window MIR_Window;
-
-typedef struct
-{
-    MirConnection*    connection;
-    MirDisplayConfig* display_config;
-    MIR_Window*       current_window;
-    SDL_bool          software;
-    MirPixelFormat    pixel_format;
-} MIR_Data;
-
-extern Uint32
-MIR_GetSDLPixelFormat(MirPixelFormat format);
-
-#endif /* SDL_mirvideo_h__ */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 176
Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c

@@ -1,176 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
- * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
- * SDL_x11vulkan.c.
- */
-
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR
-
-#include "SDL_mirvideo.h"
-#include "SDL_mirwindow.h"
-#include "SDL_assert.h"
-
-#include "SDL_loadso.h"
-#include "SDL_mirvulkan.h"
-#include "SDL_syswm.h"
-
-int MIR_Vulkan_LoadLibrary(_THIS, const char *path)
-{
-    VkExtensionProperties *extensions = NULL;
-    Uint32 extensionCount = 0;
-    SDL_bool hasSurfaceExtension = SDL_FALSE;
-    SDL_bool hasMIRSurfaceExtension = SDL_FALSE;
-    PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
-    if(_this->vulkan_config.loader_handle)
-        return SDL_SetError("Vulkan already loaded");
-
-    /* Load the Vulkan loader library */
-    if(!path)
-        path = SDL_getenv("SDL_VULKAN_LIBRARY");
-    if(!path)
-        path = "libvulkan.so.1";
-    _this->vulkan_config.loader_handle = SDL_LoadObject(path);
-    if(!_this->vulkan_config.loader_handle)
-        return -1;
-    SDL_strlcpy(_this->vulkan_config.loader_path, path,
-                SDL_arraysize(_this->vulkan_config.loader_path));
-    vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction(
-        _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr");
-    if(!vkGetInstanceProcAddr)
-        goto fail;
-    _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr;
-    _this->vulkan_config.vkEnumerateInstanceExtensionProperties =
-        (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)(
-            VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties");
-    if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties)
-        goto fail;
-    extensions = SDL_Vulkan_CreateInstanceExtensionsList(
-        (PFN_vkEnumerateInstanceExtensionProperties)
-            _this->vulkan_config.vkEnumerateInstanceExtensionProperties,
-        &extensionCount);
-    if(!extensions)
-        goto fail;
-    for(Uint32 i = 0; i < extensionCount; i++)
-    {
-        if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
-            hasSurfaceExtension = SDL_TRUE;
-        else if(SDL_strcmp(VK_KHR_MIR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0)
-            hasMIRSurfaceExtension = SDL_TRUE;
-    }
-    SDL_free(extensions);
-    if(!hasSurfaceExtension)
-    {
-        SDL_SetError("Installed Vulkan doesn't implement the "
-                     VK_KHR_SURFACE_EXTENSION_NAME " extension");
-        goto fail;
-    }
-    else if(!hasMIRSurfaceExtension)
-    {
-        SDL_SetError("Installed Vulkan doesn't implement the "
-                     VK_KHR_MIR_SURFACE_EXTENSION_NAME "extension");
-        goto fail;
-    }
-    return 0;
-
-fail:
-    SDL_UnloadObject(_this->vulkan_config.loader_handle);
-    _this->vulkan_config.loader_handle = NULL;
-    return -1;
-}
-
-void MIR_Vulkan_UnloadLibrary(_THIS)
-{
-    if(_this->vulkan_config.loader_handle)
-    {
-        SDL_UnloadObject(_this->vulkan_config.loader_handle);
-        _this->vulkan_config.loader_handle = NULL;
-    }
-}
-
-SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS,
-                                          SDL_Window *window,
-                                          unsigned *count,
-                                          const char **names)
-{
-    static const char *const extensionsForMir[] = {
-        VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_MIR_SURFACE_EXTENSION_NAME
-    };
-    if(!_this->vulkan_config.loader_handle)
-    {
-        SDL_SetError("Vulkan is not loaded");
-        return SDL_FALSE;
-    }
-    return SDL_Vulkan_GetInstanceExtensions_Helper(
-            count, names, SDL_arraysize(extensionsForMir),
-            extensionsForMir);
-}
-
-SDL_bool MIR_Vulkan_CreateSurface(_THIS,
-                                  SDL_Window *window,
-                                  VkInstance instance,
-                                  VkSurfaceKHR *surface)
-{
-    MIR_Window *windowData = (MIR_Window *)window->driverdata;
-    PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
-        (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
-    PFN_vkCreateMirSurfaceKHR vkCreateMirSurfaceKHR =
-        (PFN_vkCreateMirSurfaceKHR)vkGetInstanceProcAddr(
-                                            (VkInstance)instance,
-                                            "vkCreateMirSurfaceKHR");
-    VkMirSurfaceCreateInfoKHR createInfo;
-    VkResult result;
-
-    if(!_this->vulkan_config.loader_handle)
-    {
-        SDL_SetError("Vulkan is not loaded");
-        return SDL_FALSE;
-    }
-
-    if(!vkCreateMirSurfaceKHR)
-    {
-        SDL_SetError(VK_KHR_MIR_SURFACE_EXTENSION_NAME
-                     " extension is not enabled in the Vulkan instance.");
-        return SDL_FALSE;
-    }
-    SDL_zero(createInfo);
-    createInfo.sType = VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR;
-    createInfo.pNext = NULL;
-    createInfo.flags = 0;
-    createInfo.connection = windowData->mir_data->connection;
-    createInfo.mirSurface = windowData->window;
-    result = vkCreateMirSurfaceKHR(instance, &createInfo,
-                                       NULL, surface);
-    if(result != VK_SUCCESS)
-    {
-        SDL_SetError("vkCreateMirSurfaceKHR failed: %s",
-                     SDL_Vulkan_GetResultString(result));
-        return SDL_FALSE;
-    }
-    return SDL_TRUE;
-}
-
-#endif
-
-/* vim: set ts=4 sw=4 expandtab: */

+ 0 - 52
Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h

@@ -1,52 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
- * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's
- * SDL_x11vulkan.h.
- */
-
-#include "../../SDL_internal.h"
-
-#ifndef SDL_mirvulkan_h_
-#define SDL_mirvulkan_h_
-
-#include "../SDL_vulkan_internal.h"
-#include "../SDL_sysvideo.h"
-
-#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR
-
-int MIR_Vulkan_LoadLibrary(_THIS, const char *path);
-void MIR_Vulkan_UnloadLibrary(_THIS);
-SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS,
-                                          SDL_Window *window,
-                                          unsigned *count,
-                                          const char **names);
-SDL_bool MIR_Vulkan_CreateSurface(_THIS,
-                                  SDL_Window *window,
-                                  VkInstance instance,
-                                  VkSurfaceKHR *surface);
-
-#endif
-
-#endif /* SDL_mirvulkan_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 374
Engine/lib/sdl/src/video/mir/SDL_mirwindow.c

@@ -1,374 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#include "../../SDL_internal.h"
-
-#if SDL_VIDEO_DRIVER_MIR
-
-#include "../SDL_egl_c.h"
-#include "../SDL_sysvideo.h"
-#include "../../events/SDL_keyboard_c.h"
-
-#include "SDL_mirevents.h"
-#include "SDL_mirwindow.h"
-
-#include "SDL_mirdyn.h"
-
-static int
-IsMirWindowValid(MIR_Window* mir_window)
-{
-    if (!MIR_mir_window_is_valid(mir_window->window)) {
-        const char* error = MIR_mir_window_get_error_message(mir_window->window);
-        return SDL_SetError("Failed to create a mir surface: %s", error);
-    }
-
-    return 1;
-}
-
-static MirPixelFormat
-FindValidPixelFormat(MIR_Data* mir_data)
-{
-    unsigned int pf_size = 32;
-    unsigned int valid_formats;
-    unsigned int f;
-
-    MirPixelFormat formats[pf_size];
-    MIR_mir_connection_get_available_surface_formats(mir_data->connection, formats,
-                                                     pf_size, &valid_formats);
-
-    for (f = 0; f < valid_formats; f++) {
-        MirPixelFormat cur_pf = formats[f];
-
-        if (cur_pf == mir_pixel_format_abgr_8888 ||
-            cur_pf == mir_pixel_format_xbgr_8888 ||
-            cur_pf == mir_pixel_format_argb_8888 ||
-            cur_pf == mir_pixel_format_xrgb_8888) {
-
-            return cur_pf;
-        }
-    }
-
-    return mir_pixel_format_invalid;
-}
-
-int
-MIR_CreateWindow(_THIS, SDL_Window* window)
-{
-    MIR_Window* mir_window;
-    MIR_Data* mir_data;
-    MirPixelFormat pixel_format;
-    MirBufferUsage buffer_usage;
-
-    MirWindowSpec* spec;
-
-    mir_window = SDL_calloc(1, sizeof(MIR_Window));
-    if (!mir_window)
-        return SDL_OutOfMemory();
-
-    mir_data = _this->driverdata;
-    window->driverdata = mir_window;
-
-    if (window->x == SDL_WINDOWPOS_UNDEFINED)
-        window->x = 0;
-
-    if (window->y == SDL_WINDOWPOS_UNDEFINED)
-        window->y = 0;
-
-    mir_window->mir_data = mir_data;
-    mir_window->sdl_window = window;
-
-    if (window->flags & SDL_WINDOW_OPENGL) {
-        pixel_format = MIR_mir_connection_get_egl_pixel_format(mir_data->connection,
-                                                               _this->egl_data->egl_display,
-                                                               _this->egl_data->egl_config);
-    }
-    else {
-        pixel_format = FindValidPixelFormat(mir_data);
-    }
-
-    mir_data->pixel_format = pixel_format;
-    if (pixel_format == mir_pixel_format_invalid) {
-        return SDL_SetError("Failed to find a valid pixel format.");
-    }
-
-    buffer_usage = mir_buffer_usage_hardware;
-    if (mir_data->software)
-        buffer_usage = mir_buffer_usage_software;
-
-    spec = MIR_mir_create_normal_window_spec(mir_data->connection,
-                                             window->w,
-                                             window->h);
-
-    MIR_mir_window_spec_set_buffer_usage(spec, buffer_usage);
-    MIR_mir_window_spec_set_name(spec, "Mir surface");
-    MIR_mir_window_spec_set_pixel_format(spec, pixel_format);
-
-    if (window->flags & SDL_WINDOW_INPUT_FOCUS)
-        SDL_SetKeyboardFocus(window);
-
-    mir_window->window = MIR_mir_create_window_sync(spec);
-    MIR_mir_window_set_event_handler(mir_window->window, MIR_HandleEvent, window);
-
-    MIR_mir_window_spec_release(spec);
-
-    if (!MIR_mir_window_is_valid(mir_window->window)) {
-        return SDL_SetError("Failed to create a mir surface: %s",
-            MIR_mir_window_get_error_message(mir_window->window));
-    }
-
-    if (window->flags & SDL_WINDOW_OPENGL) {
-        EGLNativeWindowType egl_native_window =
-                        (EGLNativeWindowType)MIR_mir_buffer_stream_get_egl_native_window(
-                                                       MIR_mir_window_get_buffer_stream(mir_window->window));
-
-        mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window);
-
-        if (mir_window->egl_surface == EGL_NO_SURFACE) {
-            return SDL_SetError("Failed to create a window surface %p",
-                                _this->egl_data->egl_display);
-        }
-    }
-    else {
-        mir_window->egl_surface = EGL_NO_SURFACE;
-    }
-
-    mir_data->current_window = mir_window;
-
-    return 0;
-}
-
-void
-MIR_DestroyWindow(_THIS, SDL_Window* window)
-{
-    MIR_Data* mir_data     = _this->driverdata;
-    MIR_Window* mir_window = window->driverdata;
-
-    if (mir_data) {
-        SDL_EGL_DestroySurface(_this, mir_window->egl_surface);
-        MIR_mir_window_release_sync(mir_window->window);
-
-        mir_data->current_window = NULL;
-
-        SDL_free(mir_window);
-    }
-    window->driverdata = NULL;
-}
-
-SDL_bool
-MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info)
-{
-    if (info->version.major == SDL_MAJOR_VERSION &&
-        info->version.minor == SDL_MINOR_VERSION) {
-        MIR_Window* mir_window = window->driverdata;
-
-        info->subsystem = SDL_SYSWM_MIR;
-        info->info.mir.connection = mir_window->mir_data->connection;
-        // Cannot change this to window due to it being in the public API
-        info->info.mir.surface = mir_window->window;
-
-        return SDL_TRUE;
-    }
-
-    return SDL_FALSE;
-}
-
-static void
-UpdateMirWindowState(MIR_Data* mir_data, MIR_Window* mir_window, MirWindowState window_state)
-{
-    if (IsMirWindowValid(mir_window)) {
-        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
-        MIR_mir_window_spec_set_state(spec, window_state);
-
-        MIR_mir_window_apply_spec(mir_window->window, spec);
-        MIR_mir_window_spec_release(spec);
-    }
-}
-
-void
-MIR_SetWindowFullscreen(_THIS, SDL_Window* window,
-                        SDL_VideoDisplay* display,
-                        SDL_bool fullscreen)
-{
-    if (IsMirWindowValid(window->driverdata)) {
-        MirWindowState state;
-
-        if (fullscreen) {
-            state = mir_window_state_fullscreen;
-        }
-        else {
-            state = mir_window_state_restored;
-        }
-
-        UpdateMirWindowState(_this->driverdata, window->driverdata, state);
-    }
-}
-
-void
-MIR_MaximizeWindow(_THIS, SDL_Window* window)
-{
-    UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_maximized);
-}
-
-void
-MIR_MinimizeWindow(_THIS, SDL_Window* window)
-{
-    UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_minimized);
-}
-
-void
-MIR_RestoreWindow(_THIS, SDL_Window * window)
-{
-    UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_restored);
-}
-
-void
-MIR_HideWindow(_THIS, SDL_Window* window)
-{
-    UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_hidden);
-}
-
-void
-MIR_SetWindowSize(_THIS, SDL_Window* window)
-{
-    MIR_Data* mir_data     = _this->driverdata;
-    MIR_Window* mir_window = window->driverdata;
-
-    if (IsMirWindowValid(mir_window)) {
-        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
-        MIR_mir_window_spec_set_width (spec, window->w);
-        MIR_mir_window_spec_set_height(spec, window->h);
-
-        MIR_mir_window_apply_spec(mir_window->window, spec);
-    }
-}
-
-void
-MIR_SetWindowMinimumSize(_THIS, SDL_Window* window)
-{
-    MIR_Data* mir_data     = _this->driverdata;
-    MIR_Window* mir_window = window->driverdata;
-
-    if (IsMirWindowValid(mir_window)) {
-        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
-        MIR_mir_window_spec_set_min_width (spec, window->min_w);
-        MIR_mir_window_spec_set_min_height(spec, window->min_h);
-
-        MIR_mir_window_apply_spec(mir_window->window, spec);
-    }
-}
-
-void
-MIR_SetWindowMaximumSize(_THIS, SDL_Window* window)
-{
-    MIR_Data* mir_data     = _this->driverdata;
-    MIR_Window* mir_window = window->driverdata;
-
-    if (IsMirWindowValid(mir_window)) {
-        MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection);
-        MIR_mir_window_spec_set_max_width (spec, window->max_w);
-        MIR_mir_window_spec_set_max_height(spec, window->max_h);
-
-        MIR_mir_window_apply_spec(mir_window->window, spec);
-    }
-}
-
-void
-MIR_SetWindowTitle(_THIS, SDL_Window* window)
-{
-    MIR_Data*   mir_data   = _this->driverdata;
-    MIR_Window* mir_window = window->driverdata;
-    char const* title = window->title ? window->title : "";
-    MirWindowSpec* spec;
-
-    if (IsMirWindowValid(mir_window) < 0)
-        return;
-
-    spec = MIR_mir_create_window_spec(mir_data->connection);
-    MIR_mir_window_spec_set_name(spec, title);
-
-    MIR_mir_window_apply_spec(mir_window->window, spec);
-    MIR_mir_window_spec_release(spec);
-}
-
-void
-MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed)
-{
-    MIR_Data*   mir_data   = _this->driverdata;
-    MIR_Window* mir_window = window->driverdata;
-    MirPointerConfinementState confined = mir_pointer_unconfined;
-    MirWindowSpec* spec;
-
-    if (grabbed)
-        confined = mir_pointer_confined_to_window;
-
-    spec = MIR_mir_create_window_spec(mir_data->connection);
-    MIR_mir_window_spec_set_pointer_confinement(spec, confined);
-
-    MIR_mir_window_apply_spec(mir_window->window, spec);
-    MIR_mir_window_spec_release(spec);
-}
-
-int
-MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp)
-{
-    MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata;
-    Uint32 ramp_size = 256;
-
-    // FIXME Need to apply the changes to the output, once that public API function is around
-    if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) {
-        MIR_mir_output_set_gamma(output,
-                                 ramp + ramp_size * 0,
-                                 ramp + ramp_size * 1,
-                                 ramp + ramp_size * 2,
-                                 ramp_size);
-        return 0;
-    }
-
-    return -1;
-}
-
-int
-MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp)
-{
-    MirOutput* output = SDL_GetDisplayForWindow(window)->driverdata;
-    Uint32 ramp_size = 256;
-
-    if (MIR_mir_output_is_gamma_supported(output) == mir_output_gamma_supported) {
-        if (MIR_mir_output_get_gamma_size(output) == ramp_size) {
-            MIR_mir_output_get_gamma(output,
-                                     ramp + ramp_size * 0,
-                                     ramp + ramp_size * 1,
-                                     ramp + ramp_size * 2,
-                                     ramp_size);
-            return 0;
-        }
-    }
-
-    return -1;
-}
-
-#endif /* SDL_VIDEO_DRIVER_MIR */
-
-/* vi: set ts=4 sw=4 expandtab: */

+ 0 - 93
Engine/lib/sdl/src/video/mir/SDL_mirwindow.h

@@ -1,93 +0,0 @@
-/*
-  Simple DirectMedia Layer
-  Copyright (C) 1997-2018 Sam Lantinga <[email protected]>
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-*/
-
-/*
-  Contributed by Brandon Schaefer, <[email protected]>
-*/
-
-#ifndef SDL_mirwindow_h_
-#define SDL_mirwindow_h_
-
-#include "../SDL_sysvideo.h"
-#include "SDL_syswm.h"
-
-#include "SDL_mirvideo.h"
-
-struct MIR_Window {
-    SDL_Window* sdl_window;
-    MIR_Data*   mir_data;
-
-    MirWindow*  window;
-    EGLSurface  egl_surface;
-};
-
-
-extern int
-MIR_CreateWindow(_THIS, SDL_Window* window);
-
-extern void
-MIR_DestroyWindow(_THIS, SDL_Window* window);
-
-extern void
-MIR_SetWindowFullscreen(_THIS, SDL_Window* window,
-                        SDL_VideoDisplay* display,
-                        SDL_bool fullscreen);
-
-extern void
-MIR_MaximizeWindow(_THIS, SDL_Window* window);
-
-extern void
-MIR_MinimizeWindow(_THIS, SDL_Window* window);
-
-extern void
-MIR_RestoreWindow(_THIS, SDL_Window* window);
-
-extern void
-MIR_HideWindow(_THIS, SDL_Window* window);
-
-extern SDL_bool
-MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info);
-
-extern void
-MIR_SetWindowSize(_THIS, SDL_Window* window);
-
-extern void
-MIR_SetWindowMinimumSize(_THIS, SDL_Window* window);
-
-extern void
-MIR_SetWindowMaximumSize(_THIS, SDL_Window* window);
-
-extern void
-MIR_SetWindowTitle(_THIS, SDL_Window* window);
-
-extern void
-MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed);
-
-extern int
-MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp);
-
-extern int
-MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp);
-
-#endif /* SDL_mirwindow_h_ */
-
-/* vi: set ts=4 sw=4 expandtab: */
-

+ 0 - 359
Engine/lib/sdl/test/aclocal.m4

@@ -1,359 +0,0 @@
-# Configure paths for SDL
-# Sam Lantinga 9/21/99
-# stolen from Manish Singh
-# stolen back from Frank Belew
-# stolen from Manish Singh
-# Shamelessly stolen from Owen Taylor
-
-# serial 1
-
-dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
-dnl
-AC_DEFUN([AM_PATH_SDL2],
-[dnl 
-dnl Get the cflags and libraries from the sdl2-config script
-dnl
-AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
-            sdl_prefix="$withval", sdl_prefix="")
-AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
-            sdl_exec_prefix="$withval", sdl_exec_prefix="")
-AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
-		    , enable_sdltest=yes)
-
-  min_sdl_version=ifelse([$1], ,0.9.0,$1)
-
-  if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
-    PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version],
-           [sdl_pc=yes],
-           [sdl_pc=no])
-  else
-    sdl_pc=no
-    if test x$sdl_exec_prefix != x ; then
-      sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
-      if test x${SDL_CONFIG+set} != xset ; then
-        SDL_CONFIG=$sdl_exec_prefix/bin/sdl2-config
-      fi
-    fi
-    if test x$sdl_prefix != x ; then
-      sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
-      if test x${SDL_CONFIG+set} != xset ; then
-        SDL_CONFIG=$sdl_prefix/bin/sdl2-config
-      fi
-    fi
-  fi
-
-  if test "x$sdl_pc" = xyes ; then
-    no_sdl=""
-    SDL_CONFIG="pkg-config sdl2"
-  else
-    as_save_PATH="$PATH"
-    if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
-      PATH="$prefix/bin:$prefix/usr/bin:$PATH"
-    fi
-    AC_PATH_PROG(SDL_CONFIG, sdl2-config, no, [$PATH])
-    PATH="$as_save_PATH"
-    AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
-    no_sdl=""
-
-    if test "$SDL_CONFIG" = "no" ; then
-      no_sdl=yes
-    else
-      SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
-      SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
-
-      sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
-             sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-      sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
-             sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-      sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
-             sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-      if test "x$enable_sdltest" = "xyes" ; then
-        ac_save_CFLAGS="$CFLAGS"
-        ac_save_CXXFLAGS="$CXXFLAGS"
-        ac_save_LIBS="$LIBS"
-        CFLAGS="$CFLAGS $SDL_CFLAGS"
-        CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
-        LIBS="$LIBS $SDL_LIBS"
-dnl
-dnl Now check if the installed SDL is sufficiently new. (Also sanity
-dnl checks the results of sdl2-config to some extent
-dnl
-      rm -f conf.sdltest
-      AC_TRY_RUN([
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "SDL.h"
-
-char*
-my_strdup (char *str)
-{
-  char *new_str;
-  
-  if (str)
-    {
-      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
-      strcpy (new_str, str);
-    }
-  else
-    new_str = NULL;
-  
-  return new_str;
-}
-
-int main (int argc, char *argv[])
-{
-  int major, minor, micro;
-  char *tmp_version;
-
-  /* This hangs on some systems (?)
-  system ("touch conf.sdltest");
-  */
-  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
-
-  /* HP/UX 9 (%@#!) writes to sscanf strings */
-  tmp_version = my_strdup("$min_sdl_version");
-  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
-     printf("%s, bad version string\n", "$min_sdl_version");
-     exit(1);
-   }
-
-   if (($sdl_major_version > major) ||
-      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
-      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
-    {
-      return 0;
-    }
-  else
-    {
-      printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
-      printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro);
-      printf("*** best to upgrade to the required version.\n");
-      printf("*** If sdl2-config was wrong, set the environment variable SDL_CONFIG\n");
-      printf("*** to point to the correct copy of sdl2-config, and remove the file\n");
-      printf("*** config.cache before re-running configure\n");
-      return 1;
-    }
-}
-
-],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
-        CFLAGS="$ac_save_CFLAGS"
-        CXXFLAGS="$ac_save_CXXFLAGS"
-        LIBS="$ac_save_LIBS"
-      fi
-    fi
-    if test "x$no_sdl" = x ; then
-      AC_MSG_RESULT(yes)
-    else
-      AC_MSG_RESULT(no)
-    fi
-  fi
-  if test "x$no_sdl" = x ; then
-     ifelse([$2], , :, [$2])
-  else
-     if test "$SDL_CONFIG" = "no" ; then
-       echo "*** The sdl2-config script installed by SDL could not be found"
-       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
-       echo "*** your path, or set the SDL_CONFIG environment variable to the"
-       echo "*** full path to sdl2-config."
-     else
-       if test -f conf.sdltest ; then
-        :
-       else
-          echo "*** Could not run SDL test program, checking why..."
-          CFLAGS="$CFLAGS $SDL_CFLAGS"
-          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
-          LIBS="$LIBS $SDL_LIBS"
-          AC_TRY_LINK([
-#include <stdio.h>
-#include "SDL.h"
-
-int main(int argc, char *argv[])
-{ return 0; }
-#undef  main
-#define main K_and_R_C_main
-],      [ return 0; ],
-        [ 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"
-          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
-          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
-          echo "*** is required on your system"
-	  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"],
-        [ 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: $SDL_CONFIG" ])
-          CFLAGS="$ac_save_CFLAGS"
-          CXXFLAGS="$ac_save_CXXFLAGS"
-          LIBS="$ac_save_LIBS"
-       fi
-     fi
-     SDL_CFLAGS=""
-     SDL_LIBS=""
-     ifelse([$3], , :, [$3])
-  fi
-  AC_SUBST(SDL_CFLAGS)
-  AC_SUBST(SDL_LIBS)
-  rm -f conf.sdltest
-])
-# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
-# serial 1 (pkg-config-0.24)
-# 
-# Copyright © 2004 Scott James Remnant <[email protected]>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
-AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
-AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
-	_pkg_min_version=m4_default([$1], [0.9.0])
-	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
-	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-		AC_MSG_RESULT([yes])
-	else
-		AC_MSG_RESULT([no])
-		PKG_CONFIG=""
-	fi
-fi[]dnl
-])# PKG_PROG_PKG_CONFIG
-
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists.  Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-# only at the first occurence in configure.ac, so if the first place
-# it's called might be skipped (such as if it is within an "if", you
-# have to call PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test -n "$PKG_CONFIG" && \
-    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
-  m4_default([$2], [:])
-m4_ifvaln([$3], [else
-  $3])dnl
-fi])
-
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
-m4_define([_PKG_CONFIG],
-[if test -n "$$1"; then
-    pkg_cv_[]$1="$$1"
- elif test -n "$PKG_CONFIG"; then
-    PKG_CHECK_EXISTS([$3],
-                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
-		     [pkg_failed=yes])
- else
-    pkg_failed=untried
-fi[]dnl
-])# _PKG_CONFIG
-
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
-AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
-
-
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-
-pkg_failed=no
-AC_MSG_CHECKING([for $1])
-
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-and $1[]_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.])
-
-if test $pkg_failed = yes; then
-   	AC_MSG_RESULT([no])
-        _PKG_SHORT_ERRORS_SUPPORTED
-        if test $_pkg_short_errors_supported = yes; then
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
-        else 
-	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-
-	m4_default([$4], [AC_MSG_ERROR(
-[Package requirements ($2) were not met:
-
-$$1_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-_PKG_TEXT])dnl
-        ])
-elif test $pkg_failed = untried; then
-     	AC_MSG_RESULT([no])
-	m4_default([$4], [AC_MSG_FAILURE(
-[The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-_PKG_TEXT
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
-        ])
-else
-	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
-        AC_MSG_RESULT([yes])
-	$3
-fi[]dnl
-])# PKG_CHECK_MODULES

+ 0 - 191
Engine/lib/sdl/test/configure.in

@@ -1,191 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(README)
-
-dnl Detect the canonical build and host environments
-AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
-AC_CANONICAL_HOST
-
-dnl Check for tools
-
-AC_PROG_CC
-
-dnl Check for compiler environment
-
-AC_C_CONST
-
-dnl We only care about this for building testnative at the moment, so these
-dnl  values shouldn't be considered absolute truth.
-dnl  (Haiku, for example, sets none of these.)
-ISUNIX="false"
-ISWINDOWS="false"
-ISMACOSX="false"
-
-dnl Figure out which math library to use
-case "$host" in
-    *-*-cygwin* | *-*-mingw32*)
-        ISWINDOWS="true"
-        EXE=".exe"
-        MATHLIB=""
-        SYS_GL_LIBS="-lopengl32"
-        ;;
-    *-*-haiku*)
-        EXE=""
-        MATHLIB=""
-        SYS_GL_LIBS="-lGL"
-        ;;
-    *-*-darwin* )
-        ISMACOSX="true"
-        EXE=""
-        MATHLIB=""
-        SYS_GL_LIBS="-Wl,-framework,OpenGL"
-        ;;
-    *-*-aix*)
-        ISUNIX="true"
-        EXE=""
-        if test x$ac_cv_prog_gcc = xyes; then
-            CFLAGS="-mthreads"
-        fi
-        SYS_GL_LIBS=""
-        ;;
-    *-*-mint*)
-        EXE=""
-        MATHLIB=""
-        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
-        if test "x$OSMESA_CONFIG" = "xyes"; then
-            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
-            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
-            CFLAGS="$CFLAGS $OSMESA_CFLAGS"
-            SYS_GL_LIBS="$OSMESA_LIBS"
-        else
-            SYS_GL_LIBS="-lOSMesa"
-        fi
-        ;;
-    *-*-qnx*)
-        EXE=""
-        MATHLIB=""
-        SYS_GL_LIBS="-lGLES_CM"
-        ;;
-    *-*-emscripten* )
-        dnl This should really be .js, but we need to specify extra flags when compiling to js
-        EXE=".bc"
-        MATHLIB=""
-        SYS_GL_LIBS=""
-        ;;
-    *)
-        dnl Oh well, call it Unix...
-        ISUNIX="true"
-        EXE=""
-        MATHLIB="-lm"
-        SYS_GL_LIBS="-lGL"
-        ;;
-esac
-AC_SUBST(EXE)
-AC_SUBST(MATHLIB)
-AC_SUBST(ISMACOSX)
-AC_SUBST(ISWINDOWS)
-AC_SUBST(ISUNIX)
-
-dnl Check for SDL
-SDL_VERSION=2.0.0
-AM_PATH_SDL2($SDL_VERSION,
-            :,
-	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
-)
-CFLAGS="$CFLAGS $SDL_CFLAGS"
-LIBS="$LIBS -lSDL2_test $SDL_LIBS"
-
-dnl Check for X11 path, needed for OpenGL on some systems
-AC_PATH_X
-if test x$have_x = xyes; then
-    if test x$ac_x_includes = xno || test "x$ac_x_includes" = xNone || test "x$ac_x_includes" = x; then
-        :
-    else
-        CFLAGS="$CFLAGS -I$ac_x_includes"
-    fi
-    if test x$ac_x_libraries = xno || test "x$ac_x_libraries" = xNone; then
-        :
-    else
-        if test "x$ac_x_libraries" = x; then
-            XPATH=""
-            XLIB="-lX11"
-        else
-            XPATH="-L$ac_x_libraries"
-            XLIB="-L$ac_x_libraries -lX11"
-        fi
-    fi
-fi
-
-dnl Check for OpenGL
-AC_MSG_CHECKING(for OpenGL support)
-have_opengl=no
-AC_TRY_COMPILE([
- #include "SDL_opengl.h"
-],[
-],[
-have_opengl=yes
-])
-AC_MSG_RESULT($have_opengl)
-
-dnl Check for OpenGL ES
-AC_MSG_CHECKING(for OpenGL ES support)
-have_opengles=no
-AC_TRY_COMPILE([
- #if defined (__IPHONEOS__)
-    #include <OpenGLES/ES1/gl.h>
- #else
-    #include <GLES/gl.h>
- #endif /* __QNXNTO__ */
-],[
-],[
-have_opengles=yes
-])
-AC_MSG_RESULT($have_opengles)
-
-dnl Check for OpenGL ES2
-AC_MSG_CHECKING(for OpenGL ES2 support)
-have_opengles2=no
-AC_TRY_COMPILE([
- #if defined (__IPHONEOS__)
-    #include <OpenGLES/ES2/gl.h>
-    #include <OpenGLES/ES2/glext.h>
- #else
-    #include <GLES2/gl2.h>
-    #include <GLES2/gl2ext.h>
- #endif
-],[
-],[
-have_opengles2=yes
-])
-AC_MSG_RESULT($have_opengles2)
-
-GLLIB=""
-GLESLIB=""
-GLES2LIB=""
-if test x$have_opengles = xyes; then
-    CFLAGS="$CFLAGS -DHAVE_OPENGLES"
-    GLESLIB="$XPATH -lGLESv1_CM"
-fi
-if test x$have_opengles2 = xyes; then
-    CFLAGS="$CFLAGS -DHAVE_OPENGLES2"
-    #GLES2LIB="$XPATH -lGLESv2"
-fi
-if test x$have_opengl = xyes; then
-    CFLAGS="$CFLAGS -DHAVE_OPENGL"
-    GLLIB="$XPATH $SYS_GL_LIBS"
-fi
-
-AC_SUBST(GLLIB)
-AC_SUBST(GLESLIB)
-AC_SUBST(GLES2LIB)
-AC_SUBST(XLIB)
-
-dnl Check for SDL_ttf
-AC_CHECK_LIB(SDL2_ttf, TTF_Init, have_SDL_ttf=yes)
-if test x$have_SDL_ttf = xyes; then
-    CFLAGS="$CFLAGS -DHAVE_SDL_TTF"
-    SDL_TTF_LIB="-lSDL2_ttf"
-fi
-AC_SUBST(SDL_TTF_LIB)
-
-dnl Finally create all the generated files
-AC_OUTPUT([Makefile])