configure.in
author Ryan C. Gordon <icculus@icculus.org>
Tue, 15 May 2018 01:04:11 -0400
changeset 11987 0c284754e25b
parent 11956 f162f5d7798d
child 12033 bc702c5a7c3a
permissions -rw-r--r--
audio: converting int32 to/from float shouldn't use doubles.

The concern is that a massive int sample, like 0x7FFFFFFF, won't fit in a
float32, which doesn't have enough bits to hold a whole number this large,
just to divide it to get a value between 0 and 1.
Previously we would convert to double, to get more bits, do the division, and
cast back to a float, but this is expensive.

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