configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 04 Aug 2013 09:37:27 -0700
changeset 7573 b76d8bfe9a2f
parent 7554 4b653ef6050d
child 7659 ac4ce59c40e7
permissions -rw-r--r--
Fixed bug 1972 - Changeset 7379 (b27c778a2bdb) breaks make process with msys+mingw (make 3.82.90)

Andreas

With the patch applied, make is not able to find the rule for Makefile.in anymore. Removing the patch resolves the issue.

The path is in fact correct (in my case: /c/external/SDL64/SDL). But it seems the windows build of GNU Make doesn't work well with pathnames in rules. Both the dependencies in "$(srcdir)/configure: $(srcdir)/configure.in" and "Makefile: $(srcdir)/Makefile.in" will cause rules not to be found when srcdir is defined.

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