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