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