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