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