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