configure.in
author Sam Lantinga <slouken@libsdl.org>
Fri, 02 Nov 2018 18:07:11 -0700
changeset 12390 60f322c5984f
parent 12258 231245d461a2
child 12391 ca6e41ade79a
permissions -rw-r--r--
Fixed bug 4308 - Prebuilt SDL.dll files not compiled with ASLR support (DYNAMICBASE)

Cameron Gutman

The current SDL 2.0.8 and the prerelease SDL 2.0.9 are compiled without the DYNAMICBASE flag to indicate that ASLR may relocate the DLL at load-time. https://docs.microsoft.com/en-us/cpp/build/reference/dynamicbase-use-address-space-layout-randomization?view=vs-2017

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