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