configure.in
author Ryan C. Gordon <icculus@icculus.org>
Wed, 07 Feb 2018 13:13:55 -0500
changeset 11848 2f157c1ca383
parent 11829 fcbafc9e443c
child 11851 8f295e7acefd
permissions -rw-r--r--
wayland: Add support for xdg-shell protocol (unstable v6).

This is meant to be the desktop-enhanced version of wl_shell. Right now we
just match what the existing wl_shell code does, but there are other areas of
functionality available to us now, that we can fill in later.

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