configure.in
author Ryan C. Gordon <icculus@icculus.org>
Mon, 01 May 2017 18:39:05 -0400
changeset 10983 9f9160df4f1f
parent 10921 f426dbef4aa0
child 10984 fb6d770b08f9
permissions -rw-r--r--
haiku: Various fixes from haikuports.

Based on patch here:

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