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