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