configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 22 Aug 2010 12:07:55 -0700
changeset 4694 c24ba2cc9583
parent 4626 2cfd55c58cd9
parent 4681 5378f2d0754f
child 4862 7b1d35d98294
permissions -rw-r--r--
Merged Jim's Google Summer of Code work from SDL-gsoc2010_gesture
     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 
  1009 
  1010     AC_ARG_ENABLE(video-x11,
  1011 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
  1012                   , enable_video_x11=yes)
  1013     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1014         case "$host" in
  1015             *-*-darwin*)
  1016                 # This isn't necessary for X11, but fixes GLX detection
  1017                 if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
  1018                     x_includes="/usr/X11R6/include"
  1019                     x_libraries="/usr/X11R6/lib"
  1020                 fi
  1021                 ;;
  1022         esac
  1023         AC_PATH_X
  1024         AC_PATH_XTRA
  1025         if test x$have_x = xyes; then
  1026             # Only allow dynamically loaded X11 if the X11 function pointers
  1027             # will not end up in the global namespace, which causes problems
  1028             # with other libraries calling X11 functions.
  1029             x11_symbols_private=$have_gcc_fvisibility
  1030 
  1031             AC_ARG_ENABLE(x11-shared,
  1032 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
  1033                           , enable_x11_shared=maybe)
  1034 
  1035             case "$host" in
  1036                 *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
  1037                     x11_symbols_private=yes
  1038                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
  1039                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
  1040                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1041                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1042                     xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1043                     xss_lib='/usr/X11R6/lib/libXss.6.dylib'
  1044                     xdamage_lib='/usr/X11R6/lib/libXdamage.1.dylib'
  1045                     xfixes_lib='/usr/X11R6/lib/libXfixes.3.dylib'
  1046                     ;;
  1047                 *-*-osf*)
  1048                     x11_lib='libX11.so'
  1049                     x11ext_lib='libXext.so'
  1050                     ;;
  1051                 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
  1052                     x11_lib='libX11.so'
  1053                     x11ext_lib='libXext.so'
  1054                     ;;
  1055                 *)
  1056                     x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1057                     x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1058                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1059                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1060                     xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1061                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1062                     xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1063                     xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1064                     ;;
  1065             esac
  1066 
  1067             if test x$ac_cv_func_shmat != xyes; then
  1068                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1069             fi
  1070             CFLAGS="$CFLAGS $X_CFLAGS"
  1071             LDFLAGS="$LDFLAGS $X_LIBS"
  1072 
  1073             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
  1074             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1075             SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
  1076             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1077 
  1078             if test x$enable_x11_shared = xmaybe; then
  1079                 enable_x11_shared=$x11_symbols_private
  1080             fi
  1081             if test x$have_loadso != xyes && \
  1082                test x$enable_x11_shared = xyes; then
  1083                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1084                 enable_x11_shared=no
  1085             fi
  1086             if test x$x11_symbols_private != xyes && \
  1087                test x$enable_x11_shared = xyes; then
  1088                 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
  1089                 enable_x11_shared=no
  1090             fi
  1091 
  1092             if test x$have_loadso = xyes && \
  1093                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1094                 echo "-- dynamic libX11 -> $x11_lib"
  1095                 echo "-- dynamic libX11ext -> $x11ext_lib"
  1096                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
  1097                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
  1098             else
  1099                 enable_x11_shared=no
  1100                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1101             fi
  1102             have_video=yes
  1103 
  1104             AC_ARG_ENABLE(video-x11-vm,
  1105 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1106                           , enable_video_x11_vm=yes)
  1107             if test x$enable_video_x11_vm = xyes; then
  1108                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
  1109                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
  1110             fi
  1111             AC_ARG_ENABLE(video-x11-xv,
  1112 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
  1113                           , enable_video_x11_xv=yes)
  1114             if test x$enable_video_x11_xv = xyes; then
  1115                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
  1116                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
  1117             fi
  1118             AC_ARG_ENABLE(video-x11-xinerama,
  1119 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1120                             , enable_video_x11_xinerama=yes)
  1121             if test x$enable_video_x11_xinerama = xyes; then
  1122                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
  1123                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
  1124             fi
  1125             AC_ARG_ENABLE(video-x11-xrandr,
  1126 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1127                             , enable_video_x11_xrandr=yes)
  1128             if test x$enable_video_x11_xrandr = xyes; then
  1129                 definitely_enable_video_x11_xrandr=no
  1130                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1131                                 have_xrandr_h_hdr=yes,
  1132                                 have_xrandr_h_hdr=no,
  1133                                 [#include <X11/Xlib.h>
  1134                                 ])
  1135                 if test x$have_xrandr_h_hdr = xyes; then
  1136                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1137                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1138                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
  1139                         definitely_enable_video_x11_xrandr=yes
  1140                     else
  1141                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1142                         if test x$have_xrandr_lib = xyes ; then
  1143                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1144                             definitely_enable_video_x11_xrandr=yes
  1145                         fi
  1146                     fi
  1147                 fi
  1148             fi
  1149             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1150                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
  1151             fi
  1152             AC_ARG_ENABLE(video-x11-xinput,
  1153 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1154                             , enable_video_x11_xinput=yes)
  1155             if test x$enable_video_x11_xinput = xyes; then
  1156                 definitely_enable_video_x11_xinput=no
  1157                 AC_CHECK_HEADER(X11/extensions/XInput.h,
  1158                                 have_xinput_h_hdr=yes,
  1159                                 have_xinput_h_hdr=no,
  1160                                 [#include <X11/Xlib.h>
  1161                                 ])
  1162                 if test x$have_xinput_h_hdr = xyes; then
  1163                     if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1164                         echo "-- dynamic libXi -> $xinput_lib"
  1165                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
  1166                         definitely_enable_video_x11_xinput=yes
  1167                     else
  1168                         AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1169                         if test x$have_xinput_lib = xyes ; then
  1170                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1171                             definitely_enable_video_x11_xinput=yes
  1172                         fi
  1173                     fi
  1174                 fi
  1175             fi
  1176             if test x$definitely_enable_video_x11_xinput = xyes; then
  1177                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
  1178             fi
  1179             AC_ARG_ENABLE(video-x11-scrnsaver,
  1180 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1181                             , enable_video_x11_scrnsaver=yes)
  1182             if test x$enable_video_x11_scrnsaver = xyes; then
  1183                 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1184                                 have_scrnsaver_h_hdr=yes,
  1185                                 have_scrnsaver_h_hdr=no,
  1186                                 [#include <X11/Xlib.h>
  1187                                 ])
  1188                 if test x$have_scrnsaver_h_hdr = xyes; then
  1189                     if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1190                         echo "-- dynamic libXss -> $xss_lib"
  1191                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
  1192                         definitely_enable_video_x11_scrnsaver=yes
  1193                     else
  1194                         AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1195                         if test x$have_xss_lib = xyes ; then
  1196                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1197                             definitely_enable_video_x11_scrnsaver=yes
  1198                         fi
  1199                     fi
  1200                 fi
  1201             fi
  1202             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1203                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
  1204             fi
  1205             AC_ARG_ENABLE(video-x11-xrender,
  1206 AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[default=yes]]]),
  1207                             , enable_video_x11_xrender=yes)
  1208             if test x$enable_video_x11_xrender = xyes; then
  1209                 AC_CHECK_HEADER(X11/extensions/Xrender.h,
  1210                                 have_xrender_h_hdr=yes,
  1211                                 have_xrender_h_hdr=no,
  1212                                 [#include <X11/Xlib.h>
  1213                                 ])
  1214                 if test x$have_xrender_h_hdr = xyes; then
  1215                     if test x$enable_x11_shared = xyes && test x$xrender_lib != x ; then
  1216                         echo "-- dynamic libXrender -> $xrender_lib"
  1217                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
  1218                         definitely_enable_video_x11_xrender=yes
  1219                     else
  1220                         AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
  1221                         if test x$have_xrender_lib = xyes ; then
  1222                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrender"
  1223                             definitely_enable_video_x11_xrender=yes
  1224                         fi
  1225                     fi
  1226                 fi
  1227             fi
  1228             if test x$definitely_enable_video_x11_xrender = xyes; then
  1229                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
  1230             fi
  1231             AC_ARG_ENABLE(video-x11-xdamage-xfixes,
  1232 AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
  1233                             , enable_video_x11_xdamage=yes)
  1234             if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
  1235                 AC_CHECK_HEADER(X11/extensions/Xdamage.h,
  1236                                 have_xdamage_h_hdr=yes,
  1237                                 have_xdamage_h_hdr=no,
  1238                                 [#include <X11/Xlib.h>
  1239                                 ])
  1240                 AC_CHECK_HEADER(X11/extensions/Xfixes.h,
  1241                                 have_xfixes_h_hdr=yes,
  1242                                 have_xfixes_h_hdr=no,
  1243                                 [#include <X11/Xlib.h>
  1244                                 ])
  1245                 if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
  1246                     if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
  1247                         echo "-- dynamic libXdamage -> $xdamage_lib"
  1248                         echo "-- dynamic libXfixes -> $xfixes_lib"
  1249                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
  1250                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
  1251                         definitely_enable_video_x11_xdamage=yes
  1252                         definitely_enable_video_x11_xfixes=yes
  1253                     else
  1254                         AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
  1255                         AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
  1256                         if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
  1257                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
  1258                             definitely_enable_video_x11_xdamage=yes
  1259                             definitely_enable_video_x11_xfixes=yes
  1260                         fi
  1261                     fi
  1262                 fi
  1263             fi
  1264             if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
  1265                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
  1266                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
  1267             fi
  1268             AC_ARG_ENABLE(render-x11,
  1269 AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
  1270                                 , enable_render_x11=yes)
  1271             if test x$enable_render_x11 = xyes; then
  1272                 AC_DEFINE(SDL_VIDEO_RENDER_X11)
  1273             fi
  1274         fi
  1275     fi
  1276 }
  1277 
  1278 dnl Check for QNX photon video driver
  1279 CheckPHOTON()
  1280 {
  1281     AC_ARG_ENABLE(video-photon,
  1282 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
  1283                   , enable_video_photon=yes)
  1284     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
  1285         AC_MSG_CHECKING(for QNX Photon support)
  1286         video_photon=no
  1287         AC_TRY_COMPILE([
  1288           #include <Ph.h>
  1289           #include <Pt.h>
  1290           #include <photon/Pg.h>
  1291           #include <photon/PdDirect.h>
  1292         ],[
  1293          PgDisplaySettings_t *visual;
  1294         ],[
  1295         video_photon=yes
  1296         ])
  1297         AC_MSG_RESULT($video_photon)
  1298         if test x$video_photon = xyes; then
  1299             AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
  1300             SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
  1301             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph -lphrender"
  1302             have_video=yes
  1303 
  1304             CheckOpenGLQNX
  1305         fi
  1306     fi
  1307 }
  1308 
  1309 dnl Check for QNX photon video driver
  1310 CheckQNXGF()
  1311 {
  1312     AC_ARG_ENABLE(video-qnxgf,
  1313                   AC_HELP_STRING([--enable-video-qnxgf], [use QNX GF video driver [[default=yes]]]),
  1314                   , enable_video_qnxgf=yes)
  1315     if test x$enable_video = xyes -a x$enable_video_qnxgf = xyes; then
  1316         AC_MSG_CHECKING(for QNX GF support)
  1317         video_qnxgf=no
  1318         AC_TRY_COMPILE([
  1319           #include <gf/gf.h>
  1320           #include <gf/gf3d.h>
  1321         ],[
  1322          gf_3d_config_info_t* gfinfo;
  1323         ],[
  1324         video_qnxgf=yes
  1325         ])
  1326         AC_MSG_RESULT($video_qnxgf)
  1327         if test x$video_qnxgf = xyes; then
  1328             AC_DEFINE(SDL_VIDEO_DRIVER_QNXGF)
  1329             SOURCES="$SOURCES $srcdir/src/video/qnxgf/*.c"
  1330             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgf"
  1331 
  1332             # Add HIDDI library for HID support using GF
  1333             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lhiddi"
  1334 
  1335             have_video=yes
  1336 
  1337             CheckOpenGLESQNX
  1338         fi
  1339     fi
  1340 }
  1341 
  1342 dnl Set up the BWindow video driver if enabled
  1343 CheckBWINDOW()
  1344 {
  1345     if test x$enable_video = xyes; then
  1346         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
  1347         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
  1348         have_video=yes
  1349     fi
  1350 }
  1351 
  1352 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1353 CheckCOCOA()
  1354 {
  1355     AC_ARG_ENABLE(video-cocoa,
  1356 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1357                   , enable_video_cocoa=yes)
  1358     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1359         save_CFLAGS="$CFLAGS"
  1360         dnl work around that we don't have Objective-C support in autoconf
  1361         CFLAGS="$CFLAGS -x objective-c"
  1362         AC_MSG_CHECKING(for Cocoa framework)
  1363         have_cocoa=no
  1364         AC_TRY_COMPILE([
  1365           #import <Cocoa/Cocoa.h>
  1366         ],[
  1367         ],[
  1368         have_cocoa=yes
  1369         ])
  1370         AC_MSG_RESULT($have_cocoa)
  1371         CFLAGS="$save_CFLAGS"
  1372         if test x$have_cocoa = xyes; then
  1373             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
  1374             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1375             have_video=yes
  1376         fi
  1377     fi
  1378 }
  1379 
  1380 dnl Find the framebuffer console includes
  1381 CheckFBCON()
  1382 {
  1383     AC_ARG_ENABLE(video-fbcon,
  1384 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=no]]]),
  1385                   , enable_video_fbcon=no)
  1386     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
  1387         AC_MSG_CHECKING(for framebuffer console support)
  1388         video_fbcon=no
  1389         AC_TRY_COMPILE([
  1390          #include <linux/fb.h>
  1391          #include <linux/kd.h>
  1392          #include <linux/keyboard.h>
  1393         ],[
  1394         ],[
  1395         video_fbcon=yes
  1396         ])
  1397         AC_MSG_RESULT($video_fbcon)
  1398         if test x$video_fbcon = xyes; then
  1399             AC_CHECK_FUNCS(getpagesize)
  1400             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
  1401             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
  1402             have_video=yes
  1403         fi
  1404     fi
  1405 }
  1406 
  1407 dnl Find DirectFB
  1408 CheckDirectFB()
  1409 {
  1410     AC_ARG_ENABLE(video-directfb,
  1411 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  1412                   , enable_video_directfb=no)
  1413     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1414         video_directfb=no
  1415 
  1416         DIRECTFB_REQUIRED_VERSION=1.0.0
  1417 
  1418         AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
  1419         if test x$DIRECTFBCONFIG = xno; then
  1420             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1421             if test x$PKG_CONFIG != xno; then
  1422                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1423                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1424                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1425                     DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
  1426                     video_directfb=yes
  1427                 fi
  1428             fi
  1429         else
  1430             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1431             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1432             set -- `directfb-config --version | sed 's/\./ /g'`
  1433             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1434             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1435                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1436                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1437                 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
  1438                 video_directfb=yes
  1439             fi
  1440         fi
  1441         if test x$video_directfb = xyes; then
  1442             # SuSE 11.1 installs directfb-config without directfb-devel
  1443             save_CPPFLAGS="$CPPFLAGS"
  1444             CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  1445             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1446             CPPFLAGS="$save_CPPFLAGS"
  1447             video_directfb=$have_directfb_hdr
  1448         fi
  1449         AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1450         AC_MSG_RESULT($video_directfb)
  1451 
  1452         if test x$video_directfb = xyes; then
  1453             AC_ARG_ENABLE(directfb-shared,
  1454 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  1455                               , enable_directfb_shared=yes)
  1456 
  1457             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1458             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1459             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1460 
  1461             AC_MSG_CHECKING(for directfb dynamic loading support)
  1462             directfb_shared=no
  1463             directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1464 
  1465             if test x$have_loadso != xyes && \
  1466                test x$enable_directfb_shared = xyes; then
  1467                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1468             fi
  1469             if test x$have_loadso = xyes && \
  1470                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1471                 directfb_shared=yes
  1472                 echo "-- $directfb_lib_spec -> $directfb_lib"
  1473                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
  1474             else
  1475                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1476             fi
  1477             AC_MSG_RESULT($directfb_shared)
  1478             have_video=yes
  1479         fi
  1480     fi
  1481 }
  1482 
  1483 dnl Find FusionSound
  1484 CheckFusionSound()
  1485 {
  1486     AC_ARG_ENABLE(fusionsound,
  1487 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1488                   , enable_fusionsound=no)
  1489     if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1490         fusionsound=no
  1491 
  1492         FUSIONSOUND_REQUIRED_VERSION=1.1.1
  1493 
  1494         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1495         AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
  1496         if test x$PKG_CONFIG != xno; then
  1497             if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
  1498                 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
  1499                 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
  1500                 fusionsound=yes
  1501             fi
  1502         fi
  1503         AC_MSG_RESULT($fusionsound)
  1504 
  1505         if test x$fusionsound = xyes; then
  1506             AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
  1507             SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1508             EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1509             
  1510             AC_ARG_ENABLE(fusionsound-shared,
  1511 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1512                           , enable_fusionsound_shared=yes)
  1513             fusionsound_shared=no
  1514             AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1515             if test x$have_loadso != xyes && \
  1516                test x$enable_fusionsound_shared = xyes; then
  1517                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1518             fi
  1519             if test x$have_loadso = xyes && \
  1520                test x$enable_fusionsound_shared = xyes; then
  1521                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
  1522                 fusionsound_shared=yes
  1523             else
  1524                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1525             fi
  1526             AC_MSG_RESULT($fusionsound_shared)
  1527             
  1528             have_audio=yes
  1529         fi
  1530     fi
  1531 }
  1532 
  1533 dnl See if we're running on PlayStation 3 Cell hardware
  1534 CheckPS3()
  1535 {
  1536   AC_ARG_ENABLE(video-ps3,
  1537                 AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
  1538                 , enable_video_ps3=yes)
  1539   if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then 
  1540     video_ps3=no
  1541     AC_CHECK_HEADER([linux/fb.h])
  1542     AC_CHECK_HEADER([asm/ps3fb.h], [have_ps3fb_hdr=yes], [],
  1543             [#ifndef _LINUX_TYPES_H
  1544                 #include <linux/types.h>
  1545             #endif])
  1546     AC_CHECK_HEADER([libspe2.h], have_libspe2_hdr=yes)
  1547     AC_CHECK_LIB([spe2], spe_context_create, have_spe2_lib=yes)
  1548 
  1549     AC_CHECK_PROGS(SPU_GCC, [spu-gcc])
  1550     AC_CHECK_PROGS(EMBEDSPU, [embedspu])
  1551 
  1552     have_spu_libs=yes
  1553     AC_CHECK_LIB([fb_writer_spu], [main], [], [have_spu_libs=no])
  1554     AC_CHECK_LIB([yuv2rgb_spu], [main], [], [have_spu_libs=no])
  1555     AC_CHECK_LIB([bilin_scaler_spu], [main], [], [have_spu_libs=no])
  1556     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
  1557         AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
  1558         video_ps3=yes
  1559         have_video=yes
  1560         SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
  1561         EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
  1562         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
  1563 
  1564         if test x$have_spu_libs = xno; then 
  1565               AC_MSG_WARN([ps3libs missing, please run make ps3libs])
  1566         fi
  1567     fi
  1568     AC_MSG_CHECKING([for PlayStation 3 Cell support])
  1569     AC_MSG_RESULT([$video_ps3])
  1570   fi
  1571 }
  1572 
  1573 dnl Find the SVGAlib includes and libraries
  1574 CheckSVGA()
  1575 {
  1576     AC_ARG_ENABLE(video-svga,
  1577 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=no]]]),
  1578                   , enable_video_svga=no)
  1579     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1580         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1581         video_svga=no
  1582         AC_TRY_COMPILE([
  1583          #include <vga.h>
  1584          #include <vgamouse.h>
  1585          #include <vgakeyboard.h>
  1586         ],[
  1587          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1588              exit(0);
  1589          }
  1590         ],[
  1591         video_svga=yes
  1592         ])
  1593         AC_MSG_RESULT($video_svga)
  1594         if test x$video_svga = xyes; then
  1595             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1596             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1597             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
  1598             have_video=yes
  1599         fi
  1600     fi
  1601 }
  1602 
  1603 dnl rcg04172001 Set up the Null video driver.
  1604 CheckDummyVideo()
  1605 {
  1606     AC_ARG_ENABLE(video-dummy,
  1607 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1608                   , enable_video_dummy=yes)
  1609     if test x$enable_video_dummy = xyes; then
  1610         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1611         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1612         have_video=yes
  1613     fi
  1614 }
  1615 
  1616 dnl Check to see if OpenGL support is desired
  1617 AC_ARG_ENABLE(video-opengl,
  1618 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1619               , enable_video_opengl=yes)
  1620 
  1621 dnl Find OpenGL
  1622 CheckOpenGLX11()
  1623 {
  1624     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1625         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1626         video_opengl=no
  1627         AC_TRY_COMPILE([
  1628          #include <GL/gl.h>
  1629          #include <GL/glx.h>
  1630          #include <GL/glu.h>
  1631         ],[
  1632         ],[
  1633         video_opengl=yes
  1634         ])
  1635         AC_MSG_RESULT($video_opengl)
  1636         if test x$video_opengl = xyes; then
  1637             AC_DEFINE(SDL_VIDEO_OPENGL)
  1638             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1639             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1640         fi
  1641     fi
  1642 }
  1643 
  1644 dnl Find QNX 6.x Software OpenGL
  1645 CheckOpenGLQNX()
  1646 {
  1647     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1648         AC_MSG_CHECKING(for QNX 6.x Photon OpenGL support)
  1649         video_opengl=no
  1650         AC_TRY_COMPILE([
  1651          #include <GL/gl.h>
  1652         ],[
  1653         ],[
  1654         video_opengl=yes
  1655         ])
  1656         AC_MSG_RESULT($video_opengl)
  1657         if test x$video_opengl = xyes; then
  1658             AC_DEFINE(SDL_VIDEO_OPENGL)
  1659             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1660             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1661         fi
  1662     fi
  1663 }
  1664 
  1665 dnl Find QNX 6.3 and above OpenGL ES implementation
  1666 CheckOpenGLESQNX()
  1667 {
  1668     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1669         AC_MSG_CHECKING(for QNX OpenGL ES (CM) support)
  1670         video_opengl=no
  1671         AC_TRY_COMPILE([
  1672          #include <GLES/egl.h>
  1673         ],[
  1674         ],[
  1675         video_opengl=yes
  1676         ])
  1677         AC_MSG_RESULT($video_opengl)
  1678         if test x$video_opengl = xyes; then
  1679             AC_DEFINE(SDL_VIDEO_OPENGL_ES)
  1680             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
  1681             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
  1682         else
  1683             AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
  1684             video_opengl=no
  1685             AC_TRY_COMPILE([
  1686              #define COMMON_LITE
  1687              #include <GLES/egl.h>
  1688             ],[
  1689             ],[
  1690             video_opengl=yes
  1691             ])
  1692             AC_MSG_RESULT($video_opengl)
  1693             if test x$video_opengl = xyes; then
  1694                 AC_DEFINE(SDL_VIDEO_OPENGL_ES)
  1695                 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
  1696                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CLS"
  1697             fi
  1698         fi
  1699     fi
  1700 }
  1701 
  1702 
  1703 dnl Check for Win32 OpenGL
  1704 CheckWIN32GL()
  1705 {
  1706     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1707         AC_DEFINE(SDL_VIDEO_OPENGL)
  1708         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1709         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1710     fi
  1711 }
  1712 
  1713 dnl Check for BeOS OpenGL
  1714 CheckBeGL()
  1715 {
  1716     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1717         AC_DEFINE(SDL_VIDEO_OPENGL)
  1718         AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
  1719         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1720         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1721     fi
  1722 }
  1723 
  1724 dnl Check for MacOS OpenGL
  1725 CheckMacGL()
  1726 {
  1727     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1728         AC_DEFINE(SDL_VIDEO_OPENGL)
  1729         AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
  1730         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1731         case "$host" in
  1732             *-*-darwin*)
  1733                 if test x$enable_video_cocoa = xyes; then
  1734                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1735                 fi
  1736         esac
  1737     fi
  1738 }
  1739 
  1740 dnl See if we can use the new unified event interface in Linux 2.4
  1741 CheckInputEvents()
  1742 {
  1743     dnl Check for Linux 2.4 unified input event interface support
  1744     AC_ARG_ENABLE(input-events,
  1745 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1746                   , enable_input_events=yes)
  1747     if test x$enable_input_events = xyes; then
  1748         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1749         use_input_events=no
  1750         AC_TRY_COMPILE([
  1751           #include <linux/input.h>
  1752         ],[
  1753           #ifndef EVIOCGNAME
  1754           #error EVIOCGNAME() ioctl not available
  1755           #endif
  1756         ],[
  1757         use_input_events=yes
  1758         ])
  1759         AC_MSG_RESULT($use_input_events)
  1760         if test x$use_input_events = xyes; then
  1761             AC_DEFINE(SDL_INPUT_LINUXEV)
  1762         fi
  1763     fi
  1764 }
  1765 
  1766 dnl See if we can use the Touchscreen input library
  1767 CheckTslib()
  1768 {
  1769     AC_ARG_ENABLE(input-tslib,
  1770 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1771                   , enable_input_tslib=yes)
  1772     if test x$enable_input_tslib = xyes; then
  1773         AC_MSG_CHECKING(for Touchscreen library support)
  1774         enable_input_tslib=no
  1775         AC_TRY_COMPILE([
  1776           #include "tslib.h"
  1777         ],[
  1778         ],[
  1779         enable_input_tslib=yes
  1780         ])
  1781         AC_MSG_RESULT($enable_input_tslib)
  1782         if test x$enable_input_tslib = xyes; then
  1783             AC_DEFINE(SDL_INPUT_TSLIB)
  1784             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1785         fi
  1786     fi
  1787 }
  1788 
  1789 dnl See what type of thread model to use on Linux and Solaris
  1790 CheckPTHREAD()
  1791 {
  1792     dnl Check for pthread support
  1793     AC_ARG_ENABLE(pthreads,
  1794 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1795                   , enable_pthreads=yes)
  1796     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1797     AC_ARG_ENABLE(pthread-sem,
  1798 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1799                   , enable_pthread_sem=yes)
  1800     case "$host" in
  1801         *-*-linux*|*-*-uclinux*)
  1802             pthread_cflags="-D_REENTRANT"
  1803             pthread_lib="-lpthread"
  1804             ;;
  1805         *-*-bsdi*)
  1806             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1807             pthread_lib=""
  1808             ;;
  1809         *-*-darwin*)
  1810             pthread_cflags="-D_THREAD_SAFE"
  1811 # causes Carbon.p complaints?
  1812 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1813             ;;
  1814         *-*-freebsd*|*-*-dragonfly*)
  1815             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1816             pthread_lib="-pthread"
  1817             ;;
  1818         *-*-netbsd*)
  1819             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1820             pthread_lib="-lpthread"
  1821             ;;
  1822         *-*-openbsd*)
  1823             pthread_cflags="-D_REENTRANT"
  1824             pthread_lib="-pthread"
  1825             ;;
  1826         *-*-solaris*)
  1827             pthread_cflags="-D_REENTRANT"
  1828             pthread_lib="-lpthread -lposix4"
  1829             ;;
  1830         *-*-sysv5*)
  1831             pthread_cflags="-D_REENTRANT -Kthread"
  1832             pthread_lib=""
  1833             ;;
  1834         *-*-irix*)
  1835             pthread_cflags="-D_SGI_MP_SOURCE"
  1836             pthread_lib="-lpthread"
  1837             ;;
  1838         *-*-aix*)
  1839             pthread_cflags="-D_REENTRANT -mthreads"
  1840             pthread_lib="-lpthread"
  1841             ;;
  1842         *-*-hpux11*)
  1843             pthread_cflags="-D_REENTRANT"
  1844             pthread_lib="-L/usr/lib -lpthread"
  1845             ;;
  1846         *-*-qnx*)
  1847             pthread_cflags=""
  1848             pthread_lib=""
  1849             ;;
  1850         *-*-osf*)
  1851             pthread_cflags="-D_REENTRANT"
  1852             if test x$ac_cv_prog_gcc = xyes; then
  1853                 pthread_lib="-lpthread -lrt"
  1854             else
  1855                 pthread_lib="-lpthread -lexc -lrt"
  1856             fi
  1857             ;;
  1858         *)
  1859             pthread_cflags="-D_REENTRANT"
  1860             pthread_lib="-lpthread"
  1861             ;;
  1862     esac
  1863     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1864         # Save the original compiler flags and libraries
  1865         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1866         # Add the pthread compiler flags and libraries
  1867         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1868         # Check to see if we have pthread support on this system
  1869         AC_MSG_CHECKING(for pthreads)
  1870         use_pthreads=no
  1871         AC_TRY_LINK([
  1872          #include <pthread.h>
  1873         ],[
  1874          pthread_attr_t type;
  1875          pthread_attr_init(&type);
  1876         ],[
  1877         use_pthreads=yes
  1878         ])
  1879         AC_MSG_RESULT($use_pthreads)
  1880         # Restore the compiler flags and libraries
  1881         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1882 
  1883         # Do futher testing if we have pthread support...
  1884         if test x$use_pthreads = xyes; then
  1885             AC_DEFINE(SDL_THREAD_PTHREAD)
  1886             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1887             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1888             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1889             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1890 
  1891             # Save the original compiler flags and libraries
  1892             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1893             # Add the pthread compiler flags and libraries
  1894             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1895 
  1896             # Check to see if recursive mutexes are available
  1897             AC_MSG_CHECKING(for recursive mutexes)
  1898             has_recursive_mutexes=no
  1899             if test x$has_recursive_mutexes = xno; then
  1900                 AC_TRY_COMPILE([
  1901                   #include <pthread.h>
  1902                 ],[
  1903                   pthread_mutexattr_t attr;
  1904                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1905                 ],[
  1906                 has_recursive_mutexes=yes
  1907                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1908                 ])
  1909             fi
  1910             if test x$has_recursive_mutexes = xno; then
  1911                 AC_TRY_COMPILE([
  1912                   #include <pthread.h>
  1913                 ],[
  1914                   pthread_mutexattr_t attr;
  1915                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1916                 ],[
  1917                 has_recursive_mutexes=yes
  1918                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1919                 ])
  1920             fi
  1921             AC_MSG_RESULT($has_recursive_mutexes)
  1922 
  1923             # Check to see if pthread semaphore support is missing
  1924             if test x$enable_pthread_sem = xyes; then
  1925                 AC_MSG_CHECKING(for pthread semaphores)
  1926                 have_pthread_sem=no
  1927                 AC_TRY_COMPILE([
  1928                   #include <pthread.h>
  1929                   #include <semaphore.h>
  1930                 ],[
  1931                 ],[
  1932                 have_pthread_sem=yes
  1933                 ])
  1934                 AC_MSG_RESULT($have_pthread_sem)
  1935             fi
  1936 
  1937             # Restore the compiler flags and libraries
  1938             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1939 
  1940             # Basic thread creation functions
  1941             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1942 
  1943             # Semaphores
  1944             # We can fake these with mutexes and condition variables if necessary
  1945             if test x$have_pthread_sem = xyes; then
  1946                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1947             else
  1948                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1949             fi
  1950 
  1951             # Mutexes
  1952             # We can fake these with semaphores if necessary
  1953             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1954 
  1955             # Condition variables
  1956             # We can fake these with semaphores and mutexes if necessary
  1957             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1958 
  1959             have_threads=yes
  1960         fi
  1961     fi
  1962 }
  1963 
  1964 dnl Determine whether the compiler can produce Win32 executables
  1965 CheckWIN32()
  1966 {
  1967     AC_MSG_CHECKING(Win32 compiler)
  1968     have_win32_gcc=no
  1969     AC_TRY_COMPILE([
  1970      #include <windows.h>
  1971     ],[
  1972     ],[
  1973     have_win32_gcc=yes
  1974     ])
  1975     AC_MSG_RESULT($have_win32_gcc)
  1976     if test x$have_win32_gcc != xyes; then
  1977        AC_MSG_ERROR([
  1978 *** Your compiler ($CC) does not produce Win32 executables!
  1979        ])
  1980     fi
  1981 
  1982     AC_MSG_CHECKING(Windows CE)
  1983     have_wince=no
  1984     AC_TRY_COMPILE([
  1985 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  1986 #error This is not Windows CE
  1987 #endif
  1988     ],[
  1989     ],[
  1990     have_wince=yes
  1991     ])
  1992     AC_MSG_RESULT($have_wince)
  1993 
  1994     dnl See if the user wants to redirect standard output to files
  1995     AC_ARG_ENABLE(stdio-redirect,
  1996 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  1997                   , enable_stdio_redirect=yes)
  1998     if test x$enable_stdio_redirect != xyes; then
  1999         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  2000     fi
  2001 }
  2002 
  2003 dnl Find the DirectX includes and libraries
  2004 CheckDIRECTX()
  2005 {
  2006     AC_ARG_ENABLE(directx,
  2007 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  2008                   , enable_directx=yes)
  2009     if test x$enable_directx = xyes; then
  2010         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  2011         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  2012         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  2013         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  2014     fi
  2015 }
  2016 
  2017 dnl Check for the dlfcn.h interface for dynamically loading objects
  2018 CheckDLOPEN()
  2019 {
  2020     AC_ARG_ENABLE(sdl-dlopen,
  2021 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  2022                   , enable_sdl_dlopen=yes)
  2023     if test x$enable_sdl_dlopen = xyes; then
  2024         AC_MSG_CHECKING(for dlopen)
  2025         have_dlopen=no
  2026         AC_TRY_COMPILE([
  2027          #include <dlfcn.h>
  2028         ],[
  2029          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  2030          #error Use dlcompat for Mac OS X 10.2 compatibility
  2031          #endif
  2032         ],[
  2033         have_dlopen=yes
  2034         ])
  2035         AC_MSG_RESULT($have_dlopen)
  2036 
  2037         if test x$have_dlopen = xyes; then
  2038             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  2039                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  2040                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  2041             AC_DEFINE(SDL_LOADSO_DLOPEN)
  2042             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  2043             have_loadso=yes
  2044         fi
  2045     fi
  2046 }
  2047 
  2048 dnl Check for the usbhid(3) library on *BSD
  2049 CheckUSBHID()
  2050 {
  2051     if test x$enable_joystick = xyes; then
  2052         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  2053         if test x$have_libusbhid = xyes; then
  2054             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  2055             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  2056             USB_LIBS="$USB_LIBS -lusbhid"
  2057         else
  2058             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  2059             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  2060             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  2061         fi
  2062             
  2063         save_CFLAGS="$CFLAGS"
  2064         CFLAGS="$CFLAGS $USB_CFLAGS"
  2065 
  2066         AC_MSG_CHECKING(for usbhid)
  2067         have_usbhid=no
  2068         AC_TRY_COMPILE([
  2069           #include <sys/types.h>
  2070           #if defined(HAVE_USB_H)
  2071           #include <usb.h>
  2072           #endif
  2073           #ifdef __DragonFly__
  2074           # include <bus/usb/usb.h>
  2075           # include <bus/usb/usbhid.h>
  2076           #else
  2077           # include <dev/usb/usb.h>
  2078           # include <dev/usb/usbhid.h>
  2079           #endif
  2080           #if defined(HAVE_USBHID_H)
  2081           #include <usbhid.h>
  2082           #elif defined(HAVE_LIBUSB_H)
  2083           #include <libusb.h>
  2084           #elif defined(HAVE_LIBUSBHID_H)
  2085           #include <libusbhid.h>
  2086           #endif
  2087         ],[
  2088           struct report_desc *repdesc;
  2089           struct usb_ctl_report *repbuf;
  2090           hid_kind_t hidkind;
  2091         ],[
  2092         have_usbhid=yes
  2093         ])
  2094         AC_MSG_RESULT($have_usbhid)
  2095 
  2096         if test x$have_usbhid = xyes; then
  2097             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2098             have_usbhid_ucr_data=no
  2099             AC_TRY_COMPILE([
  2100               #include <sys/types.h>
  2101               #if defined(HAVE_USB_H)
  2102               #include <usb.h>
  2103               #endif
  2104               #ifdef __DragonFly__
  2105               # include <bus/usb/usb.h>
  2106               # include <bus/usb/usbhid.h>
  2107               #else
  2108               # include <dev/usb/usb.h>
  2109               # include <dev/usb/usbhid.h>
  2110               #endif
  2111               #if defined(HAVE_USBHID_H)
  2112               #include <usbhid.h>
  2113               #elif defined(HAVE_LIBUSB_H)
  2114               #include <libusb.h>
  2115               #elif defined(HAVE_LIBUSBHID_H)
  2116               #include <libusbhid.h>
  2117               #endif
  2118             ],[
  2119               struct usb_ctl_report buf;
  2120               if (buf.ucr_data) { }
  2121             ],[
  2122             have_usbhid_ucr_data=yes
  2123             ])
  2124             if test x$have_usbhid_ucr_data = xyes; then
  2125                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2126             fi
  2127             AC_MSG_RESULT($have_usbhid_ucr_data)
  2128             
  2129             AC_MSG_CHECKING(for new usbhid API)
  2130             have_usbhid_new=no
  2131             AC_TRY_COMPILE([
  2132               #include <sys/types.h>
  2133               #if defined(HAVE_USB_H)
  2134               #include <usb.h>
  2135               #endif
  2136               #ifdef __DragonFly__
  2137               #include <bus/usb/usb.h>
  2138               #include <bus/usb/usbhid.h>
  2139               #else
  2140               #include <dev/usb/usb.h>
  2141               #include <dev/usb/usbhid.h>
  2142               #endif
  2143               #if defined(HAVE_USBHID_H)
  2144               #include <usbhid.h>
  2145               #elif defined(HAVE_LIBUSB_H)
  2146               #include <libusb.h>
  2147               #elif defined(HAVE_LIBUSBHID_H)
  2148               #include <libusbhid.h>
  2149               #endif
  2150             ],[
  2151               report_desc_t d;
  2152               hid_start_parse(d, 1, 1);
  2153             ],[
  2154             have_usbhid_new=yes
  2155             ])
  2156             if test x$have_usbhid_new = xyes; then
  2157                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2158             fi
  2159             AC_MSG_RESULT($have_usbhid_new)
  2160 
  2161             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2162             have_machine_joystick=no
  2163             AC_TRY_COMPILE([
  2164               #include <machine/joystick.h>
  2165             ],[
  2166               struct joystick t;
  2167             ],[
  2168             have_machine_joystick=yes
  2169             ])
  2170             if test x$have_machine_joystick = xyes; then
  2171                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2172             fi
  2173             AC_MSG_RESULT($have_machine_joystick)
  2174 
  2175             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2176             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2177             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2178             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2179             have_joystick=yes
  2180         fi
  2181         CFLAGS="$save_CFLAGS"
  2182     fi
  2183 }
  2184 
  2185 dnl Check for clock_gettime()
  2186 CheckClockGettime()
  2187 {
  2188     AC_ARG_ENABLE(clock_gettime,
  2189 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2190                   , enable_clock_gettime=no)
  2191     if test x$enable_clock_gettime = xyes; then
  2192         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2193         if test x$have_clock_gettime = xyes; then
  2194             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2195             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2196         else
  2197             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  2198             if test x$have_clock_gettime = xyes; then
  2199                AC_DEFINE(HAVE_CLOCK_GETTIME)
  2200                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  2201             fi
  2202         fi
  2203     fi
  2204 }
  2205 
  2206 dnl Check for a valid linux/version.h
  2207 CheckLinuxVersion()
  2208 {
  2209     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2210     if test x$have_linux_version_h = xyes; then
  2211         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2212     fi
  2213 }
  2214 
  2215 dnl Check if we want to use RPATH
  2216 CheckRPATH()
  2217 {
  2218     AC_ARG_ENABLE(rpath,
  2219 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2220                   , enable_rpath=yes)
  2221 }
  2222 
  2223 dnl Set up the configuration based on the host platform!
  2224 case "$host" in
  2225     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
  2226         case "$host" in
  2227             *-*-linux*)         ARCH=linux ;;
  2228             *-*-uclinux*)       ARCH=linux ;;
  2229             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2230             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2231             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2232             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2233             *-*-bsdi*)          ARCH=bsdi ;;
  2234             *-*-freebsd*)       ARCH=freebsd ;;
  2235             *-*-dragonfly*)     ARCH=freebsd ;;
  2236             *-*-netbsd*)        ARCH=netbsd ;;
  2237             *-*-openbsd*)       ARCH=openbsd ;;
  2238             *-*-sysv5*)         ARCH=sysv5 ;;
  2239             *-*-solaris*)       ARCH=solaris ;;
  2240             *-*-hpux*)          ARCH=hpux ;;
  2241             *-*-irix*)          ARCH=irix ;;
  2242             *-*-aix*)           ARCH=aix ;;
  2243             *-*-osf*)           ARCH=osf ;;
  2244             *-*-minix*)         ARCH=minix ;;
  2245         esac
  2246         CheckVisibilityHidden
  2247         CheckDummyVideo
  2248         CheckDiskAudio
  2249         CheckDummyAudio
  2250         CheckDLOPEN
  2251         CheckOSS
  2252         CheckDMEDIA
  2253         CheckMME
  2254         CheckALSA
  2255         CheckPulseAudio
  2256         CheckARTSC
  2257         CheckESD
  2258         CheckNAS
  2259         CheckX11
  2260         CheckFBCON
  2261         CheckDirectFB
  2262         CheckFusionSound
  2263         CheckPS3
  2264         CheckSVGA
  2265         CheckOpenGLX11
  2266         CheckInputEvents
  2267         CheckTslib
  2268         CheckUSBHID
  2269         CheckPTHREAD
  2270         CheckClockGettime
  2271         CheckLinuxVersion
  2272         CheckRPATH
  2273         # Set up files for the audio library
  2274         if test x$enable_audio = xyes; then
  2275           case $ARCH in
  2276             sysv5|solaris|hpux)
  2277                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2278                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2279                 have_audio=yes
  2280             ;;
  2281             netbsd|openbsd)
  2282                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2283                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2284                 have_audio=yes
  2285             ;;
  2286             aix)
  2287                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
  2288                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2289                 have_audio=yes
  2290             ;;
  2291           esac
  2292         fi
  2293         # Set up files for the atomic operations library
  2294         if test x$enable_atomic = xyes; then
  2295           case $ARCH in
  2296             linux)
  2297                 AC_DEFINE(SDL_ATOMIC_LINUX)
  2298                 SOURCES="$SOURCES $srcdir/src/atomic/linux/*.c"
  2299                 have_atomic=yes
  2300             ;;
  2301           esac
  2302         fi
  2303         # Set up files for the joystick library
  2304         if test x$enable_joystick = xyes; then
  2305           case $ARCH in
  2306             linux)
  2307                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2308                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2309                 have_joystick=yes
  2310             ;;
  2311           esac
  2312         fi
  2313         # Set up files for the haptic library
  2314         if test x$enable_haptic = xyes; then
  2315            if test x$use_input_events = xyes; then
  2316              case $ARCH in
  2317                linux)
  2318                    AC_DEFINE(SDL_HAPTIC_LINUX)
  2319                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2320                    have_haptic=yes
  2321                ;;
  2322              esac
  2323            fi
  2324         fi
  2325         # Set up files for the power library
  2326         if test x$enable_power = xyes; then
  2327              case $ARCH in
  2328                linux)
  2329                    AC_DEFINE(SDL_POWER_LINUX)
  2330                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2331                    have_power=yes
  2332                ;;
  2333              esac
  2334         fi
  2335         # Set up files for the thread library
  2336         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2337             AC_DEFINE(SDL_THREAD_SPROC)
  2338             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2339             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2340             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2341             have_threads=yes
  2342         fi
  2343         # Set up files for the timer library
  2344         if test x$enable_timers = xyes; then
  2345             AC_DEFINE(SDL_TIMER_UNIX)
  2346             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2347             have_timers=yes
  2348         fi
  2349         ;;
  2350     *-*-qnx*)
  2351 
  2352         EXTRA_CFLAGS="-I/usr/include $CFLAGS"
  2353         EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
  2354 
  2355         ARCH=qnx
  2356         CheckVisibilityHidden
  2357         CheckDummyVideo
  2358         CheckDiskAudio
  2359         CheckDummyAudio
  2360         CheckDLOPEN
  2361         CheckPulseAudio
  2362         CheckESD
  2363         CheckNAS
  2364         CheckPHOTON
  2365         CheckQNXGF
  2366         CheckX11
  2367         CheckOpenGLX11
  2368         CheckPTHREAD
  2369         CheckClockGettime
  2370 
  2371 
  2372         # Set up files for the audio library
  2373         if test x$enable_audio = xyes; then
  2374             AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
  2375             SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
  2376             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2377             have_audio=yes
  2378         fi
  2379         # Set up files for the timer library
  2380         if test x$enable_timers = xyes; then
  2381             AC_DEFINE(SDL_TIMER_UNIX)
  2382             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2383             have_timers=yes
  2384         fi
  2385         # Setup files for the atomic operations
  2386         if test x$enable_atomic = xyes; then
  2387                 AC_DEFINE(SDL_ATOMIC_QNX)
  2388                 SOURCES="$SOURCES $srcdir/src/atomic/qnx/*.c"
  2389                 have_atomic=yes
  2390         fi
  2391         # Set up dummy files for the joystick for now
  2392         if test x$enable_joystick = xyes; then
  2393             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2394             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2395             have_joystick=yes
  2396         fi
  2397         # Set up dummy files for the haptic for now
  2398         if test x$enable_haptic = xyes; then
  2399             AC_DEFINE(SDL_HAPTIC_DUMMY)
  2400             SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2401             have_haptic=yes
  2402         fi
  2403         ;;
  2404     *-wince* | *-mingw32ce)
  2405         ARCH=win32
  2406         CheckDummyVideo
  2407         CheckDiskAudio
  2408         CheckDummyAudio
  2409         CheckWIN32
  2410         if test x$enable_video = xyes; then
  2411             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2412             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2413             have_video=yes
  2414             AC_ARG_ENABLE(render-gdi,
  2415 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2416                                 , enable_render_gdi=yes)
  2417             if test x$enable_render_gdi = xyes; then
  2418                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2419             fi
  2420             AC_ARG_ENABLE(render-gapi,
  2421 AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
  2422                                 , enable_render_gapi=yes)
  2423             if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
  2424                 AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
  2425             fi
  2426             AC_ARG_ENABLE(render-ddraw,
  2427 AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
  2428                                 , enable_render_ddraw=yes)
  2429             if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
  2430                 AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
  2431             fi
  2432             AC_ARG_ENABLE(render-d3d,
  2433 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2434                                 , enable_render_d3d=yes)
  2435             enable_render_d3d=no
  2436             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2437                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2438             fi
  2439         fi
  2440         # Set up files for the audio library
  2441         if test x$enable_audio = xyes; then
  2442             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2443             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2444             if test x$have_dsound = xyes; then
  2445                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2446                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2447             fi
  2448             have_audio=yes
  2449         fi
  2450         # Set up files for the atomic operations library
  2451         if test x$enable_atomic = xyes; then
  2452             AC_DEFINE(SDL_ATOMIC_WIN32)
  2453             SOURCES="$SOURCES $srcdir/src/atomic/win32/*.c"
  2454             have_atomic=yes
  2455         fi
  2456         # Set up dummy files for the joystick for now
  2457         if test x$enable_joystick = xyes; then
  2458             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2459             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2460             have_joystick=yes
  2461         fi
  2462         # Set up files for the thread library
  2463         if test x$enable_threads = xyes; then
  2464             AC_DEFINE(SDL_THREAD_WIN32)
  2465             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2466             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2467             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2468             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2469             have_threads=yes
  2470         fi
  2471         # Set up files for the timer library
  2472         if test x$enable_timers = xyes; then
  2473             AC_DEFINE(SDL_TIMER_WINCE)
  2474             SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
  2475             have_timers=yes
  2476         fi
  2477         # Set up files for the shared object loading library
  2478         if test x$enable_loadso = xyes; then
  2479             AC_DEFINE(SDL_LOADSO_WIN32)
  2480             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2481             have_loadso=yes
  2482         fi
  2483         # Set up the system libraries we need
  2484         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
  2485 
  2486 	# mingw32ce library
  2487 	case "$host" in
  2488     	    *-mingw32ce)
  2489     		EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
  2490     		;;
  2491     	    *)
  2492         	;;
  2493 	esac
  2494 
  2495         # The Win32 platform requires special setup
  2496         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2497         EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
  2498         EXTRA_LDFLAGS="-lSDLmain $EXTRA_LDFLAGS"
  2499         ;;
  2500     *-*-cygwin* | *-*-mingw32*)
  2501         ARCH=win32
  2502         if test "$build" != "$host"; then # cross-compiling
  2503             # Default cross-compile location
  2504             ac_default_prefix=/usr/local/cross-tools/$host
  2505         else
  2506             # Look for the location of the tools and install there
  2507             if test "$BUILD_PREFIX" != ""; then
  2508                 ac_default_prefix=$BUILD_PREFIX
  2509             fi
  2510         fi
  2511         CheckDummyVideo
  2512         CheckDiskAudio
  2513         CheckDummyAudio
  2514         CheckWIN32
  2515         CheckWIN32GL
  2516         CheckDIRECTX
  2517         # Set up files for the video library
  2518         if test x$enable_video = xyes; then
  2519             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2520             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2521             have_video=yes
  2522             AC_ARG_ENABLE(render-gdi,
  2523 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2524                                 , enable_render_gdi=yes)
  2525             if test x$enable_render_gdi = xyes; then
  2526                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2527             fi
  2528             AC_ARG_ENABLE(render-d3d,
  2529 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2530                                 , enable_render_d3d=yes)
  2531             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2532                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2533             fi
  2534         fi
  2535         # Set up files for the audio library
  2536         if test x$enable_audio = xyes; then
  2537             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2538             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2539             if test x$have_dsound = xyes; then
  2540                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2541                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2542             fi
  2543             have_audio=yes
  2544         fi
  2545         # Set up files for the atomic operations library
  2546         if test x$enable_atomic = xyes; then
  2547             AC_DEFINE(SDL_ATOMIC_WIN32)
  2548             SOURCES="$SOURCES $srcdir/src/atomic/win32/*.c"
  2549             have_atomic=yes
  2550         fi
  2551         # Set up files for the joystick library
  2552         if test x$enable_joystick = xyes; then
  2553             if test x$have_dinput = xyes; then
  2554                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2555                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
  2556                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8 -lole32"
  2557             else
  2558                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2559                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
  2560             fi
  2561             have_joystick=yes
  2562         fi
  2563         if test x$enable_haptic = xyes; then
  2564             if test x$have_dinput = xyes; then
  2565                 AC_DEFINE(SDL_HAPTIC_DINPUT)
  2566                 SOURCES="$SOURCES $srcdir/src/haptic/win32/SDL_syshaptic.c"
  2567                 have_haptic=yes
  2568             fi
  2569         fi
  2570         if test x$enable_power = xyes; then
  2571             AC_DEFINE(SDL_POWER_WINDOWS)
  2572             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2573             have_power=yes
  2574         fi
  2575         # Set up files for the thread library
  2576         if test x$enable_threads = xyes; then
  2577             AC_DEFINE(SDL_THREAD_WIN32)
  2578             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2579             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2580             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2581             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2582             have_threads=yes
  2583         fi
  2584         # Set up files for the timer library
  2585         if test x$enable_timers = xyes; then
  2586             AC_DEFINE(SDL_TIMER_WIN32)
  2587             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2588             have_timers=yes
  2589         fi
  2590         # Set up files for the shared object loading library
  2591         if test x$enable_loadso = xyes; then
  2592             AC_DEFINE(SDL_LOADSO_WIN32)
  2593             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2594             have_loadso=yes
  2595         fi
  2596         # Set up the system libraries we need
  2597         # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
  2598         # You can get this here: http://libunicows.sourceforge.net/
  2599         #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
  2600         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm"
  2601         # The Win32 platform requires special setup
  2602         VERSION_SOURCES="$srcdir/src/main/win32/*.rc"
  2603         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2604         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2605         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2606         ;;
  2607     *-*-beos* | *-*-haiku*)
  2608         ARCH=beos
  2609         ac_default_prefix=/boot/develop/tools/gnupro
  2610         CheckDummyVideo
  2611         CheckDiskAudio
  2612         CheckDummyAudio
  2613         CheckBWINDOW
  2614         CheckBeGL
  2615         # Set up files for the audio library
  2616         if test x$enable_audio = xyes; then
  2617             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
  2618             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2619             have_audio=yes
  2620         fi
  2621         # Set up files for the joystick library
  2622         if test x$enable_joystick = xyes; then
  2623             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2624             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2625             have_joystick=yes
  2626         fi
  2627         # Set up files for the thread library
  2628         if test x$enable_threads = xyes; then
  2629             AC_DEFINE(SDL_THREAD_BEOS)
  2630             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2631             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2632             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2633             have_threads=yes
  2634         fi
  2635         # Set up files for the timer library
  2636         if test x$enable_timers = xyes; then
  2637             AC_DEFINE(SDL_TIMER_BEOS)
  2638             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2639             have_timers=yes
  2640         fi
  2641         # Set up files for the shared object loading library
  2642         if test x$enable_loadso = xyes; then
  2643             AC_DEFINE(SDL_LOADSO_BEOS)
  2644             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2645             have_loadso=yes
  2646         fi
  2647         # Set up files for the system power library
  2648         if test x$enable_power = xyes; then
  2649             AC_DEFINE(SDL_POWER_BEOS)
  2650             SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
  2651             have_power=yes
  2652         fi
  2653         # The BeOS platform requires special setup.
  2654         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2655         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2656         ;;
  2657     *-*-darwin* )
  2658         # This could be either full "Mac OS X", or plain "Darwin" which is
  2659         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2660         # Next line is broken, and a few files below require Mac OS X (full)
  2661         ARCH=macosx
  2662 
  2663         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2664         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2665         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2666 
  2667         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2668         # is -lm which is not needed under Mac OS X. But for some reasons it
  2669         # also tends to contain spurious -L switches, which we don't want to
  2670         # use here or in sdl-config. Hence we reset it.
  2671         EXTRA_LDFLAGS=""
  2672 
  2673         CheckVisibilityHidden
  2674         CheckDummyVideo
  2675         CheckDiskAudio
  2676         CheckDummyAudio
  2677         CheckDLOPEN
  2678 
  2679         # Set up files for the shared object loading library
  2680         # (this needs to be done before the dynamic X11 check)
  2681         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2682             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2683             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2684             have_loadso=yes
  2685         fi
  2686 
  2687         CheckCOCOA
  2688         CheckX11
  2689         CheckMacGL
  2690         CheckOpenGLX11
  2691         CheckPTHREAD
  2692 
  2693         # Good optimization on Mac OS X, yes...
  2694         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2695 
  2696         # Need this or things might misbuild on a G3.
  2697         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2698 
  2699         # Set up files for the audio library
  2700         if test x$enable_audio = xyes; then
  2701             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2702             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2703             have_audio=yes
  2704         fi
  2705         # Set up files for the atomic operations library
  2706         if test x$enable_atomic = xyes; then
  2707             AC_DEFINE(SDL_ATOMIC_MACOSX)
  2708             SOURCES="$SOURCES $srcdir/src/atomic/macosx/*.c"
  2709             have_atomic=yes
  2710         fi
  2711         # Set up files for the joystick library
  2712         if test x$enable_joystick = xyes; then
  2713             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2714             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2715             have_joystick=yes
  2716         fi
  2717         # Set up files for the haptic library
  2718         if test x$enable_haptic = xyes; then
  2719             AC_DEFINE(SDL_HAPTIC_IOKIT)
  2720             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2721             have_haptic=yes
  2722             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2723         fi
  2724         # Set up files for the power library
  2725         if test x$enable_power = xyes; then
  2726             AC_DEFINE(SDL_POWER_MACOSX)
  2727             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2728             have_power=yes
  2729         fi
  2730         # Set up files for the timer library
  2731         if test x$enable_timers = xyes; then
  2732             AC_DEFINE(SDL_TIMER_UNIX)
  2733             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2734             have_timers=yes
  2735         fi
  2736         # Set up additional files for the file library
  2737         if test x$enable_file = xyes; then
  2738             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2739         fi
  2740         # The Mac OS X platform requires special setup.
  2741         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2742         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2743         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2744         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2745         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2746         # If audio is used, add the AudioUnit framework
  2747         if test x$enable_audio = xyes; then
  2748             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2749         fi
  2750         ;;
  2751     *-riscos)
  2752         ARCH=riscos
  2753         CheckOSS
  2754         CheckPTHREAD
  2755         # Set up files for the video library
  2756         if test x$enable_video = xyes; then
  2757             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2758             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2759             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2760             have_video=yes
  2761         fi
  2762         # Set up files for the joystick library
  2763         if test x$enable_joystick = xyes; then
  2764             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2765             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2766             have_joystick=yes
  2767         fi
  2768         # Set up files for the timer library
  2769         if test x$enable_timers = xyes; then
  2770             AC_DEFINE(SDL_TIMER_RISCOS)
  2771             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2772             have_timers=yes
  2773         fi
  2774         # The RISC OS platform requires special setup.
  2775         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2776         ;;
  2777     *)
  2778         AC_MSG_ERROR([
  2779 *** Unsupported host:  Please add to configure.in
  2780         ])
  2781         ;;
  2782 esac
  2783 
  2784 # Verify that we have all the platform specific files we need
  2785 
  2786 if test x$have_joystick != xyes; then
  2787     if test x$enable_joystick = xyes; then
  2788         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2789     fi
  2790     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2791 fi
  2792 if test x$have_haptic != xyes; then
  2793     if test x$enable_haptic = xyes; then
  2794         AC_DEFINE(SDL_HAPTIC_DISABLED)
  2795     fi
  2796     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2797 fi
  2798 if test x$have_threads != xyes; then
  2799     if test x$enable_threads = xyes; then
  2800         AC_DEFINE(SDL_THREADS_DISABLED)
  2801     fi
  2802     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2803 fi
  2804 if test x$have_timers != xyes; then
  2805     if test x$enable_timers = xyes; then
  2806         AC_DEFINE(SDL_TIMERS_DISABLED)
  2807     fi
  2808     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2809 fi
  2810 if test x$have_loadso != xyes; then
  2811     if test x$enable_loadso = xyes; then
  2812         AC_DEFINE(SDL_LOADSO_DISABLED)
  2813     fi
  2814     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2815 fi
  2816 if test x$SDLMAIN_SOURCES = x; then
  2817     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2818 fi
  2819 
  2820 OBJECTS=`echo $SOURCES`
  2821 DEPENDS=`echo $SOURCES`
  2822 for EXT in asm cc m c S; do
  2823     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2824     DEPENDS=`echo "$DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT,\\\\
  2825 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  2826 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2827 done
  2828 
  2829 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2830 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2831 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2832 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  2833 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  2834 	\\$(WINDRES) \\$< \\$@,g"`
  2835 
  2836 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2837 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2838 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2839 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2840 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2841 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2842 
  2843 # Set runtime shared library paths as needed
  2844 
  2845 if test "x$enable_rpath" = "xyes"; then
  2846   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2847     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2848   fi
  2849   if test $ARCH = solaris; then
  2850     SDL_RLD_FLAGS="-R\${libdir}"
  2851   fi
  2852 else
  2853   SDL_RLD_FLAGS=""
  2854 fi
  2855 
  2856 case "$ARCH" in
  2857   macosx)
  2858     # Evil hack to allow static linking on Mac OS X
  2859     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2860     ;;
  2861   *)
  2862     SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2863     ;;
  2864 esac
  2865 
  2866 dnl Expand the cflags and libraries needed by apps using SDL
  2867 AC_SUBST(SDL_CFLAGS)
  2868 AC_SUBST(SDL_LIBS)
  2869 AC_SUBST(SDL_STATIC_LIBS)
  2870 AC_SUBST(SDL_RLD_FLAGS)
  2871 if test x$enable_shared = xyes; then
  2872     ENABLE_SHARED_TRUE=
  2873     ENABLE_SHARED_FALSE="#"
  2874 else
  2875     ENABLE_SHARED_TRUE="#"
  2876     ENABLE_SHARED_FALSE=
  2877 fi
  2878 if test x$enable_static = xyes; then
  2879     ENABLE_STATIC_TRUE=
  2880     ENABLE_STATIC_FALSE="#"
  2881 else
  2882     ENABLE_STATIC_TRUE="#"
  2883     ENABLE_STATIC_FALSE=
  2884 fi
  2885 AC_SUBST(ENABLE_SHARED_TRUE)
  2886 AC_SUBST(ENABLE_SHARED_FALSE)
  2887 AC_SUBST(ENABLE_STATIC_TRUE)
  2888 AC_SUBST(ENABLE_STATIC_FALSE)
  2889 
  2890 dnl Expand the sources and objects needed to build the library
  2891 AC_SUBST(ac_aux_dir)
  2892 AC_SUBST(INCLUDE)
  2893 AC_SUBST(OBJECTS)
  2894 AC_SUBST(DEPENDS)
  2895 AC_SUBST(VERSION_OBJECTS)
  2896 AC_SUBST(VERSION_DEPENDS)
  2897 AC_SUBST(SDLMAIN_OBJECTS)
  2898 AC_SUBST(SDLMAIN_DEPENDS)
  2899 AC_SUBST(BUILD_CFLAGS)
  2900 AC_SUBST(EXTRA_CFLAGS)
  2901 AC_SUBST(BUILD_LDFLAGS)
  2902 AC_SUBST(EXTRA_LDFLAGS)
  2903 AC_SUBST(WINDRES)
  2904 
  2905 AC_OUTPUT([
  2906     Makefile sdl-config SDL.spec sdl.pc
  2907 ])