configure.ac
author Ryan C. Gordon
Wed, 01 Apr 2020 13:43:53 -0400
changeset 13684 aecf8c5a136a
parent 13657 3c2eaf481522
child 13702 1463104b6302
permissions -rw-r--r--
configure: Remove wayland-protocols check from configure and CMake scripts.

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