configure.in
author Ryan C. Gordon <icculus@icculus.org>
Sat, 04 Jun 2011 15:26:02 -0400
changeset 5548 8f0abb6ef37d
parent 5512 56ab281d7d3e
child 5557 c1ed57cbfd66
permissions -rw-r--r--
Updated configure.in to be compatible with autoconf 2.67.

Still works with autoconf 2.61 (what ships with Xcode 3).

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