configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 23 Dec 2013 17:15:32 -0800
changeset 8070 c0cedfd0c45e
parent 8062 4fc5f66d63cc
child 8082 5b83ad3f01ac
permissions -rw-r--r--
Fixed float to int conversion warning, which was a legitimate bug.
     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=1
    24 SDL_INTERFACE_AGE=0
    25 SDL_BINARY_AGE=1
    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 $gcc_bin_path $gcc_lib_path $env_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 sscanf snprintf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
   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)
   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/events/*.c"
   330 SOURCES="$SOURCES $srcdir/src/file/*.c"
   331 SOURCES="$SOURCES $srcdir/src/haptic/*.c"
   332 SOURCES="$SOURCES $srcdir/src/joystick/*.c"
   333 SOURCES="$SOURCES $srcdir/src/libm/*.c"
   334 SOURCES="$SOURCES $srcdir/src/power/*.c"
   335 #SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
   336 SOURCES="$SOURCES $srcdir/src/render/*.c"
   337 SOURCES="$SOURCES $srcdir/src/render/*/*.c"
   338 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
   339 SOURCES="$SOURCES $srcdir/src/thread/*.c"
   340 SOURCES="$SOURCES $srcdir/src/timer/*.c"
   341 SOURCES="$SOURCES $srcdir/src/video/*.c"
   342 
   343 dnl Enable/disable various subsystems of the SDL library
   344 
   345 AC_ARG_ENABLE(atomic,
   346 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
   347               , enable_atomic=yes)
   348 if test x$enable_atomic != xyes; then
   349     AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
   350 fi
   351 AC_ARG_ENABLE(audio,
   352 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
   353               , enable_audio=yes)
   354 if test x$enable_audio != xyes; then
   355     AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
   356 fi
   357 AC_ARG_ENABLE(video,
   358 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
   359               , enable_video=yes)
   360 if test x$enable_video != xyes; then
   361     AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
   362 fi
   363 AC_ARG_ENABLE(render,
   364 AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
   365               , enable_render=yes)
   366 if test x$enable_render != xyes; then
   367     AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
   368 fi
   369 AC_ARG_ENABLE(events,
   370 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
   371               , enable_events=yes)
   372 if test x$enable_events != xyes; then
   373     AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
   374 fi
   375 AC_ARG_ENABLE(joystick,
   376 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
   377               , enable_joystick=yes)
   378 if test x$enable_joystick != xyes; then
   379     AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
   380 fi
   381 AC_ARG_ENABLE(haptic,
   382 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
   383               , enable_haptic=yes)
   384 if test x$enable_haptic != xyes; then
   385     AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
   386 fi
   387 AC_ARG_ENABLE(power,
   388 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
   389               , enable_power=yes)
   390 if test x$enable_power != xyes; then
   391     AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
   392 fi
   393 AC_ARG_ENABLE(filesystem,
   394 AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
   395               , enable_filesystem=yes)
   396 if test x$enable_filesystem != xyes; then
   397     AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
   398 fi
   399 AC_ARG_ENABLE(threads,
   400 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
   401               , enable_threads=yes)
   402 if test x$enable_threads != xyes; then
   403     AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
   404 fi
   405 AC_ARG_ENABLE(timers,
   406 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
   407               , enable_timers=yes)
   408 if test x$enable_timers != xyes; then
   409     AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
   410 fi
   411 AC_ARG_ENABLE(file,
   412 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
   413               , enable_file=yes)
   414 if test x$enable_file != xyes; then
   415     AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
   416 fi
   417 AC_ARG_ENABLE(loadso,
   418 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
   419               , enable_loadso=yes)
   420 if test x$enable_loadso != xyes; then
   421     AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
   422 fi
   423 AC_ARG_ENABLE(cpuinfo,
   424 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
   425               , enable_cpuinfo=yes)
   426 if test x$enable_cpuinfo != xyes; then
   427     AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
   428 fi
   429 AC_ARG_ENABLE(atomic,
   430 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
   431               , enable_atomic=yes)
   432 if test x$enable_atomic != xyes; then
   433     AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
   434 fi
   435 AC_ARG_ENABLE(assembly,
   436 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
   437               , enable_assembly=yes)
   438 if test x$enable_assembly = xyes; then
   439     AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
   440 
   441     # Make sure that we don't generate floating point code that would
   442     # cause illegal instruction exceptions on older processors
   443     case "$host" in
   444         *-*-darwin*)
   445             # Don't need to worry about Apple hardware, it's all SSE capable
   446             default_ssemath=yes
   447             ;;
   448         *64-*-*)
   449             # x86 64-bit architectures all have SSE instructions
   450             default_ssemath=yes
   451             ;;
   452         *)
   453             default_ssemath=no
   454             ;;
   455     esac
   456     AC_ARG_ENABLE(ssemath,
   457 AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
   458                   , enable_ssemath=$default_ssemath)
   459     if test x$enable_ssemath = xno; then
   460         if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
   461             EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
   462         fi
   463     fi
   464 
   465     dnl Check for various instruction support
   466     AC_ARG_ENABLE(mmx,
   467 AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
   468                   , enable_mmx=yes)
   469     if test x$enable_mmx = xyes; then
   470         save_CFLAGS="$CFLAGS"
   471         have_gcc_mmx=no
   472         AC_MSG_CHECKING(for GCC -mmmx option)
   473         mmx_CFLAGS="-mmmx"
   474         CFLAGS="$save_CFLAGS $mmx_CFLAGS"
   475 
   476         AC_TRY_COMPILE([
   477         #ifdef __MINGW32__
   478         #include <_mingw.h>
   479         #ifdef __MINGW64_VERSION_MAJOR
   480         #include <intrin.h>
   481         #else
   482         #include <mmintrin.h>
   483         #endif
   484         #else
   485         #include <mmintrin.h>
   486         #endif
   487         #ifndef __MMX__
   488         #error Assembler CPP flag not enabled
   489         #endif
   490         ],[
   491         ],[
   492         have_gcc_mmx=yes
   493         ])
   494         AC_MSG_RESULT($have_gcc_mmx)
   495         CFLAGS="$save_CFLAGS"
   496 
   497         if test x$have_gcc_mmx = xyes; then
   498             EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
   499         fi
   500     fi
   501 
   502     AC_ARG_ENABLE(3dnow,
   503 AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
   504                   , enable_3dnow=yes)
   505     if test x$enable_3dnow = xyes; then
   506         save_CFLAGS="$CFLAGS"
   507         have_gcc_3dnow=no
   508         AC_MSG_CHECKING(for GCC -m3dnow option)
   509         amd3dnow_CFLAGS="-m3dnow"
   510         CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
   511 
   512         AC_TRY_LINK([
   513         #include <mm3dnow.h>
   514         #ifndef __3dNOW__
   515         #error Assembler CPP flag not enabled
   516         #endif
   517         ],[
   518         void *p = 0;
   519         _m_prefetch(p);
   520         ],[
   521         have_gcc_3dnow=yes
   522         ])
   523         AC_MSG_RESULT($have_gcc_3dnow)
   524         CFLAGS="$save_CFLAGS"
   525 
   526         if test x$have_gcc_3dnow = xyes; then
   527             EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
   528         fi
   529     fi
   530 
   531     AC_ARG_ENABLE(sse,
   532 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
   533                   , enable_sse=yes)
   534     if test x$enable_sse = xyes; then
   535         save_CFLAGS="$CFLAGS"
   536         have_gcc_sse=no
   537         AC_MSG_CHECKING(for GCC -msse option)
   538         sse_CFLAGS="-msse"
   539         CFLAGS="$save_CFLAGS $sse_CFLAGS"
   540 
   541         AC_TRY_COMPILE([
   542         #ifdef __MINGW32__
   543         #include <_mingw.h>
   544         #ifdef __MINGW64_VERSION_MAJOR
   545         #include <intrin.h>
   546         #else
   547         #include <xmmintrin.h>
   548         #endif
   549         #else
   550         #include <xmmintrin.h>
   551         #endif
   552         #ifndef __SSE__
   553         #error Assembler CPP flag not enabled
   554         #endif
   555         ],[
   556         ],[
   557         have_gcc_sse=yes
   558         ])
   559         AC_MSG_RESULT($have_gcc_sse)
   560         CFLAGS="$save_CFLAGS"
   561 
   562         if test x$have_gcc_sse = xyes; then
   563             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
   564         fi
   565     fi
   566 
   567     AC_ARG_ENABLE(sse2,
   568 AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
   569                   , enable_sse2=$default_ssemath)
   570     if test x$enable_sse2 = xyes; then
   571         save_CFLAGS="$CFLAGS"
   572         have_gcc_sse2=no
   573         AC_MSG_CHECKING(for GCC -msse2 option)
   574         sse2_CFLAGS="-msse2"
   575         CFLAGS="$save_CFLAGS $sse2_CFLAGS"
   576 
   577         AC_TRY_COMPILE([
   578         #ifdef __MINGW32__
   579         #include <_mingw.h>
   580         #ifdef __MINGW64_VERSION_MAJOR
   581         #include <intrin.h>
   582         #else
   583         #include <emmintrin.h>
   584         #endif
   585         #else
   586         #include <emmintrin.h>
   587         #endif
   588         #ifndef __SSE2__
   589         #error Assembler CPP flag not enabled
   590         #endif
   591         ],[
   592         ],[
   593         have_gcc_sse2=yes
   594         ])
   595         AC_MSG_RESULT($have_gcc_sse2)
   596         CFLAGS="$save_CFLAGS"
   597 
   598         if test x$have_gcc_sse2 = xyes; then
   599             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
   600         fi
   601     fi
   602 
   603     AC_ARG_ENABLE(altivec,
   604 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
   605                   , enable_altivec=yes)
   606     if test x$enable_altivec = xyes; then
   607         save_CFLAGS="$CFLAGS"
   608         have_gcc_altivec=no
   609         have_altivec_h_hdr=no
   610         altivec_CFLAGS="-maltivec"
   611         CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   612 
   613         AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
   614         AC_TRY_COMPILE([
   615         #include <altivec.h>
   616         vector unsigned int vzero() {
   617             return vec_splat_u32(0);
   618         }
   619         ],[
   620         ],[
   621         have_gcc_altivec=yes
   622         have_altivec_h_hdr=yes
   623         ])
   624         AC_MSG_RESULT($have_gcc_altivec)
   625 
   626         if test x$have_gcc_altivec = xno; then
   627             AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
   628             AC_TRY_COMPILE([
   629             vector unsigned int vzero() {
   630                 return vec_splat_u32(0);
   631             }
   632             ],[
   633             ],[
   634             have_gcc_altivec=yes
   635             ])
   636             AC_MSG_RESULT($have_gcc_altivec)
   637         fi
   638 
   639         if test x$have_gcc_altivec = xno; then
   640             AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
   641             altivec_CFLAGS="-faltivec"
   642             CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   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         fi
   655 
   656         if test x$have_gcc_altivec = xno; then
   657             AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
   658             AC_TRY_COMPILE([
   659             vector unsigned int vzero() {
   660                 return vec_splat_u32(0);
   661             }
   662             ],[
   663             ],[
   664             have_gcc_altivec=yes
   665             ])
   666             AC_MSG_RESULT($have_gcc_altivec)
   667         fi
   668         CFLAGS="$save_CFLAGS"
   669 
   670         if test x$have_gcc_altivec = xyes; then
   671             AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
   672             if test x$have_altivec_h_hdr = xyes; then
   673               AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
   674             fi
   675             EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
   676         fi
   677     fi
   678 fi
   679 
   680 dnl See if the OSS audio interface is supported
   681 CheckOSS()
   682 {
   683     AC_ARG_ENABLE(oss,
   684 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
   685                   , enable_oss=maybe)
   686 
   687     # OpenBSD "has" OSS, but it's not really for app use. They want you to
   688     #  use sndio instead. So on there, we default to disabled. You can force
   689     #  it on if you really want, though.
   690     if test x$enable_oss = xmaybe; then
   691         enable_oss=yes
   692         case "$host" in
   693             *-*-openbsd*)
   694                 enable_oss=no;;
   695         esac
   696     fi
   697 
   698     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
   699         AC_MSG_CHECKING(for OSS audio support)
   700         have_oss=no
   701         if test x$have_oss != xyes; then
   702             AC_TRY_COMPILE([
   703               #include <sys/soundcard.h>
   704             ],[
   705               int arg = SNDCTL_DSP_SETFRAGMENT;
   706             ],[
   707             have_oss=yes
   708             ])
   709         fi
   710         if test x$have_oss != xyes; then
   711             AC_TRY_COMPILE([
   712               #include <soundcard.h>
   713             ],[
   714               int arg = SNDCTL_DSP_SETFRAGMENT;
   715             ],[
   716             have_oss=yes
   717             AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
   718             ])
   719         fi
   720         AC_MSG_RESULT($have_oss)
   721         if test x$have_oss = xyes; then
   722             AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
   723             SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
   724             have_audio=yes
   725 
   726             # We may need to link with ossaudio emulation library
   727             case "$host" in
   728                 *-*-openbsd*|*-*-netbsd*)
   729                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
   730             esac
   731         fi
   732     fi
   733 }
   734 
   735 dnl See if the ALSA audio interface is supported
   736 CheckALSA()
   737 {
   738     AC_ARG_ENABLE(alsa,
   739 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
   740                   , enable_alsa=yes)
   741     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
   742         AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
   743         # Restore all flags from before the ALSA detection runs
   744         CFLAGS="$alsa_save_CFLAGS"
   745         LDFLAGS="$alsa_save_LDFLAGS"
   746         LIBS="$alsa_save_LIBS"
   747         if test x$have_alsa = xyes; then
   748             AC_ARG_ENABLE(alsa-shared,
   749 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
   750                           , enable_alsa_shared=yes)
   751             alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   752 
   753             AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
   754             SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
   755             EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
   756             if test x$have_loadso != xyes && \
   757                test x$enable_alsa_shared = xyes; then
   758                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
   759             fi
   760             if test x$have_loadso = xyes && \
   761                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   762                 echo "-- dynamic libasound -> $alsa_lib"
   763                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
   764             else
   765                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
   766             fi
   767             have_audio=yes
   768         fi
   769     fi
   770 }
   771 
   772 dnl Find the ESD includes and libraries
   773 CheckESD()
   774 {
   775     AC_ARG_ENABLE(esd,
   776 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
   777                   , enable_esd=yes)
   778     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   779         AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
   780         if test x$have_esd = xyes; then
   781             AC_ARG_ENABLE(esd-shared,
   782 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
   783                           , enable_esd_shared=yes)
   784             esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   785 
   786             AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
   787             SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
   788             EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
   789             if test x$have_loadso != xyes && \
   790                test x$enable_esd_shared = xyes; then
   791                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
   792             fi
   793             if test x$have_loadso = xyes && \
   794                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   795                 echo "-- dynamic libesd -> $esd_lib"
   796                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
   797             else
   798                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
   799             fi
   800             have_audio=yes
   801         fi
   802     fi
   803 }
   804 
   805 dnl Find PulseAudio
   806 CheckPulseAudio()
   807 {
   808     AC_ARG_ENABLE(pulseaudio,
   809 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
   810                   , enable_pulseaudio=yes)
   811     if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
   812         audio_pulseaudio=no
   813 
   814         PULSEAUDIO_REQUIRED_VERSION=0.9
   815 
   816         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   817         AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
   818         if test x$PKG_CONFIG != xno; then
   819         if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
   820                 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
   821                 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
   822                 audio_pulseaudio=yes
   823             fi
   824         fi
   825         AC_MSG_RESULT($audio_pulseaudio)
   826 
   827         if test x$audio_pulseaudio = xyes; then
   828             AC_ARG_ENABLE(pulseaudio-shared,
   829 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
   830                           , enable_pulseaudio_shared=yes)
   831             pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   832 
   833             AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
   834             SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
   835             EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
   836             if test x$have_loadso != xyes && \
   837                test x$enable_pulseaudio_shared = xyes; then
   838                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
   839             fi
   840             if test x$have_loadso = xyes && \
   841                test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
   842                 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
   843                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
   844 
   845                 case "$host" in
   846                     # On Solaris, pulseaudio must be linked deferred explicitly
   847                     # to prevent undefined symbol failures.
   848                     *-*-solaris*)
   849                         PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
   850                         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
   851                 esac
   852             else
   853                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
   854             fi
   855             have_audio=yes
   856         fi
   857     fi
   858 }
   859 
   860 CheckARTSC()
   861 {
   862     AC_ARG_ENABLE(arts,
   863 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
   864                   , enable_arts=yes)
   865     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   866         AC_PATH_PROG(ARTSCONFIG, artsc-config)
   867         if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
   868             : # arts isn't installed
   869         else
   870             ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   871             ARTS_LIBS=`$ARTSCONFIG --libs`
   872             AC_MSG_CHECKING(for aRts development environment)
   873             audio_arts=no
   874             save_CFLAGS="$CFLAGS"
   875             CFLAGS="$CFLAGS $ARTS_CFLAGS"
   876             AC_TRY_COMPILE([
   877              #include <artsc.h>
   878             ],[
   879              arts_stream_t stream;
   880             ],[
   881             audio_arts=yes
   882             ])
   883             CFLAGS="$save_CFLAGS"
   884             AC_MSG_RESULT($audio_arts)
   885             if test x$audio_arts = xyes; then
   886                 AC_ARG_ENABLE(arts-shared,
   887 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
   888                               , enable_arts_shared=yes)
   889                 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   890 
   891                 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
   892                 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   893                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
   894                 if test x$have_loadso != xyes && \
   895                    test x$enable_arts_shared = xyes; then
   896                     AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
   897                 fi
   898                 if test x$have_loadso = xyes && \
   899                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   900                     echo "-- dynamic libartsc -> $arts_lib"
   901                     AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
   902                 else
   903                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
   904                 fi
   905                 have_audio=yes
   906             fi
   907         fi
   908     fi
   909 }
   910 
   911 dnl See if the NAS audio interface is supported
   912 CheckNAS()
   913 {
   914     AC_ARG_ENABLE(nas,
   915 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
   916                   , enable_nas=yes)
   917     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   918         AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
   919         AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
   920 
   921         AC_MSG_CHECKING(for NAS audio support)
   922         have_nas=no
   923 
   924         if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
   925             have_nas=yes
   926             NAS_LIBS="-laudio"
   927 
   928         elif test -r /usr/X11R6/include/audio/audiolib.h; then
   929             have_nas=yes
   930             NAS_CFLAGS="-I/usr/X11R6/include/"
   931             NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
   932 
   933         fi
   934 
   935         AC_MSG_RESULT($have_nas)
   936 
   937         if test x$have_nas = xyes; then
   938             AC_ARG_ENABLE(nas-shared,
   939 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
   940                           , enable_nas_shared=yes)
   941             nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   942 
   943             if test x$have_loadso != xyes && \
   944                test x$enable_nas_shared = xyes; then
   945                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
   946             fi
   947             if test x$have_loadso = xyes && \
   948                test x$enable_nas_shared = xyes && test x$nas_lib != x; then
   949                 echo "-- dynamic libaudio -> $nas_lib"
   950                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
   951             else
   952                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
   953             fi
   954 
   955             AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
   956             SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
   957             EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
   958             have_audio=yes
   959         fi
   960     fi
   961 }
   962 
   963 dnl See if the sndio audio interface is supported
   964 CheckSNDIO()
   965 {
   966     AC_ARG_ENABLE(sndio,
   967 AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
   968                   , enable_sndio=yes)
   969     if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
   970         AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
   971         AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
   972 
   973         AC_MSG_CHECKING(for sndio audio support)
   974         have_sndio=no
   975 
   976         if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
   977             have_sndio=yes
   978             SNDIO_LIBS="-lsndio"
   979         fi
   980 
   981         AC_MSG_RESULT($have_sndio)
   982 
   983         if test x$have_sndio = xyes; then
   984             AC_ARG_ENABLE(sndio-shared,
   985 AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
   986                           , enable_sndio_shared=yes)
   987             sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   988 
   989             if test x$have_loadso != xyes && \
   990                test x$enable_sndio_shared = xyes; then
   991                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
   992             fi
   993             if test x$have_loadso = xyes && \
   994                test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
   995                 echo "-- dynamic libsndio -> $sndio_lib"
   996                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
   997             else
   998                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
   999             fi
  1000 
  1001             AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
  1002             SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
  1003             EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
  1004             have_audio=yes
  1005         fi
  1006     fi
  1007 }
  1008 
  1009 dnl rcg07142001 See if the user wants the disk writer audio driver...
  1010 CheckDiskAudio()
  1011 {
  1012     AC_ARG_ENABLE(diskaudio,
  1013 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
  1014                   , enable_diskaudio=yes)
  1015     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
  1016         AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
  1017         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
  1018     fi
  1019 }
  1020 
  1021 dnl rcg03142006 See if the user wants the dummy audio driver...
  1022 CheckDummyAudio()
  1023 {
  1024     AC_ARG_ENABLE(dummyaudio,
  1025 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
  1026                   , enable_dummyaudio=yes)
  1027     if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
  1028         AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
  1029         SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
  1030     fi
  1031 }
  1032 
  1033 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
  1034 dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
  1035 CheckVisibilityHidden()
  1036 {
  1037     AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
  1038     have_gcc_fvisibility=no
  1039 
  1040     visibility_CFLAGS="-fvisibility=hidden"
  1041     save_CFLAGS="$CFLAGS"
  1042     CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
  1043     AC_TRY_COMPILE([
  1044     #if !defined(__GNUC__) || __GNUC__ < 4
  1045     #error SDL only uses visibility attributes in GCC 4 or newer
  1046     #endif
  1047     ],[
  1048     ],[
  1049     have_gcc_fvisibility=yes
  1050     ])
  1051     AC_MSG_RESULT($have_gcc_fvisibility)
  1052     CFLAGS="$save_CFLAGS"
  1053 
  1054     if test x$have_gcc_fvisibility = xyes; then
  1055         EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
  1056     fi
  1057 }
  1058 
  1059 dnl See if GCC's -mpreferred-stack-boundary is supported.
  1060 dnl  Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
  1061 CheckStackBoundary()
  1062 {
  1063     AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
  1064     have_gcc_preferred_stack_boundary=no
  1065 
  1066     save_CFLAGS="$CFLAGS"
  1067     CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
  1068     AC_TRY_COMPILE([
  1069     int x = 0;
  1070     ],[
  1071     ],[
  1072     have_gcc_preferred_stack_boundary=yes
  1073     ])
  1074     AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
  1075     CFLAGS="$save_CFLAGS"
  1076 
  1077     if test x$have_gcc_preferred_stack_boundary = xyes; then
  1078         EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
  1079     fi
  1080 }
  1081 
  1082 
  1083 dnl See if GCC's -Wall is supported.
  1084 CheckWarnAll()
  1085 {
  1086     AC_MSG_CHECKING(for GCC -Wall option)
  1087     have_gcc_Wall=no
  1088 
  1089     save_CFLAGS="$CFLAGS"
  1090     CFLAGS="$save_CFLAGS -Wall"
  1091     AC_TRY_COMPILE([
  1092     int x = 0;
  1093     ],[
  1094     ],[
  1095     have_gcc_Wall=yes
  1096     ])
  1097     AC_MSG_RESULT($have_gcc_Wall)
  1098     CFLAGS="$save_CFLAGS"
  1099 
  1100     if test x$have_gcc_Wall = xyes; then
  1101         EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
  1102 
  1103         dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
  1104         AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
  1105         need_gcc_Wno_multichar=no
  1106         case "$host" in
  1107             *-*-haiku*)
  1108                 need_gcc_Wno_multichar=yes
  1109                 ;;
  1110         esac
  1111         AC_MSG_RESULT($need_gcc_Wno_multichar)
  1112         if test x$need_gcc_Wno_multichar = xyes; then
  1113             EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
  1114         fi
  1115     fi
  1116 }
  1117 
  1118 dnl Check for Wayland
  1119 CheckWayland()
  1120 {
  1121     AC_ARG_ENABLE(video-wayland,
  1122 AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]),
  1123                   ,enable_video_wayland=yes)
  1124 
  1125     if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
  1126         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1127         AC_MSG_CHECKING(for Wayland support)
  1128         video_wayland=no
  1129         if test x$PKG_CONFIG != xno; then
  1130             if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
  1131                 WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
  1132                 WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
  1133                 video_wayland=yes
  1134             fi
  1135         fi
  1136         AC_MSG_RESULT($video_wayland)
  1137 
  1138         if test x$video_wayland = xyes; then
  1139             AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
  1140             SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
  1141             EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
  1142             dnl FIXME do dynamic loading code here.
  1143             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
  1144             have_video=yes
  1145         fi
  1146     fi
  1147 }
  1148 
  1149 dnl Find the X11 include and library directories
  1150 CheckX11()
  1151 {
  1152 
  1153 
  1154     AC_ARG_ENABLE(video-x11,
  1155 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
  1156                   , enable_video_x11=yes)
  1157     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1158         case "$host" in
  1159             *-*-darwin*)
  1160                 # This isn't necessary for X11, but fixes GLX detection
  1161                 if test "x$x_includes" = xNONE && \
  1162                    test "x$x_libraries" = xNONE && \
  1163                    test -d /usr/X11R6/include && \
  1164                    test -d /usr/X11R6/lib; then
  1165                     x_includes="/usr/X11R6/include"
  1166                     x_libraries="/usr/X11R6/lib"
  1167                 fi
  1168                 ;;
  1169         esac
  1170         AC_PATH_X
  1171         AC_PATH_XTRA
  1172         if test x$have_x = xyes; then
  1173             AC_ARG_ENABLE(x11-shared,
  1174 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
  1175                           , enable_x11_shared=maybe)
  1176 
  1177             case "$host" in
  1178                 *-*-darwin*)
  1179                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
  1180                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
  1181                     xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
  1182                     xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
  1183                     xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1184                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1185                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1186                     xss_lib='/usr/X11R6/lib/libXss.1.dylib'
  1187                     xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
  1188                     ;;
  1189                 *-*-openbsd*)
  1190                     x11_lib='libX11.so'
  1191                     x11ext_lib='libXext.so'
  1192                     xcursor_lib='libXcursor.so'
  1193                     xinerama_lib='libXinerama.so'
  1194                     xinput_lib='libXi.so'
  1195                     xrandr_lib='libXrandr.so'
  1196                     xrender_lib='libXrender.so'
  1197                     xss_lib='libXss.so'
  1198                     xvidmode_lib='libXxf86vm.so'
  1199                     ;;
  1200                 *)
  1201                     x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1202                     x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1203                     xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1204                     xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1205                     xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1206                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1207                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1208                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1209                     xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1210                     ;;
  1211             esac
  1212 
  1213             if test x$ac_cv_func_shmat != xyes; then
  1214                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1215             fi
  1216             CFLAGS="$CFLAGS $X_CFLAGS"
  1217             LDFLAGS="$LDFLAGS $X_LIBS"
  1218 
  1219             AC_CHECK_HEADER(X11/extensions/Xext.h,
  1220                             have_xext_h_hdr=yes,
  1221                             have_xext_h_hdr=no,
  1222                             [#include <X11/Xlib.h>
  1223                              #include <X11/Xproto.h>
  1224                             ])
  1225             if test x$have_xext_h_hdr != xyes; then
  1226                AC_MSG_ERROR([
  1227 *** Missing Xext.h, maybe you need to install the libxext-dev package?
  1228                ])
  1229             fi
  1230 
  1231             AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
  1232             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1233             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1234 
  1235             # Needed so SDL applications can include SDL_syswm.h
  1236             SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
  1237 
  1238             if test x$enable_x11_shared = xmaybe; then
  1239                 enable_x11_shared=yes
  1240             fi
  1241             if test x$have_loadso != xyes && \
  1242                test x$enable_x11_shared = xyes; then
  1243                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1244                 enable_x11_shared=no
  1245             fi
  1246             if test x$have_loadso = xyes && \
  1247                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1248                 echo "-- dynamic libX11 -> $x11_lib"
  1249                 echo "-- dynamic libX11ext -> $x11ext_lib"
  1250                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
  1251                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
  1252             else
  1253                 enable_x11_shared=no
  1254                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1255             fi
  1256             have_video=yes
  1257 
  1258             AC_MSG_CHECKING(for const parameter to XextAddDisplay)
  1259             have_const_param_XextAddDisplay=no
  1260             AC_TRY_COMPILE([
  1261               #include <X11/Xlib.h>
  1262               #include <X11/Xproto.h>
  1263               #include <X11/extensions/Xext.h>
  1264               #include <X11/extensions/extutil.h>
  1265               extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
  1266             ],[
  1267             ],[
  1268             have_const_param_XextAddDisplay=yes
  1269             AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY)
  1270             ])
  1271             AC_MSG_RESULT($have_const_param_XextAddDisplay)
  1272 
  1273             AC_MSG_CHECKING(for const parameter to _XData32)
  1274 	    have_const_param_xdata32=no
  1275 	    AC_TRY_COMPILE([
  1276 	      #include <X11/Xlibint.h>
  1277 	      extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
  1278 	    ],[
  1279 	    ],[
  1280 	    have_const_param_xdata32=yes
  1281 	    AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32)
  1282 	    ])
  1283 	    AC_MSG_RESULT($have_const_param_xdata32)
  1284 
  1285             dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
  1286             AC_MSG_CHECKING([for XGenericEvent])
  1287             have_XGenericEvent=no
  1288             AC_TRY_COMPILE([
  1289               	#include <X11/Xlib.h>
  1290             ],[
  1291 Display *display;
  1292 XEvent event;
  1293 XGenericEventCookie *cookie = &event.xcookie;
  1294 XNextEvent(display, &event);
  1295 XGetEventData(display, cookie);
  1296 XFreeEventData(display, cookie);
  1297             ],[
  1298                 have_XGenericEvent=yes
  1299                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
  1300             ])
  1301             AC_MSG_RESULT($have_XGenericEvent)
  1302 
  1303             AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
  1304 
  1305             AC_ARG_ENABLE(video-x11-xcursor,
  1306 AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
  1307                             , enable_video_x11_xcursor=yes)
  1308             if test x$enable_video_x11_xcursor = xyes; then
  1309                 definitely_enable_video_x11_xcursor=no
  1310                 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
  1311                                 have_xcursor_h_hdr=yes,
  1312                                 have_xcursor_h_hdr=no,
  1313                                 [#include <X11/Xlib.h>
  1314                                 ])
  1315                 if test x$have_xcursor_h_hdr = xyes; then
  1316                     if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
  1317                         echo "-- dynamic libXcursor -> $xcursor_lib"
  1318                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
  1319                         definitely_enable_video_x11_xcursor=yes
  1320                     else
  1321                         AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
  1322                         if test x$have_xcursor_lib = xyes ; then
  1323                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
  1324                             definitely_enable_video_x11_xcursor=yes
  1325                         fi
  1326                     fi
  1327                 fi
  1328             fi
  1329             if test x$definitely_enable_video_x11_xcursor = xyes; then
  1330                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
  1331             fi
  1332             AC_ARG_ENABLE(video-x11-xinerama,
  1333 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1334                             , enable_video_x11_xinerama=yes)
  1335             if test x$enable_video_x11_xinerama = xyes; then
  1336                 definitely_enable_video_x11_xinerama=no
  1337                 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
  1338                                 have_xinerama_h_hdr=yes,
  1339                                 have_xinerama_h_hdr=no,
  1340                                 [#include <X11/Xlib.h>
  1341                                 ])
  1342                 if test x$have_xinerama_h_hdr = xyes; then
  1343                     if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
  1344                         echo "-- dynamic libXinerama -> $xinerama_lib"
  1345                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
  1346                         definitely_enable_video_x11_xinerama=yes
  1347                     else
  1348                         AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
  1349                         if test x$have_xinerama_lib = xyes ; then
  1350                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
  1351                             definitely_enable_video_x11_xinerama=yes
  1352                         fi
  1353                     fi
  1354                 fi
  1355             fi
  1356             if test x$definitely_enable_video_x11_xinerama = xyes; then
  1357                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
  1358             fi
  1359             AC_ARG_ENABLE(video-x11-xinput,
  1360 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1361                             , enable_video_x11_xinput=yes)
  1362             if test x$enable_video_x11_xinput = xyes; then
  1363                 definitely_enable_video_x11_xinput=no
  1364                 AC_CHECK_HEADER(X11/extensions/XInput2.h,
  1365                                 have_xinput_h_hdr=yes,
  1366                                 have_xinput_h_hdr=no,
  1367                                 [#include <X11/Xlib.h>
  1368                                 ])
  1369                 if test x$have_xinput_h_hdr = xyes; then
  1370                     if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1371                         echo "-- dynamic libXi -> $xinput_lib"
  1372                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
  1373                         definitely_enable_video_x11_xinput=yes
  1374                     else
  1375                         AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1376                         if test x$have_xinput_lib = xyes ; then
  1377                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1378                             definitely_enable_video_x11_xinput=yes
  1379                         fi
  1380                     fi
  1381                 fi
  1382             fi
  1383             if test x$definitely_enable_video_x11_xinput = xyes; then
  1384                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
  1385                 AC_MSG_CHECKING(for xinput2 multitouch)
  1386             	have_xinput2_multitouch=no
  1387             	AC_TRY_COMPILE([
  1388               		#include <X11/Xlib.h>
  1389              		#include <X11/Xproto.h>
  1390 			#include <X11/extensions/XInput2.h>
  1391             	],[
  1392 int event_type = XI_TouchBegin;
  1393 XITouchClassInfo *t;
  1394 Status 
  1395 XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f)
  1396 {
  1397     return (Status)0;
  1398 }
  1399             	],[
  1400             	have_xinput2_multitouch=yes
  1401             	AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
  1402             	])
  1403             	AC_MSG_RESULT($have_xinput2_multitouch)
  1404             fi
  1405             AC_ARG_ENABLE(video-x11-xrandr,
  1406 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1407                             , enable_video_x11_xrandr=yes)
  1408             if test x$enable_video_x11_xrandr = xyes; then
  1409                 definitely_enable_video_x11_xrandr=no
  1410                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1411                                 have_xrandr_h_hdr=yes,
  1412                                 have_xrandr_h_hdr=no,
  1413                                 [#include <X11/Xlib.h>
  1414                                 ])
  1415                 if test x$have_xrandr_h_hdr = xyes; then
  1416                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1417                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1418                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
  1419                         definitely_enable_video_x11_xrandr=yes
  1420                     else
  1421                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1422                         if test x$have_xrandr_lib = xyes ; then
  1423                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1424                             definitely_enable_video_x11_xrandr=yes
  1425                         fi
  1426                     fi
  1427                 fi
  1428             fi
  1429             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1430                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
  1431             fi
  1432             AC_ARG_ENABLE(video-x11-scrnsaver,
  1433 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1434                             , enable_video_x11_scrnsaver=yes)
  1435             if test x$enable_video_x11_scrnsaver = xyes; then
  1436                 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1437                                 have_scrnsaver_h_hdr=yes,
  1438                                 have_scrnsaver_h_hdr=no,
  1439                                 [#include <X11/Xlib.h>
  1440                                 ])
  1441                 if test x$have_scrnsaver_h_hdr = xyes; then
  1442                     if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1443                         echo "-- dynamic libXss -> $xss_lib"
  1444                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
  1445                         definitely_enable_video_x11_scrnsaver=yes
  1446                     else
  1447                         AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1448                         if test x$have_xss_lib = xyes ; then
  1449                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1450                             definitely_enable_video_x11_scrnsaver=yes
  1451                         fi
  1452                     fi
  1453                 fi
  1454             fi
  1455             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1456                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
  1457             fi
  1458             AC_ARG_ENABLE(video-x11-xshape,
  1459 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
  1460                             , enable_video_x11_xshape=yes)
  1461             if test x$enable_video_x11_xshape = xyes; then
  1462                 AC_CHECK_HEADER(X11/extensions/shape.h,
  1463                                 have_shape_h_hdr=yes,
  1464                                 have_shape_h_hdr=no,
  1465                                 [#include <X11/Xlib.h>
  1466                                 ])
  1467                 if test x$have_shape_h_hdr = xyes; then
  1468                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
  1469                 fi
  1470             fi
  1471             AC_ARG_ENABLE(video-x11-vm,
  1472 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1473                             , enable_video_x11_vm=yes)
  1474             if test x$enable_video_x11_vm = xyes; then
  1475                 definitely_enable_video_x11_vm=no
  1476                 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
  1477                                 have_vm_h_hdr=yes,
  1478                                 have_vm_h_hdr=no,
  1479                                 [#include <X11/Xlib.h>
  1480                                 ])
  1481                 if test x$have_vm_h_hdr = xyes; then
  1482                     if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
  1483                         echo "-- dynamic libXxf86vm -> $xvidmode_lib"
  1484                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
  1485                         definitely_enable_video_x11_vm=yes
  1486                     else
  1487                         AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
  1488                         if test x$have_vm_lib = xyes ; then
  1489                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
  1490                             definitely_enable_video_x11_vm=yes
  1491                         fi
  1492                     fi
  1493                 fi
  1494             fi
  1495             if test x$definitely_enable_video_x11_vm = xyes; then
  1496                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
  1497             fi
  1498         fi
  1499     fi
  1500 }
  1501 
  1502 dnl Set up the Haiku video driver if enabled
  1503 CheckHaikuVideo()
  1504 {
  1505     if test x$enable_video = xyes; then
  1506         AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
  1507         SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
  1508         have_video=yes
  1509     fi
  1510 }
  1511 
  1512 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1513 CheckCOCOA()
  1514 {
  1515     AC_ARG_ENABLE(video-cocoa,
  1516 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1517                   , enable_video_cocoa=yes)
  1518     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1519         save_CFLAGS="$CFLAGS"
  1520         dnl work around that we don't have Objective-C support in autoconf
  1521         CFLAGS="$CFLAGS -x objective-c"
  1522         AC_MSG_CHECKING(for Cocoa framework)
  1523         have_cocoa=no
  1524         AC_TRY_COMPILE([
  1525           #import <Cocoa/Cocoa.h>
  1526         ],[
  1527         ],[
  1528         have_cocoa=yes
  1529         ])
  1530         AC_MSG_RESULT($have_cocoa)
  1531         CFLAGS="$save_CFLAGS"
  1532         if test x$have_cocoa = xyes; then
  1533             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
  1534             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1535             have_video=yes
  1536         fi
  1537     fi
  1538 }
  1539 
  1540 dnl Find DirectFB
  1541 CheckDirectFB()
  1542 {
  1543     AC_ARG_ENABLE(video-directfb,
  1544 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  1545                   , enable_video_directfb=no)
  1546     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1547         video_directfb=no
  1548 
  1549         DIRECTFB_REQUIRED_VERSION=1.0.0
  1550         AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
  1551         if test x$DIRECTFBCONFIG = xno; then
  1552             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1553             if test x$PKG_CONFIG != xno; then
  1554                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1555                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1556                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1557                     DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
  1558                     video_directfb=yes
  1559                 fi
  1560             fi
  1561         else
  1562             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1563             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1564             set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
  1565             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1566             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1567                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1568                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1569                 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
  1570                 video_directfb=yes
  1571             fi
  1572         fi
  1573         if test x$video_directfb = xyes; then
  1574             # SuSE 11.1 installs directfb-config without directfb-devel
  1575             save_CPPFLAGS="$CPPFLAGS"
  1576             CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  1577             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1578             CPPFLAGS="$save_CPPFLAGS"
  1579             video_directfb=$have_directfb_hdr
  1580         fi
  1581         AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1582         AC_MSG_RESULT($video_directfb)
  1583 
  1584         if test x$video_directfb = xyes; then
  1585             AC_ARG_ENABLE(directfb-shared,
  1586 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  1587                               , enable_directfb_shared=yes)
  1588 
  1589             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
  1590             AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
  1591             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1592             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1593 
  1594             AC_MSG_CHECKING(for directfb dynamic loading support)
  1595             directfb_shared=no
  1596             directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
  1597             # | sed 's/.*\/\(.*\)/\1/; q'`]
  1598 AC_MSG_WARN("directfb $directfb_lib")
  1599             if test x$have_loadso != xyes && \
  1600                test x$enable_directfb_shared = xyes; then
  1601                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1602             fi
  1603             if test x$have_loadso = xyes && \
  1604                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1605                 directfb_shared=yes
  1606                 echo "-- $directfb_lib_spec -> $directfb_lib"
  1607                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
  1608             else
  1609                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1610             fi
  1611             AC_MSG_RESULT($directfb_shared)
  1612             have_video=yes
  1613         fi
  1614     fi
  1615 }
  1616 
  1617 dnl Find FusionSound
  1618 CheckFusionSound()
  1619 {
  1620     AC_ARG_ENABLE(fusionsound,
  1621 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1622                   , enable_fusionsound=no)
  1623     if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1624         fusionsound=no
  1625 
  1626         FUSIONSOUND_REQUIRED_VERSION=1.1.1
  1627 
  1628         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1629         AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
  1630         if test x$PKG_CONFIG != xno; then
  1631             if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
  1632                 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
  1633                 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
  1634                 fusionsound=yes
  1635             fi
  1636         fi
  1637         AC_MSG_RESULT($fusionsound)
  1638 
  1639         if test x$fusionsound = xyes; then
  1640             AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
  1641             SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1642             EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1643             
  1644             AC_ARG_ENABLE(fusionsound-shared,
  1645 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1646                           , enable_fusionsound_shared=yes)
  1647             fusionsound_shared=no
  1648             AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1649             if test x$have_loadso != xyes && \
  1650                test x$enable_fusionsound_shared = xyes; then
  1651                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1652             fi
  1653             if test x$have_loadso = xyes && \
  1654                test x$enable_fusionsound_shared = xyes; then
  1655                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
  1656                 fusionsound_shared=yes
  1657             else
  1658                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1659             fi
  1660             AC_MSG_RESULT($fusionsound_shared)
  1661             
  1662             have_audio=yes
  1663         fi
  1664     fi
  1665 }
  1666 
  1667 dnl rcg04172001 Set up the Null video driver.
  1668 CheckDummyVideo()
  1669 {
  1670     AC_ARG_ENABLE(video-dummy,
  1671 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1672                   , enable_video_dummy=yes)
  1673     if test x$enable_video_dummy = xyes; then
  1674         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
  1675         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1676         have_video=yes
  1677     fi
  1678 }
  1679 
  1680 dnl Check to see if OpenGL support is desired
  1681 AC_ARG_ENABLE(video-opengl,
  1682 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1683               , enable_video_opengl=yes)
  1684 
  1685 dnl Find OpenGL
  1686 CheckOpenGLX11()
  1687 {
  1688     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1689         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1690         video_opengl=no
  1691         AC_TRY_COMPILE([
  1692          #include <GL/gl.h>
  1693          #include <GL/glx.h>
  1694         ],[
  1695         ],[
  1696         video_opengl=yes
  1697         ])
  1698         AC_MSG_RESULT($video_opengl)
  1699         if test x$video_opengl = xyes; then
  1700             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1701             AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
  1702             AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1703         fi
  1704     fi
  1705 }
  1706 
  1707 dnl Check to see if OpenGL ES support is desired
  1708 AC_ARG_ENABLE(video-opengles,
  1709 AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
  1710               , enable_video_opengles=yes)
  1711 
  1712 dnl Find OpenGL ES
  1713 CheckOpenGLESX11()
  1714 {
  1715     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1716         AC_MSG_CHECKING(for EGL support)
  1717         video_opengl_egl=no
  1718         AC_TRY_COMPILE([
  1719          #include <EGL/egl.h>
  1720         ],[
  1721         ],[
  1722         video_opengl_egl=yes
  1723         ])
  1724         AC_MSG_RESULT($video_opengl_egl)
  1725         if test x$video_opengl_egl = xyes; then
  1726             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1727         fi
  1728             
  1729         AC_MSG_CHECKING(for OpenGL ES v1 headers)
  1730         video_opengles_v1=no
  1731         AC_TRY_COMPILE([
  1732          #include <GLES/gl.h>
  1733          #include <GLES/glext.h>
  1734         ],[
  1735         ],[
  1736         video_opengles_v1=yes
  1737         ])
  1738         AC_MSG_RESULT($video_opengles_v1)
  1739         if test x$video_opengles_v1 = xyes; then
  1740             AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  1741             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  1742         fi
  1743         
  1744         AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1745         video_opengles_v2=no
  1746         AC_TRY_COMPILE([
  1747          #include <GLES2/gl2.h>
  1748          #include <GLES2/gl2ext.h>
  1749         ],[
  1750         ],[
  1751         video_opengles_v2=yes
  1752         ])
  1753         AC_MSG_RESULT($video_opengles_v2)
  1754         if test x$video_opengles_v2 = xyes; then
  1755             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1756             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1757         fi
  1758     fi
  1759 }
  1760 
  1761 dnl Check for Windows OpenGL
  1762 CheckWINDOWSGL()
  1763 {
  1764     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1765         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1766         AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
  1767         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1768     fi
  1769 }
  1770 
  1771 dnl Check for Windows OpenGL
  1772 CheckWINDOWSGLES()
  1773 {
  1774     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1775 
  1776         AC_MSG_CHECKING(for EGL support)
  1777         video_opengl_egl=no
  1778         AC_TRY_COMPILE([
  1779          #include <EGL/egl.h>
  1780         ],[
  1781         ],[
  1782         video_opengl_egl=yes
  1783         ])
  1784         AC_MSG_RESULT($video_opengl_egl)
  1785         if test x$video_opengl_egl = xyes; then
  1786             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1787             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1788         fi
  1789        
  1790         AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1791         video_opengles_v2=no
  1792         AC_TRY_COMPILE([
  1793          #include <GLES2/gl2.h>
  1794          #include <GLES2/gl2ext.h>
  1795         ],[
  1796         ],[
  1797         video_opengles_v2=yes
  1798         ])
  1799         AC_MSG_RESULT($video_opengles_v2)
  1800         if test x$video_opengles_v2 = xyes; then
  1801             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1802             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1803             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1804         fi
  1805     fi
  1806 }
  1807 
  1808 dnl Check for Haiku OpenGL
  1809 CheckHaikuGL()
  1810 {
  1811     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1812         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1813         AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
  1814         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1815         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1816     fi
  1817 }
  1818 
  1819 dnl Check for MacOS OpenGL
  1820 CheckMacGL()
  1821 {
  1822     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1823         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1824         AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
  1825         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1826         case "$host" in
  1827             *-*-darwin*)
  1828                 if test x$enable_video_cocoa = xyes; then
  1829                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1830                 fi
  1831         esac
  1832     fi
  1833 }
  1834 
  1835 dnl See if we can use the new unified event interface in Linux 2.4
  1836 CheckInputEvents()
  1837 {
  1838     dnl Check for Linux 2.4 unified input event interface support
  1839         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1840         use_input_events=no
  1841         AC_TRY_COMPILE([
  1842           #include <linux/input.h>
  1843         ],[
  1844           #ifndef EVIOCGNAME
  1845           #error EVIOCGNAME() ioctl not available
  1846           #endif
  1847         ],[
  1848         use_input_events=yes
  1849         ])
  1850         AC_MSG_RESULT($use_input_events)
  1851         if test x$use_input_events = xyes; then
  1852             AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
  1853         fi
  1854 }
  1855 
  1856 dnl See if we can use the kernel kd.h header
  1857 CheckInputKD()
  1858 {
  1859 
  1860     AC_MSG_CHECKING(for Linux kd.h)
  1861     use_input_kd=no
  1862     AC_TRY_COMPILE([
  1863       #include <linux/kd.h>
  1864       #include <linux/keyboard.h>
  1865     ],[
  1866         struct kbentry kbe;
  1867         kbe.kb_table = KG_CTRL;
  1868         ioctl(0, KDGKBENT, &kbe);
  1869     ],[
  1870     use_input_kd=yes
  1871     ])
  1872     AC_MSG_RESULT($use_input_kd)
  1873     if test x$use_input_kd = xyes; then
  1874         AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
  1875     fi
  1876 }
  1877 
  1878 dnl See if the platform offers libudev for device enumeration and hotplugging.
  1879 CheckLibUDev()
  1880 {
  1881     AC_ARG_ENABLE(libudev,
  1882 AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
  1883                         , enable_libudev=yes)
  1884     if test x$enable_libudev = xyes; then
  1885         AC_CHECK_HEADER(libudev.h,
  1886                         have_libudev_h_hdr=yes,
  1887                         have_libudev_h_hdr=no)
  1888         if test x$have_libudev_h_hdr = xyes; then
  1889             AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
  1890         fi
  1891     fi
  1892 }
  1893 
  1894 dnl See if the platform offers libdbus for various IPC techniques.
  1895 CheckDBus()
  1896 {
  1897     AC_ARG_ENABLE(dbus,
  1898 AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
  1899                         , enable_dbus=yes)
  1900     if test x$enable_dbus = xyes; then
  1901         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1902         if test x$PKG_CONFIG != xno; then
  1903             DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
  1904             save_CFLAGS="$CFLAGS"
  1905             CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
  1906             AC_CHECK_HEADER(dbus/dbus.h,
  1907                             have_dbus_dbus_h_hdr=yes,
  1908                             have_dbus_dbus_h_hdr=no)
  1909             CFLAGS="$save_CFLAGS"
  1910             if test x$have_dbus_dbus_h_hdr = xyes; then
  1911                 AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
  1912                 EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
  1913             fi
  1914         fi
  1915     fi
  1916 }
  1917 
  1918 dnl See if we can use the Touchscreen input library
  1919 CheckTslib()
  1920 {
  1921     AC_ARG_ENABLE(input-tslib,
  1922 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1923                   , enable_input_tslib=yes)
  1924     if test x$enable_input_tslib = xyes; then
  1925         AC_MSG_CHECKING(for Touchscreen library support)
  1926         enable_input_tslib=no
  1927         AC_TRY_COMPILE([
  1928           #include "tslib.h"
  1929         ],[
  1930         ],[
  1931         enable_input_tslib=yes
  1932         ])
  1933         AC_MSG_RESULT($enable_input_tslib)
  1934         if test x$enable_input_tslib = xyes; then
  1935             AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
  1936             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1937         fi
  1938     fi
  1939 }
  1940 
  1941 dnl See what type of thread model to use on Linux and Solaris
  1942 CheckPTHREAD()
  1943 {
  1944     dnl Check for pthread support
  1945     AC_ARG_ENABLE(pthreads,
  1946 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1947                   , enable_pthreads=yes)
  1948     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1949     AC_ARG_ENABLE(pthread-sem,
  1950 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1951                   , enable_pthread_sem=yes)
  1952     case "$host" in
  1953         *-*-linux*|*-*-uclinux*)
  1954             pthread_cflags="-D_REENTRANT"
  1955             pthread_lib="-lpthread"
  1956             ;;
  1957         *-*-bsdi*)
  1958             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1959             pthread_lib=""
  1960             ;;
  1961         *-*-darwin*)
  1962             pthread_cflags="-D_THREAD_SAFE"
  1963 # causes Carbon.p complaints?
  1964 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1965             ;;
  1966         *-*-freebsd*|*-*-dragonfly*)
  1967             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1968             pthread_lib="-pthread"
  1969             ;;
  1970         *-*-netbsd*)
  1971             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1972             pthread_lib="-lpthread"
  1973             ;;
  1974         *-*-openbsd*)
  1975             pthread_cflags="-D_REENTRANT"
  1976             pthread_lib="-pthread"
  1977             ;;
  1978         *-*-solaris2.9)
  1979             # From Solaris 9+, posix4's preferred name is rt.
  1980             pthread_cflags="-D_REENTRANT"
  1981             pthread_lib="-lpthread -lrt"
  1982             ;;
  1983         *-*-solaris2.10)
  1984             # Solaris 10+ merged pthread into libc.
  1985             pthread_cflags="-D_REENTRANT"
  1986             pthread_lib="-lrt"
  1987             ;;
  1988         *-*-solaris*)
  1989             # Solaris 11+ merged rt into libc.
  1990             pthread_cflags="-D_REENTRANT"
  1991             pthread_lib=""
  1992             ;;
  1993         *-*-sysv5*)
  1994             pthread_cflags="-D_REENTRANT -Kthread"
  1995             pthread_lib=""
  1996             ;;
  1997         *-*-aix*)
  1998             pthread_cflags="-D_REENTRANT -mthreads"
  1999             pthread_lib="-lpthread"
  2000             ;;
  2001         *-*-hpux11*)
  2002             pthread_cflags="-D_REENTRANT"
  2003             pthread_lib="-L/usr/lib -lpthread"
  2004             ;;
  2005         *-*-haiku*)
  2006             pthread_cflags="-D_REENTRANT"
  2007             pthread_lib=""
  2008             ;;
  2009         *)
  2010             pthread_cflags="-D_REENTRANT"
  2011             pthread_lib="-lpthread"
  2012             ;;
  2013     esac
  2014     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  2015         # Save the original compiler flags and libraries
  2016         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  2017         # Add the pthread compiler flags and libraries
  2018         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  2019         # Check to see if we have pthread support on this system
  2020         AC_MSG_CHECKING(for pthreads)
  2021         use_pthreads=no
  2022         AC_TRY_LINK([
  2023          #include <pthread.h>
  2024         ],[
  2025          pthread_attr_t type;
  2026          pthread_attr_init(&type);
  2027         ],[
  2028         use_pthreads=yes
  2029         ])
  2030         AC_MSG_RESULT($use_pthreads)
  2031         # Restore the compiler flags and libraries
  2032         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2033 
  2034         # Do futher testing if we have pthread support...
  2035         if test x$use_pthreads = xyes; then
  2036             AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
  2037             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  2038             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  2039             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  2040             SDL_LIBS="$SDL_LIBS $pthread_lib"
  2041 
  2042             # Save the original compiler flags and libraries
  2043             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  2044             # Add the pthread compiler flags and libraries
  2045             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  2046 
  2047             # Check to see if recursive mutexes are available
  2048             AC_MSG_CHECKING(for recursive mutexes)
  2049             has_recursive_mutexes=no
  2050             if test x$has_recursive_mutexes = xno; then
  2051                 AC_TRY_COMPILE([
  2052                   #include <pthread.h>
  2053                 ],[
  2054                   pthread_mutexattr_t attr;
  2055                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  2056                 ],[
  2057                 has_recursive_mutexes=yes
  2058                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
  2059                 ])
  2060             fi
  2061             if test x$has_recursive_mutexes = xno; then
  2062                 AC_TRY_COMPILE([
  2063                   #include <pthread.h>
  2064                 ],[
  2065                   pthread_mutexattr_t attr;
  2066                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  2067                 ],[
  2068                 has_recursive_mutexes=yes
  2069                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
  2070                 ])
  2071             fi
  2072             AC_MSG_RESULT($has_recursive_mutexes)
  2073 
  2074             # Check to see if pthread semaphore support is missing
  2075             if test x$enable_pthread_sem = xyes; then
  2076                 AC_MSG_CHECKING(for pthread semaphores)
  2077                 have_pthread_sem=no
  2078                 AC_TRY_COMPILE([
  2079                   #include <pthread.h>
  2080                   #include <semaphore.h>
  2081                 ],[
  2082                 ],[
  2083                 have_pthread_sem=yes
  2084                 ])
  2085                 AC_MSG_RESULT($have_pthread_sem)
  2086             fi
  2087             if test x$have_pthread_sem = xyes; then
  2088                 AC_MSG_CHECKING(for sem_timedwait)
  2089                 have_sem_timedwait=no
  2090                 AC_TRY_LINK([
  2091                   #include <pthread.h>
  2092                   #include <semaphore.h>
  2093                 ],[
  2094                   sem_timedwait(NULL, NULL);
  2095                 ],[
  2096                 have_sem_timedwait=yes
  2097                 AC_DEFINE(HAVE_SEM_TIMEDWAIT)
  2098                 ])
  2099                 AC_MSG_RESULT($have_sem_timedwait)
  2100             fi
  2101 
  2102             AC_MSG_CHECKING(for pthread_spin_trylock)
  2103             AC_TRY_LINK_FUNC(pthread_spin_trylock, [
  2104               has_pthread_spin_trylock=yes
  2105               AC_DEFINE(HAVE_PTHREAD_SPINLOCK, 1, [ ])
  2106             ],[
  2107               has_pthread_spin_trylock=no
  2108             ])
  2109             AC_MSG_RESULT($has_pthread_spin_trylock)
  2110 
  2111             AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
  2112             if test x$have_pthread_np_h = xyes; then
  2113                 AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
  2114             fi
  2115 
  2116             # Check to see if pthread naming is available
  2117             AC_MSG_CHECKING(for pthread_setname_np)
  2118             AC_TRY_LINK_FUNC(pthread_setname_np, [
  2119               has_pthread_setname_np=yes
  2120               AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
  2121             ],[
  2122               has_pthread_setname_np=no
  2123             ])
  2124             AC_MSG_RESULT($has_pthread_setname_np)
  2125 
  2126             AC_MSG_CHECKING(for pthread_set_name_np)
  2127             AC_TRY_LINK_FUNC(pthread_set_name_np, [
  2128               has_pthread_set_name_np=yes
  2129               AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
  2130             ],[
  2131               has_pthread_set_name_np=no
  2132             ])
  2133             AC_MSG_RESULT($has_pthread_set_name_np)
  2134 
  2135             # Restore the compiler flags and libraries
  2136             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2137 
  2138             # Basic thread creation functions
  2139             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  2140 
  2141             # Semaphores
  2142             # We can fake these with mutexes and condition variables if necessary
  2143             if test x$have_pthread_sem = xyes; then
  2144                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  2145             else
  2146                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  2147             fi
  2148 
  2149             # Mutexes
  2150             # We can fake these with semaphores if necessary
  2151             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  2152 
  2153             # Condition variables
  2154             # We can fake these with semaphores and mutexes if necessary
  2155             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  2156 
  2157             # Thread local storage
  2158             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
  2159 
  2160             have_threads=yes
  2161         fi
  2162     fi
  2163 }
  2164 
  2165 dnl Determine whether the compiler can produce Windows executables
  2166 CheckWINDOWS()
  2167 {
  2168     AC_MSG_CHECKING(Windows compiler)
  2169     have_win32_gcc=no
  2170     AC_TRY_COMPILE([
  2171      #include <windows.h>
  2172     ],[
  2173     ],[
  2174     have_win32_gcc=yes
  2175     ])
  2176     AC_MSG_RESULT($have_win32_gcc)
  2177     if test x$have_win32_gcc != xyes; then
  2178        AC_MSG_ERROR([
  2179 *** Your compiler ($CC) does not produce Windows executables!
  2180        ])
  2181     fi
  2182 
  2183     AC_MSG_CHECKING(Windows CE)
  2184     have_wince=no
  2185     AC_TRY_COMPILE([
  2186 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  2187 #error This is not Windows CE
  2188 #endif
  2189     ],[
  2190     ],[
  2191     have_wince=yes
  2192        AC_MSG_ERROR([
  2193 *** Sorry, Windows CE is no longer supported.
  2194        ])
  2195     ])
  2196     AC_MSG_RESULT($have_wince)
  2197 
  2198     # This fixes Windows stack alignment with newer GCC
  2199     CheckStackBoundary
  2200 }
  2201 
  2202 dnl Find the DirectX includes and libraries
  2203 CheckDIRECTX()
  2204 {
  2205     AC_ARG_ENABLE(directx,
  2206 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
  2207                   , enable_directx=yes)
  2208     if test x$enable_directx = xyes; then
  2209         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  2210         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  2211         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  2212         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  2213         AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
  2214 
  2215         # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
  2216         # FIXME:  ...so force it off for now.
  2217         case "$host" in
  2218             *-*-cygwin*)
  2219             have_dinput=false
  2220             ;;
  2221         esac
  2222     fi
  2223 }
  2224 
  2225 dnl Check for the dlfcn.h interface for dynamically loading objects
  2226 CheckDLOPEN()
  2227 {
  2228     AC_ARG_ENABLE(sdl-dlopen,
  2229 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  2230                   , enable_sdl_dlopen=yes)
  2231     if test x$enable_sdl_dlopen = xyes; then
  2232         AC_MSG_CHECKING(for dlopen)
  2233         have_dlopen=no
  2234         AC_TRY_COMPILE([
  2235          #include <dlfcn.h>
  2236         ],[
  2237          void *handle = dlopen("", RTLD_NOW);
  2238          const char *loaderror = (char *) dlerror();
  2239         ],[
  2240         have_dlopen=yes
  2241         ])
  2242         AC_MSG_RESULT($have_dlopen)
  2243 
  2244         if test x$have_dlopen = xyes; then
  2245             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  2246                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  2247                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  2248             AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
  2249             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  2250             have_loadso=yes
  2251         fi
  2252     fi
  2253 }
  2254 
  2255 dnl Check for the usbhid(3) library on *BSD
  2256 CheckUSBHID()
  2257 {
  2258     case "$host" in
  2259         *-*-*bsd*)
  2260             if test x$enable_joystick = xyes; then
  2261                 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  2262                 if test x$have_libusbhid = xyes; then
  2263                     AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  2264                     AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  2265                     USB_LIBS="$USB_LIBS -lusbhid"
  2266                 else
  2267                     AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  2268                     AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  2269                     AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  2270                 fi
  2271                     
  2272                 save_CFLAGS="$CFLAGS"
  2273                 CFLAGS="$CFLAGS $USB_CFLAGS"
  2274 
  2275                 AC_MSG_CHECKING(for usbhid)
  2276                 have_usbhid=no
  2277                 AC_TRY_COMPILE([
  2278                   #include <sys/types.h>
  2279                   #if defined(HAVE_USB_H)
  2280                   #include <usb.h>
  2281                   #endif
  2282                   #ifdef __DragonFly__
  2283                   # include <bus/usb/usb.h>
  2284                   # include <bus/usb/usbhid.h>
  2285                   #else
  2286                   # include <dev/usb/usb.h>
  2287                   # include <dev/usb/usbhid.h>
  2288                   #endif
  2289                   #if defined(HAVE_USBHID_H)
  2290                   #include <usbhid.h>
  2291                   #elif defined(HAVE_LIBUSB_H)
  2292                   #include <libusb.h>
  2293                   #elif defined(HAVE_LIBUSBHID_H)
  2294                   #include <libusbhid.h>
  2295                   #endif
  2296                 ],[
  2297                   struct report_desc *repdesc;
  2298                   struct usb_ctl_report *repbuf;
  2299                   hid_kind_t hidkind;
  2300                 ],[
  2301                 have_usbhid=yes
  2302                 ])
  2303                 AC_MSG_RESULT($have_usbhid)
  2304 
  2305                 if test x$have_usbhid = xyes; then
  2306                     AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2307                     have_usbhid_ucr_data=no
  2308                     AC_TRY_COMPILE([
  2309                       #include <sys/types.h>
  2310                       #if defined(HAVE_USB_H)
  2311                       #include <usb.h>
  2312                       #endif
  2313                       #ifdef __DragonFly__
  2314                       # include <bus/usb/usb.h>
  2315                       # include <bus/usb/usbhid.h>
  2316                       #else
  2317                       # include <dev/usb/usb.h>
  2318                       # include <dev/usb/usbhid.h>
  2319                       #endif
  2320                       #if defined(HAVE_USBHID_H)
  2321                       #include <usbhid.h>
  2322                       #elif defined(HAVE_LIBUSB_H)
  2323                       #include <libusb.h>
  2324                       #elif defined(HAVE_LIBUSBHID_H)
  2325                       #include <libusbhid.h>
  2326                       #endif
  2327                     ],[
  2328                       struct usb_ctl_report buf;
  2329                       if (buf.ucr_data) { }
  2330                     ],[
  2331                     have_usbhid_ucr_data=yes
  2332                     ])
  2333                     if test x$have_usbhid_ucr_data = xyes; then
  2334                         USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2335                     fi
  2336                     AC_MSG_RESULT($have_usbhid_ucr_data)
  2337                     
  2338                     AC_MSG_CHECKING(for new usbhid API)
  2339                     have_usbhid_new=no
  2340                     AC_TRY_COMPILE([
  2341                       #include <sys/types.h>
  2342                       #if defined(HAVE_USB_H)
  2343                       #include <usb.h>
  2344                       #endif
  2345                       #ifdef __DragonFly__
  2346                       #include <bus/usb/usb.h>
  2347                       #include <bus/usb/usbhid.h>
  2348                       #else
  2349                       #include <dev/usb/usb.h>
  2350                       #include <dev/usb/usbhid.h>
  2351                       #endif
  2352                       #if defined(HAVE_USBHID_H)
  2353                       #include <usbhid.h>
  2354                       #elif defined(HAVE_LIBUSB_H)
  2355                       #include <libusb.h>
  2356                       #elif defined(HAVE_LIBUSBHID_H)
  2357                       #include <libusbhid.h>
  2358                       #endif
  2359                     ],[
  2360                       report_desc_t d;
  2361                       hid_start_parse(d, 1, 1);
  2362                     ],[
  2363                     have_usbhid_new=yes
  2364                     ])
  2365                     if test x$have_usbhid_new = xyes; then
  2366                         USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2367                     fi
  2368                     AC_MSG_RESULT($have_usbhid_new)
  2369 
  2370                     AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2371                     have_machine_joystick=no
  2372                     AC_TRY_COMPILE([
  2373                       #include <machine/joystick.h>
  2374                     ],[
  2375                       struct joystick t;
  2376                     ],[
  2377                     have_machine_joystick=yes
  2378                     ])
  2379                     if test x$have_machine_joystick = xyes; then
  2380                         AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
  2381                     fi
  2382                     AC_MSG_RESULT($have_machine_joystick)
  2383 
  2384                     AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
  2385                     SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2386                     EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2387                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2388                     have_joystick=yes
  2389                 fi
  2390                 CFLAGS="$save_CFLAGS"
  2391             fi
  2392         ;;
  2393     esac
  2394 }
  2395 
  2396 dnl Check for clock_gettime()
  2397 CheckClockGettime()
  2398 {
  2399     AC_ARG_ENABLE(clock_gettime,
  2400 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
  2401                   , enable_clock_gettime=yes)
  2402     if test x$enable_clock_gettime = xyes; then
  2403         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2404         if test x$have_clock_gettime = xyes; then
  2405             AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  2406             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2407         else
  2408             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  2409             if test x$have_clock_gettime = xyes; then
  2410                AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  2411                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  2412             fi
  2413         fi
  2414     fi
  2415 }
  2416 
  2417 dnl Check for a valid linux/version.h
  2418 CheckLinuxVersion()
  2419 {
  2420     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2421     if test x$have_linux_version_h = xyes; then
  2422         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2423     fi
  2424 }
  2425 
  2426 dnl Check if we want to use RPATH
  2427 CheckRPATH()
  2428 {
  2429     AC_ARG_ENABLE(rpath,
  2430 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2431                   , enable_rpath=yes)
  2432 }
  2433 
  2434 dnl Set up the configuration based on the host platform!
  2435 case "$host" in
  2436     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
  2437         case "$host" in
  2438             *-raspberry-linux*)
  2439                 # Raspberry Pi
  2440                 ARCH=linux
  2441                 RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
  2442                 CFLAGS="$CFLAGS $RPI_CFLAGS"
  2443                 SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
  2444                 EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
  2445                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl"
  2446 
  2447                 if test x$enable_video = xyes; then
  2448                     SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
  2449                     $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
  2450                 fi
  2451                 ;;
  2452             *-*-linux*)         ARCH=linux ;;
  2453             *-*-uclinux*)       ARCH=linux ;;
  2454             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2455             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2456             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2457             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2458             *-*-bsdi*)          ARCH=bsdi ;;
  2459             *-*-freebsd*)       ARCH=freebsd ;;
  2460             *-*-dragonfly*)     ARCH=freebsd ;;
  2461             *-*-netbsd*)        ARCH=netbsd ;;
  2462             *-*-openbsd*)       ARCH=openbsd ;;
  2463             *-*-sysv5*)         ARCH=sysv5 ;;
  2464             *-*-solaris*)       ARCH=solaris ;;
  2465             *-*-hpux*)          ARCH=hpux ;;
  2466             *-*-aix*)           ARCH=aix ;;
  2467             *-*-minix*)         ARCH=minix ;;
  2468         esac
  2469         CheckVisibilityHidden
  2470         CheckDummyVideo
  2471         CheckDiskAudio
  2472         CheckDummyAudio
  2473         CheckDLOPEN
  2474         CheckOSS
  2475         CheckALSA
  2476         CheckPulseAudio
  2477         CheckARTSC
  2478         CheckESD
  2479         CheckNAS
  2480         CheckSNDIO
  2481         CheckX11
  2482         CheckWayland
  2483         CheckDirectFB
  2484         CheckFusionSound
  2485         CheckOpenGLX11
  2486         CheckOpenGLESX11
  2487         CheckLibUDev
  2488         CheckDBus
  2489         CheckInputEvents
  2490         CheckInputKD
  2491         CheckTslib
  2492         CheckUSBHID
  2493         CheckPTHREAD
  2494         CheckClockGettime
  2495         CheckLinuxVersion
  2496         CheckRPATH
  2497         # Set up files for the audio library
  2498         if test x$enable_audio = xyes; then
  2499           case $ARCH in
  2500             sysv5|solaris|hpux)
  2501                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
  2502                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2503                 have_audio=yes
  2504             ;;
  2505             netbsd)  # Don't use this on OpenBSD, it's busted.
  2506                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ])
  2507                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2508                 have_audio=yes
  2509             ;;
  2510             aix)
  2511                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
  2512                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2513                 have_audio=yes
  2514             ;;
  2515           esac
  2516         fi
  2517         # Set up files for the joystick library
  2518         if test x$enable_joystick = xyes; then
  2519           case $ARCH in
  2520             linux)
  2521                 AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
  2522                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2523                 have_joystick=yes
  2524             ;;
  2525           esac
  2526         fi
  2527         # Set up files for the haptic library
  2528         if test x$enable_haptic = xyes; then
  2529            if test x$use_input_events = xyes; then
  2530              case $ARCH in
  2531                linux)
  2532                    AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
  2533                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2534                    have_haptic=yes
  2535                ;;
  2536              esac
  2537            fi
  2538         fi
  2539         # Set up files for the power library
  2540         if test x$enable_power = xyes; then
  2541              case $ARCH in
  2542                linux)
  2543                    AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
  2544                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2545                    have_power=yes
  2546                ;;
  2547              esac
  2548         fi
  2549         # Set up files for the filesystem library
  2550         if test x$enable_filesystem = xyes; then
  2551             AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
  2552             SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
  2553             have_filesystem=yes
  2554         fi
  2555         # Set up files for the timer library
  2556         if test x$enable_timers = xyes; then
  2557             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  2558             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2559             have_timers=yes
  2560         fi
  2561         # Set up files for udev hotplugging support
  2562         if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
  2563             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"               
  2564         fi
  2565         # Set up files for evdev input
  2566         if test x$use_input_events = xyes; then
  2567             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c"
  2568         fi       
  2569         ;;
  2570     *-*-cygwin* | *-*-mingw32*)
  2571         ARCH=win32
  2572         if test "$build" != "$host"; then # cross-compiling
  2573             # Default cross-compile location
  2574             ac_default_prefix=/usr/local/cross-tools/$host
  2575         else
  2576             # Look for the location of the tools and install there
  2577             if test "$BUILD_PREFIX" != ""; then
  2578                 ac_default_prefix=$BUILD_PREFIX
  2579             fi
  2580         fi
  2581         CheckDummyVideo
  2582         CheckDiskAudio
  2583         CheckDummyAudio
  2584         CheckWINDOWS
  2585         CheckWINDOWSGL
  2586         CheckWINDOWSGLES
  2587         CheckDIRECTX
  2588 
  2589         # Set up the core platform files
  2590         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  2591 
  2592         # Set up files for the video library
  2593         if test x$enable_video = xyes; then
  2594             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
  2595             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  2596             have_video=yes
  2597             AC_ARG_ENABLE(render-d3d,
  2598 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2599                                 , enable_render_d3d=yes)
  2600             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2601                 AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
  2602             fi
  2603         fi
  2604         # Set up files for the audio library
  2605         if test x$enable_audio = xyes; then
  2606             AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
  2607             SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
  2608             if test x$have_dsound = xyes; then
  2609                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
  2610                 SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
  2611             fi
  2612             if test x$have_xaudio2 = xyes; then
  2613                 AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
  2614                 SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
  2615             fi
  2616             have_audio=yes
  2617         fi
  2618         # Set up files for the joystick library
  2619         if test x$enable_joystick = xyes; then
  2620             if test x$have_dinput = xyes; then
  2621                 AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
  2622                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
  2623                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  2624             else
  2625                 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
  2626                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
  2627             fi
  2628             have_joystick=yes
  2629         fi
  2630         if test x$enable_haptic = xyes; then
  2631             if test x$have_dinput = xyes; then
  2632                 AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
  2633                 SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
  2634                 have_haptic=yes
  2635             fi
  2636         fi
  2637         if test x$enable_power = xyes; then
  2638             AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
  2639             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2640             have_power=yes
  2641         fi
  2642         if test x$enable_filesystem = xyes; then
  2643             AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
  2644             SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
  2645             have_filesystem=yes
  2646         fi
  2647         # Set up files for the thread library
  2648         if test x$enable_threads = xyes; then
  2649             AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
  2650             SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
  2651             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2652             have_threads=yes
  2653         fi
  2654         # Set up files for the timer library
  2655         if test x$enable_timers = xyes; then
  2656             AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
  2657             SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  2658             have_timers=yes
  2659         fi
  2660         # Set up files for the shared object loading library
  2661         if test x$enable_loadso = xyes; then
  2662             AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
  2663             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  2664             have_loadso=yes
  2665         fi
  2666         # Set up the system libraries we need
  2667         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
  2668         # The Windows platform requires special setup
  2669         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  2670         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  2671         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2672         SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
  2673 
  2674         # Check to see if this is a mingw or cygwin build
  2675         have_mingw32=
  2676         AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
  2677         if test x$have_mingw32 = xyes; then
  2678             SDL_LIBS="-lmingw32 $SDL_LIBS"
  2679         else
  2680             SDL_LIBS="-lcygwin $SDL_LIBS"
  2681         fi
  2682         ;;
  2683 
  2684     dnl BeOS support removed after SDL 2.0.1. Haiku still works.  --ryan.
  2685     *-*-beos*)
  2686         AC_MSG_ERROR([
  2687 *** BeOS support has been removed as of SDL 2.0.2.
  2688         ])
  2689         ;;
  2690 
  2691     *-*-haiku*)
  2692         ARCH=haiku
  2693         ac_default_prefix=/boot/system
  2694         CheckDummyVideo
  2695         CheckDiskAudio
  2696         CheckDummyAudio
  2697         CheckHaikuVideo
  2698         CheckHaikuGL
  2699         CheckPTHREAD
  2700 
  2701         # Set up files for the audio library
  2702         if test x$enable_audio = xyes; then
  2703             AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
  2704             SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
  2705             have_audio=yes
  2706         fi
  2707         # Set up files for the joystick library
  2708         if test x$enable_joystick = xyes; then
  2709             AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
  2710             SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
  2711             have_joystick=yes
  2712         fi
  2713         # Set up files for the timer library
  2714         if test x$enable_timers = xyes; then
  2715             AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
  2716             SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
  2717             have_timers=yes
  2718         fi
  2719         # Set up files for the shared object loading library
  2720         if test x$enable_loadso = xyes; then
  2721             AC_DEFINE(SDL_LOADSO_HAIKU, 1, [ ])
  2722             SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c"
  2723             have_loadso=yes
  2724         fi
  2725         # Set up files for the system power library
  2726         if test x$enable_power = xyes; then
  2727             AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
  2728             SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
  2729             have_power=yes
  2730         fi
  2731         # Set up files for the system filesystem library
  2732         if test x$enable_filesystem = xyes; then
  2733             AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
  2734             SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
  2735             have_filesystem=yes
  2736         fi
  2737         # The Haiku platform requires special setup.
  2738         SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
  2739         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2740         ;;
  2741     arm*-apple-darwin*)
  2742         # iOS - We are not writing anything to confdefs.h because you have to replace
  2743         # SDL_config.h for SDL_config_iphoneos.h anyway
  2744         ARCH=ios
  2745 
  2746         CheckVisibilityHidden
  2747         CheckDummyVideo
  2748         CheckDiskAudio
  2749         CheckDummyAudio
  2750         CheckDLOPEN
  2751         CheckCOCOA
  2752         CheckPTHREAD
  2753 
  2754 
  2755         # Set up files for the audio library
  2756         if test x$enable_audio = xyes; then
  2757             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
  2758             have_audio=yes
  2759         fi
  2760         # Set up files for the joystick library
  2761         if test x$enable_joystick = xyes; then
  2762             SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  2763             have_joystick=yes
  2764         fi
  2765         # Set up files for the haptic library
  2766         #if test x$enable_haptic = xyes; then
  2767         #    SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2768         #    have_haptic=yes
  2769         #    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2770         #fi
  2771         # Set up files for the power library
  2772         if test x$enable_power = xyes; then
  2773             SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
  2774             have_power=yes
  2775         fi
  2776         # Set up files for the filesystem library
  2777         if test x$enable_filesystem = xyes; then
  2778             SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  2779             have_filesystem=yes
  2780         fi
  2781         # Set up files for the timer library
  2782         if test x$enable_timers = xyes; then
  2783             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2784             have_timers=yes
  2785         fi
  2786         # Set up additional files for the file library
  2787         if test x$enable_file = xyes; then
  2788             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2789         fi
  2790         # The iOS platform requires special setup.
  2791         SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
  2792         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2793         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
  2794         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
  2795         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
  2796         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
  2797         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
  2798         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
  2799         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
  2800         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
  2801         ;;
  2802     *-*-darwin* )
  2803         # This could be either full "Mac OS X", or plain "Darwin" which is
  2804         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2805         # Next line is broken, and a few files below require Mac OS X (full)
  2806         ARCH=macosx
  2807 
  2808         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2809         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2810         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2811 
  2812         CheckVisibilityHidden
  2813         CheckDummyVideo
  2814         CheckDiskAudio
  2815         CheckDummyAudio
  2816         CheckDLOPEN
  2817         CheckCOCOA
  2818         CheckX11
  2819         CheckMacGL
  2820         CheckOpenGLX11
  2821         CheckPTHREAD
  2822 
  2823         # Good optimization on Mac OS X, yes...
  2824         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2825 
  2826         # Need this or things might misbuild on a G3.
  2827         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2828 
  2829         # Set up files for the audio library
  2830         if test x$enable_audio = xyes; then
  2831             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  2832             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
  2833             have_audio=yes
  2834         fi
  2835         # Set up files for the joystick library
  2836         if test x$enable_joystick = xyes; then
  2837             AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  2838             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2839             have_joystick=yes
  2840         fi
  2841         # Set up files for the haptic library
  2842         if test x$enable_haptic = xyes; then
  2843             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  2844             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2845             have_haptic=yes
  2846             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2847         fi
  2848         # Set up files for the power library
  2849         if test x$enable_power = xyes; then
  2850             AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
  2851             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2852             have_power=yes
  2853         fi
  2854         # Set up files for the filesystem library
  2855         if test x$enable_filesystem = xyes; then
  2856             AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  2857             SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  2858             have_filesystem=yes
  2859         fi
  2860         # Set up files for the timer library
  2861         if test x$enable_timers = xyes; then
  2862             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  2863             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2864             have_timers=yes
  2865         fi
  2866         # Set up additional files for the file library
  2867         if test x$enable_file = xyes; then
  2868             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2869         fi
  2870         # The Mac OS X platform requires special setup.
  2871         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2872         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2873         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2874         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2875         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2876         # If audio is used, add the AudioUnit framework
  2877         if test x$enable_audio = xyes; then
  2878             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2879         fi
  2880         ;;
  2881     *)
  2882         AC_MSG_ERROR([
  2883 *** Unsupported host:  Please add to configure.in
  2884         ])
  2885         ;;
  2886 esac
  2887 
  2888 dnl Do this on all platforms, after everything else.
  2889 CheckWarnAll
  2890 
  2891 # Verify that we have all the platform specific files we need
  2892 
  2893 if test x$have_joystick != xyes; then
  2894     if test x$enable_joystick = xyes; then
  2895         AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
  2896     fi
  2897     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2898 fi
  2899 if test x$have_haptic != xyes; then
  2900     if test x$enable_haptic = xyes; then
  2901         AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
  2902     fi
  2903     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2904 fi
  2905 if test x$have_threads != xyes; then
  2906     if test x$enable_threads = xyes; then
  2907         AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  2908     fi
  2909     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2910 fi
  2911 if test x$have_timers != xyes; then
  2912     if test x$enable_timers = xyes; then
  2913         AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
  2914     fi
  2915     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2916 fi
  2917 if test x$have_filesystem != xyes; then
  2918     if test x$enable_filesystem = xyes; then
  2919         AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
  2920     fi
  2921     SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
  2922 fi
  2923 if test x$have_loadso != xyes; then
  2924     if test x$enable_loadso = xyes; then
  2925         AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
  2926     fi
  2927     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2928 fi
  2929 if test x$SDLMAIN_SOURCES = x; then
  2930     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2931 fi
  2932 SDLTEST_SOURCES="$srcdir/src/test/*.c"
  2933 
  2934 OBJECTS=`echo $SOURCES`
  2935 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  2936 for EXT in asm cc m c S; do
  2937     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2938     DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  2939 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  2940 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2941 done
  2942 
  2943 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2944 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2945 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2946 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  2947 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  2948 	\\$(WINDRES) \\$< \\$@,g"`
  2949 
  2950 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2951 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2952 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2953 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2954 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2955 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2956 
  2957 SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
  2958 SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
  2959 SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2960 SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2961 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2962 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2963 
  2964 # Set runtime shared library paths as needed
  2965 
  2966 if test "x$enable_rpath" = "xyes"; then
  2967   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
  2968     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2969   fi
  2970   if test $ARCH = solaris; then
  2971     SDL_RLD_FLAGS="-R\${libdir}"
  2972   fi
  2973 else
  2974   SDL_RLD_FLAGS=""
  2975 fi
  2976 
  2977 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2978 
  2979 dnl Expand the cflags and libraries needed by apps using SDL
  2980 AC_SUBST(SDL_CFLAGS)
  2981 AC_SUBST(SDL_LIBS)
  2982 AC_SUBST(SDL_STATIC_LIBS)
  2983 AC_SUBST(SDL_RLD_FLAGS)
  2984 if test x$enable_shared = xyes; then
  2985     ENABLE_SHARED_TRUE=
  2986     ENABLE_SHARED_FALSE="#"
  2987 else
  2988     ENABLE_SHARED_TRUE="#"
  2989     ENABLE_SHARED_FALSE=
  2990 fi
  2991 if test x$enable_static = xyes; then
  2992     ENABLE_STATIC_TRUE=
  2993     ENABLE_STATIC_FALSE="#"
  2994 else
  2995     ENABLE_STATIC_TRUE="#"
  2996     ENABLE_STATIC_FALSE=
  2997 fi
  2998 AC_SUBST(ENABLE_SHARED_TRUE)
  2999 AC_SUBST(ENABLE_SHARED_FALSE)
  3000 AC_SUBST(ENABLE_STATIC_TRUE)
  3001 AC_SUBST(ENABLE_STATIC_FALSE)
  3002 
  3003 dnl Expand the sources and objects needed to build the library
  3004 AC_SUBST(ac_aux_dir)
  3005 AC_SUBST(INCLUDE)
  3006 AC_SUBST(OBJECTS)
  3007 AC_SUBST(VERSION_OBJECTS)
  3008 AC_SUBST(SDLMAIN_OBJECTS)
  3009 AC_SUBST(SDLTEST_OBJECTS)
  3010 AC_SUBST(BUILD_CFLAGS)
  3011 AC_SUBST(EXTRA_CFLAGS)
  3012 AC_SUBST(BUILD_LDFLAGS)
  3013 AC_SUBST(EXTRA_LDFLAGS)
  3014 AC_SUBST(WINDRES)
  3015 
  3016 cat >Makefile.rules <<__EOF__
  3017 
  3018 # Build rules for objects
  3019 -include \$(OBJECTS:.lo=.d)
  3020 
  3021 # Special dependency for SDL.c, since it depends on SDL_revision.h
  3022 $srcdir/src/SDL.c: update-revision
  3023 $DEPENDS
  3024 $VERSION_DEPENDS
  3025 $SDLMAIN_DEPENDS
  3026 $SDLTEST_DEPENDS
  3027 __EOF__
  3028 
  3029 AC_CONFIG_FILES([
  3030     Makefile:Makefile.in:Makefile.rules sdl2-config SDL2.spec sdl2.pc
  3031 ])
  3032 AC_OUTPUT
  3033 chmod a+x sdl2-config