configure.in
author Ryan C. Gordon <icculus@icculus.org>
Sun, 24 Nov 2013 21:15:58 -0500
changeset 8087 f9912ddfe17b
parent 8082 5b83ad3f01ac
child 8089 de8b6fdf6544
permissions -rw-r--r--
Don't use -falign-loops=16 on Mac OS X anymore.

It isn't available in Clang at all, and was more important on PowerPC.
     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 acos asin 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 dnl Check for Wayland
  1119 CheckWayland()
  1120 {
  1121     AC_ARG_ENABLE(video-wayland,
  1122 AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]),
  1123                   ,enable_video_wayland=yes)
  1124 
  1125     AC_ARG_ENABLE(video-wayland-qt-touch,
  1126 AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]),
  1127                   ,enable_video_wayland_qt_touch=yes)
  1128 
  1129     if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
  1130         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1131         AC_MSG_CHECKING(for Wayland support)
  1132         video_wayland=no
  1133         if test x$PKG_CONFIG != xno; then
  1134             if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
  1135                 WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
  1136                 WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
  1137                 video_wayland=yes
  1138             fi
  1139         fi
  1140         AC_MSG_RESULT($video_wayland)
  1141 
  1142         if test x$video_wayland = xyes; then
  1143             AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
  1144             if test x$enable_video_wayland_qt_touch = xyes; then
  1145                 AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
  1146             fi
  1147             SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
  1148             EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
  1149             dnl FIXME do dynamic loading code here.
  1150             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
  1151             have_video=yes
  1152         fi
  1153     fi
  1154 }
  1155 
  1156 dnl Find the X11 include and library directories
  1157 CheckX11()
  1158 {
  1159 
  1160 
  1161     AC_ARG_ENABLE(video-x11,
  1162 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
  1163                   , enable_video_x11=yes)
  1164     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1165         case "$host" in
  1166             *-*-darwin*)
  1167                 # This isn't necessary for X11, but fixes GLX detection
  1168                 if test "x$x_includes" = xNONE && \
  1169                    test "x$x_libraries" = xNONE && \
  1170                    test -d /usr/X11R6/include && \
  1171                    test -d /usr/X11R6/lib; then
  1172                     x_includes="/usr/X11R6/include"
  1173                     x_libraries="/usr/X11R6/lib"
  1174                 fi
  1175                 ;;
  1176         esac
  1177         AC_PATH_X
  1178         AC_PATH_XTRA
  1179         if test x$have_x = xyes; then
  1180             AC_ARG_ENABLE(x11-shared,
  1181 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
  1182                           , enable_x11_shared=maybe)
  1183 
  1184             case "$host" in
  1185                 *-*-darwin*)
  1186                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
  1187                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
  1188                     xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
  1189                     xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
  1190                     xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1191                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1192                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1193                     xss_lib='/usr/X11R6/lib/libXss.1.dylib'
  1194                     xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
  1195                     ;;
  1196                 *-*-openbsd*)
  1197                     x11_lib='libX11.so'
  1198                     x11ext_lib='libXext.so'
  1199                     xcursor_lib='libXcursor.so'
  1200                     xinerama_lib='libXinerama.so'
  1201                     xinput_lib='libXi.so'
  1202                     xrandr_lib='libXrandr.so'
  1203                     xrender_lib='libXrender.so'
  1204                     xss_lib='libXss.so'
  1205                     xvidmode_lib='libXxf86vm.so'
  1206                     ;;
  1207                 *)
  1208                     x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1209                     x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1210                     xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1211                     xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1212                     xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1213                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1214                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1215                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1216                     xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1217                     ;;
  1218             esac
  1219 
  1220             if test x$ac_cv_func_shmat != xyes; then
  1221                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1222             fi
  1223             CFLAGS="$CFLAGS $X_CFLAGS"
  1224             LDFLAGS="$LDFLAGS $X_LIBS"
  1225 
  1226             AC_CHECK_HEADER(X11/extensions/Xext.h,
  1227                             have_xext_h_hdr=yes,
  1228                             have_xext_h_hdr=no,
  1229                             [#include <X11/Xlib.h>
  1230                              #include <X11/Xproto.h>
  1231                             ])
  1232             if test x$have_xext_h_hdr != xyes; then
  1233                AC_MSG_ERROR([
  1234 *** Missing Xext.h, maybe you need to install the libxext-dev package?
  1235                ])
  1236             fi
  1237 
  1238             AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
  1239             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1240             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1241 
  1242             # Needed so SDL applications can include SDL_syswm.h
  1243             SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
  1244 
  1245             if test x$enable_x11_shared = xmaybe; then
  1246                 enable_x11_shared=yes
  1247             fi
  1248             if test x$have_loadso != xyes && \
  1249                test x$enable_x11_shared = xyes; then
  1250                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1251                 enable_x11_shared=no
  1252             fi
  1253             if test x$have_loadso = xyes && \
  1254                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1255                 echo "-- dynamic libX11 -> $x11_lib"
  1256                 echo "-- dynamic libX11ext -> $x11ext_lib"
  1257                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
  1258                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
  1259             else
  1260                 enable_x11_shared=no
  1261                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1262             fi
  1263             have_video=yes
  1264 
  1265             AC_MSG_CHECKING(for const parameter to XextAddDisplay)
  1266             have_const_param_XextAddDisplay=no
  1267             AC_TRY_COMPILE([
  1268               #include <X11/Xlib.h>
  1269               #include <X11/Xproto.h>
  1270               #include <X11/extensions/Xext.h>
  1271               #include <X11/extensions/extutil.h>
  1272               extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
  1273             ],[
  1274             ],[
  1275             have_const_param_XextAddDisplay=yes
  1276             AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY)
  1277             ])
  1278             AC_MSG_RESULT($have_const_param_XextAddDisplay)
  1279 
  1280             AC_MSG_CHECKING(for const parameter to _XData32)
  1281 	    have_const_param_xdata32=no
  1282 	    AC_TRY_COMPILE([
  1283 	      #include <X11/Xlibint.h>
  1284 	      extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
  1285 	    ],[
  1286 	    ],[
  1287 	    have_const_param_xdata32=yes
  1288 	    AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32)
  1289 	    ])
  1290 	    AC_MSG_RESULT($have_const_param_xdata32)
  1291 
  1292             dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
  1293             AC_MSG_CHECKING([for XGenericEvent])
  1294             have_XGenericEvent=no
  1295             AC_TRY_COMPILE([
  1296               	#include <X11/Xlib.h>
  1297             ],[
  1298 Display *display;
  1299 XEvent event;
  1300 XGenericEventCookie *cookie = &event.xcookie;
  1301 XNextEvent(display, &event);
  1302 XGetEventData(display, cookie);
  1303 XFreeEventData(display, cookie);
  1304             ],[
  1305                 have_XGenericEvent=yes
  1306                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
  1307             ])
  1308             AC_MSG_RESULT($have_XGenericEvent)
  1309 
  1310             AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
  1311 
  1312             AC_ARG_ENABLE(video-x11-xcursor,
  1313 AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
  1314                             , enable_video_x11_xcursor=yes)
  1315             if test x$enable_video_x11_xcursor = xyes; then
  1316                 definitely_enable_video_x11_xcursor=no
  1317                 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
  1318                                 have_xcursor_h_hdr=yes,
  1319                                 have_xcursor_h_hdr=no,
  1320                                 [#include <X11/Xlib.h>
  1321                                 ])
  1322                 if test x$have_xcursor_h_hdr = xyes; then
  1323                     if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
  1324                         echo "-- dynamic libXcursor -> $xcursor_lib"
  1325                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
  1326                         definitely_enable_video_x11_xcursor=yes
  1327                     else
  1328                         AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
  1329                         if test x$have_xcursor_lib = xyes ; then
  1330                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
  1331                             definitely_enable_video_x11_xcursor=yes
  1332                         fi
  1333                     fi
  1334                 fi
  1335             fi
  1336             if test x$definitely_enable_video_x11_xcursor = xyes; then
  1337                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
  1338             fi
  1339             AC_ARG_ENABLE(video-x11-xinerama,
  1340 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1341                             , enable_video_x11_xinerama=yes)
  1342             if test x$enable_video_x11_xinerama = xyes; then
  1343                 definitely_enable_video_x11_xinerama=no
  1344                 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
  1345                                 have_xinerama_h_hdr=yes,
  1346                                 have_xinerama_h_hdr=no,
  1347                                 [#include <X11/Xlib.h>
  1348                                 ])
  1349                 if test x$have_xinerama_h_hdr = xyes; then
  1350                     if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
  1351                         echo "-- dynamic libXinerama -> $xinerama_lib"
  1352                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
  1353                         definitely_enable_video_x11_xinerama=yes
  1354                     else
  1355                         AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
  1356                         if test x$have_xinerama_lib = xyes ; then
  1357                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
  1358                             definitely_enable_video_x11_xinerama=yes
  1359                         fi
  1360                     fi
  1361                 fi
  1362             fi
  1363             if test x$definitely_enable_video_x11_xinerama = xyes; then
  1364                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
  1365             fi
  1366             AC_ARG_ENABLE(video-x11-xinput,
  1367 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1368                             , enable_video_x11_xinput=yes)
  1369             if test x$enable_video_x11_xinput = xyes; then
  1370                 definitely_enable_video_x11_xinput=no
  1371                 AC_CHECK_HEADER(X11/extensions/XInput2.h,
  1372                                 have_xinput_h_hdr=yes,
  1373                                 have_xinput_h_hdr=no,
  1374                                 [#include <X11/Xlib.h>
  1375                                 ])
  1376                 if test x$have_xinput_h_hdr = xyes; then
  1377                     if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1378                         echo "-- dynamic libXi -> $xinput_lib"
  1379                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
  1380                         definitely_enable_video_x11_xinput=yes
  1381                     else
  1382                         AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1383                         if test x$have_xinput_lib = xyes ; then
  1384                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1385                             definitely_enable_video_x11_xinput=yes
  1386                         fi
  1387                     fi
  1388                 fi
  1389             fi
  1390             if test x$definitely_enable_video_x11_xinput = xyes; then
  1391                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
  1392                 AC_MSG_CHECKING(for xinput2 multitouch)
  1393             	have_xinput2_multitouch=no
  1394             	AC_TRY_COMPILE([
  1395               		#include <X11/Xlib.h>
  1396              		#include <X11/Xproto.h>
  1397 			#include <X11/extensions/XInput2.h>
  1398             	],[
  1399 int event_type = XI_TouchBegin;
  1400 XITouchClassInfo *t;
  1401 Status 
  1402 XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f)
  1403 {
  1404     return (Status)0;
  1405 }
  1406             	],[
  1407             	have_xinput2_multitouch=yes
  1408             	AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
  1409             	])
  1410             	AC_MSG_RESULT($have_xinput2_multitouch)
  1411             fi
  1412             AC_ARG_ENABLE(video-x11-xrandr,
  1413 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1414                             , enable_video_x11_xrandr=yes)
  1415             if test x$enable_video_x11_xrandr = xyes; then
  1416                 definitely_enable_video_x11_xrandr=no
  1417                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1418                                 have_xrandr_h_hdr=yes,
  1419                                 have_xrandr_h_hdr=no,
  1420                                 [#include <X11/Xlib.h>
  1421                                 ])
  1422                 if test x$have_xrandr_h_hdr = xyes; then
  1423                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1424                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1425                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
  1426                         definitely_enable_video_x11_xrandr=yes
  1427                     else
  1428                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1429                         if test x$have_xrandr_lib = xyes ; then
  1430                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1431                             definitely_enable_video_x11_xrandr=yes
  1432                         fi
  1433                     fi
  1434                 fi
  1435             fi
  1436             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1437                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
  1438             fi
  1439             AC_ARG_ENABLE(video-x11-scrnsaver,
  1440 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1441                             , enable_video_x11_scrnsaver=yes)
  1442             if test x$enable_video_x11_scrnsaver = xyes; then
  1443                 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1444                                 have_scrnsaver_h_hdr=yes,
  1445                                 have_scrnsaver_h_hdr=no,
  1446                                 [#include <X11/Xlib.h>
  1447                                 ])
  1448                 if test x$have_scrnsaver_h_hdr = xyes; then
  1449                     if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1450                         echo "-- dynamic libXss -> $xss_lib"
  1451                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
  1452                         definitely_enable_video_x11_scrnsaver=yes
  1453                     else
  1454                         AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1455                         if test x$have_xss_lib = xyes ; then
  1456                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1457                             definitely_enable_video_x11_scrnsaver=yes
  1458                         fi
  1459                     fi
  1460                 fi
  1461             fi
  1462             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1463                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
  1464             fi
  1465             AC_ARG_ENABLE(video-x11-xshape,
  1466 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
  1467                             , enable_video_x11_xshape=yes)
  1468             if test x$enable_video_x11_xshape = xyes; then
  1469                 AC_CHECK_HEADER(X11/extensions/shape.h,
  1470                                 have_shape_h_hdr=yes,
  1471                                 have_shape_h_hdr=no,
  1472                                 [#include <X11/Xlib.h>
  1473                                 ])
  1474                 if test x$have_shape_h_hdr = xyes; then
  1475                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
  1476                 fi
  1477             fi
  1478             AC_ARG_ENABLE(video-x11-vm,
  1479 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1480                             , enable_video_x11_vm=yes)
  1481             if test x$enable_video_x11_vm = xyes; then
  1482                 definitely_enable_video_x11_vm=no
  1483                 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
  1484                                 have_vm_h_hdr=yes,
  1485                                 have_vm_h_hdr=no,
  1486                                 [#include <X11/Xlib.h>
  1487                                 ])
  1488                 if test x$have_vm_h_hdr = xyes; then
  1489                     if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
  1490                         echo "-- dynamic libXxf86vm -> $xvidmode_lib"
  1491                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
  1492                         definitely_enable_video_x11_vm=yes
  1493                     else
  1494                         AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
  1495                         if test x$have_vm_lib = xyes ; then
  1496                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
  1497                             definitely_enable_video_x11_vm=yes
  1498                         fi
  1499                     fi
  1500                 fi
  1501             fi
  1502             if test x$definitely_enable_video_x11_vm = xyes; then
  1503                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
  1504             fi
  1505         fi
  1506     fi
  1507 }
  1508 
  1509 dnl Set up the Haiku video driver if enabled
  1510 CheckHaikuVideo()
  1511 {
  1512     if test x$enable_video = xyes; then
  1513         AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
  1514         SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
  1515         have_video=yes
  1516     fi
  1517 }
  1518 
  1519 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1520 CheckCOCOA()
  1521 {
  1522     AC_ARG_ENABLE(video-cocoa,
  1523 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1524                   , enable_video_cocoa=yes)
  1525     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1526         save_CFLAGS="$CFLAGS"
  1527         dnl work around that we don't have Objective-C support in autoconf
  1528         CFLAGS="$CFLAGS -x objective-c"
  1529         AC_MSG_CHECKING(for Cocoa framework)
  1530         have_cocoa=no
  1531         AC_TRY_COMPILE([
  1532           #import <Cocoa/Cocoa.h>
  1533         ],[
  1534         ],[
  1535         have_cocoa=yes
  1536         ])
  1537         AC_MSG_RESULT($have_cocoa)
  1538         CFLAGS="$save_CFLAGS"
  1539         if test x$have_cocoa = xyes; then
  1540             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
  1541             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1542             have_video=yes
  1543         fi
  1544     fi
  1545 }
  1546 
  1547 dnl Find DirectFB
  1548 CheckDirectFB()
  1549 {
  1550     AC_ARG_ENABLE(video-directfb,
  1551 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  1552                   , enable_video_directfb=no)
  1553     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1554         video_directfb=no
  1555 
  1556         DIRECTFB_REQUIRED_VERSION=1.0.0
  1557         AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
  1558         if test x$DIRECTFBCONFIG = xno; then
  1559             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1560             if test x$PKG_CONFIG != xno; then
  1561                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1562                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1563                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1564                     DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
  1565                     video_directfb=yes
  1566                 fi
  1567             fi
  1568         else
  1569             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1570             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1571             set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
  1572             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1573             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1574                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1575                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1576                 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
  1577                 video_directfb=yes
  1578             fi
  1579         fi
  1580         if test x$video_directfb = xyes; then
  1581             # SuSE 11.1 installs directfb-config without directfb-devel
  1582             save_CPPFLAGS="$CPPFLAGS"
  1583             CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  1584             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1585             CPPFLAGS="$save_CPPFLAGS"
  1586             video_directfb=$have_directfb_hdr
  1587         fi
  1588         AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1589         AC_MSG_RESULT($video_directfb)
  1590 
  1591         if test x$video_directfb = xyes; then
  1592             AC_ARG_ENABLE(directfb-shared,
  1593 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  1594                               , enable_directfb_shared=yes)
  1595 
  1596             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
  1597             AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
  1598             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1599             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1600 
  1601             AC_MSG_CHECKING(for directfb dynamic loading support)
  1602             directfb_shared=no
  1603             directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
  1604             # | sed 's/.*\/\(.*\)/\1/; q'`]
  1605 AC_MSG_WARN("directfb $directfb_lib")
  1606             if test x$have_loadso != xyes && \
  1607                test x$enable_directfb_shared = xyes; then
  1608                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1609             fi
  1610             if test x$have_loadso = xyes && \
  1611                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1612                 directfb_shared=yes
  1613                 echo "-- $directfb_lib_spec -> $directfb_lib"
  1614                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
  1615             else
  1616                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1617             fi
  1618             AC_MSG_RESULT($directfb_shared)
  1619             have_video=yes
  1620         fi
  1621     fi
  1622 }
  1623 
  1624 dnl Find FusionSound
  1625 CheckFusionSound()
  1626 {
  1627     AC_ARG_ENABLE(fusionsound,
  1628 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1629                   , enable_fusionsound=no)
  1630     if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1631         fusionsound=no
  1632 
  1633         FUSIONSOUND_REQUIRED_VERSION=1.1.1
  1634 
  1635         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1636         AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
  1637         if test x$PKG_CONFIG != xno; then
  1638             if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
  1639                 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
  1640                 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
  1641                 fusionsound=yes
  1642             fi
  1643         fi
  1644         AC_MSG_RESULT($fusionsound)
  1645 
  1646         if test x$fusionsound = xyes; then
  1647             AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
  1648             SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1649             EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1650             
  1651             AC_ARG_ENABLE(fusionsound-shared,
  1652 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1653                           , enable_fusionsound_shared=yes)
  1654             fusionsound_shared=no
  1655             AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1656             if test x$have_loadso != xyes && \
  1657                test x$enable_fusionsound_shared = xyes; then
  1658                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1659             fi
  1660             if test x$have_loadso = xyes && \
  1661                test x$enable_fusionsound_shared = xyes; then
  1662                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
  1663                 fusionsound_shared=yes
  1664             else
  1665                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1666             fi
  1667             AC_MSG_RESULT($fusionsound_shared)
  1668             
  1669             have_audio=yes
  1670         fi
  1671     fi
  1672 }
  1673 
  1674 dnl rcg04172001 Set up the Null video driver.
  1675 CheckDummyVideo()
  1676 {
  1677     AC_ARG_ENABLE(video-dummy,
  1678 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1679                   , enable_video_dummy=yes)
  1680     if test x$enable_video_dummy = xyes; then
  1681         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
  1682         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1683         have_video=yes
  1684     fi
  1685 }
  1686 
  1687 dnl Check to see if OpenGL support is desired
  1688 AC_ARG_ENABLE(video-opengl,
  1689 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1690               , enable_video_opengl=yes)
  1691 
  1692 dnl Find OpenGL
  1693 CheckOpenGLX11()
  1694 {
  1695     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1696         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1697         video_opengl=no
  1698         AC_TRY_COMPILE([
  1699          #include <GL/gl.h>
  1700          #include <GL/glx.h>
  1701         ],[
  1702         ],[
  1703         video_opengl=yes
  1704         ])
  1705         AC_MSG_RESULT($video_opengl)
  1706         if test x$video_opengl = xyes; then
  1707             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1708             AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
  1709             AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1710         fi
  1711     fi
  1712 }
  1713 
  1714 dnl Check to see if OpenGL ES support is desired
  1715 AC_ARG_ENABLE(video-opengles,
  1716 AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
  1717               , enable_video_opengles=yes)
  1718 
  1719 dnl Find OpenGL ES
  1720 CheckOpenGLESX11()
  1721 {
  1722     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1723         AC_MSG_CHECKING(for EGL support)
  1724         video_opengl_egl=no
  1725         AC_TRY_COMPILE([
  1726          #include <EGL/egl.h>
  1727         ],[
  1728         ],[
  1729         video_opengl_egl=yes
  1730         ])
  1731         AC_MSG_RESULT($video_opengl_egl)
  1732         if test x$video_opengl_egl = xyes; then
  1733             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1734         fi
  1735             
  1736         AC_MSG_CHECKING(for OpenGL ES v1 headers)
  1737         video_opengles_v1=no
  1738         AC_TRY_COMPILE([
  1739          #include <GLES/gl.h>
  1740          #include <GLES/glext.h>
  1741         ],[
  1742         ],[
  1743         video_opengles_v1=yes
  1744         ])
  1745         AC_MSG_RESULT($video_opengles_v1)
  1746         if test x$video_opengles_v1 = xyes; then
  1747             AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  1748             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  1749         fi
  1750         
  1751         AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1752         video_opengles_v2=no
  1753         AC_TRY_COMPILE([
  1754          #include <GLES2/gl2.h>
  1755          #include <GLES2/gl2ext.h>
  1756         ],[
  1757         ],[
  1758         video_opengles_v2=yes
  1759         ])
  1760         AC_MSG_RESULT($video_opengles_v2)
  1761         if test x$video_opengles_v2 = xyes; then
  1762             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1763             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1764         fi
  1765     fi
  1766 }
  1767 
  1768 dnl Check for Windows OpenGL
  1769 CheckWINDOWSGL()
  1770 {
  1771     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1772         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1773         AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
  1774         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1775     fi
  1776 }
  1777 
  1778 dnl Check for Windows OpenGL
  1779 CheckWINDOWSGLES()
  1780 {
  1781     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1782 
  1783         AC_MSG_CHECKING(for EGL support)
  1784         video_opengl_egl=no
  1785         AC_TRY_COMPILE([
  1786          #include <EGL/egl.h>
  1787         ],[
  1788         ],[
  1789         video_opengl_egl=yes
  1790         ])
  1791         AC_MSG_RESULT($video_opengl_egl)
  1792         if test x$video_opengl_egl = xyes; then
  1793             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1794             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1795         fi
  1796        
  1797         AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1798         video_opengles_v2=no
  1799         AC_TRY_COMPILE([
  1800          #include <GLES2/gl2.h>
  1801          #include <GLES2/gl2ext.h>
  1802         ],[
  1803         ],[
  1804         video_opengles_v2=yes
  1805         ])
  1806         AC_MSG_RESULT($video_opengles_v2)
  1807         if test x$video_opengles_v2 = xyes; then
  1808             AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1809             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1810             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1811         fi
  1812     fi
  1813 }
  1814 
  1815 dnl Check for Haiku OpenGL
  1816 CheckHaikuGL()
  1817 {
  1818     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1819         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1820         AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
  1821         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1822         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1823     fi
  1824 }
  1825 
  1826 dnl Check for MacOS OpenGL
  1827 CheckMacGL()
  1828 {
  1829     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1830         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1831         AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
  1832         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1833         case "$host" in
  1834             *-*-darwin*)
  1835                 if test x$enable_video_cocoa = xyes; then
  1836                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1837                 fi
  1838         esac
  1839     fi
  1840 }
  1841 
  1842 dnl See if we can use the new unified event interface in Linux 2.4
  1843 CheckInputEvents()
  1844 {
  1845     dnl Check for Linux 2.4 unified input event interface support
  1846         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1847         use_input_events=no
  1848         AC_TRY_COMPILE([
  1849           #include <linux/input.h>
  1850         ],[
  1851           #ifndef EVIOCGNAME
  1852           #error EVIOCGNAME() ioctl not available
  1853           #endif
  1854         ],[
  1855         use_input_events=yes
  1856         ])
  1857         AC_MSG_RESULT($use_input_events)
  1858         if test x$use_input_events = xyes; then
  1859             AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
  1860         fi
  1861 }
  1862 
  1863 dnl See if we can use the kernel kd.h header
  1864 CheckInputKD()
  1865 {
  1866 
  1867     AC_MSG_CHECKING(for Linux kd.h)
  1868     use_input_kd=no
  1869     AC_TRY_COMPILE([
  1870       #include <linux/kd.h>
  1871       #include <linux/keyboard.h>
  1872     ],[
  1873         struct kbentry kbe;
  1874         kbe.kb_table = KG_CTRL;
  1875         ioctl(0, KDGKBENT, &kbe);
  1876     ],[
  1877     use_input_kd=yes
  1878     ])
  1879     AC_MSG_RESULT($use_input_kd)
  1880     if test x$use_input_kd = xyes; then
  1881         AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
  1882     fi
  1883 }
  1884 
  1885 dnl See if the platform offers libudev for device enumeration and hotplugging.
  1886 CheckLibUDev()
  1887 {
  1888     AC_ARG_ENABLE(libudev,
  1889 AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
  1890                         , enable_libudev=yes)
  1891     if test x$enable_libudev = xyes; then
  1892         AC_CHECK_HEADER(libudev.h,
  1893                         have_libudev_h_hdr=yes,
  1894                         have_libudev_h_hdr=no)
  1895         if test x$have_libudev_h_hdr = xyes; then
  1896             AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
  1897         fi
  1898     fi
  1899 }
  1900 
  1901 dnl See if the platform offers libdbus for various IPC techniques.
  1902 CheckDBus()
  1903 {
  1904     AC_ARG_ENABLE(dbus,
  1905 AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
  1906                         , enable_dbus=yes)
  1907     if test x$enable_dbus = xyes; then
  1908         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1909         if test x$PKG_CONFIG != xno; then
  1910             DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
  1911             save_CFLAGS="$CFLAGS"
  1912             CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
  1913             AC_CHECK_HEADER(dbus/dbus.h,
  1914                             have_dbus_dbus_h_hdr=yes,
  1915                             have_dbus_dbus_h_hdr=no)
  1916             CFLAGS="$save_CFLAGS"
  1917             if test x$have_dbus_dbus_h_hdr = xyes; then
  1918                 AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
  1919                 EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
  1920             fi
  1921         fi
  1922     fi
  1923 }
  1924 
  1925 dnl See if we can use the Touchscreen input library
  1926 CheckTslib()
  1927 {
  1928     AC_ARG_ENABLE(input-tslib,
  1929 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1930                   , enable_input_tslib=yes)
  1931     if test x$enable_input_tslib = xyes; then
  1932         AC_MSG_CHECKING(for Touchscreen library support)
  1933         enable_input_tslib=no
  1934         AC_TRY_COMPILE([
  1935           #include "tslib.h"
  1936         ],[
  1937         ],[
  1938         enable_input_tslib=yes
  1939         ])
  1940         AC_MSG_RESULT($enable_input_tslib)
  1941         if test x$enable_input_tslib = xyes; then
  1942             AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
  1943             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1944         fi
  1945     fi
  1946 }
  1947 
  1948 dnl See what type of thread model to use on Linux and Solaris
  1949 CheckPTHREAD()
  1950 {
  1951     dnl Check for pthread support
  1952     AC_ARG_ENABLE(pthreads,
  1953 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1954                   , enable_pthreads=yes)
  1955     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1956     AC_ARG_ENABLE(pthread-sem,
  1957 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1958                   , enable_pthread_sem=yes)
  1959     case "$host" in
  1960         *-*-linux*|*-*-uclinux*)
  1961             pthread_cflags="-D_REENTRANT"
  1962             pthread_lib="-lpthread"
  1963             ;;
  1964         *-*-bsdi*)
  1965             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1966             pthread_lib=""
  1967             ;;
  1968         *-*-darwin*)
  1969             pthread_cflags="-D_THREAD_SAFE"
  1970 # causes Carbon.p complaints?
  1971 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1972             ;;
  1973         *-*-freebsd*|*-*-dragonfly*)
  1974             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1975             pthread_lib="-pthread"
  1976             ;;
  1977         *-*-netbsd*)
  1978             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1979             pthread_lib="-lpthread"
  1980             ;;
  1981         *-*-openbsd*)
  1982             pthread_cflags="-D_REENTRANT"
  1983             pthread_lib="-pthread"
  1984             ;;
  1985         *-*-solaris2.9)
  1986             # From Solaris 9+, posix4's preferred name is rt.
  1987             pthread_cflags="-D_REENTRANT"
  1988             pthread_lib="-lpthread -lrt"
  1989             ;;
  1990         *-*-solaris2.10)
  1991             # Solaris 10+ merged pthread into libc.
  1992             pthread_cflags="-D_REENTRANT"
  1993             pthread_lib="-lrt"
  1994             ;;
  1995         *-*-solaris*)
  1996             # Solaris 11+ merged rt into libc.
  1997             pthread_cflags="-D_REENTRANT"
  1998             pthread_lib=""
  1999             ;;
  2000         *-*-sysv5*)
  2001             pthread_cflags="-D_REENTRANT -Kthread"
  2002             pthread_lib=""
  2003             ;;
  2004         *-*-aix*)
  2005             pthread_cflags="-D_REENTRANT -mthreads"
  2006             pthread_lib="-lpthread"
  2007             ;;
  2008         *-*-hpux11*)
  2009             pthread_cflags="-D_REENTRANT"
  2010             pthread_lib="-L/usr/lib -lpthread"
  2011             ;;
  2012         *-*-haiku*)
  2013             pthread_cflags="-D_REENTRANT"
  2014             pthread_lib=""
  2015             ;;
  2016         *)
  2017             pthread_cflags="-D_REENTRANT"
  2018             pthread_lib="-lpthread"
  2019             ;;
  2020     esac
  2021     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  2022         # Save the original compiler flags and libraries
  2023         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  2024         # Add the pthread compiler flags and libraries
  2025         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  2026         # Check to see if we have pthread support on this system
  2027         AC_MSG_CHECKING(for pthreads)
  2028         use_pthreads=no
  2029         AC_TRY_LINK([
  2030          #include <pthread.h>
  2031         ],[
  2032          pthread_attr_t type;
  2033          pthread_attr_init(&type);
  2034         ],[
  2035         use_pthreads=yes
  2036         ])
  2037         AC_MSG_RESULT($use_pthreads)
  2038         # Restore the compiler flags and libraries
  2039         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2040 
  2041         # Do futher testing if we have pthread support...
  2042         if test x$use_pthreads = xyes; then
  2043             AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
  2044             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  2045             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  2046             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  2047             SDL_LIBS="$SDL_LIBS $pthread_lib"
  2048 
  2049             # Save the original compiler flags and libraries
  2050             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  2051             # Add the pthread compiler flags and libraries
  2052             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  2053 
  2054             # Check to see if recursive mutexes are available
  2055             AC_MSG_CHECKING(for recursive mutexes)
  2056             has_recursive_mutexes=no
  2057             if test x$has_recursive_mutexes = xno; then
  2058                 AC_TRY_COMPILE([
  2059                   #include <pthread.h>
  2060                 ],[
  2061                   pthread_mutexattr_t attr;
  2062                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  2063                 ],[
  2064                 has_recursive_mutexes=yes
  2065                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
  2066                 ])
  2067             fi
  2068             if test x$has_recursive_mutexes = xno; then
  2069                 AC_TRY_COMPILE([
  2070                   #include <pthread.h>
  2071                 ],[
  2072                   pthread_mutexattr_t attr;
  2073                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  2074                 ],[
  2075                 has_recursive_mutexes=yes
  2076                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
  2077                 ])
  2078             fi
  2079             AC_MSG_RESULT($has_recursive_mutexes)
  2080 
  2081             # Check to see if pthread semaphore support is missing
  2082             if test x$enable_pthread_sem = xyes; then
  2083                 AC_MSG_CHECKING(for pthread semaphores)
  2084                 have_pthread_sem=no
  2085                 AC_TRY_COMPILE([
  2086                   #include <pthread.h>
  2087                   #include <semaphore.h>
  2088                 ],[
  2089                 ],[
  2090                 have_pthread_sem=yes
  2091                 ])
  2092                 AC_MSG_RESULT($have_pthread_sem)
  2093             fi
  2094             if test x$have_pthread_sem = xyes; then
  2095                 AC_MSG_CHECKING(for sem_timedwait)
  2096                 have_sem_timedwait=no
  2097                 AC_TRY_LINK([
  2098                   #include <pthread.h>
  2099                   #include <semaphore.h>
  2100                 ],[
  2101                   sem_timedwait(NULL, NULL);
  2102                 ],[
  2103                 have_sem_timedwait=yes
  2104                 AC_DEFINE(HAVE_SEM_TIMEDWAIT)
  2105                 ])
  2106                 AC_MSG_RESULT($have_sem_timedwait)
  2107             fi
  2108 
  2109             AC_MSG_CHECKING(for pthread_spin_trylock)
  2110             AC_TRY_LINK_FUNC(pthread_spin_trylock, [
  2111               has_pthread_spin_trylock=yes
  2112               AC_DEFINE(HAVE_PTHREAD_SPINLOCK, 1, [ ])
  2113             ],[
  2114               has_pthread_spin_trylock=no
  2115             ])
  2116             AC_MSG_RESULT($has_pthread_spin_trylock)
  2117 
  2118             AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
  2119             if test x$have_pthread_np_h = xyes; then
  2120                 AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
  2121             fi
  2122 
  2123             # Check to see if pthread naming is available
  2124             AC_MSG_CHECKING(for pthread_setname_np)
  2125             AC_TRY_LINK_FUNC(pthread_setname_np, [
  2126               has_pthread_setname_np=yes
  2127               AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
  2128             ],[
  2129               has_pthread_setname_np=no
  2130             ])
  2131             AC_MSG_RESULT($has_pthread_setname_np)
  2132 
  2133             AC_MSG_CHECKING(for pthread_set_name_np)
  2134             AC_TRY_LINK_FUNC(pthread_set_name_np, [
  2135               has_pthread_set_name_np=yes
  2136               AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
  2137             ],[
  2138               has_pthread_set_name_np=no
  2139             ])
  2140             AC_MSG_RESULT($has_pthread_set_name_np)
  2141 
  2142             # Restore the compiler flags and libraries
  2143             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2144 
  2145             # Basic thread creation functions
  2146             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  2147 
  2148             # Semaphores
  2149             # We can fake these with mutexes and condition variables if necessary
  2150             if test x$have_pthread_sem = xyes; then
  2151                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  2152             else
  2153                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  2154             fi
  2155 
  2156             # Mutexes
  2157             # We can fake these with semaphores if necessary
  2158             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  2159 
  2160             # Condition variables
  2161             # We can fake these with semaphores and mutexes if necessary
  2162             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  2163 
  2164             # Thread local storage
  2165             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
  2166 
  2167             have_threads=yes
  2168         fi
  2169     fi
  2170 }
  2171 
  2172 dnl Determine whether the compiler can produce Windows executables
  2173 CheckWINDOWS()
  2174 {
  2175     AC_MSG_CHECKING(Windows compiler)
  2176     have_win32_gcc=no
  2177     AC_TRY_COMPILE([
  2178      #include <windows.h>
  2179     ],[
  2180     ],[
  2181     have_win32_gcc=yes
  2182     ])
  2183     AC_MSG_RESULT($have_win32_gcc)
  2184     if test x$have_win32_gcc != xyes; then
  2185        AC_MSG_ERROR([
  2186 *** Your compiler ($CC) does not produce Windows executables!
  2187        ])
  2188     fi
  2189 
  2190     AC_MSG_CHECKING(Windows CE)
  2191     have_wince=no
  2192     AC_TRY_COMPILE([
  2193 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  2194 #error This is not Windows CE
  2195 #endif
  2196     ],[
  2197     ],[
  2198     have_wince=yes
  2199        AC_MSG_ERROR([
  2200 *** Sorry, Windows CE is no longer supported.
  2201        ])
  2202     ])
  2203     AC_MSG_RESULT($have_wince)
  2204 
  2205     # This fixes Windows stack alignment with newer GCC
  2206     CheckStackBoundary
  2207 }
  2208 
  2209 dnl Find the DirectX includes and libraries
  2210 CheckDIRECTX()
  2211 {
  2212     AC_ARG_ENABLE(directx,
  2213 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
  2214                   , enable_directx=yes)
  2215     if test x$enable_directx = xyes; then
  2216         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  2217         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  2218         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  2219         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  2220         AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
  2221 
  2222         # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
  2223         # FIXME:  ...so force it off for now.
  2224         case "$host" in
  2225             *-*-cygwin*)
  2226             have_dinput=false
  2227             ;;
  2228         esac
  2229     fi
  2230 }
  2231 
  2232 dnl Check for the dlfcn.h interface for dynamically loading objects
  2233 CheckDLOPEN()
  2234 {
  2235     AC_ARG_ENABLE(sdl-dlopen,
  2236 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  2237                   , enable_sdl_dlopen=yes)
  2238     if test x$enable_sdl_dlopen = xyes; then
  2239         AC_MSG_CHECKING(for dlopen)
  2240         have_dlopen=no
  2241         AC_TRY_COMPILE([
  2242          #include <dlfcn.h>
  2243         ],[
  2244          void *handle = dlopen("", RTLD_NOW);
  2245          const char *loaderror = (char *) dlerror();
  2246         ],[
  2247         have_dlopen=yes
  2248         ])
  2249         AC_MSG_RESULT($have_dlopen)
  2250 
  2251         if test x$have_dlopen = xyes; then
  2252             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  2253                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  2254                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  2255             AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
  2256             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  2257             have_loadso=yes
  2258         fi
  2259     fi
  2260 }
  2261 
  2262 dnl Check for the usbhid(3) library on *BSD
  2263 CheckUSBHID()
  2264 {
  2265     case "$host" in
  2266         *-*-*bsd*)
  2267             if test x$enable_joystick = xyes; then
  2268                 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  2269                 if test x$have_libusbhid = xyes; then
  2270                     AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  2271                     AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  2272                     USB_LIBS="$USB_LIBS -lusbhid"
  2273                 else
  2274                     AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  2275                     AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  2276                     AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  2277                 fi
  2278                     
  2279                 save_CFLAGS="$CFLAGS"
  2280                 CFLAGS="$CFLAGS $USB_CFLAGS"
  2281 
  2282                 AC_MSG_CHECKING(for usbhid)
  2283                 have_usbhid=no
  2284                 AC_TRY_COMPILE([
  2285                   #include <sys/types.h>
  2286                   #if defined(HAVE_USB_H)
  2287                   #include <usb.h>
  2288                   #endif
  2289                   #ifdef __DragonFly__
  2290                   # include <bus/usb/usb.h>
  2291                   # include <bus/usb/usbhid.h>
  2292                   #else
  2293                   # include <dev/usb/usb.h>
  2294                   # include <dev/usb/usbhid.h>
  2295                   #endif
  2296                   #if defined(HAVE_USBHID_H)
  2297                   #include <usbhid.h>
  2298                   #elif defined(HAVE_LIBUSB_H)
  2299                   #include <libusb.h>
  2300                   #elif defined(HAVE_LIBUSBHID_H)
  2301                   #include <libusbhid.h>
  2302                   #endif
  2303                 ],[
  2304                   struct report_desc *repdesc;
  2305                   struct usb_ctl_report *repbuf;
  2306                   hid_kind_t hidkind;
  2307                 ],[
  2308                 have_usbhid=yes
  2309                 ])
  2310                 AC_MSG_RESULT($have_usbhid)
  2311 
  2312                 if test x$have_usbhid = xyes; then
  2313                     AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2314                     have_usbhid_ucr_data=no
  2315                     AC_TRY_COMPILE([
  2316                       #include <sys/types.h>
  2317                       #if defined(HAVE_USB_H)
  2318                       #include <usb.h>
  2319                       #endif
  2320                       #ifdef __DragonFly__
  2321                       # include <bus/usb/usb.h>
  2322                       # include <bus/usb/usbhid.h>
  2323                       #else
  2324                       # include <dev/usb/usb.h>
  2325                       # include <dev/usb/usbhid.h>
  2326                       #endif
  2327                       #if defined(HAVE_USBHID_H)
  2328                       #include <usbhid.h>
  2329                       #elif defined(HAVE_LIBUSB_H)
  2330                       #include <libusb.h>
  2331                       #elif defined(HAVE_LIBUSBHID_H)
  2332                       #include <libusbhid.h>
  2333                       #endif
  2334                     ],[
  2335                       struct usb_ctl_report buf;
  2336                       if (buf.ucr_data) { }
  2337                     ],[
  2338                     have_usbhid_ucr_data=yes
  2339                     ])
  2340                     if test x$have_usbhid_ucr_data = xyes; then
  2341                         USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2342                     fi
  2343                     AC_MSG_RESULT($have_usbhid_ucr_data)
  2344                     
  2345                     AC_MSG_CHECKING(for new usbhid API)
  2346                     have_usbhid_new=no
  2347                     AC_TRY_COMPILE([
  2348                       #include <sys/types.h>
  2349                       #if defined(HAVE_USB_H)
  2350                       #include <usb.h>
  2351                       #endif
  2352                       #ifdef __DragonFly__
  2353                       #include <bus/usb/usb.h>
  2354                       #include <bus/usb/usbhid.h>
  2355                       #else
  2356                       #include <dev/usb/usb.h>
  2357                       #include <dev/usb/usbhid.h>
  2358                       #endif
  2359                       #if defined(HAVE_USBHID_H)
  2360                       #include <usbhid.h>
  2361                       #elif defined(HAVE_LIBUSB_H)
  2362                       #include <libusb.h>
  2363                       #elif defined(HAVE_LIBUSBHID_H)
  2364                       #include <libusbhid.h>
  2365                       #endif
  2366                     ],[
  2367                       report_desc_t d;
  2368                       hid_start_parse(d, 1, 1);
  2369                     ],[
  2370                     have_usbhid_new=yes
  2371                     ])
  2372                     if test x$have_usbhid_new = xyes; then
  2373                         USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2374                     fi
  2375                     AC_MSG_RESULT($have_usbhid_new)
  2376 
  2377                     AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2378                     have_machine_joystick=no
  2379                     AC_TRY_COMPILE([
  2380                       #include <machine/joystick.h>
  2381                     ],[
  2382                       struct joystick t;
  2383                     ],[
  2384                     have_machine_joystick=yes
  2385                     ])
  2386                     if test x$have_machine_joystick = xyes; then
  2387                         AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
  2388                     fi
  2389                     AC_MSG_RESULT($have_machine_joystick)
  2390 
  2391                     AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
  2392                     SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2393                     EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2394                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2395                     have_joystick=yes
  2396                 fi
  2397                 CFLAGS="$save_CFLAGS"
  2398             fi
  2399         ;;
  2400     esac
  2401 }
  2402 
  2403 dnl Check for clock_gettime()
  2404 CheckClockGettime()
  2405 {
  2406     AC_ARG_ENABLE(clock_gettime,
  2407 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
  2408                   , enable_clock_gettime=yes)
  2409     if test x$enable_clock_gettime = xyes; then
  2410         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2411         if test x$have_clock_gettime = xyes; then
  2412             AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  2413             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2414         else
  2415             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  2416             if test x$have_clock_gettime = xyes; then
  2417                AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  2418                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  2419             fi
  2420         fi
  2421     fi
  2422 }
  2423 
  2424 dnl Check for a valid linux/version.h
  2425 CheckLinuxVersion()
  2426 {
  2427     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2428     if test x$have_linux_version_h = xyes; then
  2429         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2430     fi
  2431 }
  2432 
  2433 dnl Check if we want to use RPATH
  2434 CheckRPATH()
  2435 {
  2436     AC_ARG_ENABLE(rpath,
  2437 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2438                   , enable_rpath=yes)
  2439 }
  2440 
  2441 dnl Set up the configuration based on the host platform!
  2442 case "$host" in
  2443     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
  2444         case "$host" in
  2445             *-raspberry-linux*)
  2446                 # Raspberry Pi
  2447                 ARCH=linux
  2448                 RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
  2449                 CFLAGS="$CFLAGS $RPI_CFLAGS"
  2450                 SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
  2451                 EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
  2452                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl"
  2453 
  2454                 if test x$enable_video = xyes; then
  2455                     SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
  2456                     $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
  2457                 fi
  2458                 ;;
  2459             *-*-linux*)         ARCH=linux ;;
  2460             *-*-uclinux*)       ARCH=linux ;;
  2461             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2462             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2463             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2464             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2465             *-*-bsdi*)          ARCH=bsdi ;;
  2466             *-*-freebsd*)       ARCH=freebsd ;;
  2467             *-*-dragonfly*)     ARCH=freebsd ;;
  2468             *-*-netbsd*)        ARCH=netbsd ;;
  2469             *-*-openbsd*)       ARCH=openbsd ;;
  2470             *-*-sysv5*)         ARCH=sysv5 ;;
  2471             *-*-solaris*)       ARCH=solaris ;;
  2472             *-*-hpux*)          ARCH=hpux ;;
  2473             *-*-aix*)           ARCH=aix ;;
  2474             *-*-minix*)         ARCH=minix ;;
  2475         esac
  2476         CheckVisibilityHidden
  2477         CheckDummyVideo
  2478         CheckDiskAudio
  2479         CheckDummyAudio
  2480         CheckDLOPEN
  2481         CheckOSS
  2482         CheckALSA
  2483         CheckPulseAudio
  2484         CheckARTSC
  2485         CheckESD
  2486         CheckNAS
  2487         CheckSNDIO
  2488         CheckX11
  2489         CheckWayland
  2490         CheckDirectFB
  2491         CheckFusionSound
  2492         CheckOpenGLX11
  2493         CheckOpenGLESX11
  2494         CheckLibUDev
  2495         CheckDBus
  2496         CheckInputEvents
  2497         CheckInputKD
  2498         CheckTslib
  2499         CheckUSBHID
  2500         CheckPTHREAD
  2501         CheckClockGettime
  2502         CheckLinuxVersion
  2503         CheckRPATH
  2504         # Set up files for the audio library
  2505         if test x$enable_audio = xyes; then
  2506           case $ARCH in
  2507             sysv5|solaris|hpux)
  2508                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
  2509                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2510                 have_audio=yes
  2511             ;;
  2512             netbsd)  # Don't use this on OpenBSD, it's busted.
  2513                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ])
  2514                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2515                 have_audio=yes
  2516             ;;
  2517             aix)
  2518                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
  2519                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2520                 have_audio=yes
  2521             ;;
  2522           esac
  2523         fi
  2524         # Set up files for the joystick library
  2525         if test x$enable_joystick = xyes; then
  2526           case $ARCH in
  2527             linux)
  2528                 AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
  2529                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2530                 have_joystick=yes
  2531             ;;
  2532           esac
  2533         fi
  2534         # Set up files for the haptic library
  2535         if test x$enable_haptic = xyes; then
  2536            if test x$use_input_events = xyes; then
  2537              case $ARCH in
  2538                linux)
  2539                    AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
  2540                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2541                    have_haptic=yes
  2542                ;;
  2543              esac
  2544            fi
  2545         fi
  2546         # Set up files for the power library
  2547         if test x$enable_power = xyes; then
  2548              case $ARCH in
  2549                linux)
  2550                    AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
  2551                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2552                    have_power=yes
  2553                ;;
  2554              esac
  2555         fi
  2556         # Set up files for the filesystem library
  2557         if test x$enable_filesystem = xyes; then
  2558             AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
  2559             SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
  2560             have_filesystem=yes
  2561         fi
  2562         # Set up files for the timer library
  2563         if test x$enable_timers = xyes; then
  2564             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  2565             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2566             have_timers=yes
  2567         fi
  2568         # Set up files for udev hotplugging support
  2569         if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
  2570             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"               
  2571         fi
  2572         # Set up files for evdev input
  2573         if test x$use_input_events = xyes; then
  2574             SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c"
  2575         fi       
  2576         ;;
  2577     *-*-cygwin* | *-*-mingw32*)
  2578         ARCH=win32
  2579         if test "$build" != "$host"; then # cross-compiling
  2580             # Default cross-compile location
  2581             ac_default_prefix=/usr/local/cross-tools/$host
  2582         else
  2583             # Look for the location of the tools and install there
  2584             if test "$BUILD_PREFIX" != ""; then
  2585                 ac_default_prefix=$BUILD_PREFIX
  2586             fi
  2587         fi
  2588         CheckDummyVideo
  2589         CheckDiskAudio
  2590         CheckDummyAudio
  2591         CheckWINDOWS
  2592         CheckWINDOWSGL
  2593         CheckWINDOWSGLES
  2594         CheckDIRECTX
  2595 
  2596         # Set up the core platform files
  2597         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  2598 
  2599         # Set up files for the video library
  2600         if test x$enable_video = xyes; then
  2601             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
  2602             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  2603             have_video=yes
  2604             AC_ARG_ENABLE(render-d3d,
  2605 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2606                                 , enable_render_d3d=yes)
  2607             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2608                 AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
  2609             fi
  2610         fi
  2611         # Set up files for the audio library
  2612         if test x$enable_audio = xyes; then
  2613             AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
  2614             SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
  2615             if test x$have_dsound = xyes; then
  2616                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
  2617                 SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
  2618             fi
  2619             if test x$have_xaudio2 = xyes; then
  2620                 AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
  2621                 SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
  2622             fi
  2623             have_audio=yes
  2624         fi
  2625         # Set up files for the joystick library
  2626         if test x$enable_joystick = xyes; then
  2627             if test x$have_dinput = xyes; then
  2628                 AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
  2629                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
  2630                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  2631             else
  2632                 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
  2633                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
  2634             fi
  2635             have_joystick=yes
  2636         fi
  2637         if test x$enable_haptic = xyes; then
  2638             if test x$have_dinput = xyes; then
  2639                 AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
  2640                 SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
  2641                 have_haptic=yes
  2642             fi
  2643         fi
  2644         if test x$enable_power = xyes; then
  2645             AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
  2646             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2647             have_power=yes
  2648         fi
  2649         if test x$enable_filesystem = xyes; then
  2650             AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
  2651             SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
  2652             have_filesystem=yes
  2653         fi
  2654         # Set up files for the thread library
  2655         if test x$enable_threads = xyes; then
  2656             AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
  2657             SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
  2658             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2659             have_threads=yes
  2660         fi
  2661         # Set up files for the timer library
  2662         if test x$enable_timers = xyes; then
  2663             AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
  2664             SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  2665             have_timers=yes
  2666         fi
  2667         # Set up files for the shared object loading library
  2668         if test x$enable_loadso = xyes; then
  2669             AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
  2670             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  2671             have_loadso=yes
  2672         fi
  2673         # Set up the system libraries we need
  2674         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
  2675         # The Windows platform requires special setup
  2676         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  2677         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  2678         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2679         SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
  2680 
  2681         # Check to see if this is a mingw or cygwin build
  2682         have_mingw32=
  2683         AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
  2684         if test x$have_mingw32 = xyes; then
  2685             SDL_LIBS="-lmingw32 $SDL_LIBS"
  2686         else
  2687             SDL_LIBS="-lcygwin $SDL_LIBS"
  2688         fi
  2689         ;;
  2690 
  2691     dnl BeOS support removed after SDL 2.0.1. Haiku still works.  --ryan.
  2692     *-*-beos*)
  2693         AC_MSG_ERROR([
  2694 *** BeOS support has been removed as of SDL 2.0.2.
  2695         ])
  2696         ;;
  2697 
  2698     *-*-haiku*)
  2699         ARCH=haiku
  2700         ac_default_prefix=/boot/system
  2701         CheckDummyVideo
  2702         CheckDiskAudio
  2703         CheckDummyAudio
  2704         CheckHaikuVideo
  2705         CheckHaikuGL
  2706         CheckPTHREAD
  2707 
  2708         # Set up files for the audio library
  2709         if test x$enable_audio = xyes; then
  2710             AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
  2711             SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
  2712             have_audio=yes
  2713         fi
  2714         # Set up files for the joystick library
  2715         if test x$enable_joystick = xyes; then
  2716             AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
  2717             SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
  2718             have_joystick=yes
  2719         fi
  2720         # Set up files for the timer library
  2721         if test x$enable_timers = xyes; then
  2722             AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
  2723             SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
  2724             have_timers=yes
  2725         fi
  2726         # Set up files for the shared object loading library
  2727         if test x$enable_loadso = xyes; then
  2728             AC_DEFINE(SDL_LOADSO_HAIKU, 1, [ ])
  2729             SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c"
  2730             have_loadso=yes
  2731         fi
  2732         # Set up files for the system power library
  2733         if test x$enable_power = xyes; then
  2734             AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
  2735             SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
  2736             have_power=yes
  2737         fi
  2738         # Set up files for the system filesystem library
  2739         if test x$enable_filesystem = xyes; then
  2740             AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
  2741             SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
  2742             have_filesystem=yes
  2743         fi
  2744         # The Haiku platform requires special setup.
  2745         SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
  2746         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2747         ;;
  2748     arm*-apple-darwin*)
  2749         # iOS - We are not writing anything to confdefs.h because you have to replace
  2750         # SDL_config.h for SDL_config_iphoneos.h anyway
  2751         ARCH=ios
  2752 
  2753         CheckVisibilityHidden
  2754         CheckDummyVideo
  2755         CheckDiskAudio
  2756         CheckDummyAudio
  2757         CheckDLOPEN
  2758         CheckCOCOA
  2759         CheckPTHREAD
  2760 
  2761 
  2762         # Set up files for the audio library
  2763         if test x$enable_audio = xyes; then
  2764             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
  2765             have_audio=yes
  2766         fi
  2767         # Set up files for the joystick library
  2768         if test x$enable_joystick = xyes; then
  2769             SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  2770             have_joystick=yes
  2771         fi
  2772         # Set up files for the haptic library
  2773         #if test x$enable_haptic = xyes; then
  2774         #    SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2775         #    have_haptic=yes
  2776         #    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2777         #fi
  2778         # Set up files for the power library
  2779         if test x$enable_power = xyes; then
  2780             SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
  2781             have_power=yes
  2782         fi
  2783         # Set up files for the filesystem library
  2784         if test x$enable_filesystem = xyes; then
  2785             SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  2786             have_filesystem=yes
  2787         fi
  2788         # Set up files for the timer library
  2789         if test x$enable_timers = xyes; then
  2790             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2791             have_timers=yes
  2792         fi
  2793         # Set up additional files for the file library
  2794         if test x$enable_file = xyes; then
  2795             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2796         fi
  2797         # The iOS platform requires special setup.
  2798         SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
  2799         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2800         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
  2801         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
  2802         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
  2803         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
  2804         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
  2805         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
  2806         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
  2807         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
  2808         ;;
  2809     *-*-darwin* )
  2810         # This could be either full "Mac OS X", or plain "Darwin" which is
  2811         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2812         # Next line is broken, and a few files below require Mac OS X (full)
  2813         ARCH=macosx
  2814 
  2815         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2816         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2817         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2818 
  2819         CheckVisibilityHidden
  2820         CheckDummyVideo
  2821         CheckDiskAudio
  2822         CheckDummyAudio
  2823         CheckDLOPEN
  2824         CheckCOCOA
  2825         CheckX11
  2826         CheckMacGL
  2827         CheckOpenGLX11
  2828         CheckPTHREAD
  2829 
  2830         # Need this or things might misbuild on a G3.
  2831         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2832 
  2833         # Set up files for the audio library
  2834         if test x$enable_audio = xyes; then
  2835             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  2836             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
  2837             have_audio=yes
  2838         fi
  2839         # Set up files for the joystick library
  2840         if test x$enable_joystick = xyes; then
  2841             AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  2842             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2843             have_joystick=yes
  2844         fi
  2845         # Set up files for the haptic library
  2846         if test x$enable_haptic = xyes; then
  2847             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  2848             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2849             have_haptic=yes
  2850             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2851         fi
  2852         # Set up files for the power library
  2853         if test x$enable_power = xyes; then
  2854             AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
  2855             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2856             have_power=yes
  2857         fi
  2858         # Set up files for the filesystem library
  2859         if test x$enable_filesystem = xyes; then
  2860             AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  2861             SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  2862             have_filesystem=yes
  2863         fi
  2864         # Set up files for the timer library
  2865         if test x$enable_timers = xyes; then
  2866             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  2867             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2868             have_timers=yes
  2869         fi
  2870         # Set up additional files for the file library
  2871         if test x$enable_file = xyes; then
  2872             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2873         fi
  2874         # The Mac OS X platform requires special setup.
  2875         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2876         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2877         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2878         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2879         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2880         # If audio is used, add the AudioUnit framework
  2881         if test x$enable_audio = xyes; then
  2882             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2883         fi
  2884         ;;
  2885     *)
  2886         AC_MSG_ERROR([
  2887 *** Unsupported host:  Please add to configure.in
  2888         ])
  2889         ;;
  2890 esac
  2891 
  2892 dnl Do this on all platforms, after everything else.
  2893 CheckWarnAll
  2894 
  2895 # Verify that we have all the platform specific files we need
  2896 
  2897 if test x$have_joystick != xyes; then
  2898     if test x$enable_joystick = xyes; then
  2899         AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
  2900     fi
  2901     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2902 fi
  2903 if test x$have_haptic != xyes; then
  2904     if test x$enable_haptic = xyes; then
  2905         AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
  2906     fi
  2907     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2908 fi
  2909 if test x$have_threads != xyes; then
  2910     if test x$enable_threads = xyes; then
  2911         AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  2912     fi
  2913     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2914 fi
  2915 if test x$have_timers != xyes; then
  2916     if test x$enable_timers = xyes; then
  2917         AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
  2918     fi
  2919     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2920 fi
  2921 if test x$have_filesystem != xyes; then
  2922     if test x$enable_filesystem = xyes; then
  2923         AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
  2924     fi
  2925     SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
  2926 fi
  2927 if test x$have_loadso != xyes; then
  2928     if test x$enable_loadso = xyes; then
  2929         AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
  2930     fi
  2931     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2932 fi
  2933 if test x$SDLMAIN_SOURCES = x; then
  2934     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2935 fi
  2936 SDLTEST_SOURCES="$srcdir/src/test/*.c"
  2937 
  2938 OBJECTS=`echo $SOURCES`
  2939 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  2940 for EXT in asm cc m c S; do
  2941     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2942     DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  2943 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  2944 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2945 done
  2946 
  2947 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2948 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2949 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2950 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  2951 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  2952 	\\$(WINDRES) \\$< \\$@,g"`
  2953 
  2954 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2955 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2956 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2957 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2958 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2959 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2960 
  2961 SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
  2962 SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
  2963 SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2964 SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2965 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2966 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2967 
  2968 # Set runtime shared library paths as needed
  2969 
  2970 if test "x$enable_rpath" = "xyes"; then
  2971   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
  2972     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2973   fi
  2974   if test $ARCH = solaris; then
  2975     SDL_RLD_FLAGS="-R\${libdir}"
  2976   fi
  2977 else
  2978   SDL_RLD_FLAGS=""
  2979 fi
  2980 
  2981 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2982 
  2983 dnl Expand the cflags and libraries needed by apps using SDL
  2984 AC_SUBST(SDL_CFLAGS)
  2985 AC_SUBST(SDL_LIBS)
  2986 AC_SUBST(SDL_STATIC_LIBS)
  2987 AC_SUBST(SDL_RLD_FLAGS)
  2988 if test x$enable_shared = xyes; then
  2989     ENABLE_SHARED_TRUE=
  2990     ENABLE_SHARED_FALSE="#"
  2991 else
  2992     ENABLE_SHARED_TRUE="#"
  2993     ENABLE_SHARED_FALSE=
  2994 fi
  2995 if test x$enable_static = xyes; then
  2996     ENABLE_STATIC_TRUE=
  2997     ENABLE_STATIC_FALSE="#"
  2998 else
  2999     ENABLE_STATIC_TRUE="#"
  3000     ENABLE_STATIC_FALSE=
  3001 fi
  3002 AC_SUBST(ENABLE_SHARED_TRUE)
  3003 AC_SUBST(ENABLE_SHARED_FALSE)
  3004 AC_SUBST(ENABLE_STATIC_TRUE)
  3005 AC_SUBST(ENABLE_STATIC_FALSE)
  3006 
  3007 dnl Expand the sources and objects needed to build the library
  3008 AC_SUBST(ac_aux_dir)
  3009 AC_SUBST(INCLUDE)
  3010 AC_SUBST(OBJECTS)
  3011 AC_SUBST(VERSION_OBJECTS)
  3012 AC_SUBST(SDLMAIN_OBJECTS)
  3013 AC_SUBST(SDLTEST_OBJECTS)
  3014 AC_SUBST(BUILD_CFLAGS)
  3015 AC_SUBST(EXTRA_CFLAGS)
  3016 AC_SUBST(BUILD_LDFLAGS)
  3017 AC_SUBST(EXTRA_LDFLAGS)
  3018 AC_SUBST(WINDRES)
  3019 
  3020 cat >Makefile.rules <<__EOF__
  3021 
  3022 # Build rules for objects
  3023 -include \$(OBJECTS:.lo=.d)
  3024 
  3025 # Special dependency for SDL.c, since it depends on SDL_revision.h
  3026 $srcdir/src/SDL.c: update-revision
  3027 $DEPENDS
  3028 $VERSION_DEPENDS
  3029 $SDLMAIN_DEPENDS
  3030 $SDLTEST_DEPENDS
  3031 __EOF__
  3032 
  3033 AC_CONFIG_FILES([
  3034     Makefile:Makefile.in:Makefile.rules sdl2-config SDL2.spec sdl2.pc
  3035 ])
  3036 AC_OUTPUT
  3037 chmod a+x sdl2-config