configure.in
author Sam Lantinga <slouken@libsdl.org>
Tue, 13 Oct 2009 06:49:29 +0000
changeset 3392 efc22582afc5
parent 3391 188fc5ecc58c
child 3394 2b0a3b2f2fc6
permissions -rw-r--r--
Only show the dynamic audio libraries if we'll be dynamically loading them
Fixed DirectFB dynamic loading to use find_lib
Converted tabs to spaces
     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_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1976             if test x$have_dlvsym = xyes; then
  1977                 AC_DEFINE(HAVE_DLVSYM)
  1978             fi
  1979             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1980             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1981             have_loadso=yes
  1982         fi
  1983     fi
  1984 }
  1985 
  1986 dnl Check for the usbhid(3) library on *BSD
  1987 CheckUSBHID()
  1988 {
  1989     if test x$enable_joystick = xyes; then
  1990         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1991         if test x$have_libusbhid = xyes; then
  1992             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1993             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1994             USB_LIBS="$USB_LIBS -lusbhid"
  1995         else
  1996             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1997             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1998             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1999         fi
  2000             
  2001         save_CFLAGS="$CFLAGS"
  2002         CFLAGS="$CFLAGS $USB_CFLAGS"
  2003 
  2004         AC_MSG_CHECKING(for usbhid)
  2005         have_usbhid=no
  2006         AC_TRY_COMPILE([
  2007           #include <sys/types.h>
  2008           #if defined(HAVE_USB_H)
  2009           #include <usb.h>
  2010           #endif
  2011           #ifdef __DragonFly__
  2012           # include <bus/usb/usb.h>
  2013           # include <bus/usb/usbhid.h>
  2014           #else
  2015           # include <dev/usb/usb.h>
  2016           # include <dev/usb/usbhid.h>
  2017           #endif
  2018           #if defined(HAVE_USBHID_H)
  2019           #include <usbhid.h>
  2020           #elif defined(HAVE_LIBUSB_H)
  2021           #include <libusb.h>
  2022           #elif defined(HAVE_LIBUSBHID_H)
  2023           #include <libusbhid.h>
  2024           #endif
  2025         ],[
  2026           struct report_desc *repdesc;
  2027           struct usb_ctl_report *repbuf;
  2028           hid_kind_t hidkind;
  2029         ],[
  2030         have_usbhid=yes
  2031         ])
  2032         AC_MSG_RESULT($have_usbhid)
  2033 
  2034         if test x$have_usbhid = xyes; then
  2035             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2036             have_usbhid_ucr_data=no
  2037             AC_TRY_COMPILE([
  2038               #include <sys/types.h>
  2039               #if defined(HAVE_USB_H)
  2040               #include <usb.h>
  2041               #endif
  2042               #ifdef __DragonFly__
  2043               # include <bus/usb/usb.h>
  2044               # include <bus/usb/usbhid.h>
  2045               #else
  2046               # include <dev/usb/usb.h>
  2047               # include <dev/usb/usbhid.h>
  2048               #endif
  2049               #if defined(HAVE_USBHID_H)
  2050               #include <usbhid.h>
  2051               #elif defined(HAVE_LIBUSB_H)
  2052               #include <libusb.h>
  2053               #elif defined(HAVE_LIBUSBHID_H)
  2054               #include <libusbhid.h>
  2055               #endif
  2056             ],[
  2057               struct usb_ctl_report buf;
  2058               if (buf.ucr_data) { }
  2059             ],[
  2060             have_usbhid_ucr_data=yes
  2061             ])
  2062             if test x$have_usbhid_ucr_data = xyes; then
  2063                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2064             fi
  2065             AC_MSG_RESULT($have_usbhid_ucr_data)
  2066             
  2067             AC_MSG_CHECKING(for new usbhid API)
  2068             have_usbhid_new=no
  2069             AC_TRY_COMPILE([
  2070               #include <sys/types.h>
  2071               #if defined(HAVE_USB_H)
  2072               #include <usb.h>
  2073               #endif
  2074               #ifdef __DragonFly__
  2075               #include <bus/usb/usb.h>
  2076               #include <bus/usb/usbhid.h>
  2077               #else
  2078               #include <dev/usb/usb.h>
  2079               #include <dev/usb/usbhid.h>
  2080               #endif
  2081               #if defined(HAVE_USBHID_H)
  2082               #include <usbhid.h>
  2083               #elif defined(HAVE_LIBUSB_H)
  2084               #include <libusb.h>
  2085               #elif defined(HAVE_LIBUSBHID_H)
  2086               #include <libusbhid.h>
  2087               #endif
  2088             ],[
  2089               report_desc_t d;
  2090               hid_start_parse(d, 1, 1);
  2091             ],[
  2092             have_usbhid_new=yes
  2093             ])
  2094             if test x$have_usbhid_new = xyes; then
  2095                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2096             fi
  2097             AC_MSG_RESULT($have_usbhid_new)
  2098 
  2099             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2100             have_machine_joystick=no
  2101             AC_TRY_COMPILE([
  2102               #include <machine/joystick.h>
  2103             ],[
  2104               struct joystick t;
  2105             ],[
  2106             have_machine_joystick=yes
  2107             ])
  2108             if test x$have_machine_joystick = xyes; then
  2109                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2110             fi
  2111             AC_MSG_RESULT($have_machine_joystick)
  2112 
  2113             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2114             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2115             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2116             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2117             have_joystick=yes
  2118         fi
  2119         CFLAGS="$save_CFLAGS"
  2120     fi
  2121 }
  2122 
  2123 dnl Check for clock_gettime()
  2124 CheckClockGettime()
  2125 {
  2126     AC_ARG_ENABLE(clock_gettime,
  2127 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2128                   , enable_clock_gettime=no)
  2129     if test x$enable_clock_gettime = xyes; then
  2130         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2131         if test x$have_clock_gettime = xyes; then
  2132             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2133             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2134         else
  2135             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  2136             if test x$have_clock_gettime = xyes; then
  2137                AC_DEFINE(HAVE_CLOCK_GETTIME)
  2138                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  2139             fi
  2140         fi
  2141     fi
  2142 }
  2143 
  2144 dnl Check for a valid linux/version.h
  2145 CheckLinuxVersion()
  2146 {
  2147     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2148     if test x$have_linux_version_h = xyes; then
  2149         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2150     fi
  2151 }
  2152 
  2153 dnl Check if we want to use RPATH
  2154 CheckRPATH()
  2155 {
  2156     AC_ARG_ENABLE(rpath,
  2157 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2158                   , enable_rpath=yes)
  2159 }
  2160 
  2161 dnl Set up the configuration based on the host platform!
  2162 case "$host" in
  2163     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2164         ARCH=linux
  2165         CheckDummyVideo
  2166         CheckIPod
  2167         # Set up files for the timer library
  2168         if test x$enable_timers = xyes; then
  2169             AC_DEFINE(SDL_TIMER_UNIX)
  2170             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2171             have_timers=yes
  2172         fi
  2173         ;;
  2174     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
  2175         case "$host" in
  2176             *-*-linux*)         ARCH=linux ;;
  2177             *-*-uclinux*)       ARCH=linux ;;
  2178             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2179             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2180             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2181             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2182             *-*-bsdi*)          ARCH=bsdi ;;
  2183             *-*-freebsd*)       ARCH=freebsd ;;
  2184             *-*-dragonfly*)     ARCH=freebsd ;;
  2185             *-*-netbsd*)        ARCH=netbsd ;;
  2186             *-*-openbsd*)       ARCH=openbsd ;;
  2187             *-*-sysv5*)         ARCH=sysv5 ;;
  2188             *-*-solaris*)       ARCH=solaris ;;
  2189             *-*-hpux*)          ARCH=hpux ;;
  2190             *-*-irix*)          ARCH=irix ;;
  2191             *-*-aix*)           ARCH=aix ;;
  2192             *-*-osf*)           ARCH=osf ;;
  2193             *-*-minix*)         ARCH=minix ;;
  2194         esac
  2195         CheckVisibilityHidden
  2196         CheckDummyVideo
  2197         CheckDiskAudio
  2198         CheckDummyAudio
  2199         CheckDLOPEN
  2200         CheckOSS
  2201         CheckDMEDIA
  2202         CheckMME
  2203         CheckALSA
  2204         CheckPulseAudio
  2205         CheckARTSC
  2206         CheckESD
  2207         CheckNAS
  2208         CheckX11
  2209         CheckFBCON
  2210         CheckDirectFB
  2211         CheckFusionSound
  2212         CheckPS2GS
  2213         CheckPS3
  2214         CheckSVGA
  2215         CheckOpenGLX11
  2216         CheckInputEvents
  2217         CheckTslib
  2218         CheckUSBHID
  2219         CheckPTHREAD
  2220         CheckClockGettime
  2221         CheckLinuxVersion
  2222         CheckRPATH
  2223         # Set up files for the audio library
  2224         if test x$enable_audio = xyes; then
  2225           case $ARCH in
  2226             sysv5|solaris|hpux)
  2227                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2228                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2229                 have_audio=yes
  2230             ;;
  2231             netbsd|openbsd)
  2232                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2233                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2234                 have_audio=yes
  2235             ;;
  2236             aix)
  2237                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
  2238                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2239                 have_audio=yes
  2240             ;;
  2241           esac
  2242         fi
  2243         # Set up files for the atomic operations library
  2244         if test x$enable_atomic = xyes; then
  2245           case $ARCH in
  2246             linux)
  2247                 AC_DEFINE(SDL_ATOMIC_LINUX)
  2248                 SOURCES="$SOURCES $srcdir/src/atomic/linux/*.c"
  2249                 have_atomic=yes
  2250             ;;
  2251           esac
  2252         fi
  2253         # Set up files for the joystick library
  2254         if test x$enable_joystick = xyes; then
  2255           case $ARCH in
  2256             linux)
  2257                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2258                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2259                 have_joystick=yes
  2260             ;;
  2261           esac
  2262         fi
  2263         # Set up files for the haptic library
  2264         if test x$enable_haptic = xyes; then
  2265            if test x$use_input_events = xyes; then
  2266              case $ARCH in
  2267                linux)
  2268                    AC_DEFINE(SDL_HAPTIC_LINUX)
  2269                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2270                    have_haptic=yes
  2271                ;;
  2272              esac
  2273            fi
  2274         fi
  2275         # Set up files for the power library
  2276         if test x$enable_power = xyes; then
  2277              case $ARCH in
  2278                linux)
  2279                    AC_DEFINE(SDL_POWER_LINUX)
  2280                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2281                    have_power=yes
  2282                ;;
  2283              esac
  2284         fi
  2285         # Set up files for the thread library
  2286         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2287             AC_DEFINE(SDL_THREAD_SPROC)
  2288             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2289             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2290             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2291             have_threads=yes
  2292         fi
  2293         # Set up files for the timer library
  2294         if test x$enable_timers = xyes; then
  2295             AC_DEFINE(SDL_TIMER_UNIX)
  2296             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2297             have_timers=yes
  2298         fi
  2299         ;;
  2300     *-*-qnx*)
  2301 
  2302         EXTRA_CFLAGS="-I/usr/include $CFLAGS"
  2303         EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
  2304 
  2305         ARCH=qnx
  2306         CheckVisibilityHidden
  2307         CheckDummyVideo
  2308         CheckDiskAudio
  2309         CheckDummyAudio
  2310         CheckDLOPEN
  2311         CheckPulseAudio
  2312         CheckESD
  2313         CheckNAS
  2314         CheckPHOTON
  2315         CheckQNXGF
  2316         CheckX11
  2317         CheckOpenGLX11
  2318         CheckPTHREAD
  2319         CheckClockGettime
  2320 
  2321 
  2322         # Set up files for the audio library
  2323         if test x$enable_audio = xyes; then
  2324             AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
  2325             SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
  2326             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2327             have_audio=yes
  2328         fi
  2329         # Set up files for the timer library
  2330         if test x$enable_timers = xyes; then
  2331             AC_DEFINE(SDL_TIMER_UNIX)
  2332             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2333             have_timers=yes
  2334         fi
  2335         # Setup files for the atomic operations
  2336         if test x$enable_atomic = xyes; then
  2337                 AC_DEFINE(SDL_ATOMIC_QNX)
  2338                 SOURCES="$SOURCES $srcdir/src/atomic/qnx/*.c"
  2339                 have_atomic=yes
  2340         fi
  2341         # Set up dummy files for the joystick for now
  2342         if test x$enable_joystick = xyes; then
  2343             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2344             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2345             have_joystick=yes
  2346         fi
  2347         # Set up dummy files for the haptic for now
  2348         if test x$enable_haptic = xyes; then
  2349             AC_DEFINE(SDL_HAPTIC_DUMMY)
  2350             SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2351             have_haptic=yes
  2352         fi
  2353         ;;
  2354     *-wince* | *-mingw32ce)
  2355         ARCH=win32
  2356         CheckDummyVideo
  2357         CheckDiskAudio
  2358         CheckDummyAudio
  2359         CheckWIN32
  2360         #SOURCES="$SOURCES $srcdir/src/video/gapi/*.c"
  2361         #AC_DEFINE(SDL_VIDEO_DRIVER_GAPI)
  2362         if test x$enable_video = xyes; then
  2363             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2364             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2365             have_video=yes
  2366             AC_ARG_ENABLE(render-gdi,
  2367 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2368                                 , enable_render_gdi=yes)
  2369             if test x$enable_render_gdi = xyes; then
  2370                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2371             fi
  2372             AC_ARG_ENABLE(render-gapi,
  2373 AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
  2374                                 , enable_render_gapi=yes)
  2375             if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
  2376                 AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
  2377             fi
  2378             AC_ARG_ENABLE(render-ddraw,
  2379 AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
  2380                                 , enable_render_ddraw=yes)
  2381             if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
  2382                 AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
  2383             fi
  2384             AC_ARG_ENABLE(render-d3d,
  2385 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2386                                 , enable_render_d3d=yes)
  2387             enable_render_d3d=no
  2388             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2389                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2390             fi
  2391         fi
  2392         # Set up files for the audio library
  2393         if test x$enable_audio = xyes; then
  2394             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2395             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2396             if test x$have_dsound = xyes; then
  2397                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2398                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2399             fi
  2400             have_audio=yes
  2401         fi
  2402         # Set up files for the thread library
  2403         if test x$enable_threads = xyes; then
  2404             AC_DEFINE(SDL_THREAD_WIN32)
  2405             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2406             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2407             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2408             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2409             have_threads=yes
  2410         fi
  2411         # Set up files for the timer library
  2412         if test x$enable_timers = xyes; then
  2413             AC_DEFINE(SDL_TIMER_WINCE)
  2414             SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
  2415             have_timers=yes
  2416         fi
  2417         # Set up files for the shared object loading library
  2418         if test x$enable_loadso = xyes; then
  2419             AC_DEFINE(SDL_LOADSO_WIN32)
  2420             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2421             have_loadso=yes
  2422         fi
  2423         # Set up files for the system power library
  2424         if test x$enable_power = xyes; then
  2425             AC_DEFINE(SDL_POWER_WINDOWS)
  2426             SOURCES="$SOURCES $srcdir/src/power/windows/*.c"
  2427             have_power=yes
  2428         fi
  2429         # Set up the system libraries we need
  2430         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
  2431         # The Win32 platform requires special setup
  2432         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2433         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
  2434         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2435         ;;
  2436     *-*-cygwin* | *-*-mingw32*)
  2437         ARCH=win32
  2438         if test "$build" != "$host"; then # cross-compiling
  2439             # Default cross-compile location
  2440             ac_default_prefix=/usr/local/cross-tools/i386-mingw32
  2441         else
  2442             # Look for the location of the tools and install there
  2443             if test "$BUILD_PREFIX" != ""; then
  2444                 ac_default_prefix=$BUILD_PREFIX
  2445             fi
  2446         fi
  2447         CheckDummyVideo
  2448         CheckDiskAudio
  2449         CheckDummyAudio
  2450         CheckWIN32
  2451         CheckWIN32GL
  2452         CheckDIRECTX
  2453         # Set up files for the video library
  2454         if test x$enable_video = xyes; then
  2455             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2456             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2457             have_video=yes
  2458             AC_ARG_ENABLE(render-gdi,
  2459 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2460                                 , enable_render_gdi=yes)
  2461             if test x$enable_render_gdi = xyes; then
  2462                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2463             fi
  2464             AC_ARG_ENABLE(render-d3d,
  2465 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2466                                 , enable_render_d3d=yes)
  2467             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2468                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2469             fi
  2470         fi
  2471         # Set up files for the audio library
  2472         if test x$enable_audio = xyes; then
  2473             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2474             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2475             if test x$have_dsound = xyes; then
  2476                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2477                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2478             fi
  2479             have_audio=yes
  2480         fi
  2481         # Set up files for the atomic operations library
  2482         if test x$enable_atomic = xyes; then
  2483             AC_DEFINE(SDL_ATOMIC_WIN32)
  2484             SOURCES="$SOURCES $srcdir/src/atomic/win32/*.c"
  2485             have_atomic=yes
  2486         fi
  2487         # Set up files for the joystick library
  2488         if test x$enable_joystick = xyes; then
  2489             if test x$have_dinput = xyes; then
  2490                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2491                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
  2492                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8 -lole32"
  2493             else
  2494                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2495                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
  2496             fi
  2497             have_joystick=yes
  2498         fi
  2499         if test x$enable_haptic = xyes; then
  2500             if test x$have_dinput = xyes; then
  2501                 AC_DEFINE(SDL_HAPTIC_DINPUT)
  2502                 SOURCES="$SOURCES $srcdir/src/haptic/win32/SDL_syshaptic.c"
  2503                 have_haptic=yes
  2504             fi
  2505         fi
  2506         if test x$enable_power = xyes; then
  2507             AC_DEFINE(SDL_POWER_WINDOWS)
  2508             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2509             have_power=yes
  2510         fi
  2511         # Set up files for the thread library
  2512         if test x$enable_threads = xyes; then
  2513             AC_DEFINE(SDL_THREAD_WIN32)
  2514             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2515             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2516             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2517             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2518             have_threads=yes
  2519         fi
  2520         # Set up files for the timer library
  2521         if test x$enable_timers = xyes; then
  2522             AC_DEFINE(SDL_TIMER_WIN32)
  2523             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2524             have_timers=yes
  2525         fi
  2526         # Set up files for the shared object loading library
  2527         if test x$enable_loadso = xyes; then
  2528             AC_DEFINE(SDL_LOADSO_WIN32)
  2529             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2530             have_loadso=yes
  2531         fi
  2532         # Set up the system libraries we need
  2533         # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
  2534         # You can get this here: http://libunicows.sourceforge.net/
  2535         #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
  2536         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm"
  2537         # The Win32 platform requires special setup
  2538         VERSION_SOURCES="$srcdir/src/main/win32/*.rc"
  2539         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2540         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2541         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2542         ;;
  2543     *-*-beos* | *-*-haiku*)
  2544         ARCH=beos
  2545         ac_default_prefix=/boot/develop/tools/gnupro
  2546         CheckDummyVideo
  2547         CheckDiskAudio
  2548         CheckDummyAudio
  2549         CheckBWINDOW
  2550         CheckBeGL
  2551         # Set up files for the audio library
  2552         if test x$enable_audio = xyes; then
  2553             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
  2554             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2555             have_audio=yes
  2556         fi
  2557         # Set up files for the joystick library
  2558         if test x$enable_joystick = xyes; then
  2559             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2560             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2561             have_joystick=yes
  2562         fi
  2563         # Set up files for the thread library
  2564         if test x$enable_threads = xyes; then
  2565             AC_DEFINE(SDL_THREAD_BEOS)
  2566             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2567             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2568             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2569             have_threads=yes
  2570         fi
  2571         # Set up files for the timer library
  2572         if test x$enable_timers = xyes; then
  2573             AC_DEFINE(SDL_TIMER_BEOS)
  2574             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2575             have_timers=yes
  2576         fi
  2577         # Set up files for the shared object loading library
  2578         if test x$enable_loadso = xyes; then
  2579             AC_DEFINE(SDL_LOADSO_BEOS)
  2580             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2581             have_loadso=yes
  2582         fi
  2583         # Set up files for the system power library
  2584         if test x$enable_power = xyes; then
  2585             AC_DEFINE(SDL_POWER_BEOS)
  2586             SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
  2587             have_power=yes
  2588         fi
  2589         # The BeOS platform requires special setup.
  2590         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2591         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2592         ;;
  2593     *-*-darwin* )
  2594         # This could be either full "Mac OS X", or plain "Darwin" which is
  2595         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2596         # Next line is broken, and a few files below require Mac OS X (full)
  2597         ARCH=macosx
  2598 
  2599         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2600         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2601         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2602 
  2603         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2604         # is -lm which is not needed under Mac OS X. But for some reasons it
  2605         # also tends to contain spurious -L switches, which we don't want to
  2606         # use here or in sdl-config. Hence we reset it.
  2607         EXTRA_LDFLAGS=""
  2608 
  2609         CheckVisibilityHidden
  2610         CheckDummyVideo
  2611         CheckDiskAudio
  2612         CheckDummyAudio
  2613         CheckDLOPEN
  2614 
  2615         # Set up files for the shared object loading library
  2616         # (this needs to be done before the dynamic X11 check)
  2617         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2618             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2619             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2620             have_loadso=yes
  2621         fi
  2622 
  2623         CheckCOCOA
  2624         CheckX11
  2625         CheckMacGL
  2626         CheckOpenGLX11
  2627         CheckPTHREAD
  2628 
  2629         # Good optimization on Mac OS X, yes...
  2630         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2631 
  2632         # Need this or things might misbuild on a G3.
  2633         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2634 
  2635         # Set up files for the audio library
  2636         if test x$enable_audio = xyes; then
  2637             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2638             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2639             have_audio=yes
  2640         fi
  2641         # Set up files for the atomic operations library
  2642         if test x$enable_atomic = xyes; then
  2643             AC_DEFINE(SDL_ATOMIC_MACOSX)
  2644             SOURCES="$SOURCES $srcdir/src/atomic/macosx/*.c"
  2645             have_atomic=yes
  2646         fi
  2647         # Set up files for the joystick library
  2648         if test x$enable_joystick = xyes; then
  2649             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2650             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2651             have_joystick=yes
  2652         fi
  2653         # Set up files for the haptic library
  2654         if test x$enable_haptic = xyes; then
  2655             AC_DEFINE(SDL_HAPTIC_IOKIT)
  2656             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2657             have_haptic=yes
  2658             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2659         fi
  2660         # Set up files for the power library
  2661         if test x$enable_power = xyes; then
  2662             AC_DEFINE(SDL_POWER_MACOSX)
  2663             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2664             have_power=yes
  2665         fi
  2666         # Set up files for the timer library
  2667         if test x$enable_timers = xyes; then
  2668             AC_DEFINE(SDL_TIMER_UNIX)
  2669             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2670             have_timers=yes
  2671         fi
  2672         # The Mac OS X platform requires special setup.
  2673         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2674         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2675         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2676         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2677         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2678         # If either the audio or CD driver is used, add the AudioUnit framework
  2679         if test x$enable_audio = xyes; then
  2680             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2681         fi
  2682         ;;
  2683     *-riscos)
  2684         ARCH=riscos
  2685         CheckOSS
  2686         CheckPTHREAD
  2687         # Set up files for the video library
  2688         if test x$enable_video = xyes; then
  2689             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2690             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2691             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2692             have_video=yes
  2693         fi
  2694         # Set up files for the joystick library
  2695         if test x$enable_joystick = xyes; then
  2696             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2697             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2698             have_joystick=yes
  2699         fi
  2700         # Set up files for the timer library
  2701         if test x$enable_timers = xyes; then
  2702             AC_DEFINE(SDL_TIMER_RISCOS)
  2703             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2704             have_timers=yes
  2705         fi
  2706         # The RISC OS platform requires special setup.
  2707         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2708         ;;
  2709     *)
  2710         AC_MSG_ERROR([
  2711 *** Unsupported host:  Please add to configure.in
  2712         ])
  2713         ;;
  2714 esac
  2715 
  2716 # Verify that we have all the platform specific files we need
  2717 
  2718 if test x$have_joystick != xyes; then
  2719     if test x$enable_joystick = xyes; then
  2720         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2721     fi
  2722     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2723 fi
  2724 if test x$have_haptic != xyes; then
  2725     if test x$enable_haptic = xyes; then
  2726         AC_DEFINE(SDL_HAPTIC_DISABLED)
  2727     fi
  2728     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2729 fi
  2730 if test x$have_threads != xyes; then
  2731     if test x$enable_threads = xyes; then
  2732         AC_DEFINE(SDL_THREADS_DISABLED)
  2733     fi
  2734     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2735 fi
  2736 if test x$have_timers != xyes; then
  2737     if test x$enable_timers = xyes; then
  2738         AC_DEFINE(SDL_TIMERS_DISABLED)
  2739     fi
  2740     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2741 fi
  2742 if test x$have_loadso != xyes; then
  2743     if test x$enable_loadso = xyes; then
  2744         AC_DEFINE(SDL_LOADSO_DISABLED)
  2745     fi
  2746     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2747 fi
  2748 if test x$SDLMAIN_SOURCES = x; then
  2749     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2750 fi
  2751 
  2752 OBJECTS=`echo $SOURCES`
  2753 DEPENDS=`echo $SOURCES`
  2754 for EXT in asm cc m c S; do
  2755     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2756     DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.'$EXT',\\
  2757 $(objects)/\2.lo: \1/\2.'$EXT'\\
  2758 	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c $< -o $@,g'`
  2759 done
  2760 
  2761 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2762 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2763 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2764 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
  2765 $(objects)/\2.o: \1/\2.rc\\
  2766 	\$(WINDRES) \$< \$@,g'`
  2767 
  2768 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2769 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2770 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2771 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
  2772 $(objects)/\2.o: \1/\2.c\\
  2773 	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c $< -o $@,g'`
  2774 
  2775 # Set runtime shared library paths as needed
  2776 
  2777 if test "x$enable_rpath" = "xyes"; then
  2778   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2779     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2780   fi
  2781   if test $ARCH = solaris; then
  2782     SDL_RLD_FLAGS="-R\${libdir}"
  2783   fi
  2784 else
  2785   SDL_RLD_FLAGS=""
  2786 fi
  2787 
  2788 case "$ARCH" in
  2789   macosx)
  2790     # Evil hack to allow static linking on Mac OS X
  2791     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2792     ;;
  2793   *)
  2794     SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2795     ;;
  2796 esac
  2797 
  2798 dnl Expand the cflags and libraries needed by apps using SDL
  2799 AC_SUBST(SDL_CFLAGS)
  2800 AC_SUBST(SDL_LIBS)
  2801 AC_SUBST(SDL_STATIC_LIBS)
  2802 AC_SUBST(SDL_RLD_FLAGS)
  2803 if test x$enable_shared = xyes; then
  2804     ENABLE_SHARED_TRUE=
  2805     ENABLE_SHARED_FALSE="#"
  2806 else
  2807     ENABLE_SHARED_TRUE="#"
  2808     ENABLE_SHARED_FALSE=
  2809 fi
  2810 if test x$enable_static = xyes; then
  2811     ENABLE_STATIC_TRUE=
  2812     ENABLE_STATIC_FALSE="#"
  2813 else
  2814     ENABLE_STATIC_TRUE="#"
  2815     ENABLE_STATIC_FALSE=
  2816 fi
  2817 AC_SUBST(ENABLE_SHARED_TRUE)
  2818 AC_SUBST(ENABLE_SHARED_FALSE)
  2819 AC_SUBST(ENABLE_STATIC_TRUE)
  2820 AC_SUBST(ENABLE_STATIC_FALSE)
  2821 
  2822 dnl Expand the sources and objects needed to build the library
  2823 AC_SUBST(ac_aux_dir)
  2824 AC_SUBST(INCLUDE)
  2825 AC_SUBST(OBJECTS)
  2826 AC_SUBST(DEPENDS)
  2827 AC_SUBST(VERSION_OBJECTS)
  2828 AC_SUBST(VERSION_DEPENDS)
  2829 AC_SUBST(SDLMAIN_OBJECTS)
  2830 AC_SUBST(SDLMAIN_DEPENDS)
  2831 AC_SUBST(BUILD_CFLAGS)
  2832 AC_SUBST(EXTRA_CFLAGS)
  2833 AC_SUBST(BUILD_LDFLAGS)
  2834 AC_SUBST(EXTRA_LDFLAGS)
  2835 AC_SUBST(WINDRES)
  2836 
  2837 AC_OUTPUT([
  2838     Makefile sdl-config SDL.spec sdl.pc
  2839 ])