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