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