configure.ac
changeset 12673 95689b6959db
child 12708 f6193f829c8a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/configure.ac	Mon Mar 25 23:01:32 2019 +1100
     1.3 @@ -0,0 +1,4160 @@
     1.4 +dnl Process this file with autoconf to produce a configure script.
     1.5 +AC_INIT(README.txt)
     1.6 +AC_CONFIG_HEADER(include/SDL_config.h)
     1.7 +AC_CONFIG_AUX_DIR(build-scripts)
     1.8 +AC_CONFIG_MACRO_DIR([acinclude])
     1.9 +
    1.10 +dnl Save the CFLAGS to see whether they were passed in or generated
    1.11 +orig_CFLAGS="$CFLAGS"
    1.12 +
    1.13 +dnl Set various version strings - taken gratefully from the GTk sources
    1.14 +#
    1.15 +# Making releases:
    1.16 +# Edit include/SDL_version.h and change the version, then:
    1.17 +#   SDL_MICRO_VERSION += 1;
    1.18 +#   SDL_INTERFACE_AGE += 1;
    1.19 +#   SDL_BINARY_AGE += 1;
    1.20 +# if any functions have been added, set SDL_INTERFACE_AGE to 0.
    1.21 +# if backwards compatibility has been broken,
    1.22 +# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
    1.23 +#
    1.24 +SDL_MAJOR_VERSION=2
    1.25 +SDL_MINOR_VERSION=0
    1.26 +SDL_MICRO_VERSION=9
    1.27 +SDL_INTERFACE_AGE=0
    1.28 +SDL_BINARY_AGE=9
    1.29 +SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
    1.30 +
    1.31 +AC_SUBST(SDL_MAJOR_VERSION)
    1.32 +AC_SUBST(SDL_MINOR_VERSION)
    1.33 +AC_SUBST(SDL_MICRO_VERSION)
    1.34 +AC_SUBST(SDL_INTERFACE_AGE)
    1.35 +AC_SUBST(SDL_BINARY_AGE)
    1.36 +AC_SUBST(SDL_VERSION)
    1.37 +
    1.38 +# libtool versioning
    1.39 +LT_INIT([win32-dll])
    1.40 +
    1.41 +LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
    1.42 +LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
    1.43 +LT_REVISION=$SDL_INTERFACE_AGE
    1.44 +LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
    1.45 +m4_pattern_allow([^LT_])
    1.46 +
    1.47 +AC_SUBST(LT_RELEASE)
    1.48 +AC_SUBST(LT_CURRENT)
    1.49 +AC_SUBST(LT_REVISION)
    1.50 +AC_SUBST(LT_AGE)
    1.51 +
    1.52 +dnl Detect the canonical build and host environments
    1.53 +dnl AC_CANONICAL_HOST
    1.54 +
    1.55 +dnl Check for tools
    1.56 +AC_PROG_LIBTOOL
    1.57 +AC_PROG_CC
    1.58 +AC_PROG_CXX
    1.59 +AC_PROG_INSTALL
    1.60 +AC_PROG_MAKE_SET
    1.61 +AC_CHECK_TOOL(WINDRES, [windres], [:])
    1.62 +PKG_PROG_PKG_CONFIG
    1.63 +
    1.64 +dnl Make sure that srcdir is a full pathname
    1.65 +case "$host" in
    1.66 +    *-*-mingw32*)
    1.67 +        # Except on msys, where make can't handle full pathnames (bug 1972)
    1.68 +        ;;
    1.69 +    *)
    1.70 +        srcdir=`cd $srcdir && pwd`
    1.71 +        ;;
    1.72 +esac
    1.73 +
    1.74 +dnl Set up the compiler and linker flags
    1.75 +INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos"
    1.76 +if test x$srcdir != x.; then
    1.77 +    INCLUDE="-Iinclude $INCLUDE"
    1.78 +elif test -d .hg; then
    1.79 +    AC_MSG_ERROR([
    1.80 +*** When building from Mercurial you should configure and build in a
    1.81 +    separate directory so you don't clobber SDL_config.h, SDL_revision.h
    1.82 +])
    1.83 +fi
    1.84 +BASE_CFLAGS=""
    1.85 +BASE_LDFLAGS=""
    1.86 +case "$host" in
    1.87 +    *-*-cygwin*)
    1.88 +        # We build SDL on cygwin without the UNIX emulation layer
    1.89 +        save_CFLAGS="$CFLAGS"
    1.90 +        have_no_cygwin=no
    1.91 +        AC_MSG_CHECKING(for GCC -mno-cygwin option)
    1.92 +        CFLAGS="$save_CFLAGS -mno-cygwin"
    1.93 +
    1.94 +        AC_TRY_COMPILE([
    1.95 +        ],[
    1.96 +        ],[
    1.97 +        have_no_cygwin=yes
    1.98 +        ])
    1.99 +        AC_MSG_RESULT($have_no_cygwin)
   1.100 +        CFLAGS="$save_CFLAGS"
   1.101 +
   1.102 +        if test x$have_no_cygwin = xyes; then
   1.103 +            BASE_CFLAGS="-mno-cygwin"
   1.104 +            BASE_LDFLAGS="-mno-cygwin"
   1.105 +        fi
   1.106 +        BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw"
   1.107 +        ;;
   1.108 +esac
   1.109 +# Uncomment the following line if you want to force SDL and applications
   1.110 +# built with it to be compiled for a particular architecture.
   1.111 +#AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
   1.112 +BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H"
   1.113 +# The default optimization for SDL is -O3 (Bug #31)
   1.114 +if test "x$orig_CFLAGS" = x; then
   1.115 +    BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
   1.116 +fi
   1.117 +EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
   1.118 +BUILD_LDFLAGS="$LDFLAGS"
   1.119 +EXTRA_LDFLAGS="$BASE_LDFLAGS"
   1.120 +## These are common directories to find software packages
   1.121 +#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
   1.122 +#    if test -d $path/include; then
   1.123 +#        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
   1.124 +#    fi
   1.125 +#    if test -d $path/lib; then
   1.126 +#        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
   1.127 +#    fi
   1.128 +#done
   1.129 +SDL_CFLAGS="$BASE_CFLAGS"
   1.130 +SDL_LIBS="-lSDL2"
   1.131 +if test "x$BASE_LDFLAGS" != x; then
   1.132 +    SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS"
   1.133 +fi
   1.134 +if test "x$EXTRA_CFLAGS" != x; then
   1.135 +    CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
   1.136 +    CFLAGS="$CFLAGS $EXTRA_CFLAGS"
   1.137 +fi
   1.138 +if test "x$EXTRA_LDFLAGS" != x; then
   1.139 +    LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
   1.140 +fi
   1.141 +
   1.142 +dnl set this to use on systems that use lib64 instead of lib
   1.143 +base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
   1.144 +
   1.145 +dnl Function to find a library in the compiler search path
   1.146 +find_lib()
   1.147 +{
   1.148 +    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
   1.149 +    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
   1.150 +    env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
   1.151 +    if test "$cross_compiling" = yes; then
   1.152 +        host_lib_path=""
   1.153 +    else
   1.154 +        host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
   1.155 +    fi
   1.156 +    for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
   1.157 +        lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
   1.158 +        if test x$lib != x; then
   1.159 +            echo $lib
   1.160 +            return
   1.161 +        fi
   1.162 +    done
   1.163 +    # Try again, this time allowing more than one version digit after the .so
   1.164 +    for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
   1.165 +        lib=[`ls -- $path/$1 2>/dev/null | sed -e 's,.*/,,' | sort | tail -1`]
   1.166 +        if test x$lib != x; then
   1.167 +            echo $lib
   1.168 +            return
   1.169 +        fi
   1.170 +    done
   1.171 +}
   1.172 +
   1.173 +dnl Check for compiler characteristics
   1.174 +AC_C_CONST
   1.175 +AC_C_INLINE
   1.176 +AC_C_VOLATILE
   1.177 +
   1.178 +dnl See whether we want assertions for debugging/sanity checking SDL itself.
   1.179 +AC_ARG_ENABLE(assertions,
   1.180 +AS_HELP_STRING([--enable-assertions],
   1.181 +               [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
   1.182 +              , enable_assertions=auto)
   1.183 +case "$enable_assertions" in
   1.184 +    auto) # Use optimization settings to determine assertion level
   1.185 +        ;;
   1.186 +    disabled)
   1.187 +        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
   1.188 +        ;;
   1.189 +    release)
   1.190 +        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
   1.191 +        ;;
   1.192 +    enabled)
   1.193 +        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
   1.194 +        ;;
   1.195 +    paranoid)
   1.196 +        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
   1.197 +        ;;
   1.198 +    *)
   1.199 +        AC_MSG_ERROR([*** unknown assertion level. stop.])
   1.200 +        ;;
   1.201 +esac
   1.202 +
   1.203 +dnl See whether we can use gcc style dependency tracking
   1.204 +AC_ARG_ENABLE(dependency-tracking,
   1.205 +AS_HELP_STRING([--enable-dependency-tracking],
   1.206 +               [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
   1.207 +              , enable_dependency_tracking=yes)
   1.208 +if test x$enable_dependency_tracking = xyes; then
   1.209 +    have_gcc_mmd_mt=no
   1.210 +    AC_MSG_CHECKING(for GCC -MMD -MT option)
   1.211 +    AC_TRY_COMPILE([
   1.212 +    #if !defined(__GNUC__) || __GNUC__ < 3
   1.213 +    #error Dependency tracking requires GCC 3.0 or newer
   1.214 +    #endif
   1.215 +    ],[
   1.216 +    ],[
   1.217 +    have_gcc_mmd_mt=yes
   1.218 +    ])
   1.219 +    AC_MSG_RESULT($have_gcc_mmd_mt)
   1.220 +
   1.221 +    if test x$have_gcc_mmd_mt = xyes; then
   1.222 +        DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
   1.223 +    fi
   1.224 +fi
   1.225 +
   1.226 +AC_MSG_CHECKING(for linker option --no-undefined)
   1.227 +have_no_undefined=no
   1.228 +case "$host" in
   1.229 +    dnl Skip this on platforms where it is just simply busted.
   1.230 +    *-*-openbsd*)
   1.231 +        ;;
   1.232 +
   1.233 +    *)
   1.234 +        save_LDFLAGS="$LDFLAGS"
   1.235 +        LDFLAGS="$LDFLAGS -Wl,--no-undefined"
   1.236 +        AC_TRY_LINK([
   1.237 +        ],[
   1.238 +        ],[
   1.239 +        have_no_undefined=yes
   1.240 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined"
   1.241 +        ])
   1.242 +        LDFLAGS="$save_LDFLAGS"
   1.243 +        ;;
   1.244 +esac
   1.245 +AC_MSG_RESULT($have_no_undefined)
   1.246 +
   1.247 +AC_MSG_CHECKING(for linker option --dynamicbase)
   1.248 +have_dynamicbase=no
   1.249 +case "$host" in
   1.250 +    *)
   1.251 +        save_LDFLAGS="$LDFLAGS"
   1.252 +        LDFLAGS="$LDFLAGS -Wl,--dynamicbase"
   1.253 +        AC_TRY_LINK([
   1.254 +        ],[
   1.255 +        ],[
   1.256 +        have_dynamicbase=yes
   1.257 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--dynamicbase"
   1.258 +        ])
   1.259 +        LDFLAGS="$save_LDFLAGS"
   1.260 +        ;;
   1.261 +esac
   1.262 +AC_MSG_RESULT($have_dynamicbase)
   1.263 +
   1.264 +AC_MSG_CHECKING(for linker option --nxcompat)
   1.265 +have_nxcompat=no
   1.266 +case "$host" in
   1.267 +    *)
   1.268 +        save_LDFLAGS="$LDFLAGS"
   1.269 +        LDFLAGS="$LDFLAGS -Wl,--nxcompat"
   1.270 +        AC_TRY_LINK([
   1.271 +        ],[
   1.272 +        ],[
   1.273 +        have_nxcompat=yes
   1.274 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--nxcompat"
   1.275 +        ])
   1.276 +        LDFLAGS="$save_LDFLAGS"
   1.277 +        ;;
   1.278 +esac
   1.279 +AC_MSG_RESULT($have_nxcompat)
   1.280 +
   1.281 +AC_MSG_CHECKING(for linker option --high-entropy-va)
   1.282 +have_high_entropy_va=no
   1.283 +case "$host" in
   1.284 +    *)
   1.285 +        save_LDFLAGS="$LDFLAGS"
   1.286 +        LDFLAGS="$LDFLAGS -Wl,--high-entropy-va"
   1.287 +        AC_TRY_LINK([
   1.288 +        ],[
   1.289 +        ],[
   1.290 +        have_high_entropy_va=yes
   1.291 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--high-entropy-va"
   1.292 +        ])
   1.293 +        LDFLAGS="$save_LDFLAGS"
   1.294 +        ;;
   1.295 +esac
   1.296 +AC_MSG_RESULT($have_high_entropy_va)
   1.297 +
   1.298 +dnl See whether we are allowed to use the system C library
   1.299 +AC_ARG_ENABLE(libc,
   1.300 +AS_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
   1.301 +              , enable_libc=yes)
   1.302 +if test x$enable_libc = xyes; then
   1.303 +    AC_DEFINE(HAVE_LIBC, 1, [ ])
   1.304 +
   1.305 +    dnl Check for C library headers
   1.306 +    AC_HEADER_STDC
   1.307 +    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)
   1.308 +
   1.309 +    dnl Check for typedefs, structures, etc.
   1.310 +    AC_TYPE_SIZE_T
   1.311 +
   1.312 +    dnl Check for defines
   1.313 +    AC_CHECK_DEFINE(M_PI, math.h)
   1.314 +
   1.315 +    dnl Checks for library functions.
   1.316 +    case "$host" in
   1.317 +    *-*-cygwin* | *-*-mingw32*)
   1.318 +        ;;
   1.319 +    *)
   1.320 +        AC_FUNC_ALLOCA
   1.321 +        ;;
   1.322 +    esac
   1.323 +
   1.324 +    AC_FUNC_MEMCMP
   1.325 +    if test x$ac_cv_func_memcmp_working = xyes; then
   1.326 +        AC_DEFINE(HAVE_MEMCMP, 1, [ ])
   1.327 +    fi
   1.328 +    AC_FUNC_STRTOD
   1.329 +    if test x$ac_cv_func_strtod = xyes; then
   1.330 +        AC_DEFINE(HAVE_STRTOD, 1, [ ])
   1.331 +    fi
   1.332 +    AC_CHECK_FUNC(mprotect,
   1.333 +        AC_TRY_COMPILE([
   1.334 +          #include <sys/types.h>
   1.335 +          #include <sys/mman.h>
   1.336 +        ],[
   1.337 +        ],[
   1.338 +        AC_DEFINE(HAVE_MPROTECT, 1, [ ])
   1.339 +        ]),
   1.340 +    )
   1.341 +    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll)
   1.342 +
   1.343 +    AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
   1.344 +    AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
   1.345 +
   1.346 +    AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
   1.347 +    AC_CHECK_FUNCS(iconv)
   1.348 +
   1.349 +    AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
   1.350 +
   1.351 +    dnl Check for additional non-standard headers
   1.352 +    AC_CHECK_HEADERS(libunwind.h)
   1.353 +fi
   1.354 +
   1.355 +dnl AC_CHECK_SIZEOF(void*)
   1.356 +
   1.357 +dnl See whether we can use gcc atomic operations on this architecture
   1.358 +AC_ARG_ENABLE(gcc-atomics,
   1.359 +AS_HELP_STRING([--enable-gcc-atomics],
   1.360 +               [Use gcc builtin atomics [[default=yes]]]),
   1.361 +              , enable_gcc_atomics=yes)
   1.362 +if test x$enable_gcc_atomics = xyes; then
   1.363 +    have_gcc_atomics=no
   1.364 +    AC_MSG_CHECKING(for GCC builtin atomic operations)
   1.365 +    AC_TRY_LINK([
   1.366 +    ],[
   1.367 +    int a;
   1.368 +    void *x, *y, *z;
   1.369 +    __sync_lock_test_and_set(&a, 4);
   1.370 +    __sync_lock_test_and_set(&x, y);
   1.371 +    __sync_fetch_and_add(&a, 1);
   1.372 +    __sync_bool_compare_and_swap(&a, 5, 10);
   1.373 +    __sync_bool_compare_and_swap(&x, y, z);
   1.374 +    ],[
   1.375 +    have_gcc_atomics=yes
   1.376 +    ])
   1.377 +    AC_MSG_RESULT($have_gcc_atomics)
   1.378 +
   1.379 +    if test x$have_gcc_atomics = xyes; then
   1.380 +        AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
   1.381 +    else
   1.382 +        # See if we have the minimum operation needed for GCC atomics
   1.383 +        AC_TRY_LINK([
   1.384 +        ],[
   1.385 +        int a;
   1.386 +        __sync_lock_test_and_set(&a, 1);
   1.387 +        __sync_lock_release(&a);
   1.388 +        ],[
   1.389 +        have_gcc_sync_lock_test_and_set=yes
   1.390 +        ])
   1.391 +        if test x$have_gcc_sync_lock_test_and_set = xyes; then
   1.392 +            AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
   1.393 +        fi
   1.394 +    fi
   1.395 +fi
   1.396 +
   1.397 +# Standard C sources
   1.398 +SOURCES="$SOURCES $srcdir/src/*.c"
   1.399 +SOURCES="$SOURCES $srcdir/src/atomic/*.c"
   1.400 +SOURCES="$SOURCES $srcdir/src/audio/*.c"
   1.401 +SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
   1.402 +SOURCES="$SOURCES $srcdir/src/dynapi/*.c"
   1.403 +SOURCES="$SOURCES $srcdir/src/events/*.c"
   1.404 +SOURCES="$SOURCES $srcdir/src/file/*.c"
   1.405 +SOURCES="$SOURCES $srcdir/src/haptic/*.c"
   1.406 +SOURCES="$SOURCES $srcdir/src/joystick/*.c"
   1.407 +SOURCES="$SOURCES $srcdir/src/libm/*.c"
   1.408 +SOURCES="$SOURCES $srcdir/src/power/*.c"
   1.409 +#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
   1.410 +SOURCES="$SOURCES $srcdir/src/render/*.c"
   1.411 +SOURCES="$SOURCES $srcdir/src/render/*/*.c"
   1.412 +SOURCES="$SOURCES $srcdir/src/sensor/*.c"
   1.413 +SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
   1.414 +SOURCES="$SOURCES $srcdir/src/thread/*.c"
   1.415 +SOURCES="$SOURCES $srcdir/src/timer/*.c"
   1.416 +SOURCES="$SOURCES $srcdir/src/video/*.c"
   1.417 +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
   1.418 +
   1.419 +dnl Enable/disable various subsystems of the SDL library
   1.420 +
   1.421 +AC_ARG_ENABLE(atomic,
   1.422 +AS_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
   1.423 +              , enable_atomic=yes)
   1.424 +if test x$enable_atomic != xyes; then
   1.425 +    AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
   1.426 +else
   1.427 +    SUMMARY_modules="${SUMMARY_modules} atomic"
   1.428 +fi
   1.429 +AC_ARG_ENABLE(audio,
   1.430 +AS_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
   1.431 +              , enable_audio=yes)
   1.432 +if test x$enable_audio != xyes; then
   1.433 +    AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
   1.434 +else
   1.435 +    SUMMARY_modules="${SUMMARY_modules} audio"
   1.436 +fi
   1.437 +AC_ARG_ENABLE(video,
   1.438 +AS_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
   1.439 +              , enable_video=yes)
   1.440 +if test x$enable_video != xyes; then
   1.441 +    AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
   1.442 +else
   1.443 +    SUMMARY_modules="${SUMMARY_modules} video"
   1.444 +fi
   1.445 +AC_ARG_ENABLE(render,
   1.446 +AS_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
   1.447 +              , enable_render=yes)
   1.448 +if test x$enable_render != xyes; then
   1.449 +    AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
   1.450 +else
   1.451 +    SUMMARY_modules="${SUMMARY_modules} render"
   1.452 +fi
   1.453 +AC_ARG_ENABLE(events,
   1.454 +AS_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
   1.455 +              , enable_events=yes)
   1.456 +if test x$enable_events != xyes; then
   1.457 +    AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
   1.458 +else
   1.459 +    SUMMARY_modules="${SUMMARY_modules} events"
   1.460 +fi
   1.461 +AC_ARG_ENABLE(joystick,
   1.462 +AS_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
   1.463 +              , enable_joystick=yes)
   1.464 +if test x$enable_joystick != xyes; then
   1.465 +    AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
   1.466 +else
   1.467 +    SUMMARY_modules="${SUMMARY_modules} joystick"
   1.468 +fi
   1.469 +AC_ARG_ENABLE(haptic,
   1.470 +AS_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
   1.471 +              , enable_haptic=yes)
   1.472 +if test x$enable_haptic != xyes; then
   1.473 +    AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
   1.474 +else
   1.475 +    SUMMARY_modules="${SUMMARY_modules} haptic"
   1.476 +fi
   1.477 +AC_ARG_ENABLE(sensor,
   1.478 +AS_HELP_STRING([--enable-sensor], [Enable the sensor subsystem [[default=yes]]]),
   1.479 +              , enable_sensor=yes)
   1.480 +if test x$enable_sensor != xyes; then
   1.481 +    AC_DEFINE(SDL_SENSOR_DISABLED, 1, [ ])
   1.482 +else
   1.483 +    SUMMARY_modules="${SUMMARY_modules} sensor"
   1.484 +fi
   1.485 +AC_ARG_ENABLE(power,
   1.486 +AS_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
   1.487 +              , enable_power=yes)
   1.488 +if test x$enable_power != xyes; then
   1.489 +    AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
   1.490 +else
   1.491 +    SUMMARY_modules="${SUMMARY_modules} power"
   1.492 +fi
   1.493 +AC_ARG_ENABLE(filesystem,
   1.494 +AS_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
   1.495 +              , enable_filesystem=yes)
   1.496 +if test x$enable_filesystem != xyes; then
   1.497 +    AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
   1.498 +else
   1.499 +    SUMMARY_modules="${SUMMARY_modules} filesystem"
   1.500 +fi
   1.501 +AC_ARG_ENABLE(threads,
   1.502 +AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
   1.503 +              , enable_threads=yes)
   1.504 +if test x$enable_threads != xyes; then
   1.505 +    AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
   1.506 +else
   1.507 +    SUMMARY_modules="${SUMMARY_modules} threads"
   1.508 +fi
   1.509 +AC_ARG_ENABLE(timers,
   1.510 +AS_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
   1.511 +              , enable_timers=yes)
   1.512 +if test x$enable_timers != xyes; then
   1.513 +    AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
   1.514 +else
   1.515 +    SUMMARY_modules="${SUMMARY_modules} timers"
   1.516 +fi
   1.517 +AC_ARG_ENABLE(file,
   1.518 +AS_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
   1.519 +              , enable_file=yes)
   1.520 +if test x$enable_file != xyes; then
   1.521 +    AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
   1.522 +else
   1.523 +    SUMMARY_modules="${SUMMARY_modules} file"
   1.524 +fi
   1.525 +AC_ARG_ENABLE(loadso,
   1.526 +AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
   1.527 +              , enable_loadso=yes)
   1.528 +if test x$enable_loadso != xyes; then
   1.529 +    AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
   1.530 +else
   1.531 +    SUMMARY_modules="${SUMMARY_modules} loadso"
   1.532 +fi
   1.533 +AC_ARG_ENABLE(cpuinfo,
   1.534 +AS_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
   1.535 +              , enable_cpuinfo=yes)
   1.536 +if test x$enable_cpuinfo != xyes; then
   1.537 +    AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
   1.538 +else
   1.539 +    SUMMARY_modules="${SUMMARY_modules} cpuinfo"
   1.540 +fi
   1.541 +AC_ARG_ENABLE(assembly,
   1.542 +AS_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
   1.543 +              , enable_assembly=yes)
   1.544 +if test x$enable_assembly = xyes; then
   1.545 +    SUMMARY_modules="${SUMMARY_modules} assembly"
   1.546 +
   1.547 +    AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
   1.548 +
   1.549 +    # Make sure that we don't generate floating point code that would
   1.550 +    # cause illegal instruction exceptions on older processors
   1.551 +    case "$host" in
   1.552 +        *-*-darwin*)
   1.553 +            # Don't need to worry about Apple hardware, it's all SSE capable
   1.554 +            default_ssemath=yes
   1.555 +            ;;
   1.556 +        *64-*-*)
   1.557 +            # x86 64-bit architectures all have SSE instructions
   1.558 +            default_ssemath=yes
   1.559 +            ;;
   1.560 +        *)
   1.561 +            default_ssemath=no
   1.562 +            ;;
   1.563 +    esac
   1.564 +    AC_ARG_ENABLE(ssemath,
   1.565 +AS_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]),
   1.566 +                  , enable_ssemath=$default_ssemath)
   1.567 +    if test x$enable_ssemath = xno; then
   1.568 +        if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then
   1.569 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
   1.570 +        fi
   1.571 +    fi
   1.572 +
   1.573 +    dnl Check for various instruction support
   1.574 +    AC_ARG_ENABLE(mmx,
   1.575 +AS_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
   1.576 +                  , enable_mmx=yes)
   1.577 +    if test x$enable_mmx = xyes; then
   1.578 +        save_CFLAGS="$CFLAGS"
   1.579 +        have_gcc_mmx=no
   1.580 +        AC_MSG_CHECKING(for GCC -mmmx option)
   1.581 +        mmx_CFLAGS="-mmmx"
   1.582 +        CFLAGS="$save_CFLAGS $mmx_CFLAGS"
   1.583 +
   1.584 +        AC_TRY_COMPILE([
   1.585 +        #ifdef __MINGW32__
   1.586 +        #include <_mingw.h>
   1.587 +        #ifdef __MINGW64_VERSION_MAJOR
   1.588 +        #include <intrin.h>
   1.589 +        #else
   1.590 +        #include <mmintrin.h>
   1.591 +        #endif
   1.592 +        #else
   1.593 +        #include <mmintrin.h>
   1.594 +        #endif
   1.595 +        #ifndef __MMX__
   1.596 +        #error Assembler CPP flag not enabled
   1.597 +        #endif
   1.598 +        ],[
   1.599 +        ],[
   1.600 +        have_gcc_mmx=yes
   1.601 +        ])
   1.602 +        AC_MSG_RESULT($have_gcc_mmx)
   1.603 +        CFLAGS="$save_CFLAGS"
   1.604 +
   1.605 +        if test x$have_gcc_mmx = xyes; then
   1.606 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
   1.607 +            SUMMARY_math="${SUMMARY_math} mmx"
   1.608 +        fi
   1.609 +    fi
   1.610 +
   1.611 +    AC_ARG_ENABLE(3dnow,
   1.612 +AS_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
   1.613 +                  , enable_3dnow=yes)
   1.614 +    if test x$enable_3dnow = xyes; then
   1.615 +        save_CFLAGS="$CFLAGS"
   1.616 +        have_gcc_3dnow=no
   1.617 +        AC_MSG_CHECKING(for GCC -m3dnow option)
   1.618 +        amd3dnow_CFLAGS="-m3dnow"
   1.619 +        CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
   1.620 +
   1.621 +        AC_TRY_LINK([
   1.622 +        #include <mm3dnow.h>
   1.623 +        #ifndef __3dNOW__
   1.624 +        #error Assembler CPP flag not enabled
   1.625 +        #endif
   1.626 +        ],[
   1.627 +        void *p = 0;
   1.628 +        _m_prefetch(p);
   1.629 +        ],[
   1.630 +        have_gcc_3dnow=yes
   1.631 +        ])
   1.632 +        AC_MSG_RESULT($have_gcc_3dnow)
   1.633 +        CFLAGS="$save_CFLAGS"
   1.634 +
   1.635 +        if test x$have_gcc_3dnow = xyes; then
   1.636 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
   1.637 +            SUMMARY_math="${SUMMARY_math} 3dnow"
   1.638 +        fi
   1.639 +    fi
   1.640 +
   1.641 +    AC_ARG_ENABLE(sse,
   1.642 +AS_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
   1.643 +                  , enable_sse=yes)
   1.644 +    if test x$enable_sse = xyes; then
   1.645 +        save_CFLAGS="$CFLAGS"
   1.646 +        have_gcc_sse=no
   1.647 +        AC_MSG_CHECKING(for GCC -msse option)
   1.648 +        sse_CFLAGS="-msse"
   1.649 +        CFLAGS="$save_CFLAGS $sse_CFLAGS"
   1.650 +
   1.651 +        AC_TRY_COMPILE([
   1.652 +        #ifdef __MINGW32__
   1.653 +        #include <_mingw.h>
   1.654 +        #ifdef __MINGW64_VERSION_MAJOR
   1.655 +        #include <intrin.h>
   1.656 +        #else
   1.657 +        #include <xmmintrin.h>
   1.658 +        #endif
   1.659 +        #else
   1.660 +        #include <xmmintrin.h>
   1.661 +        #endif
   1.662 +        #ifndef __SSE__
   1.663 +        #error Assembler CPP flag not enabled
   1.664 +        #endif
   1.665 +        ],[
   1.666 +        ],[
   1.667 +        have_gcc_sse=yes
   1.668 +        ])
   1.669 +        AC_MSG_RESULT($have_gcc_sse)
   1.670 +        CFLAGS="$save_CFLAGS"
   1.671 +
   1.672 +        if test x$have_gcc_sse = xyes; then
   1.673 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
   1.674 +            SUMMARY_math="${SUMMARY_math} sse"
   1.675 +        fi
   1.676 +    fi
   1.677 +
   1.678 +    AC_ARG_ENABLE(sse2,
   1.679 +AS_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]),
   1.680 +                  , enable_sse2=$default_ssemath)
   1.681 +    if test x$enable_sse2 = xyes; then
   1.682 +        save_CFLAGS="$CFLAGS"
   1.683 +        have_gcc_sse2=no
   1.684 +        AC_MSG_CHECKING(for GCC -msse2 option)
   1.685 +        sse2_CFLAGS="-msse2"
   1.686 +        CFLAGS="$save_CFLAGS $sse2_CFLAGS"
   1.687 +
   1.688 +        AC_TRY_COMPILE([
   1.689 +        #ifdef __MINGW32__
   1.690 +        #include <_mingw.h>
   1.691 +        #ifdef __MINGW64_VERSION_MAJOR
   1.692 +        #include <intrin.h>
   1.693 +        #else
   1.694 +        #include <emmintrin.h>
   1.695 +        #endif
   1.696 +        #else
   1.697 +        #include <emmintrin.h>
   1.698 +        #endif
   1.699 +        #ifndef __SSE2__
   1.700 +        #error Assembler CPP flag not enabled
   1.701 +        #endif
   1.702 +        ],[
   1.703 +        ],[
   1.704 +        have_gcc_sse2=yes
   1.705 +        ])
   1.706 +        AC_MSG_RESULT($have_gcc_sse2)
   1.707 +        CFLAGS="$save_CFLAGS"
   1.708 +
   1.709 +        if test x$have_gcc_sse2 = xyes; then
   1.710 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
   1.711 +            SUMMARY_math="${SUMMARY_math} sse2"
   1.712 +        fi
   1.713 +    fi
   1.714 +
   1.715 +    AC_ARG_ENABLE(sse3,
   1.716 +AS_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]),
   1.717 +                  , enable_sse3=$default_ssemath)
   1.718 +    if test x$enable_sse3 = xyes; then
   1.719 +        save_CFLAGS="$CFLAGS"
   1.720 +        have_gcc_sse3=no
   1.721 +        AC_MSG_CHECKING(for GCC -msse3 option)
   1.722 +        sse3_CFLAGS="-msse3"
   1.723 +        CFLAGS="$save_CFLAGS $sse3_CFLAGS"
   1.724 +
   1.725 +        AC_TRY_COMPILE([
   1.726 +        #ifdef __MINGW32__
   1.727 +        #include <_mingw.h>
   1.728 +        #ifdef __MINGW64_VERSION_MAJOR
   1.729 +        #include <intrin.h>
   1.730 +        #else
   1.731 +        #include <pmmintrin.h>
   1.732 +        #endif
   1.733 +        #else
   1.734 +        #include <pmmintrin.h>
   1.735 +        #endif
   1.736 +        #ifndef __SSE2__
   1.737 +        #error Assembler CPP flag not enabled
   1.738 +        #endif
   1.739 +        ],[
   1.740 +        ],[
   1.741 +        have_gcc_sse3=yes
   1.742 +        ])
   1.743 +        AC_MSG_RESULT($have_gcc_sse3)
   1.744 +        CFLAGS="$save_CFLAGS"
   1.745 +
   1.746 +        if test x$have_gcc_sse3 = xyes; then
   1.747 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS"
   1.748 +            SUMMARY_math="${SUMMARY_math} sse3"
   1.749 +        fi
   1.750 +    fi
   1.751 +
   1.752 +    AC_CHECK_HEADER(immintrin.h,
   1.753 +                    have_immintrin_h_hdr=yes,
   1.754 +                    have_immintrin_h_hdr=no)
   1.755 +    if test x$have_immintrin_h_hdr = xyes; then
   1.756 +        AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ])
   1.757 +    fi
   1.758 +
   1.759 +    AC_ARG_ENABLE(altivec,
   1.760 +AS_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
   1.761 +                  , enable_altivec=yes)
   1.762 +    if test x$enable_altivec = xyes; then
   1.763 +        save_CFLAGS="$CFLAGS"
   1.764 +        have_gcc_altivec=no
   1.765 +        have_altivec_h_hdr=no
   1.766 +        altivec_CFLAGS="-maltivec"
   1.767 +        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   1.768 +
   1.769 +        AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
   1.770 +        AC_TRY_COMPILE([
   1.771 +        #include <altivec.h>
   1.772 +        vector unsigned int vzero() {
   1.773 +            return vec_splat_u32(0);
   1.774 +        }
   1.775 +        ],[
   1.776 +        ],[
   1.777 +        have_gcc_altivec=yes
   1.778 +        have_altivec_h_hdr=yes
   1.779 +        ])
   1.780 +        AC_MSG_RESULT($have_gcc_altivec)
   1.781 +
   1.782 +        if test x$have_gcc_altivec = xno; then
   1.783 +            AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
   1.784 +            AC_TRY_COMPILE([
   1.785 +            vector unsigned int vzero() {
   1.786 +                return vec_splat_u32(0);
   1.787 +            }
   1.788 +            ],[
   1.789 +            ],[
   1.790 +            have_gcc_altivec=yes
   1.791 +            ])
   1.792 +            AC_MSG_RESULT($have_gcc_altivec)
   1.793 +        fi
   1.794 +
   1.795 +        if test x$have_gcc_altivec = xno; then
   1.796 +            AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
   1.797 +            altivec_CFLAGS="-faltivec"
   1.798 +            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   1.799 +            AC_TRY_COMPILE([
   1.800 +            #include <altivec.h>
   1.801 +            vector unsigned int vzero() {
   1.802 +                return vec_splat_u32(0);
   1.803 +            }
   1.804 +            ],[
   1.805 +            ],[
   1.806 +            have_gcc_altivec=yes
   1.807 +            have_altivec_h_hdr=yes
   1.808 +            ])
   1.809 +            AC_MSG_RESULT($have_gcc_altivec)
   1.810 +        fi
   1.811 +
   1.812 +        if test x$have_gcc_altivec = xno; then
   1.813 +            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
   1.814 +            AC_TRY_COMPILE([
   1.815 +            vector unsigned int vzero() {
   1.816 +                return vec_splat_u32(0);
   1.817 +            }
   1.818 +            ],[
   1.819 +            ],[
   1.820 +            have_gcc_altivec=yes
   1.821 +            ])
   1.822 +            AC_MSG_RESULT($have_gcc_altivec)
   1.823 +        fi
   1.824 +        CFLAGS="$save_CFLAGS"
   1.825 +
   1.826 +        if test x$have_gcc_altivec = xyes; then
   1.827 +            AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
   1.828 +            if test x$have_altivec_h_hdr = xyes; then
   1.829 +              AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
   1.830 +            fi
   1.831 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
   1.832 +            SUMMARY_math="${SUMMARY_math} altivec"
   1.833 +        fi
   1.834 +    fi
   1.835 +fi
   1.836 +
   1.837 +dnl See if the OSS audio interface is supported
   1.838 +CheckOSS()
   1.839 +{
   1.840 +    AC_ARG_ENABLE(oss,
   1.841 +AS_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
   1.842 +                  , enable_oss=maybe)
   1.843 +
   1.844 +    # OpenBSD "has" OSS, but it's not really for app use. They want you to
   1.845 +    #  use sndio instead. So on there, we default to disabled. You can force
   1.846 +    #  it on if you really want, though.
   1.847 +    if test x$enable_oss = xmaybe; then
   1.848 +        enable_oss=yes
   1.849 +        case "$host" in
   1.850 +            *-*-openbsd*)
   1.851 +                enable_oss=no;;
   1.852 +        esac
   1.853 +    fi
   1.854 +
   1.855 +    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
   1.856 +        AC_MSG_CHECKING(for OSS audio support)
   1.857 +        have_oss=no
   1.858 +        if test x$have_oss != xyes; then
   1.859 +            AC_TRY_COMPILE([
   1.860 +              #include <sys/soundcard.h>
   1.861 +            ],[
   1.862 +              int arg = SNDCTL_DSP_SETFRAGMENT;
   1.863 +            ],[
   1.864 +            have_oss=yes
   1.865 +            ])
   1.866 +        fi
   1.867 +        if test x$have_oss != xyes; then
   1.868 +            AC_TRY_COMPILE([
   1.869 +              #include <soundcard.h>
   1.870 +            ],[
   1.871 +              int arg = SNDCTL_DSP_SETFRAGMENT;
   1.872 +            ],[
   1.873 +            have_oss=yes
   1.874 +            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
   1.875 +            ])
   1.876 +        fi
   1.877 +        AC_MSG_RESULT($have_oss)
   1.878 +        if test x$have_oss = xyes; then
   1.879 +            SUMMARY_audio="${SUMMARY_audio} oss"
   1.880 +            AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
   1.881 +            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
   1.882 +            have_audio=yes
   1.883 +
   1.884 +            # We may need to link with ossaudio emulation library
   1.885 +            case "$host" in
   1.886 +                *-*-openbsd*|*-*-netbsd*)
   1.887 +                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
   1.888 +            esac
   1.889 +        fi
   1.890 +    fi
   1.891 +}
   1.892 +
   1.893 +dnl See if the ALSA audio interface is supported
   1.894 +CheckALSA()
   1.895 +{
   1.896 +    AC_ARG_ENABLE(alsa,
   1.897 +AS_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
   1.898 +                  , enable_alsa=yes)
   1.899 +    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
   1.900 +        AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no)
   1.901 +        # Restore all flags from before the ALSA detection runs
   1.902 +        CFLAGS="$alsa_save_CFLAGS"
   1.903 +        LDFLAGS="$alsa_save_LDFLAGS"
   1.904 +        LIBS="$alsa_save_LIBS"
   1.905 +        if test x$have_alsa = xyes; then
   1.906 +            AC_ARG_ENABLE(alsa-shared,
   1.907 +AS_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
   1.908 +                          , enable_alsa_shared=yes)
   1.909 +            alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.910 +
   1.911 +            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
   1.912 +            SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
   1.913 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
   1.914 +            if test x$have_loadso != xyes && \
   1.915 +               test x$enable_alsa_shared = xyes; then
   1.916 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
   1.917 +            fi
   1.918 +            if test x$have_loadso = xyes && \
   1.919 +               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   1.920 +                echo "-- dynamic libasound -> $alsa_lib"
   1.921 +                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
   1.922 +                SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)"
   1.923 +            else
   1.924 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
   1.925 +                SUMMARY_audio="${SUMMARY_audio} alsa"
   1.926 +            fi
   1.927 +            have_audio=yes
   1.928 +        fi
   1.929 +    fi
   1.930 +}
   1.931 +
   1.932 +dnl Find JACK Audio
   1.933 +CheckJACK()
   1.934 +{
   1.935 +    AC_ARG_ENABLE(jack,
   1.936 +AS_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]),
   1.937 +                  , enable_jack=yes)
   1.938 +    if test x$enable_audio = xyes -a x$enable_jack = xyes; then
   1.939 +        PKG_CHECK_MODULES([JACK], [jack >= 0.125], audio_jack=yes, audio_jack=no)
   1.940 +
   1.941 +        if test x$audio_jack = xyes; then
   1.942 +            AC_ARG_ENABLE(jack-shared,
   1.943 +AS_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]),
   1.944 +                          , enable_jack_shared=yes)
   1.945 +            jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.946 +
   1.947 +            AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ])
   1.948 +            SOURCES="$SOURCES $srcdir/src/audio/jack/*.c"
   1.949 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS"
   1.950 +            if test x$have_loadso != xyes && \
   1.951 +               test x$enable_jack_shared = xyes; then
   1.952 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading])
   1.953 +            fi
   1.954 +            if test x$have_loadso = xyes && \
   1.955 +               test x$enable_jack_shared = xyes && test x$jack_lib != x; then
   1.956 +                echo "-- dynamic libjack -> $jack_lib"
   1.957 +                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ])
   1.958 +                SUMMARY_audio="${SUMMARY_audio} jack(dynamic)"
   1.959 +
   1.960 +                case "$host" in
   1.961 +                    # On Solaris, jack must be linked deferred explicitly
   1.962 +                    # to prevent undefined symbol failures.
   1.963 +                    *-*-solaris*)
   1.964 +                        JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'`
   1.965 +                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred"
   1.966 +                esac
   1.967 +            else
   1.968 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS"
   1.969 +                SUMMARY_audio="${SUMMARY_audio} jack"
   1.970 +            fi
   1.971 +            have_audio=yes
   1.972 +        fi
   1.973 +    fi
   1.974 +}
   1.975 +
   1.976 +dnl Find the ESD includes and libraries
   1.977 +CheckESD()
   1.978 +{
   1.979 +    AC_ARG_ENABLE(esd,
   1.980 +AS_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
   1.981 +                  , enable_esd=yes)
   1.982 +    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   1.983 +        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
   1.984 +        if test x$have_esd = xyes; then
   1.985 +            AC_ARG_ENABLE(esd-shared,
   1.986 +AS_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
   1.987 +                          , enable_esd_shared=yes)
   1.988 +            esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   1.989 +
   1.990 +            AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
   1.991 +            SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
   1.992 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
   1.993 +            if test x$have_loadso != xyes && \
   1.994 +               test x$enable_esd_shared = xyes; then
   1.995 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
   1.996 +            fi
   1.997 +            if test x$have_loadso = xyes && \
   1.998 +               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   1.999 +                echo "-- dynamic libesd -> $esd_lib"
  1.1000 +                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
  1.1001 +                SUMMARY_audio="${SUMMARY_audio} esd(dynamic)"
  1.1002 +            else
  1.1003 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
  1.1004 +                SUMMARY_audio="${SUMMARY_audio} esd"
  1.1005 +            fi
  1.1006 +            have_audio=yes
  1.1007 +        fi
  1.1008 +    fi
  1.1009 +}
  1.1010 +
  1.1011 +dnl Find PulseAudio
  1.1012 +CheckPulseAudio()
  1.1013 +{
  1.1014 +    AC_ARG_ENABLE(pulseaudio,
  1.1015 +AS_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
  1.1016 +                  , enable_pulseaudio=yes)
  1.1017 +    if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
  1.1018 +        PKG_CHECK_MODULES([PULSEAUDIO], [libpulse-simple >= 0.9], audio_pulseaudio=yes, audio_pulseaudio=no)
  1.1019 +
  1.1020 +        if test x$audio_pulseaudio = xyes; then
  1.1021 +            AC_ARG_ENABLE(pulseaudio-shared,
  1.1022 +AS_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
  1.1023 +                          , enable_pulseaudio_shared=yes)
  1.1024 +            pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1025 +
  1.1026 +            AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
  1.1027 +            SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
  1.1028 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
  1.1029 +            if test x$have_loadso != xyes && \
  1.1030 +               test x$enable_pulseaudio_shared = xyes; then
  1.1031 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
  1.1032 +            fi
  1.1033 +            if test x$have_loadso = xyes && \
  1.1034 +               test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
  1.1035 +                echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
  1.1036 +                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
  1.1037 +                SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)"
  1.1038 +
  1.1039 +                case "$host" in
  1.1040 +                    # On Solaris, pulseaudio must be linked deferred explicitly
  1.1041 +                    # to prevent undefined symbol failures.
  1.1042 +                    *-*-solaris*)
  1.1043 +                        PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
  1.1044 +                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
  1.1045 +                esac
  1.1046 +            else
  1.1047 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
  1.1048 +                SUMMARY_audio="${SUMMARY_audio} pulse"
  1.1049 +            fi
  1.1050 +            have_audio=yes
  1.1051 +        fi
  1.1052 +    fi
  1.1053 +}
  1.1054 +
  1.1055 +CheckARTSC()
  1.1056 +{
  1.1057 +    AC_ARG_ENABLE(arts,
  1.1058 +AS_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
  1.1059 +                  , enable_arts=yes)
  1.1060 +    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
  1.1061 +        AC_PATH_PROG(ARTSCONFIG, artsc-config)
  1.1062 +        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
  1.1063 +            : # arts isn't installed
  1.1064 +        else
  1.1065 +            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
  1.1066 +            ARTS_LIBS=`$ARTSCONFIG --libs`
  1.1067 +            AC_MSG_CHECKING(for aRts development environment)
  1.1068 +            audio_arts=no
  1.1069 +            save_CFLAGS="$CFLAGS"
  1.1070 +            CFLAGS="$CFLAGS $ARTS_CFLAGS"
  1.1071 +            AC_TRY_COMPILE([
  1.1072 +             #include <artsc.h>
  1.1073 +            ],[
  1.1074 +             arts_stream_t stream;
  1.1075 +            ],[
  1.1076 +            audio_arts=yes
  1.1077 +            ])
  1.1078 +            CFLAGS="$save_CFLAGS"
  1.1079 +            AC_MSG_RESULT($audio_arts)
  1.1080 +            if test x$audio_arts = xyes; then
  1.1081 +                AC_ARG_ENABLE(arts-shared,
  1.1082 +AS_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
  1.1083 +                              , enable_arts_shared=yes)
  1.1084 +                arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1085 +
  1.1086 +                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
  1.1087 +                SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
  1.1088 +                EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
  1.1089 +                if test x$have_loadso != xyes && \
  1.1090 +                   test x$enable_arts_shared = xyes; then
  1.1091 +                    AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
  1.1092 +                fi
  1.1093 +                if test x$have_loadso = xyes && \
  1.1094 +                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
  1.1095 +                    echo "-- dynamic libartsc -> $arts_lib"
  1.1096 +                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
  1.1097 +                    SUMMARY_audio="${SUMMARY_audio} arts(dynamic)"
  1.1098 +                else
  1.1099 +                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
  1.1100 +                    SUMMARY_audio="${SUMMARY_audio} arts"
  1.1101 +                fi
  1.1102 +                have_audio=yes
  1.1103 +            fi
  1.1104 +        fi
  1.1105 +    fi
  1.1106 +}
  1.1107 +
  1.1108 +dnl See if the NAS audio interface is supported
  1.1109 +CheckNAS()
  1.1110 +{
  1.1111 +    AC_ARG_ENABLE(nas,
  1.1112 +AS_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
  1.1113 +                  , enable_nas=yes)
  1.1114 +    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
  1.1115 +        AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
  1.1116 +        AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
  1.1117 +
  1.1118 +        AC_MSG_CHECKING(for NAS audio support)
  1.1119 +        have_nas=no
  1.1120 +
  1.1121 +        if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
  1.1122 +            have_nas=yes
  1.1123 +            NAS_LIBS="-laudio"
  1.1124 +
  1.1125 +        elif test -r /usr/X11R6/include/audio/audiolib.h; then
  1.1126 +            have_nas=yes
  1.1127 +            NAS_CFLAGS="-I/usr/X11R6/include/"
  1.1128 +            NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
  1.1129 +
  1.1130 +        fi
  1.1131 +
  1.1132 +        AC_MSG_RESULT($have_nas)
  1.1133 +
  1.1134 +        if test x$have_nas = xyes; then
  1.1135 +            AC_ARG_ENABLE(nas-shared,
  1.1136 +AS_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
  1.1137 +                          , enable_nas_shared=yes)
  1.1138 +            nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1139 +
  1.1140 +            if test x$have_loadso != xyes && \
  1.1141 +               test x$enable_nas_shared = xyes; then
  1.1142 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
  1.1143 +            fi
  1.1144 +            if test x$have_loadso = xyes && \
  1.1145 +               test x$enable_nas_shared = xyes && test x$nas_lib != x; then
  1.1146 +                echo "-- dynamic libaudio -> $nas_lib"
  1.1147 +                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
  1.1148 +                SUMMARY_audio="${SUMMARY_audio} nas(dynamic)"
  1.1149 +            else
  1.1150 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
  1.1151 +                SUMMARY_audio="${SUMMARY_audio} nas"
  1.1152 +            fi
  1.1153 +
  1.1154 +            AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
  1.1155 +            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
  1.1156 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
  1.1157 +            have_audio=yes
  1.1158 +        fi
  1.1159 +    fi
  1.1160 +}
  1.1161 +
  1.1162 +dnl See if the sndio audio interface is supported
  1.1163 +CheckSNDIO()
  1.1164 +{
  1.1165 +    AC_ARG_ENABLE(sndio,
  1.1166 +AS_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
  1.1167 +                  , enable_sndio=yes)
  1.1168 +    if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
  1.1169 +        AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
  1.1170 +        AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
  1.1171 +
  1.1172 +        AC_MSG_CHECKING(for sndio audio support)
  1.1173 +        have_sndio=no
  1.1174 +
  1.1175 +        if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
  1.1176 +            have_sndio=yes
  1.1177 +            SNDIO_LIBS="-lsndio"
  1.1178 +        fi
  1.1179 +
  1.1180 +        AC_MSG_RESULT($have_sndio)
  1.1181 +
  1.1182 +        if test x$have_sndio = xyes; then
  1.1183 +            AC_ARG_ENABLE(sndio-shared,
  1.1184 +AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
  1.1185 +                          , enable_sndio_shared=yes)
  1.1186 +            sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1187 +
  1.1188 +            if test x$have_loadso != xyes && \
  1.1189 +               test x$enable_sndio_shared = xyes; then
  1.1190 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
  1.1191 +            fi
  1.1192 +            if test x$have_loadso = xyes && \
  1.1193 +               test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
  1.1194 +                echo "-- dynamic libsndio -> $sndio_lib"
  1.1195 +                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
  1.1196 +                SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)"
  1.1197 +            else
  1.1198 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
  1.1199 +                SUMMARY_audio="${SUMMARY_audio} sndio"
  1.1200 +            fi
  1.1201 +
  1.1202 +            AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
  1.1203 +            SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
  1.1204 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
  1.1205 +            have_audio=yes
  1.1206 +        fi
  1.1207 +    fi
  1.1208 +}
  1.1209 +
  1.1210 +dnl Find FusionSound
  1.1211 +CheckFusionSound()
  1.1212 +{
  1.1213 +    AC_ARG_ENABLE(fusionsound,
  1.1214 +AS_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1.1215 +                  , enable_fusionsound=no)
  1.1216 +    if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1.1217 +        PKG_CHECK_MODULES([FUSIONSOUND], [fusionsound >= 1.1.1], fusionsound=yes, fusionsound=no)
  1.1218 +
  1.1219 +        if test x$fusionsound = xyes; then
  1.1220 +            AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
  1.1221 +            SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1.1222 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1.1223 +            
  1.1224 +            AC_ARG_ENABLE(fusionsound-shared,
  1.1225 +AS_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1.1226 +                          , enable_fusionsound_shared=yes)
  1.1227 +            fusionsound_shared=no
  1.1228 +            AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1.1229 +            if test x$have_loadso != xyes && \
  1.1230 +               test x$enable_fusionsound_shared = xyes; then
  1.1231 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1.1232 +            fi
  1.1233 +            if test x$have_loadso = xyes && \
  1.1234 +               test x$enable_fusionsound_shared = xyes; then
  1.1235 +                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
  1.1236 +                fusionsound_shared=yes
  1.1237 +                SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
  1.1238 +            else
  1.1239 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1.1240 +                SUMMARY_audio="${SUMMARY_audio} fusionsound"
  1.1241 +            fi
  1.1242 +            AC_MSG_RESULT($fusionsound_shared)
  1.1243 +            
  1.1244 +            have_audio=yes
  1.1245 +        fi
  1.1246 +    fi
  1.1247 +}
  1.1248 +
  1.1249 +dnl rcg07142001 See if the user wants the disk writer audio driver...
  1.1250 +CheckDiskAudio()
  1.1251 +{
  1.1252 +    AC_ARG_ENABLE(diskaudio,
  1.1253 +AS_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
  1.1254 +                  , enable_diskaudio=yes)
  1.1255 +    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
  1.1256 +        AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
  1.1257 +        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
  1.1258 +        SUMMARY_audio="${SUMMARY_audio} disk"
  1.1259 +    fi
  1.1260 +}
  1.1261 +
  1.1262 +dnl rcg03142006 See if the user wants the dummy audio driver...
  1.1263 +CheckDummyAudio()
  1.1264 +{
  1.1265 +    AC_ARG_ENABLE(dummyaudio,
  1.1266 +AS_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
  1.1267 +                  , enable_dummyaudio=yes)
  1.1268 +    if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
  1.1269 +        AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
  1.1270 +        SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
  1.1271 +        SUMMARY_audio="${SUMMARY_audio} dummy"
  1.1272 +    fi
  1.1273 +}
  1.1274 +
  1.1275 +dnl See if libsamplerate is available
  1.1276 +CheckLibSampleRate()
  1.1277 +{
  1.1278 +    AC_ARG_ENABLE(libsamplerate,
  1.1279 +AS_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]),
  1.1280 +                  , enable_libsamplerate=yes)
  1.1281 +    if test x$enable_libsamplerate = xyes; then
  1.1282 +        AC_CHECK_HEADER(samplerate.h,
  1.1283 +                        have_samplerate_h_hdr=yes,
  1.1284 +                        have_samplerate_h_hdr=no)
  1.1285 +        if test x$have_samplerate_h_hdr = xyes; then
  1.1286 +            AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ])
  1.1287 +
  1.1288 +            AC_ARG_ENABLE(libsamplerate-shared,
  1.1289 +AS_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]),
  1.1290 +                          , enable_libsamplerate_shared=yes)
  1.1291 +
  1.1292 +            samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1293 +
  1.1294 +            if test x$have_loadso != xyes && \
  1.1295 +               test x$enable_libsamplerate_shared = xyes; then
  1.1296 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading])
  1.1297 +            fi
  1.1298 +            if test x$have_loadso = xyes && \
  1.1299 +               test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then
  1.1300 +                echo "-- dynamic libsamplerate -> $samplerate_lib"
  1.1301 +                AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ])
  1.1302 +            else
  1.1303 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate"
  1.1304 +            fi
  1.1305 +        fi
  1.1306 +    fi
  1.1307 +}
  1.1308 +
  1.1309 +dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
  1.1310 +dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
  1.1311 +CheckVisibilityHidden()
  1.1312 +{
  1.1313 +    AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
  1.1314 +    have_gcc_fvisibility=no
  1.1315 +
  1.1316 +    visibility_CFLAGS="-fvisibility=hidden"
  1.1317 +    save_CFLAGS="$CFLAGS"
  1.1318 +    CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
  1.1319 +    AC_TRY_COMPILE([
  1.1320 +    #if !defined(__GNUC__) || __GNUC__ < 4
  1.1321 +    #error SDL only uses visibility attributes in GCC 4 or newer
  1.1322 +    #endif
  1.1323 +    ],[
  1.1324 +    ],[
  1.1325 +    have_gcc_fvisibility=yes
  1.1326 +    ])
  1.1327 +    AC_MSG_RESULT($have_gcc_fvisibility)
  1.1328 +    CFLAGS="$save_CFLAGS"
  1.1329 +
  1.1330 +    if test x$have_gcc_fvisibility = xyes; then
  1.1331 +        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
  1.1332 +    fi
  1.1333 +}
  1.1334 +
  1.1335 +dnl See if GCC's -mpreferred-stack-boundary is supported.
  1.1336 +dnl  Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
  1.1337 +CheckStackBoundary()
  1.1338 +{
  1.1339 +    AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
  1.1340 +    have_gcc_preferred_stack_boundary=no
  1.1341 +
  1.1342 +    save_CFLAGS="$CFLAGS"
  1.1343 +    CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
  1.1344 +    AC_TRY_COMPILE([
  1.1345 +    int x = 0;
  1.1346 +    ],[
  1.1347 +    ],[
  1.1348 +    have_gcc_preferred_stack_boundary=yes
  1.1349 +    ])
  1.1350 +    AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
  1.1351 +    CFLAGS="$save_CFLAGS"
  1.1352 +
  1.1353 +    if test x$have_gcc_preferred_stack_boundary = xyes; then
  1.1354 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
  1.1355 +    fi
  1.1356 +}
  1.1357 +
  1.1358 +dnl See if GCC's -Wdeclaration-after-statement is supported.
  1.1359 +dnl  This lets us catch things that would fail on a C89 compiler when using
  1.1360 +dnl  a modern GCC.
  1.1361 +CheckDeclarationAfterStatement()
  1.1362 +{
  1.1363 +    AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option)
  1.1364 +    have_gcc_declaration_after_statement=no
  1.1365 +
  1.1366 +    save_CFLAGS="$CFLAGS"
  1.1367 +    CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
  1.1368 +    AC_TRY_COMPILE([
  1.1369 +    int x = 0;
  1.1370 +    ],[
  1.1371 +    ],[
  1.1372 +    have_gcc_declaration_after_statement=yes
  1.1373 +    ])
  1.1374 +    AC_MSG_RESULT($have_gcc_declaration_after_statement)
  1.1375 +    CFLAGS="$save_CFLAGS"
  1.1376 +
  1.1377 +    if test x$have_gcc_declaration_after_statement = xyes; then
  1.1378 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
  1.1379 +    fi
  1.1380 +}
  1.1381 +
  1.1382 +dnl See if GCC's -Wall is supported.
  1.1383 +CheckWarnAll()
  1.1384 +{
  1.1385 +    AC_MSG_CHECKING(for GCC -Wall option)
  1.1386 +    have_gcc_Wall=no
  1.1387 +
  1.1388 +    save_CFLAGS="$CFLAGS"
  1.1389 +    CFLAGS="$save_CFLAGS -Wall"
  1.1390 +    AC_TRY_COMPILE([
  1.1391 +    int x = 0;
  1.1392 +    ],[
  1.1393 +    ],[
  1.1394 +    have_gcc_Wall=yes
  1.1395 +    ])
  1.1396 +    AC_MSG_RESULT($have_gcc_Wall)
  1.1397 +    CFLAGS="$save_CFLAGS"
  1.1398 +
  1.1399 +    if test x$have_gcc_Wall = xyes; then
  1.1400 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
  1.1401 +
  1.1402 +        dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
  1.1403 +        AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
  1.1404 +        need_gcc_Wno_multichar=no
  1.1405 +        case "$host" in
  1.1406 +            *-*-haiku*)
  1.1407 +                need_gcc_Wno_multichar=yes
  1.1408 +                ;;
  1.1409 +        esac
  1.1410 +        AC_MSG_RESULT($need_gcc_Wno_multichar)
  1.1411 +        if test x$need_gcc_Wno_multichar = xyes; then
  1.1412 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
  1.1413 +        fi
  1.1414 +    fi
  1.1415 +}
  1.1416 +
  1.1417 +dnl Check for Wayland
  1.1418 +CheckWayland()
  1.1419 +{
  1.1420 +    AC_ARG_ENABLE(video-wayland,
  1.1421 +AS_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]),
  1.1422 +                  ,enable_video_wayland=yes)
  1.1423 +
  1.1424 +    AC_ARG_ENABLE(video-wayland-qt-touch,
  1.1425 +AS_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]),
  1.1426 +                  ,enable_video_wayland_qt_touch=yes)
  1.1427 +
  1.1428 +    if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
  1.1429 +        AC_MSG_CHECKING(for Wayland support)
  1.1430 +        video_wayland=no
  1.1431 +        if  test x$video_opengl_egl = xyes && \
  1.1432 +            test x$video_opengles_v2 = xyes; then
  1.1433 +            if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then
  1.1434 +                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
  1.1435 +                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
  1.1436 +                WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
  1.1437 +                video_wayland=yes
  1.1438 +            fi
  1.1439 +        fi
  1.1440 +        AC_MSG_RESULT($video_wayland)
  1.1441 +
  1.1442 +        if test x$video_wayland = xyes; then
  1.1443 +            AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
  1.1444 +            if test x$enable_video_wayland_qt_touch = xyes; then
  1.1445 +                AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
  1.1446 +            fi
  1.1447 +
  1.1448 +            WAYLAND_SOURCES="$srcdir/src/video/wayland/*.c"
  1.1449 +            SOURCES="$SOURCES $WAYLAND_SOURCES"
  1.1450 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
  1.1451 +            AC_ARG_ENABLE(wayland-shared,
  1.1452 +AS_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
  1.1453 +                          , enable_wayland_shared=maybe)
  1.1454 +
  1.1455 +            dnl FIXME: Do BSD and OS X need special cases?
  1.1456 +            case "$host" in
  1.1457 +                *)
  1.1458 +                    wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1459 +                    wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1460 +                    if test x$wayland_egl_lib = x; then
  1.1461 +                        dnl This works in Ubuntu 13.10, maybe others
  1.1462 +                        wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1463 +                    fi
  1.1464 +                    wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1465 +                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1466 +                    ;;
  1.1467 +            esac
  1.1468 +
  1.1469 +            if test x$enable_wayland_shared = xmaybe; then
  1.1470 +                enable_wayland_shared=yes
  1.1471 +            fi
  1.1472 +            if test x$have_loadso != xyes && \
  1.1473 +               test x$enable_wayland_shared = xyes; then
  1.1474 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Wayland loading])
  1.1475 +                enable_wayland_shared=no
  1.1476 +            fi
  1.1477 +            if test x$have_loadso = xyes && \
  1.1478 +               test x$enable_wayland_shared = xyes && \
  1.1479 +               test x$wayland_client_lib != x && \
  1.1480 +               test x$wayland_egl_lib != x && \
  1.1481 +               test x$wayland_cursor_lib != x && \
  1.1482 +               test x$xkbcommon_lib != x; then
  1.1483 +                echo "-- dynamic libwayland-client -> $wayland_client_lib"
  1.1484 +                echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
  1.1485 +                echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
  1.1486 +                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
  1.1487 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
  1.1488 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
  1.1489 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
  1.1490 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
  1.1491 +                SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
  1.1492 +            else
  1.1493 +                enable_wayland_shared=no
  1.1494 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
  1.1495 +                SUMMARY_video="${SUMMARY_video} wayland"
  1.1496 +            fi
  1.1497 +            have_video=yes
  1.1498 +        fi
  1.1499 +    fi
  1.1500 +}
  1.1501 +
  1.1502 +
  1.1503 +dnl Check for Native Client stuff
  1.1504 +CheckNativeClient()
  1.1505 +{
  1.1506 +        AC_TRY_COMPILE([
  1.1507 +          #if !defined(__native_client__)
  1.1508 +          #error "NO NACL"
  1.1509 +          #endif
  1.1510 +        ],[
  1.1511 +        ],[
  1.1512 +        AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ])
  1.1513 +        AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ])
  1.1514 +        AC_DEFINE(HAVE_POW, 1, [ ])
  1.1515 +        AC_DEFINE(HAVE_OPENGLES2, 1, [ ])
  1.1516 +        AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1.1517 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1.1518 +
  1.1519 +        SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS"
  1.1520 +
  1.1521 +        SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
  1.1522 +        SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
  1.1523 +        SUMMARY_audio="${SUMMARY_audio} nacl"
  1.1524 +        SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
  1.1525 +        SUMMARY_video="${SUMMARY_video} nacl opengles2"
  1.1526 +        ])
  1.1527 +}
  1.1528 +
  1.1529 +
  1.1530 +CheckRPI()
  1.1531 +{
  1.1532 +    AC_ARG_ENABLE(video-rpi,
  1.1533 +AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=no]]]),
  1.1534 +                  , enable_video_rpi=no)
  1.1535 +    if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
  1.1536 +        PKG_CHECK_MODULES([RPI], [bcm_host brcmegl], video_rpi=yes, video_rpi=no)
  1.1537 +
  1.1538 +        if test x$video_rpi = xno; then
  1.1539 +            if test x$ARCH = xnetbsd; then
  1.1540 +                RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
  1.1541 +                RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
  1.1542 +            else
  1.1543 +                RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
  1.1544 +                RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
  1.1545 +            fi
  1.1546 +        fi
  1.1547 +
  1.1548 +        # Save the original compiler flags and libraries
  1.1549 +        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1.1550 +
  1.1551 +        # Add the Raspberry Pi compiler flags and libraries
  1.1552 +        CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS"
  1.1553 +
  1.1554 +        AC_MSG_CHECKING(for Raspberry Pi)
  1.1555 +        have_video_rpi=no
  1.1556 +        AC_TRY_LINK([
  1.1557 +          #include <bcm_host.h>
  1.1558 +        ],[
  1.1559 +          bcm_host_init();
  1.1560 +        ],[
  1.1561 +        have_video_rpi=yes
  1.1562 +        ],[
  1.1563 +        ])
  1.1564 +        AC_MSG_RESULT($have_video_rpi)
  1.1565 +
  1.1566 +        # Restore the compiler flags and libraries
  1.1567 +        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1.1568 +        
  1.1569 +        if test x$have_video_rpi = xyes; then
  1.1570 +            CFLAGS="$CFLAGS $RPI_CFLAGS"
  1.1571 +            SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
  1.1572 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
  1.1573 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
  1.1574 +            SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
  1.1575 +            AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
  1.1576 +            SUMMARY_video="${SUMMARY_video} rpi"
  1.1577 +        fi
  1.1578 +    fi
  1.1579 +}
  1.1580 +
  1.1581 +dnl Find the X11 include and library directories
  1.1582 +CheckX11()
  1.1583 +{
  1.1584 +    AC_ARG_ENABLE(video-x11,
  1.1585 +AS_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
  1.1586 +                  , enable_video_x11=yes)
  1.1587 +    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1.1588 +        case "$host" in
  1.1589 +            *-*-darwin*)
  1.1590 +                # This isn't necessary for X11, but fixes GLX detection
  1.1591 +                if test "x$x_includes" = xNONE && \
  1.1592 +                   test "x$x_libraries" = xNONE && \
  1.1593 +                   test -d /usr/X11R6/include && \
  1.1594 +                   test -d /usr/X11R6/lib; then
  1.1595 +                    x_includes="/usr/X11R6/include"
  1.1596 +                    x_libraries="/usr/X11R6/lib"
  1.1597 +                fi
  1.1598 +                ;;
  1.1599 +        esac
  1.1600 +        AC_PATH_X
  1.1601 +        AC_PATH_XTRA
  1.1602 +        if test x$have_x = xyes; then
  1.1603 +            AC_ARG_ENABLE(x11-shared,
  1.1604 +AS_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
  1.1605 +                          , enable_x11_shared=maybe)
  1.1606 +
  1.1607 +            case "$host" in
  1.1608 +                *-*-darwin*)
  1.1609 +                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
  1.1610 +                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
  1.1611 +                    xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
  1.1612 +                    xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
  1.1613 +                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1.1614 +                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1.1615 +                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1.1616 +                    xss_lib='/usr/X11R6/lib/libXss.1.dylib'
  1.1617 +                    xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
  1.1618 +                    ;;
  1.1619 +                *-*-openbsd*)
  1.1620 +                    x11_lib='libX11.so'
  1.1621 +                    x11ext_lib='libXext.so'
  1.1622 +                    xcursor_lib='libXcursor.so'
  1.1623 +                    xinerama_lib='libXinerama.so'
  1.1624 +                    xinput_lib='libXi.so'
  1.1625 +                    xrandr_lib='libXrandr.so'
  1.1626 +                    xrender_lib='libXrender.so'
  1.1627 +                    xss_lib='libXss.so'
  1.1628 +                    xvidmode_lib='libXxf86vm.so'
  1.1629 +                    ;;
  1.1630 +                *)
  1.1631 +                    x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1632 +                    x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1633 +                    xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1634 +                    xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1635 +                    xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1636 +                    xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1637 +                    xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1638 +                    xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1639 +                    xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.1640 +                    ;;
  1.1641 +            esac
  1.1642 +
  1.1643 +            if test x$ac_cv_func_shmat != xyes; then
  1.1644 +                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1.1645 +            fi
  1.1646 +            CFLAGS="$CFLAGS $X_CFLAGS"
  1.1647 +            LDFLAGS="$LDFLAGS $X_LIBS"
  1.1648 +
  1.1649 +            AC_CHECK_HEADER(X11/extensions/Xext.h,
  1.1650 +                            have_xext_h_hdr=yes,
  1.1651 +                            have_xext_h_hdr=no,
  1.1652 +                            [#include <X11/Xlib.h>
  1.1653 +                             #include <X11/Xproto.h>
  1.1654 +                            ])
  1.1655 +            if test x$have_xext_h_hdr != xyes; then
  1.1656 +               AC_MSG_ERROR([
  1.1657 +*** Missing Xext.h, maybe you need to install the libxext-dev package?
  1.1658 +               ])
  1.1659 +            fi
  1.1660 +
  1.1661 +            AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
  1.1662 +            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1.1663 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1.1664 +
  1.1665 +            # Needed so SDL applications can include SDL_syswm.h
  1.1666 +            SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
  1.1667 +
  1.1668 +            if test x$enable_x11_shared = xmaybe; then
  1.1669 +                enable_x11_shared=yes
  1.1670 +            fi
  1.1671 +            if test x$have_loadso != xyes && \
  1.1672 +               test x$enable_x11_shared = xyes; then
  1.1673 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1.1674 +                enable_x11_shared=no
  1.1675 +            fi
  1.1676 +            if test x$have_loadso = xyes && \
  1.1677 +               test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1.1678 +                echo "-- dynamic libX11 -> $x11_lib"
  1.1679 +                echo "-- dynamic libX11ext -> $x11ext_lib"
  1.1680 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
  1.1681 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
  1.1682 +                SUMMARY_video="${SUMMARY_video} x11(dynamic)"
  1.1683 +            else
  1.1684 +                enable_x11_shared=no
  1.1685 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1.1686 +                SUMMARY_video="${SUMMARY_video} x11"
  1.1687 +            fi
  1.1688 +            have_video=yes
  1.1689 +
  1.1690 +            AC_MSG_CHECKING(for const parameter to XextAddDisplay)
  1.1691 +            have_const_param_XextAddDisplay=no
  1.1692 +            AC_TRY_COMPILE([
  1.1693 +              #include <X11/Xlib.h>
  1.1694 +              #include <X11/Xproto.h>
  1.1695 +              #include <X11/extensions/Xext.h>
  1.1696 +              #include <X11/extensions/extutil.h>
  1.1697 +              extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
  1.1698 +            ],[
  1.1699 +            ],[
  1.1700 +            have_const_param_XextAddDisplay=yes
  1.1701 +            AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ])
  1.1702 +            ])
  1.1703 +            AC_MSG_RESULT($have_const_param_XextAddDisplay)
  1.1704 +
  1.1705 +            dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
  1.1706 +            AC_MSG_CHECKING([for XGenericEvent])
  1.1707 +            have_XGenericEvent=no
  1.1708 +            AC_TRY_COMPILE([
  1.1709 +                #include <X11/Xlib.h>
  1.1710 +            ],[
  1.1711 +Display *display;
  1.1712 +XEvent event;
  1.1713 +XGenericEventCookie *cookie = &event.xcookie;
  1.1714 +XNextEvent(display, &event);
  1.1715 +XGetEventData(display, cookie);
  1.1716 +XFreeEventData(display, cookie);
  1.1717 +            ],[
  1.1718 +                have_XGenericEvent=yes
  1.1719 +                AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ])
  1.1720 +            ])
  1.1721 +            AC_MSG_RESULT($have_XGenericEvent)
  1.1722 +
  1.1723 +            AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
  1.1724 +
  1.1725 +            AC_ARG_ENABLE(video-x11-xcursor,
  1.1726 +AS_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
  1.1727 +                            , enable_video_x11_xcursor=yes)
  1.1728 +            if test x$enable_video_x11_xcursor = xyes; then
  1.1729 +                definitely_enable_video_x11_xcursor=no
  1.1730 +                AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
  1.1731 +                                have_xcursor_h_hdr=yes,
  1.1732 +                                have_xcursor_h_hdr=no,
  1.1733 +                                [#include <X11/Xlib.h>
  1.1734 +                                ])
  1.1735 +                if test x$have_xcursor_h_hdr = xyes; then
  1.1736 +                    if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
  1.1737 +                        echo "-- dynamic libXcursor -> $xcursor_lib"
  1.1738 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
  1.1739 +                        definitely_enable_video_x11_xcursor=yes
  1.1740 +                    else
  1.1741 +                        AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
  1.1742 +                        if test x$have_xcursor_lib = xyes ; then
  1.1743 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
  1.1744 +                            definitely_enable_video_x11_xcursor=yes
  1.1745 +                        fi
  1.1746 +                    fi
  1.1747 +                fi
  1.1748 +            fi
  1.1749 +            if test x$definitely_enable_video_x11_xcursor = xyes; then
  1.1750 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
  1.1751 +                SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
  1.1752 +            fi
  1.1753 +            AC_ARG_ENABLE(video-x11-xdbe,
  1.1754 +AS_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]),
  1.1755 +                            , enable_video_x11_xdbe=yes)
  1.1756 +            if test x$enable_video_x11_xdbe = xyes; then
  1.1757 +                AC_CHECK_HEADER(X11/extensions/Xdbe.h,
  1.1758 +                                have_dbe_h_hdr=yes,
  1.1759 +                                have_dbe_h_hdr=no,
  1.1760 +                                [#include <X11/Xlib.h>
  1.1761 +                                ])
  1.1762 +                if test x$have_dbe_h_hdr = xyes; then
  1.1763 +                    AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ])
  1.1764 +                    SUMMARY_video_x11="${SUMMARY_video_x11} xdbe"
  1.1765 +                fi
  1.1766 +            fi
  1.1767 +            AC_ARG_ENABLE(video-x11-xinerama,
  1.1768 +AS_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1.1769 +                            , enable_video_x11_xinerama=yes)
  1.1770 +            if test x$enable_video_x11_xinerama = xyes; then
  1.1771 +                definitely_enable_video_x11_xinerama=no
  1.1772 +                AC_CHECK_HEADER(X11/extensions/Xinerama.h,
  1.1773 +                                have_xinerama_h_hdr=yes,
  1.1774 +                                have_xinerama_h_hdr=no,
  1.1775 +                                [#include <X11/Xlib.h>
  1.1776 +                                ])
  1.1777 +                if test x$have_xinerama_h_hdr = xyes; then
  1.1778 +                    if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
  1.1779 +                        echo "-- dynamic libXinerama -> $xinerama_lib"
  1.1780 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
  1.1781 +                        definitely_enable_video_x11_xinerama=yes
  1.1782 +                    else
  1.1783 +                        AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
  1.1784 +                        if test x$have_xinerama_lib = xyes ; then
  1.1785 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
  1.1786 +                            definitely_enable_video_x11_xinerama=yes
  1.1787 +                        fi
  1.1788 +                    fi
  1.1789 +                fi
  1.1790 +            fi
  1.1791 +            if test x$definitely_enable_video_x11_xinerama = xyes; then
  1.1792 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
  1.1793 +                SUMMARY_video_x11="${SUMMARY_video_x11} xinerama"
  1.1794 +            fi
  1.1795 +            AC_ARG_ENABLE(video-x11-xinput,
  1.1796 +AS_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1.1797 +                            , enable_video_x11_xinput=yes)
  1.1798 +            if test x$enable_video_x11_xinput = xyes; then
  1.1799 +                definitely_enable_video_x11_xinput=no
  1.1800 +                AC_CHECK_HEADER(X11/extensions/XInput2.h,
  1.1801 +                                have_xinput_h_hdr=yes,
  1.1802 +                                have_xinput_h_hdr=no,
  1.1803 +                                [#include <X11/Xlib.h>
  1.1804 +                                ])
  1.1805 +                if test x$have_xinput_h_hdr = xyes; then
  1.1806 +                    if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1.1807 +                        echo "-- dynamic libXi -> $xinput_lib"
  1.1808 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
  1.1809 +                        definitely_enable_video_x11_xinput=yes
  1.1810 +                    else
  1.1811 +                        AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1.1812 +                        if test x$have_xinput_lib = xyes ; then
  1.1813 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1.1814 +                            definitely_enable_video_x11_xinput=yes
  1.1815 +                        fi
  1.1816 +                    fi
  1.1817 +                fi
  1.1818 +            fi
  1.1819 +            if test x$definitely_enable_video_x11_xinput = xyes; then
  1.1820 +                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
  1.1821 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
  1.1822 +                AC_MSG_CHECKING(for xinput2 multitouch)
  1.1823 +                have_xinput2_multitouch=no
  1.1824 +                AC_TRY_COMPILE([
  1.1825 +                    #include <X11/Xlib.h>
  1.1826 +                    #include <X11/Xproto.h>
  1.1827 +                    #include <X11/extensions/XInput2.h>
  1.1828 +                    ],[
  1.1829 +int event_type = XI_TouchBegin;
  1.1830 +XITouchClassInfo *t;
  1.1831 +                    ],[
  1.1832 +                    have_xinput2_multitouch=yes
  1.1833 +                    AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [])
  1.1834 +                    SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
  1.1835 +                    ])
  1.1836 +                AC_MSG_RESULT($have_xinput2_multitouch)
  1.1837 +            fi
  1.1838 +            AC_ARG_ENABLE(video-x11-xrandr,
  1.1839 +AS_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1.1840 +                            , enable_video_x11_xrandr=yes)
  1.1841 +            if test x$enable_video_x11_xrandr = xyes; then
  1.1842 +                dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
  1.1843 +                definitely_enable_video_x11_xrandr=no
  1.1844 +                have_xrandr_h_hdr=no
  1.1845 +                AC_TRY_COMPILE([
  1.1846 +                #include <X11/Xlib.h>
  1.1847 +                #include <X11/extensions/Xrandr.h>
  1.1848 +                ],[
  1.1849 +                XRRScreenResources *res = NULL;
  1.1850 +                ],[
  1.1851 +                have_xrandr_h_hdr=yes
  1.1852 +                ])
  1.1853 +                if test x$have_xrandr_h_hdr = xyes; then
  1.1854 +                    if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1.1855 +                        echo "-- dynamic libXrandr -> $xrandr_lib"
  1.1856 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
  1.1857 +                        definitely_enable_video_x11_xrandr=yes
  1.1858 +                    else
  1.1859 +                        AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1.1860 +                        if test x$have_xrandr_lib = xyes ; then
  1.1861 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1.1862 +                            definitely_enable_video_x11_xrandr=yes
  1.1863 +                        fi
  1.1864 +                    fi
  1.1865 +                fi
  1.1866 +            fi
  1.1867 +            if test x$definitely_enable_video_x11_xrandr = xyes; then
  1.1868 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
  1.1869 +                SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
  1.1870 +            fi
  1.1871 +            AC_ARG_ENABLE(video-x11-scrnsaver,
  1.1872 +AS_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1.1873 +                            , enable_video_x11_scrnsaver=yes)
  1.1874 +            if test x$enable_video_x11_scrnsaver = xyes; then
  1.1875 +                AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1.1876 +                                have_scrnsaver_h_hdr=yes,
  1.1877 +                                have_scrnsaver_h_hdr=no,
  1.1878 +                                [#include <X11/Xlib.h>
  1.1879 +                                ])
  1.1880 +                if test x$have_scrnsaver_h_hdr = xyes; then
  1.1881 +                    if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1.1882 +                        echo "-- dynamic libXss -> $xss_lib"
  1.1883 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
  1.1884 +                        definitely_enable_video_x11_scrnsaver=yes
  1.1885 +                    else
  1.1886 +                        AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1.1887 +                        if test x$have_xss_lib = xyes ; then
  1.1888 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1.1889 +                            definitely_enable_video_x11_scrnsaver=yes
  1.1890 +                        fi
  1.1891 +                    fi
  1.1892 +                fi
  1.1893 +            fi
  1.1894 +            if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1.1895 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
  1.1896 +                SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
  1.1897 +            fi
  1.1898 +            AC_ARG_ENABLE(video-x11-xshape,
  1.1899 +AS_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
  1.1900 +                            , enable_video_x11_xshape=yes)
  1.1901 +            if test x$enable_video_x11_xshape = xyes; then
  1.1902 +                AC_CHECK_HEADER(X11/extensions/shape.h,
  1.1903 +                                have_shape_h_hdr=yes,
  1.1904 +                                have_shape_h_hdr=no,
  1.1905 +                                [#include <X11/Xlib.h>
  1.1906 +                                ])
  1.1907 +                if test x$have_shape_h_hdr = xyes; then
  1.1908 +                    AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
  1.1909 +                    SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
  1.1910 +                fi
  1.1911 +            fi
  1.1912 +            AC_ARG_ENABLE(video-x11-vm,
  1.1913 +AS_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1.1914 +                            , enable_video_x11_vm=yes)
  1.1915 +            if test x$enable_video_x11_vm = xyes; then
  1.1916 +                definitely_enable_video_x11_vm=no
  1.1917 +                AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
  1.1918 +                                have_vm_h_hdr=yes,
  1.1919 +                                have_vm_h_hdr=no,
  1.1920 +                                [#include <X11/Xlib.h>
  1.1921 +                                ])
  1.1922 +                if test x$have_vm_h_hdr = xyes; then
  1.1923 +                    if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
  1.1924 +                        echo "-- dynamic libXxf86vm -> $xvidmode_lib"
  1.1925 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
  1.1926 +                        definitely_enable_video_x11_vm=yes
  1.1927 +                    else
  1.1928 +                        AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
  1.1929 +                        if test x$have_vm_lib = xyes ; then
  1.1930 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
  1.1931 +                            definitely_enable_video_x11_vm=yes
  1.1932 +                        fi
  1.1933 +                    fi
  1.1934 +                fi
  1.1935 +            fi
  1.1936 +            if test x$definitely_enable_video_x11_vm = xyes; then
  1.1937 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
  1.1938 +                SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
  1.1939 +            fi
  1.1940 +        fi
  1.1941 +    fi
  1.1942 +}
  1.1943 +
  1.1944 +dnl Set up the Vivante video driver if enabled
  1.1945 +CheckVivanteVideo()
  1.1946 +{
  1.1947 +    AC_ARG_ENABLE(video-vivante,
  1.1948 +AS_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]),
  1.1949 +                  , enable_video_vivante=yes)
  1.1950 +    if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then
  1.1951 +        AC_MSG_CHECKING(for Vivante VDK API)
  1.1952 +        have_vivante_vdk=no
  1.1953 +        AC_TRY_COMPILE([
  1.1954 +          #define LINUX
  1.1955 +          #define EGL_API_FB
  1.1956 +          #include <gc_vdk.h>
  1.1957 +        ],[
  1.1958 +        ],[
  1.1959 +        have_vivante_vdk=yes
  1.1960 +        ])
  1.1961 +        AC_MSG_RESULT($have_vivante_vdk)
  1.1962 +
  1.1963 +        AC_MSG_CHECKING(for Vivante FB API)
  1.1964 +        have_vivante_egl=no
  1.1965 +        AC_TRY_COMPILE([
  1.1966 +          #define LINUX
  1.1967 +          #define EGL_API_FB
  1.1968 +          #include <EGL/eglvivante.h>
  1.1969 +        ],[
  1.1970 +        ],[
  1.1971 +        have_vivante_egl=yes
  1.1972 +        ])
  1.1973 +        AC_MSG_RESULT($have_vivante_egl)
  1.1974 +
  1.1975 +        if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then
  1.1976 +            AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ])
  1.1977 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
  1.1978 +            if test x$have_vivante_vdk = xyes; then
  1.1979 +                AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ])
  1.1980 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK"
  1.1981 +            fi
  1.1982 +            SOURCES="$SOURCES $srcdir/src/video/vivante/*.c"
  1.1983 +            SUMMARY_video="${SUMMARY_video} vivante"
  1.1984 +            have_video=yes
  1.1985 +        fi
  1.1986 +    fi
  1.1987 +}
  1.1988 +
  1.1989 +dnl Set up the Haiku video driver if enabled
  1.1990 +CheckHaikuVideo()
  1.1991 +{
  1.1992 +    if test x$enable_video = xyes; then
  1.1993 +        AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
  1.1994 +        SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
  1.1995 +        have_video=yes
  1.1996 +        SUMMARY_video="${SUMMARY_video} haiku"
  1.1997 +    fi
  1.1998 +}
  1.1999 +
  1.2000 +dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1.2001 +CheckCOCOA()
  1.2002 +{
  1.2003 +    AC_ARG_ENABLE(video-cocoa,
  1.2004 +AS_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1.2005 +                  , enable_video_cocoa=yes)
  1.2006 +    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1.2007 +        save_CFLAGS="$CFLAGS"
  1.2008 +        dnl Work around that we don't have Objective-C support in autoconf
  1.2009 +        CFLAGS="$CFLAGS -x objective-c"
  1.2010 +        AC_MSG_CHECKING(for Cocoa framework)
  1.2011 +        have_cocoa=no
  1.2012 +        AC_TRY_COMPILE([
  1.2013 +          #import <Cocoa/Cocoa.h>
  1.2014 +        ],[
  1.2015 +        ],[
  1.2016 +        have_cocoa=yes
  1.2017 +        ])
  1.2018 +        AC_MSG_RESULT($have_cocoa)
  1.2019 +        CFLAGS="$save_CFLAGS"
  1.2020 +        if test x$have_cocoa = xyes; then
  1.2021 +            AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
  1.2022 +            SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1.2023 +            SUMMARY_video="${SUMMARY_video} cocoa"
  1.2024 +            have_video=yes
  1.2025 +        fi
  1.2026 +    fi
  1.2027 +}
  1.2028 +
  1.2029 +CheckMETAL()
  1.2030 +{
  1.2031 +    AC_ARG_ENABLE(render-metal,
  1.2032 +AS_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]),
  1.2033 +                                , enable_render_metal=yes)
  1.2034 +    if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
  1.2035 +        save_CFLAGS="$CFLAGS"
  1.2036 +        dnl Work around that we don't have Objective-C support in autoconf
  1.2037 +        CFLAGS="$CFLAGS -x objective-c"
  1.2038 +        AC_MSG_CHECKING(for Metal framework)
  1.2039 +        have_metal=no
  1.2040 +        AC_TRY_COMPILE([
  1.2041 +          #import <Cocoa/Cocoa.h>
  1.2042 +          #import <Metal/Metal.h>
  1.2043 +          #import <QuartzCore/CAMetalLayer.h>
  1.2044 +
  1.2045 +          #if !TARGET_CPU_X86_64
  1.2046 +          #error Metal doesn't work on this configuration
  1.2047 +          #endif
  1.2048 +        ],[
  1.2049 +        ],[
  1.2050 +        have_metal=yes
  1.2051 +        ])
  1.2052 +        CFLAGS="$save_CFLAGS"
  1.2053 +        AC_MSG_RESULT($have_metal)
  1.2054 +        if test x$have_metal = xyes; then
  1.2055 +            AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
  1.2056 +            SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
  1.2057 +            SUMMARY_video="${SUMMARY_video} metal"
  1.2058 +        else
  1.2059 +            enable_render_metal=no
  1.2060 +        fi
  1.2061 +    fi
  1.2062 +}
  1.2063 +
  1.2064 +
  1.2065 +dnl Find DirectFB
  1.2066 +CheckDirectFB()
  1.2067 +{
  1.2068 +    AC_ARG_ENABLE(video-directfb,
  1.2069 +AS_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  1.2070 +                  , enable_video_directfb=no)
  1.2071 +    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1.2072 +        PKG_CHECK_MODULES([DIRECTFB], [directfb >= 1.0.0], video_directfb=yes, video_directfb=no)
  1.2073 +
  1.2074 +        if test x$video_directfb = xyes; then
  1.2075 +            # SuSE 11.1 installs directfb-config without directfb-devel
  1.2076 +            save_CPPFLAGS="$CPPFLAGS"
  1.2077 +            CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  1.2078 +            AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1.2079 +            CPPFLAGS="$save_CPPFLAGS"
  1.2080 +            video_directfb=$have_directfb_hdr
  1.2081 +        fi
  1.2082 +
  1.2083 +        if test x$video_directfb = xyes; then
  1.2084 +            AC_ARG_ENABLE(directfb-shared,
  1.2085 +AS_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  1.2086 +                              , enable_directfb_shared=yes)
  1.2087 +
  1.2088 +            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
  1.2089 +            AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
  1.2090 +            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1.2091 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1.2092 +
  1.2093 +            AC_MSG_CHECKING(for directfb dynamic loading support)
  1.2094 +            directfb_shared=no
  1.2095 +            directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`]
  1.2096 +            # | sed 's/.*\/\(.*\)/\1/; q'`]
  1.2097 +AC_MSG_WARN("directfb $directfb_lib")
  1.2098 +            if test x$have_loadso != xyes && \
  1.2099 +               test x$enable_directfb_shared = xyes; then
  1.2100 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1.2101 +            fi
  1.2102 +            if test x$have_loadso = xyes && \
  1.2103 +               test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1.2104 +                directfb_shared=yes
  1.2105 +                echo "-- $directfb_lib_spec -> $directfb_lib"
  1.2106 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
  1.2107 +                SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
  1.2108 +            else
  1.2109 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1.2110 +                SUMMARY_video="${SUMMARY_video} directfb"
  1.2111 +            fi
  1.2112 +            AC_MSG_RESULT($directfb_shared)
  1.2113 +            SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
  1.2114 +            have_video=yes
  1.2115 +        fi
  1.2116 +    fi
  1.2117 +}
  1.2118 +
  1.2119 +dnl Find KMSDRM
  1.2120 +CheckKMSDRM()
  1.2121 +{
  1.2122 +    AC_ARG_ENABLE(video-kmsdrm,
  1.2123 +AS_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]),
  1.2124 +                  , enable_video_kmsdrm=no)
  1.2125 +
  1.2126 +    if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
  1.2127 +        video_kmsdrm=no
  1.2128 +
  1.2129 +        PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.4.46], libdrm_avail=yes, libdrm_avail=no)
  1.2130 +        PKG_CHECK_MODULES([LIBGBM], [gbm >= 9.0.0], libgbm_avail=yes, libgbm_avail=no)
  1.2131 +
  1.2132 +        if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
  1.2133 +            video_kmsdrm=yes
  1.2134 +        fi
  1.2135 +
  1.2136 +        if test x$video_kmsdrm = xyes; then
  1.2137 +            AC_ARG_ENABLE(kmsdrm-shared,
  1.2138 +AS_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]),
  1.2139 +                , enable_kmsdrm_shared=yes)
  1.2140 +
  1.2141 +            AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
  1.2142 +            SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
  1.2143 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
  1.2144 +
  1.2145 +            AC_MSG_CHECKING(for kmsdrm dynamic loading support)
  1.2146 +            kmsdrm_shared=no
  1.2147 +            drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
  1.2148 +            gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
  1.2149 +            if test x$have_loadso != xyes && \
  1.2150 +               test x$enable_kmsdrm_shared = xyes; then
  1.2151 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
  1.2152 +            fi
  1.2153 +            if test x$have_loadso = xyes && \
  1.2154 +               test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
  1.2155 +                kmsdrm_shared=yes
  1.2156 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
  1.2157 +                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
  1.2158 +                AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
  1.2159 +                SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
  1.2160 +            else
  1.2161 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
  1.2162 +                SUMMARY_video="${SUMMARY_video} kmsdrm"
  1.2163 +            fi
  1.2164 +            AC_MSG_RESULT($kmsdrm_shared)
  1.2165 +            have_video=yes
  1.2166 +        fi
  1.2167 +    fi
  1.2168 +}
  1.2169 +
  1.2170 +dnl rcg04172001 Set up the Null video driver.
  1.2171 +CheckDummyVideo()
  1.2172 +{
  1.2173 +    AC_ARG_ENABLE(video-dummy,
  1.2174 +AS_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1.2175 +                  , enable_video_dummy=yes)
  1.2176 +    if test x$enable_video_dummy = xyes; then
  1.2177 +        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
  1.2178 +        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1.2179 +        have_video=yes
  1.2180 +        SUMMARY_video="${SUMMARY_video} dummy"
  1.2181 +    fi
  1.2182 +}
  1.2183 +
  1.2184 +dnl Set up the QNX video driver if enabled
  1.2185 +CheckQNXVideo()
  1.2186 +{
  1.2187 +    if test x$enable_video = xyes; then
  1.2188 +        AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
  1.2189 +        SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
  1.2190 +        have_video=yes
  1.2191 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
  1.2192 +        SUMMARY_video="${SUMMARY_video} qnx"
  1.2193 +    fi
  1.2194 +}
  1.2195 +
  1.2196 +dnl Set up the QNX audio driver if enabled
  1.2197 +CheckQNXAudio()
  1.2198 +{
  1.2199 +    if test x$enable_audio = xyes; then
  1.2200 +        AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
  1.2201 +        SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
  1.2202 +        have_audio=yes
  1.2203 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  1.2204 +        SUMMARY_audio="${SUMMARY_audio} qsa"
  1.2205 +    fi
  1.2206 +}
  1.2207 +
  1.2208 +dnl Check to see if OpenGL support is desired
  1.2209 +AC_ARG_ENABLE(video-opengl,
  1.2210 +AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1.2211 +              , enable_video_opengl=yes)
  1.2212 +
  1.2213 +dnl Find OpenGL
  1.2214 +CheckOpenGLX11()
  1.2215 +{
  1.2216 +    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1.2217 +        AC_MSG_CHECKING(for OpenGL (GLX) support)
  1.2218 +        video_opengl=no
  1.2219 +        AC_TRY_COMPILE([
  1.2220 +         #include <GL/gl.h>
  1.2221 +         #include <GL/glx.h>
  1.2222 +        ],[
  1.2223 +        ],[
  1.2224 +        video_opengl=yes
  1.2225 +        ])
  1.2226 +        AC_MSG_RESULT($video_opengl)
  1.2227 +        if test x$video_opengl = xyes; then
  1.2228 +            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1.2229 +            AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
  1.2230 +            AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1.2231 +            SUMMARY_video="${SUMMARY_video} opengl"
  1.2232 +        fi
  1.2233 +    fi
  1.2234 +}
  1.2235 +
  1.2236 +dnl Check to see if OpenGL ES support is desired
  1.2237 +AC_ARG_ENABLE(video-opengles,
  1.2238 +AS_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
  1.2239 +              , enable_video_opengles=yes)
  1.2240 +AC_ARG_ENABLE(video-opengles1,
  1.2241 +AS_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]),
  1.2242 +              , enable_video_opengles1=yes)
  1.2243 +AC_ARG_ENABLE(video-opengles2,
  1.2244 +AS_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]),
  1.2245 +              , enable_video_opengles2=yes)
  1.2246 +
  1.2247 +dnl Find OpenGL ES
  1.2248 +CheckOpenGLESX11()
  1.2249 +{
  1.2250 +    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1.2251 +        AC_MSG_CHECKING(for EGL support)
  1.2252 +        video_opengl_egl=no
  1.2253 +        AC_TRY_COMPILE([
  1.2254 +          #define LINUX
  1.2255 +          #define EGL_API_FB
  1.2256 +          #define MESA_EGL_NO_X11_HEADERS
  1.2257 +          #include <EGL/egl.h>
  1.2258 +          #include <EGL/eglext.h>
  1.2259 +        ],[
  1.2260 +        ],[
  1.2261 +        video_opengl_egl=yes
  1.2262 +        ])
  1.2263 +        AC_MSG_RESULT($video_opengl_egl)
  1.2264 +        if test x$video_opengl_egl = xyes; then
  1.2265 +            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1.2266 +        fi
  1.2267 +            
  1.2268 +        if test x$enable_video_opengles1 = xyes; then
  1.2269 +            AC_MSG_CHECKING(for OpenGL ES v1 headers)
  1.2270 +            video_opengles_v1=no
  1.2271 +            AC_TRY_COMPILE([
  1.2272 +             #include <GLES/gl.h>
  1.2273 +             #include <GLES/glext.h>
  1.2274 +            ],[
  1.2275 +            ],[
  1.2276 +            video_opengles_v1=yes
  1.2277 +            ])
  1.2278 +            AC_MSG_RESULT($video_opengles_v1)
  1.2279 +            if test x$video_opengles_v1 = xyes; then
  1.2280 +                AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  1.2281 +                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  1.2282 +                SUMMARY_video="${SUMMARY_video} opengl_es1"
  1.2283 +            fi
  1.2284 +        fi
  1.2285 +        
  1.2286 +        if test x$enable_video_opengles2 = xyes; then
  1.2287 +            AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1.2288 +            video_opengles_v2=no
  1.2289 +            AC_TRY_COMPILE([
  1.2290 +             #include <GLES2/gl2.h>
  1.2291 +             #include <GLES2/gl2ext.h>
  1.2292 +            ],[
  1.2293 +            ],[
  1.2294 +            video_opengles_v2=yes
  1.2295 +            ])
  1.2296 +            AC_MSG_RESULT($video_opengles_v2)
  1.2297 +            if test x$video_opengles_v2 = xyes; then
  1.2298 +                AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1.2299 +                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1.2300 +                SUMMARY_video="${SUMMARY_video} opengl_es2"
  1.2301 +            fi
  1.2302 +        fi
  1.2303 +    fi
  1.2304 +}
  1.2305 +
  1.2306 +dnl Check for Windows OpenGL
  1.2307 +CheckWINDOWSGL()
  1.2308 +{
  1.2309 +    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1.2310 +        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1.2311 +        AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
  1.2312 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1.2313 +        SUMMARY_video="${SUMMARY_video} opengl"
  1.2314 +    fi
  1.2315 +}
  1.2316 +
  1.2317 +dnl Check for Windows OpenGL
  1.2318 +CheckWINDOWSGLES()
  1.2319 +{
  1.2320 +    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1.2321 +
  1.2322 +        AC_MSG_CHECKING(for EGL support)
  1.2323 +        video_opengl_egl=no
  1.2324 +        AC_TRY_COMPILE([
  1.2325 +         #include <EGL/egl.h>
  1.2326 +        ],[
  1.2327 +        ],[
  1.2328 +        video_opengl_egl=yes
  1.2329 +        ])
  1.2330 +        AC_MSG_RESULT($video_opengl_egl)
  1.2331 +        if test x$video_opengl_egl = xyes; then
  1.2332 +            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1.2333 +            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1.2334 +            SUMMARY_video="${SUMMARY_video} opengl_es1"
  1.2335 +        fi
  1.2336 +       
  1.2337 +        AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1.2338 +        video_opengles_v2=no
  1.2339 +        AC_TRY_COMPILE([
  1.2340 +         #include <GLES2/gl2.h>
  1.2341 +         #include <GLES2/gl2ext.h>
  1.2342 +        ],[
  1.2343 +        ],[
  1.2344 +        video_opengles_v2=yes
  1.2345 +        ])
  1.2346 +        AC_MSG_RESULT($video_opengles_v2)
  1.2347 +        if test x$video_opengles_v2 = xyes; then
  1.2348 +            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1.2349 +            AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1.2350 +            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1.2351 +            SUMMARY_video="${SUMMARY_video} opengl_es2"
  1.2352 +        fi
  1.2353 +    fi
  1.2354 +}
  1.2355 +
  1.2356 +dnl Check for Haiku OpenGL
  1.2357 +CheckHaikuGL()
  1.2358 +{
  1.2359 +    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1.2360 +        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1.2361 +        AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
  1.2362 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1.2363 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1.2364 +        SUMMARY_video="${SUMMARY_video} opengl"
  1.2365 +    fi
  1.2366 +}
  1.2367 +
  1.2368 +dnl Check for MacOS OpenGL
  1.2369 +CheckMacGL()
  1.2370 +{
  1.2371 +    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1.2372 +        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1.2373 +        AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
  1.2374 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1.2375 +        SUMMARY_video="${SUMMARY_video} opengl"
  1.2376 +    fi
  1.2377 +}
  1.2378 +
  1.2379 +dnl Check for MacOS OpenGLES
  1.2380 +CheckMacGLES()
  1.2381 +{
  1.2382 +    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1.2383 +        video_opengl_egl=yes
  1.2384 +        AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1.2385 +        video_opengles_v2=yes
  1.2386 +        AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1.2387 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1.2388 +        SUMMARY_video="${SUMMARY_video} opengl_es2"
  1.2389 +    fi
  1.2390 +}
  1.2391 +
  1.2392 +CheckEmscriptenGLES()
  1.2393 +{
  1.2394 +    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1.2395 +        AC_MSG_CHECKING(for EGL support)
  1.2396 +        video_opengl_egl=no
  1.2397 +        AC_TRY_COMPILE([
  1.2398 +         #include <EGL/egl.h>
  1.2399 +        ],[
  1.2400 +        ],[
  1.2401 +        video_opengl_egl=yes
  1.2402 +        ])
  1.2403 +        AC_MSG_RESULT($video_opengl_egl)
  1.2404 +        if test x$video_opengl_egl = xyes; then
  1.2405 +            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1.2406 +        fi
  1.2407 +
  1.2408 +        AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1.2409 +        video_opengles_v2=no
  1.2410 +        AC_TRY_COMPILE([
  1.2411 +         #include <GLES2/gl2.h>
  1.2412 +         #include <GLES2/gl2ext.h>
  1.2413 +        ],[
  1.2414 +        ],[
  1.2415 +        video_opengles_v2=yes
  1.2416 +        ])
  1.2417 +        AC_MSG_RESULT($video_opengles_v2)
  1.2418 +        if test x$video_opengles_v2 = xyes; then
  1.2419 +            AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1.2420 +            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1.2421 +            SUMMARY_video="${SUMMARY_video} opengl_es2"
  1.2422 +        fi
  1.2423 +    fi
  1.2424 +}
  1.2425 +
  1.2426 +dnl Check to see if Vulkan support is desired
  1.2427 +AC_ARG_ENABLE(video-vulkan,
  1.2428 +AS_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
  1.2429 +              , enable_video_vulkan=yes)
  1.2430 +
  1.2431 +dnl Find Vulkan Header
  1.2432 +CheckVulkan()
  1.2433 +{
  1.2434 +    if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
  1.2435 +        case "$host" in
  1.2436 +            *-*-android*)
  1.2437 +                AC_TRY_COMPILE([
  1.2438 +                  #if defined(__ARM_ARCH) && __ARM_ARCH < 7
  1.2439 +                  #error Vulkan doesn't work on this configuration
  1.2440 +                  #endif
  1.2441 +                ],[
  1.2442 +                ],[
  1.2443 +                ],[
  1.2444 +                    enable_video_vulkan=no
  1.2445 +                ])
  1.2446 +                ;;
  1.2447 +            *-*-darwin*)
  1.2448 +                save_CFLAGS="$CFLAGS"
  1.2449 +                dnl Work around that we don't have Objective-C support in autoconf
  1.2450 +                CFLAGS="$CFLAGS -x objective-c"
  1.2451 +                AC_TRY_COMPILE([
  1.2452 +                  #include <Cocoa/Cocoa.h>
  1.2453 +                  #include <Metal/Metal.h>
  1.2454 +                  #include <QuartzCore/CAMetalLayer.h>
  1.2455 +
  1.2456 +                  #if !TARGET_CPU_X86_64
  1.2457 +                  #error Vulkan doesn't work on this configuration
  1.2458 +                  #endif
  1.2459 +                ],[
  1.2460 +                ],[
  1.2461 +                ],[
  1.2462 +                    enable_video_vulkan=no
  1.2463 +                ])
  1.2464 +                CFLAGS="$save_CFLAGS"
  1.2465 +                ;;
  1.2466 +            *)
  1.2467 +                ;;
  1.2468 +        esac
  1.2469 +        if test x$enable_video_vulkan = xno; then
  1.2470 +            # For reasons I am totally unable to see, I get an undefined macro error if
  1.2471 +            # I put this in the AC_TRY_COMPILE.
  1.2472 +            AC_MSG_WARN([Vulkan does not work on this configuration.])
  1.2473 +        fi
  1.2474 +    fi
  1.2475 +    if test x$enable_video_vulkan = xyes; then
  1.2476 +        AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
  1.2477 +        SUMMARY_video="${SUMMARY_video} vulkan"
  1.2478 +    fi
  1.2479 +}
  1.2480 +
  1.2481 +dnl See if we can use the new unified event interface in Linux 2.4
  1.2482 +CheckInputEvents()
  1.2483 +{
  1.2484 +    dnl Check for Linux 2.4 unified input event interface support
  1.2485 +        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1.2486 +        use_input_events=no
  1.2487 +        AC_TRY_COMPILE([
  1.2488 +          #include <linux/input.h>
  1.2489 +        ],[
  1.2490 +          #ifndef EVIOCGNAME
  1.2491 +          #error EVIOCGNAME() ioctl not available
  1.2492 +          #endif
  1.2493 +        ],[
  1.2494 +        use_input_events=yes
  1.2495 +        ])
  1.2496 +        AC_MSG_RESULT($use_input_events)
  1.2497 +        if test x$use_input_events = xyes; then
  1.2498 +            AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
  1.2499 +            SUMMARY_input="${SUMMARY_input} linuxev"
  1.2500 +        fi
  1.2501 +}
  1.2502 +
  1.2503 +dnl See if we can use the kernel kd.h header
  1.2504 +CheckInputKD()
  1.2505 +{
  1.2506 +
  1.2507 +    AC_MSG_CHECKING(for Linux kd.h)
  1.2508 +    use_input_kd=no
  1.2509 +    AC_TRY_COMPILE([
  1.2510 +      #include <linux/kd.h>
  1.2511 +      #include <linux/keyboard.h>
  1.2512 +    ],[
  1.2513 +        struct kbentry kbe;
  1.2514 +        kbe.kb_table = KG_CTRL;
  1.2515 +        ioctl(0, KDGKBENT, &kbe);
  1.2516 +    ],[
  1.2517 +    use_input_kd=yes
  1.2518 +    ])
  1.2519 +    AC_MSG_RESULT($use_input_kd)
  1.2520 +    if test x$use_input_kd = xyes; then
  1.2521 +        AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
  1.2522 +        SUMMARY_input="${SUMMARY_input} linuxkd"
  1.2523 +    fi
  1.2524 +}
  1.2525 +
  1.2526 +dnl See if the platform offers libudev for device enumeration and hotplugging.
  1.2527 +CheckLibUDev()
  1.2528 +{
  1.2529 +    AC_ARG_ENABLE(libudev,
  1.2530 +AS_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
  1.2531 +                        , enable_libudev=yes)
  1.2532 +    if test x$enable_libudev = xyes; then
  1.2533 +        AC_CHECK_HEADER(libudev.h,
  1.2534 +                        have_libudev_h_hdr=yes,
  1.2535 +                        have_libudev_h_hdr=no)
  1.2536 +        if test x$have_libudev_h_hdr = xyes; then
  1.2537 +            AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
  1.2538 +
  1.2539 +            udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
  1.2540 +            if test x$udev_lib != x; then
  1.2541 +                echo "-- dynamic udev -> $udev_lib"
  1.2542 +                AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ])
  1.2543 +            fi
  1.2544 +        fi
  1.2545 +    fi
  1.2546 +}
  1.2547 +
  1.2548 +dnl See if the platform offers libdbus for various IPC techniques.
  1.2549 +CheckDBus()
  1.2550 +{
  1.2551 +    AC_ARG_ENABLE(dbus,
  1.2552 +AS_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
  1.2553 +                        , enable_dbus=yes)
  1.2554 +    if test x$enable_dbus = xyes; then
  1.2555 +        PKG_CHECK_MODULES([DBUS], [dbus-1], have_dbus=yes, have_dbus=no)
  1.2556 +        save_CFLAGS="$CFLAGS"
  1.2557 +        CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
  1.2558 +        AC_CHECK_HEADER(dbus/dbus.h,
  1.2559 +                        have_dbus_dbus_h_hdr=yes,
  1.2560 +                        have_dbus_dbus_h_hdr=no)
  1.2561 +        CFLAGS="$save_CFLAGS"
  1.2562 +        if test x$have_dbus_dbus_h_hdr = xyes; then
  1.2563 +            AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
  1.2564 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
  1.2565 +            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
  1.2566 +        fi
  1.2567 +    fi
  1.2568 +}
  1.2569 +
  1.2570 +dnl See if the platform wanna IME support.
  1.2571 +CheckIME()
  1.2572 +{
  1.2573 +    AC_ARG_ENABLE(ime,
  1.2574 +AS_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
  1.2575 +                  , enable_ime=yes)
  1.2576 +    if test x$enable_ime = xyes; then
  1.2577 +        AC_DEFINE(SDL_USE_IME, 1, [ ])
  1.2578 +            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
  1.2579 +    fi
  1.2580 +}
  1.2581 +
  1.2582 +dnl See if the platform has libibus IME support.
  1.2583 +CheckIBus()
  1.2584 +{
  1.2585 +    AC_ARG_ENABLE(ibus,
  1.2586 +AS_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
  1.2587 +                  , enable_ibus=yes)
  1.2588 +    if test x$enable_ibus = xyes; then
  1.2589 +        PKG_CHECK_MODULES([IBUS], [ibus-1.0], have_ibus=yes, have_ibus=no)
  1.2590 +        save_CFLAGS="$CFLAGS"
  1.2591 +        CFLAGS="$save_CFLAGS $IBUS_CFLAGS"
  1.2592 +        AC_CHECK_HEADER(ibus-1.0/ibus.h,
  1.2593 +                        have_ibus_ibus_h_hdr=yes,
  1.2594 +                        have_ibus_ibus_h_hdr=no)
  1.2595 +        AC_CHECK_HEADER(sys/inotify.h,
  1.2596 +                        have_inotify_inotify_h_hdr=yes,
  1.2597 +                        have_inotify_inotify_h_hdr=no)
  1.2598 +        CFLAGS="$save_CFLAGS"
  1.2599 +        if test x$have_ibus_ibus_h_hdr = xyes; then
  1.2600 +            if test x$enable_ime != xyes; then
  1.2601 +                AC_MSG_WARN([IME support is required for IBus.])
  1.2602 +                have_ibus_ibus_h_hdr=no
  1.2603 +            elif test x$enable_dbus != xyes; then
  1.2604 +                AC_MSG_WARN([DBus support is required for IBus.])
  1.2605 +                have_ibus_ibus_h_hdr=no
  1.2606 +            elif test x$have_inotify_inotify_h_hdr != xyes; then
  1.2607 +                AC_MSG_WARN([INotify support is required for IBus.])
  1.2608 +                have_ibus_ibus_h_hdr=no
  1.2609 +            else
  1.2610 +                AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
  1.2611 +                EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
  1.2612 +                SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
  1.2613 +            fi
  1.2614 +        fi
  1.2615 +    fi
  1.2616 +}
  1.2617 +
  1.2618 +dnl See if the platform has fcitx IME support.
  1.2619 +CheckFcitx()
  1.2620 +{
  1.2621 +    AC_ARG_ENABLE(fcitx,
  1.2622 +AS_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
  1.2623 +                  , enable_fcitx=yes)
  1.2624 +    if test x$enable_fcitx = xyes; then
  1.2625 +        PKG_CHECK_MODULES([FCITX], [fcitx], have_fcitx=yes, have_fcitx=no)
  1.2626 +        CFLAGS="$CFLAGS $FCITX_CFLAGS"
  1.2627 +        AC_CHECK_HEADER(fcitx/frontend.h,
  1.2628 +                        have_fcitx_frontend_h_hdr=yes,
  1.2629 +                        have_fcitx_frontend_h_hdr=no)
  1.2630 +        CFLAGS="$save_CFLAGS"
  1.2631 +        if test x$have_fcitx_frontend_h_hdr = xyes; then
  1.2632 +            if test x$enable_ime != xyes; then
  1.2633 +                AC_MSG_WARN([IME support is required for fcitx.])
  1.2634 +                have_fcitx_frontend_h_hdr=no
  1.2635 +            elif test x$enable_dbus != xyes; then
  1.2636 +                AC_MSG_WARN([DBus support is required for fcitx.])
  1.2637 +                have_fcitx_frontend_h_hdr=no
  1.2638 +            else
  1.2639 +                AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ])
  1.2640 +                EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
  1.2641 +                SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
  1.2642 +            fi
  1.2643 +        fi
  1.2644 +    fi
  1.2645 +}
  1.2646 +
  1.2647 +dnl See if we can use the Touchscreen input library
  1.2648 +CheckTslib()
  1.2649 +{
  1.2650 +    AC_ARG_ENABLE(input-tslib,
  1.2651 +AS_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1.2652 +                  , enable_input_tslib=yes)
  1.2653 +    if test x$enable_input_tslib = xyes; then
  1.2654 +        AC_MSG_CHECKING(for Touchscreen library support)
  1.2655 +        enable_input_tslib=no
  1.2656 +        AC_TRY_COMPILE([
  1.2657 +          #include "tslib.h"
  1.2658 +        ],[
  1.2659 +        ],[
  1.2660 +        enable_input_tslib=yes
  1.2661 +        ])
  1.2662 +        AC_MSG_RESULT($enable_input_tslib)
  1.2663 +        if test x$enable_input_tslib = xyes; then
  1.2664 +            AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
  1.2665 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1.2666 +            SUMMARY_input="${SUMMARY_input} ts"
  1.2667 +        fi
  1.2668 +    fi
  1.2669 +}
  1.2670 +
  1.2671 +dnl See what type of thread model to use on Linux and Solaris
  1.2672 +CheckPTHREAD()
  1.2673 +{
  1.2674 +    dnl Check for pthread support
  1.2675 +    AC_ARG_ENABLE(pthreads,
  1.2676 +AS_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1.2677 +                  , enable_pthreads=yes)
  1.2678 +    dnl This is used on Linux for glibc binary compatibility (Doh!)
  1.2679 +    AC_ARG_ENABLE(pthread-sem,
  1.2680 +AS_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1.2681 +                  , enable_pthread_sem=yes)
  1.2682 +    case "$host" in
  1.2683 +         *-*-android*)
  1.2684 +            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1.2685 +            pthread_lib=""
  1.2686 +            ;;
  1.2687 +        *-*-linux*|*-*-uclinux*)
  1.2688 +            pthread_cflags="-D_REENTRANT"
  1.2689 +            pthread_lib="-lpthread"
  1.2690 +            ;;
  1.2691 +        *-*-bsdi*)
  1.2692 +            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1.2693 +            pthread_lib=""
  1.2694 +            ;;
  1.2695 +        *-*-darwin*)
  1.2696 +            pthread_cflags="-D_THREAD_SAFE"
  1.2697 +# causes Carbon.p complaints?
  1.2698 +#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1.2699 +            ;;
  1.2700 +        *-*-freebsd*|*-*-dragonfly*)
  1.2701 +            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1.2702 +            pthread_lib="-pthread"
  1.2703 +            ;;
  1.2704 +        *-*-netbsd*)
  1.2705 +            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1.2706 +            pthread_lib="-lpthread"
  1.2707 +            ;;
  1.2708 +        *-*-openbsd*)
  1.2709 +            pthread_cflags="-D_REENTRANT"
  1.2710 +            pthread_lib="-pthread"
  1.2711 +            ;;
  1.2712 +        *-*-solaris2.9)
  1.2713 +            # From Solaris 9+, posix4's preferred name is rt.
  1.2714 +            pthread_cflags="-D_REENTRANT"
  1.2715 +            pthread_lib="-lpthread -lrt"
  1.2716 +            ;;
  1.2717 +        *-*-solaris2.10)
  1.2718 +            # Solaris 10+ merged pthread into libc.
  1.2719 +            pthread_cflags="-D_REENTRANT"
  1.2720 +            pthread_lib="-lrt"
  1.2721 +            ;;
  1.2722 +        *-*-solaris*)
  1.2723 +            # Solaris 11+ merged rt into libc.
  1.2724 +            pthread_cflags="-D_REENTRANT"
  1.2725 +            pthread_lib=""
  1.2726 +            ;;
  1.2727 +        *-*-sysv5*)
  1.2728 +            pthread_cflags="-D_REENTRANT -Kthread"
  1.2729 +            pthread_lib=""
  1.2730 +            ;;
  1.2731 +        *-*-aix*)
  1.2732 +            pthread_cflags="-D_REENTRANT -mthreads"
  1.2733 +            pthread_lib="-lpthread"
  1.2734 +            ;;
  1.2735 +        *-*-hpux11*)
  1.2736 +            pthread_cflags="-D_REENTRANT"
  1.2737 +            pthread_lib="-L/usr/lib -lpthread"
  1.2738 +            ;;
  1.2739 +        *-*-haiku*)
  1.2740 +            pthread_cflags="-D_REENTRANT"
  1.2741 +            pthread_lib=""
  1.2742 +            ;;
  1.2743 +        *-*-nto*)
  1.2744 +            pthread_cflags="-D_REENTRANT"
  1.2745 +            pthread_lib=""
  1.2746 +            ;;
  1.2747 +        *)
  1.2748 +            pthread_cflags="-D_REENTRANT"
  1.2749 +            pthread_lib="-lpthread"
  1.2750 +            ;;
  1.2751 +    esac
  1.2752 +    if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1.2753 +        # Save the original compiler flags and libraries
  1.2754 +        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1.2755 +        # Add the pthread compiler flags and libraries
  1.2756 +        CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1.2757 +        # Check to see if we have pthread support on this system
  1.2758 +        AC_MSG_CHECKING(for pthreads)
  1.2759 +        use_pthreads=no
  1.2760 +        AC_TRY_LINK([
  1.2761 +         #include <pthread.h>
  1.2762 +        ],[
  1.2763 +         pthread_attr_t type;
  1.2764 +         pthread_attr_init(&type);
  1.2765 +        ],[
  1.2766 +        use_pthreads=yes
  1.2767 +        ])
  1.2768 +        AC_MSG_RESULT($use_pthreads)
  1.2769 +        # Restore the compiler flags and libraries
  1.2770 +        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1.2771 +
  1.2772 +        # Do futher testing if we have pthread support...
  1.2773 +        if test x$use_pthreads = xyes; then
  1.2774 +            AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
  1.2775 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1.2776 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1.2777 +            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1.2778 +
  1.2779 +            # Save the original compiler flags and libraries
  1.2780 +            ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1.2781 +            # Add the pthread compiler flags and libraries
  1.2782 +            CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1.2783 +
  1.2784 +            # Check to see if recursive mutexes are available
  1.2785 +            AC_MSG_CHECKING(for recursive mutexes)
  1.2786 +            has_recursive_mutexes=no
  1.2787 +            if test x$has_recursive_mutexes = xno; then
  1.2788 +                AC_TRY_LINK([
  1.2789 +                  #define _GNU_SOURCE 1
  1.2790 +                  #include <pthread.h>
  1.2791 +                ],[
  1.2792 +                  pthread_mutexattr_t attr;
  1.2793 +                  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1.2794 +                ],[
  1.2795 +                has_recursive_mutexes=yes
  1.2796 +                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
  1.2797 +                ])
  1.2798 +            fi
  1.2799 +            if test x$has_recursive_mutexes = xno; then
  1.2800 +                AC_TRY_LINK([
  1.2801 +                  #define _GNU_SOURCE 1
  1.2802 +                  #include <pthread.h>
  1.2803 +                ],[
  1.2804 +                  pthread_mutexattr_t attr;
  1.2805 +                  pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1.2806 +                ],[
  1.2807 +                has_recursive_mutexes=yes
  1.2808 +                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
  1.2809 +                ])
  1.2810 +            fi
  1.2811 +            AC_MSG_RESULT($has_recursive_mutexes)
  1.2812 +
  1.2813 +            # Check to see if pthread semaphore support is missing
  1.2814 +            if test x$enable_pthread_sem = xyes; then
  1.2815 +                AC_MSG_CHECKING(for pthread semaphores)
  1.2816 +                have_pthread_sem=no
  1.2817 +                AC_TRY_COMPILE([
  1.2818 +                  #include <pthread.h>
  1.2819 +                  #include <semaphore.h>
  1.2820 +                ],[
  1.2821 +                ],[
  1.2822 +                have_pthread_sem=yes
  1.2823 +                ])
  1.2824 +                AC_MSG_RESULT($have_pthread_sem)
  1.2825 +            fi
  1.2826 +            if test x$have_pthread_sem = xyes; then
  1.2827 +                AC_MSG_CHECKING(for sem_timedwait)
  1.2828 +                have_sem_timedwait=no
  1.2829 +                AC_TRY_LINK([
  1.2830 +                  #include <pthread.h>
  1.2831 +                  #include <semaphore.h>
  1.2832 +                ],[
  1.2833 +                  sem_timedwait(NULL, NULL);
  1.2834 +                ],[
  1.2835 +                have_sem_timedwait=yes
  1.2836 +                AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ])
  1.2837 +                ])
  1.2838 +                AC_MSG_RESULT($have_sem_timedwait)
  1.2839 +            fi
  1.2840 +
  1.2841 +            AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
  1.2842 +            if test x$have_pthread_np_h = xyes; then
  1.2843 +                AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
  1.2844 +            fi
  1.2845 +
  1.2846 +            # Check to see if pthread naming is available
  1.2847 +            AC_MSG_CHECKING(for pthread_setname_np)
  1.2848 +            AC_TRY_LINK_FUNC(pthread_setname_np, [
  1.2849 +              has_pthread_setname_np=yes
  1.2850 +              AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
  1.2851 +            ],[
  1.2852 +              has_pthread_setname_np=no
  1.2853 +            ])
  1.2854 +            AC_MSG_RESULT($has_pthread_setname_np)
  1.2855 +
  1.2856 +            AC_MSG_CHECKING(for pthread_set_name_np)
  1.2857 +            AC_TRY_LINK_FUNC(pthread_set_name_np, [
  1.2858 +              has_pthread_set_name_np=yes
  1.2859 +              AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
  1.2860 +            ],[
  1.2861 +              has_pthread_set_name_np=no
  1.2862 +            ])
  1.2863 +            AC_MSG_RESULT($has_pthread_set_name_np)
  1.2864 +
  1.2865 +            # Restore the compiler flags and libraries
  1.2866 +            CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1.2867 +
  1.2868 +            # Basic thread creation functions
  1.2869 +            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1.2870 +
  1.2871 +            # Semaphores
  1.2872 +            # We can fake these with mutexes and condition variables if necessary
  1.2873 +            if test x$have_pthread_sem = xyes; then
  1.2874 +                SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1.2875 +            else
  1.2876 +                SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1.2877 +            fi
  1.2878 +
  1.2879 +            # Mutexes
  1.2880 +            # We can fake these with semaphores if necessary
  1.2881 +            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1.2882 +
  1.2883 +            # Condition variables
  1.2884 +            # We can fake these with semaphores and mutexes if necessary
  1.2885 +            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1.2886 +
  1.2887 +            # Thread local storage
  1.2888 +            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
  1.2889 +
  1.2890 +            have_threads=yes
  1.2891 +        fi
  1.2892 +    fi
  1.2893 +}
  1.2894 +
  1.2895 +dnl Determine whether the compiler can produce Windows executables
  1.2896 +CheckWINDOWS()
  1.2897 +{
  1.2898 +    AC_MSG_CHECKING(Windows compiler)
  1.2899 +    have_win32_gcc=no
  1.2900 +    AC_TRY_COMPILE([
  1.2901 +     #include <windows.h>
  1.2902 +    ],[
  1.2903 +    ],[
  1.2904 +    have_win32_gcc=yes
  1.2905 +    ])
  1.2906 +    AC_MSG_RESULT($have_win32_gcc)
  1.2907 +    if test x$have_win32_gcc != xyes; then
  1.2908 +       AC_MSG_ERROR([
  1.2909 +*** Your compiler ($CC) does not produce Windows executables!
  1.2910 +       ])
  1.2911 +    fi
  1.2912 +
  1.2913 +    AC_MSG_CHECKING(Windows CE)
  1.2914 +    have_wince=no
  1.2915 +    AC_TRY_COMPILE([
  1.2916 +#if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  1.2917 +#error This is not Windows CE
  1.2918 +#endif
  1.2919 +    ],[
  1.2920 +    ],[
  1.2921 +    have_wince=yes
  1.2922 +       AC_MSG_ERROR([
  1.2923 +*** Sorry, Windows CE is no longer supported.
  1.2924 +       ])
  1.2925 +    ])
  1.2926 +    AC_MSG_RESULT($have_wince)
  1.2927 +
  1.2928 +    # This fixes Windows stack alignment with newer GCC
  1.2929 +    CheckStackBoundary
  1.2930 +}
  1.2931 +
  1.2932 +dnl Find the DirectX includes and libraries
  1.2933 +CheckDIRECTX()
  1.2934 +{
  1.2935 +    AC_ARG_ENABLE(directx,
  1.2936 +AS_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
  1.2937 +                  , enable_directx=yes)
  1.2938 +    if test x$enable_directx = xyes; then
  1.2939 +        AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  1.2940 +        AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes)
  1.2941 +        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1.2942 +        AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1.2943 +        AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  1.2944 +        AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
  1.2945 +        AC_CHECK_HEADER(xinput.h, have_xinput=yes)
  1.2946 +        AC_TRY_COMPILE([
  1.2947 +#include <windows.h>
  1.2948 +#include <xinput.h>
  1.2949 +XINPUT_GAMEPAD_EX x1;
  1.2950 +        ],[],[have_xinput_gamepadex=yes])
  1.2951 +        AC_TRY_COMPILE([
  1.2952 +#include <windows.h>
  1.2953 +#include <xinput.h>
  1.2954 +XINPUT_STATE_EX s1;
  1.2955 +        ],[],[have_xinput_stateex=yes])
  1.2956 +
  1.2957 +        if test x$have_ddraw = xyes; then
  1.2958 +            AC_DEFINE(HAVE_DDRAW_H, 1, [ ])
  1.2959 +        fi
  1.2960 +        if test x$have_dinput = xyes; then
  1.2961 +            AC_DEFINE(HAVE_DINPUT_H, 1, [ ])
  1.2962 +        fi
  1.2963 +        if test x$have_dsound = xyes; then
  1.2964 +            AC_DEFINE(HAVE_DSOUND_H, 1, [ ])
  1.2965 +        fi
  1.2966 +        if test x$have_dxgi = xyes; then
  1.2967 +            AC_DEFINE(HAVE_DXGI_H, 1, [ ])
  1.2968 +        fi
  1.2969 +        if test x$have_xinput = xyes; then
  1.2970 +            AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
  1.2971 +        fi
  1.2972 +        if test x$have_xinput_gamepadex = xyes; then
  1.2973 +            AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
  1.2974 +        fi
  1.2975 +        if test x$have_xinput_stateex = xyes; then
  1.2976 +            AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
  1.2977 +        fi
  1.2978 +
  1.2979 +        SUMMARY_video="${SUMMARY_video} directx"
  1.2980 +        SUMMARY_audio="${SUMMARY_audio} directx"
  1.2981 +
  1.2982 +        # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
  1.2983 +        # FIXME:  ...so force it off for now.
  1.2984 +        case "$host" in
  1.2985 +            *-*-cygwin*)
  1.2986 +            have_dinput=false
  1.2987 +            ;;
  1.2988 +        esac
  1.2989 +    fi
  1.2990 +
  1.2991 +    AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
  1.2992 +    if test x$have_wasapi = xyes; then
  1.2993 +        AC_DEFINE(HAVE_MMDEVICEAPI_H,1,[])
  1.2994 +    fi
  1.2995 +    AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
  1.2996 +    if test x$have_wasapi = xyes; then
  1.2997 +        AC_DEFINE(HAVE_AUDIOCLIENT_H,1,[])
  1.2998 +    fi
  1.2999 +
  1.3000 +    AC_CHECK_HEADER(endpointvolume.h,AC_DEFINE(HAVE_ENDPOINTVOLUME_H,1,[]))
  1.3001 +
  1.3002 +    AC_ARG_ENABLE(wasapi,
  1.3003 +AS_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
  1.3004 +                                , enable_wasapi=yes)
  1.3005 +}
  1.3006 +
  1.3007 +dnl Check for the dlfcn.h interface for dynamically loading objects
  1.3008 +CheckDLOPEN()
  1.3009 +{
  1.3010 +    AC_ARG_ENABLE(sdl-dlopen,
  1.3011 +AS_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1.3012 +                  , enable_sdl_dlopen=yes)
  1.3013 +    if test x$enable_sdl_dlopen = xyes; then
  1.3014 +        AC_MSG_CHECKING(for dlopen)
  1.3015 +        have_dlopen=no
  1.3016 +        AC_TRY_COMPILE([
  1.3017 +         #include <dlfcn.h>
  1.3018 +        ],[
  1.3019 +         void *handle = dlopen("", RTLD_NOW);
  1.3020 +         const char *loaderror = (char *) dlerror();
  1.3021 +        ],[
  1.3022 +        have_dlopen=yes
  1.3023 +        ])
  1.3024 +        AC_MSG_RESULT($have_dlopen)
  1.3025 +
  1.3026 +        if test x$have_dlopen = xyes; then
  1.3027 +            AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1.3028 +               AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1.3029 +                  AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1.3030 +            AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
  1.3031 +            SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1.3032 +            have_loadso=yes
  1.3033 +        fi
  1.3034 +    fi
  1.3035 +}
  1.3036 +
  1.3037 +dnl Check for the usbhid(3) library on *BSD
  1.3038 +CheckUSBHID()
  1.3039 +{
  1.3040 +    case "$host" in
  1.3041 +        *-*-*bsd*)
  1.3042 +            if test x$enable_joystick = xyes; then
  1.3043 +                AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1.3044 +                if test x$have_libusbhid = xyes; then
  1.3045 +                    AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1.3046 +                    AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1.3047 +                    USB_LIBS="$USB_LIBS -lusbhid"
  1.3048 +                else
  1.3049 +                    AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1.3050 +                    AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1.3051 +                    AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1.3052 +                fi
  1.3053 +                    
  1.3054 +                save_CFLAGS="$CFLAGS"
  1.3055 +                CFLAGS="$CFLAGS $USB_CFLAGS"
  1.3056 +
  1.3057 +                AC_MSG_CHECKING(for usbhid)
  1.3058 +                have_usbhid=no
  1.3059 +                AC_TRY_COMPILE([
  1.3060 +                  #include <sys/types.h>
  1.3061 +                  #if defined(HAVE_USB_H)
  1.3062 +                  #include <usb.h>
  1.3063 +                  #endif
  1.3064 +                  #ifdef __DragonFly__
  1.3065 +                  # include <bus/usb/usb.h>
  1.3066 +                  # include <bus/usb/usbhid.h>
  1.3067 +                  #else
  1.3068 +                  # include <dev/usb/usb.h>
  1.3069 +                  # include <dev/usb/usbhid.h>
  1.3070 +                  #endif
  1.3071 +                  #if defined(HAVE_USBHID_H)
  1.3072 +                  #include <usbhid.h>
  1.3073 +                  #elif defined(HAVE_LIBUSB_H)
  1.3074 +                  #include <libusb.h>
  1.3075 +                  #elif defined(HAVE_LIBUSBHID_H)
  1.3076 +                  #include <libusbhid.h>
  1.3077 +                  #endif
  1.3078 +                ],[
  1.3079 +                  struct report_desc *repdesc;
  1.3080 +                  struct usb_ctl_report *repbuf;
  1.3081 +                  hid_kind_t hidkind;
  1.3082 +                ],[
  1.3083 +                have_usbhid=yes
  1.3084 +                ])
  1.3085 +                AC_MSG_RESULT($have_usbhid)
  1.3086 +
  1.3087 +                if test x$have_usbhid = xyes; then
  1.3088 +                    AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1.3089 +                    have_usbhid_ucr_data=no
  1.3090 +                    AC_TRY_COMPILE([
  1.3091 +                      #include <sys/types.h>
  1.3092 +                      #if defined(HAVE_USB_H)
  1.3093 +                      #include <usb.h>
  1.3094 +                      #endif
  1.3095 +                      #ifdef __DragonFly__
  1.3096 +                      # include <bus/usb/usb.h>
  1.3097 +                      # include <bus/usb/usbhid.h>
  1.3098 +                      #else
  1.3099 +                      # include <dev/usb/usb.h>
  1.3100 +                      # include <dev/usb/usbhid.h>
  1.3101 +                      #endif
  1.3102 +                      #if defined(HAVE_USBHID_H)
  1.3103 +                      #include <usbhid.h>
  1.3104 +                      #elif defined(HAVE_LIBUSB_H)
  1.3105 +                      #include <libusb.h>
  1.3106 +                      #elif defined(HAVE_LIBUSBHID_H)
  1.3107 +                      #include <libusbhid.h>
  1.3108 +                      #endif
  1.3109 +                    ],[
  1.3110 +                      struct usb_ctl_report buf;
  1.3111 +                      if (buf.ucr_data) { }
  1.3112 +                    ],[
  1.3113 +                    have_usbhid_ucr_data=yes
  1.3114 +                    ])
  1.3115 +                    if test x$have_usbhid_ucr_data = xyes; then
  1.3116 +                        USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1.3117 +                    fi
  1.3118 +                    AC_MSG_RESULT($have_usbhid_ucr_data)
  1.3119 +                    
  1.3120 +                    AC_MSG_CHECKING(for new usbhid API)
  1.3121 +                    have_usbhid_new=no
  1.3122 +                    AC_TRY_COMPILE([
  1.3123 +                      #include <sys/types.h>
  1.3124 +                      #if defined(HAVE_USB_H)
  1.3125 +                      #include <usb.h>
  1.3126 +                      #endif
  1.3127 +                      #ifdef __DragonFly__
  1.3128 +                      #include <bus/usb/usb.h>
  1.3129 +                      #include <bus/usb/usbhid.h>
  1.3130 +                      #else
  1.3131 +                      #include <dev/usb/usb.h>
  1.3132 +                      #include <dev/usb/usbhid.h>
  1.3133 +                      #endif
  1.3134 +                      #if defined(HAVE_USBHID_H)
  1.3135 +                      #include <usbhid.h>
  1.3136 +                      #elif defined(HAVE_LIBUSB_H)
  1.3137 +                      #include <libusb.h>
  1.3138 +                      #elif defined(HAVE_LIBUSBHID_H)
  1.3139 +                      #include <libusbhid.h>
  1.3140 +                      #endif
  1.3141 +                    ],[
  1.3142 +                      report_desc_t d;
  1.3143 +                      hid_start_parse(d, 1, 1);
  1.3144 +                    ],[
  1.3145 +                    have_usbhid_new=yes
  1.3146 +                    ])
  1.3147 +                    if test x$have_usbhid_new = xyes; then
  1.3148 +                        USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  1.3149 +                    fi
  1.3150 +                    AC_MSG_RESULT($have_usbhid_new)
  1.3151 +
  1.3152 +                    AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  1.3153 +                    have_machine_joystick=no
  1.3154 +                    AC_TRY_COMPILE([
  1.3155 +                      #include <machine/joystick.h>
  1.3156 +                    ],[
  1.3157 +                      struct joystick t;
  1.3158 +                    ],[
  1.3159 +                    have_machine_joystick=yes
  1.3160 +                    ])
  1.3161 +                    if test x$have_machine_joystick = xyes; then
  1.3162 +                        AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
  1.3163 +                    fi
  1.3164 +                    AC_MSG_RESULT($have_machine_joystick)
  1.3165 +
  1.3166 +                    AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
  1.3167 +                    SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  1.3168 +                    EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  1.3169 +                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  1.3170 +                    have_joystick=yes
  1.3171 +                fi
  1.3172 +                CFLAGS="$save_CFLAGS"
  1.3173 +            fi
  1.3174 +        ;;
  1.3175 +    esac
  1.3176 +}
  1.3177 +
  1.3178 +dnl Check for HIDAPI joystick drivers
  1.3179 +CheckHIDAPI()
  1.3180 +{
  1.3181 +    # The hidraw support doesn't catch Xbox, PS4 and Nintendo controllers,
  1.3182 +    # so we'll just use libusb when it's available.
  1.3183 +    #
  1.3184 +    # Except that libusb requires root permissions to open devices, so that's not generally useful, and we'll disable this by default.
  1.3185 +    AC_ARG_ENABLE(hidapi,
  1.3186 +AS_HELP_STRING([--enable-hidapi], [use HIDAPI for low level joystick drivers [[default=no]]]),
  1.3187 +                  , enable_hidapi=no)
  1.3188 +    if test x$enable_joystick = xyes -a x$enable_hidapi = xyes; then
  1.3189 +        PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no)
  1.3190 +        hidapi_support=no
  1.3191 +        save_CFLAGS="$CFLAGS"
  1.3192 +        CFLAGS="$save_CFLAGS $LIBUSB_CFLAGS"
  1.3193 +        AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
  1.3194 +        CFLAGS="$save_CFLAGS"
  1.3195 +
  1.3196 +        if test x$have_libusb_h = xyes; then
  1.3197 +            hidapi_support=yes
  1.3198 +            AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  1.3199 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
  1.3200 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  1.3201 +            SOURCES="$SOURCES $srcdir/src/hidapi/libusb/hid.c"
  1.3202 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
  1.3203 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
  1.3204 +        fi
  1.3205 +        AC_MSG_CHECKING(for hidapi support)
  1.3206 +        AC_MSG_RESULT($hidapi_support)
  1.3207 +    fi
  1.3208 +}
  1.3209 +
  1.3210 +dnl Check for clock_gettime()
  1.3211 +CheckClockGettime()
  1.3212 +{
  1.3213 +    AC_ARG_ENABLE(clock_gettime,
  1.3214 +AS_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
  1.3215 +                  , enable_clock_gettime=yes)
  1.3216 +    if test x$enable_clock_gettime = xyes; then
  1.3217 +        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  1.3218 +        if test x$have_clock_gettime = xyes; then
  1.3219 +            AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  1.3220 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  1.3221 +        else
  1.3222 +            AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  1.3223 +            if test x$have_clock_gettime = xyes; then
  1.3224 +               AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  1.3225 +               EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  1.3226 +            fi
  1.3227 +        fi
  1.3228 +    fi
  1.3229 +}
  1.3230 +
  1.3231 +dnl Check for a valid linux/version.h
  1.3232 +CheckLinuxVersion()
  1.3233 +{
  1.3234 +    AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  1.3235 +    if test x$have_linux_version_h = xyes; then
  1.3236 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  1.3237 +    fi
  1.3238 +}
  1.3239 +
  1.3240 +dnl Check if we want to use RPATH
  1.3241 +CheckRPATH()
  1.3242 +{
  1.3243 +    AC_ARG_ENABLE(rpath,
  1.3244 +AS_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  1.3245 +                  , enable_rpath=yes)
  1.3246 +}
  1.3247 +
  1.3248 +dnl Check if we want to use custom signals to fake iOS/Android's backgrounding
  1.3249 +dnl  events. These could be useful if you're building a custom embedded
  1.3250 +dnl  environment, etc, but most people don't need this.
  1.3251 +CheckEventSignals()
  1.3252 +{
  1.3253 +    AC_ARG_ENABLE(backgrounding-signal,
  1.3254 +AS_HELP_STRING([--enable-backgrounding-signal], [number to use for magic backgrounding signal or 'no' [[default=no]]]),
  1.3255 +                  , enable_backgrounding_signal=no)
  1.3256 +    if test x$enable_backgrounding_signal != xno; then
  1.3257 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_BACKGROUNDING_SIGNAL=$enable_backgrounding_signal"
  1.3258 +    fi
  1.3259 +
  1.3260 +    AC_ARG_ENABLE(foregrounding-signal,
  1.3261 +AS_HELP_STRING([--enable-foregrounding-signal], [number to use for magic foregrounding signal or 'no' [[default=no]]]),
  1.3262 +                  , enable_foregrounding_signal=no)
  1.3263 +    if test x$enable_foregrounding_signal != xno; then
  1.3264 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_FOREGROUNDING_SIGNAL=$enable_foregrounding_signal"
  1.3265 +    fi
  1.3266 +}
  1.3267 +
  1.3268 +
  1.3269 +
  1.3270 +dnl Do this on all platforms, before everything else (other things might want to override it).
  1.3271 +CheckWarnAll
  1.3272 +
  1.3273 +dnl Do this for every platform, but for some it doesn't mean anything, but better to catch it here anyhow.
  1.3274 +CheckEventSignals
  1.3275 +
  1.3276 +dnl Set up the configuration based on the host platform!
  1.3277 +case "$host" in
  1.3278 +    *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
  1.3279 +        case "$host" in
  1.3280 +            *-*-android*)
  1.3281 +                # Android
  1.3282 +                ARCH=android
  1.3283 +                ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES"
  1.3284 +                CFLAGS="$CFLAGS $ANDROID_CFLAGS"
  1.3285 +                SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS"
  1.3286 +                EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS"
  1.3287 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid"
  1.3288 +                SDLMAIN_SOURCES="$srcdir/src/main/android/*.c"
  1.3289 +
  1.3290 +                if test x$enable_video = xyes; then
  1.3291 +                    SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
  1.3292 +                    # FIXME: confdefs? Not AC_DEFINE?
  1.3293 +                    $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
  1.3294 +                    SUMMARY_video="${SUMMARY_video} android"
  1.3295 +                fi
  1.3296 +                ;;
  1.3297 +            *-*-linux*)         ARCH=linux ;;
  1.3298 +            *-*-uclinux*)       ARCH=linux ;;
  1.3299 +            *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  1.3300 +            *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  1.3301 +            *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  1.3302 +            *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  1.3303 +            *-*-bsdi*)          ARCH=bsdi ;;
  1.3304 +            *-*-freebsd*)       ARCH=freebsd ;;
  1.3305 +            *-*-dragonfly*)     ARCH=freebsd ;;
  1.3306 +            *-*-netbsd*)        ARCH=netbsd ;;
  1.3307 +            *-*-openbsd*)       ARCH=openbsd ;;
  1.3308 +            *-*-sysv5*)         ARCH=sysv5 ;;
  1.3309 +            *-*-solaris*)       ARCH=solaris ;;
  1.3310 +            *-*-hpux*)          ARCH=hpux ;;
  1.3311 +            *-*-aix*)           ARCH=aix ;;
  1.3312 +            *-*-minix*)         ARCH=minix ;;
  1.3313 +            *-*-nto*)           ARCH=nto
  1.3314 +                CheckQNXVideo
  1.3315 +                ;;
  1.3316 +        esac
  1.3317 +        CheckVisibilityHidden
  1.3318 +        CheckDeclarationAfterStatement
  1.3319 +        CheckDummyVideo
  1.3320 +        CheckDiskAudio
  1.3321 +        CheckDummyAudio
  1.3322 +        CheckDLOPEN
  1.3323 +        CheckOSS
  1.3324 +        CheckALSA
  1.3325 +        CheckPulseAudio
  1.3326 +        CheckJACK
  1.3327 +        CheckARTSC
  1.3328 +        CheckESD
  1.3329 +        CheckNAS
  1.3330 +        CheckSNDIO
  1.3331 +        CheckFusionSound
  1.3332 +        CheckLibSampleRate
  1.3333 +        # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
  1.3334 +        CheckRPI
  1.3335 +        CheckX11
  1.3336 +        CheckDirectFB
  1.3337 +        CheckKMSDRM
  1.3338 +        CheckOpenGLX11
  1.3339 +        CheckOpenGLESX11
  1.3340 +        CheckVulkan
  1.3341 +        CheckWayland
  1.3342 +        CheckLibUDev
  1.3343 +        CheckDBus
  1.3344 +        CheckIME
  1.3345 +        CheckIBus
  1.3346 +        CheckFcitx
  1.3347 +        case $ARCH in
  1.3348 +          linux)
  1.3349 +              CheckInputEvents
  1.3350 +              CheckInputKD
  1.3351 +          ;;
  1.3352 +        esac
  1.3353 +        CheckTslib
  1.3354 +        CheckUSBHID
  1.3355 +        CheckHIDAPI
  1.3356 +        CheckPTHREAD
  1.3357 +        CheckClockGettime
  1.3358 +        CheckLinuxVersion
  1.3359 +        CheckRPATH
  1.3360 +        CheckVivanteVideo
  1.3361 +
  1.3362 +        # Set up files for the audio library
  1.3363 +        if test x$enable_audio = xyes; then
  1.3364 +          case $ARCH in
  1.3365 +            sysv5|solaris|hpux)
  1.3366 +                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
  1.3367 +                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  1.3368 +                SUMMARY_audio="${SUMMARY_audio} sun"
  1.3369 +                have_audio=yes
  1.3370 +            ;;
  1.3371 +            netbsd)  # Don't use this on OpenBSD, it's busted.
  1.3372 +                AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ])
  1.3373 +                SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c"
  1.3374 +                SUMMARY_audio="${SUMMARY_audio} netbsd"
  1.3375 +                have_audio=yes
  1.3376 +            ;;
  1.3377 +            aix)
  1.3378 +                AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
  1.3379 +                SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  1.3380 +                SUMMARY_audio="${SUMMARY_audio} paudio"
  1.3381 +                have_audio=yes
  1.3382 +            ;;
  1.3383 +            android)
  1.3384 +                AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
  1.3385 +                SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
  1.3386 +                SUMMARY_audio="${SUMMARY_audio} android"
  1.3387 +                have_audio=yes
  1.3388 +            ;;
  1.3389 +            nto)
  1.3390 +                CheckQNXAudio
  1.3391 +            ;;
  1.3392 +          esac
  1.3393 +        fi
  1.3394 +        # Set up files for the joystick library
  1.3395 +        if test x$enable_joystick = xyes; then
  1.3396 +          case $ARCH in
  1.3397 +            linux)
  1.3398 +                AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
  1.3399 +                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  1.3400 +                SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  1.3401 +                have_joystick=yes
  1.3402 +            ;;
  1.3403 +            android)
  1.3404 +                AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ])
  1.3405 +                SOURCES="$SOURCES $srcdir/src/joystick/android/*.c"
  1.3406 +                SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  1.3407 +                have_joystick=yes
  1.3408 +            ;;
  1.3409 +          esac
  1.3410 +        fi
  1.3411 +        # Set up files for the haptic library
  1.3412 +        if test x$enable_haptic = xyes; then
  1.3413 +          case $ARCH in
  1.3414 +            linux)
  1.3415 +                if test x$use_input_events = xyes; then
  1.3416 +                    AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
  1.3417 +                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  1.3418 +                    have_haptic=yes
  1.3419 +                fi
  1.3420 +            ;;
  1.3421 +            android)
  1.3422 +                AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ])
  1.3423 +                SOURCES="$SOURCES $srcdir/src/haptic/android/*.c"
  1.3424 +                have_haptic=yes
  1.3425 +            ;;
  1.3426 +          esac
  1.3427 +        fi
  1.3428 +        # Set up files for the sensor library
  1.3429 +        if test x$enable_sensor = xyes; then
  1.3430 +          case $ARCH in
  1.3431 +            android)
  1.3432 +                AC_DEFINE(SDL_SENSOR_ANDROID, 1, [ ])
  1.3433 +                SOURCES="$SOURCES $srcdir/src/sensor/android/*.c"
  1.3434 +                have_sensor=yes
  1.3435 +            ;;
  1.3436 +          esac
  1.3437 +        fi
  1.3438 +        # Set up files for the power library
  1.3439 +        if test x$enable_power = xyes; then
  1.3440 +             case $ARCH in
  1.3441 +               linux)
  1.3442 +                   AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
  1.3443 +                   SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  1.3444 +                   have_power=yes
  1.3445 +               ;;
  1.3446 +               android)
  1.3447 +                   AC_DEFINE(SDL_POWER_ANDROID, 1, [ ])
  1.3448 +                   SOURCES="$SOURCES $srcdir/src/power/android/*.c"
  1.3449 +                   have_power=yes
  1.3450 +               ;;
  1.3451 +             esac
  1.3452 +        fi
  1.3453 +        # Set up files for the filesystem library
  1.3454 +        if test x$enable_filesystem = xyes; then
  1.3455 +             case $ARCH in
  1.3456 +               android)
  1.3457 +                   AC_DEFINE(SDL_FILESYSTEM_ANDROID, 1, [ ])
  1.3458 +                   SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c"
  1.3459 +                   have_filesystem=yes
  1.3460 +               ;;
  1.3461 +               *)
  1.3462 +                   AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
  1.3463 +                   SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
  1.3464 +                   have_filesystem=yes
  1.3465 +               ;;
  1.3466 +             esac
  1.3467 +        fi
  1.3468 +        # Set up files for the timer library
  1.3469 +        if test x$enable_timers = xyes; then
  1.3470 +            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  1.3471 +            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  1.3472 +            have_timers=yes
  1.3473 +        fi
  1.3474 +        # Set up files for udev hotplugging support
  1.3475 +        if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
  1.3476 +            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"               
  1.3477 +        fi
  1.3478 +        # Set up files for evdev input
  1.3479 +        if test x$use_input_events = xyes; then
  1.3480 +            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c"
  1.3481 +        fi       
  1.3482 +        # Set up other core UNIX files
  1.3483 +        SOURCES="$SOURCES $srcdir/src/core/linux/SDL_threadprio.c"
  1.3484 +        SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  1.3485 +        ;;
  1.3486 +    *-*-cygwin* | *-*-mingw32*)
  1.3487 +        ARCH=win32
  1.3488 +        if test "$build" != "$host"; then # cross-compiling
  1.3489 +            # Default cross-compile location
  1.3490 +            ac_default_prefix=/usr/local/cross-tools/$host
  1.3491 +        else
  1.3492 +            # Look for the location of the tools and install there
  1.3493 +            if test "$BUILD_PREFIX" != ""; then
  1.3494 +                ac_default_prefix=$BUILD_PREFIX
  1.3495 +            fi
  1.3496 +        fi
  1.3497 +        CheckDeclarationAfterStatement
  1.3498 +        CheckDummyVideo
  1.3499 +        CheckDiskAudio
  1.3500 +        CheckDummyAudio
  1.3501 +        CheckWINDOWS
  1.3502 +        CheckWINDOWSGL
  1.3503 +        CheckWINDOWSGLES
  1.3504 +        CheckVulkan
  1.3505 +        CheckDIRECTX
  1.3506 +
  1.3507 +        # Set up the core platform files
  1.3508 +        SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  1.3509 +
  1.3510 +        # Set up files for the video library
  1.3511 +        if test x$enable_video = xyes; then
  1.3512 +            AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
  1.3513 +            SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  1.3514 +            have_video=yes
  1.3515 +            AC_ARG_ENABLE(render-d3d,
  1.3516 +AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  1.3517 +                                , enable_render_d3d=yes)
  1.3518 +            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  1.3519 +                AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
  1.3520 +            fi
  1.3521 +            if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then
  1.3522 +                AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ])
  1.3523 +            fi
  1.3524 +        fi
  1.3525 +        # Set up files for the audio library
  1.3526 +        if test x$enable_audio = xyes; then
  1.3527 +            AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
  1.3528 +            SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
  1.3529 +            if test x$have_dsound = xyes; then
  1.3530 +                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
  1.3531 +                SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
  1.3532 +            fi
  1.3533 +            if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then
  1.3534 +                AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
  1.3535 +                SUMMARY_audio="${SUMMARY_audio} wasapi"
  1.3536 +                SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
  1.3537 +            fi
  1.3538 +            have_audio=yes
  1.3539 +        fi
  1.3540 +        # Set up files for the joystick library
  1.3541 +        if test x$enable_joystick = xyes; then
  1.3542 +            if test x$have_dinput = xyes -o x$have_xinput = xyes; then
  1.3543 +                if test x$have_xinput = xyes; then
  1.3544 +                    AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ])
  1.3545 +                fi
  1.3546 +                if test x$have_dinput = xyes; then
  1.3547 +                    AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
  1.3548 +                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  1.3549 +                fi
  1.3550 +            else
  1.3551 +                AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
  1.3552 +            fi
  1.3553 +            AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  1.3554 +            SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
  1.3555 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  1.3556 +            SOURCES="$SOURCES $srcdir/src/hidapi/windows/hid.c"
  1.3557 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
  1.3558 +            have_joystick=yes
  1.3559 +        fi
  1.3560 +        if test x$enable_haptic = xyes; then
  1.3561 +            if test x$have_dinput = xyes -o x$have_xinput = xyes; then
  1.3562 +                if test x$have_xinput = xyes; then
  1.3563 +                    AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ])
  1.3564 +                fi
  1.3565 +                if test x$have_dinput = xyes; then
  1.3566 +                    AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
  1.3567 +                fi
  1.3568 +                SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
  1.3569 +                have_haptic=yes
  1.3570 +            fi
  1.3571 +        fi
  1.3572 +        if test x$enable_power = xyes; then
  1.3573 +            AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
  1.3574 +            SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  1.3575 +            have_power=yes
  1.3576 +        fi
  1.3577 +        if test x$enable_filesystem = xyes; then
  1.3578 +            AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
  1.3579 +            SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
  1.3580 +            have_filesystem=yes
  1.3581 +        fi
  1.3582 +        # Set up files for the thread library
  1.3583 +        if test x$enable_threads = xyes; then
  1.3584 +            AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
  1.3585 +            SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
  1.3586 +            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  1.3587 +            have_threads=yes
  1.3588 +        fi
  1.3589 +        # Set up files for the timer library
  1.3590 +        if test x$enable_timers = xyes; then
  1.3591 +            AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
  1.3592 +            SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  1.3593 +            have_timers=yes
  1.3594 +        fi
  1.3595 +        # Set up files for the shared object loading library
  1.3596 +        if test x$enable_loadso = xyes; then
  1.3597 +            AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
  1.3598 +            SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  1.3599 +            have_loadso=yes
  1.3600 +        fi
  1.3601 +        # Set up the system libraries we need
  1.3602 +        if test -f /lib/w32api/libuuid.a; then
  1.3603 +            LIBUUID=/lib/w32api/libuuid.a
  1.3604 +        else
  1.3605 +            LIBUUID=-luuid
  1.3606 +        fi
  1.3607 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID -static-libgcc"
  1.3608 +        # The Windows platform requires special setup
  1.3609 +        VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  1.3610 +        SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  1.3611 +        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  1.3612 +        SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
  1.3613 +
  1.3614 +        # Check to see if this is a mingw or cygwin build
  1.3615 +        have_mingw32=
  1.3616 +        AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
  1.3617 +        if test x$have_mingw32 = xyes; then
  1.3618 +            SDL_LIBS="-lmingw32 $SDL_LIBS"
  1.3619 +        else
  1.3620 +            SDL_LIBS="-lcygwin $SDL_LIBS"
  1.3621 +        fi
  1.3622 +        ;;
  1.3623 +
  1.3624 +    dnl BeOS support removed after SDL 2.0.1. Haiku still works.  --ryan.
  1.3625 +    *-*-beos*)
  1.3626 +        AC_MSG_ERROR([
  1.3627 +*** BeOS support has been removed as of SDL 2.0.2.
  1.3628 +        ])
  1.3629 +        ;;
  1.3630 +
  1.3631 +    *-*-haiku*)
  1.3632 +        ARCH=haiku
  1.3633 +        ac_default_prefix=/boot/system
  1.3634 +        CheckDummyVideo
  1.3635 +        CheckDiskAudio
  1.3636 +        CheckDummyAudio
  1.3637 +        CheckDLOPEN
  1.3638 +        CheckHaikuVideo
  1.3639 +        CheckHaikuGL
  1.3640 +        CheckPTHREAD
  1.3641 +
  1.3642 +        # Set up files for the audio library
  1.3643 +        if test x$enable_audio = xyes; then
  1.3644 +            AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
  1.3645 +            SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
  1.3646 +            SUMMARY_audio="${SUMMARY_audio} haiku"
  1.3647 +            have_audio=yes
  1.3648 +        fi
  1.3649 +        # Set up files for the joystick library
  1.3650 +        if test x$enable_joystick = xyes; then
  1.3651 +            AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
  1.3652 +            SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
  1.3653 +            have_joystick=yes
  1.3654 +        fi
  1.3655 +        # Set up files for the timer library
  1.3656 +        if test x$enable_timers = xyes; then
  1.3657 +            AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
  1.3658 +            SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
  1.3659 +            have_timers=yes
  1.3660 +        fi
  1.3661 +        # Set up files for the system power library
  1.3662 +        if test x$enable_power = xyes; then
  1.3663 +            AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
  1.3664 +            SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
  1.3665 +            have_power=yes
  1.3666 +        fi
  1.3667 +        # Set up files for the system filesystem library
  1.3668 +        if test x$enable_filesystem = xyes; then
  1.3669 +            AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
  1.3670 +            SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
  1.3671 +            have_filesystem=yes
  1.3672 +        fi
  1.3673 +        # The Haiku platform requires special setup.
  1.3674 +        SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
  1.3675 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  1.3676 +        # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but
  1.3677 +        #  other spins, like x86-64, use a more standard "libstdc++.so.*"
  1.3678 +        AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++")
  1.3679 +        ;;
  1.3680 +    arm*-apple-darwin*|*-ios-*)
  1.3681 +        ARCH=ios
  1.3682 +
  1.3683 +        CheckVisibilityHidden
  1.3684 +        CheckDeclarationAfterStatement
  1.3685 +        CheckDummyVideo
  1.3686 +        CheckDiskAudio
  1.3687 +        CheckDummyAudio
  1.3688 +        CheckDLOPEN
  1.3689 +        CheckMETAL
  1.3690 +        CheckVulkan
  1.3691 +        CheckPTHREAD
  1.3692 +
  1.3693 +        # Set up files for the audio library
  1.3694 +        if test x$enable_audio = xyes; then
  1.3695 +            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  1.3696 +            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
  1.3697 +            SUMMARY_audio="${SUMMARY_audio} coreaudio"
  1.3698 +            have_audio=yes
  1.3699 +        fi
  1.3700 +        # Set up files for the joystick library
  1.3701 +        if test x$enable_joystick = xyes; then
  1.3702 +            AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
  1.3703 +            SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  1.3704 +            SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  1.3705 +            have_joystick=yes
  1.3706 +        fi
  1.3707 +        # Set up files for the haptic library
  1.3708 +        #if test x$enable_haptic = xyes; then
  1.3709 +        #    SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  1.3710 +        #    have_haptic=yes
  1.3711 +        #    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  1.3712 +        #fi
  1.3713 +        # Set up files for the power library
  1.3714 +        if test x$enable_power = xyes; then
  1.3715 +            AC_DEFINE(SDL_POWER_UIKIT, 1, [ ])
  1.3716 +            SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
  1.3717 +            have_power=yes
  1.3718 +        fi
  1.3719 +        # Set up files for the filesystem library
  1.3720 +        if test x$enable_filesystem = xyes; then
  1.3721 +            SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  1.3722 +            have_filesystem=yes
  1.3723 +        fi
  1.3724 +        # Set up additional files for the file library
  1.3725 +        if test x$enable_file = xyes; then
  1.3726 +            AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  1.3727 +            SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  1.3728 +        fi
  1.3729 +        # Set up files for the timer library
  1.3730 +        if test x$enable_timers = xyes; then
  1.3731 +            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  1.3732 +            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  1.3733 +            have_timers=yes
  1.3734 +        fi
  1.3735 +        # Set up other core UNIX files
  1.3736 +        SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  1.3737 +        # The iOS platform requires special setup.
  1.3738 +        AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ])
  1.3739 +        AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1.3740 +        AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  1.3741 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  1.3742 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1.3743 +        SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
  1.3744 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
  1.3745 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
  1.3746 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
  1.3747 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
  1.3748 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
  1.3749 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
  1.3750 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
  1.3751 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
  1.3752 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
  1.3753 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
  1.3754 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
  1.3755 +
  1.3756 +        if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
  1.3757 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
  1.3758 +        fi
  1.3759 +        ;;
  1.3760 +    *-*-darwin* )
  1.3761 +        # This could be either full "Mac OS X", or plain "Darwin" which is
  1.3762 +        # just the OS X kernel sans upper layers like Carbon and Cocoa.
  1.3763 +        # Next line is broken, and a few files below require Mac OS X (full)
  1.3764 +        ARCH=macosx
  1.3765 +
  1.3766 +        # Mac OS X builds with both the Carbon and OSX APIs at the moment
  1.3767 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  1.3768 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  1.3769 +
  1.3770 +        CheckVisibilityHidden
  1.3771 +        CheckDeclarationAfterStatement
  1.3772 +        CheckDummyVideo
  1.3773 +        CheckDiskAudio
  1.3774 +        CheckDummyAudio
  1.3775 +        CheckDLOPEN
  1.3776 +        CheckCOCOA
  1.3777 +        CheckMETAL
  1.3778 +        CheckX11
  1.3779 +        CheckMacGL
  1.3780 +        CheckMacGLES
  1.3781 +        CheckOpenGLX11
  1.3782 +        CheckVulkan
  1.3783 +        CheckPTHREAD
  1.3784 +
  1.3785 +        # Set up files for the audio library
  1.3786 +        if test x$enable_audio = xyes; then
  1.3787 +            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  1.3788 +            SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
  1.3789 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox"
  1.3790 +            SUMMARY_audio="${SUMMARY_audio} coreaudio"
  1.3791 +            have_audio=yes
  1.3792 +        fi
  1.3793 +        # Set up files for the joystick library
  1.3794 +        if test x$enable_joystick = xyes; then
  1.3795 +            AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  1.3796 +            AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  1.3797 +            SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  1.3798 +            SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  1.3799 +            SOURCES="$SOURCES $srcdir/src/hidapi/mac/hid.c"
  1.3800 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -I$srcdir/src/hidapi/hidapi"
  1.3801 +            have_joystick=yes
  1.3802 +        fi
  1.3803 +        # Set up files for the haptic library
  1.3804 +        if test x$enable_haptic = xyes; then
  1.3805 +            AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  1.3806 +            SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  1.3807 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  1.3808 +            have_haptic=yes
  1.3809 +        fi
  1.3810 +        # Set up files for the power library
  1.3811 +        if test x$enable_power = xyes; then
  1.3812 +            AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
  1.3813 +            SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  1.3814 +            have_power=yes
  1.3815 +        fi
  1.3816 +        # Set up files for the filesystem library
  1.3817 +        if test x$enable_filesystem = xyes; then
  1.3818 +            AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  1.3819 +            SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  1.3820 +            have_filesystem=yes
  1.3821 +        fi
  1.3822 +        # Set up files for the timer library
  1.3823 +        if test x$enable_timers = xyes; then
  1.3824 +            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  1.3825 +            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  1.3826 +            have_timers=yes
  1.3827 +        fi
  1.3828 +        # Set up additional files for the file library
  1.3829 +        if test x$enable_file = xyes; then
  1.3830 +            SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  1.3831 +        fi
  1.3832 +        # Set up other core UNIX files
  1.3833 +        SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  1.3834 +        # The Mac OS X platform requires special setup.
  1.3835 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  1.3836 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo"
  1.3837 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  1.3838 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  1.3839 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  1.3840 +
  1.3841 +        if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
  1.3842 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
  1.3843 +        fi
  1.3844 +        ;;
  1.3845 +    *-nacl|*-pnacl)
  1.3846 +        ARCH=nacl
  1.3847 +        CheckNativeClient
  1.3848 +        CheckDummyAudio
  1.3849 +        CheckDummyVideo
  1.3850 +        CheckInputEvents
  1.3851 +        CheckPTHREAD
  1.3852 +
  1.3853 +        # Set up files for the timer library
  1.3854 +        if test x$enable_timers = xyes; then
  1.3855 +            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  1.3856 +            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  1.3857 +            have_timers=yes
  1.3858 +        fi
  1.3859 +        
  1.3860 +        if test x$enable_filesystem = xyes; then
  1.3861 +            AC_DEFINE(SDL_FILESYSTEM_NACL, 1, [ ])
  1.3862 +            SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c"
  1.3863 +            have_filesystem=yes
  1.3864 +        fi
  1.3865 +        ;;
  1.3866 +    *-*-emscripten* )
  1.3867 +        if test x$enable_video = xyes; then
  1.3868 +            AC_DEFINE(SDL_VIDEO_DRIVER_EMSCRIPTEN, 1, [ ])
  1.3869 +            SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c"
  1.3870 +            have_video=yes
  1.3871 +            SUMMARY_video="${SUMMARY_video} emscripten"
  1.3872 +        fi
  1.3873 +
  1.3874 +        if test x$enable_audio = xyes; then
  1.3875 +            AC_DEFINE(SDL_AUDIO_DRIVER_EMSCRIPTEN, 1, [ ])
  1.3876 +            SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c"
  1.3877 +            have_audio=yes
  1.3878 +            SUMMARY_audio="${SUMMARY_audio} emscripten"
  1.3879 +        fi
  1.3880 +
  1.3881 +        CheckVisibilityHidden
  1.3882 +        CheckDeclarationAfterStatement
  1.3883 +        CheckDummyVideo
  1.3884 +        CheckDiskAudio
  1.3885 +        CheckDummyAudio
  1.3886 +        CheckDLOPEN
  1.3887 +        CheckClockGettime
  1.3888 +        CheckEmscriptenGLES
  1.3889 +
  1.3890 +         # Set up files for the power library
  1.3891 +        if test x$enable_power = xyes; then
  1.3892 +            AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ])
  1.3893 +            SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c"
  1.3894 +            have_power=yes
  1.3895 +        fi
  1.3896 +        
  1.3897 +        # Set up files for the power library
  1.3898 +        if test x$enable_joystick = xyes; then
  1.3899 +            AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ])
  1.3900 +            SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c"
  1.3901 +            have_joystick=yes
  1.3902 +        fi
  1.3903 +
  1.3904 +        # Set up files for the filesystem library
  1.3905 +        if test x$enable_filesystem = xyes; then
  1.3906 +            AC_DEFINE(SDL_FILESYSTEM_EMSCRIPTEN, 1, [ ])
  1.3907 +            SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c"
  1.3908 +            have_filesystem=yes
  1.3909 +        fi
  1.3910 +        # Set up files for the timer library
  1.3911 +        if test x$enable_timers = xyes; then
  1.3912 +            AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  1.3913 +            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  1.3914 +            have_timers=yes
  1.3915 +        fi
  1.3916 +        ;;
  1.3917 +    *)
  1.3918 +        AC_MSG_ERROR([
  1.3919 +*** Unsupported host:  Please add to configure.ac
  1.3920 +        ])
  1.3921 +        ;;
  1.3922 +esac
  1.3923 +
  1.3924 +# Verify that we have all the platform specific files we need
  1.3925 +
  1.3926 +if test x$have_joystick != xyes; then
  1.3927 +    if test x$enable_joystick = xyes; then
  1.3928 +        AC_DEFINE(SDL_JOYSTICK_DUMMY, 1, [ ])
  1.3929 +    fi
  1.3930 +    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  1.3931 +fi
  1.3932 +if test x$have_haptic != xyes; then
  1.3933 +    if test x$enable_haptic = xyes; then
  1.3934 +        AC_DEFINE(SDL_HAPTIC_DUMMY, 1, [ ])
  1.3935 +    fi
  1.3936 +    SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  1.3937 +fi
  1.3938 +if test x$have_sensor != xyes; then
  1.3939 +    if test x$enable_sensor = xyes; then
  1.3940 +        AC_DEFINE(SDL_SENSOR_DUMMY, 1, [ ])
  1.3941 +    fi
  1.3942 +    SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c"
  1.3943 +fi
  1.3944 +if test x$have_threads != xyes; then
  1.3945 +    if test x$enable_threads = xyes; then
  1.3946 +        AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  1.3947 +    fi
  1.3948 +    SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  1.3949 +fi
  1.3950 +if test x$have_timers != xyes; then
  1.3951 +    if test x$enable_timers = xyes; then
  1.3952 +        AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
  1.3953 +    fi
  1.3954 +    SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  1.3955 +fi
  1.3956 +if test x$have_filesystem != xyes; then
  1.3957 +    if test x$enable_filesystem = xyes; then
  1.3958 +        AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
  1.3959 +    fi
  1.3960 +    SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
  1.3961 +fi
  1.3962 +if test x$have_loadso != xyes; then
  1.3963 +    if test x$enable_loadso = xyes; then
  1.3964 +        AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
  1.3965 +    fi
  1.3966 +    SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  1.3967 +fi
  1.3968 +if test x$SDLMAIN_SOURCES = x; then
  1.3969 +    SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  1.3970 +fi
  1.3971 +SDLTEST_SOURCES="$srcdir/src/test/*.c"
  1.3972 +
  1.3973 +if test x$video_wayland = xyes; then
  1.3974 +    WAYLAND_PROTOCOLS=`cd $srcdir/wayland-protocols ; for p in *.xml ; do echo -n "\$p" |sed 's,\\.xml\$, ,g' ; done`
  1.3975 +    WAYLAND_PROTOCOLS_SOURCES=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-protocol.c " ; done`
  1.3976 +    WAYLAND_PROTOCOLS_HEADERS=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-client-protocol.h " ; done`
  1.3977 +    GEN_SOURCES="$GEN_SOURCES $WAYLAND_PROTOCOLS_SOURCES"
  1.3978 +    GEN_HEADERS="$GEN_HEADERS $WAYLAND_PROTOCOLS_HEADERS"
  1.3979 +
  1.3980 +    WAYLAND_PROTOCOLS_DEPENDS=`for p in $WAYLAND_PROTOCOLS ; do\
  1.3981 +        echo ;\
  1.3982 +        echo "\\$(gen)/\$p-client-protocol.h: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
  1.3983 +        echo "	@\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
  1.3984 +        echo "	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@" ;\
  1.3985 +        echo ;\
  1.3986 +        echo "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
  1.3987 +        echo "	@\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
  1.3988 +        echo "	\\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@" ;\
  1.3989 +        echo ;\
  1.3990 +        echo "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\
  1.3991 +        echo "	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\
  1.3992 +        done ;\
  1.3993 +        echo ;\
  1.3994 +        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`
  1.3995 +fi
  1.3996 +
  1.3997 +OBJECTS=`echo $SOURCES`
  1.3998 +DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  1.3999 +for EXT in asm cc m c S; do
  1.4000 +    OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  1.4001 +    DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  1.4002 +\\$(objects)/\\2.lo: \\1/\\2.$EXT \\$(objects)/.created\\\\
  1.4003 +	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  1.4004 +done
  1.4005 +
  1.4006 +GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  1.4007 +
  1.4008 +VERSION_OBJECTS=`echo $VERSION_SOURCES`
  1.4009 +VERSION_DEPENDS=`echo $VERSION_SOURCES`
  1.4010 +VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  1.4011 +VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  1.4012 +\\$(objects)/\\2.o: \\1/\\2.rc\\\\
  1.4013 +	\\$(WINDRES) \\$< \\$@,g"`
  1.4014 +
  1.4015 +SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  1.4016 +SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  1.4017 +SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  1.4018 +SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  1.4019 +\\$(objects)/\\2.lo: \\1/\\2.c \\$(objects)/.created\\\\
  1.4020 +	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  1.4021 +
  1.4022 +SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
  1.4023 +SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
  1.4024 +SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  1.4025 +SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  1.4026 +\\$(objects)/\\2.lo: \\1/\\2.c \\$(objects)/.created\\\\
  1.4027 +	\\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  1.4028 +
  1.4029 +# Set runtime shared library paths as needed
  1.4030 +
  1.4031 +if test "x$enable_rpath" = "xyes"; then
  1.4032 +  if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
  1.4033 +    SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  1.4034 +
  1.4035 +    AC_MSG_CHECKING(for linker option --enable-new-dtags)
  1.4036 +    have_enable_new_dtags=no
  1.4037 +    save_LDFLAGS="$LDFLAGS"
  1.4038 +    LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
  1.4039 +    AC_TRY_LINK([
  1.4040 +    ],[
  1.4041 +    ],[
  1.4042 +    have_enable_new_dtags=yes
  1.4043 +    SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
  1.4044 +    ])
  1.4045 +    LDFLAGS="$save_LDFLAGS"
  1.4046 +    AC_MSG_RESULT($have_enable_new_dtags)
  1.4047 +  fi
  1.4048 +  if test $ARCH = solaris; then
  1.4049 +    SDL_RLD_FLAGS="-R\${libdir}"
  1.4050 +  fi
  1.4051 +else
  1.4052 +  SDL_RLD_FLAGS=""
  1.4053 +fi
  1.4054 +
  1.4055 +SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  1.4056 +
  1.4057 +dnl Expand the cflags and libraries needed by apps using SDL
  1.4058 +AC_SUBST(SDL_CFLAGS)
  1.4059 +AC_SUBST(SDL_LIBS)
  1.4060 +AC_SUBST(SDL_STATIC_LIBS)
  1.4061 +AC_SUBST(SDL_RLD_FLAGS)
  1.4062 +if test x$enable_shared = xyes; then
  1.4063 +    ENABLE_SHARED_TRUE=
  1.4064 +    ENABLE_SHARED_FALSE="#"
  1.4065 +else
  1.4066 +    ENABLE_SHARED_TRUE="#"
  1.4067 +    ENABLE_SHARED_FALSE=
  1.4068 +fi
  1.4069 +if test x$enable_static = xyes; then
  1.4070 +    ENABLE_STATIC_TRUE=
  1.4071 +    ENABLE_STATIC_FALSE="#"
  1.4072 +else
  1.4073 +    ENABLE_STATIC_TRUE="#"
  1.4074 +    ENABLE_STATIC_FALSE=
  1.4075 +fi
  1.4076 +AC_SUBST(ENABLE_SHARED_TRUE)
  1.4077 +AC_SUBST(ENABLE_SHARED_FALSE)
  1.4078 +AC_SUBST(ENABLE_STATIC_TRUE)
  1.4079 +AC_SUBST(ENABLE_STATIC_FALSE)
  1.4080 +
  1.4081 +dnl Expand the sources and objects needed to build the library
  1.4082 +AC_SUBST(ac_aux_dir)
  1.4083 +AC_SUBST(INCLUDE)
  1.4084 +AC_SUBST(OBJECTS)
  1.4085 +AC_SUBST(GEN_HEADERS)
  1.4086 +AC_SUBST(GEN_OBJECTS)
  1.4087 +AC_SUBST(VERSION_OBJECTS)
  1.4088 +AC_SUBST(SDLMAIN_OBJECTS)
  1.4089 +AC_SUBST(SDLTEST_OBJECTS)
  1.4090 +AC_SUBST(BUILD_CFLAGS)
  1.4091 +AC_SUBST(EXTRA_CFLAGS)
  1.4092 +AC_SUBST(BUILD_LDFLAGS)
  1.4093 +AC_SUBST(EXTRA_LDFLAGS)
  1.4094 +AC_SUBST(WINDRES)
  1.4095 +AC_SUBST(WAYLAND_SCANNER)
  1.4096 +
  1.4097 +cat >Makefile.rules <<__EOF__
  1.4098 +
  1.4099 +# Build rules for objects
  1.4100 +-include \$(OBJECTS:.lo=.d)
  1.4101 +
  1.4102 +# Special dependency for SDL.c, since it depends on SDL_revision.h
  1.4103 +$srcdir/src/SDL.c: update-revision
  1.4104 +$DEPENDS
  1.4105 +$VERSION_DEPENDS
  1.4106 +$SDLMAIN_DEPENDS
  1.4107 +$SDLTEST_DEPENDS
  1.4108 +$WAYLAND_PROTOCOLS_DEPENDS
  1.4109 +__EOF__
  1.4110 +
  1.4111 +AC_CONFIG_FILES([
  1.4112 +    Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc
  1.4113 +])
  1.4114 +AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])
  1.4115 +
  1.4116 +SUMMARY="SDL2 Configure Summary:\n"
  1.4117 +if test x$enable_shared = xyes; then
  1.4118 +    SUMMARY="${SUMMARY}Building Shared Libraries\n"
  1.4119 +fi
  1.4120 +if test x$enable_static = xyes; then
  1.4121 +    SUMMARY="${SUMMARY}Building Static Libraries\n"
  1.4122 +fi
  1.4123 +SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n"
  1.4124 +SUMMARY="${SUMMARY}Assembly Math   :${SUMMARY_math}\n" 
  1.4125 +SUMMARY="${SUMMARY}Audio drivers   :${SUMMARY_audio}\n"
  1.4126 +SUMMARY="${SUMMARY}Video drivers   :${SUMMARY_video}\n"
  1.4127 +if test x$have_x = xyes; then
  1.4128 +    SUMMARY="${SUMMARY}X11 libraries   :${SUMMARY_video_x11}\n"
  1.4129 +fi
  1.4130 +SUMMARY="${SUMMARY}Input drivers   :${SUMMARY_input}\n"
  1.4131 +if test x$have_samplerate_h_hdr = xyes; then
  1.4132 +    SUMMARY="${SUMMARY}Using libsamplerate : YES\n"
  1.4133 +else
  1.4134 +    SUMMARY="${SUMMARY}Using libsamplerate : NO\n"
  1.4135 +fi
  1.4136 +if test x$have_libudev_h_hdr = xyes; then
  1.4137 +    SUMMARY="${SUMMARY}Using libudev       : YES\n"
  1.4138 +else
  1.4139 +    SUMMARY="${SUMMARY}Using libudev       : NO\n"
  1.4140 +fi
  1.4141 +if test x$have_dbus_dbus_h_hdr = xyes; then
  1.4142 +    SUMMARY="${SUMMARY}Using dbus          : YES\n"
  1.4143 +else
  1.4144 +    SUMMARY="${SUMMARY}Using dbus          : NO\n"
  1.4145 +fi
  1.4146 +if test x$enable_ime = xyes; then
  1.4147 +    SUMMARY="${SUMMARY}Using ime           : YES\n"
  1.4148 +else
  1.4149 +    SUMMARY="${SUMMARY}Using ime           : NO\n"
  1.4150 +fi
  1.4151 +if test x$have_ibus_ibus_h_hdr = xyes; then
  1.4152 +    SUMMARY="${SUMMARY}Using ibus          : YES\n"
  1.4153 +else
  1.4154 +    SUMMARY="${SUMMARY}Using ibus          : NO\n"
  1.4155 +fi
  1.4156 +if test x$have_fcitx_frontend_h_hdr = xyes; then
  1.4157 +    SUMMARY="${SUMMARY}Using fcitx         : YES\n"
  1.4158 +else
  1.4159 +    SUMMARY="${SUMMARY}Using fcitx         : NO\n"
  1.4160 +fi
  1.4161 +AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])
  1.4162 +
  1.4163 +AC_OUTPUT