configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 27 Feb 2011 22:22:58 -0800
changeset 5407 40c9d744e595
parent 5389 24903690f48a
child 5408 35a63789c3f2
permissions -rw-r--r--
Fixed compiling AltiVec blitters
     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                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1099                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1100                     xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1101                     xss_lib='/usr/X11R6/lib/libXss.6.dylib'
  1102                     xdamage_lib='/usr/X11R6/lib/libXdamage.1.dylib'
  1103                     xfixes_lib='/usr/X11R6/lib/libXfixes.3.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                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1117                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1118                     xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1119                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1120                     xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1121                     xfixes_lib=[`find_lib "libXfixes.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-vm,
  1162 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1163                           , enable_video_x11_vm=yes)
  1164             if test x$enable_video_x11_vm = xyes; then
  1165                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
  1166                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
  1167             fi
  1168             AC_ARG_ENABLE(video-x11-xv,
  1169 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
  1170                           , enable_video_x11_xv=yes)
  1171             if test x$enable_video_x11_xv = xyes; then
  1172                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
  1173                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
  1174             fi
  1175             AC_ARG_ENABLE(video-x11-xinerama,
  1176 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1177                             , enable_video_x11_xinerama=yes)
  1178             if test x$enable_video_x11_xinerama = xyes; then
  1179                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
  1180                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
  1181             fi
  1182             AC_ARG_ENABLE(video-x11-xshape,
  1183 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
  1184                             , enable_video_x11_xshape=yes)
  1185             if test x$enable_video_x11_xshape = xyes; then
  1186                 AC_CHECK_HEADER(X11/extensions/shape.h,
  1187                                 have_shape_h_hdr=yes,
  1188                                 have_shape_h_hdr=no,
  1189                                 [#include <X11/Xlib.h>
  1190                                 ])
  1191                 if test x$have_shape_h_hdr = xyes; then
  1192                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE)
  1193                 fi
  1194             fi
  1195             AC_ARG_ENABLE(video-x11-xrandr,
  1196 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1197                             , enable_video_x11_xrandr=yes)
  1198             if test x$enable_video_x11_xrandr = xyes; then
  1199                 definitely_enable_video_x11_xrandr=no
  1200                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1201                                 have_xrandr_h_hdr=yes,
  1202                                 have_xrandr_h_hdr=no,
  1203                                 [#include <X11/Xlib.h>
  1204                                 ])
  1205                 if test x$have_xrandr_h_hdr = xyes; then
  1206                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1207                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1208                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
  1209                         definitely_enable_video_x11_xrandr=yes
  1210                     else
  1211                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1212                         if test x$have_xrandr_lib = xyes ; then
  1213                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1214                             definitely_enable_video_x11_xrandr=yes
  1215                         fi
  1216                     fi
  1217                 fi
  1218             fi
  1219             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1220                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
  1221             fi
  1222             AC_ARG_ENABLE(video-x11-xinput,
  1223 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1224                             , enable_video_x11_xinput=yes)
  1225             if test x$enable_video_x11_xinput = xyes; then
  1226                 definitely_enable_video_x11_xinput=no
  1227                 AC_CHECK_HEADER(X11/extensions/XInput.h,
  1228                                 have_xinput_h_hdr=yes,
  1229                                 have_xinput_h_hdr=no,
  1230                                 [#include <X11/Xlib.h>
  1231                                 ])
  1232                 if test x$have_xinput_h_hdr = xyes; then
  1233                     if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1234                         echo "-- dynamic libXi -> $xinput_lib"
  1235                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
  1236                         definitely_enable_video_x11_xinput=yes
  1237                     else
  1238                         AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1239                         if test x$have_xinput_lib = xyes ; then
  1240                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1241                             definitely_enable_video_x11_xinput=yes
  1242                         fi
  1243                     fi
  1244                 fi
  1245             fi
  1246             if test x$definitely_enable_video_x11_xinput = xyes; then
  1247                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
  1248             fi
  1249             AC_ARG_ENABLE(video-x11-scrnsaver,
  1250 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1251                             , enable_video_x11_scrnsaver=yes)
  1252             if test x$enable_video_x11_scrnsaver = xyes; then
  1253                 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1254                                 have_scrnsaver_h_hdr=yes,
  1255                                 have_scrnsaver_h_hdr=no,
  1256                                 [#include <X11/Xlib.h>
  1257                                 ])
  1258                 if test x$have_scrnsaver_h_hdr = xyes; then
  1259                     if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1260                         echo "-- dynamic libXss -> $xss_lib"
  1261                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
  1262                         definitely_enable_video_x11_scrnsaver=yes
  1263                     else
  1264                         AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1265                         if test x$have_xss_lib = xyes ; then
  1266                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1267                             definitely_enable_video_x11_scrnsaver=yes
  1268                         fi
  1269                     fi
  1270                 fi
  1271             fi
  1272             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1273                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
  1274             fi
  1275         fi
  1276     fi
  1277 }
  1278 
  1279 dnl Set up the BWindow video driver if enabled
  1280 CheckBWINDOW()
  1281 {
  1282     if test x$enable_video = xyes; then
  1283         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
  1284         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
  1285         have_video=yes
  1286     fi
  1287 }
  1288 
  1289 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1290 CheckCOCOA()
  1291 {
  1292     AC_ARG_ENABLE(video-cocoa,
  1293 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1294                   , enable_video_cocoa=yes)
  1295     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1296         save_CFLAGS="$CFLAGS"
  1297         dnl work around that we don't have Objective-C support in autoconf
  1298         CFLAGS="$CFLAGS -x objective-c"
  1299         AC_MSG_CHECKING(for Cocoa framework)
  1300         have_cocoa=no
  1301         AC_TRY_COMPILE([
  1302           #import <Cocoa/Cocoa.h>
  1303         ],[
  1304         ],[
  1305         have_cocoa=yes
  1306         ])
  1307         AC_MSG_RESULT($have_cocoa)
  1308         CFLAGS="$save_CFLAGS"
  1309         if test x$have_cocoa = xyes; then
  1310             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
  1311             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1312             have_video=yes
  1313         fi
  1314     fi
  1315 }
  1316 
  1317 dnl Find DirectFB
  1318 CheckDirectFB()
  1319 {
  1320     AC_ARG_ENABLE(video-directfb,
  1321 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  1322                   , enable_video_directfb=no)
  1323     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1324         video_directfb=no
  1325 
  1326         DIRECTFB_REQUIRED_VERSION=1.0.0
  1327         AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
  1328         if test x$DIRECTFBCONFIG = xno; then
  1329             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1330             if test x$PKG_CONFIG != xno; then
  1331                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1332                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1333                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1334                     DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
  1335                     video_directfb=yes
  1336                 fi
  1337             fi
  1338         else
  1339             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1340             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1341             set -- `directfb-config --version | sed 's/\./ /g'`
  1342             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1343             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1344                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1345                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1346                 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
  1347                 video_directfb=yes
  1348             fi
  1349         fi
  1350         if test x$video_directfb = xyes; then
  1351             # SuSE 11.1 installs directfb-config without directfb-devel
  1352             save_CPPFLAGS="$CPPFLAGS"
  1353             CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  1354             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1355             CPPFLAGS="$save_CPPFLAGS"
  1356             video_directfb=$have_directfb_hdr
  1357         fi
  1358         AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1359         AC_MSG_RESULT($video_directfb)
  1360 
  1361         if test x$video_directfb = xyes; then
  1362             AC_ARG_ENABLE(directfb-shared,
  1363 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  1364                               , enable_directfb_shared=yes)
  1365 
  1366             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1367             AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB)
  1368             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1369             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1370 
  1371             AC_MSG_CHECKING(for directfb dynamic loading support)
  1372             directfb_shared=no
  1373             directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
  1374             # | sed 's/.*\/\(.*\)/\1/; q'`]
  1375 AC_MSG_WARN("directfb $directfb_lib")
  1376             if test x$have_loadso != xyes && \
  1377                test x$enable_directfb_shared = xyes; then
  1378                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1379             fi
  1380             if test x$have_loadso = xyes && \
  1381                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1382                 directfb_shared=yes
  1383                 echo "-- $directfb_lib_spec -> $directfb_lib"
  1384                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
  1385             else
  1386                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1387             fi
  1388             AC_MSG_RESULT($directfb_shared)
  1389             have_video=yes
  1390         fi
  1391     fi
  1392 }
  1393 
  1394 dnl Find FusionSound
  1395 CheckFusionSound()
  1396 {
  1397     AC_ARG_ENABLE(fusionsound,
  1398 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1399                   , enable_fusionsound=no)
  1400     if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1401         fusionsound=no
  1402 
  1403         FUSIONSOUND_REQUIRED_VERSION=1.1.1
  1404 
  1405         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1406         AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
  1407         if test x$PKG_CONFIG != xno; then
  1408             if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
  1409                 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
  1410                 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
  1411                 fusionsound=yes
  1412             fi
  1413         fi
  1414         AC_MSG_RESULT($fusionsound)
  1415 
  1416         if test x$fusionsound = xyes; then
  1417             AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
  1418             SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1419             EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1420             
  1421             AC_ARG_ENABLE(fusionsound-shared,
  1422 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1423                           , enable_fusionsound_shared=yes)
  1424             fusionsound_shared=no
  1425             AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1426             if test x$have_loadso != xyes && \
  1427                test x$enable_fusionsound_shared = xyes; then
  1428                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1429             fi
  1430             if test x$have_loadso = xyes && \
  1431                test x$enable_fusionsound_shared = xyes; then
  1432                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
  1433                 fusionsound_shared=yes
  1434             else
  1435                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1436             fi
  1437             AC_MSG_RESULT($fusionsound_shared)
  1438             
  1439             have_audio=yes
  1440         fi
  1441     fi
  1442 }
  1443 
  1444 dnl rcg04172001 Set up the Null video driver.
  1445 CheckDummyVideo()
  1446 {
  1447     AC_ARG_ENABLE(video-dummy,
  1448 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1449                   , enable_video_dummy=yes)
  1450     if test x$enable_video_dummy = xyes; then
  1451         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1452         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1453         have_video=yes
  1454     fi
  1455 }
  1456 
  1457 dnl Check to see if OpenGL support is desired
  1458 AC_ARG_ENABLE(video-opengl,
  1459 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1460               , enable_video_opengl=yes)
  1461 
  1462 dnl Find OpenGL
  1463 CheckOpenGLX11()
  1464 {
  1465     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1466         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1467         video_opengl=no
  1468         AC_TRY_COMPILE([
  1469          #include <GL/gl.h>
  1470          #include <GL/glx.h>
  1471         ],[
  1472         ],[
  1473         video_opengl=yes
  1474         ])
  1475         AC_MSG_RESULT($video_opengl)
  1476         if test x$video_opengl = xyes; then
  1477             AC_DEFINE(SDL_VIDEO_OPENGL)
  1478             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1479             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1480         fi
  1481     fi
  1482 }
  1483 
  1484 dnl Check for Windows OpenGL
  1485 CheckWINDOWSGL()
  1486 {
  1487     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1488         AC_DEFINE(SDL_VIDEO_OPENGL)
  1489         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1490         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1491     fi
  1492 }
  1493 
  1494 dnl Check for BeOS OpenGL
  1495 CheckBeGL()
  1496 {
  1497     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1498         AC_DEFINE(SDL_VIDEO_OPENGL)
  1499         AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
  1500         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1501         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1502     fi
  1503 }
  1504 
  1505 dnl Check for MacOS OpenGL
  1506 CheckMacGL()
  1507 {
  1508     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1509         AC_DEFINE(SDL_VIDEO_OPENGL)
  1510         AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
  1511         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1512         case "$host" in
  1513             *-*-darwin*)
  1514                 if test x$enable_video_cocoa = xyes; then
  1515                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1516                 fi
  1517         esac
  1518     fi
  1519 }
  1520 
  1521 dnl See if we can use the new unified event interface in Linux 2.4
  1522 CheckInputEvents()
  1523 {
  1524     dnl Check for Linux 2.4 unified input event interface support
  1525     AC_ARG_ENABLE(input-events,
  1526 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1527                   , enable_input_events=yes)
  1528     if test x$enable_input_events = xyes; then
  1529         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1530         use_input_events=no
  1531         AC_TRY_COMPILE([
  1532           #include <linux/input.h>
  1533         ],[
  1534           #ifndef EVIOCGNAME
  1535           #error EVIOCGNAME() ioctl not available
  1536           #endif
  1537         ],[
  1538         use_input_events=yes
  1539         ])
  1540         AC_MSG_RESULT($use_input_events)
  1541         if test x$use_input_events = xyes; then
  1542             AC_DEFINE(SDL_INPUT_LINUXEV)
  1543         fi
  1544     fi
  1545 }
  1546 
  1547 dnl See if we can use the Touchscreen input library
  1548 CheckTslib()
  1549 {
  1550     AC_ARG_ENABLE(input-tslib,
  1551 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1552                   , enable_input_tslib=yes)
  1553     if test x$enable_input_tslib = xyes; then
  1554         AC_MSG_CHECKING(for Touchscreen library support)
  1555         enable_input_tslib=no
  1556         AC_TRY_COMPILE([
  1557           #include "tslib.h"
  1558         ],[
  1559         ],[
  1560         enable_input_tslib=yes
  1561         ])
  1562         AC_MSG_RESULT($enable_input_tslib)
  1563         if test x$enable_input_tslib = xyes; then
  1564             AC_DEFINE(SDL_INPUT_TSLIB)
  1565             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1566         fi
  1567     fi
  1568 }
  1569 
  1570 dnl See what type of thread model to use on Linux and Solaris
  1571 CheckPTHREAD()
  1572 {
  1573     dnl Check for pthread support
  1574     AC_ARG_ENABLE(pthreads,
  1575 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1576                   , enable_pthreads=yes)
  1577     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1578     AC_ARG_ENABLE(pthread-sem,
  1579 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1580                   , enable_pthread_sem=yes)
  1581     case "$host" in
  1582         *-*-linux*|*-*-uclinux*)
  1583             pthread_cflags="-D_REENTRANT"
  1584             pthread_lib="-lpthread"
  1585             ;;
  1586         *-*-bsdi*)
  1587             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1588             pthread_lib=""
  1589             ;;
  1590         *-*-darwin*)
  1591             pthread_cflags="-D_THREAD_SAFE"
  1592 # causes Carbon.p complaints?
  1593 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1594             ;;
  1595         *-*-freebsd*|*-*-dragonfly*)
  1596             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1597             pthread_lib="-pthread"
  1598             ;;
  1599         *-*-netbsd*)
  1600             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1601             pthread_lib="-lpthread"
  1602             ;;
  1603         *-*-openbsd*)
  1604             pthread_cflags="-D_REENTRANT"
  1605             pthread_lib="-pthread"
  1606             ;;
  1607         *-*-solaris*)
  1608             pthread_cflags="-D_REENTRANT"
  1609             pthread_lib="-lpthread -lposix4"
  1610             ;;
  1611         *-*-sysv5*)
  1612             pthread_cflags="-D_REENTRANT -Kthread"
  1613             pthread_lib=""
  1614             ;;
  1615         *-*-irix*)
  1616             pthread_cflags="-D_SGI_MP_SOURCE"
  1617             pthread_lib="-lpthread"
  1618             ;;
  1619         *-*-aix*)
  1620             pthread_cflags="-D_REENTRANT -mthreads"
  1621             pthread_lib="-lpthread"
  1622             ;;
  1623         *-*-hpux11*)
  1624             pthread_cflags="-D_REENTRANT"
  1625             pthread_lib="-L/usr/lib -lpthread"
  1626             ;;
  1627         *-*-osf*)
  1628             pthread_cflags="-D_REENTRANT"
  1629             if test x$ac_cv_prog_gcc = xyes; then
  1630                 pthread_lib="-lpthread -lrt"
  1631             else
  1632                 pthread_lib="-lpthread -lexc -lrt"
  1633             fi
  1634             ;;
  1635         *)
  1636             pthread_cflags="-D_REENTRANT"
  1637             pthread_lib="-lpthread"
  1638             ;;
  1639     esac
  1640     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1641         # Save the original compiler flags and libraries
  1642         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1643         # Add the pthread compiler flags and libraries
  1644         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1645         # Check to see if we have pthread support on this system
  1646         AC_MSG_CHECKING(for pthreads)
  1647         use_pthreads=no
  1648         AC_TRY_LINK([
  1649          #include <pthread.h>
  1650         ],[
  1651          pthread_attr_t type;
  1652          pthread_attr_init(&type);
  1653         ],[
  1654         use_pthreads=yes
  1655         ])
  1656         AC_MSG_RESULT($use_pthreads)
  1657         # Restore the compiler flags and libraries
  1658         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1659 
  1660         # Do futher testing if we have pthread support...
  1661         if test x$use_pthreads = xyes; then
  1662             AC_DEFINE(SDL_THREAD_PTHREAD)
  1663             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1664             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1665             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1666             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1667 
  1668             # Save the original compiler flags and libraries
  1669             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1670             # Add the pthread compiler flags and libraries
  1671             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1672 
  1673             # Check to see if recursive mutexes are available
  1674             AC_MSG_CHECKING(for recursive mutexes)
  1675             has_recursive_mutexes=no
  1676             if test x$has_recursive_mutexes = xno; then
  1677                 AC_TRY_COMPILE([
  1678                   #include <pthread.h>
  1679                 ],[
  1680                   pthread_mutexattr_t attr;
  1681                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1682                 ],[
  1683                 has_recursive_mutexes=yes
  1684                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1685                 ])
  1686             fi
  1687             if test x$has_recursive_mutexes = xno; then
  1688                 AC_TRY_COMPILE([
  1689                   #include <pthread.h>
  1690                 ],[
  1691                   pthread_mutexattr_t attr;
  1692                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1693                 ],[
  1694                 has_recursive_mutexes=yes
  1695                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1696                 ])
  1697             fi
  1698             AC_MSG_RESULT($has_recursive_mutexes)
  1699 
  1700             # Check to see if pthread semaphore support is missing
  1701             if test x$enable_pthread_sem = xyes; then
  1702                 AC_MSG_CHECKING(for pthread semaphores)
  1703                 have_pthread_sem=no
  1704                 AC_TRY_COMPILE([
  1705                   #include <pthread.h>
  1706                   #include <semaphore.h>
  1707                 ],[
  1708                 ],[
  1709                 have_pthread_sem=yes
  1710                 ])
  1711                 AC_MSG_RESULT($have_pthread_sem)
  1712             fi
  1713 
  1714             # Restore the compiler flags and libraries
  1715             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1716 
  1717             # Basic thread creation functions
  1718             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1719 
  1720             # Semaphores
  1721             # We can fake these with mutexes and condition variables if necessary
  1722             if test x$have_pthread_sem = xyes; then
  1723                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1724             else
  1725                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1726             fi
  1727 
  1728             # Mutexes
  1729             # We can fake these with semaphores if necessary
  1730             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1731 
  1732             # Condition variables
  1733             # We can fake these with semaphores and mutexes if necessary
  1734             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1735 
  1736             have_threads=yes
  1737         fi
  1738     fi
  1739 }
  1740 
  1741 dnl Determine whether the compiler can produce Windows executables
  1742 CheckWINDOWS()
  1743 {
  1744     AC_MSG_CHECKING(Windows compiler)
  1745     have_win32_gcc=no
  1746     AC_TRY_COMPILE([
  1747      #include <windows.h>
  1748     ],[
  1749     ],[
  1750     have_win32_gcc=yes
  1751     ])
  1752     AC_MSG_RESULT($have_win32_gcc)
  1753     if test x$have_win32_gcc != xyes; then
  1754        AC_MSG_ERROR([
  1755 *** Your compiler ($CC) does not produce Windows executables!
  1756        ])
  1757     fi
  1758 
  1759     AC_MSG_CHECKING(Windows CE)
  1760     have_wince=no
  1761     AC_TRY_COMPILE([
  1762 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  1763 #error This is not Windows CE
  1764 #endif
  1765     ],[
  1766     ],[
  1767     have_wince=yes
  1768     ])
  1769     AC_MSG_RESULT($have_wince)
  1770 }
  1771 
  1772 dnl Find the DirectX includes and libraries
  1773 CheckDIRECTX()
  1774 {
  1775     AC_ARG_ENABLE(directx,
  1776 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
  1777                   , enable_directx=yes)
  1778     if test x$enable_directx = xyes; then
  1779         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  1780         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1781         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1782         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  1783     fi
  1784 }
  1785 
  1786 dnl Check for the dlfcn.h interface for dynamically loading objects
  1787 CheckDLOPEN()
  1788 {
  1789     AC_ARG_ENABLE(sdl-dlopen,
  1790 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1791                   , enable_sdl_dlopen=yes)
  1792     if test x$enable_sdl_dlopen = xyes; then
  1793         AC_MSG_CHECKING(for dlopen)
  1794         have_dlopen=no
  1795         AC_TRY_COMPILE([
  1796          #include <dlfcn.h>
  1797         ],[
  1798          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1799          #error Use dlcompat for Mac OS X 10.2 compatibility
  1800          #endif
  1801         ],[
  1802         have_dlopen=yes
  1803         ])
  1804         AC_MSG_RESULT($have_dlopen)
  1805 
  1806         if test x$have_dlopen = xyes; then
  1807             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1808                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1809                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1810             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1811             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1812             have_loadso=yes
  1813         fi
  1814     fi
  1815 }
  1816 
  1817 dnl Check for the usbhid(3) library on *BSD
  1818 CheckUSBHID()
  1819 {
  1820     if test x$enable_joystick = xyes; then
  1821         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1822         if test x$have_libusbhid = xyes; then
  1823             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1824             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1825             USB_LIBS="$USB_LIBS -lusbhid"
  1826         else
  1827             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1828             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1829             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1830         fi
  1831             
  1832         save_CFLAGS="$CFLAGS"
  1833         CFLAGS="$CFLAGS $USB_CFLAGS"
  1834 
  1835         AC_MSG_CHECKING(for usbhid)
  1836         have_usbhid=no
  1837         AC_TRY_COMPILE([
  1838           #include <sys/types.h>
  1839           #if defined(HAVE_USB_H)
  1840           #include <usb.h>
  1841           #endif
  1842           #ifdef __DragonFly__
  1843           # include <bus/usb/usb.h>
  1844           # include <bus/usb/usbhid.h>
  1845           #else
  1846           # include <dev/usb/usb.h>
  1847           # include <dev/usb/usbhid.h>
  1848           #endif
  1849           #if defined(HAVE_USBHID_H)
  1850           #include <usbhid.h>
  1851           #elif defined(HAVE_LIBUSB_H)
  1852           #include <libusb.h>
  1853           #elif defined(HAVE_LIBUSBHID_H)
  1854           #include <libusbhid.h>
  1855           #endif
  1856         ],[
  1857           struct report_desc *repdesc;
  1858           struct usb_ctl_report *repbuf;
  1859           hid_kind_t hidkind;
  1860         ],[
  1861         have_usbhid=yes
  1862         ])
  1863         AC_MSG_RESULT($have_usbhid)
  1864 
  1865         if test x$have_usbhid = xyes; then
  1866             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1867             have_usbhid_ucr_data=no
  1868             AC_TRY_COMPILE([
  1869               #include <sys/types.h>
  1870               #if defined(HAVE_USB_H)
  1871               #include <usb.h>
  1872               #endif
  1873               #ifdef __DragonFly__
  1874               # include <bus/usb/usb.h>
  1875               # include <bus/usb/usbhid.h>
  1876               #else
  1877               # include <dev/usb/usb.h>
  1878               # include <dev/usb/usbhid.h>
  1879               #endif
  1880               #if defined(HAVE_USBHID_H)
  1881               #include <usbhid.h>
  1882               #elif defined(HAVE_LIBUSB_H)
  1883               #include <libusb.h>
  1884               #elif defined(HAVE_LIBUSBHID_H)
  1885               #include <libusbhid.h>
  1886               #endif
  1887             ],[
  1888               struct usb_ctl_report buf;
  1889               if (buf.ucr_data) { }
  1890             ],[
  1891             have_usbhid_ucr_data=yes
  1892             ])
  1893             if test x$have_usbhid_ucr_data = xyes; then
  1894                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1895             fi
  1896             AC_MSG_RESULT($have_usbhid_ucr_data)
  1897             
  1898             AC_MSG_CHECKING(for new usbhid API)
  1899             have_usbhid_new=no
  1900             AC_TRY_COMPILE([
  1901               #include <sys/types.h>
  1902               #if defined(HAVE_USB_H)
  1903               #include <usb.h>
  1904               #endif
  1905               #ifdef __DragonFly__
  1906               #include <bus/usb/usb.h>
  1907               #include <bus/usb/usbhid.h>
  1908               #else
  1909               #include <dev/usb/usb.h>
  1910               #include <dev/usb/usbhid.h>
  1911               #endif
  1912               #if defined(HAVE_USBHID_H)
  1913               #include <usbhid.h>
  1914               #elif defined(HAVE_LIBUSB_H)
  1915               #include <libusb.h>
  1916               #elif defined(HAVE_LIBUSBHID_H)
  1917               #include <libusbhid.h>
  1918               #endif
  1919             ],[
  1920               report_desc_t d;
  1921               hid_start_parse(d, 1, 1);
  1922             ],[
  1923             have_usbhid_new=yes
  1924             ])
  1925             if test x$have_usbhid_new = xyes; then
  1926                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  1927             fi
  1928             AC_MSG_RESULT($have_usbhid_new)
  1929 
  1930             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  1931             have_machine_joystick=no
  1932             AC_TRY_COMPILE([
  1933               #include <machine/joystick.h>
  1934             ],[
  1935               struct joystick t;
  1936             ],[
  1937             have_machine_joystick=yes
  1938             ])
  1939             if test x$have_machine_joystick = xyes; then
  1940                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  1941             fi
  1942             AC_MSG_RESULT($have_machine_joystick)
  1943 
  1944             AC_DEFINE(SDL_JOYSTICK_USBHID)
  1945             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  1946             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  1947             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  1948             have_joystick=yes
  1949         fi
  1950         CFLAGS="$save_CFLAGS"
  1951     fi
  1952 }
  1953 
  1954 dnl Check for clock_gettime()
  1955 CheckClockGettime()
  1956 {
  1957     AC_ARG_ENABLE(clock_gettime,
  1958 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  1959                   , enable_clock_gettime=no)
  1960     if test x$enable_clock_gettime = xyes; then
  1961         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  1962         if test x$have_clock_gettime = xyes; then
  1963             AC_DEFINE(HAVE_CLOCK_GETTIME)
  1964             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  1965         else
  1966             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  1967             if test x$have_clock_gettime = xyes; then
  1968                AC_DEFINE(HAVE_CLOCK_GETTIME)
  1969                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  1970             fi
  1971         fi
  1972     fi
  1973 }
  1974 
  1975 dnl Check for a valid linux/version.h
  1976 CheckLinuxVersion()
  1977 {
  1978     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  1979     if test x$have_linux_version_h = xyes; then
  1980         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  1981     fi
  1982 }
  1983 
  1984 dnl Check if we want to use RPATH
  1985 CheckRPATH()
  1986 {
  1987     AC_ARG_ENABLE(rpath,
  1988 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  1989                   , enable_rpath=yes)
  1990 }
  1991 
  1992 dnl Set up the configuration based on the host platform!
  1993 case "$host" in
  1994     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
  1995         case "$host" in
  1996             *-*-linux*)         ARCH=linux ;;
  1997             *-*-uclinux*)       ARCH=linux ;;
  1998             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  1999             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2000             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2001             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2002             *-*-bsdi*)          ARCH=bsdi ;;
  2003             *-*-freebsd*)       ARCH=freebsd ;;
  2004             *-*-dragonfly*)     ARCH=freebsd ;;
  2005             *-*-netbsd*)        ARCH=netbsd ;;
  2006             *-*-openbsd*)       ARCH=openbsd ;;
  2007             *-*-sysv5*)         ARCH=sysv5 ;;
  2008             *-*-solaris*)       ARCH=solaris ;;
  2009             *-*-hpux*)          ARCH=hpux ;;
  2010             *-*-irix*)          ARCH=irix ;;
  2011             *-*-aix*)           ARCH=aix ;;
  2012             *-*-osf*)           ARCH=osf ;;
  2013             *-*-minix*)         ARCH=minix ;;
  2014         esac
  2015         CheckVisibilityHidden
  2016         CheckDummyVideo
  2017         CheckDiskAudio
  2018         CheckDummyAudio
  2019         CheckDLOPEN
  2020         CheckOSS
  2021         CheckDMEDIA
  2022         CheckMME
  2023         CheckALSA
  2024         CheckPulseAudio
  2025         CheckARTSC
  2026         CheckESD
  2027         CheckNAS
  2028         CheckX11
  2029         CheckDirectFB
  2030         CheckFusionSound
  2031         CheckOpenGLX11
  2032         CheckInputEvents
  2033         CheckTslib
  2034         CheckUSBHID
  2035         CheckPTHREAD
  2036         CheckClockGettime
  2037         CheckLinuxVersion
  2038         CheckRPATH
  2039         # Set up files for the audio library
  2040         if test x$enable_audio = xyes; then
  2041           case $ARCH in
  2042             sysv5|solaris|hpux)
  2043                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2044                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2045                 have_audio=yes
  2046             ;;
  2047             netbsd|openbsd)
  2048                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2049                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2050                 have_audio=yes
  2051             ;;
  2052             aix)
  2053                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
  2054                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2055                 have_audio=yes
  2056             ;;
  2057           esac
  2058         fi
  2059         # Set up files for the joystick library
  2060         if test x$enable_joystick = xyes; then
  2061           case $ARCH in
  2062             linux)
  2063                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2064                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2065                 have_joystick=yes
  2066             ;;
  2067           esac
  2068         fi
  2069         # Set up files for the haptic library
  2070         if test x$enable_haptic = xyes; then
  2071            if test x$use_input_events = xyes; then
  2072              case $ARCH in
  2073                linux)
  2074                    AC_DEFINE(SDL_HAPTIC_LINUX)
  2075                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2076                    have_haptic=yes
  2077                ;;
  2078              esac
  2079            fi
  2080         fi
  2081         # Set up files for the power library
  2082         if test x$enable_power = xyes; then
  2083              case $ARCH in
  2084                linux)
  2085                    AC_DEFINE(SDL_POWER_LINUX)
  2086                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2087                    have_power=yes
  2088                ;;
  2089              esac
  2090         fi
  2091         # Set up files for the thread library
  2092         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2093             AC_DEFINE(SDL_THREAD_SPROC)
  2094             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2095             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2096             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2097             have_threads=yes
  2098         fi
  2099         # Set up files for the timer library
  2100         if test x$enable_timers = xyes; then
  2101             AC_DEFINE(SDL_TIMER_UNIX)
  2102             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2103             have_timers=yes
  2104         fi
  2105         ;;
  2106     *-wince* | *-mingw32ce)
  2107         ARCH=win32
  2108         CheckDummyVideo
  2109         CheckDiskAudio
  2110         CheckDummyAudio
  2111         CheckWINDOWS
  2112         if test x$enable_video = xyes; then
  2113             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
  2114             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  2115             have_video=yes
  2116             AC_ARG_ENABLE(render-d3d,
  2117 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2118                                 , enable_render_d3d=yes)
  2119             enable_render_d3d=no
  2120             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2121                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2122             fi
  2123         fi
  2124         # Set up files for the audio library
  2125         if test x$enable_audio = xyes; then
  2126             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2127             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2128             if test x$have_dsound = xyes; then
  2129                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2130                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2131             fi
  2132             have_audio=yes
  2133         fi
  2134         # Set up dummy files for the joystick for now
  2135         if test x$enable_joystick = xyes; then
  2136             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2137             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2138             have_joystick=yes
  2139         fi
  2140         # Set up files for the thread library
  2141         if test x$enable_threads = xyes; then
  2142             AC_DEFINE(SDL_THREAD_WINDOWS)
  2143             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
  2144             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
  2145             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
  2146             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2147             have_threads=yes
  2148         fi
  2149         # Set up files for the timer library
  2150         if test x$enable_timers = xyes; then
  2151             AC_DEFINE(SDL_TIMER_WINCE)
  2152             SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
  2153             have_timers=yes
  2154         fi
  2155         # Set up files for the shared object loading library
  2156         if test x$enable_loadso = xyes; then
  2157             AC_DEFINE(SDL_LOADSO_WINDOWS)
  2158             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  2159             have_loadso=yes
  2160         fi
  2161         # Set up the system libraries we need
  2162         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
  2163 
  2164 	# mingw32ce library
  2165 	case "$host" in
  2166     	    *-mingw32ce)
  2167     		EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
  2168     		;;
  2169     	    *)
  2170         	;;
  2171 	esac
  2172 
  2173         # The Windows platform requires special setup
  2174         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  2175         EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
  2176         EXTRA_LDFLAGS="-lSDLmain $EXTRA_LDFLAGS"
  2177         ;;
  2178     *-*-cygwin* | *-*-mingw32*)
  2179         ARCH=win32
  2180         if test "$build" != "$host"; then # cross-compiling
  2181             # Default cross-compile location
  2182             ac_default_prefix=/usr/local/cross-tools/$host
  2183         else
  2184             # Look for the location of the tools and install there
  2185             if test "$BUILD_PREFIX" != ""; then
  2186                 ac_default_prefix=$BUILD_PREFIX
  2187             fi
  2188         fi
  2189         CheckDummyVideo
  2190         CheckDiskAudio
  2191         CheckDummyAudio
  2192         CheckWINDOWS
  2193         CheckWINDOWSGL
  2194         CheckDIRECTX
  2195 
  2196         # Set up the core platform files
  2197         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  2198 
  2199         # Set up files for the video library
  2200         if test x$enable_video = xyes; then
  2201             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
  2202             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  2203             have_video=yes
  2204             AC_ARG_ENABLE(render-d3d,
  2205 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2206                                 , enable_render_d3d=yes)
  2207             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2208                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2209             fi
  2210         fi
  2211         # Set up files for the audio library
  2212         if test x$enable_audio = xyes; then
  2213             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2214             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2215             if test x$have_dsound = xyes; then
  2216                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2217                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2218             fi
  2219             have_audio=yes
  2220         fi
  2221         # Set up files for the joystick library
  2222         if test x$enable_joystick = xyes; then
  2223             if test x$have_dinput = xyes; then
  2224                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2225                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
  2226                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  2227             else
  2228                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2229                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
  2230             fi
  2231             have_joystick=yes
  2232         fi
  2233         if test x$enable_haptic = xyes; then
  2234             if test x$have_dinput = xyes; then
  2235                 AC_DEFINE(SDL_HAPTIC_DINPUT)
  2236                 SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
  2237                 have_haptic=yes
  2238             fi
  2239         fi
  2240         if test x$enable_power = xyes; then
  2241             AC_DEFINE(SDL_POWER_WINDOWS)
  2242             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2243             have_power=yes
  2244         fi
  2245         # Set up files for the thread library
  2246         if test x$enable_threads = xyes; then
  2247             AC_DEFINE(SDL_THREAD_WINDOWS)
  2248             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
  2249             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
  2250             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
  2251             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2252             have_threads=yes
  2253         fi
  2254         # Set up files for the timer library
  2255         if test x$enable_timers = xyes; then
  2256             AC_DEFINE(SDL_TIMER_WINDOWS)
  2257             SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  2258             have_timers=yes
  2259         fi
  2260         # Set up files for the shared object loading library
  2261         if test x$enable_loadso = xyes; then
  2262             AC_DEFINE(SDL_LOADSO_WINDOWS)
  2263             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  2264             have_loadso=yes
  2265         fi
  2266         # Set up the system libraries we need
  2267         # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
  2268         # You can get this here: http://libunicows.sourceforge.net/
  2269         #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
  2270         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm -limm32 -lole32 -loleaut32 -lversion -luuid"
  2271         # The Windows platform requires special setup
  2272         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  2273         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  2274         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2275         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2276         ;;
  2277     *-*-beos* | *-*-haiku*)
  2278         ARCH=beos
  2279         ac_default_prefix=/boot/develop/tools/gnupro
  2280         CheckDummyVideo
  2281         CheckDiskAudio
  2282         CheckDummyAudio
  2283         CheckBWINDOW
  2284         CheckBeGL
  2285         # Set up files for the audio library
  2286         if test x$enable_audio = xyes; then
  2287             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
  2288             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2289             have_audio=yes
  2290         fi
  2291         # Set up files for the joystick library
  2292         if test x$enable_joystick = xyes; then
  2293             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2294             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2295             have_joystick=yes
  2296         fi
  2297         # Set up files for the thread library
  2298         if test x$enable_threads = xyes; then
  2299             AC_DEFINE(SDL_THREAD_BEOS)
  2300             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2301             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2302             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2303             have_threads=yes
  2304         fi
  2305         # Set up files for the timer library
  2306         if test x$enable_timers = xyes; then
  2307             AC_DEFINE(SDL_TIMER_BEOS)
  2308             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2309             have_timers=yes
  2310         fi
  2311         # Set up files for the shared object loading library
  2312         if test x$enable_loadso = xyes; then
  2313             AC_DEFINE(SDL_LOADSO_BEOS)
  2314             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2315             have_loadso=yes
  2316         fi
  2317         # Set up files for the system power library
  2318         if test x$enable_power = xyes; then
  2319             AC_DEFINE(SDL_POWER_BEOS)
  2320             SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
  2321             have_power=yes
  2322         fi
  2323         # The BeOS platform requires special setup.
  2324         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2325         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2326         ;;
  2327     *-*-darwin* )
  2328         # This could be either full "Mac OS X", or plain "Darwin" which is
  2329         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2330         # Next line is broken, and a few files below require Mac OS X (full)
  2331         ARCH=macosx
  2332 
  2333         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2334         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2335         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2336 
  2337         CheckVisibilityHidden
  2338         CheckDummyVideo
  2339         CheckDiskAudio
  2340         CheckDummyAudio
  2341         CheckDLOPEN
  2342 
  2343         # Set up files for the shared object loading library
  2344         # (this needs to be done before the dynamic X11 check)
  2345         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2346             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2347             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2348             have_loadso=yes
  2349         fi
  2350 
  2351         CheckCOCOA
  2352         CheckX11
  2353         CheckMacGL
  2354         CheckOpenGLX11
  2355         CheckPTHREAD
  2356 
  2357         # Good optimization on Mac OS X, yes...
  2358         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2359 
  2360         # Need this or things might misbuild on a G3.
  2361         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2362 
  2363         # Set up files for the audio library
  2364         if test x$enable_audio = xyes; then
  2365             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2366             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2367             have_audio=yes
  2368         fi
  2369         # Set up files for the joystick library
  2370         if test x$enable_joystick = xyes; then
  2371             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2372             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2373             have_joystick=yes
  2374         fi
  2375         # Set up files for the haptic library
  2376         if test x$enable_haptic = xyes; then
  2377             AC_DEFINE(SDL_HAPTIC_IOKIT)
  2378             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2379             have_haptic=yes
  2380             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2381         fi
  2382         # Set up files for the power library
  2383         if test x$enable_power = xyes; then
  2384             AC_DEFINE(SDL_POWER_MACOSX)
  2385             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2386             have_power=yes
  2387         fi
  2388         # Set up files for the timer library
  2389         if test x$enable_timers = xyes; then
  2390             AC_DEFINE(SDL_TIMER_UNIX)
  2391             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2392             have_timers=yes
  2393         fi
  2394         # Set up additional files for the file library
  2395         if test x$enable_file = xyes; then
  2396             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2397         fi
  2398         # The Mac OS X platform requires special setup.
  2399         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2400         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2401         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2402         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2403         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2404         # If audio is used, add the AudioUnit framework
  2405         if test x$enable_audio = xyes; then
  2406             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2407         fi
  2408         ;;
  2409     *)
  2410         AC_MSG_ERROR([
  2411 *** Unsupported host:  Please add to configure.in
  2412         ])
  2413         ;;
  2414 esac
  2415 
  2416 # Verify that we have all the platform specific files we need
  2417 
  2418 if test x$have_joystick != xyes; then
  2419     if test x$enable_joystick = xyes; then
  2420         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2421     fi
  2422     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2423 fi
  2424 if test x$have_haptic != xyes; then
  2425     if test x$enable_haptic = xyes; then
  2426         AC_DEFINE(SDL_HAPTIC_DISABLED)
  2427     fi
  2428     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2429 fi
  2430 if test x$have_threads != xyes; then
  2431     if test x$enable_threads = xyes; then
  2432         AC_DEFINE(SDL_THREADS_DISABLED)
  2433     fi
  2434     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2435 fi
  2436 if test x$have_timers != xyes; then
  2437     if test x$enable_timers = xyes; then
  2438         AC_DEFINE(SDL_TIMERS_DISABLED)
  2439     fi
  2440     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2441 fi
  2442 if test x$have_loadso != xyes; then
  2443     if test x$enable_loadso = xyes; then
  2444         AC_DEFINE(SDL_LOADSO_DISABLED)
  2445     fi
  2446     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2447 fi
  2448 if test x$SDLMAIN_SOURCES = x; then
  2449     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2450 fi
  2451 
  2452 OBJECTS=`echo $SOURCES`
  2453 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  2454 for EXT in asm cc m c S; do
  2455     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2456     DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  2457 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  2458 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2459 done
  2460 
  2461 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2462 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2463 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2464 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  2465 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  2466 	\\$(WINDRES) \\$< \\$@,g"`
  2467 
  2468 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2469 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2470 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2471 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2472 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2473 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2474 
  2475 # Set runtime shared library paths as needed
  2476 
  2477 if test "x$enable_rpath" = "xyes"; then
  2478   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2479     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2480   fi
  2481   if test $ARCH = solaris; then
  2482     SDL_RLD_FLAGS="-R\${libdir}"
  2483   fi
  2484 else
  2485   SDL_RLD_FLAGS=""
  2486 fi
  2487 
  2488 case "$ARCH" in
  2489   macosx)
  2490     # Evil hack to allow static linking on Mac OS X
  2491     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2492     ;;
  2493   *)
  2494     SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2495     ;;
  2496 esac
  2497 
  2498 dnl Expand the cflags and libraries needed by apps using SDL
  2499 AC_SUBST(SDL_CFLAGS)
  2500 AC_SUBST(SDL_LIBS)
  2501 AC_SUBST(SDL_STATIC_LIBS)
  2502 AC_SUBST(SDL_RLD_FLAGS)
  2503 if test x$enable_shared = xyes; then
  2504     ENABLE_SHARED_TRUE=
  2505     ENABLE_SHARED_FALSE="#"
  2506 else
  2507     ENABLE_SHARED_TRUE="#"
  2508     ENABLE_SHARED_FALSE=
  2509 fi
  2510 if test x$enable_static = xyes; then
  2511     ENABLE_STATIC_TRUE=
  2512     ENABLE_STATIC_FALSE="#"
  2513 else
  2514     ENABLE_STATIC_TRUE="#"
  2515     ENABLE_STATIC_FALSE=
  2516 fi
  2517 AC_SUBST(ENABLE_SHARED_TRUE)
  2518 AC_SUBST(ENABLE_SHARED_FALSE)
  2519 AC_SUBST(ENABLE_STATIC_TRUE)
  2520 AC_SUBST(ENABLE_STATIC_FALSE)
  2521 
  2522 dnl Expand the sources and objects needed to build the library
  2523 AC_SUBST(ac_aux_dir)
  2524 AC_SUBST(INCLUDE)
  2525 AC_SUBST(OBJECTS)
  2526 AC_SUBST(VERSION_OBJECTS)
  2527 AC_SUBST(SDLMAIN_OBJECTS)
  2528 AC_SUBST(BUILD_CFLAGS)
  2529 AC_SUBST(EXTRA_CFLAGS)
  2530 AC_SUBST(BUILD_LDFLAGS)
  2531 AC_SUBST(EXTRA_LDFLAGS)
  2532 AC_SUBST(WINDRES)
  2533 
  2534 cat >Makefile.rules <<__EOF__
  2535 
  2536 # Build rules for objects
  2537 -include \$(OBJECTS:.lo=.d)
  2538 
  2539 # Special dependency for SDL.c, since it depends on SDL_revision.h
  2540 $srcdir/src/SDL.c: update-revision
  2541 $DEPENDS
  2542 $VERSION_DEPENDS
  2543 $SDLMAIN_DEPENDS
  2544 __EOF__
  2545 
  2546 AC_CONFIG_FILES([
  2547     Makefile:Makefile.in:Makefile.rules sdl-config SDL.spec sdl.pc
  2548 ])
  2549 AC_OUTPUT