configure.ac
author Ozkan Sezer
Thu, 26 Nov 2020 10:47:33 +0300
changeset 14393 86796edcae76
parent 14380 7ef432b4e3dc
permissions -rw-r--r--
SDL_rawinputjoystick.c: fix ambiguous 'else' warning

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