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