sdl

FORK: Simple Directmedia Layer
git clone https://git.neptards.moe/neptards/sdl.git
Log | Files | Refs

configure.ac (166205B)


      1 dnl Process this file with autoconf to produce a configure script.
      2 AC_INIT
      3 AC_CONFIG_SRCDIR(README.txt)
      4 AC_CONFIG_HEADERS(include/SDL_config.h)
      5 AC_CONFIG_AUX_DIR(build-scripts)
      6 AC_CONFIG_MACRO_DIR([acinclude])
      7 
      8 dnl Save the CFLAGS to see whether they were passed in or generated
      9 orig_CFLAGS="$CFLAGS"
     10 
     11 dnl Set various version strings - taken gratefully from the GTk sources
     12 #
     13 # Making releases:
     14 # Edit include/SDL_version.h and change the version, then:
     15 #   SDL_MICRO_VERSION += 1;
     16 #   SDL_INTERFACE_AGE += 1;
     17 #   SDL_BINARY_AGE += 1;
     18 # if any functions have been added, set SDL_INTERFACE_AGE to 0.
     19 # if backwards compatibility has been broken,
     20 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
     21 #
     22 SDL_MAJOR_VERSION=2
     23 SDL_MINOR_VERSION=0
     24 SDL_MICRO_VERSION=14
     25 SDL_INTERFACE_AGE=0
     26 SDL_BINARY_AGE=14
     27 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
     28 
     29 AC_SUBST(SDL_MAJOR_VERSION)
     30 AC_SUBST(SDL_MINOR_VERSION)
     31 AC_SUBST(SDL_MICRO_VERSION)
     32 AC_SUBST(SDL_INTERFACE_AGE)
     33 AC_SUBST(SDL_BINARY_AGE)
     34 AC_SUBST(SDL_VERSION)
     35 
     36 # libtool versioning
     37 LT_INIT([win32-dll])
     38 LT_LANG([Windows Resource])
     39 
     40 LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
     41 LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
     42 LT_REVISION=$SDL_INTERFACE_AGE
     43 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
     44 m4_pattern_allow([^LT_])
     45 
     46 AC_SUBST(LT_RELEASE)
     47 AC_SUBST(LT_CURRENT)
     48 AC_SUBST(LT_REVISION)
     49 AC_SUBST(LT_AGE)
     50 
     51 dnl Detect the canonical build and host environments
     52 dnl AC_CANONICAL_HOST
     53 
     54 dnl Check for tools
     55 AC_PROG_CC
     56 AC_PROG_CXX
     57 AC_PROG_INSTALL
     58 AC_PROG_MAKE_SET
     59 PKG_PROG_PKG_CONFIG
     60 
     61 dnl Make sure that srcdir is a full pathname
     62 case "$host" in
     63     *-*-mingw32*)
     64         # Except on msys, where make can't handle full pathnames (bug 1972)
     65         ;;
     66     *)
     67         srcdir=`cd $srcdir && pwd`
     68         ;;
     69 esac
     70 
     71 dnl Set up the compiler and linker flags
     72 INCLUDE="-I$srcdir/include"
     73 
     74 dnl Don't use our khronos headers on QNX.
     75 case "$host" in
     76     *-*-nto-qnx*)
     77         ;;
     78     *)
     79         INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos"
     80         ;;
     81 esac
     82 
     83 if test x$srcdir != x.; then
     84     INCLUDE="-Iinclude $INCLUDE"
     85 elif test -d .hg; then
     86     AC_MSG_ERROR([
     87 *** When building from Mercurial you should configure and build in a
     88     separate directory so you don't clobber SDL_config.h, SDL_revision.h
     89 ])
     90 fi
     91 BASE_CFLAGS=""
     92 BASE_LDFLAGS=""
     93 case "$host" in
     94     *-*-cygwin*)
     95         # We build SDL on cygwin without the UNIX emulation layer
     96         save_CFLAGS="$CFLAGS"
     97         have_no_cygwin=no
     98         AC_MSG_CHECKING(for GCC -mno-cygwin option)
     99         CFLAGS="$save_CFLAGS -mno-cygwin"
    100 
    101         AC_TRY_COMPILE([
    102         ],[
    103         ],[
    104         have_no_cygwin=yes
    105         ])
    106         AC_MSG_RESULT($have_no_cygwin)
    107         CFLAGS="$save_CFLAGS"
    108 
    109         if test x$have_no_cygwin = xyes; then
    110             BASE_CFLAGS="-mno-cygwin"
    111             BASE_LDFLAGS="-mno-cygwin"
    112         fi
    113         BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw"
    114         ;;
    115 esac
    116 # Uncomment the following line if you want to force SDL and applications
    117 # built with it to be compiled for a particular architecture.
    118 #AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
    119 BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H"
    120 # The default optimization for SDL is -O3 (Bug #31)
    121 if test "x$orig_CFLAGS" = x; then
    122     BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
    123 fi
    124 EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
    125 BUILD_LDFLAGS="$LDFLAGS"
    126 EXTRA_LDFLAGS="$BASE_LDFLAGS"
    127 ## These are common directories to find software packages
    128 #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
    129 #    if test -d $path/include; then
    130 #        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
    131 #    fi
    132 #    if test -d $path/lib; then
    133 #        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
    134 #    fi
    135 #done
    136 SDL_CFLAGS="$BASE_CFLAGS"
    137 SDL_LIBS="-lSDL2"
    138 if test "x$BASE_LDFLAGS" != x; then
    139     SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS"
    140 fi
    141 if test "x$EXTRA_CFLAGS" != x; then
    142     CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
    143     CFLAGS="$CFLAGS $EXTRA_CFLAGS"
    144 fi
    145 if test "x$EXTRA_LDFLAGS" != x; then
    146     LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
    147 fi
    148 
    149 dnl set this to use on systems that use lib64 instead of lib
    150 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
    151 
    152 dnl Function to find a library in the compiler search path
    153 find_lib()
    154 {
    155     gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
    156     gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
    157     env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
    158     if test "$cross_compiling" = yes; then
    159         host_lib_path=""
    160     else
    161         host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
    162     fi
    163     for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
    164         lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
    165         if test x$lib != x; then
    166             echo $lib
    167             return
    168         fi
    169     done
    170     # Try again, this time allowing more than one version digit after the .so
    171     for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
    172         lib=[`ls -- $path/$1 2>/dev/null | sed -e 's,.*/,,' | sort | tail -1`]
    173         if test x$lib != x; then
    174             echo $lib
    175             return
    176         fi
    177     done
    178 }
    179 
    180 dnl Check for compiler characteristics
    181 AC_C_CONST
    182 AC_C_INLINE
    183 AC_C_VOLATILE
    184 
    185 dnl See whether we want assertions for debugging/sanity checking SDL itself.
    186 AC_ARG_ENABLE(assertions,
    187 AS_HELP_STRING([--enable-assertions],
    188                [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
    189               , enable_assertions=auto)
    190 case "$enable_assertions" in
    191     auto) # Use optimization settings to determine assertion level
    192         ;;
    193     disabled)
    194         AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
    195         ;;
    196     release)
    197         AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
    198         ;;
    199     enabled)
    200         AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
    201         ;;
    202     paranoid)
    203         AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
    204         ;;
    205     *)
    206         AC_MSG_ERROR([*** unknown assertion level. stop.])
    207         ;;
    208 esac
    209 
    210 dnl See whether we can use gcc style dependency tracking
    211 AC_ARG_ENABLE(dependency-tracking,
    212 AS_HELP_STRING([--enable-dependency-tracking],
    213                [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
    214               , enable_dependency_tracking=yes)
    215 if test x$enable_dependency_tracking = xyes; then
    216     have_gcc_mmd_mt=no
    217     AC_MSG_CHECKING(for GCC -MMD -MT option)
    218     AC_TRY_COMPILE([
    219     #if !defined(__GNUC__) || __GNUC__ < 3
    220     #error Dependency tracking requires GCC 3.0 or newer
    221     #endif
    222     ],[
    223     ],[
    224     have_gcc_mmd_mt=yes
    225     ])
    226     AC_MSG_RESULT($have_gcc_mmd_mt)
    227 
    228     if test x$have_gcc_mmd_mt = xyes; then
    229         DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
    230     fi
    231 fi
    232 
    233 AC_MSG_CHECKING(for linker option --no-undefined)
    234 have_no_undefined=no
    235 case "$host" in
    236     dnl Skip this on platforms where it is just simply busted.
    237     *-*-openbsd*)
    238         ;;
    239 
    240     *)
    241         save_LDFLAGS="$LDFLAGS"
    242         LDFLAGS="$LDFLAGS -Wl,--no-undefined"
    243         AC_TRY_LINK([
    244         ],[
    245         ],[
    246         have_no_undefined=yes
    247         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined"
    248         ])
    249         LDFLAGS="$save_LDFLAGS"
    250         ;;
    251 esac
    252 AC_MSG_RESULT($have_no_undefined)
    253 
    254 AC_MSG_CHECKING(for linker option --dynamicbase)
    255 have_dynamicbase=no
    256 case "$host" in
    257     *)
    258         save_LDFLAGS="$LDFLAGS"
    259         LDFLAGS="$LDFLAGS -Wl,--dynamicbase"
    260         AC_TRY_LINK([
    261         ],[
    262         ],[
    263         have_dynamicbase=yes
    264         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--dynamicbase"
    265         ])
    266         LDFLAGS="$save_LDFLAGS"
    267         ;;
    268 esac
    269 AC_MSG_RESULT($have_dynamicbase)
    270 
    271 AC_MSG_CHECKING(for linker option --nxcompat)
    272 have_nxcompat=no
    273 case "$host" in
    274     *)
    275         save_LDFLAGS="$LDFLAGS"
    276         LDFLAGS="$LDFLAGS -Wl,--nxcompat"
    277         AC_TRY_LINK([
    278         ],[
    279         ],[
    280         have_nxcompat=yes
    281         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--nxcompat"
    282         ])
    283         LDFLAGS="$save_LDFLAGS"
    284         ;;
    285 esac
    286 AC_MSG_RESULT($have_nxcompat)
    287 
    288 AC_MSG_CHECKING(for linker option --high-entropy-va)
    289 have_high_entropy_va=no
    290 case "$host" in
    291     *)
    292         save_LDFLAGS="$LDFLAGS"
    293         LDFLAGS="$LDFLAGS -Wl,--high-entropy-va"
    294         AC_TRY_LINK([
    295         ],[
    296         ],[
    297         have_high_entropy_va=yes
    298         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--high-entropy-va"
    299         ])
    300         LDFLAGS="$save_LDFLAGS"
    301         ;;
    302 esac
    303 AC_MSG_RESULT($have_high_entropy_va)
    304 
    305 dnl See whether we are allowed to use the system C library
    306 AC_ARG_ENABLE(libc,
    307 AS_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
    308               , enable_libc=yes)
    309 if test x$enable_libc = xyes; then
    310     AC_DEFINE(HAVE_LIBC, 1, [ ])
    311 
    312     dnl Check for C library headers
    313     AC_HEADER_STDC
    314     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)
    315 
    316     dnl Check for typedefs, structures, etc.
    317     AC_TYPE_SIZE_T
    318 
    319     dnl Check for defines
    320     AC_CHECK_DEFINE(M_PI, math.h)
    321 
    322     dnl Checks for library functions.
    323     case "$host" in
    324     *-*-cygwin* | *-*-mingw32*)
    325         ;;
    326     *)
    327         AC_FUNC_ALLOCA
    328         ;;
    329     esac
    330 
    331     AC_FUNC_MEMCMP
    332     if test x$ac_cv_func_memcmp_working = xyes; then
    333         AC_DEFINE(HAVE_MEMCMP, 1, [ ])
    334     fi
    335     AC_FUNC_STRTOD
    336     if test x$ac_cv_func_strtod = xyes; then
    337         AC_DEFINE(HAVE_STRTOD, 1, [ ])
    338     fi
    339     AC_CHECK_FUNC(mprotect,
    340         AC_TRY_COMPILE([
    341           #include <sys/types.h>
    342           #include <sys/mman.h>
    343         ],[
    344         ],[
    345         AC_DEFINE(HAVE_MPROTECT, 1, [ ])
    346         ]),
    347     )
    348     AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit)
    349 
    350     AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
    351     AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
    352 
    353     AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
    354     AC_CHECK_FUNCS(iconv)
    355 
    356     AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
    357 
    358     dnl Check for additional non-standard headers
    359     AC_CHECK_HEADERS(libunwind.h)
    360 fi
    361 
    362 dnl AC_CHECK_SIZEOF(void*)
    363 
    364 dnl See whether we can use gcc atomic operations on this architecture
    365 AC_ARG_ENABLE(gcc-atomics,
    366 AS_HELP_STRING([--enable-gcc-atomics],
    367                [Use gcc builtin atomics [[default=yes]]]),
    368               , enable_gcc_atomics=yes)
    369 if test x$enable_gcc_atomics = xyes; then
    370     have_gcc_atomics=no
    371     AC_MSG_CHECKING(for GCC builtin atomic operations)
    372     AC_TRY_LINK([
    373     ],[
    374     int a;
    375     void *x, *y, *z;
    376     __sync_lock_test_and_set(&a, 4);
    377     __sync_lock_test_and_set(&x, y);
    378     __sync_fetch_and_add(&a, 1);
    379     __sync_bool_compare_and_swap(&a, 5, 10);
    380     __sync_bool_compare_and_swap(&x, y, z);
    381     ],[
    382     have_gcc_atomics=yes
    383     ])
    384     AC_MSG_RESULT($have_gcc_atomics)
    385 
    386     if test x$have_gcc_atomics = xyes; then
    387         AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
    388     else
    389         # See if we have the minimum operation needed for GCC atomics
    390         AC_TRY_LINK([
    391         ],[
    392         int a;
    393         __sync_lock_test_and_set(&a, 1);
    394         __sync_lock_release(&a);
    395         ],[
    396         have_gcc_sync_lock_test_and_set=yes
    397         ])
    398         if test x$have_gcc_sync_lock_test_and_set = xyes; then
    399             AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
    400         fi
    401     fi
    402 fi
    403 
    404 # Standard C sources
    405 SOURCES="$SOURCES $srcdir/src/*.c"
    406 SOURCES="$SOURCES $srcdir/src/atomic/*.c"
    407 SOURCES="$SOURCES $srcdir/src/audio/*.c"
    408 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
    409 SOURCES="$SOURCES $srcdir/src/dynapi/*.c"
    410 SOURCES="$SOURCES $srcdir/src/events/*.c"
    411 SOURCES="$SOURCES $srcdir/src/file/*.c"
    412 SOURCES="$SOURCES $srcdir/src/haptic/*.c"
    413 SOURCES="$SOURCES $srcdir/src/joystick/*.c"
    414 SOURCES="$SOURCES $srcdir/src/libm/*.c"
    415 SOURCES="$SOURCES $srcdir/src/misc/*.c"
    416 SOURCES="$SOURCES $srcdir/src/power/*.c"
    417 #SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
    418 SOURCES="$SOURCES $srcdir/src/render/*.c"
    419 SOURCES="$SOURCES $srcdir/src/render/*/*.c"
    420 SOURCES="$SOURCES $srcdir/src/sensor/*.c"
    421 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
    422 SOURCES="$SOURCES $srcdir/src/thread/*.c"
    423 SOURCES="$SOURCES $srcdir/src/timer/*.c"
    424 SOURCES="$SOURCES $srcdir/src/video/*.c"
    425 SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
    426 SOURCES="$SOURCES $srcdir/src/locale/*.c"
    427 
    428 dnl Enable/disable various subsystems of the SDL library
    429 
    430 AC_ARG_ENABLE(atomic,
    431 AS_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
    432               , enable_atomic=yes)
    433 if test x$enable_atomic != xyes; then
    434     AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
    435 else
    436     SUMMARY_modules="${SUMMARY_modules} atomic"
    437 fi
    438 AC_ARG_ENABLE(audio,
    439 AS_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
    440               , enable_audio=yes)
    441 if test x$enable_audio != xyes; then
    442     AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
    443 else
    444     SUMMARY_modules="${SUMMARY_modules} audio"
    445 fi
    446 AC_ARG_ENABLE(video,
    447 AS_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
    448               , enable_video=yes)
    449 if test x$enable_video != xyes; then
    450     AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
    451 else
    452     SUMMARY_modules="${SUMMARY_modules} video"
    453 fi
    454 AC_ARG_ENABLE(render,
    455 AS_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
    456               , enable_render=yes)
    457 if test x$enable_render != xyes; then
    458     AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
    459 else
    460     SUMMARY_modules="${SUMMARY_modules} render"
    461 fi
    462 AC_ARG_ENABLE(events,
    463 AS_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
    464               , enable_events=yes)
    465 if test x$enable_events != xyes; then
    466     AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
    467 else
    468     SUMMARY_modules="${SUMMARY_modules} events"
    469 fi
    470 AC_ARG_ENABLE(joystick,
    471 AS_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
    472               , enable_joystick=yes)
    473 if test x$enable_joystick != xyes; then
    474     AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
    475 else
    476     SUMMARY_modules="${SUMMARY_modules} joystick"
    477 fi
    478 AC_ARG_ENABLE(haptic,
    479 AS_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
    480               , enable_haptic=yes)
    481 if test x$enable_haptic != xyes; then
    482     AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
    483 else
    484     SUMMARY_modules="${SUMMARY_modules} haptic"
    485 fi
    486 AC_ARG_ENABLE(sensor,
    487 AS_HELP_STRING([--enable-sensor], [Enable the sensor subsystem [[default=yes]]]),
    488               , enable_sensor=yes)
    489 if test x$enable_sensor != xyes; then
    490     AC_DEFINE(SDL_SENSOR_DISABLED, 1, [ ])
    491 else
    492     SUMMARY_modules="${SUMMARY_modules} sensor"
    493 fi
    494 AC_ARG_ENABLE(power,
    495 AS_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
    496               , enable_power=yes)
    497 if test x$enable_power != xyes; then
    498     AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
    499 else
    500     SUMMARY_modules="${SUMMARY_modules} power"
    501 fi
    502 AC_ARG_ENABLE(filesystem,
    503 AS_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
    504               , enable_filesystem=yes)
    505 if test x$enable_filesystem != xyes; then
    506     AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
    507 else
    508     SUMMARY_modules="${SUMMARY_modules} filesystem"
    509 fi
    510 AC_ARG_ENABLE(threads,
    511 AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
    512               , enable_threads=yes)
    513 if test x$enable_threads != xyes; then
    514     AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
    515 else
    516     SUMMARY_modules="${SUMMARY_modules} threads"
    517 fi
    518 AC_ARG_ENABLE(timers,
    519 AS_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
    520               , enable_timers=yes)
    521 if test x$enable_timers != xyes; then
    522     AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
    523 else
    524     SUMMARY_modules="${SUMMARY_modules} timers"
    525 fi
    526 AC_ARG_ENABLE(file,
    527 AS_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
    528               , enable_file=yes)
    529 if test x$enable_file != xyes; then
    530     AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
    531 else
    532     SUMMARY_modules="${SUMMARY_modules} file"
    533 fi
    534 AC_ARG_ENABLE(loadso,
    535 AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
    536               , enable_loadso=yes)
    537 if test x$enable_loadso != xyes; then
    538     AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
    539 else
    540     SUMMARY_modules="${SUMMARY_modules} loadso"
    541 fi
    542 AC_ARG_ENABLE(cpuinfo,
    543 AS_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
    544               , enable_cpuinfo=yes)
    545 if test x$enable_cpuinfo != xyes; then
    546     AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
    547 else
    548     SUMMARY_modules="${SUMMARY_modules} cpuinfo"
    549 fi
    550 AC_ARG_ENABLE(assembly,
    551 AS_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
    552               , enable_assembly=yes)
    553 if test x$enable_assembly = xyes; then
    554     SUMMARY_modules="${SUMMARY_modules} assembly"
    555 
    556     AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
    557 
    558     # Make sure that we don't generate floating point code that would
    559     # cause illegal instruction exceptions on older processors
    560     case "$host" in
    561         *-*-darwin*)
    562             # Don't need to worry about Apple hardware, it's all SSE capable
    563             default_ssemath=yes
    564             ;;
    565         *64-*-*)
    566             # x86 64-bit architectures all have SSE instructions
    567             default_ssemath=yes
    568             ;;
    569         *)
    570             default_ssemath=no
    571             ;;
    572     esac
    573     AC_ARG_ENABLE(ssemath,
    574 AS_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]),
    575                   , enable_ssemath=$default_ssemath)
    576     if test x$enable_ssemath = xno; then
    577         if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then
    578             EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
    579         fi
    580     fi
    581 
    582     dnl Check for various instruction support
    583     AC_ARG_ENABLE(mmx,
    584 AS_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
    585                   , enable_mmx=yes)
    586     if test x$enable_mmx = xyes; then
    587         save_CFLAGS="$CFLAGS"
    588         have_gcc_mmx=no
    589         AC_MSG_CHECKING(for GCC -mmmx option)
    590         mmx_CFLAGS="-mmmx"
    591         CFLAGS="$save_CFLAGS $mmx_CFLAGS"
    592 
    593         AC_TRY_COMPILE([
    594         #ifdef __MINGW32__
    595         #include <_mingw.h>
    596         #ifdef __MINGW64_VERSION_MAJOR
    597         #include <intrin.h>
    598         #else
    599         #include <mmintrin.h>
    600         #endif
    601         #else
    602         #include <mmintrin.h>
    603         #endif
    604         #ifndef __MMX__
    605         #error Assembler CPP flag not enabled
    606         #endif
    607         ],[
    608         ],[
    609         have_gcc_mmx=yes
    610         ])
    611         AC_MSG_RESULT($have_gcc_mmx)
    612         CFLAGS="$save_CFLAGS"
    613 
    614         if test x$have_gcc_mmx = xyes; then
    615             EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
    616             SUMMARY_math="${SUMMARY_math} mmx"
    617         fi
    618     fi
    619 
    620     AC_ARG_ENABLE(3dnow,
    621 AS_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
    622                   , enable_3dnow=yes)
    623     if test x$enable_3dnow = xyes; then
    624         save_CFLAGS="$CFLAGS"
    625         have_gcc_3dnow=no
    626         AC_MSG_CHECKING(for GCC -m3dnow option)
    627         amd3dnow_CFLAGS="-m3dnow"
    628         CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
    629 
    630         AC_TRY_LINK([
    631         #include <mm3dnow.h>
    632         #ifndef __3dNOW__
    633         #error Assembler CPP flag not enabled
    634         #endif
    635         ],[
    636         void *p = 0;
    637         _m_prefetch(p);
    638         ],[
    639         have_gcc_3dnow=yes
    640         ])
    641         AC_MSG_RESULT($have_gcc_3dnow)
    642         CFLAGS="$save_CFLAGS"
    643 
    644         if test x$have_gcc_3dnow = xyes; then
    645             EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
    646             SUMMARY_math="${SUMMARY_math} 3dnow"
    647         fi
    648     fi
    649 
    650     AC_ARG_ENABLE(sse,
    651 AS_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
    652                   , enable_sse=yes)
    653     if test x$enable_sse = xyes; then
    654         save_CFLAGS="$CFLAGS"
    655         have_gcc_sse=no
    656         AC_MSG_CHECKING(for GCC -msse option)
    657         sse_CFLAGS="-msse"
    658         CFLAGS="$save_CFLAGS $sse_CFLAGS"
    659 
    660         AC_TRY_COMPILE([
    661         #ifdef __MINGW32__
    662         #include <_mingw.h>
    663         #ifdef __MINGW64_VERSION_MAJOR
    664         #include <intrin.h>
    665         #else
    666         #include <xmmintrin.h>
    667         #endif
    668         #else
    669         #include <xmmintrin.h>
    670         #endif
    671         #ifndef __SSE__
    672         #error Assembler CPP flag not enabled
    673         #endif
    674         ],[
    675         ],[
    676         have_gcc_sse=yes
    677         ])
    678         AC_MSG_RESULT($have_gcc_sse)
    679         CFLAGS="$save_CFLAGS"
    680 
    681         if test x$have_gcc_sse = xyes; then
    682             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
    683             SUMMARY_math="${SUMMARY_math} sse"
    684         fi
    685     fi
    686 
    687     AC_ARG_ENABLE(sse2,
    688 AS_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]),
    689                   , enable_sse2=$default_ssemath)
    690     if test x$enable_sse2 = xyes; then
    691         save_CFLAGS="$CFLAGS"
    692         have_gcc_sse2=no
    693         AC_MSG_CHECKING(for GCC -msse2 option)
    694         sse2_CFLAGS="-msse2"
    695         CFLAGS="$save_CFLAGS $sse2_CFLAGS"
    696 
    697         AC_TRY_COMPILE([
    698         #ifdef __MINGW32__
    699         #include <_mingw.h>
    700         #ifdef __MINGW64_VERSION_MAJOR
    701         #include <intrin.h>
    702         #else
    703         #include <emmintrin.h>
    704         #endif
    705         #else
    706         #include <emmintrin.h>
    707         #endif
    708         #ifndef __SSE2__
    709         #error Assembler CPP flag not enabled
    710         #endif
    711         ],[
    712         ],[
    713         have_gcc_sse2=yes
    714         ])
    715         AC_MSG_RESULT($have_gcc_sse2)
    716         CFLAGS="$save_CFLAGS"
    717 
    718         if test x$have_gcc_sse2 = xyes; then
    719             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
    720             SUMMARY_math="${SUMMARY_math} sse2"
    721         fi
    722     fi
    723 
    724     AC_ARG_ENABLE(sse3,
    725 AS_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]),
    726                   , enable_sse3=$default_ssemath)
    727     if test x$enable_sse3 = xyes; then
    728         save_CFLAGS="$CFLAGS"
    729         have_gcc_sse3=no
    730         AC_MSG_CHECKING(for GCC -msse3 option)
    731         sse3_CFLAGS="-msse3"
    732         CFLAGS="$save_CFLAGS $sse3_CFLAGS"
    733 
    734         AC_TRY_COMPILE([
    735         #ifdef __MINGW32__
    736         #include <_mingw.h>
    737         #ifdef __MINGW64_VERSION_MAJOR
    738         #include <intrin.h>
    739         #else
    740         #include <pmmintrin.h>
    741         #endif
    742         #else
    743         #include <pmmintrin.h>
    744         #endif
    745         #ifndef __SSE2__
    746         #error Assembler CPP flag not enabled
    747         #endif
    748         ],[
    749         ],[
    750         have_gcc_sse3=yes
    751         ])
    752         AC_MSG_RESULT($have_gcc_sse3)
    753         CFLAGS="$save_CFLAGS"
    754 
    755         if test x$have_gcc_sse3 = xyes; then
    756             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS"
    757             SUMMARY_math="${SUMMARY_math} sse3"
    758         fi
    759     fi
    760 
    761     AC_CHECK_HEADER(immintrin.h,
    762                     have_immintrin_h_hdr=yes,
    763                     have_immintrin_h_hdr=no)
    764     if test x$have_immintrin_h_hdr = xyes; then
    765         AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ])
    766     fi
    767 
    768     AC_ARG_ENABLE(altivec,
    769 AS_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
    770                   , enable_altivec=yes)
    771     if test x$enable_altivec = xyes; then
    772         save_CFLAGS="$CFLAGS"
    773         have_gcc_altivec=no
    774         have_altivec_h_hdr=no
    775         altivec_CFLAGS="-maltivec"
    776         CFLAGS="$save_CFLAGS $altivec_CFLAGS"
    777 
    778         AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
    779         AC_TRY_COMPILE([
    780         #include <altivec.h>
    781         vector unsigned int vzero() {
    782             return vec_splat_u32(0);
    783         }
    784         ],[
    785         ],[
    786         have_gcc_altivec=yes
    787         have_altivec_h_hdr=yes
    788         ])
    789         AC_MSG_RESULT($have_gcc_altivec)
    790 
    791         if test x$have_gcc_altivec = xno; then
    792             AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
    793             AC_TRY_COMPILE([
    794             vector unsigned int vzero() {
    795                 return vec_splat_u32(0);
    796             }
    797             ],[
    798             ],[
    799             have_gcc_altivec=yes
    800             ])
    801             AC_MSG_RESULT($have_gcc_altivec)
    802         fi
    803 
    804         if test x$have_gcc_altivec = xno; then
    805             AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
    806             altivec_CFLAGS="-faltivec"
    807             CFLAGS="$save_CFLAGS $altivec_CFLAGS"
    808             AC_TRY_COMPILE([
    809             #include <altivec.h>
    810             vector unsigned int vzero() {
    811                 return vec_splat_u32(0);
    812             }
    813             ],[
    814             ],[
    815             have_gcc_altivec=yes
    816             have_altivec_h_hdr=yes
    817             ])
    818             AC_MSG_RESULT($have_gcc_altivec)
    819         fi
    820 
    821         if test x$have_gcc_altivec = xno; then
    822             AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
    823             AC_TRY_COMPILE([
    824             vector unsigned int vzero() {
    825                 return vec_splat_u32(0);
    826             }
    827             ],[
    828             ],[
    829             have_gcc_altivec=yes
    830             ])
    831             AC_MSG_RESULT($have_gcc_altivec)
    832         fi
    833         CFLAGS="$save_CFLAGS"
    834 
    835         if test x$have_gcc_altivec = xyes; then
    836             AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
    837             if test x$have_altivec_h_hdr = xyes; then
    838               AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
    839             fi
    840             EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
    841             SUMMARY_math="${SUMMARY_math} altivec"
    842         fi
    843     fi
    844 fi
    845 
    846 dnl See if the OSS audio interface is supported
    847 CheckOSS()
    848 {
    849     AC_ARG_ENABLE(oss,
    850 AS_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
    851                   , enable_oss=maybe)
    852 
    853     # OpenBSD "has" OSS, but it's not really for app use. They want you to
    854     #  use sndio instead. So on there, we default to disabled. You can force
    855     #  it on if you really want, though.
    856     if test x$enable_oss = xmaybe; then
    857         enable_oss=yes
    858         case "$host" in
    859             *-*-openbsd*)
    860                 enable_oss=no;;
    861         esac
    862     fi
    863 
    864     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
    865         AC_MSG_CHECKING(for OSS audio support)
    866         have_oss=no
    867         if test x$have_oss != xyes; then
    868             AC_TRY_COMPILE([
    869               #include <sys/soundcard.h>
    870             ],[
    871               int arg = SNDCTL_DSP_SETFRAGMENT;
    872             ],[
    873             have_oss=yes
    874             ])
    875         fi
    876         if test x$have_oss != xyes; then
    877             AC_TRY_COMPILE([
    878               #include <soundcard.h>
    879             ],[
    880               int arg = SNDCTL_DSP_SETFRAGMENT;
    881             ],[
    882             have_oss=yes
    883             AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
    884             ])
    885         fi
    886         AC_MSG_RESULT($have_oss)
    887         if test x$have_oss = xyes; then
    888             SUMMARY_audio="${SUMMARY_audio} oss"
    889             AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
    890             SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
    891             have_audio=yes
    892 
    893             # We may need to link with ossaudio emulation library
    894             case "$host" in
    895                 *-*-openbsd*|*-*-netbsd*)
    896                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
    897             esac
    898         fi
    899     fi
    900 }
    901 
    902 dnl See if the ALSA audio interface is supported
    903 CheckALSA()
    904 {
    905     AC_ARG_ENABLE(alsa,
    906 AS_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
    907                   , enable_alsa=yes)
    908     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
    909         AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no)
    910         # Restore all flags from before the ALSA detection runs
    911         CFLAGS="$alsa_save_CFLAGS"
    912         LDFLAGS="$alsa_save_LDFLAGS"
    913         LIBS="$alsa_save_LIBS"
    914         if test x$have_alsa = xyes; then
    915             AC_ARG_ENABLE(alsa-shared,
    916 AS_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
    917                           , enable_alsa_shared=yes)
    918             alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    919 
    920             AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
    921             SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
    922             EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
    923             if test x$have_loadso != xyes && \
    924                test x$enable_alsa_shared = xyes; then
    925                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
    926             fi
    927             if test x$have_loadso = xyes && \
    928                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
    929                 echo "-- dynamic libasound -> $alsa_lib"
    930                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
    931                 SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)"
    932             else
    933                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
    934                 SUMMARY_audio="${SUMMARY_audio} alsa"
    935             fi
    936             have_audio=yes
    937         fi
    938     fi
    939 }
    940 
    941 dnl Find JACK Audio
    942 CheckJACK()
    943 {
    944     AC_ARG_ENABLE(jack,
    945 AS_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]),
    946                   , enable_jack=yes)
    947     if test x$enable_audio = xyes -a x$enable_jack = xyes; then
    948         PKG_CHECK_MODULES([JACK], [jack >= 0.125], audio_jack=yes, audio_jack=no)
    949 
    950         if test x$audio_jack = xyes; then
    951             AC_ARG_ENABLE(jack-shared,
    952 AS_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]),
    953                           , enable_jack_shared=yes)
    954             jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    955 
    956             AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ])
    957             SOURCES="$SOURCES $srcdir/src/audio/jack/*.c"
    958             EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS"
    959             if test x$have_loadso != xyes && \
    960                test x$enable_jack_shared = xyes; then
    961                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading])
    962             fi
    963             if test x$have_loadso = xyes && \
    964                test x$enable_jack_shared = xyes && test x$jack_lib != x; then
    965                 echo "-- dynamic libjack -> $jack_lib"
    966                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ])
    967                 SUMMARY_audio="${SUMMARY_audio} jack(dynamic)"
    968 
    969                 case "$host" in
    970                     # On Solaris, jack must be linked deferred explicitly
    971                     # to prevent undefined symbol failures.
    972                     *-*-solaris*)
    973                         JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'`
    974                         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred"
    975                 esac
    976             else
    977                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS"
    978                 SUMMARY_audio="${SUMMARY_audio} jack"
    979             fi
    980             have_audio=yes
    981         fi
    982     fi
    983 }
    984 
    985 dnl Find the ESD includes and libraries
    986 CheckESD()
    987 {
    988     AC_ARG_ENABLE(esd,
    989 AS_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
    990                   , enable_esd=yes)
    991     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
    992         AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
    993         if test x$have_esd = xyes; then
    994             AC_ARG_ENABLE(esd-shared,
    995 AS_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
    996                           , enable_esd_shared=yes)
    997             esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
    998 
    999             AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
   1000             SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
   1001             EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
   1002             if test x$have_loadso != xyes && \
   1003                test x$enable_esd_shared = xyes; then
   1004                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
   1005             fi
   1006             if test x$have_loadso = xyes && \
   1007                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   1008                 echo "-- dynamic libesd -> $esd_lib"
   1009                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
   1010                 SUMMARY_audio="${SUMMARY_audio} esd(dynamic)"
   1011             else
   1012                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
   1013                 SUMMARY_audio="${SUMMARY_audio} esd"
   1014             fi
   1015             have_audio=yes
   1016         fi
   1017     fi
   1018 }
   1019 
   1020 dnl Find PulseAudio
   1021 CheckPulseAudio()
   1022 {
   1023     AC_ARG_ENABLE(pulseaudio,
   1024 AS_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
   1025                   , enable_pulseaudio=yes)
   1026     if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
   1027         PKG_CHECK_MODULES([PULSEAUDIO], [libpulse-simple >= 0.9], audio_pulseaudio=yes, audio_pulseaudio=no)
   1028 
   1029         if test x$audio_pulseaudio = xyes; then
   1030             AC_ARG_ENABLE(pulseaudio-shared,
   1031 AS_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
   1032                           , enable_pulseaudio_shared=yes)
   1033             pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1034 
   1035             AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
   1036             SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
   1037             EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
   1038             if test x$have_loadso != xyes && \
   1039                test x$enable_pulseaudio_shared = xyes; then
   1040                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
   1041             fi
   1042             if test x$have_loadso = xyes && \
   1043                test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
   1044                 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
   1045                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
   1046                 SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)"
   1047 
   1048                 case "$host" in
   1049                     # On Solaris, pulseaudio must be linked deferred explicitly
   1050                     # to prevent undefined symbol failures.
   1051                     *-*-solaris*)
   1052                         PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
   1053                         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
   1054                 esac
   1055             else
   1056                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
   1057                 SUMMARY_audio="${SUMMARY_audio} pulse"
   1058             fi
   1059             have_audio=yes
   1060         fi
   1061     fi
   1062 }
   1063 
   1064 CheckARTSC()
   1065 {
   1066     AC_ARG_ENABLE(arts,
   1067 AS_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
   1068                   , enable_arts=yes)
   1069     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   1070         AC_PATH_PROG(ARTSCONFIG, artsc-config)
   1071         if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
   1072             : # arts isn't installed
   1073         else
   1074             ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   1075             ARTS_LIBS=`$ARTSCONFIG --libs`
   1076             AC_MSG_CHECKING(for aRts development environment)
   1077             audio_arts=no
   1078             save_CFLAGS="$CFLAGS"
   1079             CFLAGS="$CFLAGS $ARTS_CFLAGS"
   1080             AC_TRY_COMPILE([
   1081              #include <artsc.h>
   1082             ],[
   1083              arts_stream_t stream;
   1084             ],[
   1085             audio_arts=yes
   1086             ])
   1087             CFLAGS="$save_CFLAGS"
   1088             AC_MSG_RESULT($audio_arts)
   1089             if test x$audio_arts = xyes; then
   1090                 AC_ARG_ENABLE(arts-shared,
   1091 AS_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
   1092                               , enable_arts_shared=yes)
   1093                 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1094 
   1095                 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
   1096                 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   1097                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
   1098                 if test x$have_loadso != xyes && \
   1099                    test x$enable_arts_shared = xyes; then
   1100                     AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
   1101                 fi
   1102                 if test x$have_loadso = xyes && \
   1103                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   1104                     echo "-- dynamic libartsc -> $arts_lib"
   1105                     AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
   1106                     SUMMARY_audio="${SUMMARY_audio} arts(dynamic)"
   1107                 else
   1108                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
   1109                     SUMMARY_audio="${SUMMARY_audio} arts"
   1110                 fi
   1111                 have_audio=yes
   1112             fi
   1113         fi
   1114     fi
   1115 }
   1116 
   1117 dnl See if the NAS audio interface is supported
   1118 CheckNAS()
   1119 {
   1120     AC_ARG_ENABLE(nas,
   1121 AS_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
   1122                   , enable_nas=yes)
   1123     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   1124         AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
   1125         AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
   1126 
   1127         AC_MSG_CHECKING(for NAS audio support)
   1128         have_nas=no
   1129 
   1130         if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
   1131             have_nas=yes
   1132             NAS_LIBS="-laudio"
   1133 
   1134         elif test -r /usr/X11R6/include/audio/audiolib.h; then
   1135             have_nas=yes
   1136             NAS_CFLAGS="-I/usr/X11R6/include/"
   1137             NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
   1138 
   1139         fi
   1140 
   1141         AC_MSG_RESULT($have_nas)
   1142 
   1143         if test x$have_nas = xyes; then
   1144             AC_ARG_ENABLE(nas-shared,
   1145 AS_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
   1146                           , enable_nas_shared=yes)
   1147             nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1148 
   1149             if test x$have_loadso != xyes && \
   1150                test x$enable_nas_shared = xyes; then
   1151                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
   1152             fi
   1153             if test x$have_loadso = xyes && \
   1154                test x$enable_nas_shared = xyes && test x$nas_lib != x; then
   1155                 echo "-- dynamic libaudio -> $nas_lib"
   1156                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
   1157                 SUMMARY_audio="${SUMMARY_audio} nas(dynamic)"
   1158             else
   1159                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
   1160                 SUMMARY_audio="${SUMMARY_audio} nas"
   1161             fi
   1162 
   1163             AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
   1164             SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
   1165             EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
   1166             have_audio=yes
   1167         fi
   1168     fi
   1169 }
   1170 
   1171 dnl See if the sndio audio interface is supported
   1172 CheckSNDIO()
   1173 {
   1174     AC_ARG_ENABLE(sndio,
   1175 AS_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
   1176                   , enable_sndio=yes)
   1177     if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
   1178         AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
   1179         AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
   1180 
   1181         AC_MSG_CHECKING(for sndio audio support)
   1182         have_sndio=no
   1183 
   1184         if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
   1185             have_sndio=yes
   1186             SNDIO_LIBS="-lsndio"
   1187         fi
   1188 
   1189         AC_MSG_RESULT($have_sndio)
   1190 
   1191         if test x$have_sndio = xyes; then
   1192             AC_ARG_ENABLE(sndio-shared,
   1193 AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
   1194                           , enable_sndio_shared=yes)
   1195             sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1196 
   1197             if test x$have_loadso != xyes && \
   1198                test x$enable_sndio_shared = xyes; then
   1199                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
   1200             fi
   1201             if test x$have_loadso = xyes && \
   1202                test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
   1203                 echo "-- dynamic libsndio -> $sndio_lib"
   1204                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
   1205                 SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)"
   1206             else
   1207                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
   1208                 SUMMARY_audio="${SUMMARY_audio} sndio"
   1209             fi
   1210 
   1211             AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
   1212             SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
   1213             EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
   1214             have_audio=yes
   1215         fi
   1216     fi
   1217 }
   1218 
   1219 dnl Find FusionSound
   1220 CheckFusionSound()
   1221 {
   1222     AC_ARG_ENABLE(fusionsound,
   1223 AS_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
   1224                   , enable_fusionsound=no)
   1225     if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
   1226         PKG_CHECK_MODULES([FUSIONSOUND], [fusionsound >= 1.1.1], fusionsound=yes, fusionsound=no)
   1227 
   1228         if test x$fusionsound = xyes; then
   1229             AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
   1230             SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
   1231             EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
   1232 
   1233             AC_ARG_ENABLE(fusionsound-shared,
   1234 AS_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
   1235                           , enable_fusionsound_shared=yes)
   1236             fusionsound_shared=no
   1237             AC_MSG_CHECKING(for FusionSound dynamic loading support)
   1238             if test x$have_loadso != xyes && \
   1239                test x$enable_fusionsound_shared = xyes; then
   1240                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
   1241             fi
   1242             if test x$have_loadso = xyes && \
   1243                test x$enable_fusionsound_shared = xyes; then
   1244                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
   1245                 fusionsound_shared=yes
   1246                 SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
   1247             else
   1248                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
   1249                 SUMMARY_audio="${SUMMARY_audio} fusionsound"
   1250             fi
   1251             AC_MSG_RESULT($fusionsound_shared)
   1252 
   1253             have_audio=yes
   1254         fi
   1255     fi
   1256 }
   1257 
   1258 dnl rcg07142001 See if the user wants the disk writer audio driver...
   1259 CheckDiskAudio()
   1260 {
   1261     AC_ARG_ENABLE(diskaudio,
   1262 AS_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
   1263                   , enable_diskaudio=yes)
   1264     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
   1265         AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
   1266         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
   1267         SUMMARY_audio="${SUMMARY_audio} disk"
   1268     fi
   1269 }
   1270 
   1271 dnl rcg03142006 See if the user wants the dummy audio driver...
   1272 CheckDummyAudio()
   1273 {
   1274     AC_ARG_ENABLE(dummyaudio,
   1275 AS_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
   1276                   , enable_dummyaudio=yes)
   1277     if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
   1278         AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
   1279         SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
   1280         SUMMARY_audio="${SUMMARY_audio} dummy"
   1281     fi
   1282 }
   1283 
   1284 dnl See if libsamplerate is available
   1285 CheckLibSampleRate()
   1286 {
   1287     AC_ARG_ENABLE(libsamplerate,
   1288 AS_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]),
   1289                   , enable_libsamplerate=yes)
   1290     if test x$enable_libsamplerate = xyes; then
   1291         AC_CHECK_HEADER(samplerate.h,
   1292                         have_samplerate_h_hdr=yes,
   1293                         have_samplerate_h_hdr=no)
   1294         if test x$have_samplerate_h_hdr = xyes; then
   1295             AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ])
   1296 
   1297             AC_ARG_ENABLE(libsamplerate-shared,
   1298 AS_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]),
   1299                           , enable_libsamplerate_shared=yes)
   1300 
   1301             samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
   1302 
   1303             if test x$have_loadso != xyes && \
   1304                test x$enable_libsamplerate_shared = xyes; then
   1305                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading])
   1306             fi
   1307             if test x$have_loadso = xyes && \
   1308                test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then
   1309                 echo "-- dynamic libsamplerate -> $samplerate_lib"
   1310                 AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ])
   1311             else
   1312                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate"
   1313             fi
   1314         fi
   1315     fi
   1316 }
   1317 
   1318 dnl Check for ARM instruction support using gas syntax
   1319 CheckARM()
   1320 {
   1321     AC_ARG_ENABLE(arm-simd,
   1322 AS_HELP_STRING([--enable-arm-simd], [use SIMD assembly blitters on ARM [[default=no]]]),
   1323                   enable_arm_simd=$enableval, enable_arm_simd=no)
   1324     if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_simd = xyes; then
   1325         save_CFLAGS="$CFLAGS"
   1326         have_arm_simd=no
   1327         CFLAGS="-x assembler-with-cpp $CFLAGS"
   1328 
   1329         AC_MSG_CHECKING(for ARM SIMD)
   1330         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
   1331         .text
   1332         .arch armv6
   1333         .object_arch armv4
   1334         .arm
   1335         .altmacro
   1336         #ifndef __ARM_EABI__
   1337         #error EABI is required (to be sure that calling conventions are compatible)
   1338         #endif
   1339         pld [r0]
   1340         uqadd8 r0, r0, r0
   1341         ]])], have_arm_simd=yes)
   1342         AC_MSG_RESULT($have_arm_simd)
   1343 
   1344         CFLAGS="$save_CFLAGS"
   1345 
   1346         if test x$have_arm_simd = xyes; then
   1347             AC_DEFINE(SDL_ARM_SIMD_BLITTERS, 1, [ ])
   1348             SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.S"
   1349             WARN_ABOUT_ARM_SIMD_ASM_MIT="yes"
   1350         fi
   1351     fi
   1352 }
   1353 
   1354 dnl Check for ARM NEON instruction support using gas syntax
   1355 CheckNEON()
   1356 {
   1357     AC_ARG_ENABLE(arm-neon,
   1358 AS_HELP_STRING([--enable-arm-neon], [use NEON assembly blitters on ARM [[default=no]]]),
   1359                   enable_arm_neon=$enableval, enable_arm_neon=no)
   1360     if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_neon = xyes; then
   1361         save_CFLAGS="$CFLAGS"
   1362         have_arm_neon=no
   1363         CFLAGS="-x assembler-with-cpp $CFLAGS"
   1364 
   1365         AC_MSG_CHECKING(for ARM NEON)
   1366         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
   1367         .text
   1368         .fpu neon
   1369         .arch armv7a
   1370         .object_arch armv4
   1371         .eabi_attribute 10, 0
   1372         .arm
   1373         .altmacro
   1374         #ifndef __ARM_EABI__
   1375         #error EABI is required (to be sure that calling conventions are compatible)
   1376         #endif
   1377         pld [r0]
   1378         vmovn.u16 d0, q0
   1379         ]])], have_arm_neon=yes)
   1380         AC_MSG_RESULT($have_arm_neon)
   1381         CFLAGS="$save_CFLAGS"
   1382 
   1383         if test x$have_arm_neon = xyes; then
   1384             AC_DEFINE(SDL_ARM_NEON_BLITTERS, 1, [ ])
   1385             SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.S"
   1386             WARN_ABOUT_ARM_NEON_ASM_MIT="yes"
   1387         fi
   1388     fi
   1389 }
   1390 
   1391 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
   1392 dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
   1393 CheckVisibilityHidden()
   1394 {
   1395     AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
   1396     have_gcc_fvisibility=no
   1397 
   1398     visibility_CFLAGS="-fvisibility=hidden"
   1399     save_CFLAGS="$CFLAGS"
   1400     CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
   1401     AC_TRY_COMPILE([
   1402     #if !defined(__GNUC__) || __GNUC__ < 4
   1403     #error SDL only uses visibility attributes in GCC 4 or newer
   1404     #endif
   1405     ],[
   1406     ],[
   1407     have_gcc_fvisibility=yes
   1408     ])
   1409     AC_MSG_RESULT($have_gcc_fvisibility)
   1410     CFLAGS="$save_CFLAGS"
   1411 
   1412     if test x$have_gcc_fvisibility = xyes; then
   1413         EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
   1414     fi
   1415 }
   1416 
   1417 dnl See if GCC's -fno-strict-aliasingis supported.
   1418 dnl  Reference: https://bugzilla.libsdl.org/show_bug.cgi?id=4254
   1419 CheckNoStrictAliasing()
   1420 {
   1421     AC_MSG_CHECKING(for GCC -fno-strict-aliasing option)
   1422     have_gcc_no_strict_aliasing=no
   1423 
   1424     save_CFLAGS="$CFLAGS"
   1425     CFLAGS="$save_CFLAGS -fno-strict-aliasing"
   1426     AC_TRY_COMPILE([
   1427     int x = 0;
   1428     ],[
   1429     ],[
   1430     have_gcc_no_strict_aliasing=yes
   1431     ])
   1432     AC_MSG_RESULT($have_gcc_no_strict_aliasing)
   1433     CFLAGS="$save_CFLAGS"
   1434 
   1435     if test x$have_gcc_no_strict_aliasing = xyes; then
   1436         EXTRA_CFLAGS="$EXTRA_CFLAGS -fno-strict-aliasing"
   1437     fi
   1438 }
   1439 
   1440 dnl See if GCC's -mpreferred-stack-boundary is supported.
   1441 dnl  Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
   1442 CheckStackBoundary()
   1443 {
   1444     AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
   1445     have_gcc_preferred_stack_boundary=no
   1446 
   1447     save_CFLAGS="$CFLAGS"
   1448     CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
   1449     AC_TRY_COMPILE([
   1450     int x = 0;
   1451     ],[
   1452     ],[
   1453     have_gcc_preferred_stack_boundary=yes
   1454     ])
   1455     AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
   1456     CFLAGS="$save_CFLAGS"
   1457 
   1458     if test x$have_gcc_preferred_stack_boundary = xyes; then
   1459         EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
   1460     fi
   1461 }
   1462 
   1463 dnl See if GCC's -Wdeclaration-after-statement is supported.
   1464 dnl  This lets us catch things that would fail on a C89 compiler when using
   1465 dnl  a modern GCC.
   1466 CheckDeclarationAfterStatement()
   1467 {
   1468     AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option)
   1469     have_gcc_declaration_after_statement=no
   1470 
   1471     save_CFLAGS="$CFLAGS"
   1472     CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
   1473     AC_TRY_COMPILE([
   1474     int x = 0;
   1475     ],[
   1476     ],[
   1477     have_gcc_declaration_after_statement=yes
   1478     ])
   1479     AC_MSG_RESULT($have_gcc_declaration_after_statement)
   1480     CFLAGS="$save_CFLAGS"
   1481 
   1482     if test x$have_gcc_declaration_after_statement = xyes; then
   1483         EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
   1484     fi
   1485 }
   1486 
   1487 dnl See if GCC's -Wall is supported.
   1488 CheckWarnAll()
   1489 {
   1490     AC_MSG_CHECKING(for GCC -Wall option)
   1491     have_gcc_Wall=no
   1492 
   1493     save_CFLAGS="$CFLAGS"
   1494     CFLAGS="$save_CFLAGS -Wall"
   1495     AC_TRY_COMPILE([
   1496     int x = 0;
   1497     ],[
   1498     ],[
   1499     have_gcc_Wall=yes
   1500     ])
   1501     AC_MSG_RESULT($have_gcc_Wall)
   1502     CFLAGS="$save_CFLAGS"
   1503 
   1504     if test x$have_gcc_Wall = xyes; then
   1505         EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
   1506 
   1507         dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
   1508         AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
   1509         need_gcc_Wno_multichar=no
   1510         case "$host" in
   1511             *-*-haiku*)
   1512                 need_gcc_Wno_multichar=yes
   1513                 ;;
   1514         esac
   1515         AC_MSG_RESULT($need_gcc_Wno_multichar)
   1516         if test x$need_gcc_Wno_multichar = xyes; then
   1517             EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
   1518         fi
   1519     fi
   1520 }
   1521 
   1522 dnl Check for Wayland
   1523 CheckWayland()
   1524 {
   1525     AC_ARG_ENABLE(video-wayland,
   1526 AS_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]),
   1527                   ,enable_video_wayland=yes)
   1528 
   1529     AC_ARG_ENABLE(video-wayland-qt-touch,
   1530 AS_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]),
   1531                   ,enable_video_wayland_qt_touch=yes)
   1532 
   1533     if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
   1534         AC_MSG_CHECKING(for Wayland support)
   1535         video_wayland=no
   1536         if  test x$video_opengl_egl = xyes && \
   1537             test x$video_opengles_v2 = xyes; then
   1538             if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl xkbcommon ; then
   1539                 WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
   1540                 WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
   1541                 WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
   1542                 video_wayland=yes
   1543             fi
   1544         fi
   1545         AC_MSG_RESULT($video_wayland)
   1546 
   1547         if test x$video_wayland = xyes; then
   1548             AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
   1549             if test x$enable_video_wayland_qt_touch = xyes; then
   1550                 AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
   1551             fi
   1552 
   1553             WAYLAND_SOURCES="$srcdir/src/video/wayland/*.c"
   1554             SOURCES="$SOURCES $WAYLAND_SOURCES"
   1555             EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
   1556             AC_ARG_ENABLE(wayland-shared,
   1557 AS_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
   1558                           , enable_wayland_shared=maybe)
   1559 
   1560             dnl FIXME: Do BSD and OS X need special cases?
   1561             case "$host" in
   1562                 *)
   1563                     wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1564                     wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1565                     if test x$wayland_egl_lib = x; then
   1566                         dnl This works in Ubuntu 13.10, maybe others
   1567                         wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1568                     fi
   1569                     wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1570                     xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1571                     ;;
   1572             esac
   1573 
   1574             if test x$enable_wayland_shared = xmaybe; then
   1575                 enable_wayland_shared=yes
   1576             fi
   1577             if test x$have_loadso != xyes && \
   1578                test x$enable_wayland_shared = xyes; then
   1579                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Wayland loading])
   1580                 enable_wayland_shared=no
   1581             fi
   1582             if test x$have_loadso = xyes && \
   1583                test x$enable_wayland_shared = xyes && \
   1584                test x$wayland_client_lib != x && \
   1585                test x$wayland_egl_lib != x && \
   1586                test x$wayland_cursor_lib != x && \
   1587                test x$xkbcommon_lib != x; then
   1588                 echo "-- dynamic libwayland-client -> $wayland_client_lib"
   1589                 echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
   1590                 echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
   1591                 echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
   1592                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
   1593                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
   1594                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
   1595                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
   1596                 SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
   1597             else
   1598                 enable_wayland_shared=no
   1599                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
   1600                 SUMMARY_video="${SUMMARY_video} wayland"
   1601             fi
   1602             have_video=yes
   1603         fi
   1604     fi
   1605 }
   1606 
   1607 dnl Check for Native Client stuff
   1608 CheckNativeClient()
   1609 {
   1610         AC_TRY_COMPILE([
   1611           #if !defined(__native_client__)
   1612           #error "NO NACL"
   1613           #endif
   1614         ],[
   1615         ],[
   1616         AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ])
   1617         AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ])
   1618         AC_DEFINE(HAVE_POW, 1, [ ])
   1619         AC_DEFINE(HAVE_OPENGLES2, 1, [ ])
   1620         AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
   1621         AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
   1622 
   1623         SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS"
   1624 
   1625         SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
   1626         SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
   1627         SUMMARY_audio="${SUMMARY_audio} nacl"
   1628         SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
   1629         SUMMARY_video="${SUMMARY_video} nacl opengles2"
   1630         ])
   1631 }
   1632 
   1633 CheckRPI()
   1634 {
   1635     AC_ARG_ENABLE(video-rpi,
   1636 AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
   1637                   , enable_video_rpi=yes)
   1638     if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
   1639         PKG_CHECK_MODULES([RPI], [bcm_host brcmegl], video_rpi=yes, video_rpi=no)
   1640 
   1641         if test x$video_rpi = xno; then
   1642             if test x$ARCH = xnetbsd; then
   1643                 RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
   1644                 RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
   1645             else
   1646                 RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
   1647                 RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
   1648             fi
   1649         fi
   1650 
   1651         # Save the original compiler flags and libraries
   1652         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
   1653 
   1654         # Add the Raspberry Pi compiler flags and libraries
   1655         CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS"
   1656 
   1657         AC_MSG_CHECKING(for Raspberry Pi)
   1658         have_video_rpi=no
   1659         AC_TRY_LINK([
   1660           #include <bcm_host.h>
   1661         ],[
   1662           bcm_host_init();
   1663         ],[
   1664         have_video_rpi=yes
   1665         ],[
   1666         ])
   1667         AC_MSG_RESULT($have_video_rpi)
   1668 
   1669         # Restore the compiler flags and libraries
   1670         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
   1671 
   1672         if test x$have_video_rpi = xyes; then
   1673             CFLAGS="$CFLAGS $RPI_CFLAGS"
   1674             SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
   1675             EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
   1676             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
   1677             SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
   1678             AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
   1679             SUMMARY_video="${SUMMARY_video} rpi"
   1680         fi
   1681     fi
   1682 }
   1683 
   1684 dnl Find the X11 include and library directories
   1685 CheckX11()
   1686 {
   1687     AC_ARG_ENABLE(video-x11,
   1688 AS_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
   1689                   , enable_video_x11=yes)
   1690     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
   1691         case "$host" in
   1692             *-*-darwin*)
   1693                 # This isn't necessary for X11, but fixes GLX detection
   1694                 if test "x$x_includes" = xNONE && \
   1695                    test "x$x_libraries" = xNONE && \
   1696                    test -d /opt/X11/include && \
   1697                    test -d /opt/X11/lib; then
   1698                     x_includes="/opt/X11/include"
   1699                     x_libraries="/opt/X11/lib"
   1700                 fi
   1701                 ;;
   1702         esac
   1703         AC_PATH_X
   1704         AC_PATH_XTRA
   1705         if test x$have_x = xyes; then
   1706             AC_ARG_ENABLE(x11-shared,
   1707 AS_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
   1708                           , enable_x11_shared=maybe)
   1709 
   1710             case "$host" in
   1711                 *-*-darwin*)
   1712                     # Apple now puts this in /opt/X11
   1713                     x11_lib='/opt/X11/lib/libX11.6.dylib'
   1714                     x11ext_lib='/opt/X11/lib/libXext.6.dylib'
   1715                     xcursor_lib='/opt/X11/lib/libXcursor.1.dylib'
   1716                     xinerama_lib='/opt/X11/lib/libXinerama.1.dylib'
   1717                     xinput_lib='/opt/X11/lib/libXi.6.dylib'
   1718                     xrandr_lib='/opt/X11/lib/libXrandr.2.dylib'
   1719                     xrender_lib='/opt/X11/lib/libXrender.1.dylib'
   1720                     xss_lib='/opt/X11/lib/libXss.1.dylib'
   1721                     xvidmode_lib='/opt/X11/lib/libXxf86vm.1.dylib'
   1722                     ;;
   1723                 *-*-openbsd*)
   1724                     x11_lib='libX11.so'
   1725                     x11ext_lib='libXext.so'
   1726                     xcursor_lib='libXcursor.so'
   1727                     xinerama_lib='libXinerama.so'
   1728                     xinput_lib='libXi.so'
   1729                     xrandr_lib='libXrandr.so'
   1730                     xrender_lib='libXrender.so'
   1731                     xss_lib='libXss.so'
   1732                     xvidmode_lib='libXxf86vm.so'
   1733                     ;;
   1734                 *)
   1735                     x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1736                     x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1737                     xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1738                     xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1739                     xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1740                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1741                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1742                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1743                     xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
   1744                     ;;
   1745             esac
   1746 
   1747             if test x$ac_cv_func_shmat != xyes; then
   1748                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
   1749             fi
   1750             CFLAGS="$CFLAGS $X_CFLAGS"
   1751             LDFLAGS="$LDFLAGS $X_LIBS"
   1752 
   1753             AC_CHECK_HEADER(X11/extensions/Xext.h,
   1754                             have_xext_h_hdr=yes,
   1755                             have_xext_h_hdr=no,
   1756                             [#include <X11/Xlib.h>
   1757                              #include <X11/Xproto.h>
   1758                             ])
   1759             if test x$have_xext_h_hdr != xyes; then
   1760                AC_MSG_ERROR([
   1761 *** Missing Xext.h, maybe you need to install the libxext-dev package?
   1762                ])
   1763             fi
   1764 
   1765             AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
   1766             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
   1767             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
   1768 
   1769             # Needed so SDL applications can include SDL_syswm.h
   1770             SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
   1771 
   1772             if test x$enable_x11_shared = xmaybe; then
   1773                 enable_x11_shared=yes
   1774             fi
   1775             if test x$have_loadso != xyes && \
   1776                test x$enable_x11_shared = xyes; then
   1777                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
   1778                 enable_x11_shared=no
   1779             fi
   1780             if test x$have_loadso = xyes && \
   1781                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
   1782                 echo "-- dynamic libX11 -> $x11_lib"
   1783                 echo "-- dynamic libX11ext -> $x11ext_lib"
   1784                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
   1785                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
   1786                 SUMMARY_video="${SUMMARY_video} x11(dynamic)"
   1787             else
   1788                 enable_x11_shared=no
   1789                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
   1790                 SUMMARY_video="${SUMMARY_video} x11"
   1791             fi
   1792             have_video=yes
   1793 
   1794             AC_MSG_CHECKING(for const parameter to XextAddDisplay)
   1795             have_const_param_XextAddDisplay=no
   1796             AC_TRY_COMPILE([
   1797               #include <X11/Xlib.h>
   1798               #include <X11/Xproto.h>
   1799               #include <X11/extensions/Xext.h>
   1800               #include <X11/extensions/extutil.h>
   1801               extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
   1802             ],[
   1803             ],[
   1804             have_const_param_XextAddDisplay=yes
   1805             AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ])
   1806             ])
   1807             AC_MSG_RESULT($have_const_param_XextAddDisplay)
   1808 
   1809             dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
   1810             AC_MSG_CHECKING([for XGenericEvent])
   1811             have_XGenericEvent=no
   1812             AC_TRY_COMPILE([
   1813                 #include <X11/Xlib.h>
   1814             ],[
   1815 Display *display;
   1816 XEvent event;
   1817 XGenericEventCookie *cookie = &event.xcookie;
   1818 XNextEvent(display, &event);
   1819 XGetEventData(display, cookie);
   1820 XFreeEventData(display, cookie);
   1821             ],[
   1822                 have_XGenericEvent=yes
   1823                 AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ])
   1824             ])
   1825             AC_MSG_RESULT($have_XGenericEvent)
   1826 
   1827             AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
   1828 
   1829             AC_ARG_ENABLE(video-x11-xcursor,
   1830 AS_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
   1831                             , enable_video_x11_xcursor=yes)
   1832             if test x$enable_video_x11_xcursor = xyes; then
   1833                 definitely_enable_video_x11_xcursor=no
   1834                 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
   1835                                 have_xcursor_h_hdr=yes,
   1836                                 have_xcursor_h_hdr=no,
   1837                                 [#include <X11/Xlib.h>
   1838                                 ])
   1839                 if test x$have_xcursor_h_hdr = xyes; then
   1840                     if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
   1841                         echo "-- dynamic libXcursor -> $xcursor_lib"
   1842                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
   1843                         definitely_enable_video_x11_xcursor=yes
   1844                     else
   1845                         AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
   1846                         if test x$have_xcursor_lib = xyes ; then
   1847                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
   1848                             definitely_enable_video_x11_xcursor=yes
   1849                         fi
   1850                     fi
   1851                 fi
   1852             fi
   1853             if test x$definitely_enable_video_x11_xcursor = xyes; then
   1854                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
   1855                 SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
   1856             fi
   1857             AC_ARG_ENABLE(video-x11-xdbe,
   1858 AS_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]),
   1859                             , enable_video_x11_xdbe=yes)
   1860             if test x$enable_video_x11_xdbe = xyes; then
   1861                 AC_CHECK_HEADER(X11/extensions/Xdbe.h,
   1862                                 have_dbe_h_hdr=yes,
   1863                                 have_dbe_h_hdr=no,
   1864                                 [#include <X11/Xlib.h>
   1865                                 ])
   1866                 if test x$have_dbe_h_hdr = xyes; then
   1867                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ])
   1868                     SUMMARY_video_x11="${SUMMARY_video_x11} xdbe"
   1869                 fi
   1870             fi
   1871             AC_ARG_ENABLE(video-x11-xinerama,
   1872 AS_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
   1873                             , enable_video_x11_xinerama=yes)
   1874             if test x$enable_video_x11_xinerama = xyes; then
   1875                 definitely_enable_video_x11_xinerama=no
   1876                 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
   1877                                 have_xinerama_h_hdr=yes,
   1878                                 have_xinerama_h_hdr=no,
   1879                                 [#include <X11/Xlib.h>
   1880                                 ])
   1881                 if test x$have_xinerama_h_hdr = xyes; then
   1882                     if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
   1883                         echo "-- dynamic libXinerama -> $xinerama_lib"
   1884                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
   1885                         definitely_enable_video_x11_xinerama=yes
   1886                     else
   1887                         AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
   1888                         if test x$have_xinerama_lib = xyes ; then
   1889                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
   1890                             definitely_enable_video_x11_xinerama=yes
   1891                         fi
   1892                     fi
   1893                 fi
   1894             fi
   1895             if test x$definitely_enable_video_x11_xinerama = xyes; then
   1896                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
   1897                 SUMMARY_video_x11="${SUMMARY_video_x11} xinerama"
   1898             fi
   1899             AC_ARG_ENABLE(video-x11-xinput,
   1900 AS_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
   1901                             , enable_video_x11_xinput=yes)
   1902             if test x$enable_video_x11_xinput = xyes; then
   1903                 definitely_enable_video_x11_xinput=no
   1904                 AC_CHECK_HEADER(X11/extensions/XInput2.h,
   1905                                 have_xinput_h_hdr=yes,
   1906                                 have_xinput_h_hdr=no,
   1907                                 [#include <X11/Xlib.h>
   1908                                 ])
   1909                 if test x$have_xinput_h_hdr = xyes; then
   1910                     if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
   1911                         echo "-- dynamic libXi -> $xinput_lib"
   1912                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
   1913                         definitely_enable_video_x11_xinput=yes
   1914                     else
   1915                         AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
   1916                         if test x$have_xinput_lib = xyes ; then
   1917                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
   1918                             definitely_enable_video_x11_xinput=yes
   1919                         fi
   1920                     fi
   1921                 fi
   1922             fi
   1923             if test x$definitely_enable_video_x11_xinput = xyes; then
   1924                 SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
   1925                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
   1926                 AC_MSG_CHECKING(for xinput2 multitouch)
   1927                 have_xinput2_multitouch=no
   1928                 AC_TRY_COMPILE([
   1929                     #include <X11/Xlib.h>
   1930                     #include <X11/Xproto.h>
   1931                     #include <X11/extensions/XInput2.h>
   1932                     ],[
   1933 int event_type = XI_TouchBegin;
   1934 XITouchClassInfo *t;
   1935                     ],[
   1936                     have_xinput2_multitouch=yes
   1937                     AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [ ])
   1938                     SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
   1939                     ])
   1940                 AC_MSG_RESULT($have_xinput2_multitouch)
   1941             fi
   1942             AC_ARG_ENABLE(video-x11-xrandr,
   1943 AS_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
   1944                             , enable_video_x11_xrandr=yes)
   1945             if test x$enable_video_x11_xrandr = xyes; then
   1946                 dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
   1947                 definitely_enable_video_x11_xrandr=no
   1948                 have_xrandr_h_hdr=no
   1949                 AC_TRY_COMPILE([
   1950                 #include <X11/Xlib.h>
   1951                 #include <X11/extensions/Xrandr.h>
   1952                 ],[
   1953                 XRRScreenResources *res = NULL;
   1954                 ],[
   1955                 have_xrandr_h_hdr=yes
   1956                 ])
   1957                 if test x$have_xrandr_h_hdr = xyes; then
   1958                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
   1959                         echo "-- dynamic libXrandr -> $xrandr_lib"
   1960                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
   1961                         definitely_enable_video_x11_xrandr=yes
   1962                     else
   1963                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
   1964                         if test x$have_xrandr_lib = xyes ; then
   1965                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
   1966                             definitely_enable_video_x11_xrandr=yes
   1967                         fi
   1968                     fi
   1969                 fi
   1970             fi
   1971             if test x$definitely_enable_video_x11_xrandr = xyes; then
   1972                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
   1973                 SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
   1974             fi
   1975             AC_ARG_ENABLE(video-x11-scrnsaver,
   1976 AS_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
   1977                             , enable_video_x11_scrnsaver=yes)
   1978             if test x$enable_video_x11_scrnsaver = xyes; then
   1979                 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
   1980                                 have_scrnsaver_h_hdr=yes,
   1981                                 have_scrnsaver_h_hdr=no,
   1982                                 [#include <X11/Xlib.h>
   1983                                 ])
   1984                 if test x$have_scrnsaver_h_hdr = xyes; then
   1985                     if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
   1986                         echo "-- dynamic libXss -> $xss_lib"
   1987                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
   1988                         definitely_enable_video_x11_scrnsaver=yes
   1989                     else
   1990                         AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
   1991                         if test x$have_xss_lib = xyes ; then
   1992                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
   1993                             definitely_enable_video_x11_scrnsaver=yes
   1994                         fi
   1995                     fi
   1996                 fi
   1997             fi
   1998             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
   1999                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
   2000                 SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
   2001             fi
   2002             AC_ARG_ENABLE(video-x11-xshape,
   2003 AS_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
   2004                             , enable_video_x11_xshape=yes)
   2005             if test x$enable_video_x11_xshape = xyes; then
   2006                 AC_CHECK_HEADER(X11/extensions/shape.h,
   2007                                 have_shape_h_hdr=yes,
   2008                                 have_shape_h_hdr=no,
   2009                                 [#include <X11/Xlib.h>
   2010                                 ])
   2011                 if test x$have_shape_h_hdr = xyes; then
   2012                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
   2013                     SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
   2014                 fi
   2015             fi
   2016             AC_ARG_ENABLE(video-x11-vm,
   2017 AS_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
   2018                             , enable_video_x11_vm=yes)
   2019             if test x$enable_video_x11_vm = xyes; then
   2020                 definitely_enable_video_x11_vm=no
   2021                 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
   2022                                 have_vm_h_hdr=yes,
   2023                                 have_vm_h_hdr=no,
   2024                                 [#include <X11/Xlib.h>
   2025                                 ])
   2026                 if test x$have_vm_h_hdr = xyes; then
   2027                     if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
   2028                         echo "-- dynamic libXxf86vm -> $xvidmode_lib"
   2029                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
   2030                         definitely_enable_video_x11_vm=yes
   2031                     else
   2032                         AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
   2033                         if test x$have_vm_lib = xyes ; then
   2034                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
   2035                             definitely_enable_video_x11_vm=yes
   2036                         fi
   2037                     fi
   2038                 fi
   2039             fi
   2040             if test x$definitely_enable_video_x11_vm = xyes; then
   2041                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
   2042                 SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
   2043             fi
   2044         fi
   2045     else
   2046         # Prevent Mesa from including X11 headers
   2047         EXTRA_CFLAGS="$EXTRA_CFLAGS -DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11"
   2048     fi
   2049 }
   2050 
   2051 dnl Set up the Vivante video driver if enabled
   2052 CheckVivanteVideo()
   2053 {
   2054     AC_ARG_ENABLE(video-vivante,
   2055 AS_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]),
   2056                   , enable_video_vivante=yes)
   2057     if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then
   2058         AC_MSG_CHECKING(for Vivante VDK API)
   2059         have_vivante_vdk=no
   2060         AC_TRY_COMPILE([
   2061           #define LINUX
   2062           #define EGL_API_FB
   2063           #include <gc_vdk.h>
   2064         ],[
   2065         ],[
   2066         have_vivante_vdk=yes
   2067         ])
   2068         AC_MSG_RESULT($have_vivante_vdk)
   2069 
   2070         AC_MSG_CHECKING(for Vivante FB API)
   2071         have_vivante_egl=no
   2072         AC_TRY_COMPILE([
   2073           #define LINUX
   2074           #define EGL_API_FB
   2075           #include <EGL/eglvivante.h>
   2076         ],[
   2077         ],[
   2078         have_vivante_egl=yes
   2079         ])
   2080         AC_MSG_RESULT($have_vivante_egl)
   2081 
   2082         if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then
   2083             AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ])
   2084             EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
   2085             if test x$have_vivante_vdk = xyes; then
   2086                 AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ])
   2087                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK"
   2088             fi
   2089             SOURCES="$SOURCES $srcdir/src/video/vivante/*.c"
   2090             SUMMARY_video="${SUMMARY_video} vivante"
   2091             have_video=yes
   2092         fi
   2093     fi
   2094 }
   2095 
   2096 dnl Set up the Haiku video driver if enabled
   2097 CheckHaikuVideo()
   2098 {
   2099     if test x$enable_video = xyes; then
   2100         AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
   2101         SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
   2102         have_video=yes
   2103         SUMMARY_video="${SUMMARY_video} haiku"
   2104     fi
   2105 }
   2106 
   2107 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
   2108 CheckCOCOA()
   2109 {
   2110     AC_ARG_ENABLE(video-cocoa,
   2111 AS_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
   2112                   , enable_video_cocoa=yes)
   2113     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
   2114         save_CFLAGS="$CFLAGS"
   2115         dnl Work around that we don't have Objective-C support in autoconf
   2116         CFLAGS="$CFLAGS -x objective-c"
   2117         AC_MSG_CHECKING(for Cocoa framework)
   2118         have_cocoa=no
   2119         AC_TRY_COMPILE([
   2120           #import <Cocoa/Cocoa.h>
   2121         ],[
   2122         ],[
   2123         have_cocoa=yes
   2124         ])
   2125         AC_MSG_RESULT($have_cocoa)
   2126         CFLAGS="$save_CFLAGS"
   2127         if test x$have_cocoa = xyes; then
   2128             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
   2129             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
   2130             SUMMARY_video="${SUMMARY_video} cocoa"
   2131             have_video=yes
   2132         fi
   2133     fi
   2134 }
   2135 
   2136 CheckMETAL()
   2137 {
   2138     AC_ARG_ENABLE(video-metal,
   2139 AS_HELP_STRING([--enable-video-metal], [include Metal support [[default=yes]]]),
   2140               , enable_video_metal=yes)
   2141     AC_ARG_ENABLE(render-metal,
   2142 AS_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]),
   2143                                 , enable_render_metal=yes)
   2144     if test x$enable_video = xyes -a x$enable_video_metal = xyes; then
   2145         save_CFLAGS="$CFLAGS"
   2146         dnl Work around that we don't have Objective-C support in autoconf
   2147         CFLAGS="$CFLAGS -x objective-c"
   2148         AC_MSG_CHECKING(for Metal framework)
   2149         have_metal=no
   2150         AC_TRY_COMPILE([
   2151           #import <Cocoa/Cocoa.h>
   2152           #import <Metal/Metal.h>
   2153           #import <QuartzCore/CAMetalLayer.h>
   2154 
   2155           #if TARGET_CPU_X86
   2156           #error Metal doesn't work on this configuration
   2157           #endif
   2158         ],[
   2159         ],[
   2160         have_metal=yes
   2161         ])
   2162         CFLAGS="$save_CFLAGS"
   2163         AC_MSG_RESULT($have_metal)
   2164         if test x$have_metal = xyes; then
   2165             AC_DEFINE(SDL_VIDEO_METAL, 1, [ ])
   2166             if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
   2167                 AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
   2168                 SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
   2169             fi
   2170             SUMMARY_video="${SUMMARY_video} metal"
   2171         else
   2172             enable_video_metal=no
   2173             enable_render_metal=no
   2174         fi
   2175     fi
   2176 }
   2177 
   2178 dnl Find DirectFB
   2179 CheckDirectFB()
   2180 {
   2181     AC_ARG_ENABLE(video-directfb,
   2182 AS_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
   2183                   , enable_video_directfb=no)
   2184     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
   2185         PKG_CHECK_MODULES([DIRECTFB], [directfb >= 1.0.0], video_directfb=yes, video_directfb=no)
   2186 
   2187         if test x$video_directfb = xyes; then
   2188             # SuSE 11.1 installs directfb-config without directfb-devel
   2189             save_CPPFLAGS="$CPPFLAGS"
   2190             CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
   2191             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
   2192             CPPFLAGS="$save_CPPFLAGS"
   2193             video_directfb=$have_directfb_hdr
   2194         fi
   2195 
   2196         if test x$video_directfb = xyes; then
   2197             AC_ARG_ENABLE(directfb-shared,
   2198 AS_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
   2199                               , enable_directfb_shared=yes)
   2200 
   2201             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
   2202             AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
   2203             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
   2204             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
   2205 
   2206             AC_MSG_CHECKING(for directfb dynamic loading support)
   2207             directfb_shared=no
   2208             directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`]
   2209             # | sed 's/.*\/\(.*\)/\1/; q'`]
   2210 AC_MSG_WARN("directfb $directfb_lib")
   2211             if test x$have_loadso != xyes && \
   2212                test x$enable_directfb_shared = xyes; then
   2213                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
   2214             fi
   2215             if test x$have_loadso = xyes && \
   2216                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
   2217                 directfb_shared=yes
   2218                 echo "-- $directfb_lib_spec -> $directfb_lib"
   2219                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
   2220                 SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
   2221             else
   2222                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
   2223                 SUMMARY_video="${SUMMARY_video} directfb"
   2224             fi
   2225             AC_MSG_RESULT($directfb_shared)
   2226             SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
   2227             have_video=yes
   2228         fi
   2229     fi
   2230 }
   2231 
   2232 dnl Find KMSDRM
   2233 CheckKMSDRM()
   2234 {
   2235     AC_ARG_ENABLE(video-kmsdrm,
   2236 AS_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]),
   2237                   , enable_video_kmsdrm=no)
   2238 
   2239     if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
   2240         video_kmsdrm=no
   2241 
   2242         PKG_CHECK_MODULES([LIBDRM], [libdrm >= 1.4.82], libdrm_avail=yes, libdrm_avail=no)
   2243         PKG_CHECK_MODULES([LIBGBM], [gbm >= 11.1.0], libgbm_avail=yes, libgbm_avail=no)
   2244 
   2245         if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
   2246             video_kmsdrm=yes
   2247         fi
   2248 
   2249         if test x$video_kmsdrm = xyes; then
   2250             AC_ARG_ENABLE(kmsdrm-shared,
   2251 AS_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]),
   2252                 , enable_kmsdrm_shared=yes)
   2253 
   2254             AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
   2255             SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
   2256             SOURCES="$SOURCES $srcdir/src/video/kmsdrm_legacy/*.c"
   2257             EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
   2258 
   2259             AC_MSG_CHECKING(for kmsdrm dynamic loading support)
   2260             kmsdrm_shared=no
   2261             drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
   2262             gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
   2263             if test x$have_loadso != xyes && \
   2264                test x$enable_kmsdrm_shared = xyes; then
   2265                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
   2266             fi
   2267             if test x$have_loadso = xyes && \
   2268                test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
   2269                 kmsdrm_shared=yes
   2270                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
   2271                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
   2272                 AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
   2273                 SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
   2274             else
   2275                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
   2276                 SUMMARY_video="${SUMMARY_video} kmsdrm"
   2277             fi
   2278             AC_MSG_RESULT($kmsdrm_shared)
   2279             have_video=yes
   2280         fi
   2281     fi
   2282 }
   2283 
   2284 dnl rcg04172001 Set up the Null video driver.
   2285 CheckDummyVideo()
   2286 {
   2287     AC_ARG_ENABLE(video-dummy,
   2288 AS_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
   2289                   , enable_video_dummy=yes)
   2290     if test x$enable_video_dummy = xyes; then
   2291         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
   2292         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
   2293         have_video=yes
   2294         SUMMARY_video="${SUMMARY_video} dummy"
   2295     fi
   2296 }
   2297 
   2298 dnl Set up the QNX video driver if enabled
   2299 CheckQNXVideo()
   2300 {
   2301     if test x$enable_video = xyes; then
   2302         AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
   2303         SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
   2304         have_video=yes
   2305         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
   2306         SUMMARY_video="${SUMMARY_video} qnx"
   2307     fi
   2308 }
   2309 
   2310 dnl Set up the QNX audio driver if enabled
   2311 CheckQNXAudio()
   2312 {
   2313     if test x$enable_audio = xyes; then
   2314         AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
   2315         SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
   2316         have_audio=yes
   2317         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
   2318         SUMMARY_audio="${SUMMARY_audio} qsa"
   2319     fi
   2320 }
   2321 
   2322 dnl Check to see if OpenGL support is desired
   2323 AC_ARG_ENABLE(video-opengl,
   2324 AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
   2325               , enable_video_opengl=yes)
   2326 
   2327 dnl Find OpenGL
   2328 CheckOpenGLX11()
   2329 {
   2330     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   2331         AC_MSG_CHECKING(for OpenGL (GLX) support)
   2332         video_opengl=no
   2333         AC_TRY_COMPILE([
   2334          #include <GL/gl.h>
   2335          #include <GL/glx.h>
   2336         ],[
   2337         ],[
   2338         video_opengl=yes
   2339         ])
   2340         AC_MSG_RESULT($video_opengl)
   2341         if test x$video_opengl = xyes; then
   2342             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
   2343             AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
   2344             AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
   2345             SUMMARY_video="${SUMMARY_video} opengl"
   2346         fi
   2347     fi
   2348 }
   2349 
   2350 dnl Check to see if OpenGL ES support is desired
   2351 AC_ARG_ENABLE(video-opengles,
   2352 AS_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
   2353               , enable_video_opengles=yes)
   2354 AC_ARG_ENABLE(video-opengles1,
   2355 AS_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]),
   2356               , enable_video_opengles1=yes)
   2357 AC_ARG_ENABLE(video-opengles2,
   2358 AS_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]),
   2359               , enable_video_opengles2=yes)
   2360 
   2361 dnl Find OpenGL ES
   2362 CheckOpenGLESX11()
   2363 {
   2364     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
   2365         AC_MSG_CHECKING(for EGL support)
   2366         video_opengl_egl=no
   2367         AC_TRY_COMPILE([
   2368           #define LINUX
   2369           #define EGL_API_FB
   2370           #define MESA_EGL_NO_X11_HEADERS
   2371           #define EGL_NO_X11
   2372           #include <EGL/egl.h>
   2373           #include <EGL/eglext.h>
   2374         ],[
   2375         ],[
   2376         video_opengl_egl=yes
   2377         ])
   2378         AC_MSG_RESULT($video_opengl_egl)
   2379         if test x$video_opengl_egl = xyes; then
   2380             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
   2381         fi
   2382 
   2383         if test x$enable_video_opengles1 = xyes; then
   2384             AC_MSG_CHECKING(for OpenGL ES v1 headers)
   2385             video_opengles_v1=no
   2386             AC_TRY_COMPILE([
   2387              #include <GLES/gl.h>
   2388              #include <GLES/glext.h>
   2389             ],[
   2390             ],[
   2391             video_opengles_v1=yes
   2392             ])
   2393             AC_MSG_RESULT($video_opengles_v1)
   2394             if test x$video_opengles_v1 = xyes; then
   2395                 AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
   2396                 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
   2397                 SUMMARY_video="${SUMMARY_video} opengl_es1"
   2398             fi
   2399         fi
   2400 
   2401         if test x$enable_video_opengles2 = xyes; then
   2402             AC_MSG_CHECKING(for OpenGL ES v2 headers)
   2403             video_opengles_v2=no
   2404             AC_TRY_COMPILE([
   2405              #include <GLES2/gl2.h>
   2406              #include <GLES2/gl2ext.h>
   2407             ],[
   2408             ],[
   2409             video_opengles_v2=yes
   2410             ])
   2411             AC_MSG_RESULT($video_opengles_v2)
   2412             if test x$video_opengles_v2 = xyes; then
   2413                 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
   2414                 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
   2415                 SUMMARY_video="${SUMMARY_video} opengl_es2"
   2416             fi
   2417         fi
   2418     fi
   2419 }
   2420 
   2421 dnl Check for Windows OpenGL
   2422 CheckWINDOWSGL()
   2423 {
   2424     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   2425         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
   2426         AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
   2427         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
   2428         SUMMARY_video="${SUMMARY_video} opengl"
   2429     fi
   2430 }
   2431 
   2432 dnl Check for Windows OpenGL
   2433 CheckWINDOWSGLES()
   2434 {
   2435     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
   2436 
   2437         AC_MSG_CHECKING(for EGL support)
   2438         video_opengl_egl=no
   2439         AC_TRY_COMPILE([
   2440          #include <EGL/egl.h>
   2441         ],[
   2442         ],[
   2443         video_opengl_egl=yes
   2444         ])
   2445         AC_MSG_RESULT($video_opengl_egl)
   2446         if test x$video_opengl_egl = xyes; then
   2447             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
   2448             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
   2449             SUMMARY_video="${SUMMARY_video} opengl_es1"
   2450         fi
   2451 
   2452         AC_MSG_CHECKING(for OpenGL ES v2 headers)
   2453         video_opengles_v2=no
   2454         AC_TRY_COMPILE([
   2455          #include <GLES2/gl2.h>
   2456          #include <GLES2/gl2ext.h>
   2457         ],[
   2458         ],[
   2459         video_opengles_v2=yes
   2460         ])
   2461         AC_MSG_RESULT($video_opengles_v2)
   2462         if test x$video_opengles_v2 = xyes; then
   2463             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
   2464             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
   2465             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
   2466             SUMMARY_video="${SUMMARY_video} opengl_es2"
   2467         fi
   2468     fi
   2469 }
   2470 
   2471 dnl Check for Haiku OpenGL
   2472 CheckHaikuGL()
   2473 {
   2474     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   2475         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
   2476         AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
   2477         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
   2478         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
   2479         SUMMARY_video="${SUMMARY_video} opengl"
   2480     fi
   2481 }
   2482 
   2483 dnl Check for MacOS OpenGL
   2484 CheckMacGL()
   2485 {
   2486     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   2487         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
   2488         AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
   2489         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
   2490         SUMMARY_video="${SUMMARY_video} opengl"
   2491     fi
   2492 }
   2493 
   2494 dnl Check for MacOS OpenGLES
   2495 CheckMacGLES()
   2496 {
   2497     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
   2498         video_opengl_egl=yes
   2499         AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
   2500         video_opengles_v2=yes
   2501         AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
   2502         AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
   2503         SUMMARY_video="${SUMMARY_video} opengl_es2"
   2504     fi
   2505 }
   2506 
   2507 CheckEmscriptenGLES()
   2508 {
   2509     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
   2510         AC_MSG_CHECKING(for EGL support)
   2511         video_opengl_egl=no
   2512         AC_TRY_COMPILE([
   2513          #include <EGL/egl.h>
   2514         ],[
   2515         ],[
   2516         video_opengl_egl=yes
   2517         ])
   2518         AC_MSG_RESULT($video_opengl_egl)
   2519         if test x$video_opengl_egl = xyes; then
   2520             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
   2521         fi
   2522 
   2523         AC_MSG_CHECKING(for OpenGL ES v2 headers)
   2524         video_opengles_v2=no
   2525         AC_TRY_COMPILE([
   2526          #include <GLES2/gl2.h>
   2527          #include <GLES2/gl2ext.h>
   2528         ],[
   2529         ],[
   2530         video_opengles_v2=yes
   2531         ])
   2532         AC_MSG_RESULT($video_opengles_v2)
   2533         if test x$video_opengles_v2 = xyes; then
   2534             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
   2535             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
   2536             SUMMARY_video="${SUMMARY_video} opengl_es2"
   2537         fi
   2538     fi
   2539 }
   2540 
   2541 dnl Check to see if Vulkan support is desired
   2542 AC_ARG_ENABLE(video-vulkan,
   2543 AS_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
   2544               , enable_video_vulkan=yes)
   2545 
   2546 dnl Find Vulkan Header
   2547 CheckVulkan()
   2548 {
   2549     if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
   2550         case "$host" in
   2551             *-*-android*)
   2552                 AC_TRY_COMPILE([
   2553                   #if defined(__ARM_ARCH) && __ARM_ARCH < 7
   2554                   #error Vulkan doesn't work on this configuration
   2555                   #endif
   2556                 ],[
   2557                 ],[
   2558                 ],[
   2559                     enable_video_vulkan=no
   2560                 ])
   2561                 ;;
   2562             *-*-darwin*)
   2563                 save_CFLAGS="$CFLAGS"
   2564                 dnl Work around that we don't have Objective-C support in autoconf
   2565                 CFLAGS="$CFLAGS -x objective-c"
   2566                 AC_TRY_COMPILE([
   2567                   #include <Cocoa/Cocoa.h>
   2568                   #include <Metal/Metal.h>
   2569                   #include <QuartzCore/CAMetalLayer.h>
   2570 
   2571                   #if TARGET_CPU_X86
   2572                   #error Vulkan doesn't work on this configuration
   2573                   #endif
   2574                 ],[
   2575                 ],[
   2576                 ],[
   2577                     enable_video_vulkan=no
   2578                 ])
   2579                 CFLAGS="$save_CFLAGS"
   2580                 ;;
   2581             *)
   2582                 ;;
   2583         esac
   2584         if test x$enable_video_vulkan = xno; then
   2585             # For reasons I am totally unable to see, I get an undefined macro error if
   2586             # I put this in the AC_TRY_COMPILE.
   2587             AC_MSG_WARN([Vulkan does not work on this configuration.])
   2588         fi
   2589     fi
   2590     if test x$enable_video_vulkan = xyes; then
   2591         AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
   2592         SUMMARY_video="${SUMMARY_video} vulkan"
   2593     fi
   2594 }
   2595 
   2596 dnl See if we can use the new unified event interface in Linux 2.4
   2597 CheckInputEvents()
   2598 {
   2599     dnl Check for Linux 2.4 unified input event interface support
   2600         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
   2601         use_input_events=no
   2602         AC_TRY_COMPILE([
   2603           #include <linux/input.h>
   2604         ],[
   2605           #ifndef EVIOCGNAME
   2606           #error EVIOCGNAME() ioctl not available
   2607           #endif
   2608         ],[
   2609         use_input_events=yes
   2610         ])
   2611         AC_MSG_RESULT($use_input_events)
   2612         if test x$use_input_events = xyes; then
   2613             AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
   2614             SUMMARY_input="${SUMMARY_input} linuxev"
   2615         fi
   2616 }
   2617 
   2618 dnl See if we can use the kernel kd.h header
   2619 CheckInputKD()
   2620 {
   2621 
   2622     AC_MSG_CHECKING(for Linux kd.h)
   2623     use_input_kd=no
   2624     AC_TRY_COMPILE([
   2625       #include <linux/kd.h>
   2626       #include <linux/keyboard.h>
   2627     ],[
   2628         struct kbentry kbe;
   2629         kbe.kb_table = KG_CTRL;
   2630         ioctl(0, KDGKBENT, &kbe);
   2631     ],[
   2632     use_input_kd=yes
   2633     ])
   2634     AC_MSG_RESULT($use_input_kd)
   2635     if test x$use_input_kd = xyes; then
   2636         AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
   2637         SUMMARY_input="${SUMMARY_input} linuxkd"
   2638     fi
   2639 }
   2640 
   2641 dnl See if we can use the FreeBSD kernel kbio.h header
   2642 CheckInputKBIO()
   2643 {
   2644     AC_MSG_CHECKING(for FreeBSD kbio.h)
   2645     use_input_kbio=no
   2646     AC_TRY_COMPILE([
   2647       #include <sys/kbio.h>
   2648       #include <sys/ioctl.h>
   2649     ],[
   2650     	accentmap_t accTable;
   2651         ioctl(0, KDENABIO, 1);
   2652     ],[
   2653     use_input_kbio=yes
   2654     ])
   2655     AC_MSG_RESULT($use_input_kbio)
   2656     if test x$use_input_kbio = xyes; then
   2657         AC_DEFINE(SDL_INPUT_FBSDKBIO, 1, [ ])
   2658         SUMMARY_input="${SUMMARY_input} fbsdkbio"
   2659     fi
   2660 }
   2661 
   2662 dnl See if the platform offers libudev for device enumeration and hotplugging.
   2663 CheckLibUDev()
   2664 {
   2665     AC_ARG_ENABLE(libudev,
   2666 AS_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
   2667                         , enable_libudev=yes)
   2668     if test x$enable_libudev = xyes; then
   2669         AC_CHECK_HEADER(libudev.h,
   2670                         have_libudev_h_hdr=yes,
   2671                         have_libudev_h_hdr=no)
   2672         if test x$have_libudev_h_hdr = xyes; then
   2673             AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
   2674 
   2675             udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
   2676             if test x$udev_lib != x; then
   2677                 echo "-- dynamic udev -> $udev_lib"
   2678                 AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ])
   2679             fi
   2680         fi
   2681     fi
   2682 }
   2683 
   2684 dnl See if the platform offers libdbus for various IPC techniques.
   2685 CheckDBus()
   2686 {
   2687     AC_ARG_ENABLE(dbus,
   2688 AS_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
   2689                         , enable_dbus=yes)
   2690     if test x$enable_dbus = xyes; then
   2691         PKG_CHECK_MODULES([DBUS], [dbus-1], have_dbus=yes, have_dbus=no)
   2692         save_CFLAGS="$CFLAGS"
   2693         CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
   2694         AC_CHECK_HEADER(dbus/dbus.h,
   2695                         have_dbus_dbus_h_hdr=yes,
   2696                         have_dbus_dbus_h_hdr=no)
   2697         CFLAGS="$save_CFLAGS"
   2698         if test x$have_dbus_dbus_h_hdr = xyes; then
   2699             AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
   2700             EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
   2701             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
   2702         fi
   2703     fi
   2704 }
   2705 
   2706 dnl See if the platform wanna IME support.
   2707 CheckIME()
   2708 {
   2709     AC_ARG_ENABLE(ime,
   2710 AS_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
   2711                   , enable_ime=yes)
   2712     if test x$enable_ime = xyes; then
   2713         AC_DEFINE(SDL_USE_IME, 1, [ ])
   2714         SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
   2715     fi
   2716 }
   2717 
   2718 dnl Check inotify presense
   2719 CheckInotify()
   2720 {
   2721     save_LIBS="$LIBS"
   2722     case "$host" in
   2723      *-*-freebsd*) LIBS="$LIBS -linotify"
   2724       ;;
   2725     esac
   2726     AC_CHECK_HEADERS(sys/inotify.h, [have_inotify_inotify_h_hdr=yes])
   2727     AC_CHECK_FUNCS(inotify_init, [have_inotify=yes])
   2728     AC_CHECK_FUNCS(inotify_init1)
   2729     if test x$have_inotify_inotify_h_hdr = xyes -a x$have_inotify = xyes; then
   2730         AC_DEFINE(HAVE_INOTIFY, 1, [ ])
   2731         case "$host" in
   2732             *-*-freebsd*)
   2733                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -linotify"
   2734                 ;;
   2735         esac
   2736     fi
   2737     LIBS="$save_LIBS"
   2738 }
   2739 
   2740 dnl See if the platform has libibus IME support.
   2741 CheckIBus()
   2742 {
   2743     AC_ARG_ENABLE(ibus,
   2744 AS_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
   2745                   , enable_ibus=yes)
   2746     if test x$enable_ibus = xyes; then
   2747         PKG_CHECK_MODULES([IBUS], [ibus-1.0], have_ibus=yes, have_ibus=no)
   2748         save_CFLAGS="$CFLAGS"
   2749         CFLAGS="$save_CFLAGS $IBUS_CFLAGS"
   2750         AC_CHECK_HEADER(ibus-1.0/ibus.h,
   2751                         have_ibus_ibus_h_hdr=yes,
   2752                         have_ibus_ibus_h_hdr=no)
   2753         CFLAGS="$save_CFLAGS"
   2754         if test x$have_ibus_ibus_h_hdr = xyes; then
   2755             if test x$enable_ime != xyes; then
   2756                 AC_MSG_WARN([IME support is required for IBus.])
   2757                 have_ibus_ibus_h_hdr=no
   2758             elif test x$enable_dbus != xyes; then
   2759                 AC_MSG_WARN([DBus support is required for IBus.])
   2760                 have_ibus_ibus_h_hdr=no
   2761             elif test x$have_inotify_inotify_h_hdr != xyes; then
   2762                 AC_MSG_WARN([INotify support is required for IBus.])
   2763                 have_ibus_ibus_h_hdr=no
   2764             else
   2765                 AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
   2766                 EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
   2767                 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
   2768             fi
   2769         fi
   2770     fi
   2771 }
   2772 
   2773 dnl See if the platform has fcitx IME support.
   2774 CheckFcitx()
   2775 {
   2776     AC_ARG_ENABLE(fcitx,
   2777 AS_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
   2778                   , enable_fcitx=yes)
   2779     if test x$enable_fcitx = xyes; then
   2780         AC_MSG_CHECKING(for fcitx support)
   2781         have_fcitx=no
   2782         if test x$enable_ime != xyes; then
   2783             AC_MSG_WARN([IME support is required for fcitx.])
   2784         elif test x$have_dbus_dbus_h_hdr != xyes; then
   2785             AC_MSG_WARN([DBus support is required for fcitx.])
   2786         else
   2787             have_fcitx=yes
   2788             AC_DEFINE(HAVE_FCITX, 1, [ ])
   2789             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
   2790         fi
   2791         AC_MSG_RESULT($have_fcitx)
   2792     fi
   2793 }
   2794 
   2795 dnl Check to see if GameController framework support is desired
   2796 CheckJoystickMFI()
   2797 {
   2798     AC_ARG_ENABLE(joystick-mfi,
   2799 AS_HELP_STRING([--enable-joystick-mfi], [include macOS MFI joystick support [[default=yes]]]),
   2800               , enable_joystick_mfi=yes)
   2801 
   2802     if test x$enable_joystick_mfi = xyes; then
   2803         save_CFLAGS="$CFLAGS"
   2804         save_LDFLAGS="$LDFLAGS"
   2805         dnl Work around that we don't have Objective-C support in autoconf
   2806         CFLAGS="$CFLAGS -x objective-c -fobjc-weak"
   2807         LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
   2808         AC_MSG_CHECKING(for GameController framework)
   2809         enable_joystick_mfi=no
   2810         AC_TRY_LINK([
   2811           #include <AvailabilityMacros.h>
   2812           #include <TargetConditionals.h>
   2813           #import <GameController/GameController.h>
   2814         ],[
   2815           #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
   2816           #error GameController framework doesn't work on this configuration
   2817           #endif
   2818           #if TARGET_CPU_X86
   2819           #error GameController framework doesn't work on this configuration
   2820           #endif
   2821         ],[
   2822         enable_joystick_mfi=yes
   2823         ])
   2824         CFLAGS="$save_CFLAGS"
   2825         LDFLAGS="$save_LDFLAGS"
   2826 
   2827         AC_MSG_RESULT($enable_joystick_mfi)
   2828         if test x$enable_joystick_mfi = xyes; then
   2829             AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
   2830             EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-weak -Wno-unused-command-line-argument"
   2831             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
   2832         fi
   2833     fi
   2834 }
   2835 
   2836 dnl See what type of thread model to use on Linux and Solaris
   2837 CheckPTHREAD()
   2838 {
   2839     dnl Check for pthread support
   2840     AC_ARG_ENABLE(pthreads,
   2841 AS_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
   2842                   , enable_pthreads=yes)
   2843     dnl This is used on Linux for glibc binary compatibility (Doh!)
   2844     AC_ARG_ENABLE(pthread-sem,
   2845 AS_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
   2846                   , enable_pthread_sem=yes)
   2847     case "$host" in
   2848          *-*-android*)
   2849             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
   2850             pthread_lib=""
   2851             ;;
   2852         *-*-linux*|*-*-uclinux*)
   2853             pthread_cflags="-D_REENTRANT"
   2854             pthread_lib="-lpthread"
   2855             ;;
   2856         *-*-bsdi*)
   2857             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
   2858             pthread_lib=""
   2859             ;;
   2860         *-*-darwin*)
   2861             pthread_cflags="-D_THREAD_SAFE"
   2862 # causes Carbon.p complaints?
   2863 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
   2864             ;;
   2865         *-*-freebsd*|*-*-dragonfly*)
   2866             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
   2867             pthread_lib="-pthread"
   2868             ;;
   2869         *-*-netbsd*)
   2870             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
   2871             pthread_lib="-lpthread"
   2872             ;;
   2873         *-*-openbsd*)
   2874             pthread_cflags="-D_REENTRANT"
   2875             pthread_lib="-pthread"
   2876             ;;
   2877         *-*-solaris2.9)
   2878             # From Solaris 9+, posix4's preferred name is rt.
   2879             pthread_cflags="-D_REENTRANT"
   2880             pthread_lib="-lpthread -lrt"
   2881             ;;
   2882         *-*-solaris2.10)
   2883             # Solaris 10+ merged pthread into libc.
   2884             pthread_cflags="-D_REENTRANT"
   2885             pthread_lib="-lrt"
   2886             ;;
   2887         *-*-solaris*)
   2888             # Solaris 11+ merged rt into libc.
   2889             pthread_cflags="-D_REENTRANT"
   2890             pthread_lib=""
   2891             ;;
   2892         *-*-sysv5*)
   2893             pthread_cflags="-D_REENTRANT -Kthread"
   2894             pthread_lib=""
   2895             ;;
   2896         *-*-aix*)
   2897             pthread_cflags="-D_REENTRANT -mthreads"
   2898             pthread_lib="-lpthread"
   2899             ;;
   2900         *-*-hpux11*)
   2901             pthread_cflags="-D_REENTRANT"
   2902             pthread_lib="-L/usr/lib -lpthread"
   2903             ;;
   2904         *-*-haiku*)
   2905             pthread_cflags="-D_REENTRANT"
   2906             pthread_lib=""
   2907             ;;
   2908         *-*-nto*)
   2909             pthread_cflags="-D_REENTRANT"
   2910             pthread_lib=""
   2911             ;;
   2912         *)
   2913             pthread_cflags="-D_REENTRANT"
   2914             pthread_lib="-lpthread"
   2915             ;;
   2916     esac
   2917     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
   2918         # Save the original compiler flags and libraries
   2919         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
   2920         # Add the pthread compiler flags and libraries
   2921         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
   2922         # Check to see if we have pthread support on this system
   2923         AC_MSG_CHECKING(for pthreads)
   2924         use_pthreads=no
   2925         AC_TRY_LINK([
   2926          #include <pthread.h>
   2927         ],[
   2928          pthread_attr_t type;
   2929          pthread_attr_init(&type);
   2930         ],[
   2931         use_pthreads=yes
   2932         ])
   2933         AC_MSG_RESULT($use_pthreads)
   2934         # Restore the compiler flags and libraries
   2935         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
   2936 
   2937         # Do futher testing if we have pthread support...
   2938         if test x$use_pthreads = xyes; then
   2939             AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
   2940             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
   2941             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
   2942             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
   2943 
   2944             # Save the original compiler flags and libraries
   2945             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
   2946             # Add the pthread compiler flags and libraries
   2947             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
   2948 
   2949             # Check to see if recursive mutexes are available
   2950             AC_MSG_CHECKING(for recursive mutexes)
   2951             has_recursive_mutexes=no
   2952             if test x$has_recursive_mutexes = xno; then
   2953                 AC_TRY_LINK([
   2954                   #define _GNU_SOURCE 1
   2955                   #include <pthread.h>
   2956                 ],[
   2957                   pthread_mutexattr_t attr;
   2958                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
   2959                 ],[
   2960                 has_recursive_mutexes=yes
   2961                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
   2962                 ])
   2963             fi
   2964             if test x$has_recursive_mutexes = xno; then
   2965                 AC_TRY_LINK([
   2966                   #define _GNU_SOURCE 1
   2967                   #include <pthread.h>
   2968                 ],[
   2969                   pthread_mutexattr_t attr;
   2970                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
   2971                 ],[
   2972                 has_recursive_mutexes=yes
   2973                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
   2974                 ])
   2975             fi
   2976             AC_MSG_RESULT($has_recursive_mutexes)
   2977 
   2978             # Check to see if pthread semaphore support is missing
   2979             if test x$enable_pthread_sem = xyes; then
   2980                 AC_MSG_CHECKING(for pthread semaphores)
   2981                 have_pthread_sem=no
   2982                 AC_TRY_COMPILE([
   2983                   #include <pthread.h>
   2984                   #include <semaphore.h>
   2985                 ],[
   2986                 ],[
   2987                 have_pthread_sem=yes
   2988                 ])
   2989                 AC_MSG_RESULT($have_pthread_sem)
   2990             fi
   2991             if test x$have_pthread_sem = xyes; then
   2992                 AC_MSG_CHECKING(for sem_timedwait)
   2993                 have_sem_timedwait=no
   2994                 AC_TRY_LINK([
   2995                   #include <pthread.h>
   2996                   #include <semaphore.h>
   2997                 ],[
   2998                   sem_timedwait(NULL, NULL);
   2999                 ],[
   3000                 have_sem_timedwait=yes
   3001                 AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ])
   3002                 ])
   3003                 AC_MSG_RESULT($have_sem_timedwait)
   3004             fi
   3005 
   3006             AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
   3007             if test x$have_pthread_np_h = xyes; then
   3008                 AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
   3009             fi
   3010 
   3011             # Check to see if pthread naming is available
   3012             AC_MSG_CHECKING(for pthread_setname_np)
   3013             AC_TRY_LINK_FUNC(pthread_setname_np, [
   3014               has_pthread_setname_np=yes
   3015               AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
   3016             ],[
   3017               has_pthread_setname_np=no
   3018             ])
   3019             AC_MSG_RESULT($has_pthread_setname_np)
   3020 
   3021             AC_MSG_CHECKING(for pthread_set_name_np)
   3022             AC_TRY_LINK_FUNC(pthread_set_name_np, [
   3023               has_pthread_set_name_np=yes
   3024               AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
   3025             ],[
   3026               has_pthread_set_name_np=no
   3027             ])
   3028             AC_MSG_RESULT($has_pthread_set_name_np)
   3029 
   3030             # Restore the compiler flags and libraries
   3031             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
   3032 
   3033             # Basic thread creation functions
   3034             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
   3035 
   3036             # Semaphores
   3037             # We can fake these with mutexes and condition variables if necessary
   3038             if test x$have_pthread_sem = xyes; then
   3039                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
   3040             else
   3041                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
   3042             fi
   3043 
   3044             # Mutexes
   3045             # We can fake these with semaphores if necessary
   3046             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
   3047 
   3048             # Condition variables
   3049             # We can fake these with semaphores and mutexes if necessary
   3050             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
   3051 
   3052             # Thread local storage
   3053             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
   3054 
   3055             have_threads=yes
   3056         fi
   3057     fi
   3058 }
   3059 
   3060 dnl Determine whether the compiler can produce Windows executables
   3061 CheckWINDOWS()
   3062 {
   3063     AC_MSG_CHECKING(Windows compiler)
   3064     have_win32_gcc=no
   3065     AC_TRY_COMPILE([
   3066      #include <windows.h>
   3067     ],[
   3068     ],[
   3069     have_win32_gcc=yes
   3070     ])
   3071     AC_MSG_RESULT($have_win32_gcc)
   3072     if test x$have_win32_gcc != xyes; then
   3073        AC_MSG_ERROR([
   3074 *** Your compiler ($CC) does not produce Windows executables!
   3075        ])
   3076     fi
   3077 
   3078     AC_MSG_CHECKING(Windows CE)
   3079     have_wince=no
   3080     AC_TRY_COMPILE([
   3081 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
   3082 #error This is not Windows CE
   3083 #endif
   3084     ],[
   3085     ],[
   3086     have_wince=yes
   3087        AC_MSG_ERROR([
   3088 *** Sorry, Windows CE is no longer supported.
   3089        ])
   3090     ])
   3091     AC_MSG_RESULT($have_wince)
   3092 
   3093     # This fixes Windows stack alignment with newer GCC
   3094     CheckStackBoundary
   3095 }
   3096 
   3097 dnl Find the DirectX includes and libraries
   3098 CheckDIRECTX()
   3099 {
   3100     AC_ARG_ENABLE(directx,
   3101 AS_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
   3102                   , enable_directx=yes)
   3103     if test x$enable_directx = xyes; then
   3104         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
   3105         AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes)
   3106         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
   3107         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
   3108         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
   3109         AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
   3110         AC_CHECK_HEADER(xinput.h, have_xinput=yes)
   3111         AC_TRY_COMPILE([
   3112 #include <windows.h>
   3113 #include <xinput.h>
   3114 XINPUT_GAMEPAD_EX x1;
   3115         ],[],[have_xinput_gamepadex=yes])
   3116         AC_TRY_COMPILE([
   3117 #include <windows.h>
   3118 #include <xinput.h>
   3119 XINPUT_STATE_EX s1;
   3120         ],[],[have_xinput_stateex=yes])
   3121 
   3122         if test x$have_ddraw = xyes; then
   3123             AC_DEFINE(HAVE_DDRAW_H, 1, [ ])
   3124         fi
   3125         if test x$have_dinput = xyes; then
   3126             AC_DEFINE(HAVE_DINPUT_H, 1, [ ])
   3127         fi
   3128         if test x$have_dsound = xyes; then
   3129             AC_DEFINE(HAVE_DSOUND_H, 1, [ ])
   3130         fi
   3131         if test x$have_dxgi = xyes; then
   3132             AC_DEFINE(HAVE_DXGI_H, 1, [ ])
   3133         fi
   3134         if test x$have_xinput = xyes; then
   3135             AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
   3136         fi
   3137         if test x$have_xinput_gamepadex = xyes; then
   3138             AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
   3139         fi
   3140         if test x$have_xinput_stateex = xyes; then
   3141             AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
   3142         fi
   3143 
   3144         # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
   3145         # FIXME:  ...so force it off for now.
   3146         case "$host" in
   3147             *-*-cygwin*)
   3148             have_dinput=false
   3149             ;;
   3150         esac
   3151     fi
   3152 
   3153     AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
   3154     if test x$have_wasapi = xyes; then
   3155         AC_DEFINE(HAVE_MMDEVICEAPI_H, 1, [ ])
   3156     fi
   3157     AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
   3158     if test x$have_wasapi = xyes; then
   3159         AC_DEFINE(HAVE_AUDIOCLIENT_H, 1, [ ])
   3160     fi
   3161 
   3162     AC_ARG_ENABLE(wasapi,
   3163 AS_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
   3164                                 , enable_wasapi=yes)
   3165 }
   3166 
   3167 dnl Check for the dlfcn.h interface for dynamically loading objects
   3168 CheckDLOPEN()
   3169 {
   3170     AC_ARG_ENABLE(sdl-dlopen,
   3171 AS_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
   3172                   , enable_sdl_dlopen=yes)
   3173     if test x$enable_sdl_dlopen = xyes; then
   3174         AC_MSG_CHECKING(for dlopen)
   3175         have_dlopen=no
   3176         AC_TRY_COMPILE([
   3177          #include <dlfcn.h>
   3178         ],[
   3179          void *handle = dlopen("", RTLD_NOW);
   3180          const char *loaderror = (char *) dlerror();
   3181         ],[
   3182         have_dlopen=yes
   3183         ])
   3184         AC_MSG_RESULT($have_dlopen)
   3185 
   3186         if test x$have_dlopen = xyes; then
   3187             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
   3188                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
   3189                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
   3190             AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
   3191             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
   3192             have_loadso=yes
   3193         fi
   3194     fi
   3195 }
   3196 
   3197 dnl Check for the usbhid(3) library on *BSD
   3198 CheckUSBHID()
   3199 {
   3200     case "$host" in
   3201         *-*-*bsd*|*-*-dragonfly*)
   3202             if test x$enable_joystick = xyes; then
   3203                 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
   3204                 if test x$have_libusbhid = xyes; then
   3205                     AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
   3206                     AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
   3207                     USB_LIBS="$USB_LIBS -lusbhid"
   3208                 else
   3209                     AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
   3210                     AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
   3211                     AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
   3212                 fi
   3213 
   3214                 save_CFLAGS="$CFLAGS"
   3215                 CFLAGS="$CFLAGS $USB_CFLAGS"
   3216 
   3217                 AC_MSG_CHECKING(for usbhid)
   3218                 have_usbhid=no
   3219                 AC_TRY_COMPILE([
   3220                   #include <sys/types.h>
   3221                   #if defined(HAVE_USB_H)
   3222                   #include <usb.h>
   3223                   #endif
   3224                   #ifdef __DragonFly__
   3225                   # include <bus/u4b/usb.h>
   3226                   # include <bus/u4b/usbhid.h>
   3227                   #else
   3228                   # include <dev/usb/usb.h>
   3229                   # include <dev/usb/usbhid.h>
   3230                   #endif
   3231                   #if defined(HAVE_USBHID_H)
   3232                   #include <usbhid.h>
   3233                   #elif defined(HAVE_LIBUSB_H)
   3234                   #include <libusb.h>
   3235                   #elif defined(HAVE_LIBUSBHID_H)
   3236                   #include <libusbhid.h>
   3237                   #endif
   3238                 ],[
   3239                   struct report_desc *repdesc;
   3240                   struct usb_ctl_report *repbuf;
   3241                   hid_kind_t hidkind;
   3242                 ],[
   3243                 have_usbhid=yes
   3244                 ])
   3245                 AC_MSG_RESULT($have_usbhid)
   3246 
   3247                 if test x$have_usbhid = xyes; then
   3248                     AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
   3249                     have_usbhid_ucr_data=no
   3250                     AC_TRY_COMPILE([
   3251                       #include <sys/types.h>
   3252                       #if defined(HAVE_USB_H)
   3253                       #include <usb.h>
   3254                       #endif
   3255                       #ifdef __DragonFly__
   3256                       # include <bus/u4b/usb.h>
   3257                       # include <bus/u4b/usbhid.h>
   3258                       #else
   3259                       # include <dev/usb/usb.h>
   3260                       # include <dev/usb/usbhid.h>
   3261                       #endif
   3262                       #if defined(HAVE_USBHID_H)
   3263                       #include <usbhid.h>
   3264                       #elif defined(HAVE_LIBUSB_H)
   3265                       #include <libusb.h>
   3266                       #elif defined(HAVE_LIBUSBHID_H)
   3267                       #include <libusbhid.h>
   3268                       #endif
   3269                     ],[
   3270                       struct usb_ctl_report buf;
   3271                       if (buf.ucr_data) { }
   3272                     ],[
   3273                     have_usbhid_ucr_data=yes
   3274                     ])
   3275                     if test x$have_usbhid_ucr_data = xyes; then
   3276                         USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
   3277                     fi
   3278                     AC_MSG_RESULT($have_usbhid_ucr_data)
   3279 
   3280                     AC_MSG_CHECKING(for new usbhid API)
   3281                     have_usbhid_new=no
   3282                     AC_TRY_COMPILE([
   3283                       #include <sys/types.h>
   3284                       #if defined(HAVE_USB_H)
   3285                       #include <usb.h>
   3286                       #endif
   3287                       #ifdef __DragonFly__
   3288                       #include <bus/u4b/usb.h>
   3289                       #include <bus/u4b/usbhid.h>
   3290                       #else
   3291                       #include <dev/usb/usb.h>
   3292                       #include <dev/usb/usbhid.h>
   3293                       #endif
   3294                       #if defined(HAVE_USBHID_H)
   3295                       #include <usbhid.h>
   3296                       #elif defined(HAVE_LIBUSB_H)
   3297                       #include <libusb.h>
   3298                       #elif defined(HAVE_LIBUSBHID_H)
   3299                       #include <libusbhid.h>
   3300                       #endif
   3301                     ],[
   3302                       report_desc_t d;
   3303                       hid_start_parse(d, 1, 1);
   3304                     ],[
   3305                     have_usbhid_new=yes
   3306                     ])
   3307                     if test x$have_usbhid_new = xyes; then
   3308                         USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
   3309                     fi
   3310                     AC_MSG_RESULT($have_usbhid_new)
   3311 
   3312                     AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
   3313                     have_machine_joystick=no
   3314                     AC_TRY_COMPILE([
   3315                       #include <machine/joystick.h>
   3316                     ],[
   3317                       struct joystick t;
   3318                     ],[
   3319                     have_machine_joystick=yes
   3320                     ])
   3321                     if test x$have_machine_joystick = xyes; then
   3322                         AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
   3323                     fi
   3324                     AC_MSG_RESULT($have_machine_joystick)
   3325 
   3326                     AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
   3327                     SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
   3328                     EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
   3329                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
   3330                     have_joystick=yes
   3331                 fi
   3332                 CFLAGS="$save_CFLAGS"
   3333             fi
   3334         ;;
   3335     esac
   3336 }
   3337 
   3338 dnl Check for HIDAPI joystick drivers
   3339 CheckHIDAPI()
   3340 {
   3341     AC_ARG_ENABLE(hidapi,
   3342 AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=yes]]]),
   3343                   , enable_hidapi=yes)
   3344     AC_ARG_ENABLE(hidapi-libusb,
   3345 AS_HELP_STRING([--enable-hidapi-libusb], [use libusb for low level joystick drivers [[default=maybe]]]),
   3346                   , enable_hidapi_libusb=maybe)
   3347 
   3348     if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
   3349         case "$host" in
   3350             # libusb does not support iOS
   3351             *-ios-* )
   3352                 enable_hidapi_libusb=no
   3353                 ;;
   3354             # On the other hand, *BSD specifically uses libusb only
   3355             *-*-*bsd* )
   3356                 enable_hidapi_libusb=yes
   3357                 require_hidapi_libusb=yes
   3358                 ;;
   3359             # RAWINPUT is only available on Win32, but can be enabled if HIDAPI is
   3360             *-*-cygwin* | *-*-mingw32*)
   3361                 enable_joystick_rawinput=yes
   3362                 ;;
   3363         esac
   3364 
   3365         hidapi_support=yes
   3366         if test x$enable_hidapi_libusb = xyes; then
   3367             PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no)
   3368             save_CFLAGS="$CFLAGS"
   3369             CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
   3370             AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
   3371             CFLAGS="$save_CFLAGS"
   3372             if test x$have_libusb_h = xno && test x$require_hidapi_libusb = xyes; then
   3373                 hidapi_support=no
   3374             fi
   3375         fi
   3376 
   3377         if test x$hidapi_support = xyes; then
   3378             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
   3379             if test x$enable_joystick_rawinput = xyes; then
   3380                 AC_DEFINE(SDL_JOYSTICK_RAWINPUT, 1, [ ])
   3381             fi
   3382             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
   3383             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
   3384             SOURCES="$SOURCES $srcdir/src/hidapi/SDL_hidapi.c"
   3385 
   3386             if test x$have_libusb_h = xyes; then
   3387                 EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
   3388                 if test x$require_hidapi_libusb = xyes; then
   3389                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
   3390                 else
   3391                     if test x$have_loadso != xyes; then
   3392                         AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libusb loading])
   3393                     fi
   3394                     # libusb is loaded dynamically, so don't add it to LDFLAGS
   3395                     libusb_lib=""
   3396                     case "$host" in
   3397                         *-*-darwin* )
   3398                             libusb_lib="libusb-1.0.0.dylib"
   3399                             ;;
   3400                         *-*-cygwin* | *-*-mingw32* )
   3401                             libusb_lib="libusb-1.0.dll"
   3402                             ;;
   3403                     esac
   3404                     if test x$libusb_lib = x; then
   3405                         libusb_lib=[`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
   3406                     fi
   3407                     AC_DEFINE_UNQUOTED(SDL_LIBUSB_DYNAMIC, "$libusb_lib", [ ])
   3408                 fi
   3409             fi
   3410         fi
   3411 
   3412         AC_MSG_CHECKING(for hidapi support)
   3413         AC_MSG_RESULT($hidapi_support)
   3414     fi
   3415 }
   3416 
   3417 dnl Check for clock_gettime()
   3418 CheckClockGettime()
   3419 {
   3420     AC_ARG_ENABLE(clock_gettime,
   3421 AS_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
   3422                   , enable_clock_gettime=yes)
   3423     if test x$enable_clock_gettime = xyes; then
   3424         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
   3425         if test x$have_clock_gettime = xyes; then
   3426             AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
   3427             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
   3428         else
   3429             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
   3430             if test x$have_clock_gettime = xyes; then
   3431                AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
   3432                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
   3433             fi
   3434         fi
   3435     fi
   3436 }
   3437 
   3438 dnl Check for a valid linux/version.h
   3439 CheckLinuxVersion()
   3440 {
   3441     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
   3442     if test x$have_linux_version_h = xyes; then
   3443         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
   3444     fi
   3445 }
   3446 
   3447 dnl Check if we want to use RPATH
   3448 CheckRPATH()
   3449 {
   3450     AC_ARG_ENABLE(rpath,
   3451 AS_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
   3452                   , enable_rpath=yes)
   3453 }
   3454 
   3455 dnl Check if we want to use custom signals to fake iOS/Android's backgrounding
   3456 dnl  events. These could be useful if you're building a custom embedded
   3457 dnl  environment, etc, but most people don't need this.
   3458 CheckEventSignals()
   3459 {
   3460     AC_ARG_ENABLE(backgrounding-signal,
   3461 AS_HELP_STRING([--enable-backgrounding-signal], [number to use for magic backgrounding signal or 'no' [[default=no]]]),
   3462                   , enable_backgrounding_signal=no)
   3463     if test x$enable_backgrounding_signal != xno; then
   3464         EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_BACKGROUNDING_SIGNAL=$enable_backgrounding_signal"
   3465     fi
   3466 
   3467     AC_ARG_ENABLE(foregrounding-signal,
   3468 AS_HELP_STRING([--enable-foregrounding-signal], [number to use for magic foregrounding signal or 'no' [[default=no]]]),
   3469                   , enable_foregrounding_signal=no)
   3470     if test x$enable_foregrounding_signal != xno; then
   3471         EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_FOREGROUNDING_SIGNAL=$enable_foregrounding_signal"
   3472     fi
   3473 }
   3474 
   3475 dnl Set up the Virtual joystick driver.
   3476 CheckVirtualJoystick()
   3477 {
   3478     AC_ARG_ENABLE(joystick-virtual,
   3479 AS_HELP_STRING([--enable-joystick-virtual], [enable virtual joystick APIs [[default=yes]]]),
   3480                   , enable_joystick_virtual=yes)
   3481     if test x$enable_joystick = xyes -a x$enable_joystick_virtual = xyes; then
   3482         AC_DEFINE(SDL_JOYSTICK_VIRTUAL, 1, [ ])
   3483         SOURCES="$SOURCES $srcdir/src/joystick/virtual/*.c"
   3484         have_joystick_virtual=yes
   3485     fi
   3486 }
   3487 
   3488 dnl Do this on all platforms, before everything else (other things might want to override it).
   3489 CheckWarnAll
   3490 CheckNoStrictAliasing
   3491 
   3492 dnl Do this for every platform, but for some it doesn't mean anything, but better to catch it here anyhow.
   3493 CheckEventSignals
   3494 
   3495 have_locale=no
   3496 
   3497 dnl Set up the configuration based on the host platform!
   3498 case "$host" in
   3499     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
   3500         case "$host" in
   3501             *-*-android*)
   3502                 # Android
   3503                 ARCH=android
   3504                 ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES"
   3505                 CFLAGS="$CFLAGS $ANDROID_CFLAGS"
   3506                 SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS"
   3507                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS"
   3508                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid"
   3509                 SDLMAIN_SOURCES="$srcdir/src/main/android/*.c"
   3510                 if test x$enable_video = xyes; then
   3511                     SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
   3512                     AC_DEFINE(SDL_VIDEO_DRIVER_ANDROID, 1, [ ])
   3513                     SUMMARY_video="${SUMMARY_video} android"
   3514                 fi
   3515                 ;;
   3516             *-*-linux*)         ARCH=linux ;;
   3517             *-*-uclinux*)       ARCH=linux ;;
   3518             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
   3519             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
   3520             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
   3521             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
   3522             *-*-bsdi*)          ARCH=bsdi ;;
   3523             *-*-freebsd*)       ARCH=freebsd ;;
   3524             *-*-dragonfly*)     ARCH=freebsd ;;
   3525             *-*-netbsd*)        ARCH=netbsd ;;
   3526             *-*-openbsd*)       ARCH=openbsd ;;
   3527             *-*-sysv5*)         ARCH=sysv5 ;;
   3528             *-*-solaris*)       ARCH=solaris ;;
   3529             *-*-hpux*)          ARCH=hpux ;;
   3530             *-*-aix*)           ARCH=aix ;;
   3531             *-*-minix*)         ARCH=minix ;;
   3532             *-*-nto*)           ARCH=nto
   3533                 CheckQNXVideo
   3534                 ;;
   3535         esac
   3536         CheckVisibilityHidden
   3537         CheckDeclarationAfterStatement
   3538         CheckDummyVideo
   3539         CheckDiskAudio
   3540         CheckDummyAudio
   3541         CheckDLOPEN
   3542         CheckARM
   3543         CheckNEON
   3544         CheckOSS
   3545         CheckALSA
   3546         CheckPulseAudio
   3547         CheckJACK
   3548         CheckARTSC
   3549         CheckESD
   3550         CheckNAS
   3551         CheckSNDIO
   3552         CheckFusionSound
   3553         CheckLibSampleRate
   3554         # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
   3555         CheckRPI
   3556         CheckX11
   3557         CheckDirectFB
   3558         CheckKMSDRM
   3559         CheckOpenGLX11
   3560         CheckOpenGLESX11
   3561         CheckVulkan
   3562         CheckWayland
   3563         CheckInputEvents
   3564         CheckLibUDev
   3565         CheckDBus
   3566         CheckIME
   3567         CheckInotify
   3568         CheckIBus
   3569         CheckFcitx
   3570         case $ARCH in
   3571           linux)
   3572               CheckInputKD
   3573           ;;
   3574           freebsd)
   3575               CheckInputKBIO
   3576           ;;
   3577         esac
   3578         CheckUSBHID
   3579         CheckHIDAPI
   3580         CheckPTHREAD
   3581         CheckClockGettime
   3582         CheckLinuxVersion
   3583         CheckRPATH
   3584         CheckVivanteVideo
   3585 
   3586         SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
   3587         have_misc=yes
   3588 
   3589         SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
   3590         have_locale=yes
   3591 
   3592         # Set up files for the audio library
   3593         if test x$enable_audio = xyes; then
   3594           case $ARCH in
   3595             sysv5|solaris|hpux)
   3596                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
   3597                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
   3598                 SUMMARY_audio="${SUMMARY_audio} sun"
   3599                 have_audio=yes
   3600             ;;
   3601             netbsd)  # Don't use this on OpenBSD, it's busted.
   3602                 AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ])
   3603                 SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c"
   3604                 SUMMARY_audio="${SUMMARY_audio} netbsd"
   3605                 have_audio=yes
   3606             ;;
   3607             aix)
   3608                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
   3609                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
   3610                 SUMMARY_audio="${SUMMARY_audio} paudio"
   3611                 have_audio=yes
   3612             ;;
   3613             android)
   3614                 AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
   3615                 SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
   3616                 SUMMARY_audio="${SUMMARY_audio} android"
   3617                 have_audio=yes
   3618             ;;
   3619             nto)
   3620                 CheckQNXAudio
   3621             ;;
   3622           esac
   3623         fi
   3624         # Set up files for the joystick library
   3625         if test x$enable_joystick = xyes; then
   3626           case $ARCH in
   3627             linux)
   3628                 AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
   3629                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
   3630                 SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
   3631                 have_joystick=yes
   3632             ;;
   3633             freebsd)
   3634                 if test x$use_input_events = xyes; then
   3635                     AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
   3636                     SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
   3637                     SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
   3638                     have_joystick=yes
   3639                 fi
   3640             ;;
   3641             android)
   3642                 AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ])
   3643                 SOURCES="$SOURCES $srcdir/src/joystick/android/*.c"
   3644                 SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
   3645                 have_joystick=yes
   3646             ;;
   3647           esac
   3648         fi
   3649         # Set up files for the haptic library
   3650         if test x$enable_haptic = xyes; then
   3651           case $ARCH in
   3652             linux|freebsd)
   3653                 if test x$use_input_events = xyes; then
   3654                     AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
   3655                     SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
   3656                     have_haptic=yes
   3657                 fi
   3658             ;;
   3659             android)
   3660                 AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ])
   3661                 SOURCES="$SOURCES $srcdir/src/haptic/android/*.c"
   3662                 have_haptic=yes
   3663             ;;
   3664           esac
   3665         fi
   3666         # Set up files for the sensor library
   3667         if test x$enable_sensor = xyes; then
   3668           case $ARCH in
   3669             android)
   3670                 AC_DEFINE(SDL_SENSOR_ANDROID, 1, [ ])
   3671                 SOURCES="$SOURCES $srcdir/src/sensor/android/*.c"
   3672                 have_sensor=yes
   3673             ;;
   3674           esac
   3675         fi
   3676         # Set up files for the power library
   3677         if test x$enable_power = xyes; then
   3678              case $ARCH in
   3679                linux)
   3680                    AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
   3681                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
   3682                    have_power=yes
   3683                ;;
   3684                android)
   3685                    AC_DEFINE(SDL_POWER_ANDROID, 1, [ ])
   3686                    SOURCES="$SOURCES $srcdir/src/power/android/*.c"
   3687                    have_power=yes
   3688                ;;
   3689              esac
   3690         fi
   3691         # Set up files for the filesystem library
   3692         if test x$enable_filesystem = xyes; then
   3693              case $ARCH in
   3694                android)
   3695                    AC_DEFINE(SDL_FILESYSTEM_ANDROID, 1, [ ])
   3696                    SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c"
   3697                    have_filesystem=yes
   3698                ;;
   3699                *)
   3700                    AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
   3701                    SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
   3702                    have_filesystem=yes
   3703                ;;
   3704              esac
   3705         fi
   3706         # Set up files for the timer library
   3707         if test x$enable_timers = xyes; then
   3708             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
   3709             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   3710             have_timers=yes
   3711         fi
   3712         # Set up files for udev hotplugging support
   3713         if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
   3714             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"               
   3715         fi
   3716         # Set up files for evdev input
   3717         if test x$use_input_events = xyes; then
   3718             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c"
   3719             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev_kbd.c"
   3720             SOURCES="$SOURCES $srcdir/src/core/freebsd/SDL_evdev_kbd_freebsd.c"
   3721         fi
   3722         # Set up other core UNIX files
   3723         SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev_capabilities.c"
   3724         SOURCES="$SOURCES $srcdir/src/core/linux/SDL_threadprio.c"
   3725         SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
   3726         ;;
   3727     *-*-cygwin* | *-*-mingw32*)
   3728         ARCH=win32
   3729         if test "$build" != "$host"; then # cross-compiling
   3730             # Default cross-compile location
   3731             ac_default_prefix=/usr/local/cross-tools/$host
   3732         else
   3733             # Look for the location of the tools and install there
   3734             if test "$BUILD_PREFIX" != ""; then
   3735                 ac_default_prefix=$BUILD_PREFIX
   3736             fi
   3737         fi
   3738         CheckDeclarationAfterStatement
   3739         CheckDummyVideo
   3740         CheckDiskAudio
   3741         CheckDummyAudio
   3742         CheckWINDOWS
   3743         CheckWINDOWSGL
   3744         CheckWINDOWSGLES
   3745         CheckVulkan
   3746         CheckDIRECTX
   3747         CheckHIDAPI
   3748 
   3749         # Set up the core platform files
   3750         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
   3751 
   3752         SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
   3753         have_misc=yes
   3754 
   3755         # Use the Windows locale APIs.
   3756         SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
   3757         have_locale=yes
   3758 
   3759         # Set up files for the video library
   3760         if test x$enable_video = xyes; then
   3761             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
   3762             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
   3763             have_video=yes
   3764             AC_ARG_ENABLE(render-d3d,
   3765 AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
   3766                                 , enable_render_d3d=yes)
   3767             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
   3768                 AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
   3769                 SUMMARY_video="${SUMMARY_video} d3d9"
   3770             fi
   3771             if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then
   3772                 AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ])
   3773                 SUMMARY_video="${SUMMARY_video} d3d11"
   3774             fi
   3775         fi
   3776         # Set up files for the audio library
   3777         if test x$enable_audio = xyes; then
   3778             AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
   3779             SUMMARY_audio="${SUMMARY_audio} winmm"
   3780             SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
   3781             if test x$have_dsound = xyes; then
   3782                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
   3783                 SUMMARY_audio="${SUMMARY_audio} directsound"
   3784                 SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
   3785             fi
   3786             if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then
   3787                 AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
   3788                 SUMMARY_audio="${SUMMARY_audio} wasapi"
   3789                 SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
   3790             fi
   3791             have_audio=yes
   3792         fi
   3793         # Set up files for the joystick library
   3794         if test x$enable_joystick = xyes; then
   3795             if test x$have_dinput = xyes -o x$have_xinput = xyes; then
   3796                 if test x$have_xinput = xyes; then
   3797                     AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ])
   3798                 fi
   3799                 if test x$have_dinput = xyes; then
   3800                     AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
   3801                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
   3802                 fi
   3803             else
   3804                 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
   3805             fi
   3806             SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
   3807             have_joystick=yes
   3808         fi
   3809         if test x$enable_haptic = xyes; then
   3810             if test x$have_dinput = xyes -o x$have_xinput = xyes; then
   3811                 if test x$have_xinput = xyes; then
   3812                     AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ])
   3813                 fi
   3814                 if test x$have_dinput = xyes; then
   3815                     AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
   3816                 fi
   3817                 SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
   3818                 have_haptic=yes
   3819             fi
   3820         fi
   3821         # Set up files for the sensor library
   3822         AC_CHECK_HEADER(sensorsapi.h,have_winsensors=yes,have_winsensors=no)
   3823         if test x$have_winsensors = xyes; then
   3824             AC_DEFINE(HAVE_SENSORSAPI_H, 1, [ ])
   3825         fi
   3826         if test x$enable_sensor = xyes -a x$have_winsensors = xyes; then
   3827             AC_DEFINE(SDL_SENSOR_WINDOWS, 1, [ ])
   3828             SOURCES="$SOURCES $srcdir/src/sensor/windows/*.c"
   3829             have_sensor=yes
   3830         fi
   3831         # Set up files for the power library
   3832         if test x$enable_power = xyes; then
   3833             AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
   3834             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
   3835             have_power=yes
   3836         fi
   3837         # Set up files for the filesystem library
   3838         if test x$enable_filesystem = xyes; then
   3839             AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
   3840             SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
   3841             have_filesystem=yes
   3842         fi
   3843         # Set up files for the thread library
   3844         if test x$enable_threads = xyes; then
   3845             AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
   3846             SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
   3847             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
   3848             have_threads=yes
   3849         fi
   3850         # Set up files for the timer library
   3851         if test x$enable_timers = xyes; then
   3852             AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
   3853             SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
   3854             have_timers=yes
   3855         fi
   3856         # Set up files for the shared object loading library
   3857         if test x$enable_loadso = xyes; then
   3858             AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
   3859             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
   3860             have_loadso=yes
   3861         fi
   3862         # Set up the system libraries we need
   3863         if test -f /lib/w32api/libuuid.a; then
   3864             LIBUUID=/lib/w32api/libuuid.a
   3865         else
   3866             LIBUUID=-luuid
   3867         fi
   3868         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc"
   3869         # The Windows platform requires special setup
   3870         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
   3871         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
   3872         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
   3873         SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
   3874 
   3875         # Check to see if this is a mingw or cygwin build
   3876         have_mingw32=
   3877         AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
   3878         if test x$have_mingw32 = xyes; then
   3879             SDL_LIBS="-lmingw32 $SDL_LIBS"
   3880         else
   3881             SDL_LIBS="-lcygwin $SDL_LIBS"
   3882         fi
   3883         ;;
   3884 
   3885     dnl BeOS support removed after SDL 2.0.1. Haiku still works.  --ryan.
   3886     *-*-beos*)
   3887         AC_MSG_ERROR([
   3888 *** BeOS support has been removed as of SDL 2.0.2.
   3889         ])
   3890         ;;
   3891 
   3892     *-*-haiku*)
   3893         ARCH=haiku
   3894         ac_default_prefix=/boot/system
   3895         CheckDummyVideo
   3896         CheckDiskAudio
   3897         CheckDummyAudio
   3898         CheckDLOPEN
   3899         CheckHaikuVideo
   3900         CheckHaikuGL
   3901         CheckPTHREAD
   3902 
   3903         # Set up files for the audio library
   3904         if test x$enable_audio = xyes; then
   3905             AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
   3906             SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
   3907             SUMMARY_audio="${SUMMARY_audio} haiku"
   3908             have_audio=yes
   3909         fi
   3910         # Set up files for the joystick library
   3911         if test x$enable_joystick = xyes; then
   3912             AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
   3913             SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
   3914             have_joystick=yes
   3915         fi
   3916         # Set up files for the timer library
   3917         if test x$enable_timers = xyes; then
   3918             AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
   3919             SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
   3920             have_timers=yes
   3921         fi
   3922         # Set up files for the system power library
   3923         if test x$enable_power = xyes; then
   3924             AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
   3925             SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
   3926             have_power=yes
   3927         fi
   3928         # Set up files for the system filesystem library
   3929         if test x$enable_filesystem = xyes; then
   3930             AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
   3931             SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
   3932             have_filesystem=yes
   3933         fi
   3934 
   3935         SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc"
   3936         have_misc=yes
   3937 
   3938         # Set up files for the locale library
   3939         SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
   3940         have_locale=yes
   3941 
   3942         # The Haiku platform requires special setup.
   3943         SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
   3944         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
   3945         # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but
   3946         #  other spins, like x86-64, use a more standard "libstdc++.so.*"
   3947         AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++")
   3948         ;;
   3949     *-ios-*)
   3950         ARCH=ios
   3951 
   3952         CheckVisibilityHidden
   3953         CheckDeclarationAfterStatement
   3954         CheckDummyVideo
   3955         CheckDiskAudio
   3956         CheckDummyAudio
   3957         CheckDLOPEN
   3958         CheckMETAL
   3959         CheckVulkan
   3960         CheckPTHREAD
   3961 
   3962         SOURCES="$SOURCES $srcdir/src/misc/ios/*.m"
   3963         have_misc=yes
   3964 
   3965         # Set up files for the locale library
   3966         SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
   3967         have_locale=yes
   3968 
   3969         # Set up files for the audio library
   3970         if test x$enable_audio = xyes; then
   3971             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
   3972             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
   3973             SUMMARY_audio="${SUMMARY_audio} coreaudio"
   3974             have_audio=yes
   3975         fi
   3976         # Set up files for the joystick library
   3977         if test x$enable_joystick = xyes; then
   3978             AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
   3979             SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
   3980             SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
   3981             have_joystick=yes
   3982         else
   3983             # Need this code for accelerometer as joystick support
   3984             SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
   3985         fi
   3986         # Set up files for the haptic library
   3987         #if test x$enable_haptic = xyes; then
   3988         #    SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
   3989         #    have_haptic=yes
   3990         #    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
   3991         #fi
   3992         # Set up files for the sensor library
   3993         if test x$enable_sensor = xyes; then
   3994             AC_DEFINE(SDL_SENSOR_COREMOTION, 1, [ ])
   3995             SOURCES="$SOURCES $srcdir/src/sensor/coremotion/*.m"
   3996             have_sensor=yes
   3997         fi
   3998         # Set up files for the power library
   3999         if test x$enable_power = xyes; then
   4000             AC_DEFINE(SDL_POWER_UIKIT, 1, [ ])
   4001             SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
   4002             have_power=yes
   4003         fi
   4004         # Set up files for the filesystem library
   4005         if test x$enable_filesystem = xyes; then
   4006             SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
   4007             have_filesystem=yes
   4008         fi
   4009         # Set up additional files for the file library
   4010         if test x$enable_file = xyes; then
   4011             AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
   4012             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
   4013         fi
   4014         # Set up files for the timer library
   4015         if test x$enable_timers = xyes; then
   4016             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
   4017             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   4018             have_timers=yes
   4019         fi
   4020         # Set up other core UNIX files
   4021         SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
   4022         # The iOS platform requires special setup.
   4023         AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ])
   4024         AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
   4025         AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
   4026         AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
   4027         AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
   4028         SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
   4029         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
   4030         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
   4031         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
   4032         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
   4033         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
   4034         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
   4035         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
   4036         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
   4037         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
   4038         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
   4039         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
   4040 
   4041         if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
   4042             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
   4043         fi
   4044         ;;
   4045     *-*-darwin* )
   4046         # This could be either full "Mac OS X", or plain "Darwin" which is
   4047         # just the OS X kernel sans upper layers like Carbon and Cocoa.
   4048         # Next line is broken, and a few files below require Mac OS X (full)
   4049         ARCH=macosx
   4050 
   4051         # Mac OS X builds with both the Carbon and OSX APIs at the moment
   4052         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
   4053         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
   4054 
   4055         CheckVisibilityHidden
   4056         CheckDeclarationAfterStatement
   4057         CheckDummyVideo
   4058         CheckDiskAudio
   4059         CheckDummyAudio
   4060         CheckDLOPEN
   4061         CheckCOCOA
   4062         CheckMETAL
   4063         CheckX11
   4064         CheckMacGL
   4065         CheckMacGLES
   4066         CheckOpenGLX11
   4067         CheckVulkan
   4068         CheckPTHREAD
   4069         CheckHIDAPI
   4070 
   4071         SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m"
   4072         have_misc=yes
   4073 
   4074         # Set up files for the locale library
   4075         SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
   4076         have_locale=yes
   4077 
   4078         # Set up files for the audio library
   4079         if test x$enable_audio = xyes; then
   4080             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
   4081             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
   4082             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox"
   4083             SUMMARY_audio="${SUMMARY_audio} coreaudio"
   4084             have_audio=yes
   4085         fi
   4086         # Set up files for the joystick library
   4087         if test x$enable_joystick = xyes; then
   4088             AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
   4089             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
   4090             SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
   4091             CheckJoystickMFI
   4092             have_joystick=yes
   4093         fi
   4094         # Set up files for the haptic library
   4095         if test x$enable_haptic = xyes; then
   4096             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
   4097             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
   4098             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
   4099             have_haptic=yes
   4100         fi
   4101         # Set up files for the power library
   4102         if test x$enable_power = xyes; then
   4103             AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
   4104             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
   4105             have_power=yes
   4106         fi
   4107         # Set up files for the filesystem library
   4108         if test x$enable_filesystem = xyes; then
   4109             AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
   4110             SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
   4111             have_filesystem=yes
   4112         fi
   4113         # Set up files for the timer library
   4114         if test x$enable_timers = xyes; then
   4115             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
   4116             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   4117             have_timers=yes
   4118         fi
   4119         # Set up additional files for the file library
   4120         if test x$enable_file = xyes; then
   4121             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
   4122         fi
   4123         # Set up other core UNIX files
   4124         SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
   4125         # The Mac OS X platform requires special setup.
   4126         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
   4127         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo"
   4128         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
   4129         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
   4130         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
   4131 
   4132         if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
   4133             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
   4134         fi
   4135         ;;
   4136     *-nacl|*-pnacl)
   4137         ARCH=nacl
   4138         CheckNativeClient
   4139         CheckDummyAudio
   4140         CheckDummyVideo
   4141         CheckInputEvents
   4142         CheckPTHREAD
   4143 
   4144         # Set up files for the timer library
   4145         if test x$enable_timers = xyes; then
   4146             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
   4147             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   4148             have_timers=yes
   4149         fi
   4150 
   4151         if test x$enable_filesystem = xyes; then
   4152             AC_DEFINE(SDL_FILESYSTEM_NACL, 1, [ ])
   4153             SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c"
   4154             have_filesystem=yes
   4155         fi
   4156         ;;
   4157     *-*-emscripten* )
   4158         if test x$enable_video = xyes; then
   4159             AC_DEFINE(SDL_VIDEO_DRIVER_EMSCRIPTEN, 1, [ ])
   4160             SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c"
   4161             have_video=yes
   4162             SUMMARY_video="${SUMMARY_video} emscripten"
   4163         fi
   4164 
   4165         if test x$enable_audio = xyes; then
   4166             AC_DEFINE(SDL_AUDIO_DRIVER_EMSCRIPTEN, 1, [ ])
   4167             SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c"
   4168             have_audio=yes
   4169             SUMMARY_audio="${SUMMARY_audio} emscripten"
   4170         fi
   4171 
   4172         CheckVisibilityHidden
   4173         CheckDeclarationAfterStatement
   4174         CheckDummyVideo
   4175         CheckDiskAudio
   4176         CheckDummyAudio
   4177         CheckDLOPEN
   4178         CheckClockGettime
   4179         CheckEmscriptenGLES
   4180 
   4181          # Set up files for the power library
   4182         if test x$enable_power = xyes; then
   4183             AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ])
   4184             SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c"
   4185             have_power=yes
   4186         fi
   4187 
   4188         # Set up files for the power library
   4189         if test x$enable_joystick = xyes; then
   4190             AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ])
   4191             SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c"
   4192             have_joystick=yes
   4193         fi
   4194 
   4195         # Set up files for the filesystem library
   4196         if test x$enable_filesystem = xyes; then
   4197             AC_DEFINE(SDL_FILESYSTEM_EMSCRIPTEN, 1, [ ])
   4198             SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c"
   4199             have_filesystem=yes
   4200         fi
   4201         # Set up files for the timer library
   4202         if test x$enable_timers = xyes; then
   4203             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
   4204             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   4205             have_timers=yes
   4206         fi
   4207         # Set up files for the locale library
   4208         SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
   4209         have_locale=yes
   4210         ;;
   4211     *-*-riscos*)
   4212         ARCH=riscos
   4213         CheckVisibilityHidden
   4214         CheckDeclarationAfterStatement
   4215         CheckDummyVideo
   4216         CheckDiskAudio
   4217         CheckDummyAudio
   4218         CheckDLOPEN
   4219         CheckOSS
   4220         CheckPTHREAD
   4221         CheckClockGettime
   4222 
   4223         SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c"
   4224         have_misc=yes
   4225 
   4226         # Set up files for the timer library
   4227         if test x$enable_timers = xyes; then
   4228             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
   4229             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
   4230             have_timers=yes
   4231         fi
   4232         ;;
   4233     *)
   4234         AC_MSG_ERROR([
   4235 *** Unsupported host:  Please add to configure.ac
   4236         ])
   4237         ;;
   4238 esac
   4239 
   4240 dnl Permit use of virtual joystick APIs on any platform (subject to configure options)
   4241 CheckVirtualJoystick
   4242 
   4243 # Check whether to install sdl2-config
   4244 AC_MSG_CHECKING(whether to install sdl2-config)
   4245 AC_ARG_ENABLE([sdl2-config],
   4246     AS_HELP_STRING([--enable-sdl2-config], [Install sdl2-config [default=yes]]),
   4247     [case "${enableval}" in
   4248         yes) enable_sdl2_config="TRUE" ;;
   4249         no) enable_sdl2_config="FALSE" ;;
   4250         *) AC_MSG_ERROR([bad value '${enableval}' for --enable-sdl2-config]) ;;
   4251     esac], [enable_sdl2_config="TRUE"])
   4252 if test "$enable_sdl2_config" = "TRUE"; then
   4253     AC_MSG_RESULT(yes)
   4254 else
   4255     AC_MSG_RESULT(no)
   4256 fi
   4257 AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config])
   4258 
   4259 # Verify that we have all the platform specific files we need
   4260 
   4261 if test x$have_misc != xyes; then
   4262     SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c"
   4263 fi
   4264 if test x$have_locale != xyes; then
   4265     SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
   4266 fi
   4267 if test x$have_joystick != xyes; then
   4268     if test x$enable_joystick = xyes; then
   4269         AC_DEFINE(SDL_JOYSTICK_DUMMY, 1, [ ])
   4270     fi
   4271     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
   4272 fi
   4273 if test x$have_haptic != xyes; then
   4274     if test x$enable_haptic = xyes; then
   4275         AC_DEFINE(SDL_HAPTIC_DUMMY, 1, [ ])
   4276     fi
   4277     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
   4278 fi
   4279 if test x$have_sensor != xyes; then
   4280     if test x$enable_sensor = xyes; then
   4281         AC_DEFINE(SDL_SENSOR_DUMMY, 1, [ ])
   4282     fi
   4283     SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c"
   4284 fi
   4285 if test x$have_threads != xyes; then
   4286     if test x$enable_threads = xyes; then
   4287         AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
   4288     fi
   4289     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
   4290 fi
   4291 if test x$have_timers != xyes; then
   4292     if test x$enable_timers = xyes; then
   4293         AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
   4294     fi
   4295     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
   4296 fi
   4297 if test x$have_filesystem != xyes; then
   4298     if test x$enable_filesystem = xyes; then
   4299         AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
   4300     fi
   4301     SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
   4302 fi
   4303 if test x$have_loadso != xyes; then
   4304     if test x$enable_loadso = xyes; then
   4305         AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
   4306     fi
   4307     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
   4308 fi
   4309 if test x$SDLMAIN_SOURCES = x; then
   4310     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
   4311 fi
   4312 SDLTEST_SOURCES="$srcdir/src/test/*.c"
   4313 
   4314 if test x$video_wayland = xyes; then
   4315     WAYLAND_PROTOCOLS=`cd $srcdir/wayland-protocols ; for p in *.xml ; do echo -n "\$p" |sed 's,\\.xml\$, ,g' ; done`
   4316     WAYLAND_PROTOCOLS_SOURCES=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-protocol.c " ; done`
   4317     WAYLAND_PROTOCOLS_HEADERS=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-client-protocol.h " ; done`
   4318     GEN_SOURCES="$GEN_SOURCES $WAYLAND_PROTOCOLS_SOURCES"
   4319     GEN_HEADERS="$GEN_HEADERS $WAYLAND_PROTOCOLS_HEADERS"
   4320 
   4321     WAYLAND_PROTOCOLS_DEPENDS=`for p in $WAYLAND_PROTOCOLS ; do\
   4322         echo ;\
   4323         echo "\\$(gen)/\$p-client-protocol.h: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
   4324         echo "	@\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
   4325         echo "	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@" ;\
   4326         echo ;\
   4327         echo "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
   4328         echo "	@\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
   4329         echo "	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@" ;\
   4330         echo ;\
   4331         echo "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\
   4332         echo "	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\
   4333         done ;\
   4334         echo ;\
   4335         for s in $WAYLAND_SOURCES ; do echo -n "\$s:" ; for p in $WAYLAND_PROTOCOLS ; do echo -n " \\$(gen)/\$p-client-protocol.h" ; done ; echo ; done ; echo`
   4336 fi
   4337 
   4338 OBJECTS=`echo $SOURCES`
   4339 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
   4340 for EXT in asm cc m c S; do
   4341     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
   4342     DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
   4343 \\$(objects)/\\2.lo: \\1/\\2.$EXT \\$(objects)/.created\\\\
   4344 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
   4345 done
   4346 
   4347 GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   4348 
   4349 VERSION_OBJECTS=`echo $VERSION_SOURCES`
   4350 VERSION_DEPENDS=`echo $VERSION_SOURCES`
   4351 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.lo,g'`
   4352 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
   4353 \\$(objects)/\\2.lo: \\1/\\2.rc \\$(objects)/.created\\\\
   4354 	\\$(RUN_CMD_RC)\\$(LIBTOOL) --mode=compile --tag=RC \\$(RC) -i \\$< -o \\$@,g"`
   4355 
   4356 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
   4357 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
   4358 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   4359 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
   4360 \\$(objects)/\\2.lo: \\1/\\2.c \\$(objects)/.created\\\\
   4361 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
   4362 
   4363 SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
   4364 SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
   4365 SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   4366 SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
   4367 \\$(objects)/\\2.lo: \\1/\\2.c \\$(objects)/.created\\\\
   4368 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
   4369 
   4370 # Set runtime shared library paths as needed
   4371 
   4372 if test "x$enable_rpath" = "xyes" -a "x$enable_shared" = "xyes"; then
   4373   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
   4374     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
   4375 
   4376     AC_MSG_CHECKING(for linker option --enable-new-dtags)
   4377     have_enable_new_dtags=no
   4378     save_LDFLAGS="$LDFLAGS"
   4379     LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
   4380     AC_TRY_LINK([
   4381     ],[
   4382     ],[
   4383     have_enable_new_dtags=yes
   4384     SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
   4385     ])
   4386     LDFLAGS="$save_LDFLAGS"
   4387     AC_MSG_RESULT($have_enable_new_dtags)
   4388   fi
   4389   if test $ARCH = solaris; then
   4390     SDL_RLD_FLAGS="-R\${libdir}"
   4391   fi
   4392 else
   4393   SDL_RLD_FLAGS=""
   4394 fi
   4395 
   4396 SDL_STATIC_LIBS="$EXTRA_LDFLAGS"
   4397 
   4398 dnl Expand the cflags and libraries needed by apps using SDL
   4399 AC_SUBST(SDL_CFLAGS)
   4400 AC_SUBST(SDL_LIBS)
   4401 AC_SUBST(SDL_STATIC_LIBS)
   4402 AC_SUBST(SDL_RLD_FLAGS)
   4403 if test x$enable_shared = xyes; then
   4404     PKG_CONFIG_LIBS_PRIV="
   4405 Libs.private:"
   4406     ENABLE_SHARED_TRUE=
   4407     ENABLE_SHARED_FALSE="#"
   4408 else
   4409     PKG_CONFIG_LIBS_PRIV=
   4410     ENABLE_SHARED_TRUE="#"
   4411     ENABLE_SHARED_FALSE=
   4412 fi
   4413 if test x$enable_static = xyes; then
   4414     ENABLE_STATIC_TRUE=
   4415     ENABLE_STATIC_FALSE="#"
   4416 else
   4417     ENABLE_STATIC_TRUE="#"
   4418     ENABLE_STATIC_FALSE=
   4419 fi
   4420 AC_SUBST(PKG_CONFIG_LIBS_PRIV)
   4421 AC_SUBST(ENABLE_SHARED_TRUE)
   4422 AC_SUBST(ENABLE_SHARED_FALSE)
   4423 AC_SUBST(ENABLE_STATIC_TRUE)
   4424 AC_SUBST(ENABLE_STATIC_FALSE)
   4425 
   4426 dnl Expand the sources and objects needed to build the library
   4427 AC_SUBST(ac_aux_dir)
   4428 AC_SUBST(INCLUDE)
   4429 AC_SUBST(OBJECTS)
   4430 AC_SUBST(GEN_HEADERS)
   4431 AC_SUBST(GEN_OBJECTS)
   4432 AC_SUBST(VERSION_OBJECTS)
   4433 AC_SUBST(SDLMAIN_OBJECTS)
   4434 AC_SUBST(SDLTEST_OBJECTS)
   4435 AC_SUBST(BUILD_CFLAGS)
   4436 AC_SUBST(EXTRA_CFLAGS)
   4437 AC_SUBST(BUILD_LDFLAGS)
   4438 AC_SUBST(EXTRA_LDFLAGS)
   4439 AC_SUBST(WAYLAND_SCANNER)
   4440 
   4441 cat >Makefile.rules <<__EOF__
   4442 
   4443 # Build rules for objects
   4444 -include \$(OBJECTS:.lo=.d)
   4445 
   4446 # Special dependency for SDL.c, since it depends on SDL_revision.h
   4447 $srcdir/src/SDL.c: update-revision
   4448 $DEPENDS
   4449 $VERSION_DEPENDS
   4450 $SDLMAIN_DEPENDS
   4451 $SDLTEST_DEPENDS
   4452 $WAYLAND_PROTOCOLS_DEPENDS
   4453 __EOF__
   4454 
   4455 AC_CONFIG_FILES([
   4456     Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake sdl2-config-version.cmake SDL2.spec sdl2.pc
   4457 ])
   4458 AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])
   4459 
   4460 SUMMARY="SDL2 Configure Summary:\n"
   4461 if test x$enable_shared = xyes; then
   4462     SUMMARY="${SUMMARY}Building Shared Libraries\n"
   4463 fi
   4464 if test x$enable_static = xyes; then
   4465     SUMMARY="${SUMMARY}Building Static Libraries\n"
   4466 fi
   4467 SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n"
   4468 SUMMARY="${SUMMARY}Assembly Math   :${SUMMARY_math}\n" 
   4469 SUMMARY="${SUMMARY}Audio drivers   :${SUMMARY_audio}\n"
   4470 SUMMARY="${SUMMARY}Video drivers   :${SUMMARY_video}\n"
   4471 if test x$have_x = xyes; then
   4472     SUMMARY="${SUMMARY}X11 libraries   :${SUMMARY_video_x11}\n"
   4473 fi
   4474 SUMMARY="${SUMMARY}Input drivers   :${SUMMARY_input}\n"
   4475 if test x$have_joystick_virtual = xyes; then
   4476     SUMMARY="${SUMMARY}Enable virtual joystick APIs : YES\n"
   4477 else
   4478     SUMMARY="${SUMMARY}Enable virtual joystick APIs : NO\n"
   4479 fi
   4480 if test x$have_samplerate_h_hdr = xyes; then
   4481     SUMMARY="${SUMMARY}Using libsamplerate : YES\n"
   4482 else
   4483     SUMMARY="${SUMMARY}Using libsamplerate : NO\n"
   4484 fi
   4485 if test x$have_libudev_h_hdr = xyes; then
   4486     SUMMARY="${SUMMARY}Using libudev       : YES\n"
   4487 else
   4488     SUMMARY="${SUMMARY}Using libudev       : NO\n"
   4489 fi
   4490 if test x$have_dbus_dbus_h_hdr = xyes; then
   4491     SUMMARY="${SUMMARY}Using dbus          : YES\n"
   4492 else
   4493     SUMMARY="${SUMMARY}Using dbus          : NO\n"
   4494 fi
   4495 if test x$enable_ime = xyes; then
   4496     SUMMARY="${SUMMARY}Using ime           : YES\n"
   4497 else
   4498     SUMMARY="${SUMMARY}Using ime           : NO\n"
   4499 fi
   4500 if test x$have_ibus_ibus_h_hdr = xyes; then
   4501     SUMMARY="${SUMMARY}Using ibus          : YES\n"
   4502 else
   4503     SUMMARY="${SUMMARY}Using ibus          : NO\n"
   4504 fi
   4505 if test x$have_fcitx = xyes; then
   4506     SUMMARY="${SUMMARY}Using fcitx         : YES\n"
   4507 else
   4508     SUMMARY="${SUMMARY}Using fcitx         : NO\n"
   4509 fi
   4510 
   4511 if test x$WARN_ABOUT_ARM_SIMD_ASM_MIT = xyes; then
   4512     SUMMARY="${SUMMARY}\nSDL is being built with ARM SIMD optimizations, which\n"
   4513     SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
   4514     SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
   4515     SUMMARY="${SUMMARY}configure script with:\n"
   4516     SUMMARY="${SUMMARY}\n    --disable-arm-simd\n"
   4517 fi
   4518 
   4519 if test x$WARN_ABOUT_ARM_NEON_ASM_MIT = xyes; then
   4520     SUMMARY="${SUMMARY}\nSDL is being built with ARM NEON optimizations, which\n"
   4521     SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
   4522     SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
   4523     SUMMARY="${SUMMARY}configure script with:\n"
   4524     SUMMARY="${SUMMARY}\n    --disable-arm-neon\n"
   4525 fi
   4526 
   4527 AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
   4528 
   4529 AC_OUTPUT