configure.in
author Ryan C. Gordon <icculus@icculus.org>
Tue, 20 Aug 2013 15:28:14 -0400
changeset 7666 603fb699946c
parent 7659 ac4ce59c40e7
child 7667 be1cc6f55840
permissions -rw-r--r--
Fixed cut-and-paste error.
     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 EGL support)
  1685         video_opengl_egl=no
  1686         AC_TRY_COMPILE([
  1687          #include <EGL/egl.h>
  1688         ],[
  1689         ],[
  1690         video_opengl_egl=yes
  1691         ])
  1692         AC_MSG_RESULT($video_opengl_egl)
  1693         if test x$video_opengl_egl = xyes; then
  1694             AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1695         fi
  1696             
  1697         AC_MSG_CHECKING(for OpenGL ES v1 headers)
  1698         video_opengles_v1=no
  1699         AC_TRY_COMPILE([
  1700          #include <GLES/gl.h>
  1701          #include <GLES/glext.h>
  1702         ],[
  1703         ],[
  1704         video_opengles_v1=yes
  1705         ])
  1706         AC_MSG_RESULT($video_opengles_v1)
  1707         if test x$video_opengles_v1 = xyes; then
  1708             AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  1709             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  1710         fi
  1711         
  1712         AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1713         video_opengles_v2=no
  1714         AC_TRY_COMPILE([
  1715          #include <GLES2/gl2.h>
  1716          #include <GLES2/gl2ext.h>
  1717         ],[
  1718         ],[
  1719         video_opengles_v2=yes
  1720         ])
  1721         AC_MSG_RESULT($video_opengles_v2)
  1722         if test x$video_opengles_v2 = xyes; then
  1723             AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1724             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1725         fi
  1726     fi
  1727 }
  1728 
  1729 dnl Check for Windows OpenGL
  1730 CheckWINDOWSGL()
  1731 {
  1732     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1733         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1734         AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
  1735         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1736     fi
  1737 }
  1738 
  1739 dnl Check for BeOS OpenGL
  1740 CheckBeGL()
  1741 {
  1742     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1743         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1744         AC_DEFINE(SDL_VIDEO_OPENGL_BGL, 1, [ ])
  1745         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1746         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1747     fi
  1748 }
  1749 
  1750 dnl Check for MacOS OpenGL
  1751 CheckMacGL()
  1752 {
  1753     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1754         AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1755         AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
  1756         AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1757         case "$host" in
  1758             *-*-darwin*)
  1759                 if test x$enable_video_cocoa = xyes; then
  1760                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1761                 fi
  1762         esac
  1763     fi
  1764 }
  1765 
  1766 dnl See if we can use the new unified event interface in Linux 2.4
  1767 CheckInputEvents()
  1768 {
  1769     dnl Check for Linux 2.4 unified input event interface support
  1770         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1771         use_input_events=no
  1772         AC_TRY_COMPILE([
  1773           #include <linux/input.h>
  1774         ],[
  1775           #ifndef EVIOCGNAME
  1776           #error EVIOCGNAME() ioctl not available
  1777           #endif
  1778         ],[
  1779         use_input_events=yes
  1780         ])
  1781         AC_MSG_RESULT($use_input_events)
  1782         if test x$use_input_events = xyes; then
  1783             AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
  1784         fi
  1785 }
  1786 
  1787 dnl See if the platform offers libudev for device enumeration and hotplugging.
  1788 CheckLibUDev()
  1789 {
  1790     AC_ARG_ENABLE(libudev,
  1791 AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
  1792                         , enable_libudev=yes)
  1793     if test x$enable_libudev = xyes; then
  1794         AC_CHECK_HEADER(libudev.h,
  1795                         have_libudev_h_hdr=yes,
  1796                         have_libudev_h_hdr=no)
  1797         if test x$have_libudev_h_hdr = xyes; then
  1798             AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
  1799         fi
  1800     fi
  1801 }
  1802 
  1803 dnl See if the platform offers libdbus for various IPC techniques.
  1804 CheckDBus()
  1805 {
  1806     AC_ARG_ENABLE(dbus,
  1807 AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
  1808                         , enable_dbus=yes)
  1809     if test x$enable_dbus = xyes; then
  1810         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1811         if test x$PKG_CONFIG != xno; then
  1812             DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
  1813             save_CFLAGS="$CFLAGS"
  1814             CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
  1815             AC_CHECK_HEADER(dbus/dbus.h,
  1816                             have_dbus_dbus_h_hdr=yes,
  1817                             have_dbus_dbus_h_hdr=no)
  1818             CFLAGS="$save_CFLAGS"
  1819             if test x$have_dbus_dbus_h_hdr = xyes; then
  1820                 AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
  1821                 EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
  1822             fi
  1823         fi
  1824     fi
  1825 }
  1826 
  1827 dnl See if we can use the Touchscreen input library
  1828 CheckTslib()
  1829 {
  1830     AC_ARG_ENABLE(input-tslib,
  1831 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1832                   , enable_input_tslib=yes)
  1833     if test x$enable_input_tslib = xyes; then
  1834         AC_MSG_CHECKING(for Touchscreen library support)
  1835         enable_input_tslib=no
  1836         AC_TRY_COMPILE([
  1837           #include "tslib.h"
  1838         ],[
  1839         ],[
  1840         enable_input_tslib=yes
  1841         ])
  1842         AC_MSG_RESULT($enable_input_tslib)
  1843         if test x$enable_input_tslib = xyes; then
  1844             AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
  1845             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1846         fi
  1847     fi
  1848 }
  1849 
  1850 dnl See what type of thread model to use on Linux and Solaris
  1851 CheckPTHREAD()
  1852 {
  1853     dnl Check for pthread support
  1854     AC_ARG_ENABLE(pthreads,
  1855 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1856                   , enable_pthreads=yes)
  1857     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1858     AC_ARG_ENABLE(pthread-sem,
  1859 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1860                   , enable_pthread_sem=yes)
  1861     case "$host" in
  1862         *-*-linux*|*-*-uclinux*)
  1863             pthread_cflags="-D_REENTRANT"
  1864             pthread_lib="-lpthread"
  1865             ;;
  1866         *-*-bsdi*)
  1867             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1868             pthread_lib=""
  1869             ;;
  1870         *-*-darwin*)
  1871             pthread_cflags="-D_THREAD_SAFE"
  1872 # causes Carbon.p complaints?
  1873 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1874             ;;
  1875         *-*-freebsd*|*-*-dragonfly*)
  1876             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1877             pthread_lib="-pthread"
  1878             ;;
  1879         *-*-netbsd*)
  1880             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1881             pthread_lib="-lpthread"
  1882             ;;
  1883         *-*-openbsd*)
  1884             pthread_cflags="-D_REENTRANT"
  1885             pthread_lib="-pthread"
  1886             ;;
  1887         *-*-solaris2.9)
  1888             # From Solaris 9+, posix4's preferred name is rt.
  1889             pthread_cflags="-D_REENTRANT"
  1890             pthread_lib="-lpthread -lrt"
  1891             ;;
  1892         *-*-solaris2.10)
  1893             # Solaris 10+ merged pthread into libc.
  1894             pthread_cflags="-D_REENTRANT"
  1895             pthread_lib="-lrt"
  1896             ;;
  1897         *-*-solaris*)
  1898             # Solaris 11+ merged rt into libc.
  1899             pthread_cflags="-D_REENTRANT"
  1900             pthread_lib=""
  1901             ;;
  1902         *-*-sysv5*)
  1903             pthread_cflags="-D_REENTRANT -Kthread"
  1904             pthread_lib=""
  1905             ;;
  1906         *-*-aix*)
  1907             pthread_cflags="-D_REENTRANT -mthreads"
  1908             pthread_lib="-lpthread"
  1909             ;;
  1910         *-*-hpux11*)
  1911             pthread_cflags="-D_REENTRANT"
  1912             pthread_lib="-L/usr/lib -lpthread"
  1913             ;;
  1914         *)
  1915             pthread_cflags="-D_REENTRANT"
  1916             pthread_lib="-lpthread"
  1917             ;;
  1918     esac
  1919     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1920         # Save the original compiler flags and libraries
  1921         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1922         # Add the pthread compiler flags and libraries
  1923         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1924         # Check to see if we have pthread support on this system
  1925         AC_MSG_CHECKING(for pthreads)
  1926         use_pthreads=no
  1927         AC_TRY_LINK([
  1928          #include <pthread.h>
  1929         ],[
  1930          pthread_attr_t type;
  1931          pthread_attr_init(&type);
  1932         ],[
  1933         use_pthreads=yes
  1934         ])
  1935         AC_MSG_RESULT($use_pthreads)
  1936         # Restore the compiler flags and libraries
  1937         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1938 
  1939         # Do futher testing if we have pthread support...
  1940         if test x$use_pthreads = xyes; then
  1941             AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
  1942             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1943             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1944             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1945             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1946 
  1947             # Save the original compiler flags and libraries
  1948             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1949             # Add the pthread compiler flags and libraries
  1950             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1951 
  1952             # Check to see if recursive mutexes are available
  1953             AC_MSG_CHECKING(for recursive mutexes)
  1954             has_recursive_mutexes=no
  1955             if test x$has_recursive_mutexes = xno; then
  1956                 AC_TRY_COMPILE([
  1957                   #include <pthread.h>
  1958                 ],[
  1959                   pthread_mutexattr_t attr;
  1960                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1961                 ],[
  1962                 has_recursive_mutexes=yes
  1963                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
  1964                 ])
  1965             fi
  1966             if test x$has_recursive_mutexes = xno; then
  1967                 AC_TRY_COMPILE([
  1968                   #include <pthread.h>
  1969                 ],[
  1970                   pthread_mutexattr_t attr;
  1971                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1972                 ],[
  1973                 has_recursive_mutexes=yes
  1974                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
  1975                 ])
  1976             fi
  1977             AC_MSG_RESULT($has_recursive_mutexes)
  1978 
  1979             # Check to see if pthread semaphore support is missing
  1980             if test x$enable_pthread_sem = xyes; then
  1981                 AC_MSG_CHECKING(for pthread semaphores)
  1982                 have_pthread_sem=no
  1983                 AC_TRY_COMPILE([
  1984                   #include <pthread.h>
  1985                   #include <semaphore.h>
  1986                 ],[
  1987                 ],[
  1988                 have_pthread_sem=yes
  1989                 ])
  1990                 AC_MSG_RESULT($have_pthread_sem)
  1991             fi
  1992             if test x$have_pthread_sem = xyes; then
  1993                 AC_MSG_CHECKING(for sem_timedwait)
  1994                 have_sem_timedwait=no
  1995                 AC_TRY_LINK([
  1996                   #include <pthread.h>
  1997                   #include <semaphore.h>
  1998                 ],[
  1999                   sem_timedwait(NULL, NULL);
  2000                 ],[
  2001                 have_sem_timedwait=yes
  2002                 AC_DEFINE(HAVE_SEM_TIMEDWAIT)
  2003                 ])
  2004                 AC_MSG_RESULT($have_sem_timedwait)
  2005             fi
  2006 
  2007             AC_MSG_CHECKING(for pthread_spin_trylock)
  2008             AC_TRY_LINK_FUNC(pthread_spin_trylock, [
  2009               has_pthread_spin_trylock=yes
  2010               AC_DEFINE(HAVE_PTHREAD_SPINLOCK, 1, [ ])
  2011             ],[
  2012               has_pthread_spin_trylock=no
  2013             ])
  2014             AC_MSG_RESULT($has_pthread_spin_trylock)
  2015 
  2016             AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
  2017             if test x$have_pthread_np_h = xyes; then
  2018                 AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
  2019             fi
  2020 
  2021             # Check to see if pthread naming is available
  2022             AC_MSG_CHECKING(for pthread_setname_np)
  2023             AC_TRY_LINK_FUNC(pthread_setname_np, [
  2024               has_pthread_setname_np=yes
  2025               AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
  2026             ],[
  2027               has_pthread_setname_np=no
  2028             ])
  2029             AC_MSG_RESULT($has_pthread_setname_np)
  2030 
  2031             AC_MSG_CHECKING(for pthread_set_name_np)
  2032             AC_TRY_LINK_FUNC(pthread_set_name_np, [
  2033               has_pthread_set_name_np=yes
  2034               AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
  2035             ],[
  2036               has_pthread_set_name_np=no
  2037             ])
  2038             AC_MSG_RESULT($has_pthread_set_name_np)
  2039 
  2040             # Restore the compiler flags and libraries
  2041             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2042 
  2043             # Basic thread creation functions
  2044             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  2045 
  2046             # Semaphores
  2047             # We can fake these with mutexes and condition variables if necessary
  2048             if test x$have_pthread_sem = xyes; then
  2049                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  2050             else
  2051                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  2052             fi
  2053 
  2054             # Mutexes
  2055             # We can fake these with semaphores if necessary
  2056             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  2057 
  2058             # Condition variables
  2059             # We can fake these with semaphores and mutexes if necessary
  2060             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  2061 
  2062             # Thread local storage
  2063             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
  2064 
  2065             have_threads=yes
  2066         fi
  2067     fi
  2068 }
  2069 
  2070 dnl Determine whether the compiler can produce Windows executables
  2071 CheckWINDOWS()
  2072 {
  2073     AC_MSG_CHECKING(Windows compiler)
  2074     have_win32_gcc=no
  2075     AC_TRY_COMPILE([
  2076      #include <windows.h>
  2077     ],[
  2078     ],[
  2079     have_win32_gcc=yes
  2080     ])
  2081     AC_MSG_RESULT($have_win32_gcc)
  2082     if test x$have_win32_gcc != xyes; then
  2083        AC_MSG_ERROR([
  2084 *** Your compiler ($CC) does not produce Windows executables!
  2085        ])
  2086     fi
  2087 
  2088     AC_MSG_CHECKING(Windows CE)
  2089     have_wince=no
  2090     AC_TRY_COMPILE([
  2091 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  2092 #error This is not Windows CE
  2093 #endif
  2094     ],[
  2095     ],[
  2096     have_wince=yes
  2097        AC_MSG_ERROR([
  2098 *** Sorry, Windows CE is no longer supported.
  2099        ])
  2100     ])
  2101     AC_MSG_RESULT($have_wince)
  2102 
  2103     # This fixes Windows stack alignment with newer GCC
  2104     CheckStackBoundary
  2105 }
  2106 
  2107 dnl Find the DirectX includes and libraries
  2108 CheckDIRECTX()
  2109 {
  2110     AC_ARG_ENABLE(directx,
  2111 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
  2112                   , enable_directx=yes)
  2113     if test x$enable_directx = xyes; then
  2114         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  2115         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  2116         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  2117         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  2118         AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
  2119 
  2120         # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
  2121         # FIXME:  ...so force it off for now.
  2122         case "$host" in
  2123             *-*-cygwin*)
  2124             have_dinput=false
  2125             ;;
  2126         esac
  2127     fi
  2128 }
  2129 
  2130 dnl Check for the dlfcn.h interface for dynamically loading objects
  2131 CheckDLOPEN()
  2132 {
  2133     AC_ARG_ENABLE(sdl-dlopen,
  2134 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  2135                   , enable_sdl_dlopen=yes)
  2136     if test x$enable_sdl_dlopen = xyes; then
  2137         AC_MSG_CHECKING(for dlopen)
  2138         have_dlopen=no
  2139         AC_TRY_COMPILE([
  2140          #include <dlfcn.h>
  2141         ],[
  2142          void *handle = dlopen("", RTLD_NOW);
  2143          const char *loaderror = (char *) dlerror();
  2144         ],[
  2145         have_dlopen=yes
  2146         ])
  2147         AC_MSG_RESULT($have_dlopen)
  2148 
  2149         if test x$have_dlopen = xyes; then
  2150             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  2151                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  2152                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  2153             AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
  2154             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  2155             have_loadso=yes
  2156         fi
  2157     fi
  2158 }
  2159 
  2160 dnl Check for the usbhid(3) library on *BSD
  2161 CheckUSBHID()
  2162 {
  2163     if test x$enable_joystick = xyes; then
  2164         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  2165         if test x$have_libusbhid = xyes; then
  2166             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  2167             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  2168             USB_LIBS="$USB_LIBS -lusbhid"
  2169         else
  2170             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  2171             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  2172             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  2173         fi
  2174             
  2175         save_CFLAGS="$CFLAGS"
  2176         CFLAGS="$CFLAGS $USB_CFLAGS"
  2177 
  2178         AC_MSG_CHECKING(for usbhid)
  2179         have_usbhid=no
  2180         AC_TRY_COMPILE([
  2181           #include <sys/types.h>
  2182           #if defined(HAVE_USB_H)
  2183           #include <usb.h>
  2184           #endif
  2185           #ifdef __DragonFly__
  2186           # include <bus/usb/usb.h>
  2187           # include <bus/usb/usbhid.h>
  2188           #else
  2189           # include <dev/usb/usb.h>
  2190           # include <dev/usb/usbhid.h>
  2191           #endif
  2192           #if defined(HAVE_USBHID_H)
  2193           #include <usbhid.h>
  2194           #elif defined(HAVE_LIBUSB_H)
  2195           #include <libusb.h>
  2196           #elif defined(HAVE_LIBUSBHID_H)
  2197           #include <libusbhid.h>
  2198           #endif
  2199         ],[
  2200           struct report_desc *repdesc;
  2201           struct usb_ctl_report *repbuf;
  2202           hid_kind_t hidkind;
  2203         ],[
  2204         have_usbhid=yes
  2205         ])
  2206         AC_MSG_RESULT($have_usbhid)
  2207 
  2208         if test x$have_usbhid = xyes; then
  2209             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2210             have_usbhid_ucr_data=no
  2211             AC_TRY_COMPILE([
  2212               #include <sys/types.h>
  2213               #if defined(HAVE_USB_H)
  2214               #include <usb.h>
  2215               #endif
  2216               #ifdef __DragonFly__
  2217               # include <bus/usb/usb.h>
  2218               # include <bus/usb/usbhid.h>
  2219               #else
  2220               # include <dev/usb/usb.h>
  2221               # include <dev/usb/usbhid.h>
  2222               #endif
  2223               #if defined(HAVE_USBHID_H)
  2224               #include <usbhid.h>
  2225               #elif defined(HAVE_LIBUSB_H)
  2226               #include <libusb.h>
  2227               #elif defined(HAVE_LIBUSBHID_H)
  2228               #include <libusbhid.h>
  2229               #endif
  2230             ],[
  2231               struct usb_ctl_report buf;
  2232               if (buf.ucr_data) { }
  2233             ],[
  2234             have_usbhid_ucr_data=yes
  2235             ])
  2236             if test x$have_usbhid_ucr_data = xyes; then
  2237                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2238             fi
  2239             AC_MSG_RESULT($have_usbhid_ucr_data)
  2240             
  2241             AC_MSG_CHECKING(for new usbhid API)
  2242             have_usbhid_new=no
  2243             AC_TRY_COMPILE([
  2244               #include <sys/types.h>
  2245               #if defined(HAVE_USB_H)
  2246               #include <usb.h>
  2247               #endif
  2248               #ifdef __DragonFly__
  2249               #include <bus/usb/usb.h>
  2250               #include <bus/usb/usbhid.h>
  2251               #else
  2252               #include <dev/usb/usb.h>
  2253               #include <dev/usb/usbhid.h>
  2254               #endif
  2255               #if defined(HAVE_USBHID_H)
  2256               #include <usbhid.h>
  2257               #elif defined(HAVE_LIBUSB_H)
  2258               #include <libusb.h>
  2259               #elif defined(HAVE_LIBUSBHID_H)
  2260               #include <libusbhid.h>
  2261               #endif
  2262             ],[
  2263               report_desc_t d;
  2264               hid_start_parse(d, 1, 1);
  2265             ],[
  2266             have_usbhid_new=yes
  2267             ])
  2268             if test x$have_usbhid_new = xyes; then
  2269                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2270             fi
  2271             AC_MSG_RESULT($have_usbhid_new)
  2272 
  2273             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2274             have_machine_joystick=no
  2275             AC_TRY_COMPILE([
  2276               #include <machine/joystick.h>
  2277             ],[
  2278               struct joystick t;
  2279             ],[
  2280             have_machine_joystick=yes
  2281             ])
  2282             if test x$have_machine_joystick = xyes; then
  2283                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
  2284             fi
  2285             AC_MSG_RESULT($have_machine_joystick)
  2286 
  2287             AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
  2288             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2289             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2290             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2291             have_joystick=yes
  2292         fi
  2293         CFLAGS="$save_CFLAGS"
  2294     fi
  2295 }
  2296 
  2297 dnl Check for clock_gettime()
  2298 CheckClockGettime()
  2299 {
  2300     AC_ARG_ENABLE(clock_gettime,
  2301 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
  2302                   , enable_clock_gettime=yes)
  2303     if test x$enable_clock_gettime = xyes; then
  2304         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2305         if test x$have_clock_gettime = xyes; then
  2306             AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  2307             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2308         else
  2309             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  2310             if test x$have_clock_gettime = xyes; then
  2311                AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  2312                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  2313             fi
  2314         fi
  2315     fi
  2316 }
  2317 
  2318 dnl Check for a valid linux/version.h
  2319 CheckLinuxVersion()
  2320 {
  2321     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2322     if test x$have_linux_version_h = xyes; then
  2323         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2324     fi
  2325 }
  2326 
  2327 dnl Check if we want to use RPATH
  2328 CheckRPATH()
  2329 {
  2330     AC_ARG_ENABLE(rpath,
  2331 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2332                   , enable_rpath=yes)
  2333 }
  2334 
  2335 dnl Set up the configuration based on the host platform!
  2336 case "$host" in
  2337     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
  2338         case "$host" in
  2339             *-*-linux*)         ARCH=linux ;;
  2340             *-*-uclinux*)       ARCH=linux ;;
  2341             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2342             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2343             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2344             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2345             *-*-bsdi*)          ARCH=bsdi ;;
  2346             *-*-freebsd*)       ARCH=freebsd ;;
  2347             *-*-dragonfly*)     ARCH=freebsd ;;
  2348             *-*-netbsd*)        ARCH=netbsd ;;
  2349             *-*-openbsd*)       ARCH=openbsd ;;
  2350             *-*-sysv5*)         ARCH=sysv5 ;;
  2351             *-*-solaris*)       ARCH=solaris ;;
  2352             *-*-hpux*)          ARCH=hpux ;;
  2353             *-*-aix*)           ARCH=aix ;;
  2354             *-*-minix*)         ARCH=minix ;;
  2355         esac
  2356         CheckVisibilityHidden
  2357         CheckDummyVideo
  2358         CheckDiskAudio
  2359         CheckDummyAudio
  2360         CheckDLOPEN
  2361         CheckOSS
  2362         CheckALSA
  2363         CheckPulseAudio
  2364         CheckARTSC
  2365         CheckESD
  2366         CheckNAS
  2367         CheckSNDIO
  2368         CheckX11
  2369         CheckDirectFB
  2370         CheckFusionSound
  2371         CheckOpenGLX11
  2372         CheckOpenGLESX11
  2373         CheckLibUDev
  2374         CheckDBus
  2375         CheckInputEvents
  2376         CheckTslib
  2377         CheckUSBHID
  2378         CheckPTHREAD
  2379         CheckClockGettime
  2380         CheckLinuxVersion
  2381         CheckRPATH
  2382         # Set up files for the audio library
  2383         if test x$enable_audio = xyes; then
  2384           case $ARCH in
  2385             sysv5|solaris|hpux)
  2386                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
  2387                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2388                 have_audio=yes
  2389             ;;
  2390             netbsd)  # Don't use this on OpenBSD, it's busted.
  2391                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ])
  2392                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2393                 have_audio=yes
  2394             ;;
  2395             aix)
  2396                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
  2397                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2398                 have_audio=yes
  2399             ;;
  2400           esac
  2401         fi
  2402         # Set up files for the joystick library
  2403         if test x$enable_joystick = xyes; then
  2404           case $ARCH in
  2405             linux)
  2406                 AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
  2407                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2408                 have_joystick=yes
  2409             ;;
  2410           esac
  2411         fi
  2412         # Set up files for the haptic library
  2413         if test x$enable_haptic = xyes; then
  2414            if test x$use_input_events = xyes; then
  2415              case $ARCH in
  2416                linux)
  2417                    AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
  2418                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2419                    have_haptic=yes
  2420                ;;
  2421              esac
  2422            fi
  2423         fi
  2424         # Set up files for the power library
  2425         if test x$enable_power = xyes; then
  2426              case $ARCH in
  2427                linux)
  2428                    AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
  2429                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2430                    have_power=yes
  2431                ;;
  2432              esac
  2433         fi
  2434         # Set up files for the timer library
  2435         if test x$enable_timers = xyes; then
  2436             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  2437             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2438             have_timers=yes
  2439         fi
  2440         ;;
  2441     *-*-cygwin* | *-*-mingw32*)
  2442         ARCH=win32
  2443         if test "$build" != "$host"; then # cross-compiling
  2444             # Default cross-compile location
  2445             ac_default_prefix=/usr/local/cross-tools/$host
  2446         else
  2447             # Look for the location of the tools and install there
  2448             if test "$BUILD_PREFIX" != ""; then
  2449                 ac_default_prefix=$BUILD_PREFIX
  2450             fi
  2451         fi
  2452         CheckDummyVideo
  2453         CheckDiskAudio
  2454         CheckDummyAudio
  2455         CheckWINDOWS
  2456         CheckWINDOWSGL
  2457         CheckDIRECTX
  2458 
  2459         # Set up the core platform files
  2460         SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  2461 
  2462         # Set up files for the video library
  2463         if test x$enable_video = xyes; then
  2464             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
  2465             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  2466             have_video=yes
  2467             AC_ARG_ENABLE(render-d3d,
  2468 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2469                                 , enable_render_d3d=yes)
  2470             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2471                 AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
  2472             fi
  2473         fi
  2474         # Set up files for the audio library
  2475         if test x$enable_audio = xyes; then
  2476             AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
  2477             SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
  2478             if test x$have_dsound = xyes; then
  2479                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
  2480                 SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
  2481             fi
  2482             if test x$have_xaudio2 = xyes; then
  2483                 AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
  2484                 SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
  2485             fi
  2486             have_audio=yes
  2487         fi
  2488         # Set up files for the joystick library
  2489         if test x$enable_joystick = xyes; then
  2490             if test x$have_dinput = xyes; then
  2491                 AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
  2492                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
  2493                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  2494             else
  2495                 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
  2496                 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
  2497             fi
  2498             have_joystick=yes
  2499         fi
  2500         if test x$enable_haptic = xyes; then
  2501             if test x$have_dinput = xyes; then
  2502                 AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
  2503                 SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
  2504                 have_haptic=yes
  2505             fi
  2506         fi
  2507         if test x$enable_power = xyes; then
  2508             AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
  2509             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2510             have_power=yes
  2511         fi
  2512         # Set up files for the thread library
  2513         if test x$enable_threads = xyes; then
  2514             AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
  2515             SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
  2516             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2517             have_threads=yes
  2518         fi
  2519         # Set up files for the timer library
  2520         if test x$enable_timers = xyes; then
  2521             AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
  2522             SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  2523             have_timers=yes
  2524         fi
  2525         # Set up files for the shared object loading library
  2526         if test x$enable_loadso = xyes; then
  2527             AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
  2528             SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  2529             have_loadso=yes
  2530         fi
  2531         # Set up the system libraries we need
  2532         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
  2533         # The Windows platform requires special setup
  2534         VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  2535         SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  2536         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2537         SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
  2538 
  2539         # Check to see if this is a mingw or cygwin build
  2540         have_mingw32=
  2541         AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
  2542         if test x$have_mingw32 = xyes; then
  2543             SDL_LIBS="-lmingw32 $SDL_LIBS"
  2544         else
  2545             SDL_LIBS="-lcygwin $SDL_LIBS"
  2546         fi
  2547         ;;
  2548     *-*-beos* | *-*-haiku*)
  2549         ARCH=beos
  2550         ac_default_prefix=/boot/common
  2551         CheckDummyVideo
  2552         CheckDiskAudio
  2553         CheckDummyAudio
  2554         CheckBWINDOW
  2555         CheckBeGL
  2556         # Set up files for the audio library
  2557         if test x$enable_audio = xyes; then
  2558             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO, 1, [ ])
  2559             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2560             have_audio=yes
  2561         fi
  2562         # Set up files for the joystick library
  2563         if test x$enable_joystick = xyes; then
  2564             AC_DEFINE(SDL_JOYSTICK_BEOS, 1, [ ])
  2565             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2566             have_joystick=yes
  2567         fi
  2568         # Set up files for the thread library
  2569         if test x$enable_threads = xyes; then
  2570             AC_DEFINE(SDL_THREAD_BEOS, 1, [ ])
  2571             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2572             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2573             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2574             have_threads=yes
  2575         fi
  2576         # Set up files for the timer library
  2577         if test x$enable_timers = xyes; then
  2578             AC_DEFINE(SDL_TIMER_BEOS, 1, [ ])
  2579             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2580             have_timers=yes
  2581         fi
  2582         # Set up files for the shared object loading library
  2583         if test x$enable_loadso = xyes; then
  2584             AC_DEFINE(SDL_LOADSO_BEOS, 1, [ ])
  2585             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2586             have_loadso=yes
  2587         fi
  2588         # Set up files for the system power library
  2589         if test x$enable_power = xyes; then
  2590             AC_DEFINE(SDL_POWER_BEOS, 1, [ ])
  2591             SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
  2592             have_power=yes
  2593         fi
  2594         # The BeOS platform requires special setup.
  2595         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2596         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2597         ;;
  2598     arm*-apple-darwin*)
  2599         # iOS - We are not writing anything to confdefs.h because you have to replace
  2600         # SDL_config.h for SDL_config_iphoneos.h anyway
  2601         ARCH=ios
  2602 
  2603         CheckVisibilityHidden
  2604         CheckDummyVideo
  2605         CheckDiskAudio
  2606         CheckDummyAudio
  2607         CheckDLOPEN
  2608         CheckCOCOA
  2609         CheckPTHREAD
  2610 
  2611 
  2612         # Set up files for the audio library
  2613         if test x$enable_audio = xyes; then
  2614             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
  2615             have_audio=yes
  2616         fi
  2617         # Set up files for the joystick library
  2618         if test x$enable_joystick = xyes; then
  2619             SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  2620             have_joystick=yes
  2621         fi
  2622         # Set up files for the haptic library
  2623         #if test x$enable_haptic = xyes; then
  2624         #    SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2625         #    have_haptic=yes
  2626         #    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2627         #fi
  2628         # Set up files for the power library
  2629         if test x$enable_power = xyes; then
  2630             SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
  2631             have_power=yes
  2632         fi
  2633         # Set up files for the timer library
  2634         if test x$enable_timers = xyes; then
  2635             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2636             have_timers=yes
  2637         fi
  2638         # Set up additional files for the file library
  2639         if test x$enable_file = xyes; then
  2640             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2641         fi
  2642         # The iOS platform requires special setup.
  2643         SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
  2644         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2645         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
  2646         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
  2647         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
  2648         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
  2649         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
  2650         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
  2651         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
  2652         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
  2653         ;;
  2654     *-*-darwin* )
  2655         # This could be either full "Mac OS X", or plain "Darwin" which is
  2656         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2657         # Next line is broken, and a few files below require Mac OS X (full)
  2658         ARCH=macosx
  2659 
  2660         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2661         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2662         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2663 
  2664         CheckVisibilityHidden
  2665         CheckDummyVideo
  2666         CheckDiskAudio
  2667         CheckDummyAudio
  2668         CheckDLOPEN
  2669         CheckCOCOA
  2670         CheckX11
  2671         CheckMacGL
  2672         CheckOpenGLX11
  2673         CheckPTHREAD
  2674 
  2675         # Good optimization on Mac OS X, yes...
  2676         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2677 
  2678         # Need this or things might misbuild on a G3.
  2679         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2680 
  2681         # Set up files for the audio library
  2682         if test x$enable_audio = xyes; then
  2683             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  2684             SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
  2685             have_audio=yes
  2686         fi
  2687         # Set up files for the joystick library
  2688         if test x$enable_joystick = xyes; then
  2689             AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  2690             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2691             have_joystick=yes
  2692         fi
  2693         # Set up files for the haptic library
  2694         if test x$enable_haptic = xyes; then
  2695             AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  2696             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2697             have_haptic=yes
  2698             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2699         fi
  2700         # Set up files for the power library
  2701         if test x$enable_power = xyes; then
  2702             AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
  2703             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2704             have_power=yes
  2705         fi
  2706         # Set up files for the timer library
  2707         if test x$enable_timers = xyes; then
  2708             AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  2709             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2710             have_timers=yes
  2711         fi
  2712         # Set up additional files for the file library
  2713         if test x$enable_file = xyes; then
  2714             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2715         fi
  2716         # The Mac OS X platform requires special setup.
  2717         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2718         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2719         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2720         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2721         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2722         # If audio is used, add the AudioUnit framework
  2723         if test x$enable_audio = xyes; then
  2724             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2725         fi
  2726         ;;
  2727     *)
  2728         AC_MSG_ERROR([
  2729 *** Unsupported host:  Please add to configure.in
  2730         ])
  2731         ;;
  2732 esac
  2733 
  2734 dnl Do this on all platforms, after everything else.
  2735 CheckWarnAll
  2736 
  2737 # Verify that we have all the platform specific files we need
  2738 
  2739 if test x$have_joystick != xyes; then
  2740     if test x$enable_joystick = xyes; then
  2741         AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
  2742     fi
  2743     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2744 fi
  2745 if test x$have_haptic != xyes; then
  2746     if test x$enable_haptic = xyes; then
  2747         AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
  2748     fi
  2749     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2750 fi
  2751 if test x$have_threads != xyes; then
  2752     if test x$enable_threads = xyes; then
  2753         AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  2754     fi
  2755     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2756 fi
  2757 if test x$have_timers != xyes; then
  2758     if test x$enable_timers = xyes; then
  2759         AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
  2760     fi
  2761     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2762 fi
  2763 if test x$have_loadso != xyes; then
  2764     if test x$enable_loadso = xyes; then
  2765         AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
  2766     fi
  2767     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2768 fi
  2769 if test x$SDLMAIN_SOURCES = x; then
  2770     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2771 fi
  2772 SDLTEST_SOURCES="$srcdir/src/test/*.c"
  2773 
  2774 OBJECTS=`echo $SOURCES`
  2775 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  2776 for EXT in asm cc m c S; do
  2777     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2778     DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  2779 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  2780 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2781 done
  2782 
  2783 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2784 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2785 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2786 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  2787 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  2788 	\\$(WINDRES) \\$< \\$@,g"`
  2789 
  2790 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2791 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2792 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2793 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2794 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2795 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2796 
  2797 SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
  2798 SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
  2799 SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2800 SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2801 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2802 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2803 
  2804 # Set runtime shared library paths as needed
  2805 
  2806 if test "x$enable_rpath" = "xyes"; then
  2807   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
  2808     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2809   fi
  2810   if test $ARCH = solaris; then
  2811     SDL_RLD_FLAGS="-R\${libdir}"
  2812   fi
  2813 else
  2814   SDL_RLD_FLAGS=""
  2815 fi
  2816 
  2817 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2818 
  2819 dnl Expand the cflags and libraries needed by apps using SDL
  2820 AC_SUBST(SDL_CFLAGS)
  2821 AC_SUBST(SDL_LIBS)
  2822 AC_SUBST(SDL_STATIC_LIBS)
  2823 AC_SUBST(SDL_RLD_FLAGS)
  2824 if test x$enable_shared = xyes; then
  2825     ENABLE_SHARED_TRUE=
  2826     ENABLE_SHARED_FALSE="#"
  2827 else
  2828     ENABLE_SHARED_TRUE="#"
  2829     ENABLE_SHARED_FALSE=
  2830 fi
  2831 if test x$enable_static = xyes; then
  2832     ENABLE_STATIC_TRUE=
  2833     ENABLE_STATIC_FALSE="#"
  2834 else
  2835     ENABLE_STATIC_TRUE="#"
  2836     ENABLE_STATIC_FALSE=
  2837 fi
  2838 AC_SUBST(ENABLE_SHARED_TRUE)
  2839 AC_SUBST(ENABLE_SHARED_FALSE)
  2840 AC_SUBST(ENABLE_STATIC_TRUE)
  2841 AC_SUBST(ENABLE_STATIC_FALSE)
  2842 
  2843 dnl Expand the sources and objects needed to build the library
  2844 AC_SUBST(ac_aux_dir)
  2845 AC_SUBST(INCLUDE)
  2846 AC_SUBST(OBJECTS)
  2847 AC_SUBST(VERSION_OBJECTS)
  2848 AC_SUBST(SDLMAIN_OBJECTS)
  2849 AC_SUBST(SDLTEST_OBJECTS)
  2850 AC_SUBST(BUILD_CFLAGS)
  2851 AC_SUBST(EXTRA_CFLAGS)
  2852 AC_SUBST(BUILD_LDFLAGS)
  2853 AC_SUBST(EXTRA_LDFLAGS)
  2854 AC_SUBST(WINDRES)
  2855 
  2856 cat >Makefile.rules <<__EOF__
  2857 
  2858 # Build rules for objects
  2859 -include \$(OBJECTS:.lo=.d)
  2860 
  2861 # Special dependency for SDL.c, since it depends on SDL_revision.h
  2862 $srcdir/src/SDL.c: update-revision
  2863 $DEPENDS
  2864 $VERSION_DEPENDS
  2865 $SDLMAIN_DEPENDS
  2866 $SDLTEST_DEPENDS
  2867 __EOF__
  2868 
  2869 AC_CONFIG_FILES([
  2870     Makefile:Makefile.in:Makefile.rules sdl2-config SDL2.spec sdl2.pc
  2871 ])
  2872 AC_OUTPUT
  2873 chmod a+x sdl2-config