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