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