configure.in
author David Ludwig <dludwig@pobox.com>
Wed, 25 Dec 2013 21:39:48 -0500
changeset 8563 c0e68f3b6bbb
parent 8022 7396e3cc5337
child 8056 abd9434c5d3e
permissions -rw-r--r--
WinRT: compiled the d3d11 renderer's shaders into SDL itself

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