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