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