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