configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 11 Nov 2013 22:43:05 -0800
changeset 7965 d3cbe8ecb1af
parent 7811 9dfcc6bad831
child 7977 5272ae8fccd7
permissions -rw-r--r--
Fixed assertion when quickly toggling from fullscreen back to fullscreen:
"Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'backgroundWindows not nil in enterFullScreenTransitionWithOptions:animated:activatingIt:'"

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