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