configure.in
author Ryan C. Gordon <icculus@icculus.org>
Tue, 19 Nov 2013 15:00:39 -0500
changeset 8016 3746af784462
parent 8007 f4264c673a8d
child 8022 7396e3cc5337
permissions -rw-r--r--
-fvisibility=hidden is no longer a requirement for dynamic X11.

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