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