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