configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 07 Nov 2018 07:38:11 -0800
changeset 12402 3b5b4eb1927f
parent 12391 ca6e41ade79a
child 12429 682d6359c430
permissions -rw-r--r--
The Debian maintainers aren't using these rules, so enable dynamic loading of shared libraries by default for the Steam Linux Runtime
     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 
  1532 dnl Check for Native Client stuff
  1533 CheckNativeClient()
  1534 {
  1535         AC_TRY_COMPILE([
  1536           #if !defined(__native_client__)
  1537           #error "NO NACL"
  1538           #endif
  1539         ],[
  1540         ],[
  1541         AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ])
  1542         AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ])
  1543         AC_DEFINE(HAVE_POW, 1, [ ])
  1544         AC_DEFINE(HAVE_OPENGLES2, 1, [ ])
  1545         AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1546         AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1547 
  1548         SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS"
  1549 
  1550         SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
  1551         SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
  1552         SUMMARY_audio="${SUMMARY_audio} nacl"
  1553         SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
  1554         SUMMARY_video="${SUMMARY_video} nacl opengles2"
  1555         ])
  1556 }
  1557 
  1558 
  1559 CheckRPI()
  1560 {
  1561     AC_ARG_ENABLE(video-rpi,
  1562 AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
  1563                   , enable_video_rpi=yes)
  1564     if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
  1565         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1566         if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then
  1567             RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl`
  1568             RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl`
  1569         elif test x$ARCH = xnetbsd; then
  1570             RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
  1571             RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
  1572         else
  1573             RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
  1574             RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
  1575         fi
  1576 
  1577         # Save the original compiler flags and libraries
  1578         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1579 
  1580         # Add the Raspberry Pi compiler flags and libraries
  1581         CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
  1582 
  1583         AC_MSG_CHECKING(for Raspberry Pi)
  1584         have_video_rpi=no
  1585         AC_TRY_LINK([
  1586           #include <bcm_host.h>
  1587         ],[
  1588           bcm_host_init();
  1589         ],[
  1590         have_video_rpi=yes
  1591         ],[
  1592         ])
  1593         AC_MSG_RESULT($have_video_rpi)
  1594 
  1595         # Restore the compiler flags and libraries
  1596         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1597         
  1598         if test x$have_video_rpi = xyes; then
  1599             CFLAGS="$CFLAGS $RPI_CFLAGS"
  1600             SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
  1601             EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
  1602             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
  1603             SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
  1604             AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
  1605             SUMMARY_video="${SUMMARY_video} rpi"
  1606         fi
  1607     fi
  1608 }
  1609 
  1610 dnl Find the X11 include and library directories
  1611 CheckX11()
  1612 {
  1613     AC_ARG_ENABLE(video-x11,
  1614 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
  1615                   , enable_video_x11=yes)
  1616     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1617         case "$host" in
  1618             *-*-darwin*)
  1619                 # This isn't necessary for X11, but fixes GLX detection
  1620                 if test "x$x_includes" = xNONE && \
  1621                    test "x$x_libraries" = xNONE && \
  1622                    test -d /usr/X11R6/include && \
  1623                    test -d /usr/X11R6/lib; then
  1624                     x_includes="/usr/X11R6/include"
  1625                     x_libraries="/usr/X11R6/lib"
  1626                 fi
  1627                 ;;
  1628         esac
  1629         AC_PATH_X
  1630         AC_PATH_XTRA
  1631         if test x$have_x = xyes; then
  1632             AC_ARG_ENABLE(x11-shared,
  1633 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
  1634                           , enable_x11_shared=maybe)
  1635 
  1636             case "$host" in
  1637                 *-*-darwin*)
  1638                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
  1639                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
  1640                     xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
  1641                     xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
  1642                     xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1643                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1644                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1645                     xss_lib='/usr/X11R6/lib/libXss.1.dylib'
  1646                     xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
  1647                     ;;
  1648                 *-*-openbsd*)
  1649                     x11_lib='libX11.so'
  1650                     x11ext_lib='libXext.so'
  1651                     xcursor_lib='libXcursor.so'
  1652                     xinerama_lib='libXinerama.so'
  1653                     xinput_lib='libXi.so'
  1654                     xrandr_lib='libXrandr.so'
  1655                     xrender_lib='libXrender.so'
  1656                     xss_lib='libXss.so'
  1657                     xvidmode_lib='libXxf86vm.so'
  1658                     ;;
  1659                 *)
  1660                     x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1661                     x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1662                     xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1663                     xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1664                     xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1665                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1666                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1667                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1668                     xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1669                     ;;
  1670             esac
  1671 
  1672             if test x$ac_cv_func_shmat != xyes; then
  1673                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1674             fi
  1675             CFLAGS="$CFLAGS $X_CFLAGS"
  1676             LDFLAGS="$LDFLAGS $X_LIBS"
  1677 
  1678             AC_CHECK_HEADER(X11/extensions/Xext.h,
  1679                             have_xext_h_hdr=yes,
  1680                             have_xext_h_hdr=no,
  1681                             [#include <X11/Xlib.h>
  1682                              #include <X11/Xproto.h>
  1683                             ])
  1684             if test x$have_xext_h_hdr != xyes; then
  1685                AC_MSG_ERROR([
  1686 *** Missing Xext.h, maybe you need to install the libxext-dev package?
  1687                ])
  1688             fi
  1689 
  1690             AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
  1691             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1692             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1693 
  1694             # Needed so SDL applications can include SDL_syswm.h
  1695             SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
  1696 
  1697             if test x$enable_x11_shared = xmaybe; then
  1698                 enable_x11_shared=yes
  1699             fi
  1700             if test x$have_loadso != xyes && \
  1701                test x$enable_x11_shared = xyes; then
  1702                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1703                 enable_x11_shared=no
  1704             fi
  1705             if test x$have_loadso = xyes && \
  1706                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1707                 echo "-- dynamic libX11 -> $x11_lib"
  1708                 echo "-- dynamic libX11ext -> $x11ext_lib"
  1709                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
  1710                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
  1711                 SUMMARY_video="${SUMMARY_video} x11(dynamic)"
  1712             else
  1713                 enable_x11_shared=no
  1714                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1715                 SUMMARY_video="${SUMMARY_video} x11"
  1716             fi
  1717             have_video=yes
  1718 
  1719             AC_MSG_CHECKING(for const parameter to XextAddDisplay)
  1720             have_const_param_XextAddDisplay=no
  1721             AC_TRY_COMPILE([
  1722               #include <X11/Xlib.h>
  1723               #include <X11/Xproto.h>
  1724               #include <X11/extensions/Xext.h>
  1725               #include <X11/extensions/extutil.h>
  1726               extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
  1727             ],[
  1728             ],[
  1729             have_const_param_XextAddDisplay=yes
  1730             AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ])
  1731             ])
  1732             AC_MSG_RESULT($have_const_param_XextAddDisplay)
  1733 
  1734             dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
  1735             AC_MSG_CHECKING([for XGenericEvent])
  1736             have_XGenericEvent=no
  1737             AC_TRY_COMPILE([
  1738                 #include <X11/Xlib.h>
  1739             ],[
  1740 Display *display;
  1741 XEvent event;
  1742 XGenericEventCookie *cookie = &event.xcookie;
  1743 XNextEvent(display, &event);
  1744 XGetEventData(display, cookie);
  1745 XFreeEventData(display, cookie);
  1746             ],[
  1747                 have_XGenericEvent=yes
  1748                 AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ])
  1749             ])
  1750             AC_MSG_RESULT($have_XGenericEvent)
  1751 
  1752             AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
  1753 
  1754             AC_ARG_ENABLE(video-x11-xcursor,
  1755 AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
  1756                             , enable_video_x11_xcursor=yes)
  1757             if test x$enable_video_x11_xcursor = xyes; then
  1758                 definitely_enable_video_x11_xcursor=no
  1759                 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
  1760                                 have_xcursor_h_hdr=yes,
  1761                                 have_xcursor_h_hdr=no,
  1762                                 [#include <X11/Xlib.h>
  1763                                 ])
  1764                 if test x$have_xcursor_h_hdr = xyes; then
  1765                     if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
  1766                         echo "-- dynamic libXcursor -> $xcursor_lib"
  1767                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
  1768                         definitely_enable_video_x11_xcursor=yes
  1769                     else
  1770                         AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
  1771                         if test x$have_xcursor_lib = xyes ; then
  1772                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
  1773                             definitely_enable_video_x11_xcursor=yes
  1774                         fi
  1775                     fi
  1776                 fi
  1777             fi
  1778             if test x$definitely_enable_video_x11_xcursor = xyes; then
  1779                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
  1780                 SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
  1781             fi
  1782             AC_ARG_ENABLE(video-x11-xdbe,
  1783 AC_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]),
  1784                             , enable_video_x11_xdbe=yes)
  1785             if test x$enable_video_x11_xdbe = xyes; then
  1786                 AC_CHECK_HEADER(X11/extensions/Xdbe.h,
  1787                                 have_dbe_h_hdr=yes,
  1788                                 have_dbe_h_hdr=no,
  1789                                 [#include <X11/Xlib.h>
  1790                                 ])
  1791                 if test x$have_dbe_h_hdr = xyes; then
  1792                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ])
  1793                     SUMMARY_video_x11="${SUMMARY_video_x11} xdbe"
  1794                 fi
  1795             fi
  1796             AC_ARG_ENABLE(video-x11-xinerama,
  1797 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1798                             , enable_video_x11_xinerama=yes)
  1799             if test x$enable_video_x11_xinerama = xyes; then
  1800                 definitely_enable_video_x11_xinerama=no
  1801                 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
  1802                                 have_xinerama_h_hdr=yes,
  1803                                 have_xinerama_h_hdr=no,
  1804                                 [#include <X11/Xlib.h>
  1805                                 ])
  1806                 if test x$have_xinerama_h_hdr = xyes; then
  1807                     if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
  1808                         echo "-- dynamic libXinerama -> $xinerama_lib"
  1809                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
  1810                         definitely_enable_video_x11_xinerama=yes
  1811                     else
  1812                         AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
  1813                         if test x$have_xinerama_lib = xyes ; then
  1814                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
  1815                             definitely_enable_video_x11_xinerama=yes
  1816                         fi
  1817                     fi
  1818                 fi
  1819             fi
  1820             if test x$definitely_enable_video_x11_xinerama = xyes; then
  1821                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
  1822                 SUMMARY_video_x11="${SUMMARY_video_x11} xinerama"
  1823             fi
  1824             AC_ARG_ENABLE(video-x11-xinput,
  1825 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1826                             , enable_video_x11_xinput=yes)
  1827             if test x$enable_video_x11_xinput = xyes; then
  1828                 definitely_enable_video_x11_xinput=no
  1829                 AC_CHECK_HEADER(X11/extensions/XInput2.h,
  1830                                 have_xinput_h_hdr=yes,
  1831                                 have_xinput_h_hdr=no,
  1832                                 [#include <X11/Xlib.h>
  1833                                 ])
  1834                 if test x$have_xinput_h_hdr = xyes; then
  1835                     if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1836                         echo "-- dynamic libXi -> $xinput_lib"
  1837                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
  1838                         definitely_enable_video_x11_xinput=yes
  1839                     else
  1840                         AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1841                         if test x$have_xinput_lib = xyes ; then
  1842                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1843                             definitely_enable_video_x11_xinput=yes
  1844                         fi
  1845                     fi
  1846                 fi
  1847             fi
  1848             if test x$definitely_enable_video_x11_xinput = xyes; then
  1849                 SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
  1850                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
  1851                 AC_MSG_CHECKING(for xinput2 multitouch)
  1852                 have_xinput2_multitouch=no
  1853                 AC_TRY_COMPILE([
  1854                     #include <X11/Xlib.h>
  1855                     #include <X11/Xproto.h>
  1856                     #include <X11/extensions/XInput2.h>
  1857                     ],[
  1858 int event_type = XI_TouchBegin;
  1859 XITouchClassInfo *t;
  1860                     ],[
  1861                     have_xinput2_multitouch=yes
  1862                     AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [])
  1863                     SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
  1864                     ])
  1865                 AC_MSG_RESULT($have_xinput2_multitouch)
  1866             fi
  1867             AC_ARG_ENABLE(video-x11-xrandr,
  1868 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1869                             , enable_video_x11_xrandr=yes)
  1870             if test x$enable_video_x11_xrandr = xyes; then
  1871                 dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
  1872                 definitely_enable_video_x11_xrandr=no
  1873                 have_xrandr_h_hdr=no
  1874                 AC_TRY_COMPILE([
  1875                 #include <X11/Xlib.h>
  1876                 #include <X11/extensions/Xrandr.h>
  1877                 ],[
  1878                 XRRScreenResources *res = NULL;
  1879                 ],[
  1880                 have_xrandr_h_hdr=yes
  1881                 ])
  1882                 if test x$have_xrandr_h_hdr = xyes; then
  1883                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1884                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1885                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
  1886                         definitely_enable_video_x11_xrandr=yes
  1887                     else
  1888                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1889                         if test x$have_xrandr_lib = xyes ; then
  1890                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1891                             definitely_enable_video_x11_xrandr=yes
  1892                         fi
  1893                     fi
  1894                 fi
  1895             fi
  1896             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1897                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
  1898                 SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
  1899             fi
  1900             AC_ARG_ENABLE(video-x11-scrnsaver,
  1901 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1902                             , enable_video_x11_scrnsaver=yes)
  1903             if test x$enable_video_x11_scrnsaver = xyes; then
  1904                 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1905                                 have_scrnsaver_h_hdr=yes,
  1906                                 have_scrnsaver_h_hdr=no,
  1907                                 [#include <X11/Xlib.h>
  1908                                 ])
  1909                 if test x$have_scrnsaver_h_hdr = xyes; then
  1910                     if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1911                         echo "-- dynamic libXss -> $xss_lib"
  1912                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
  1913                         definitely_enable_video_x11_scrnsaver=yes
  1914                     else
  1915                         AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1916                         if test x$have_xss_lib = xyes ; then
  1917                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1918                             definitely_enable_video_x11_scrnsaver=yes
  1919                         fi
  1920                     fi
  1921                 fi
  1922             fi
  1923             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1924                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
  1925                 SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
  1926             fi
  1927             AC_ARG_ENABLE(video-x11-xshape,
  1928 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
  1929                             , enable_video_x11_xshape=yes)
  1930             if test x$enable_video_x11_xshape = xyes; then
  1931                 AC_CHECK_HEADER(X11/extensions/shape.h,
  1932                                 have_shape_h_hdr=yes,
  1933                                 have_shape_h_hdr=no,
  1934                                 [#include <X11/Xlib.h>
  1935                                 ])
  1936                 if test x$have_shape_h_hdr = xyes; then
  1937                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
  1938                     SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
  1939                 fi
  1940             fi
  1941             AC_ARG_ENABLE(video-x11-vm,
  1942 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1943                             , enable_video_x11_vm=yes)
  1944             if test x$enable_video_x11_vm = xyes; then
  1945                 definitely_enable_video_x11_vm=no
  1946                 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
  1947                                 have_vm_h_hdr=yes,
  1948                                 have_vm_h_hdr=no,
  1949                                 [#include <X11/Xlib.h>
  1950                                 ])
  1951                 if test x$have_vm_h_hdr = xyes; then
  1952                     if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
  1953                         echo "-- dynamic libXxf86vm -> $xvidmode_lib"
  1954                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
  1955                         definitely_enable_video_x11_vm=yes
  1956                     else
  1957                         AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
  1958                         if test x$have_vm_lib = xyes ; then
  1959                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
  1960                             definitely_enable_video_x11_vm=yes
  1961                         fi
  1962                     fi
  1963                 fi
  1964             fi
  1965             if test x$definitely_enable_video_x11_vm = xyes; then
  1966                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
  1967                 SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
  1968             fi
  1969         fi
  1970     fi
  1971 }
  1972 
  1973 dnl Set up the Vivante video driver if enabled
  1974 CheckVivanteVideo()
  1975 {
  1976     AC_ARG_ENABLE(video-vivante,
  1977 AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]),
  1978                   , enable_video_vivante=yes)
  1979     if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then
  1980         AC_MSG_CHECKING(for Vivante VDK API)
  1981         have_vivante_vdk=no
  1982         AC_TRY_COMPILE([
  1983           #define LINUX
  1984           #define EGL_API_FB
  1985           #include <gc_vdk.h>
  1986         ],[
  1987         ],[
  1988         have_vivante_vdk=yes
  1989         ])
  1990         AC_MSG_RESULT($have_vivante_vdk)
  1991 
  1992         AC_MSG_CHECKING(for Vivante FB API)
  1993         have_vivante_egl=no
  1994         AC_TRY_COMPILE([
  1995           #define LINUX
  1996           #define EGL_API_FB
  1997           #include <EGL/eglvivante.h>
  1998         ],[
  1999         ],[
  2000         have_vivante_egl=yes
  2001         ])
  2002         AC_MSG_RESULT($have_vivante_egl)
  2003 
  2004         if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then
  2005             AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ])
  2006             EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
  2007             if test x$have_vivante_vdk = xyes; then
  2008                 AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ])
  2009                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK"
  2010             fi
  2011             SOURCES="$SOURCES $srcdir/src/video/vivante/*.c"
  2012             SUMMARY_video="${SUMMARY_video} vivante"
  2013             have_video=yes
  2014         fi
  2015     fi
  2016 }
  2017 
  2018 dnl Set up the Haiku video driver if enabled
  2019 CheckHaikuVideo()
  2020 {
  2021     if test x$enable_video = xyes; then
  2022         AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
  2023         SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
  2024         have_video=yes
  2025         SUMMARY_video="${SUMMARY_video} haiku"
  2026     fi
  2027 }
  2028 
  2029 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  2030 CheckCOCOA()
  2031 {
  2032     AC_ARG_ENABLE(video-cocoa,
  2033 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  2034                   , enable_video_cocoa=yes)
  2035     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2036         save_CFLAGS="$CFLAGS"
  2037         dnl Work around that we don't have Objective-C support in autoconf
  2038         CFLAGS="$CFLAGS -x objective-c"
  2039         AC_MSG_CHECKING(for Cocoa framework)
  2040         have_cocoa=no
  2041         AC_TRY_COMPILE([
  2042           #import <Cocoa/Cocoa.h>
  2043         ],[
  2044         ],[
  2045         have_cocoa=yes
  2046         ])
  2047         AC_MSG_RESULT($have_cocoa)
  2048         CFLAGS="$save_CFLAGS"
  2049         if test x$have_cocoa = xyes; then
  2050             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
  2051             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  2052             SUMMARY_video="${SUMMARY_video} cocoa"
  2053             have_video=yes
  2054         fi
  2055     fi
  2056 }
  2057 
  2058 CheckMETAL()
  2059 {
  2060     AC_ARG_ENABLE(render-metal,
  2061 AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]),
  2062                                 , enable_render_metal=yes)
  2063     if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
  2064         save_CFLAGS="$CFLAGS"
  2065         dnl Work around that we don't have Objective-C support in autoconf
  2066         CFLAGS="$CFLAGS -x objective-c"
  2067         AC_MSG_CHECKING(for Metal framework)
  2068         have_metal=no
  2069         AC_TRY_COMPILE([
  2070           #import <Cocoa/Cocoa.h>
  2071           #import <Metal/Metal.h>
  2072           #import <QuartzCore/CAMetalLayer.h>
  2073 
  2074           #if !TARGET_CPU_X86_64
  2075           #error Metal doesn't work on this configuration
  2076           #endif
  2077         ],[
  2078         ],[
  2079         have_metal=yes
  2080         ])
  2081         CFLAGS="$save_CFLAGS"
  2082         AC_MSG_RESULT($have_metal)
  2083         if test x$have_metal = xyes; then
  2084             AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
  2085             SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
  2086             SUMMARY_video="${SUMMARY_video} metal"
  2087         else
  2088             enable_render_metal=no
  2089         fi
  2090     fi
  2091 }
  2092 
  2093 
  2094 dnl Find DirectFB
  2095 CheckDirectFB()
  2096 {
  2097     AC_ARG_ENABLE(video-directfb,
  2098 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  2099                   , enable_video_directfb=no)
  2100     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  2101         video_directfb=no
  2102 
  2103         DIRECTFB_REQUIRED_VERSION=1.0.0
  2104         AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
  2105         if test x$DIRECTFBCONFIG = xno; then
  2106             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  2107             if test x$PKG_CONFIG != xno; then
  2108                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  2109                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  2110                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  2111                     DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
  2112                     video_directfb=yes
  2113                 fi
  2114             fi
  2115         else
  2116             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  2117             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  2118             set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
  2119             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  2120             if test $HAVE_VERSION -ge $NEED_VERSION; then
  2121                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  2122                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  2123                 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
  2124                 video_directfb=yes
  2125             fi
  2126         fi
  2127         if test x$video_directfb = xyes; then
  2128             # SuSE 11.1 installs directfb-config without directfb-devel
  2129             save_CPPFLAGS="$CPPFLAGS"
  2130             CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  2131             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  2132             CPPFLAGS="$save_CPPFLAGS"
  2133             video_directfb=$have_directfb_hdr
  2134         fi
  2135         AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  2136         AC_MSG_RESULT($video_directfb)
  2137 
  2138         if test x$video_directfb = xyes; then
  2139             AC_ARG_ENABLE(directfb-shared,
  2140 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  2141                               , enable_directfb_shared=yes)
  2142 
  2143             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
  2144             AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
  2145             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  2146             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  2147 
  2148             AC_MSG_CHECKING(for directfb dynamic loading support)
  2149             directfb_shared=no
  2150             directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`]
  2151             # | sed 's/.*\/\(.*\)/\1/; q'`]
  2152 AC_MSG_WARN("directfb $directfb_lib")
  2153             if test x$have_loadso != xyes && \
  2154                test x$enable_directfb_shared = xyes; then
  2155                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  2156             fi
  2157             if test x$have_loadso = xyes && \
  2158                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  2159                 directfb_shared=yes
  2160                 echo "-- $directfb_lib_spec -> $directfb_lib"
  2161                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
  2162                 SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
  2163             else
  2164                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  2165                 SUMMARY_video="${SUMMARY_video} directfb"
  2166             fi
  2167             AC_MSG_RESULT($directfb_shared)
  2168             SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
  2169             have_video=yes
  2170         fi
  2171     fi
  2172 }
  2173 
  2174 dnl Find KMSDRM
  2175 CheckKMSDRM()
  2176 {
  2177     AC_ARG_ENABLE(video-kmsdrm,
  2178 AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]),
  2179                   , enable_video_kmsdrm=no)
  2180 
  2181     if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
  2182         video_kmsdrm=no
  2183         libdrm_avail=no
  2184         libgbm_avail=no
  2185 
  2186         LIBDRM_REQUIRED_VERSION=2.4.46
  2187         LIBGBM_REQUIRED_VERSION=9.0.0
  2188 
  2189         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  2190         if test x$PKG_CONFIG != xno; then
  2191             if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then
  2192                 if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then
  2193                     LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm`
  2194                     LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm`
  2195                     LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm`
  2196                     libdrm_avail=yes
  2197                 fi
  2198                 if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then
  2199                     LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm`
  2200                     LIBGBM_LIBS=`$PKG_CONFIG --libs gbm`
  2201                     LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm`
  2202                     libgbm_avail=yes
  2203                 fi
  2204                 if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
  2205                     video_kmsdrm=yes
  2206                 fi
  2207  
  2208                 AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support)
  2209                 AC_MSG_RESULT($libdrm_avail)
  2210                 AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support)
  2211                 AC_MSG_RESULT($libgbm_avail)
  2212 
  2213                 if test x$video_kmsdrm = xyes; then
  2214                     AC_ARG_ENABLE(kmsdrm-shared,
  2215 AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]),
  2216                               , enable_kmsdrm_shared=yes)
  2217 
  2218                     AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
  2219                     SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
  2220                     EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
  2221 
  2222                     AC_MSG_CHECKING(for kmsdrm dynamic loading support)
  2223                     kmsdrm_shared=no
  2224                     drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
  2225                     gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
  2226                     if test x$have_loadso != xyes && \
  2227                        test x$enable_kmsdrm_shared = xyes; then
  2228                         AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
  2229                     fi
  2230                     if test x$have_loadso = xyes && \
  2231                        test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
  2232                         kmsdrm_shared=yes
  2233                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
  2234                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
  2235                         AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
  2236                         SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
  2237                     else
  2238                         EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
  2239                         SUMMARY_video="${SUMMARY_video} kmsdrm"
  2240                     fi
  2241                     AC_MSG_RESULT($kmsdrm_shared)
  2242                     have_video=yes
  2243                 fi
  2244             fi
  2245         fi
  2246     fi
  2247 }
  2248 
  2249 dnl rcg04172001 Set up the Null video driver.
  2250 CheckDummyVideo()
  2251 {
  2252     AC_ARG_ENABLE(video-dummy,
  2253 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  2254                   , enable_video_dummy=yes)
  2255     if test x$enable_video_dummy = xyes; then
  2256         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
  2257         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  2258         have_video=yes
  2259         SUMMARY_video="${SUMMARY_video} dummy"
  2260     fi
  2261 }
  2262 
  2263 dnl Set up the QNX video driver if enabled
  2264 CheckQNXVideo()
  2265 {
  2266     if test x$enable_video = xyes; then
  2267         AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
  2268         SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
  2269         have_video=yes
  2270         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
  2271         SUMMARY_video="${SUMMARY_video} qnx"
  2272     fi
  2273 }
  2274 
  2275 dnl Set up the QNX audio driver if enabled
  2276 CheckQNXAudio()
  2277 {
  2278     if test x$enable_audio = xyes; then
  2279         AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
  2280         SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
  2281         have_audio=yes
  2282         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2283         SUMMARY_audio="${SUMMARY_audio} qsa"
  2284     fi
  2285 }
  2286 
  2287 dnl Check to see if OpenGL support is desired
  2288 AC_ARG_ENABLE(video-opengl,
  2289 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  2290               , enable_video_opengl=yes)
  2291 
  2292 dnl Find OpenGL
  2293 CheckOpenGLX11()
  2294 {
  2295     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2296         AC_MSG_CHECKING(for OpenGL (GLX) support)
  2297         video_opengl=no
  2298         AC_TRY_COMPILE([
  2299          #include <GL/gl.h>
  2300          #include <GL/glx.h>
  2301         ],[
  2302         ],[
  2303         video_opengl=yes
  2304         ])
  2305         AC_MSG_RESULT($video_opengl)
  2306         if test x$video_opengl = xyes; then
  2307             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2308             AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
  2309             AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  2310             SUMMARY_video="${SUMMARY_video} opengl"
  2311         fi
  2312     fi
  2313 }
  2314 
  2315 dnl Check to see if OpenGL ES support is desired
  2316 AC_ARG_ENABLE(video-opengles,
  2317 AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
  2318               , enable_video_opengles=yes)
  2319 AC_ARG_ENABLE(video-opengles1,
  2320 AC_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]),
  2321               , enable_video_opengles1=yes)
  2322 AC_ARG_ENABLE(video-opengles2,
  2323 AC_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]),
  2324               , enable_video_opengles2=yes)
  2325 
  2326 dnl Find OpenGL ES
  2327 CheckOpenGLESX11()
  2328 {
  2329     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  2330         AC_MSG_CHECKING(for EGL support)
  2331         video_opengl_egl=no
  2332         AC_TRY_COMPILE([
  2333           #define LINUX
  2334           #define EGL_API_FB
  2335           #include <EGL/egl.h>
  2336           #include <EGL/eglext.h>
  2337         ],[
  2338         ],[
  2339         video_opengl_egl=yes
  2340         ])
  2341         AC_MSG_RESULT($video_opengl_egl)
  2342         if test x$video_opengl_egl = xyes; then
  2343             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  2344         fi
  2345             
  2346         if test x$enable_video_opengles1 = xyes; then
  2347             AC_MSG_CHECKING(for OpenGL ES v1 headers)
  2348             video_opengles_v1=no
  2349             AC_TRY_COMPILE([
  2350              #include <GLES/gl.h>
  2351              #include <GLES/glext.h>
  2352             ],[
  2353             ],[
  2354             video_opengles_v1=yes
  2355             ])
  2356             AC_MSG_RESULT($video_opengles_v1)
  2357             if test x$video_opengles_v1 = xyes; then
  2358                 AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  2359                 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  2360                 SUMMARY_video="${SUMMARY_video} opengl_es1"
  2361             fi
  2362         fi
  2363         
  2364         if test x$enable_video_opengles2 = xyes; then
  2365             AC_MSG_CHECKING(for OpenGL ES v2 headers)
  2366             video_opengles_v2=no
  2367             AC_TRY_COMPILE([
  2368              #include <GLES2/gl2.h>
  2369              #include <GLES2/gl2ext.h>
  2370             ],[
  2371             ],[
  2372             video_opengles_v2=yes
  2373             ])
  2374             AC_MSG_RESULT($video_opengles_v2)
  2375             if test x$video_opengles_v2 = xyes; then
  2376                 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  2377                 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  2378                 SUMMARY_video="${SUMMARY_video} opengl_es2"
  2379             fi
  2380         fi
  2381     fi
  2382 }
  2383 
  2384 dnl Check for Windows OpenGL
  2385 CheckWINDOWSGL()
  2386 {
  2387     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2388         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2389         AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
  2390         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  2391         SUMMARY_video="${SUMMARY_video} opengl"
  2392     fi
  2393 }
  2394 
  2395 dnl Check for Windows OpenGL
  2396 CheckWINDOWSGLES()
  2397 {
  2398     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  2399 
  2400         AC_MSG_CHECKING(for EGL support)
  2401         video_opengl_egl=no
  2402         AC_TRY_COMPILE([
  2403          #include <EGL/egl.h>
  2404         ],[
  2405         ],[
  2406         video_opengl_egl=yes
  2407         ])
  2408         AC_MSG_RESULT($video_opengl_egl)
  2409         if test x$video_opengl_egl = xyes; then
  2410             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2411             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  2412             SUMMARY_video="${SUMMARY_video} opengl_es1"
  2413         fi
  2414        
  2415         AC_MSG_CHECKING(for OpenGL ES v2 headers)
  2416         video_opengles_v2=no
  2417         AC_TRY_COMPILE([
  2418          #include <GLES2/gl2.h>
  2419          #include <GLES2/gl2ext.h>
  2420         ],[
  2421         ],[
  2422         video_opengles_v2=yes
  2423         ])
  2424         AC_MSG_RESULT($video_opengles_v2)
  2425         if test x$video_opengles_v2 = xyes; then
  2426             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2427             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  2428             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  2429             SUMMARY_video="${SUMMARY_video} opengl_es2"
  2430         fi
  2431     fi
  2432 }
  2433 
  2434 dnl Check for Haiku OpenGL
  2435 CheckHaikuGL()
  2436 {
  2437     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2438         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2439         AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
  2440         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  2441         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  2442         SUMMARY_video="${SUMMARY_video} opengl"
  2443     fi
  2444 }
  2445 
  2446 dnl Check for MacOS OpenGL
  2447 CheckMacGL()
  2448 {
  2449     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2450         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2451         AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
  2452         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  2453         SUMMARY_video="${SUMMARY_video} opengl"
  2454     fi
  2455 }
  2456 
  2457 dnl Check for MacOS OpenGLES
  2458 CheckMacGLES()
  2459 {
  2460     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  2461         video_opengl_egl=yes
  2462         AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  2463         video_opengles_v2=yes
  2464         AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  2465         AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  2466         SUMMARY_video="${SUMMARY_video} opengl_es2"
  2467     fi
  2468 }
  2469 
  2470 CheckEmscriptenGLES()
  2471 {
  2472     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  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_EGL, 1, [ ])
  2484         fi
  2485 
  2486         AC_MSG_CHECKING(for OpenGL ES v2 headers)
  2487         video_opengles_v2=no
  2488         AC_TRY_COMPILE([
  2489          #include <GLES2/gl2.h>
  2490          #include <GLES2/gl2ext.h>
  2491         ],[
  2492         ],[
  2493         video_opengles_v2=yes
  2494         ])
  2495         AC_MSG_RESULT($video_opengles_v2)
  2496         if test x$video_opengles_v2 = xyes; then
  2497             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  2498             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  2499             SUMMARY_video="${SUMMARY_video} opengl_es2"
  2500         fi
  2501     fi
  2502 }
  2503 
  2504 dnl Check to see if Vulkan support is desired
  2505 AC_ARG_ENABLE(video-vulkan,
  2506 AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
  2507               , enable_video_vulkan=yes)
  2508 
  2509 dnl Find Vulkan Header
  2510 CheckVulkan()
  2511 {
  2512     if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
  2513         case "$host" in
  2514             *-*-android*)
  2515                 AC_TRY_COMPILE([
  2516                   #if defined(__ARM_ARCH) && __ARM_ARCH < 7
  2517                   #error Vulkan doesn't work on this configuration
  2518                   #endif
  2519                 ],[
  2520                 ],[
  2521                 ],[
  2522                     enable_video_vulkan=no
  2523                 ])
  2524                 ;;
  2525             *-*-darwin*)
  2526                 save_CFLAGS="$CFLAGS"
  2527                 dnl Work around that we don't have Objective-C support in autoconf
  2528                 CFLAGS="$CFLAGS -x objective-c"
  2529                 AC_TRY_COMPILE([
  2530                   #include <Cocoa/Cocoa.h>
  2531                   #include <Metal/Metal.h>
  2532                   #include <QuartzCore/CAMetalLayer.h>
  2533 
  2534                   #if !TARGET_CPU_X86_64
  2535                   #error Vulkan doesn't work on this configuration
  2536                   #endif
  2537                 ],[
  2538                 ],[
  2539                 ],[
  2540                     enable_video_vulkan=no
  2541                 ])
  2542                 CFLAGS="$save_CFLAGS"
  2543                 ;;
  2544             *)
  2545                 ;;
  2546         esac
  2547         if test x$enable_video_vulkan = xno; then
  2548             # For reasons I am totally unable to see, I get an undefined macro error if
  2549             # I put this in the AC_TRY_COMPILE.
  2550             AC_MSG_WARN([Vulkan does not work on this configuration.])
  2551         fi
  2552     fi
  2553     if test x$enable_video_vulkan = xyes; then
  2554         AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
  2555         SUMMARY_video="${SUMMARY_video} vulkan"
  2556     fi
  2557 }
  2558 
  2559 dnl See if we can use the new unified event interface in Linux 2.4
  2560 CheckInputEvents()
  2561 {
  2562     dnl Check for Linux 2.4 unified input event interface support
  2563         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  2564         use_input_events=no
  2565         AC_TRY_COMPILE([
  2566           #include <linux/input.h>
  2567         ],[
  2568           #ifndef EVIOCGNAME
  2569           #error EVIOCGNAME() ioctl not available
  2570           #endif
  2571         ],[
  2572         use_input_events=yes
  2573         ])
  2574         AC_MSG_RESULT($use_input_events)
  2575         if test x$use_input_events = xyes; then
  2576             AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
  2577             SUMMARY_input="${SUMMARY_input} linuxev"
  2578         fi
  2579 }
  2580 
  2581 dnl See if we can use the kernel kd.h header
  2582 CheckInputKD()
  2583 {
  2584 
  2585     AC_MSG_CHECKING(for Linux kd.h)
  2586     use_input_kd=no
  2587     AC_TRY_COMPILE([
  2588       #include <linux/kd.h>
  2589       #include <linux/keyboard.h>
  2590     ],[
  2591         struct kbentry kbe;
  2592         kbe.kb_table = KG_CTRL;
  2593         ioctl(0, KDGKBENT, &kbe);
  2594     ],[
  2595     use_input_kd=yes
  2596     ])
  2597     AC_MSG_RESULT($use_input_kd)
  2598     if test x$use_input_kd = xyes; then
  2599         AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
  2600         SUMMARY_input="${SUMMARY_input} linuxkd"
  2601     fi
  2602 }
  2603 
  2604 dnl See if the platform offers libudev for device enumeration and hotplugging.
  2605 CheckLibUDev()
  2606 {
  2607     AC_ARG_ENABLE(libudev,
  2608 AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
  2609                         , enable_libudev=yes)
  2610     if test x$enable_libudev = xyes; then
  2611         AC_CHECK_HEADER(libudev.h,
  2612                         have_libudev_h_hdr=yes,
  2613                         have_libudev_h_hdr=no)
  2614         if test x$have_libudev_h_hdr = xyes; then
  2615             AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
  2616 
  2617             udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
  2618             if test x$udev_lib != x; then
  2619                 echo "-- dynamic udev -> $udev_lib"
  2620                 AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ])
  2621             fi
  2622         fi
  2623     fi
  2624 }
  2625 
  2626 dnl See if the platform offers libdbus for various IPC techniques.
  2627 CheckDBus()
  2628 {
  2629     AC_ARG_ENABLE(dbus,
  2630 AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
  2631                         , enable_dbus=yes)
  2632     if test x$enable_dbus = xyes; then
  2633         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  2634         if test x$PKG_CONFIG != xno; then
  2635             DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
  2636             save_CFLAGS="$CFLAGS"
  2637             CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
  2638             AC_CHECK_HEADER(dbus/dbus.h,
  2639                             have_dbus_dbus_h_hdr=yes,
  2640                             have_dbus_dbus_h_hdr=no)
  2641             CFLAGS="$save_CFLAGS"
  2642             if test x$have_dbus_dbus_h_hdr = xyes; then
  2643                 AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
  2644                 EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
  2645                 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
  2646             fi
  2647         fi
  2648     fi
  2649 }
  2650 
  2651 dnl See if the platform wanna IME support.
  2652 CheckIME()
  2653 {
  2654     AC_ARG_ENABLE(ime,
  2655 AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
  2656                   , enable_ime=yes)
  2657     if test x$enable_ime = xyes; then
  2658         AC_DEFINE(SDL_USE_IME, 1, [ ])
  2659             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
  2660     fi
  2661 }
  2662 
  2663 dnl See if the platform has libibus IME support.
  2664 CheckIBus()
  2665 {
  2666     AC_ARG_ENABLE(ibus,
  2667 AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
  2668                   , enable_ibus=yes)
  2669     if test x$enable_ibus = xyes; then
  2670         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  2671         if test x$PKG_CONFIG != xno; then
  2672             IBUS_CFLAGS=`$PKG_CONFIG --cflags ibus-1.0`
  2673             save_CFLAGS="$CFLAGS"
  2674             CFLAGS="$save_CFLAGS $IBUS_CFLAGS"
  2675             AC_CHECK_HEADER(ibus-1.0/ibus.h,
  2676                             have_ibus_ibus_h_hdr=yes,
  2677                             have_ibus_ibus_h_hdr=no)
  2678             AC_CHECK_HEADER(sys/inotify.h,
  2679                             have_inotify_inotify_h_hdr=yes,
  2680                             have_inotify_inotify_h_hdr=no)
  2681             CFLAGS="$save_CFLAGS"
  2682             if test x$have_ibus_ibus_h_hdr = xyes; then
  2683                 if test x$enable_ime != xyes; then
  2684                     AC_MSG_WARN([IME support is required for IBus.])
  2685                     have_ibus_ibus_h_hdr=no
  2686                 elif test x$enable_dbus != xyes; then
  2687                     AC_MSG_WARN([DBus support is required for IBus.])
  2688                     have_ibus_ibus_h_hdr=no
  2689                 elif test x$have_inotify_inotify_h_hdr != xyes; then
  2690                     AC_MSG_WARN([INotify support is required for IBus.])
  2691                     have_ibus_ibus_h_hdr=no
  2692                 else
  2693                     AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
  2694                     EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
  2695                     SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
  2696                fi
  2697             fi
  2698         fi
  2699     fi
  2700 }
  2701 
  2702 dnl See if the platform has fcitx IME support.
  2703 CheckFcitx()
  2704 {
  2705     AC_ARG_ENABLE(fcitx,
  2706 AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
  2707                   , enable_fcitx=yes)
  2708     if test x$enable_fcitx = xyes; then
  2709         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  2710         if test x$PKG_CONFIG != xno; then
  2711             FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
  2712             CFLAGS="$CFLAGS $FCITX_CFLAGS"
  2713             AC_CHECK_HEADER(fcitx/frontend.h,
  2714                             have_fcitx_frontend_h_hdr=yes,
  2715                             have_fcitx_frontend_h_hdr=no)
  2716             CFLAGS="$save_CFLAGS"
  2717             if test x$have_fcitx_frontend_h_hdr = xyes; then
  2718                 if test x$enable_ime != xyes; then
  2719                     AC_MSG_WARN([IME support is required for fcitx.])
  2720                     have_fcitx_frontend_h_hdr=no
  2721                 elif test x$enable_dbus != xyes; then
  2722                     AC_MSG_WARN([DBus support is required for fcitx.])
  2723                     have_fcitx_frontend_h_hdr=no
  2724                 else
  2725                     AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ])
  2726                     EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
  2727                     SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
  2728                fi
  2729             fi
  2730         fi
  2731     fi
  2732 }
  2733 
  2734 dnl See if we can use the Touchscreen input library
  2735 CheckTslib()
  2736 {
  2737     AC_ARG_ENABLE(input-tslib,
  2738 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  2739                   , enable_input_tslib=yes)
  2740     if test x$enable_input_tslib = xyes; then
  2741         AC_MSG_CHECKING(for Touchscreen library support)
  2742         enable_input_tslib=no
  2743         AC_TRY_COMPILE([
  2744           #include "tslib.h"
  2745         ],[
  2746         ],[
  2747         enable_input_tslib=yes
  2748         ])
  2749         AC_MSG_RESULT($enable_input_tslib)
  2750         if test x$enable_input_tslib = xyes; then
  2751             AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
  2752             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  2753             SUMMARY_input="${SUMMARY_input} ts"
  2754         fi
  2755     fi
  2756 }
  2757 
  2758 dnl See what type of thread model to use on Linux and Solaris
  2759 CheckPTHREAD()
  2760 {
  2761     dnl Check for pthread support
  2762     AC_ARG_ENABLE(pthreads,
  2763 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  2764                   , enable_pthreads=yes)
  2765     dnl This is used on Linux for glibc binary compatibility (Doh!)
  2766     AC_ARG_ENABLE(pthread-sem,
  2767 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  2768                   , enable_pthread_sem=yes)
  2769     case "$host" in
  2770          *-*-android*)
  2771             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2772             pthread_lib=""
  2773             ;;
  2774         *-*-linux*|*-*-uclinux*)
  2775             pthread_cflags="-D_REENTRANT"
  2776             pthread_lib="-lpthread"
  2777             ;;
  2778         *-*-bsdi*)
  2779             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2780             pthread_lib=""
  2781             ;;
  2782         *-*-darwin*)
  2783             pthread_cflags="-D_THREAD_SAFE"
  2784 # causes Carbon.p complaints?
  2785 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2786             ;;
  2787         *-*-freebsd*|*-*-dragonfly*)
  2788             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2789             pthread_lib="-pthread"
  2790             ;;
  2791         *-*-netbsd*)
  2792             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2793             pthread_lib="-lpthread"
  2794             ;;
  2795         *-*-openbsd*)
  2796             pthread_cflags="-D_REENTRANT"
  2797             pthread_lib="-pthread"
  2798             ;;
  2799         *-*-solaris2.9)
  2800             # From Solaris 9+, posix4's preferred name is rt.
  2801             pthread_cflags="-D_REENTRANT"
  2802             pthread_lib="-lpthread -lrt"
  2803             ;;
  2804         *-*-solaris2.10)
  2805             # Solaris 10+ merged pthread into libc.
  2806             pthread_cflags="-D_REENTRANT"
  2807             pthread_lib="-lrt"
  2808             ;;
  2809         *-*-solaris*)
  2810             # Solaris 11+ merged rt into libc.
  2811             pthread_cflags="-D_REENTRANT"
  2812             pthread_lib=""
  2813             ;;
  2814         *-*-sysv5*)
  2815             pthread_cflags="-D_REENTRANT -Kthread"
  2816             pthread_lib=""
  2817             ;;
  2818         *-*-aix*)
  2819             pthread_cflags="-D_REENTRANT -mthreads"
  2820             pthread_lib="-lpthread"
  2821             ;;
  2822         *-*-hpux11*)
  2823             pthread_cflags="-D_REENTRANT"
  2824             pthread_lib="-L/usr/lib -lpthread"
  2825             ;;
  2826         *-*-haiku*)
  2827             pthread_cflags="-D_REENTRANT"
  2828             pthread_lib=""
  2829             ;;
  2830         *-*-nto*)
  2831             pthread_cflags="-D_REENTRANT"
  2832             pthread_lib=""
  2833             ;;
  2834         *)
  2835             pthread_cflags="-D_REENTRANT"
  2836             pthread_lib="-lpthread"
  2837             ;;
  2838     esac
  2839     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  2840         # Save the original compiler flags and libraries
  2841         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  2842         # Add the pthread compiler flags and libraries
  2843         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  2844         # Check to see if we have pthread support on this system
  2845         AC_MSG_CHECKING(for pthreads)
  2846         use_pthreads=no
  2847         AC_TRY_LINK([
  2848          #include <pthread.h>
  2849         ],[
  2850          pthread_attr_t type;
  2851          pthread_attr_init(&type);
  2852         ],[
  2853         use_pthreads=yes
  2854         ])
  2855         AC_MSG_RESULT($use_pthreads)
  2856         # Restore the compiler flags and libraries
  2857         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2858 
  2859         # Do futher testing if we have pthread support...
  2860         if test x$use_pthreads = xyes; then
  2861             AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
  2862             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  2863             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  2864             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  2865 
  2866             # Save the original compiler flags and libraries
  2867             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  2868             # Add the pthread compiler flags and libraries
  2869             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  2870 
  2871             # Check to see if recursive mutexes are available
  2872             AC_MSG_CHECKING(for recursive mutexes)
  2873             has_recursive_mutexes=no
  2874             if test x$has_recursive_mutexes = xno; then
  2875                 AC_TRY_LINK([
  2876                   #define _GNU_SOURCE 1
  2877                   #include <pthread.h>
  2878                 ],[
  2879                   pthread_mutexattr_t attr;
  2880                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  2881                 ],[
  2882                 has_recursive_mutexes=yes
  2883                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
  2884                 ])
  2885             fi
  2886             if test x$has_recursive_mutexes = xno; then
  2887                 AC_TRY_LINK([
  2888                   #define _GNU_SOURCE 1
  2889                   #include <pthread.h>
  2890                 ],[
  2891                   pthread_mutexattr_t attr;
  2892                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  2893                 ],[
  2894                 has_recursive_mutexes=yes
  2895                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
  2896                 ])
  2897             fi
  2898             AC_MSG_RESULT($has_recursive_mutexes)
  2899 
  2900             # Check to see if pthread semaphore support is missing
  2901             if test x$enable_pthread_sem = xyes; then
  2902                 AC_MSG_CHECKING(for pthread semaphores)
  2903                 have_pthread_sem=no
  2904                 AC_TRY_COMPILE([
  2905                   #include <pthread.h>
  2906                   #include <semaphore.h>
  2907                 ],[
  2908                 ],[
  2909                 have_pthread_sem=yes
  2910                 ])
  2911                 AC_MSG_RESULT($have_pthread_sem)
  2912             fi
  2913             if test x$have_pthread_sem = xyes; then
  2914                 AC_MSG_CHECKING(for sem_timedwait)
  2915                 have_sem_timedwait=no
  2916                 AC_TRY_LINK([
  2917                   #include <pthread.h>
  2918                   #include <semaphore.h>
  2919                 ],[
  2920                   sem_timedwait(NULL, NULL);
  2921                 ],[
  2922                 have_sem_timedwait=yes
  2923                 AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ])
  2924                 ])
  2925                 AC_MSG_RESULT($have_sem_timedwait)
  2926             fi
  2927 
  2928             AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
  2929             if test x$have_pthread_np_h = xyes; then
  2930                 AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
  2931             fi
  2932 
  2933             # Check to see if pthread naming is available
  2934             AC_MSG_CHECKING(for pthread_setname_np)
  2935             AC_TRY_LINK_FUNC(pthread_setname_np, [
  2936               has_pthread_setname_np=yes
  2937               AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
  2938             ],[
  2939               has_pthread_setname_np=no
  2940             ])
  2941             AC_MSG_RESULT($has_pthread_setname_np)
  2942 
  2943             AC_MSG_CHECKING(for pthread_set_name_np)
  2944             AC_TRY_LINK_FUNC(pthread_set_name_np, [
  2945               has_pthread_set_name_np=yes
  2946               AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
  2947             ],[
  2948               has_pthread_set_name_np=no
  2949             ])
  2950             AC_MSG_RESULT($has_pthread_set_name_np)
  2951 
  2952             # Restore the compiler flags and libraries
  2953             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2954 
  2955             # Basic thread creation functions
  2956             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  2957 
  2958             # Semaphores
  2959             # We can fake these with mutexes and condition variables if necessary
  2960             if test x$have_pthread_sem = xyes; then
  2961                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  2962             else
  2963                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  2964             fi
  2965 
  2966             # Mutexes
  2967             # We can fake these with semaphores if necessary
  2968             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  2969 
  2970             # Condition variables
  2971             # We can fake these with semaphores and mutexes if necessary
  2972             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  2973 
  2974             # Thread local storage
  2975             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
  2976 
  2977             have_threads=yes
  2978         fi
  2979     fi
  2980 }
  2981 
  2982 dnl Determine whether the compiler can produce Windows executables
  2983 CheckWINDOWS()
  2984 {
  2985     AC_MSG_CHECKING(Windows compiler)
  2986     have_win32_gcc=no
  2987     AC_TRY_COMPILE([
  2988      #include <windows.h>
  2989     ],[
  2990     ],[
  2991     have_win32_gcc=yes
  2992     ])
  2993     AC_MSG_RESULT($have_win32_gcc)
  2994     if test x$have_win32_gcc != xyes; then
  2995        AC_MSG_ERROR([
  2996 *** Your compiler ($CC) does not produce Windows executables!
  2997        ])
  2998     fi
  2999 
  3000     AC_MSG_CHECKING(Windows CE)
  3001     have_wince=no
  3002     AC_TRY_COMPILE([
  3003 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  3004 #error This is not Windows CE
  3005 #endif
  3006     ],[
  3007     ],[
  3008     have_wince=yes
  3009        AC_MSG_ERROR([
  3010 *** Sorry, Windows CE is no longer supported.
  3011        ])
  3012     ])
  3013     AC_MSG_RESULT($have_wince)
  3014 
  3015     # This fixes Windows stack alignment with newer GCC
  3016     CheckStackBoundary
  3017 }
  3018 
  3019 dnl Find the DirectX includes and libraries
  3020 CheckDIRECTX()
  3021 {
  3022     AC_ARG_ENABLE(directx,
  3023 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
  3024                   , enable_directx=yes)
  3025     if test x$enable_directx = xyes; then
  3026         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  3027         AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes)
  3028         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  3029         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  3030         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  3031         AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
  3032         AC_CHECK_HEADER(xinput.h, have_xinput=yes)
  3033         AC_TRY_COMPILE([
  3034 #include <windows.h>
  3035 #include <xinput.h>
  3036 XINPUT_GAMEPAD_EX x1;
  3037         ],[],[have_xinput_gamepadex=yes])
  3038         AC_TRY_COMPILE([
  3039 #include <windows.h>
  3040 #include <xinput.h>
  3041 XINPUT_STATE_EX s1;
  3042         ],[],[have_xinput_stateex=yes])
  3043 
  3044         if test x$have_ddraw = xyes; then
  3045             AC_DEFINE(HAVE_DDRAW_H, 1, [ ])
  3046         fi
  3047         if test x$have_dinput = xyes; then
  3048             AC_DEFINE(HAVE_DINPUT_H, 1, [ ])
  3049         fi
  3050         if test x$have_dsound = xyes; then
  3051             AC_DEFINE(HAVE_DSOUND_H, 1, [ ])
  3052         fi
  3053         if test x$have_dxgi = xyes; then
  3054             AC_DEFINE(HAVE_DXGI_H, 1, [ ])
  3055         fi
  3056         if test x$have_xinput = xyes; then
  3057             AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
  3058         fi
  3059         if test x$have_xinput_gamepadex = xyes; then
  3060             AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
  3061         fi
  3062         if test x$have_xinput_stateex = xyes; then
  3063             AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
  3064         fi
  3065 
  3066         SUMMARY_video="${SUMMARY_video} directx"
  3067         SUMMARY_audio="${SUMMARY_audio} directx"
  3068 
  3069         # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
  3070         # FIXME:  ...so force it off for now.
  3071         case "$host" in
  3072             *-*-cygwin*)
  3073             have_dinput=false
  3074             ;;
  3075         esac
  3076     fi
  3077 
  3078     AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
  3079     if test x$have_wasapi = xyes; then
  3080         AC_DEFINE(HAVE_MMDEVICEAPI_H,1,[])
  3081     fi
  3082     AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
  3083     if test x$have_wasapi = xyes; then
  3084         AC_DEFINE(HAVE_AUDIOCLIENT_H,1,[])
  3085     fi
  3086 
  3087     AC_CHECK_HEADER(endpointvolume.h,AC_DEFINE(HAVE_ENDPOINTVOLUME_H,1,[]))
  3088 
  3089     AC_ARG_ENABLE(wasapi,
  3090 AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
  3091                                 , enable_wasapi=yes)
  3092 }
  3093 
  3094 dnl Check for the dlfcn.h interface for dynamically loading objects
  3095 CheckDLOPEN()
  3096 {
  3097     AC_ARG_ENABLE(sdl-dlopen,
  3098 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  3099                   , enable_sdl_dlopen=yes)
  3100     if test x$enable_sdl_dlopen = xyes; then
  3101         AC_MSG_CHECKING(for dlopen)
  3102         have_dlopen=no
  3103         AC_TRY_COMPILE([
  3104          #include <dlfcn.h>
  3105         ],[
  3106          void *handle = dlopen("", RTLD_NOW);
  3107          const char *loaderror = (char *) dlerror();
  3108         ],[
  3109         have_dlopen=yes
  3110         ])
  3111         AC_MSG_RESULT($have_dlopen)
  3112 
  3113         if test x$have_dlopen = xyes; then
  3114             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  3115                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  3116                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  3117             AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
  3118             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  3119             have_loadso=yes
  3120         fi
  3121     fi
  3122 }
  3123 
  3124 dnl Check for the usbhid(3) library on *BSD
  3125 CheckUSBHID()
  3126 {
  3127     case "$host" in
  3128         *-*-*bsd*)
  3129             if test x$enable_joystick = xyes; then
  3130                 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  3131                 if test x$have_libusbhid = xyes; then
  3132                     AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  3133                     AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  3134                     USB_LIBS="$USB_LIBS -lusbhid"
  3135                 else
  3136                     AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  3137                     AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  3138                     AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  3139                 fi
  3140                     
  3141                 save_CFLAGS="$CFLAGS"
  3142                 CFLAGS="$CFLAGS $USB_CFLAGS"
  3143 
  3144                 AC_MSG_CHECKING(for usbhid)
  3145                 have_usbhid=no
  3146                 AC_TRY_COMPILE([
  3147                   #include <sys/types.h>
  3148                   #if defined(HAVE_USB_H)
  3149                   #include <usb.h>
  3150                   #endif
  3151                   #ifdef __DragonFly__
  3152                   # include <bus/usb/usb.h>
  3153                   # include <bus/usb/usbhid.h>
  3154                   #else
  3155                   # include <dev/usb/usb.h>
  3156                   # include <dev/usb/usbhid.h>
  3157                   #endif
  3158                   #if defined(HAVE_USBHID_H)
  3159                   #include <usbhid.h>
  3160                   #elif defined(HAVE_LIBUSB_H)
  3161                   #include <libusb.h>
  3162                   #elif defined(HAVE_LIBUSBHID_H)
  3163                   #include <libusbhid.h>
  3164                   #endif
  3165                 ],[
  3166                   struct report_desc *repdesc;
  3167                   struct usb_ctl_report *repbuf;
  3168                   hid_kind_t hidkind;
  3169                 ],[
  3170                 have_usbhid=yes
  3171                 ])
  3172                 AC_MSG_RESULT($have_usbhid)
  3173 
  3174                 if test x$have_usbhid = xyes; then
  3175                     AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  3176                     have_usbhid_ucr_data=no
  3177                     AC_TRY_COMPILE([
  3178                       #include <sys/types.h>
  3179                       #if defined(HAVE_USB_H)
  3180                       #include <usb.h>
  3181                       #endif
  3182                       #ifdef __DragonFly__
  3183                       # include <bus/usb/usb.h>
  3184                       # include <bus/usb/usbhid.h>
  3185                       #else
  3186                       # include <dev/usb/usb.h>
  3187                       # include <dev/usb/usbhid.h>
  3188                       #endif
  3189                       #if defined(HAVE_USBHID_H)
  3190                       #include <usbhid.h>
  3191                       #elif defined(HAVE_LIBUSB_H)
  3192                       #include <libusb.h>
  3193                       #elif defined(HAVE_LIBUSBHID_H)
  3194                       #include <libusbhid.h>
  3195                       #endif
  3196                     ],[
  3197                       struct usb_ctl_report buf;
  3198                       if (buf.ucr_data) { }
  3199                     ],[
  3200                     have_usbhid_ucr_data=yes
  3201                     ])
  3202                     if test x$have_usbhid_ucr_data = xyes; then
  3203                         USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  3204                     fi
  3205                     AC_MSG_RESULT($have_usbhid_ucr_data)
  3206                     
  3207                     AC_MSG_CHECKING(for new usbhid API)
  3208                     have_usbhid_new=no
  3209                     AC_TRY_COMPILE([
  3210                       #include <sys/types.h>
  3211                       #if defined(HAVE_USB_H)
  3212                       #include <usb.h>
  3213                       #endif
  3214                       #ifdef __DragonFly__
  3215                       #include <bus/usb/usb.h>
  3216                       #include <bus/usb/usbhid.h>
  3217                       #else
  3218                       #include <dev/usb/usb.h>
  3219                       #include <dev/usb/usbhid.h>
  3220                       #endif
  3221                       #if defined(HAVE_USBHID_H)
  3222                       #include <usbhid.h>
  3223                       #elif defined(HAVE_LIBUSB_H)
  3224                       #include <libusb.h>
  3225                       #elif defined(HAVE_LIBUSBHID_H)
  3226                       #include <libusbhid.h>
  3227                       #endif
  3228                     ],[
  3229                       report_desc_t d;
  3230                       hid_start_parse(d, 1, 1);
  3231                     ],[
  3232                     have_usbhid_new=yes
  3233                     ])
  3234                     if test x$have_usbhid_new = xyes; then
  3235                         USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  3236                     fi
  3237                     AC_MSG_RESULT($have_usbhid_new)
  3238 
  3239                     AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  3240                     have_machine_joystick=no
  3241                     AC_TRY_COMPILE([
  3242                       #include <machine/joystick.h>
  3243                     ],[
  3244                       struct joystick t;
  3245                     ],[
  3246                     have_machine_joystick=yes
  3247                     ])
  3248                     if test x$have_machine_joystick = xyes; then
  3249                         AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
  3250                     fi
  3251                     AC_MSG_RESULT($have_machine_joystick)
  3252 
  3253                     AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
  3254                     SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  3255                     EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  3256                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  3257                     have_joystick=yes
  3258                 fi
  3259                 CFLAGS="$save_CFLAGS"
  3260             fi
  3261         ;;
  3262     esac
  3263 }
  3264 
  3265 dnl Check for HIDAPI joystick drivers
  3266 CheckHIDAPI()
  3267 {
  3268     # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
  3269     # so we'll just use libusb when it's available.
  3270     #
  3271     # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
  3272     AC_ARG_ENABLE(hidapi,
  3273 AC_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]),
  3274                   , enable_hidapi=no)
  3275     if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
  3276         hidapi_support=no
  3277         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  3278         if test x$PKG_CONFIG != xno; then
  3279             LIBUSB_CFLAGS=`$PKG_CONFIG --cflags libusb-1.0`
  3280             LIBUSB_LDFLAGS=`$PKG_CONFIG --libs libusb-1.0`
  3281             save_CFLAGS="$CFLAGS"
  3282             CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
  3283             AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
  3284             CFLAGS="$save_CFLAGS"
  3285         fi
  3286         if test x$have_libusb_h = xyes; then
  3287             hidapi_support=yes
  3288             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  3289             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
  3290             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  3291             SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
  3292             EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
  3293             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LDFLAGS"
  3294         fi
  3295         AC_MSG_CHECKING(for hidapi support)
  3296         AC_MSG_RESULT($hidapi_support)
  3297     fi
  3298 }
  3299 
  3300 dnl Check for clock_gettime()
  3301 CheckClockGettime()
  3302 {
  3303     AC_ARG_ENABLE(clock_gettime,
  3304 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
  3305                   , enable_clock_gettime=yes)
  3306     if test x$enable_clock_gettime = xyes; then
  3307         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  3308         if test x$have_clock_gettime = xyes; then
  3309             AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  3310             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  3311         else
  3312             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  3313             if test x$have_clock_gettime = xyes; then
  3314                AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  3315                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  3316             fi
  3317         fi
  3318     fi
  3319 }
  3320 
  3321 dnl Check for a valid linux/version.h
  3322 CheckLinuxVersion()
  3323 {
  3324     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  3325     if test x$have_linux_version_h = xyes; then
  3326         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  3327     fi
  3328 }
  3329 
  3330 dnl Check if we want to use RPATH
  3331 CheckRPATH()
  3332 {
  3333     AC_ARG_ENABLE(rpath,
  3334 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  3335                   , enable_rpath=yes)
  3336 }
  3337 
  3338 dnl Do this on all platforms, before everything else (other things might want to override it).
  3339 CheckWarnAll
  3340 
  3341 dnl Set up the configuration based on the host platform!
  3342 case "$host" in
  3343     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
  3344         case "$host" in
  3345             *-*-android*)
  3346                 # Android
  3347                 ARCH=android
  3348                 ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES"
  3349                 CFLAGS="$CFLAGS $ANDROID_CFLAGS"
  3350                 SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS"
  3351                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS"
  3352                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid"
  3353                 SDLMAIN_SOURCES="$srcdir/src/main/android/*.c"
  3354 
  3355                 if test x$enable_video = xyes; then
  3356                     SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
  3357                     # FIXME: confdefs? Not AC_DEFINE?
  3358                     $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
  3359                     SUMMARY_video="${SUMMARY_video} android"
  3360                 fi
  3361                 ;;
  3362             *-*-linux*)         ARCH=linux ;;
  3363             *-*-uclinux*)       ARCH=linux ;;
  3364             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  3365             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  3366             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  3367             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  3368             *-*-bsdi*)          ARCH=bsdi ;;
  3369             *-*-freebsd*)       ARCH=freebsd ;;
  3370             *-*-dragonfly*)     ARCH=freebsd ;;
  3371             *-*-netbsd*)        ARCH=netbsd ;;
  3372             *-*-openbsd*)       ARCH=openbsd ;;
  3373             *-*-sysv5*)         ARCH=sysv5 ;;
  3374             *-*-solaris*)       ARCH=solaris ;;
  3375             *-*-hpux*)          ARCH=hpux ;;
  3376             *-*-aix*)           ARCH=aix ;;
  3377             *-*-minix*)         ARCH=minix ;;
  3378             *-*-nto*)           ARCH=nto
  3379                 CheckQNXVideo
  3380                 ;;
  3381         esac
  3382         CheckVisibilityHidden
  3383         CheckDeclarationAfterStatement
  3384         CheckDummyVideo
  3385         CheckDiskAudio
  3386         CheckDummyAudio
  3387         CheckDLOPEN
  3388         CheckOSS
  3389         CheckALSA
  3390         CheckPulseAudio
  3391         CheckJACK
  3392         CheckARTSC
  3393         CheckESD
  3394         CheckNAS
  3395         CheckSNDIO
  3396         CheckFusionSound
  3397         CheckLibSampleRate
  3398         # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
  3399         CheckRPI
  3400         CheckX11
  3401         CheckDirectFB
  3402         CheckKMSDRM
  3403         CheckOpenGLX11
  3404         CheckOpenGLESX11
  3405         CheckVulkan
  3406         CheckWayland
  3407         CheckLibUDev
  3408         CheckDBus
  3409         CheckIME
  3410         CheckIBus
  3411         CheckFcitx
  3412         case $ARCH in
  3413           linux)
  3414               CheckInputEvents
  3415               CheckInputKD
  3416           ;;
  3417         esac
  3418         CheckTslib
  3419         CheckUSBHID
  3420         CheckHIDAPI
  3421         CheckPTHREAD
  3422         CheckClockGettime
  3423         CheckLinuxVersion
  3424         CheckRPATH
  3425         CheckVivanteVideo
  3426 
  3427         # Set up files for the audio library
  3428         if test x$enable_audio = xyes; then
  3429           case $ARCH in
  3430             sysv5|solaris|hpux)
  3431                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
  3432                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  3433                 SUMMARY_audio="${SUMMARY_audio} sun"
  3434                 have_audio=yes
  3435             ;;
  3436             netbsd)  # Don't use this on OpenBSD, it's busted.
  3437                 AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ])
  3438                 SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c"
  3439                 SUMMARY_audio="${SUMMARY_audio} netbsd"
  3440                 have_audio=yes
  3441             ;;
  3442             aix)
  3443                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
  3444                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  3445                 SUMMARY_audio="${SUMMARY_audio} paudio"
  3446                 have_audio=yes
  3447             ;;
  3448             android)
  3449                 AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
  3450                 SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
  3451                 SUMMARY_audio="${SUMMARY_audio} android"
  3452                 have_audio=yes
  3453             ;;
  3454             nto)
  3455                 CheckQNXAudio
  3456             ;;
  3457           esac
  3458         fi
  3459         # Set up files for the joystick library
  3460         if test x$enable_joystick = xyes; then
  3461           case $ARCH in
  3462             linux)
  3463                 AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
  3464                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  3465                 SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  3466                 have_joystick=yes
  3467             ;;
  3468             android)
  3469                 AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ])
  3470                 SOURCES="$SOURCES $srcdir/src/joystick/android/*.c"
  3471                 SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  3472                 have_joystick=yes
  3473             ;;
  3474           esac
  3475         fi
  3476         # Set up files for the haptic library
  3477         if test x$enable_haptic = xyes; then
  3478           case $ARCH in
  3479             linux)
  3480                 if test x$use_input_events = xyes; then
  3481                     AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
  3482                     SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  3483                     have_haptic=yes
  3484                 fi
  3485             ;;
  3486             android)
  3487                 AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ])
  3488                 SOURCES="$SOURCES $srcdir/src/haptic/android/*.c"
  3489                 have_haptic=yes
  3490             ;;
  3491           esac
  3492         fi
  3493         # Set up files for the sensor library
  3494         if test x$enable_sensor = xyes; then
  3495           case $ARCH in
  3496             android)
  3497                 AC_DEFINE(SDL_SENSOR_ANDROID, 1, [ ])
  3498                 SOURCES="$SOURCES $srcdir/src/sensor/android/*.c"
  3499                 have_sensor=yes
  3500             ;;
  3501           esac
  3502         fi
  3503         # Set up files for the power library
  3504         if test x$enable_power = xyes; then
  3505              case $ARCH in
  3506                linux)
  3507                    AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
  3508                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  3509                    have_power=yes
  3510                ;;
  3511                android)
  3512                    AC_DEFINE(SDL_POWER_ANDROID, 1, [ ])
  3513                    SOURCES="$SOURCES $srcdir/src/power/android/*.c"
  3514                    have_power=yes
  3515                ;;
  3516              esac
  3517         fi
  3518         # Set up files for the filesystem library
  3519         if test x$enable_filesystem = xyes; then
  3520              case $ARCH in
  3521                android)
  3522                    AC_DEFINE(SDL_FILESYSTEM_ANDROID, 1, [ ])
  3523                    SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c"
  3524                    have_filesystem=yes
  3525                ;;
  3526                *)
  3527                    AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
  3528                    SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
  3529                    have_filesystem=yes
  3530                ;;
  3531              esac
  3532         fi
  3533         # Set up files for the timer library
  3534         if test x$enable_timers = xyes; then
  3535             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  3536             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  3537             have_timers=yes
  3538         fi
  3539         # Set up files for udev hotplugging support
  3540         if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
  3541             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"               
  3542         fi
  3543         # Set up files for evdev input
  3544         if test x$use_input_events = xyes; then
  3545             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c"
  3546         fi       
  3547         # Set up other core UNIX files
  3548         SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  3549         ;;
  3550     *-*-cygwin* | *-*-mingw32*)
  3551         ARCH=win32
  3552         if test "$build" != "$host"; then # cross-compiling
  3553             # Default cross-compile location
  3554             ac_default_prefix=/usr/local/cross-tools/$host
  3555         else
  3556             # Look for the location of the tools and install there
  3557             if test "$BUILD_PREFIX" != ""; then
  3558                 ac_default_prefix=$BUILD_PREFIX
  3559             fi
  3560         fi
  3561         CheckDeclarationAfterStatement
  3562         CheckDummyVideo
  3563         CheckDiskAudio
  3564         CheckDummyAudio
  3565         CheckWINDOWS
  3566         CheckWINDOWSGL
  3567         CheckWINDOWSGLES
  3568         CheckVulkan
  3569         CheckDIRECTX
  3570 
  3571         # Set up the core platform files
  3572         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  3573 
  3574         # Set up files for the video library
  3575         if test x$enable_video = xyes; then
  3576             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
  3577             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  3578             have_video=yes
  3579             AC_ARG_ENABLE(render-d3d,
  3580 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  3581                                 , enable_render_d3d=yes)
  3582             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  3583                 AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
  3584             fi
  3585             if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then
  3586                 AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ])
  3587             fi
  3588         fi
  3589         # Set up files for the audio library
  3590         if test x$enable_audio = xyes; then
  3591             AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
  3592             SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
  3593             if test x$have_dsound = xyes; then
  3594                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
  3595                 SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
  3596             fi
  3597             if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then
  3598                 AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
  3599                 SUMMARY_audio="${SUMMARY_audio} wasapi"
  3600                 SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
  3601             fi
  3602             have_audio=yes
  3603         fi
  3604         # Set up files for the joystick library
  3605         if test x$enable_joystick = xyes; then
  3606             if test x$have_dinput = xyes -o x$have_xinput = xyes; then
  3607                 if test x$have_xinput = xyes; then
  3608                     AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ])
  3609                 fi
  3610                 if test x$have_dinput = xyes; then
  3611                     AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
  3612                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  3613                 fi
  3614             else
  3615                 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
  3616             fi
  3617             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  3618             SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
  3619             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  3620             SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
  3621             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
  3622             have_joystick=yes
  3623         fi
  3624         if test x$enable_haptic = xyes; then
  3625             if test x$have_dinput = xyes -o x$have_xinput = xyes; then
  3626                 if test x$have_xinput = xyes; then
  3627                     AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ])
  3628                 fi
  3629                 if test x$have_dinput = xyes; then
  3630                     AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
  3631                 fi
  3632                 SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
  3633                 have_haptic=yes
  3634             fi
  3635         fi
  3636         if test x$enable_power = xyes; then
  3637             AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
  3638             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  3639             have_power=yes
  3640         fi
  3641         if test x$enable_filesystem = xyes; then
  3642             AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
  3643             SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
  3644             have_filesystem=yes
  3645         fi
  3646         # Set up files for the thread library
  3647         if test x$enable_threads = xyes; then
  3648             AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
  3649             SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
  3650             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  3651             have_threads=yes
  3652         fi
  3653         # Set up files for the timer library
  3654         if test x$enable_timers = xyes; then
  3655             AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
  3656             SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  3657             have_timers=yes
  3658         fi
  3659         # Set up files for the shared object loading library
  3660         if test x$enable_loadso = xyes; then
  3661             AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
  3662             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  3663             have_loadso=yes
  3664         fi
  3665         # Set up the system libraries we need
  3666         if test -f /lib/w32api/libuuid.a; then
  3667             LIBUUID=/lib/w32api/libuuid.a
  3668         else
  3669             LIBUUID=-luuid
  3670         fi
  3671         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc"
  3672         # The Windows platform requires special setup
  3673         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  3674         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  3675         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  3676         SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
  3677 
  3678         # Check to see if this is a mingw or cygwin build
  3679         have_mingw32=
  3680         AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
  3681         if test x$have_mingw32 = xyes; then
  3682             SDL_LIBS="-lmingw32 $SDL_LIBS"
  3683         else
  3684             SDL_LIBS="-lcygwin $SDL_LIBS"
  3685         fi
  3686         ;;
  3687 
  3688     dnl BeOS support removed after SDL 2.0.1. Haiku still works.  --ryan.
  3689     *-*-beos*)
  3690         AC_MSG_ERROR([
  3691 *** BeOS support has been removed as of SDL 2.0.2.
  3692         ])
  3693         ;;
  3694 
  3695     *-*-haiku*)
  3696         ARCH=haiku
  3697         ac_default_prefix=/boot/system
  3698         CheckDummyVideo
  3699         CheckDiskAudio
  3700         CheckDummyAudio
  3701         CheckDLOPEN
  3702         CheckHaikuVideo
  3703         CheckHaikuGL
  3704         CheckPTHREAD
  3705 
  3706         # Set up files for the audio library
  3707         if test x$enable_audio = xyes; then
  3708             AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
  3709             SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
  3710             SUMMARY_audio="${SUMMARY_audio} haiku"
  3711             have_audio=yes
  3712         fi
  3713         # Set up files for the joystick library
  3714         if test x$enable_joystick = xyes; then
  3715             AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
  3716             SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
  3717             have_joystick=yes
  3718         fi
  3719         # Set up files for the timer library
  3720         if test x$enable_timers = xyes; then
  3721             AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
  3722             SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
  3723             have_timers=yes
  3724         fi
  3725         # Set up files for the system power library
  3726         if test x$enable_power = xyes; then
  3727             AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
  3728             SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
  3729             have_power=yes
  3730         fi
  3731         # Set up files for the system filesystem library
  3732         if test x$enable_filesystem = xyes; then
  3733             AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
  3734             SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
  3735             have_filesystem=yes
  3736         fi
  3737         # The Haiku platform requires special setup.
  3738         SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
  3739         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  3740         # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but
  3741         #  other spins, like x86-64, use a more standard "libstdc++.so.*"
  3742         AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++")
  3743         ;;
  3744     arm*-apple-darwin*|*-ios-*)
  3745         ARCH=ios
  3746 
  3747         CheckVisibilityHidden
  3748         CheckDeclarationAfterStatement
  3749         CheckDummyVideo
  3750         CheckDiskAudio
  3751         CheckDummyAudio
  3752         CheckDLOPEN
  3753         CheckMETAL
  3754         CheckVulkan
  3755         CheckPTHREAD
  3756 
  3757         # Set up files for the audio library
  3758         if test x$enable_audio = xyes; then
  3759             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  3760             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
  3761             SUMMARY_audio="${SUMMARY_audio} coreaudio"
  3762             have_audio=yes
  3763         fi
  3764         # Set up files for the joystick library
  3765         if test x$enable_joystick = xyes; then
  3766             AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
  3767             SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  3768             SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  3769             have_joystick=yes
  3770         fi
  3771         # Set up files for the haptic library
  3772         #if test x$enable_haptic = xyes; then
  3773         #    SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  3774         #    have_haptic=yes
  3775         #    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  3776         #fi
  3777         # Set up files for the power library
  3778         if test x$enable_power = xyes; then
  3779             AC_DEFINE(SDL_POWER_UIKIT, 1, [ ])
  3780             SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
  3781             have_power=yes
  3782         fi
  3783         # Set up files for the filesystem library
  3784         if test x$enable_filesystem = xyes; then
  3785             SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  3786             have_filesystem=yes
  3787         fi
  3788         # Set up additional files for the file library
  3789         if test x$enable_file = xyes; then
  3790             AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  3791             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  3792         fi
  3793         # Set up files for the timer library
  3794         if test x$enable_timers = xyes; then
  3795             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  3796             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  3797             have_timers=yes
  3798         fi
  3799         # Set up other core UNIX files
  3800         SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  3801         # The iOS platform requires special setup.
  3802         AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ])
  3803         AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  3804         AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  3805         AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  3806         AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  3807         SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
  3808         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
  3809         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
  3810         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
  3811         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
  3812         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
  3813         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
  3814         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
  3815         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
  3816         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
  3817         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
  3818         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
  3819 
  3820         if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
  3821             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
  3822         fi
  3823         ;;
  3824     *-*-darwin* )
  3825         # This could be either full "Mac OS X", or plain "Darwin" which is
  3826         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  3827         # Next line is broken, and a few files below require Mac OS X (full)
  3828         ARCH=macosx
  3829 
  3830         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  3831         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  3832         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  3833 
  3834         CheckVisibilityHidden
  3835         CheckDeclarationAfterStatement
  3836         CheckDummyVideo
  3837         CheckDiskAudio
  3838         CheckDummyAudio
  3839         CheckDLOPEN
  3840         CheckCOCOA
  3841         CheckMETAL
  3842         CheckX11
  3843         CheckMacGL
  3844         CheckMacGLES
  3845         CheckOpenGLX11
  3846         CheckVulkan
  3847         CheckPTHREAD
  3848 
  3849         # Set up files for the audio library
  3850         if test x$enable_audio = xyes; then
  3851             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  3852             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
  3853             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox"
  3854             SUMMARY_audio="${SUMMARY_audio} coreaudio"
  3855             have_audio=yes
  3856         fi
  3857         # Set up files for the joystick library
  3858         if test x$enable_joystick = xyes; then
  3859             AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  3860             AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  3861             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  3862             SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  3863             SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
  3864             EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
  3865             have_joystick=yes
  3866         fi
  3867         # Set up files for the haptic library
  3868         if test x$enable_haptic = xyes; then
  3869             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  3870             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  3871             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  3872             have_haptic=yes
  3873         fi
  3874         # Set up files for the power library
  3875         if test x$enable_power = xyes; then
  3876             AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
  3877             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  3878             have_power=yes
  3879         fi
  3880         # Set up files for the filesystem library
  3881         if test x$enable_filesystem = xyes; then
  3882             AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  3883             SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  3884             have_filesystem=yes
  3885         fi
  3886         # Set up files for the timer library
  3887         if test x$enable_timers = xyes; then
  3888             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  3889             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  3890             have_timers=yes
  3891         fi
  3892         # Set up additional files for the file library
  3893         if test x$enable_file = xyes; then
  3894             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  3895         fi
  3896         # Set up other core UNIX files
  3897         SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  3898         # The Mac OS X platform requires special setup.
  3899         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  3900         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo"
  3901         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  3902         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  3903         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  3904 
  3905         if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
  3906             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
  3907         fi
  3908         ;;
  3909     *-nacl|*-pnacl)
  3910         ARCH=nacl
  3911         CheckNativeClient
  3912         CheckDummyAudio
  3913         CheckDummyVideo
  3914         CheckInputEvents
  3915         CheckPTHREAD
  3916         
  3917         # Set up files for the timer library
  3918         if test x$enable_timers = xyes; then
  3919             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  3920             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  3921             have_timers=yes
  3922         fi
  3923         
  3924         if test x$enable_filesystem = xyes; then
  3925             AC_DEFINE(SDL_FILESYSTEM_NACL, 1, [ ])
  3926             SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c"
  3927             have_filesystem=yes
  3928         fi
  3929         ;;
  3930     *-*-emscripten* )
  3931         if test x$enable_video = xyes; then
  3932             AC_DEFINE(SDL_VIDEO_DRIVER_EMSCRIPTEN, 1, [ ])
  3933             SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c"
  3934             have_video=yes
  3935             SUMMARY_video="${SUMMARY_video} emscripten"
  3936         fi
  3937 
  3938         if test x$enable_audio = xyes; then
  3939             AC_DEFINE(SDL_AUDIO_DRIVER_EMSCRIPTEN, 1, [ ])
  3940             SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c"
  3941             have_audio=yes
  3942             SUMMARY_audio="${SUMMARY_audio} emscripten"
  3943         fi
  3944 
  3945         CheckVisibilityHidden
  3946         CheckDeclarationAfterStatement
  3947         CheckDummyVideo
  3948         CheckDiskAudio
  3949         CheckDummyAudio
  3950         CheckDLOPEN
  3951         CheckClockGettime
  3952         CheckEmscriptenGLES
  3953 
  3954          # Set up files for the power library
  3955         if test x$enable_power = xyes; then
  3956             AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ])
  3957             SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c"
  3958             have_power=yes
  3959         fi
  3960         
  3961         # Set up files for the power library
  3962         if test x$enable_joystick = xyes; then
  3963             AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ])
  3964             SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c"
  3965             have_joystick=yes
  3966         fi
  3967 
  3968         # Set up files for the filesystem library
  3969         if test x$enable_filesystem = xyes; then
  3970             AC_DEFINE(SDL_FILESYSTEM_EMSCRIPTEN, 1, [ ])
  3971             SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c"
  3972             have_filesystem=yes
  3973         fi
  3974         # Set up files for the timer library
  3975         if test x$enable_timers = xyes; then
  3976             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  3977             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  3978             have_timers=yes
  3979         fi
  3980         ;;
  3981     *)
  3982         AC_MSG_ERROR([
  3983 *** Unsupported host:  Please add to configure.in
  3984         ])
  3985         ;;
  3986 esac
  3987 
  3988 # Verify that we have all the platform specific files we need
  3989 
  3990 if test x$have_joystick != xyes; then
  3991     if test x$enable_joystick = xyes; then
  3992         AC_DEFINE(SDL_JOYSTICK_DUMMY, 1, [ ])
  3993     fi
  3994     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  3995 fi
  3996 if test x$have_haptic != xyes; then
  3997     if test x$enable_haptic = xyes; then
  3998         AC_DEFINE(SDL_HAPTIC_DUMMY, 1, [ ])
  3999     fi
  4000     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  4001 fi
  4002 if test x$have_sensor != xyes; then
  4003     if test x$enable_sensor = xyes; then
  4004         AC_DEFINE(SDL_SENSOR_DUMMY, 1, [ ])
  4005     fi
  4006     SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c"
  4007 fi
  4008 if test x$have_threads != xyes; then
  4009     if test x$enable_threads = xyes; then
  4010         AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  4011     fi
  4012     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  4013 fi
  4014 if test x$have_timers != xyes; then
  4015     if test x$enable_timers = xyes; then
  4016         AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
  4017     fi
  4018     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  4019 fi
  4020 if test x$have_filesystem != xyes; then
  4021     if test x$enable_filesystem = xyes; then
  4022         AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
  4023     fi
  4024     SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
  4025 fi
  4026 if test x$have_loadso != xyes; then
  4027     if test x$enable_loadso = xyes; then
  4028         AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
  4029     fi
  4030     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  4031 fi
  4032 if test x$SDLMAIN_SOURCES = x; then
  4033     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  4034 fi
  4035 SDLTEST_SOURCES="$srcdir/src/test/*.c"
  4036 
  4037 if test x$video_wayland = xyes; then
  4038     WAYLAND_PROTOCOLS=`cd $srcdir/wayland-protocols ; for p in *.xml ; do echo -n "\$p" |sed 's,\\.xml\$, ,g' ; done`
  4039     WAYLAND_PROTOCOLS_SOURCES=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-protocol.c " ; done`
  4040     WAYLAND_PROTOCOLS_HEADERS=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-client-protocol.h " ; done`
  4041     GEN_SOURCES="$GEN_SOURCES $WAYLAND_PROTOCOLS_SOURCES"
  4042     GEN_HEADERS="$GEN_HEADERS $WAYLAND_PROTOCOLS_HEADERS"
  4043 
  4044     WAYLAND_PROTOCOLS_DEPENDS=`for p in $WAYLAND_PROTOCOLS ; do\
  4045         echo ;\
  4046         echo "\\$(gen)/\$p-client-protocol.h: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
  4047         echo "	@\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
  4048         echo "	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@" ;\
  4049         echo ;\
  4050         echo "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
  4051         echo "	@\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
  4052         echo "	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@" ;\
  4053         echo ;\
  4054         echo "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\
  4055         echo "	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\
  4056         done ;\
  4057         echo ;\
  4058         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`
  4059 fi
  4060 
  4061 OBJECTS=`echo $SOURCES`
  4062 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  4063 for EXT in asm cc m c S; do
  4064     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  4065     DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  4066 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  4067 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  4068 done
  4069 
  4070 GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  4071 
  4072 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  4073 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  4074 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  4075 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  4076 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  4077 	\\$(WINDRES) \\$< \\$@,g"`
  4078 
  4079 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  4080 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  4081 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  4082 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  4083 \\$(objects)/\\2.lo: \\1/\\2.c\\\\
  4084 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  4085 
  4086 SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
  4087 SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
  4088 SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  4089 SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  4090 \\$(objects)/\\2.lo: \\1/\\2.c\\\\
  4091 	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  4092 
  4093 # Set runtime shared library paths as needed
  4094 
  4095 if test "x$enable_rpath" = "xyes"; then
  4096   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
  4097     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  4098 
  4099     AC_MSG_CHECKING(for linker option --enable-new-dtags)
  4100     have_enable_new_dtags=no
  4101     save_LDFLAGS="$LDFLAGS"
  4102     LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
  4103     AC_TRY_LINK([
  4104     ],[
  4105     ],[
  4106     have_enable_new_dtags=yes
  4107     SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
  4108     ])
  4109     LDFLAGS="$save_LDFLAGS"
  4110     AC_MSG_RESULT($have_enable_new_dtags)
  4111   fi
  4112   if test $ARCH = solaris; then
  4113     SDL_RLD_FLAGS="-R\${libdir}"
  4114   fi
  4115 else
  4116   SDL_RLD_FLAGS=""
  4117 fi
  4118 
  4119 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  4120 
  4121 dnl Expand the cflags and libraries needed by apps using SDL
  4122 AC_SUBST(SDL_CFLAGS)
  4123 AC_SUBST(SDL_LIBS)
  4124 AC_SUBST(SDL_STATIC_LIBS)
  4125 AC_SUBST(SDL_RLD_FLAGS)
  4126 if test x$enable_shared = xyes; then
  4127     ENABLE_SHARED_TRUE=
  4128     ENABLE_SHARED_FALSE="#"
  4129 else
  4130     ENABLE_SHARED_TRUE="#"
  4131     ENABLE_SHARED_FALSE=
  4132 fi
  4133 if test x$enable_static = xyes; then
  4134     ENABLE_STATIC_TRUE=
  4135     ENABLE_STATIC_FALSE="#"
  4136 else
  4137     ENABLE_STATIC_TRUE="#"
  4138     ENABLE_STATIC_FALSE=
  4139 fi
  4140 AC_SUBST(ENABLE_SHARED_TRUE)
  4141 AC_SUBST(ENABLE_SHARED_FALSE)
  4142 AC_SUBST(ENABLE_STATIC_TRUE)
  4143 AC_SUBST(ENABLE_STATIC_FALSE)
  4144 
  4145 dnl Expand the sources and objects needed to build the library
  4146 AC_SUBST(ac_aux_dir)
  4147 AC_SUBST(INCLUDE)
  4148 AC_SUBST(OBJECTS)
  4149 AC_SUBST(GEN_HEADERS)
  4150 AC_SUBST(GEN_OBJECTS)
  4151 AC_SUBST(VERSION_OBJECTS)
  4152 AC_SUBST(SDLMAIN_OBJECTS)
  4153 AC_SUBST(SDLTEST_OBJECTS)
  4154 AC_SUBST(BUILD_CFLAGS)
  4155 AC_SUBST(EXTRA_CFLAGS)
  4156 AC_SUBST(BUILD_LDFLAGS)
  4157 AC_SUBST(EXTRA_LDFLAGS)
  4158 AC_SUBST(WINDRES)
  4159 AC_SUBST(WAYLAND_SCANNER)
  4160 
  4161 cat >Makefile.rules <<__EOF__
  4162 
  4163 # Build rules for objects
  4164 -include \$(OBJECTS:.lo=.d)
  4165 
  4166 # Special dependency for SDL.c, since it depends on SDL_revision.h
  4167 $srcdir/src/SDL.c: update-revision
  4168 $DEPENDS
  4169 $VERSION_DEPENDS
  4170 $SDLMAIN_DEPENDS
  4171 $SDLTEST_DEPENDS
  4172 $WAYLAND_PROTOCOLS_DEPENDS
  4173 __EOF__
  4174 
  4175 AC_CONFIG_FILES([
  4176     Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc
  4177 ])
  4178 AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])
  4179 
  4180 SUMMARY="SDL2 Configure Summary:\n"
  4181 if test x$enable_shared = xyes; then
  4182     SUMMARY="${SUMMARY}Building Shared Libraries\n"
  4183 fi
  4184 if test x$enable_static = xyes; then
  4185     SUMMARY="${SUMMARY}Building Static Libraries\n"
  4186 fi
  4187 SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n"
  4188 SUMMARY="${SUMMARY}Assembly Math   :${SUMMARY_math}\n" 
  4189 SUMMARY="${SUMMARY}Audio drivers   :${SUMMARY_audio}\n"
  4190 SUMMARY="${SUMMARY}Video drivers   :${SUMMARY_video}\n"
  4191 if test x$have_x = xyes; then
  4192     SUMMARY="${SUMMARY}X11 libraries   :${SUMMARY_video_x11}\n"
  4193 fi
  4194 SUMMARY="${SUMMARY}Input drivers   :${SUMMARY_input}\n"
  4195 if test x$have_samplerate_h_hdr = xyes; then
  4196     SUMMARY="${SUMMARY}Using libsamplerate : YES\n"
  4197 else
  4198     SUMMARY="${SUMMARY}Using libsamplerate : NO\n"
  4199 fi
  4200 if test x$have_libudev_h_hdr = xyes; then
  4201     SUMMARY="${SUMMARY}Using libudev       : YES\n"
  4202 else
  4203     SUMMARY="${SUMMARY}Using libudev       : NO\n"
  4204 fi
  4205 if test x$have_dbus_dbus_h_hdr = xyes; then
  4206     SUMMARY="${SUMMARY}Using dbus          : YES\n"
  4207 else
  4208     SUMMARY="${SUMMARY}Using dbus          : NO\n"
  4209 fi
  4210 if test x$enable_ime = xyes; then
  4211     SUMMARY="${SUMMARY}Using ime           : YES\n"
  4212 else
  4213     SUMMARY="${SUMMARY}Using ime           : NO\n"
  4214 fi
  4215 if test x$have_ibus_ibus_h_hdr = xyes; then
  4216     SUMMARY="${SUMMARY}Using ibus          : YES\n"
  4217 else
  4218     SUMMARY="${SUMMARY}Using ibus          : NO\n"
  4219 fi
  4220 if test x$have_fcitx_frontend_h_hdr = xyes; then
  4221     SUMMARY="${SUMMARY}Using fcitx         : YES\n"
  4222 else
  4223     SUMMARY="${SUMMARY}Using fcitx         : NO\n"
  4224 fi
  4225 AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
  4226 
  4227 AC_OUTPUT