configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 14 Mar 2011 23:04:52 -0700
changeset 5487 ad3abbbe0381
parent 5482 2c0477323626
child 5512 56ab281d7d3e
permissions -rw-r--r--
Delegate should use application: didFinishLaunchingWithOptions:

Vittorio G. to Sam

would it be possible to update the application delegate in
SDL_uikitappdelagate to the suggest new method
     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 Find the ESD includes and libraries
   762 CheckESD()
   763 {
   764     AC_ARG_ENABLE(esd,
   765 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
   766                   , enable_esd=yes)
   767     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   768         AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
   769         if test x$have_esd = xyes; then
   770             AC_ARG_ENABLE(esd-shared,
   771 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
   772                           , enable_esd_shared=yes)
   773             esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   774 
   775             AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
   776             SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
   777             EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
   778             if test x$have_loadso != xyes && \
   779                test x$enable_esd_shared = xyes; then
   780                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
   781             fi
   782             if test x$have_loadso = xyes && \
   783                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   784                 echo "-- dynamic libesd -> $esd_lib"
   785                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
   786             else
   787                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
   788             fi
   789             have_audio=yes
   790         fi
   791     fi
   792 }
   793 
   794 dnl Find PulseAudio
   795 CheckPulseAudio()
   796 {
   797     AC_ARG_ENABLE(pulseaudio,
   798 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
   799                   , enable_pulseaudio=yes)
   800     if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
   801         audio_pulseaudio=no
   802 
   803         PULSEAUDIO_REQUIRED_VERSION=0.9
   804 
   805         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   806         AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
   807         if test x$PKG_CONFIG != xno; then
   808         if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
   809                 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
   810                 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
   811                 audio_pulseaudio=yes
   812             fi
   813         fi
   814         AC_MSG_RESULT($audio_pulseaudio)
   815 
   816         if test x$audio_pulseaudio = xyes; then
   817             AC_ARG_ENABLE(pulseaudio-shared,
   818 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
   819                           , enable_pulseaudio_shared=yes)
   820             pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   821 
   822             AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
   823             SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
   824             EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
   825             if test x$have_loadso != xyes && \
   826                test x$enable_pulseaudio_shared = xyes; then
   827                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
   828             fi
   829             if test x$have_loadso = xyes && \
   830                test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
   831                 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
   832                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
   833             else
   834                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
   835             fi
   836             have_audio=yes
   837         fi
   838     fi
   839 }
   840 
   841 CheckARTSC()
   842 {
   843     AC_ARG_ENABLE(arts,
   844 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
   845                   , enable_arts=yes)
   846     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   847         AC_PATH_PROG(ARTSCONFIG, artsc-config)
   848         if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
   849             : # arts isn't installed
   850         else
   851             ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   852             ARTS_LIBS=`$ARTSCONFIG --libs`
   853             AC_MSG_CHECKING(for aRts development environment)
   854             audio_arts=no
   855             save_CFLAGS="$CFLAGS"
   856             CFLAGS="$CFLAGS $ARTS_CFLAGS"
   857             AC_TRY_COMPILE([
   858              #include <artsc.h>
   859             ],[
   860              arts_stream_t stream;
   861             ],[
   862             audio_arts=yes
   863             ])
   864             CFLAGS="$save_CFLAGS"
   865             AC_MSG_RESULT($audio_arts)
   866             if test x$audio_arts = xyes; then
   867                 AC_ARG_ENABLE(arts-shared,
   868 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
   869                               , enable_arts_shared=yes)
   870                 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   871 
   872                 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   873                 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   874                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
   875                 if test x$have_loadso != xyes && \
   876                    test x$enable_arts_shared = xyes; then
   877                     AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
   878                 fi
   879                 if test x$have_loadso = xyes && \
   880                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   881                     echo "-- dynamic libartsc -> $arts_lib"
   882                     AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
   883                 else
   884                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
   885                 fi
   886                 have_audio=yes
   887             fi
   888         fi
   889     fi
   890 }
   891 
   892 dnl See if the NAS audio interface is supported
   893 CheckNAS()
   894 {
   895     AC_ARG_ENABLE(nas,
   896 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
   897                   , enable_nas=yes)
   898     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   899         AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
   900         AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
   901 
   902         AC_MSG_CHECKING(for NAS audio support)
   903         have_nas=no
   904 
   905         if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
   906             have_nas=yes
   907             NAS_LIBS="-laudio"
   908 
   909         elif test -r /usr/X11R6/include/audio/audiolib.h; then
   910             have_nas=yes
   911             NAS_CFLAGS="-I/usr/X11R6/include/"
   912             NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
   913 
   914         fi
   915 
   916         AC_MSG_RESULT($have_nas)
   917 
   918         if test x$have_nas = xyes; then
   919             AC_ARG_ENABLE(nas-shared,
   920 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
   921                           , enable_nas_shared=yes)
   922             nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   923 
   924             if test x$have_loadso != xyes && \
   925                test x$enable_nas_shared = xyes; then
   926                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
   927             fi
   928             if test x$have_loadso = xyes && \
   929                test x$enable_nas_shared = xyes && test x$nas_lib != x; then
   930                 echo "-- dynamic libaudio -> $nas_lib"
   931                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
   932             else
   933                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
   934             fi
   935 
   936             AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
   937             SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
   938             EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
   939             have_audio=yes
   940         fi
   941     fi
   942 }
   943 
   944 dnl rcg07142001 See if the user wants the disk writer audio driver...
   945 CheckDiskAudio()
   946 {
   947     AC_ARG_ENABLE(diskaudio,
   948 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
   949                   , enable_diskaudio=yes)
   950     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
   951         AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
   952         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
   953     fi
   954 }
   955 
   956 dnl rcg03142006 See if the user wants the dummy audio driver...
   957 CheckDummyAudio()
   958 {
   959     AC_ARG_ENABLE(dummyaudio,
   960 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
   961                   , enable_dummyaudio=yes)
   962     if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
   963         AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
   964         SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
   965     fi
   966 }
   967 
   968 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
   969 dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
   970 CheckVisibilityHidden()
   971 {
   972     AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
   973     have_gcc_fvisibility=no
   974 
   975     visibility_CFLAGS="-fvisibility=hidden"
   976     save_CFLAGS="$CFLAGS"
   977     CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
   978     AC_TRY_COMPILE([
   979     #if !defined(__GNUC__) || __GNUC__ < 4
   980     #error SDL only uses visibility attributes in GCC 4 or newer
   981     #endif
   982     ],[
   983     ],[
   984     have_gcc_fvisibility=yes
   985     ])
   986     AC_MSG_RESULT($have_gcc_fvisibility)
   987     CFLAGS="$save_CFLAGS"
   988 
   989     if test x$have_gcc_fvisibility = xyes; then
   990         EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
   991     fi
   992 }
   993 
   994 
   995 dnl Find the X11 include and library directories
   996 CheckX11()
   997 {
   998 
   999 
  1000     AC_ARG_ENABLE(video-x11,
  1001 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
  1002                   , enable_video_x11=yes)
  1003     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1004         case "$host" in
  1005             *-*-darwin*)
  1006                 # This isn't necessary for X11, but fixes GLX detection
  1007                 if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
  1008                     x_includes="/usr/X11R6/include"
  1009                     x_libraries="/usr/X11R6/lib"
  1010                 fi
  1011                 ;;
  1012         esac
  1013         AC_PATH_X
  1014         AC_PATH_XTRA
  1015         if test x$have_x = xyes; then
  1016             # Only allow dynamically loaded X11 if the X11 function pointers
  1017             # will not end up in the global namespace, which causes problems
  1018             # with other libraries calling X11 functions.
  1019             x11_symbols_private=$have_gcc_fvisibility
  1020 
  1021             AC_ARG_ENABLE(x11-shared,
  1022 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
  1023                           , enable_x11_shared=maybe)
  1024 
  1025             case "$host" in
  1026                 *-*-darwin*)
  1027                     x11_symbols_private=yes
  1028                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
  1029                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
  1030                     xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
  1031                     xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
  1032                     xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1033                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1034                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1035                     xss_lib='/usr/X11R6/lib/libXss.1.dylib'
  1036                     xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
  1037                     ;;
  1038                 *)
  1039                     x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1040                     x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1041                     xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1042                     xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1043                     xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1044                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1045                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1046                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1047                     xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1048                     ;;
  1049             esac
  1050 
  1051             if test x$ac_cv_func_shmat != xyes; then
  1052                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1053             fi
  1054             CFLAGS="$CFLAGS $X_CFLAGS"
  1055             LDFLAGS="$LDFLAGS $X_LIBS"
  1056 
  1057             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
  1058             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1059             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1060 
  1061             if test x$enable_x11_shared = xmaybe; then
  1062                 enable_x11_shared=$x11_symbols_private
  1063             fi
  1064             if test x$have_loadso != xyes && \
  1065                test x$enable_x11_shared = xyes; then
  1066                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1067                 enable_x11_shared=no
  1068             fi
  1069             if test x$x11_symbols_private != xyes && \
  1070                test x$enable_x11_shared = xyes; then
  1071                 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
  1072                 enable_x11_shared=no
  1073             fi
  1074 
  1075             if test x$have_loadso = xyes && \
  1076                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1077                 echo "-- dynamic libX11 -> $x11_lib"
  1078                 echo "-- dynamic libX11ext -> $x11ext_lib"
  1079                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
  1080                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
  1081             else
  1082                 enable_x11_shared=no
  1083                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1084             fi
  1085             have_video=yes
  1086 
  1087             AC_ARG_ENABLE(video-x11-xcursor,
  1088 AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
  1089                             , enable_video_x11_xcursor=yes)
  1090             if test x$enable_video_x11_xcursor = xyes; then
  1091                 definitely_enable_video_x11_xcursor=no
  1092                 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
  1093                                 have_xcursor_h_hdr=yes,
  1094                                 have_xcursor_h_hdr=no,
  1095                                 [#include <X11/Xlib.h>
  1096                                 ])
  1097                 if test x$have_xcursor_h_hdr = xyes; then
  1098                     if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
  1099                         echo "-- dynamic libXcursor -> $xcursor_lib"
  1100                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib")
  1101                         definitely_enable_video_x11_xcursor=yes
  1102                     else
  1103                         AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
  1104                         if test x$have_xcursor_lib = xyes ; then
  1105                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
  1106                             definitely_enable_video_x11_xcursor=yes
  1107                         fi
  1108                     fi
  1109                 fi
  1110             fi
  1111             if test x$definitely_enable_video_x11_xcursor = xyes; then
  1112                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR)
  1113             fi
  1114             AC_ARG_ENABLE(video-x11-xinerama,
  1115 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1116                             , enable_video_x11_xinerama=yes)
  1117             if test x$enable_video_x11_xinerama = xyes; then
  1118                 definitely_enable_video_x11_xinerama=no
  1119                 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
  1120                                 have_xinerama_h_hdr=yes,
  1121                                 have_xinerama_h_hdr=no,
  1122                                 [#include <X11/Xlib.h>
  1123                                 ])
  1124                 if test x$have_xinerama_h_hdr = xyes; then
  1125                     if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
  1126                         echo "-- dynamic libXinerama -> $xinerama_lib"
  1127                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib")
  1128                         definitely_enable_video_x11_xinerama=yes
  1129                     else
  1130                         AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
  1131                         if test x$have_xinerama_lib = xyes ; then
  1132                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
  1133                             definitely_enable_video_x11_xinerama=yes
  1134                         fi
  1135                     fi
  1136                 fi
  1137             fi
  1138             if test x$definitely_enable_video_x11_xinerama = xyes; then
  1139                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
  1140             fi
  1141             AC_ARG_ENABLE(video-x11-xinput,
  1142 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1143                             , enable_video_x11_xinput=yes)
  1144             if test x$enable_video_x11_xinput = xyes; then
  1145                 definitely_enable_video_x11_xinput=no
  1146                 AC_CHECK_HEADER(X11/extensions/XInput.h,
  1147                                 have_xinput_h_hdr=yes,
  1148                                 have_xinput_h_hdr=no,
  1149                                 [#include <X11/Xlib.h>
  1150                                 ])
  1151                 if test x$have_xinput_h_hdr = xyes; then
  1152                     if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1153                         echo "-- dynamic libXi -> $xinput_lib"
  1154                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
  1155                         definitely_enable_video_x11_xinput=yes
  1156                     else
  1157                         AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1158                         if test x$have_xinput_lib = xyes ; then
  1159                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1160                             definitely_enable_video_x11_xinput=yes
  1161                         fi
  1162                     fi
  1163                 fi
  1164             fi
  1165             if test x$definitely_enable_video_x11_xinput = xyes; then
  1166                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
  1167             fi
  1168             AC_ARG_ENABLE(video-x11-xrandr,
  1169 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1170                             , enable_video_x11_xrandr=yes)
  1171             if test x$enable_video_x11_xrandr = xyes; then
  1172                 definitely_enable_video_x11_xrandr=no
  1173                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1174                                 have_xrandr_h_hdr=yes,
  1175                                 have_xrandr_h_hdr=no,
  1176                                 [#include <X11/Xlib.h>
  1177                                 ])
  1178                 if test x$have_xrandr_h_hdr = xyes; then
  1179                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1180                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1181                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
  1182                         definitely_enable_video_x11_xrandr=yes
  1183                     else
  1184                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1185                         if test x$have_xrandr_lib = xyes ; then
  1186                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1187                             definitely_enable_video_x11_xrandr=yes
  1188                         fi
  1189                     fi
  1190                 fi
  1191             fi
  1192             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1193                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
  1194             fi
  1195             AC_ARG_ENABLE(video-x11-scrnsaver,
  1196 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1197                             , enable_video_x11_scrnsaver=yes)
  1198             if test x$enable_video_x11_scrnsaver = xyes; then
  1199                 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1200                                 have_scrnsaver_h_hdr=yes,
  1201                                 have_scrnsaver_h_hdr=no,
  1202                                 [#include <X11/Xlib.h>
  1203                                 ])
  1204                 if test x$have_scrnsaver_h_hdr = xyes; then
  1205                     if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1206                         echo "-- dynamic libXss -> $xss_lib"
  1207                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
  1208                         definitely_enable_video_x11_scrnsaver=yes
  1209                     else
  1210                         AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1211                         if test x$have_xss_lib = xyes ; then
  1212                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1213                             definitely_enable_video_x11_scrnsaver=yes
  1214                         fi
  1215                     fi
  1216                 fi
  1217             fi
  1218             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1219                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER)
  1220             fi
  1221             AC_ARG_ENABLE(video-x11-xshape,
  1222 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
  1223                             , enable_video_x11_xshape=yes)
  1224             if test x$enable_video_x11_xshape = xyes; then
  1225                 AC_CHECK_HEADER(X11/extensions/shape.h,
  1226                                 have_shape_h_hdr=yes,
  1227                                 have_shape_h_hdr=no,
  1228                                 [#include <X11/Xlib.h>
  1229                                 ])
  1230                 if test x$have_shape_h_hdr = xyes; then
  1231                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE)
  1232                 fi
  1233             fi
  1234             AC_ARG_ENABLE(video-x11-vm,
  1235 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1236                             , enable_video_x11_vm=yes)
  1237             if test x$enable_video_x11_vm = xyes; then
  1238                 definitely_enable_video_x11_vm=no
  1239                 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
  1240                                 have_vm_h_hdr=yes,
  1241                                 have_vm_h_hdr=no,
  1242                                 [#include <X11/Xlib.h>
  1243                                 ])
  1244                 if test x$have_vm_h_hdr = xyes; then
  1245                     if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
  1246                         echo "-- dynamic libXxf86vm -> $xvidmode_lib"
  1247                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib")
  1248                         definitely_enable_video_x11_vm=yes
  1249                     else
  1250                         AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
  1251                         if test x$have_vm_lib = xyes ; then
  1252                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
  1253                             definitely_enable_video_x11_vm=yes
  1254                         fi
  1255                     fi
  1256                 fi
  1257             fi
  1258             if test x$definitely_enable_video_x11_vm = xyes; then
  1259                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE)
  1260             fi
  1261         fi
  1262     fi
  1263 }
  1264 
  1265 dnl Set up the BWindow video driver if enabled
  1266 CheckBWINDOW()
  1267 {
  1268     if test x$enable_video = xyes; then
  1269         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
  1270         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
  1271         have_video=yes
  1272     fi
  1273 }
  1274 
  1275 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1276 CheckCOCOA()
  1277 {
  1278     AC_ARG_ENABLE(video-cocoa,
  1279 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1280                   , enable_video_cocoa=yes)
  1281     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1282         save_CFLAGS="$CFLAGS"
  1283         dnl work around that we don't have Objective-C support in autoconf
  1284         CFLAGS="$CFLAGS -x objective-c"
  1285         AC_MSG_CHECKING(for Cocoa framework)
  1286         have_cocoa=no
  1287         AC_TRY_COMPILE([
  1288           #import <Cocoa/Cocoa.h>
  1289         ],[
  1290         ],[
  1291         have_cocoa=yes
  1292         ])
  1293         AC_MSG_RESULT($have_cocoa)
  1294         CFLAGS="$save_CFLAGS"
  1295         if test x$have_cocoa = xyes; then
  1296             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
  1297             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1298             have_video=yes
  1299         fi
  1300     fi
  1301 }
  1302 
  1303 dnl Find DirectFB
  1304 CheckDirectFB()
  1305 {
  1306     AC_ARG_ENABLE(video-directfb,
  1307 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  1308                   , enable_video_directfb=no)
  1309     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1310         video_directfb=no
  1311 
  1312         DIRECTFB_REQUIRED_VERSION=1.0.0
  1313         AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
  1314         if test x$DIRECTFBCONFIG = xno; then
  1315             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1316             if test x$PKG_CONFIG != xno; then
  1317                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1318                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1319                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1320                     DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
  1321                     video_directfb=yes
  1322                 fi
  1323             fi
  1324         else
  1325             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1326             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1327             set -- `directfb-config --version | sed 's/\./ /g'`
  1328             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1329             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1330                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1331                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1332                 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
  1333                 video_directfb=yes
  1334             fi
  1335         fi
  1336         if test x$video_directfb = xyes; then
  1337             # SuSE 11.1 installs directfb-config without directfb-devel
  1338             save_CPPFLAGS="$CPPFLAGS"
  1339             CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  1340             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1341             CPPFLAGS="$save_CPPFLAGS"
  1342             video_directfb=$have_directfb_hdr
  1343         fi
  1344         AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1345         AC_MSG_RESULT($video_directfb)
  1346 
  1347         if test x$video_directfb = xyes; then
  1348             AC_ARG_ENABLE(directfb-shared,
  1349 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  1350                               , enable_directfb_shared=yes)
  1351 
  1352             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1353             AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB)
  1354             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1355             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1356 
  1357             AC_MSG_CHECKING(for directfb dynamic loading support)
  1358             directfb_shared=no
  1359             directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
  1360             # | sed 's/.*\/\(.*\)/\1/; q'`]
  1361 AC_MSG_WARN("directfb $directfb_lib")
  1362             if test x$have_loadso != xyes && \
  1363                test x$enable_directfb_shared = xyes; then
  1364                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1365             fi
  1366             if test x$have_loadso = xyes && \
  1367                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1368                 directfb_shared=yes
  1369                 echo "-- $directfb_lib_spec -> $directfb_lib"
  1370                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
  1371             else
  1372                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1373             fi
  1374             AC_MSG_RESULT($directfb_shared)
  1375             have_video=yes
  1376         fi
  1377     fi
  1378 }
  1379 
  1380 dnl Find FusionSound
  1381 CheckFusionSound()
  1382 {
  1383     AC_ARG_ENABLE(fusionsound,
  1384 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1385                   , enable_fusionsound=no)
  1386     if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1387         fusionsound=no
  1388 
  1389         FUSIONSOUND_REQUIRED_VERSION=1.1.1
  1390 
  1391         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1392         AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
  1393         if test x$PKG_CONFIG != xno; then
  1394             if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
  1395                 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
  1396                 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
  1397                 fusionsound=yes
  1398             fi
  1399         fi
  1400         AC_MSG_RESULT($fusionsound)
  1401 
  1402         if test x$fusionsound = xyes; then
  1403             AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
  1404             SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1405             EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1406             
  1407             AC_ARG_ENABLE(fusionsound-shared,
  1408 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1409                           , enable_fusionsound_shared=yes)
  1410             fusionsound_shared=no
  1411             AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1412             if test x$have_loadso != xyes && \
  1413                test x$enable_fusionsound_shared = xyes; then
  1414                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1415             fi
  1416             if test x$have_loadso = xyes && \
  1417                test x$enable_fusionsound_shared = xyes; then
  1418                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
  1419                 fusionsound_shared=yes
  1420             else
  1421                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1422             fi
  1423             AC_MSG_RESULT($fusionsound_shared)
  1424             
  1425             have_audio=yes
  1426         fi
  1427     fi
  1428 }
  1429 
  1430 dnl rcg04172001 Set up the Null video driver.
  1431 CheckDummyVideo()
  1432 {
  1433     AC_ARG_ENABLE(video-dummy,
  1434 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1435                   , enable_video_dummy=yes)
  1436     if test x$enable_video_dummy = xyes; then
  1437         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1438         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1439         have_video=yes
  1440     fi
  1441 }
  1442 
  1443 dnl Check to see if OpenGL support is desired
  1444 AC_ARG_ENABLE(video-opengl,
  1445 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1446               , enable_video_opengl=yes)
  1447 
  1448 dnl Find OpenGL
  1449 CheckOpenGLX11()
  1450 {
  1451     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1452         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1453         video_opengl=no
  1454         AC_TRY_COMPILE([
  1455          #include <GL/gl.h>
  1456          #include <GL/glx.h>
  1457         ],[
  1458         ],[
  1459         video_opengl=yes
  1460         ])
  1461         AC_MSG_RESULT($video_opengl)
  1462         if test x$video_opengl = xyes; then
  1463             AC_DEFINE(SDL_VIDEO_OPENGL)
  1464             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1465             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1466         fi
  1467     fi
  1468 }
  1469 
  1470 dnl Check for Windows OpenGL
  1471 CheckWINDOWSGL()
  1472 {
  1473     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1474         AC_DEFINE(SDL_VIDEO_OPENGL)
  1475         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1476         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1477     fi
  1478 }
  1479 
  1480 dnl Check for BeOS OpenGL
  1481 CheckBeGL()
  1482 {
  1483     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1484         AC_DEFINE(SDL_VIDEO_OPENGL)
  1485         AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
  1486         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1487         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1488     fi
  1489 }
  1490 
  1491 dnl Check for MacOS OpenGL
  1492 CheckMacGL()
  1493 {
  1494     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1495         AC_DEFINE(SDL_VIDEO_OPENGL)
  1496         AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
  1497         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1498         case "$host" in
  1499             *-*-darwin*)
  1500                 if test x$enable_video_cocoa = xyes; then
  1501                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1502                 fi
  1503         esac
  1504     fi
  1505 }
  1506 
  1507 dnl See if we can use the new unified event interface in Linux 2.4
  1508 CheckInputEvents()
  1509 {
  1510     dnl Check for Linux 2.4 unified input event interface support
  1511     AC_ARG_ENABLE(input-events,
  1512 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1513                   , enable_input_events=yes)
  1514     if test x$enable_input_events = xyes; then
  1515         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1516         use_input_events=no
  1517         AC_TRY_COMPILE([
  1518           #include <linux/input.h>
  1519         ],[
  1520           #ifndef EVIOCGNAME
  1521           #error EVIOCGNAME() ioctl not available
  1522           #endif
  1523         ],[
  1524         use_input_events=yes
  1525         ])
  1526         AC_MSG_RESULT($use_input_events)
  1527         if test x$use_input_events = xyes; then
  1528             AC_DEFINE(SDL_INPUT_LINUXEV)
  1529         fi
  1530     fi
  1531 }
  1532 
  1533 dnl See if we can use the Touchscreen input library
  1534 CheckTslib()
  1535 {
  1536     AC_ARG_ENABLE(input-tslib,
  1537 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1538                   , enable_input_tslib=yes)
  1539     if test x$enable_input_tslib = xyes; then
  1540         AC_MSG_CHECKING(for Touchscreen library support)
  1541         enable_input_tslib=no
  1542         AC_TRY_COMPILE([
  1543           #include "tslib.h"
  1544         ],[
  1545         ],[
  1546         enable_input_tslib=yes
  1547         ])
  1548         AC_MSG_RESULT($enable_input_tslib)
  1549         if test x$enable_input_tslib = xyes; then
  1550             AC_DEFINE(SDL_INPUT_TSLIB)
  1551             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1552         fi
  1553     fi
  1554 }
  1555 
  1556 dnl See what type of thread model to use on Linux and Solaris
  1557 CheckPTHREAD()
  1558 {
  1559     dnl Check for pthread support
  1560     AC_ARG_ENABLE(pthreads,
  1561 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1562                   , enable_pthreads=yes)
  1563     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1564     AC_ARG_ENABLE(pthread-sem,
  1565 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1566                   , enable_pthread_sem=yes)
  1567     case "$host" in
  1568         *-*-linux*|*-*-uclinux*)
  1569             pthread_cflags="-D_REENTRANT"
  1570             pthread_lib="-lpthread"
  1571             ;;
  1572         *-*-bsdi*)
  1573             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1574             pthread_lib=""
  1575             ;;
  1576         *-*-darwin*)
  1577             pthread_cflags="-D_THREAD_SAFE"
  1578 # causes Carbon.p complaints?
  1579 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1580             ;;
  1581         *-*-freebsd*|*-*-dragonfly*)
  1582             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1583             pthread_lib="-pthread"
  1584             ;;
  1585         *-*-netbsd*)
  1586             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1587             pthread_lib="-lpthread"
  1588             ;;
  1589         *-*-openbsd*)
  1590             pthread_cflags="-D_REENTRANT"
  1591             pthread_lib="-pthread"
  1592             ;;
  1593         *-*-solaris*)
  1594             pthread_cflags="-D_REENTRANT"
  1595             pthread_lib="-lpthread -lposix4"
  1596             ;;
  1597         *-*-sysv5*)
  1598             pthread_cflags="-D_REENTRANT -Kthread"
  1599             pthread_lib=""
  1600             ;;
  1601         *-*-aix*)
  1602             pthread_cflags="-D_REENTRANT -mthreads"
  1603             pthread_lib="-lpthread"
  1604             ;;
  1605         *-*-hpux11*)
  1606             pthread_cflags="-D_REENTRANT"
  1607             pthread_lib="-L/usr/lib -lpthread"
  1608             ;;
  1609         *)
  1610             pthread_cflags="-D_REENTRANT"
  1611             pthread_lib="-lpthread"
  1612             ;;
  1613     esac
  1614     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1615         # Save the original compiler flags and libraries
  1616         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1617         # Add the pthread compiler flags and libraries
  1618         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1619         # Check to see if we have pthread support on this system
  1620         AC_MSG_CHECKING(for pthreads)
  1621         use_pthreads=no
  1622         AC_TRY_LINK([
  1623          #include <pthread.h>
  1624         ],[
  1625          pthread_attr_t type;
  1626          pthread_attr_init(&type);
  1627         ],[
  1628         use_pthreads=yes
  1629         ])
  1630         AC_MSG_RESULT($use_pthreads)
  1631         # Restore the compiler flags and libraries
  1632         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1633 
  1634         # Do futher testing if we have pthread support...
  1635         if test x$use_pthreads = xyes; then
  1636             AC_DEFINE(SDL_THREAD_PTHREAD)
  1637             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1638             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1639             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1640             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1641 
  1642             # Save the original compiler flags and libraries
  1643             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1644             # Add the pthread compiler flags and libraries
  1645             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1646 
  1647             # Check to see if recursive mutexes are available
  1648             AC_MSG_CHECKING(for recursive mutexes)
  1649             has_recursive_mutexes=no
  1650             if test x$has_recursive_mutexes = xno; then
  1651                 AC_TRY_COMPILE([
  1652                   #include <pthread.h>
  1653                 ],[
  1654                   pthread_mutexattr_t attr;
  1655                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1656                 ],[
  1657                 has_recursive_mutexes=yes
  1658                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1659                 ])
  1660             fi
  1661             if test x$has_recursive_mutexes = xno; then
  1662                 AC_TRY_COMPILE([
  1663                   #include <pthread.h>
  1664                 ],[
  1665                   pthread_mutexattr_t attr;
  1666                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1667                 ],[
  1668                 has_recursive_mutexes=yes
  1669                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1670                 ])
  1671             fi
  1672             AC_MSG_RESULT($has_recursive_mutexes)
  1673 
  1674             # Check to see if pthread semaphore support is missing
  1675             if test x$enable_pthread_sem = xyes; then
  1676                 AC_MSG_CHECKING(for pthread semaphores)
  1677                 have_pthread_sem=no
  1678                 AC_TRY_COMPILE([
  1679                   #include <pthread.h>
  1680                   #include <semaphore.h>
  1681                 ],[
  1682                 ],[
  1683                 have_pthread_sem=yes
  1684                 ])
  1685                 AC_MSG_RESULT($have_pthread_sem)
  1686             fi
  1687 
  1688             # Restore the compiler flags and libraries
  1689             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1690 
  1691             # Basic thread creation functions
  1692             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1693 
  1694             # Semaphores
  1695             # We can fake these with mutexes and condition variables if necessary
  1696             if test x$have_pthread_sem = xyes; then
  1697                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1698             else
  1699                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1700             fi
  1701 
  1702             # Mutexes
  1703             # We can fake these with semaphores if necessary
  1704             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1705 
  1706             # Condition variables
  1707             # We can fake these with semaphores and mutexes if necessary
  1708             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1709 
  1710             have_threads=yes
  1711         fi
  1712     fi
  1713 }
  1714 
  1715 dnl Determine whether the compiler can produce Windows executables
  1716 CheckWINDOWS()
  1717 {
  1718     AC_MSG_CHECKING(Windows compiler)
  1719     have_win32_gcc=no
  1720     AC_TRY_COMPILE([
  1721      #include <windows.h>
  1722     ],[
  1723     ],[
  1724     have_win32_gcc=yes
  1725     ])
  1726     AC_MSG_RESULT($have_win32_gcc)
  1727     if test x$have_win32_gcc != xyes; then
  1728        AC_MSG_ERROR([
  1729 *** Your compiler ($CC) does not produce Windows executables!
  1730        ])
  1731     fi
  1732 
  1733     AC_MSG_CHECKING(Windows CE)
  1734     have_wince=no
  1735     AC_TRY_COMPILE([
  1736 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  1737 #error This is not Windows CE
  1738 #endif
  1739     ],[
  1740     ],[
  1741     have_wince=yes
  1742     ])
  1743     AC_MSG_RESULT($have_wince)
  1744 }
  1745 
  1746 dnl Find the DirectX includes and libraries
  1747 CheckDIRECTX()
  1748 {
  1749     AC_ARG_ENABLE(directx,
  1750 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
  1751                   , enable_directx=yes)
  1752     if test x$enable_directx = xyes; then
  1753         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  1754         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1755         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1756         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  1757     fi
  1758 }
  1759 
  1760 dnl Check for the dlfcn.h interface for dynamically loading objects
  1761 CheckDLOPEN()
  1762 {
  1763     AC_ARG_ENABLE(sdl-dlopen,
  1764 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1765                   , enable_sdl_dlopen=yes)
  1766     if test x$enable_sdl_dlopen = xyes; then
  1767         AC_MSG_CHECKING(for dlopen)
  1768         have_dlopen=no
  1769         AC_TRY_COMPILE([
  1770          #include <dlfcn.h>
  1771         ],[
  1772          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1773          #error Use dlcompat for Mac OS X 10.2 compatibility
  1774          #endif
  1775         ],[
  1776         have_dlopen=yes
  1777         ])
  1778         AC_MSG_RESULT($have_dlopen)
  1779 
  1780         if test x$have_dlopen = xyes; then
  1781             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1782                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1783                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1784             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1785             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1786             have_loadso=yes
  1787         fi
  1788     fi
  1789 }
  1790 
  1791 dnl Check for the usbhid(3) library on *BSD
  1792 CheckUSBHID()
  1793 {
  1794     if test x$enable_joystick = xyes; then
  1795         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1796         if test x$have_libusbhid = xyes; then
  1797             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1798             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1799             USB_LIBS="$USB_LIBS -lusbhid"
  1800         else
  1801             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1802             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1803             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1804         fi
  1805             
  1806         save_CFLAGS="$CFLAGS"
  1807         CFLAGS="$CFLAGS $USB_CFLAGS"
  1808 
  1809         AC_MSG_CHECKING(for usbhid)
  1810         have_usbhid=no
  1811         AC_TRY_COMPILE([
  1812           #include <sys/types.h>
  1813           #if defined(HAVE_USB_H)
  1814           #include <usb.h>
  1815           #endif
  1816           #ifdef __DragonFly__
  1817           # include <bus/usb/usb.h>
  1818           # include <bus/usb/usbhid.h>
  1819           #else
  1820           # include <dev/usb/usb.h>
  1821           # include <dev/usb/usbhid.h>
  1822           #endif
  1823           #if defined(HAVE_USBHID_H)
  1824           #include <usbhid.h>
  1825           #elif defined(HAVE_LIBUSB_H)
  1826           #include <libusb.h>
  1827           #elif defined(HAVE_LIBUSBHID_H)
  1828           #include <libusbhid.h>
  1829           #endif
  1830         ],[
  1831           struct report_desc *repdesc;
  1832           struct usb_ctl_report *repbuf;
  1833           hid_kind_t hidkind;
  1834         ],[
  1835         have_usbhid=yes
  1836         ])
  1837         AC_MSG_RESULT($have_usbhid)
  1838 
  1839         if test x$have_usbhid = xyes; then
  1840             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1841             have_usbhid_ucr_data=no
  1842             AC_TRY_COMPILE([
  1843               #include <sys/types.h>
  1844               #if defined(HAVE_USB_H)
  1845               #include <usb.h>
  1846               #endif
  1847               #ifdef __DragonFly__
  1848               # include <bus/usb/usb.h>
  1849               # include <bus/usb/usbhid.h>
  1850               #else
  1851               # include <dev/usb/usb.h>
  1852               # include <dev/usb/usbhid.h>
  1853               #endif
  1854               #if defined(HAVE_USBHID_H)
  1855               #include <usbhid.h>
  1856               #elif defined(HAVE_LIBUSB_H)
  1857               #include <libusb.h>
  1858               #elif defined(HAVE_LIBUSBHID_H)
  1859               #include <libusbhid.h>
  1860               #endif
  1861             ],[
  1862               struct usb_ctl_report buf;
  1863               if (buf.ucr_data) { }
  1864             ],[
  1865             have_usbhid_ucr_data=yes
  1866             ])
  1867             if test x$have_usbhid_ucr_data = xyes; then
  1868                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1869             fi
  1870             AC_MSG_RESULT($have_usbhid_ucr_data)
  1871             
  1872             AC_MSG_CHECKING(for new usbhid API)
  1873             have_usbhid_new=no
  1874             AC_TRY_COMPILE([
  1875               #include <sys/types.h>
  1876               #if defined(HAVE_USB_H)
  1877               #include <usb.h>
  1878               #endif
  1879               #ifdef __DragonFly__
  1880               #include <bus/usb/usb.h>
  1881               #include <bus/usb/usbhid.h>
  1882               #else
  1883               #include <dev/usb/usb.h>
  1884               #include <dev/usb/usbhid.h>
  1885               #endif
  1886               #if defined(HAVE_USBHID_H)
  1887               #include <usbhid.h>
  1888               #elif defined(HAVE_LIBUSB_H)
  1889               #include <libusb.h>
  1890               #elif defined(HAVE_LIBUSBHID_H)
  1891               #include <libusbhid.h>
  1892               #endif
  1893             ],[
  1894               report_desc_t d;
  1895               hid_start_parse(d, 1, 1);
  1896             ],[
  1897             have_usbhid_new=yes
  1898             ])
  1899             if test x$have_usbhid_new = xyes; then
  1900                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  1901             fi
  1902             AC_MSG_RESULT($have_usbhid_new)
  1903 
  1904             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  1905             have_machine_joystick=no
  1906             AC_TRY_COMPILE([
  1907               #include <machine/joystick.h>
  1908             ],[
  1909               struct joystick t;
  1910             ],[
  1911             have_machine_joystick=yes
  1912             ])
  1913             if test x$have_machine_joystick = xyes; then
  1914                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  1915             fi
  1916             AC_MSG_RESULT($have_machine_joystick)
  1917 
  1918             AC_DEFINE(SDL_JOYSTICK_USBHID)
  1919             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  1920             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  1921             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  1922             have_joystick=yes
  1923         fi
  1924         CFLAGS="$save_CFLAGS"
  1925     fi
  1926 }
  1927 
  1928 dnl Check for clock_gettime()
  1929 CheckClockGettime()
  1930 {
  1931     AC_ARG_ENABLE(clock_gettime,
  1932 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  1933                   , enable_clock_gettime=no)
  1934     if test x$enable_clock_gettime = xyes; then
  1935         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  1936         if test x$have_clock_gettime = xyes; then
  1937             AC_DEFINE(HAVE_CLOCK_GETTIME)
  1938             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  1939         else
  1940             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  1941             if test x$have_clock_gettime = xyes; then
  1942                AC_DEFINE(HAVE_CLOCK_GETTIME)
  1943                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  1944             fi
  1945         fi
  1946     fi
  1947 }
  1948 
  1949 dnl Check for a valid linux/version.h
  1950 CheckLinuxVersion()
  1951 {
  1952     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  1953     if test x$have_linux_version_h = xyes; then
  1954         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  1955     fi
  1956 }
  1957 
  1958 dnl Check if we want to use RPATH
  1959 CheckRPATH()
  1960 {
  1961     AC_ARG_ENABLE(rpath,
  1962 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  1963                   , enable_rpath=yes)
  1964 }
  1965 
  1966 dnl Set up the configuration based on the host platform!
  1967 case "$host" in
  1968     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
  1969         case "$host" in
  1970             *-*-linux*)         ARCH=linux ;;
  1971             *-*-uclinux*)       ARCH=linux ;;
  1972             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  1973             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  1974             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  1975             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  1976             *-*-bsdi*)          ARCH=bsdi ;;
  1977             *-*-freebsd*)       ARCH=freebsd ;;
  1978             *-*-dragonfly*)     ARCH=freebsd ;;
  1979             *-*-netbsd*)        ARCH=netbsd ;;
  1980             *-*-openbsd*)       ARCH=openbsd ;;
  1981             *-*-sysv5*)         ARCH=sysv5 ;;
  1982             *-*-solaris*)       ARCH=solaris ;;
  1983             *-*-hpux*)          ARCH=hpux ;;
  1984             *-*-aix*)           ARCH=aix ;;
  1985             *-*-minix*)         ARCH=minix ;;
  1986         esac
  1987         CheckVisibilityHidden
  1988         CheckDummyVideo
  1989         CheckDiskAudio
  1990         CheckDummyAudio
  1991         CheckDLOPEN
  1992         CheckOSS
  1993         CheckALSA
  1994         CheckPulseAudio
  1995         CheckARTSC
  1996         CheckESD
  1997         CheckNAS
  1998         CheckX11
  1999         CheckDirectFB
  2000         CheckFusionSound
  2001         CheckOpenGLX11
  2002         CheckInputEvents
  2003         CheckTslib
  2004         CheckUSBHID
  2005         CheckPTHREAD
  2006         CheckClockGettime
  2007         CheckLinuxVersion
  2008         CheckRPATH
  2009         # Set up files for the audio library
  2010         if test x$enable_audio = xyes; then
  2011           case $ARCH in
  2012             sysv5|solaris|hpux)
  2013                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2014                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2015                 have_audio=yes
  2016             ;;
  2017             netbsd|openbsd)
  2018                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2019                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2020                 have_audio=yes
  2021             ;;
  2022             aix)
  2023                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
  2024                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2025                 have_audio=yes
  2026             ;;
  2027           esac
  2028         fi
  2029         # Set up files for the joystick library
  2030         if test x$enable_joystick = xyes; then
  2031           case $ARCH in
  2032             linux)
  2033                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2034                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2035                 have_joystick=yes
  2036             ;;
  2037           esac
  2038         fi
  2039         # Set up files for the haptic library
  2040         if test x$enable_haptic = xyes; then
  2041            if test x$use_input_events = xyes; then
  2042              case $ARCH in
  2043                linux)
  2044                    AC_DEFINE(SDL_HAPTIC_LINUX)
  2045                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2046                    have_haptic=yes
  2047                ;;
  2048              esac
  2049            fi
  2050         fi
  2051         # Set up files for the power library
  2052         if test x$enable_power = xyes; then
  2053              case $ARCH in
  2054                linux)
  2055                    AC_DEFINE(SDL_POWER_LINUX)
  2056                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2057                    have_power=yes
  2058                ;;
  2059              esac
  2060         fi
  2061         # Set up files for the timer library
  2062         if test x$enable_timers = xyes; then
  2063             AC_DEFINE(SDL_TIMER_UNIX)
  2064             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2065             have_timers=yes
  2066         fi
  2067         ;;
  2068     *-wince* | *-mingw32ce)
  2069         ARCH=win32
  2070         CheckDummyVideo
  2071         CheckDiskAudio
  2072         CheckDummyAudio
  2073         CheckWINDOWS
  2074         if test x$enable_video = xyes; then
  2075             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
  2076             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  2077             have_video=yes
  2078             AC_ARG_ENABLE(render-d3d,
  2079 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2080                                 , enable_render_d3d=yes)
  2081             enable_render_d3d=no
  2082             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2083                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2084             fi
  2085         fi
  2086         # Set up files for the audio library
  2087         if test x$enable_audio = xyes; then
  2088             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2089             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2090             if test x$have_dsound = xyes; then
  2091                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2092                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2093             fi
  2094             have_audio=yes
  2095         fi
  2096         # Set up dummy files for the joystick for now
  2097         if test x$enable_joystick = xyes; then
  2098             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2099             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2100             have_joystick=yes
  2101         fi
  2102         # Set up files for the thread library
  2103         if test x$enable_threads = xyes; then
  2104             AC_DEFINE(SDL_THREAD_WINDOWS)
  2105             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
  2106             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
  2107             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
  2108             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2109             have_threads=yes
  2110         fi
  2111         # Set up files for the timer library
  2112         if test x$enable_timers = xyes; then
  2113             AC_DEFINE(SDL_TIMER_WINCE)
  2114             SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
  2115             have_timers=yes
  2116         fi
  2117         # Set up files for the shared object loading library
  2118         if test x$enable_loadso = xyes; then
  2119             AC_DEFINE(SDL_LOADSO_WINDOWS)
  2120             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  2121             have_loadso=yes
  2122         fi
  2123         # Set up the system libraries we need
  2124         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
  2125 
  2126 	# mingw32ce library
  2127 	case "$host" in
  2128     	    *-mingw32ce)
  2129     		EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
  2130     		;;
  2131     	    *)
  2132         	;;
  2133 	esac
  2134 
  2135         # The Windows platform requires special setup
  2136         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  2137         EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
  2138         EXTRA_LDFLAGS="-lSDLmain $EXTRA_LDFLAGS"
  2139         ;;
  2140     *-*-cygwin* | *-*-mingw32*)
  2141         ARCH=win32
  2142         if test "$build" != "$host"; then # cross-compiling
  2143             # Default cross-compile location
  2144             ac_default_prefix=/usr/local/cross-tools/$host
  2145         else
  2146             # Look for the location of the tools and install there
  2147             if test "$BUILD_PREFIX" != ""; then
  2148                 ac_default_prefix=$BUILD_PREFIX
  2149             fi
  2150         fi
  2151         CheckDummyVideo
  2152         CheckDiskAudio
  2153         CheckDummyAudio
  2154         CheckWINDOWS
  2155         CheckWINDOWSGL
  2156         CheckDIRECTX
  2157 
  2158         # Set up the core platform files
  2159         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  2160 
  2161         # Set up files for the video library
  2162         if test x$enable_video = xyes; then
  2163             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
  2164             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  2165             have_video=yes
  2166             AC_ARG_ENABLE(render-d3d,
  2167 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2168                                 , enable_render_d3d=yes)
  2169             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2170                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2171             fi
  2172         fi
  2173         # Set up files for the audio library
  2174         if test x$enable_audio = xyes; then
  2175             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2176             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2177             if test x$have_dsound = xyes; then
  2178                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2179                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2180             fi
  2181             have_audio=yes
  2182         fi
  2183         # Set up files for the joystick library
  2184         if test x$enable_joystick = xyes; then
  2185             if test x$have_dinput = xyes; then
  2186                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2187                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
  2188                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  2189             else
  2190                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2191                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
  2192             fi
  2193             have_joystick=yes
  2194         fi
  2195         if test x$enable_haptic = xyes; then
  2196             if test x$have_dinput = xyes; then
  2197                 AC_DEFINE(SDL_HAPTIC_DINPUT)
  2198                 SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
  2199                 have_haptic=yes
  2200             fi
  2201         fi
  2202         if test x$enable_power = xyes; then
  2203             AC_DEFINE(SDL_POWER_WINDOWS)
  2204             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2205             have_power=yes
  2206         fi
  2207         # Set up files for the thread library
  2208         if test x$enable_threads = xyes; then
  2209             AC_DEFINE(SDL_THREAD_WINDOWS)
  2210             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
  2211             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
  2212             SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
  2213             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2214             have_threads=yes
  2215         fi
  2216         # Set up files for the timer library
  2217         if test x$enable_timers = xyes; then
  2218             AC_DEFINE(SDL_TIMER_WINDOWS)
  2219             SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  2220             have_timers=yes
  2221         fi
  2222         # Set up files for the shared object loading library
  2223         if test x$enable_loadso = xyes; then
  2224             AC_DEFINE(SDL_LOADSO_WINDOWS)
  2225             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  2226             have_loadso=yes
  2227         fi
  2228         # Set up the system libraries we need
  2229         # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
  2230         # You can get this here: http://libunicows.sourceforge.net/
  2231         #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
  2232         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lversion -luuid"
  2233         # The Windows platform requires special setup
  2234         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  2235         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  2236         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2237         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2238         ;;
  2239     *-*-beos* | *-*-haiku*)
  2240         ARCH=beos
  2241         ac_default_prefix=/boot/develop/tools/gnupro
  2242         CheckDummyVideo
  2243         CheckDiskAudio
  2244         CheckDummyAudio
  2245         CheckBWINDOW
  2246         CheckBeGL
  2247         # Set up files for the audio library
  2248         if test x$enable_audio = xyes; then
  2249             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
  2250             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2251             have_audio=yes
  2252         fi
  2253         # Set up files for the joystick library
  2254         if test x$enable_joystick = xyes; then
  2255             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2256             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2257             have_joystick=yes
  2258         fi
  2259         # Set up files for the thread library
  2260         if test x$enable_threads = xyes; then
  2261             AC_DEFINE(SDL_THREAD_BEOS)
  2262             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2263             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2264             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2265             have_threads=yes
  2266         fi
  2267         # Set up files for the timer library
  2268         if test x$enable_timers = xyes; then
  2269             AC_DEFINE(SDL_TIMER_BEOS)
  2270             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2271             have_timers=yes
  2272         fi
  2273         # Set up files for the shared object loading library
  2274         if test x$enable_loadso = xyes; then
  2275             AC_DEFINE(SDL_LOADSO_BEOS)
  2276             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2277             have_loadso=yes
  2278         fi
  2279         # Set up files for the system power library
  2280         if test x$enable_power = xyes; then
  2281             AC_DEFINE(SDL_POWER_BEOS)
  2282             SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
  2283             have_power=yes
  2284         fi
  2285         # The BeOS platform requires special setup.
  2286         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2287         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2288         ;;
  2289     *-*-darwin* )
  2290         # This could be either full "Mac OS X", or plain "Darwin" which is
  2291         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2292         # Next line is broken, and a few files below require Mac OS X (full)
  2293         ARCH=macosx
  2294 
  2295         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2296         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2297         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2298 
  2299         CheckVisibilityHidden
  2300         CheckDummyVideo
  2301         CheckDiskAudio
  2302         CheckDummyAudio
  2303         CheckDLOPEN
  2304 
  2305         # Set up files for the shared object loading library
  2306         # (this needs to be done before the dynamic X11 check)
  2307         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2308             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2309             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2310             have_loadso=yes
  2311         fi
  2312 
  2313         CheckCOCOA
  2314         CheckX11
  2315         CheckMacGL
  2316         CheckOpenGLX11
  2317         CheckPTHREAD
  2318 
  2319         # Good optimization on Mac OS X, yes...
  2320         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2321 
  2322         # Need this or things might misbuild on a G3.
  2323         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2324 
  2325         # Set up files for the audio library
  2326         if test x$enable_audio = xyes; then
  2327             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2328             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2329             have_audio=yes
  2330         fi
  2331         # Set up files for the joystick library
  2332         if test x$enable_joystick = xyes; then
  2333             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2334             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2335             have_joystick=yes
  2336         fi
  2337         # Set up files for the haptic library
  2338         if test x$enable_haptic = xyes; then
  2339             AC_DEFINE(SDL_HAPTIC_IOKIT)
  2340             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2341             have_haptic=yes
  2342             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2343         fi
  2344         # Set up files for the power library
  2345         if test x$enable_power = xyes; then
  2346             AC_DEFINE(SDL_POWER_MACOSX)
  2347             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2348             have_power=yes
  2349         fi
  2350         # Set up files for the timer library
  2351         if test x$enable_timers = xyes; then
  2352             AC_DEFINE(SDL_TIMER_UNIX)
  2353             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2354             have_timers=yes
  2355         fi
  2356         # Set up additional files for the file library
  2357         if test x$enable_file = xyes; then
  2358             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2359         fi
  2360         # The Mac OS X platform requires special setup.
  2361         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2362         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2363         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2364         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2365         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2366         # If audio is used, add the AudioUnit framework
  2367         if test x$enable_audio = xyes; then
  2368             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2369         fi
  2370         ;;
  2371     *)
  2372         AC_MSG_ERROR([
  2373 *** Unsupported host:  Please add to configure.in
  2374         ])
  2375         ;;
  2376 esac
  2377 
  2378 # Verify that we have all the platform specific files we need
  2379 
  2380 if test x$have_joystick != xyes; then
  2381     if test x$enable_joystick = xyes; then
  2382         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2383     fi
  2384     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2385 fi
  2386 if test x$have_haptic != xyes; then
  2387     if test x$enable_haptic = xyes; then
  2388         AC_DEFINE(SDL_HAPTIC_DISABLED)
  2389     fi
  2390     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2391 fi
  2392 if test x$have_threads != xyes; then
  2393     if test x$enable_threads = xyes; then
  2394         AC_DEFINE(SDL_THREADS_DISABLED)
  2395     fi
  2396     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2397 fi
  2398 if test x$have_timers != xyes; then
  2399     if test x$enable_timers = xyes; then
  2400         AC_DEFINE(SDL_TIMERS_DISABLED)
  2401     fi
  2402     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2403 fi
  2404 if test x$have_loadso != xyes; then
  2405     if test x$enable_loadso = xyes; then
  2406         AC_DEFINE(SDL_LOADSO_DISABLED)
  2407     fi
  2408     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2409 fi
  2410 if test x$SDLMAIN_SOURCES = x; then
  2411     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2412 fi
  2413 
  2414 OBJECTS=`echo $SOURCES`
  2415 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  2416 for EXT in asm cc m c S; do
  2417     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2418     DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  2419 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  2420 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2421 done
  2422 
  2423 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2424 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2425 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2426 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  2427 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  2428 	\\$(WINDRES) \\$< \\$@,g"`
  2429 
  2430 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2431 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2432 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2433 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2434 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2435 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2436 
  2437 # Set runtime shared library paths as needed
  2438 
  2439 if test "x$enable_rpath" = "xyes"; then
  2440   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
  2441     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2442   fi
  2443   if test $ARCH = solaris; then
  2444     SDL_RLD_FLAGS="-R\${libdir}"
  2445   fi
  2446 else
  2447   SDL_RLD_FLAGS=""
  2448 fi
  2449 
  2450 case "$ARCH" in
  2451   macosx)
  2452     # Evil hack to allow static linking on Mac OS X
  2453     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2454     ;;
  2455   *)
  2456     SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2457     ;;
  2458 esac
  2459 
  2460 dnl Expand the cflags and libraries needed by apps using SDL
  2461 AC_SUBST(SDL_CFLAGS)
  2462 AC_SUBST(SDL_LIBS)
  2463 AC_SUBST(SDL_STATIC_LIBS)
  2464 AC_SUBST(SDL_RLD_FLAGS)
  2465 if test x$enable_shared = xyes; then
  2466     ENABLE_SHARED_TRUE=
  2467     ENABLE_SHARED_FALSE="#"
  2468 else
  2469     ENABLE_SHARED_TRUE="#"
  2470     ENABLE_SHARED_FALSE=
  2471 fi
  2472 if test x$enable_static = xyes; then
  2473     ENABLE_STATIC_TRUE=
  2474     ENABLE_STATIC_FALSE="#"
  2475 else
  2476     ENABLE_STATIC_TRUE="#"
  2477     ENABLE_STATIC_FALSE=
  2478 fi
  2479 AC_SUBST(ENABLE_SHARED_TRUE)
  2480 AC_SUBST(ENABLE_SHARED_FALSE)
  2481 AC_SUBST(ENABLE_STATIC_TRUE)
  2482 AC_SUBST(ENABLE_STATIC_FALSE)
  2483 
  2484 dnl Expand the sources and objects needed to build the library
  2485 AC_SUBST(ac_aux_dir)
  2486 AC_SUBST(INCLUDE)
  2487 AC_SUBST(OBJECTS)
  2488 AC_SUBST(VERSION_OBJECTS)
  2489 AC_SUBST(SDLMAIN_OBJECTS)
  2490 AC_SUBST(BUILD_CFLAGS)
  2491 AC_SUBST(EXTRA_CFLAGS)
  2492 AC_SUBST(BUILD_LDFLAGS)
  2493 AC_SUBST(EXTRA_LDFLAGS)
  2494 AC_SUBST(WINDRES)
  2495 
  2496 cat >Makefile.rules <<__EOF__
  2497 
  2498 # Build rules for objects
  2499 -include \$(OBJECTS:.lo=.d)
  2500 
  2501 # Special dependency for SDL.c, since it depends on SDL_revision.h
  2502 $srcdir/src/SDL.c: update-revision
  2503 $DEPENDS
  2504 $VERSION_DEPENDS
  2505 $SDLMAIN_DEPENDS
  2506 __EOF__
  2507 
  2508 AC_CONFIG_FILES([
  2509     Makefile:Makefile.in:Makefile.rules sdl-config SDL.spec sdl.pc
  2510 ])
  2511 AC_OUTPUT