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