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