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