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