configure.in
author Ryan C. Gordon <icculus@icculus.org>
Fri, 03 Jun 2011 16:03:10 -0400
changeset 5547 4ccecd0901e2
parent 5512 56ab281d7d3e
child 5548 8f0abb6ef37d
permissions -rw-r--r--
Assert code's stdio interface was reading from the wrong variable.

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