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