configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 10 Jul 2017 18:31:28 -0700
changeset 11138 c936a84f05ba
parent 11131 afa5670fa967
child 11175 cbc6a8a5b701
permissions -rw-r--r--
Fixed bug 3609 - Windows build fails due to conflicting types for 'XINPUT_GAMEPAD_EX'

Ozkan Sezer

(In reply to Ryan C. Gordon from comment #9)
> I've put this patch in as https://hg.libsdl.org/SDL/rev/117d4ce1390e ...can
> you verify this works on the latest MinGW?
>
> Thanks,
> --ryan.


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