configure.in
author Sylvain Becker <sylvain.becker@gmail.com>
Mon, 21 Jan 2019 23:41:43 +0100
changeset 12569 05aff4771d9a
parent 12469 99d8b18acf8a
permissions -rw-r--r--
Fixed bug 4024 - GameController error "Unexpected controller element"

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