configure.in
author Sam Lantinga <slouken@libsdl.org>
Tue, 13 Oct 2009 06:40:08 +0000
changeset 3391 188fc5ecc58c
parent 3390 802e5d85b90c
child 3392 efc22582afc5
permissions -rw-r--r--
Simplify and improve dynamic library detection, taken from SDL_image
     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             echo "-- dynamic libasound -> $alsa_lib"
   629 
   630             AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
   631             SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
   632             EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
   633             if test x$have_loadso != xyes && \
   634                test x$enable_alsa_shared = xyes; then
   635                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
   636             fi
   637             if test x$have_loadso = xyes && \
   638                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   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             echo "-- dynamic libesd -> $esd_lib"
   724 
   725             AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
   726             SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
   727             EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
   728             if test x$have_loadso != xyes && \
   729                test x$enable_esd_shared = xyes; then
   730                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
   731             fi
   732             if test x$have_loadso = xyes && \
   733                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   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             echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
   771 
   772             AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
   773             SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
   774             EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
   775             if test x$have_loadso != xyes && \
   776                test x$enable_pulseaudio_shared = xyes; then
   777                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
   778             fi
   779             if test x$have_loadso = xyes && \
   780                test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
   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                 echo "-- dynamic libartsc -> $arts_lib"
   821 
   822                 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   823                 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   824                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
   825                 if test x$have_loadso != xyes && \
   826                    test x$enable_arts_shared = xyes; then
   827                     AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
   828                 fi
   829                 if test x$have_loadso = xyes && \
   830                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   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             echo "-- dynamic libaudio -> $nas_lib"
   879 
   880             if test x$have_loadso != xyes && \
   881                test x$enable_nas_shared = xyes; then
   882                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
   883             fi
   884             if test x$have_loadso = xyes && \
   885                test x$enable_nas_shared = xyes && test x$nas_lib != x; then
   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_spec="$DIRECTFB_PREFIX/lib/libdirectfb.so*"
  1344             directfb_lib=`ls -- $directfb_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
  1345             dnl echo "-- $directfb_lib_spec -> $directfb_lib"
  1346 
  1347             if test x$have_loadso != xyes && \
  1348                test x$enable_directfb_shared = xyes; then
  1349                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1350             fi
  1351             if test x$have_loadso = xyes && \
  1352                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1353 				directfb_shared=yes
  1354                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
  1355             else
  1356 	            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1357             fi
  1358 	        AC_MSG_RESULT($directfb_shared)
  1359             have_video=yes
  1360         fi
  1361     fi
  1362 }
  1363 
  1364 dnl Find FusionSound
  1365 CheckFusionSound()
  1366 {
  1367     AC_ARG_ENABLE(fusionsound,
  1368 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1369                   , enable_fusionsound=no)
  1370     if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1371         fusionsound=no
  1372 
  1373         FUSIONSOUND_REQUIRED_VERSION=1.1.1
  1374 
  1375         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1376         AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
  1377         if test x$PKG_CONFIG != xno; then
  1378             if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
  1379                 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
  1380                 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
  1381                 fusionsound=yes
  1382             fi
  1383         fi
  1384         AC_MSG_RESULT($fusionsound)
  1385 
  1386         if test x$fusionsound = xyes; then
  1387             AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
  1388             SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1389             EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1390             
  1391             AC_ARG_ENABLE(fusionsound-shared,
  1392 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1393                           , enable_fusionsound_shared=yes)
  1394             fusionsound_shared=no
  1395 	        AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1396             if test x$have_loadso != xyes && \
  1397                test x$enable_fusionsound_shared = xyes; then
  1398                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1399             fi
  1400             if test x$have_loadso = xyes && \
  1401                test x$enable_fusionsound_shared = xyes; then
  1402                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
  1403             	fusionsound_shared=yes
  1404             else
  1405 	            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1406             fi
  1407 	        AC_MSG_RESULT($fusionsound_shared)
  1408             
  1409             have_audio=yes
  1410         fi
  1411     fi
  1412 }
  1413 
  1414 dnl See if we're running on PlayStation 2 hardware
  1415 CheckPS2GS()
  1416 {
  1417     AC_ARG_ENABLE(video-ps2gs,
  1418 AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=no]]]),
  1419                   , enable_video_ps2gs=no)
  1420     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
  1421         AC_MSG_CHECKING(for PlayStation 2 GS support)
  1422         video_ps2gs=no
  1423         AC_TRY_COMPILE([
  1424          #include <linux/ps2/dev.h>
  1425          #include <linux/ps2/gs.h>
  1426         ],[
  1427         ],[
  1428         video_ps2gs=yes
  1429         ])
  1430         AC_MSG_RESULT($video_ps2gs)
  1431         if test x$video_ps2gs = xyes; then
  1432             AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
  1433             SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
  1434             have_video=yes
  1435         fi
  1436     fi
  1437 }
  1438 
  1439 dnl See if we're running on PlayStation 3 Cell hardware
  1440 CheckPS3()
  1441 {
  1442   AC_ARG_ENABLE(video-ps3,
  1443                 AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
  1444                 , enable_video_ps3=yes)
  1445   if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then 
  1446     video_ps3=no
  1447     AC_CHECK_HEADER([linux/fb.h])
  1448     AC_CHECK_HEADER([asm/ps3fb.h], [have_ps3fb_hdr=yes], [],
  1449 			[#ifndef _LINUX_TYPES_H
  1450 				#include <linux/types.h>
  1451 			#endif])
  1452     AC_CHECK_HEADER([libspe2.h], have_libspe2_hdr=yes)
  1453     AC_CHECK_LIB([spe2], spe_context_create, have_spe2_lib=yes)
  1454 
  1455     AC_CHECK_PROGS(SPU_GCC, [spu-gcc])
  1456     AC_CHECK_PROGS(EMBEDSPU, [embedspu])
  1457 
  1458     have_spu_libs=yes
  1459     AC_CHECK_LIB([fb_writer_spu], [main], [], [have_spu_libs=no])
  1460     AC_CHECK_LIB([yuv2rgb_spu], [main], [], [have_spu_libs=no])
  1461     AC_CHECK_LIB([bilin_scaler_spu], [main], [], [have_spu_libs=no])
  1462     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
  1463         AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
  1464         video_ps3=yes
  1465         have_video=yes
  1466         SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
  1467         EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
  1468         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
  1469 
  1470         if test x$have_spu_libs = xno; then 
  1471               AC_MSG_WARN([ps3libs missing, please run make ps3libs])
  1472         fi
  1473     fi
  1474     AC_MSG_CHECKING([for PlayStation 3 Cell support])
  1475     AC_MSG_RESULT([$video_ps3])
  1476   fi
  1477 }
  1478 
  1479 dnl Find the SVGAlib includes and libraries
  1480 CheckSVGA()
  1481 {
  1482     AC_ARG_ENABLE(video-svga,
  1483 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=no]]]),
  1484                   , enable_video_svga=no)
  1485     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1486         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1487         video_svga=no
  1488         AC_TRY_COMPILE([
  1489          #include <vga.h>
  1490          #include <vgamouse.h>
  1491          #include <vgakeyboard.h>
  1492         ],[
  1493          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1494              exit(0);
  1495          }
  1496         ],[
  1497         video_svga=yes
  1498         ])
  1499         AC_MSG_RESULT($video_svga)
  1500         if test x$video_svga = xyes; then
  1501             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1502             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1503             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
  1504             have_video=yes
  1505         fi
  1506     fi
  1507 }
  1508 
  1509 dnl rcg04172001 Set up the Null video driver.
  1510 CheckDummyVideo()
  1511 {
  1512     AC_ARG_ENABLE(video-dummy,
  1513 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1514                   , enable_video_dummy=yes)
  1515     if test x$enable_video_dummy = xyes; then
  1516         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1517         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1518         have_video=yes
  1519     fi
  1520 }
  1521 
  1522 dnl Check to see if OpenGL support is desired
  1523 AC_ARG_ENABLE(video-opengl,
  1524 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1525               , enable_video_opengl=yes)
  1526 
  1527 dnl Find OpenGL
  1528 CheckOpenGLX11()
  1529 {
  1530     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1531         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1532         video_opengl=no
  1533         AC_TRY_COMPILE([
  1534          #include <GL/gl.h>
  1535          #include <GL/glx.h>
  1536          #include <GL/glu.h>
  1537         ],[
  1538         ],[
  1539         video_opengl=yes
  1540         ])
  1541         AC_MSG_RESULT($video_opengl)
  1542         if test x$video_opengl = xyes; then
  1543             AC_DEFINE(SDL_VIDEO_OPENGL)
  1544             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1545             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1546         fi
  1547     fi
  1548 }
  1549 
  1550 dnl Find QNX 6.x Software OpenGL
  1551 CheckOpenGLQNX()
  1552 {
  1553     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1554         AC_MSG_CHECKING(for QNX 6.x Photon OpenGL support)
  1555         video_opengl=no
  1556         AC_TRY_COMPILE([
  1557          #include <GL/gl.h>
  1558         ],[
  1559         ],[
  1560         video_opengl=yes
  1561         ])
  1562         AC_MSG_RESULT($video_opengl)
  1563         if test x$video_opengl = xyes; then
  1564             AC_DEFINE(SDL_VIDEO_OPENGL)
  1565             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1566             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1567         fi
  1568     fi
  1569 }
  1570 
  1571 dnl Find QNX 6.3 and above OpenGL ES implementation
  1572 CheckOpenGLESQNX()
  1573 {
  1574     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1575         AC_MSG_CHECKING(for QNX OpenGL ES (CM) support)
  1576         video_opengl=no
  1577         AC_TRY_COMPILE([
  1578          #include <GLES/egl.h>
  1579         ],[
  1580         ],[
  1581         video_opengl=yes
  1582         ])
  1583         AC_MSG_RESULT($video_opengl)
  1584         if test x$video_opengl = xyes; then
  1585             AC_DEFINE(SDL_VIDEO_OPENGL_ES)
  1586             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
  1587             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
  1588         else
  1589             AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
  1590             video_opengl=no
  1591             AC_TRY_COMPILE([
  1592              #define COMMON_LITE
  1593              #include <GLES/egl.h>
  1594             ],[
  1595             ],[
  1596             video_opengl=yes
  1597             ])
  1598             AC_MSG_RESULT($video_opengl)
  1599             if test x$video_opengl = xyes; then
  1600                 AC_DEFINE(SDL_VIDEO_OPENGL_ES)
  1601                 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
  1602                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CLS"
  1603             fi
  1604         fi
  1605     fi
  1606 }
  1607 
  1608 
  1609 dnl Check for Win32 OpenGL
  1610 CheckWIN32GL()
  1611 {
  1612     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1613         AC_DEFINE(SDL_VIDEO_OPENGL)
  1614         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1615         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1616     fi
  1617 }
  1618 
  1619 dnl Check for BeOS OpenGL
  1620 CheckBeGL()
  1621 {
  1622     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1623         AC_DEFINE(SDL_VIDEO_OPENGL)
  1624         AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
  1625         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1626         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1627     fi
  1628 }
  1629 
  1630 dnl Check for MacOS OpenGL
  1631 CheckMacGL()
  1632 {
  1633     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1634         AC_DEFINE(SDL_VIDEO_OPENGL)
  1635         AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
  1636         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1637         case "$host" in
  1638             *-*-darwin*)
  1639                 if test x$enable_video_cocoa = xyes; then
  1640                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1641                 fi
  1642         esac
  1643     fi
  1644 }
  1645 
  1646 dnl See if we can use the new unified event interface in Linux 2.4
  1647 CheckInputEvents()
  1648 {
  1649     dnl Check for Linux 2.4 unified input event interface support
  1650     AC_ARG_ENABLE(input-events,
  1651 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1652                   , enable_input_events=yes)
  1653     if test x$enable_input_events = xyes; then
  1654         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1655         use_input_events=no
  1656         AC_TRY_COMPILE([
  1657           #include <linux/input.h>
  1658         ],[
  1659           #ifndef EVIOCGNAME
  1660           #error EVIOCGNAME() ioctl not available
  1661           #endif
  1662         ],[
  1663         use_input_events=yes
  1664         ])
  1665         AC_MSG_RESULT($use_input_events)
  1666         if test x$use_input_events = xyes; then
  1667             AC_DEFINE(SDL_INPUT_LINUXEV)
  1668         fi
  1669     fi
  1670 }
  1671 
  1672 dnl See if we can use the Touchscreen input library
  1673 CheckTslib()
  1674 {
  1675     AC_ARG_ENABLE(input-tslib,
  1676 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1677                   , enable_input_tslib=yes)
  1678     if test x$enable_input_tslib = xyes; then
  1679         AC_MSG_CHECKING(for Touchscreen library support)
  1680         enable_input_tslib=no
  1681         AC_TRY_COMPILE([
  1682           #include "tslib.h"
  1683         ],[
  1684         ],[
  1685         enable_input_tslib=yes
  1686         ])
  1687         AC_MSG_RESULT($enable_input_tslib)
  1688         if test x$enable_input_tslib = xyes; then
  1689             AC_DEFINE(SDL_INPUT_TSLIB)
  1690             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1691         fi
  1692     fi
  1693 }
  1694 
  1695 dnl See if we can use GNU pth library for threads
  1696 CheckPTH()
  1697 {
  1698     dnl Check for pth support
  1699     AC_ARG_ENABLE(pth,
  1700 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
  1701                   , enable_pth=yes)
  1702     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1703         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1704         if test "$PTH_CONFIG" = "no"; then
  1705             use_pth=no
  1706         else
  1707             use_pth=yes
  1708         fi
  1709         AC_MSG_CHECKING(pth)
  1710         AC_MSG_RESULT($use_pth)
  1711         if test "x$use_pth" = xyes; then
  1712             AC_DEFINE(SDL_THREAD_PTH)
  1713             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1714             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1715             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1716             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1717             have_threads=yes
  1718         fi
  1719     fi
  1720 }
  1721 
  1722 dnl See what type of thread model to use on Linux and Solaris
  1723 CheckPTHREAD()
  1724 {
  1725     dnl Check for pthread support
  1726     AC_ARG_ENABLE(pthreads,
  1727 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1728                   , enable_pthreads=yes)
  1729     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1730     AC_ARG_ENABLE(pthread-sem,
  1731 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1732                   , enable_pthread_sem=yes)
  1733     case "$host" in
  1734         *-*-linux*|*-*-uclinux*)
  1735             pthread_cflags="-D_REENTRANT"
  1736             pthread_lib="-lpthread"
  1737             ;;
  1738         *-*-bsdi*)
  1739             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1740             pthread_lib=""
  1741             ;;
  1742         *-*-darwin*)
  1743             pthread_cflags="-D_THREAD_SAFE"
  1744 # causes Carbon.p complaints?
  1745 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1746             ;;
  1747         *-*-freebsd*|*-*-dragonfly*)
  1748             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1749             pthread_lib="-pthread"
  1750             ;;
  1751         *-*-netbsd*)
  1752             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1753             pthread_lib="-lpthread"
  1754             ;;
  1755         *-*-openbsd*)
  1756             pthread_cflags="-D_REENTRANT"
  1757             pthread_lib="-pthread"
  1758             ;;
  1759         *-*-solaris*)
  1760             pthread_cflags="-D_REENTRANT"
  1761             pthread_lib="-lpthread -lposix4"
  1762             ;;
  1763         *-*-sysv5*)
  1764             pthread_cflags="-D_REENTRANT -Kthread"
  1765             pthread_lib=""
  1766             ;;
  1767         *-*-irix*)
  1768             pthread_cflags="-D_SGI_MP_SOURCE"
  1769             pthread_lib="-lpthread"
  1770             ;;
  1771         *-*-aix*)
  1772             pthread_cflags="-D_REENTRANT -mthreads"
  1773             pthread_lib="-lpthread"
  1774             ;;
  1775         *-*-hpux11*)
  1776             pthread_cflags="-D_REENTRANT"
  1777             pthread_lib="-L/usr/lib -lpthread"
  1778             ;;
  1779         *-*-qnx*)
  1780             pthread_cflags=""
  1781             pthread_lib=""
  1782             ;;
  1783         *-*-osf*)
  1784             pthread_cflags="-D_REENTRANT"
  1785             if test x$ac_cv_prog_gcc = xyes; then
  1786                 pthread_lib="-lpthread -lrt"
  1787             else
  1788                 pthread_lib="-lpthread -lexc -lrt"
  1789             fi
  1790             ;;
  1791         *)
  1792             pthread_cflags="-D_REENTRANT"
  1793             pthread_lib="-lpthread"
  1794             ;;
  1795     esac
  1796     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1797         # Save the original compiler flags and libraries
  1798         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1799         # Add the pthread compiler flags and libraries
  1800         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1801         # Check to see if we have pthread support on this system
  1802         AC_MSG_CHECKING(for pthreads)
  1803         use_pthreads=no
  1804         AC_TRY_LINK([
  1805          #include <pthread.h>
  1806         ],[
  1807          pthread_attr_t type;
  1808          pthread_attr_init(&type);
  1809         ],[
  1810         use_pthreads=yes
  1811         ])
  1812         AC_MSG_RESULT($use_pthreads)
  1813         # Restore the compiler flags and libraries
  1814         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1815 
  1816         # Do futher testing if we have pthread support...
  1817         if test x$use_pthreads = xyes; then
  1818             AC_DEFINE(SDL_THREAD_PTHREAD)
  1819             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1820             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1821             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1822             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1823 
  1824             # Save the original compiler flags and libraries
  1825             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1826             # Add the pthread compiler flags and libraries
  1827             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1828 
  1829             # Check to see if recursive mutexes are available
  1830             AC_MSG_CHECKING(for recursive mutexes)
  1831             has_recursive_mutexes=no
  1832             if test x$has_recursive_mutexes = xno; then
  1833                 AC_TRY_COMPILE([
  1834                   #include <pthread.h>
  1835                 ],[
  1836                   pthread_mutexattr_t attr;
  1837                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1838                 ],[
  1839                 has_recursive_mutexes=yes
  1840                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1841                 ])
  1842             fi
  1843             if test x$has_recursive_mutexes = xno; then
  1844                 AC_TRY_COMPILE([
  1845                   #include <pthread.h>
  1846                 ],[
  1847                   pthread_mutexattr_t attr;
  1848                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1849                 ],[
  1850                 has_recursive_mutexes=yes
  1851                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1852                 ])
  1853             fi
  1854             AC_MSG_RESULT($has_recursive_mutexes)
  1855 
  1856             # Check to see if pthread semaphore support is missing
  1857             if test x$enable_pthread_sem = xyes; then
  1858                 AC_MSG_CHECKING(for pthread semaphores)
  1859                 have_pthread_sem=no
  1860                 AC_TRY_COMPILE([
  1861                   #include <pthread.h>
  1862                   #include <semaphore.h>
  1863                 ],[
  1864                 ],[
  1865                 have_pthread_sem=yes
  1866                 ])
  1867                 AC_MSG_RESULT($have_pthread_sem)
  1868             fi
  1869 
  1870             # Restore the compiler flags and libraries
  1871             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1872 
  1873             # Basic thread creation functions
  1874             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1875 
  1876             # Semaphores
  1877             # We can fake these with mutexes and condition variables if necessary
  1878             if test x$have_pthread_sem = xyes; then
  1879                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1880             else
  1881                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1882             fi
  1883 
  1884             # Mutexes
  1885             # We can fake these with semaphores if necessary
  1886             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1887 
  1888             # Condition variables
  1889             # We can fake these with semaphores and mutexes if necessary
  1890             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1891 
  1892             have_threads=yes
  1893         else
  1894             CheckPTH
  1895         fi
  1896     fi
  1897 }
  1898 
  1899 dnl Determine whether the compiler can produce Win32 executables
  1900 CheckWIN32()
  1901 {
  1902     AC_MSG_CHECKING(Win32 compiler)
  1903     have_win32_gcc=no
  1904     AC_TRY_COMPILE([
  1905      #include <windows.h>
  1906     ],[
  1907     ],[
  1908     have_win32_gcc=yes
  1909     ])
  1910     AC_MSG_RESULT($have_win32_gcc)
  1911     if test x$have_win32_gcc != xyes; then
  1912        AC_MSG_ERROR([
  1913 *** Your compiler ($CC) does not produce Win32 executables!
  1914        ])
  1915     fi
  1916 
  1917     AC_MSG_CHECKING(Windows CE)
  1918     have_wince=no
  1919     AC_TRY_COMPILE([
  1920 #ifndef _WIN32_WCE
  1921 #error This is not Windows CE
  1922 #endif
  1923     ],[
  1924     ],[
  1925     have_wince=yes
  1926     ])
  1927     AC_MSG_RESULT($have_wince)
  1928 
  1929     dnl See if the user wants to redirect standard output to files
  1930     AC_ARG_ENABLE(stdio-redirect,
  1931 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  1932                   , enable_stdio_redirect=yes)
  1933     if test x$enable_stdio_redirect != xyes; then
  1934         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  1935     fi
  1936 }
  1937 
  1938 dnl Find the DirectX includes and libraries
  1939 CheckDIRECTX()
  1940 {
  1941     AC_ARG_ENABLE(directx,
  1942 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  1943                   , enable_directx=yes)
  1944     if test x$enable_directx = xyes; then
  1945         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  1946         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1947         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1948         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  1949     fi
  1950 }
  1951 
  1952 dnl Check for the dlfcn.h interface for dynamically loading objects
  1953 CheckDLOPEN()
  1954 {
  1955     AC_ARG_ENABLE(sdl-dlopen,
  1956 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1957                   , enable_sdl_dlopen=yes)
  1958     if test x$enable_sdl_dlopen = xyes; then
  1959         AC_MSG_CHECKING(for dlopen)
  1960         have_dlopen=no
  1961         AC_TRY_COMPILE([
  1962          #include <dlfcn.h>
  1963         ],[
  1964          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1965          #error Use dlcompat for Mac OS X 10.2 compatibility
  1966          #endif
  1967         ],[
  1968         have_dlopen=yes
  1969         ])
  1970         AC_MSG_RESULT($have_dlopen)
  1971 
  1972         if test x$have_dlopen = xyes; then
  1973             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1974                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1975                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1976             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1977             if test x$have_dlvsym = xyes; then
  1978                 AC_DEFINE(HAVE_DLVSYM)
  1979             fi
  1980             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1981             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1982             have_loadso=yes
  1983         fi
  1984     fi
  1985 }
  1986 
  1987 dnl Check for the usbhid(3) library on *BSD
  1988 CheckUSBHID()
  1989 {
  1990     if test x$enable_joystick = xyes; then
  1991         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1992         if test x$have_libusbhid = xyes; then
  1993             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1994             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1995             USB_LIBS="$USB_LIBS -lusbhid"
  1996         else
  1997             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1998             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1999             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  2000         fi
  2001             
  2002         save_CFLAGS="$CFLAGS"
  2003         CFLAGS="$CFLAGS $USB_CFLAGS"
  2004 
  2005         AC_MSG_CHECKING(for usbhid)
  2006         have_usbhid=no
  2007         AC_TRY_COMPILE([
  2008           #include <sys/types.h>
  2009           #if defined(HAVE_USB_H)
  2010           #include <usb.h>
  2011           #endif
  2012           #ifdef __DragonFly__
  2013           # include <bus/usb/usb.h>
  2014           # include <bus/usb/usbhid.h>
  2015           #else
  2016           # include <dev/usb/usb.h>
  2017           # include <dev/usb/usbhid.h>
  2018           #endif
  2019           #if defined(HAVE_USBHID_H)
  2020           #include <usbhid.h>
  2021           #elif defined(HAVE_LIBUSB_H)
  2022           #include <libusb.h>
  2023           #elif defined(HAVE_LIBUSBHID_H)
  2024           #include <libusbhid.h>
  2025           #endif
  2026         ],[
  2027           struct report_desc *repdesc;
  2028           struct usb_ctl_report *repbuf;
  2029           hid_kind_t hidkind;
  2030         ],[
  2031         have_usbhid=yes
  2032         ])
  2033         AC_MSG_RESULT($have_usbhid)
  2034 
  2035         if test x$have_usbhid = xyes; then
  2036             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2037             have_usbhid_ucr_data=no
  2038             AC_TRY_COMPILE([
  2039               #include <sys/types.h>
  2040               #if defined(HAVE_USB_H)
  2041               #include <usb.h>
  2042               #endif
  2043               #ifdef __DragonFly__
  2044               # include <bus/usb/usb.h>
  2045               # include <bus/usb/usbhid.h>
  2046               #else
  2047               # include <dev/usb/usb.h>
  2048               # include <dev/usb/usbhid.h>
  2049               #endif
  2050               #if defined(HAVE_USBHID_H)
  2051               #include <usbhid.h>
  2052               #elif defined(HAVE_LIBUSB_H)
  2053               #include <libusb.h>
  2054               #elif defined(HAVE_LIBUSBHID_H)
  2055               #include <libusbhid.h>
  2056               #endif
  2057             ],[
  2058               struct usb_ctl_report buf;
  2059               if (buf.ucr_data) { }
  2060             ],[
  2061             have_usbhid_ucr_data=yes
  2062             ])
  2063             if test x$have_usbhid_ucr_data = xyes; then
  2064                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2065             fi
  2066             AC_MSG_RESULT($have_usbhid_ucr_data)
  2067             
  2068             AC_MSG_CHECKING(for new usbhid API)
  2069             have_usbhid_new=no
  2070             AC_TRY_COMPILE([
  2071               #include <sys/types.h>
  2072               #if defined(HAVE_USB_H)
  2073               #include <usb.h>
  2074               #endif
  2075 	      #ifdef __DragonFly__
  2076               #include <bus/usb/usb.h>
  2077               #include <bus/usb/usbhid.h>
  2078 	      #else
  2079               #include <dev/usb/usb.h>
  2080               #include <dev/usb/usbhid.h>
  2081 	      #endif
  2082               #if defined(HAVE_USBHID_H)
  2083               #include <usbhid.h>
  2084               #elif defined(HAVE_LIBUSB_H)
  2085               #include <libusb.h>
  2086               #elif defined(HAVE_LIBUSBHID_H)
  2087               #include <libusbhid.h>
  2088               #endif
  2089             ],[
  2090               report_desc_t d;
  2091               hid_start_parse(d, 1, 1);
  2092             ],[
  2093             have_usbhid_new=yes
  2094             ])
  2095             if test x$have_usbhid_new = xyes; then
  2096                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2097             fi
  2098             AC_MSG_RESULT($have_usbhid_new)
  2099 
  2100             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2101             have_machine_joystick=no
  2102             AC_TRY_COMPILE([
  2103               #include <machine/joystick.h>
  2104             ],[
  2105               struct joystick t;
  2106             ],[
  2107             have_machine_joystick=yes
  2108             ])
  2109             if test x$have_machine_joystick = xyes; then
  2110                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2111             fi
  2112             AC_MSG_RESULT($have_machine_joystick)
  2113 
  2114             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2115             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2116             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2117             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2118             have_joystick=yes
  2119         fi
  2120         CFLAGS="$save_CFLAGS"
  2121     fi
  2122 }
  2123 
  2124 dnl Check for clock_gettime()
  2125 CheckClockGettime()
  2126 {
  2127     AC_ARG_ENABLE(clock_gettime,
  2128 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2129                   , enable_clock_gettime=no)
  2130     if test x$enable_clock_gettime = xyes; then
  2131         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2132         if test x$have_clock_gettime = xyes; then
  2133             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2134             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2135         else
  2136             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  2137             if test x$have_clock_gettime = xyes; then
  2138                AC_DEFINE(HAVE_CLOCK_GETTIME)
  2139                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  2140             fi
  2141         fi
  2142     fi
  2143 }
  2144 
  2145 dnl Check for a valid linux/version.h
  2146 CheckLinuxVersion()
  2147 {
  2148     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2149     if test x$have_linux_version_h = xyes; then
  2150         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2151     fi
  2152 }
  2153 
  2154 dnl Check if we want to use RPATH
  2155 CheckRPATH()
  2156 {
  2157     AC_ARG_ENABLE(rpath,
  2158 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2159                   , enable_rpath=yes)
  2160 }
  2161 
  2162 dnl Set up the configuration based on the host platform!
  2163 case "$host" in
  2164     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2165         ARCH=linux
  2166         CheckDummyVideo
  2167         CheckIPod
  2168         # Set up files for the timer library
  2169         if test x$enable_timers = xyes; then
  2170             AC_DEFINE(SDL_TIMER_UNIX)
  2171             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2172             have_timers=yes
  2173         fi
  2174         ;;
  2175     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
  2176         case "$host" in
  2177             *-*-linux*)         ARCH=linux ;;
  2178             *-*-uclinux*)       ARCH=linux ;;
  2179             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2180             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2181             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2182             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2183             *-*-bsdi*)          ARCH=bsdi ;;
  2184             *-*-freebsd*)       ARCH=freebsd ;;
  2185             *-*-dragonfly*)     ARCH=freebsd ;;
  2186             *-*-netbsd*)        ARCH=netbsd ;;
  2187             *-*-openbsd*)       ARCH=openbsd ;;
  2188             *-*-sysv5*)         ARCH=sysv5 ;;
  2189             *-*-solaris*)       ARCH=solaris ;;
  2190             *-*-hpux*)          ARCH=hpux ;;
  2191             *-*-irix*)          ARCH=irix ;;
  2192             *-*-aix*)           ARCH=aix ;;
  2193             *-*-osf*)           ARCH=osf ;;
  2194             *-*-minix*)         ARCH=minix ;;
  2195         esac
  2196         CheckVisibilityHidden
  2197         CheckDummyVideo
  2198         CheckDiskAudio
  2199         CheckDummyAudio
  2200         CheckDLOPEN
  2201         CheckOSS
  2202         CheckDMEDIA
  2203         CheckMME
  2204         CheckALSA
  2205         CheckPulseAudio
  2206         CheckARTSC
  2207         CheckESD
  2208         CheckNAS
  2209         CheckX11
  2210         CheckFBCON
  2211         CheckDirectFB
  2212         CheckFusionSound
  2213         CheckPS2GS
  2214         CheckPS3
  2215         CheckSVGA
  2216         CheckOpenGLX11
  2217         CheckInputEvents
  2218         CheckTslib
  2219         CheckUSBHID
  2220         CheckPTHREAD
  2221         CheckClockGettime
  2222         CheckLinuxVersion
  2223         CheckRPATH
  2224         # Set up files for the audio library
  2225         if test x$enable_audio = xyes; then
  2226           case $ARCH in
  2227             sysv5|solaris|hpux)
  2228                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2229                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2230                 have_audio=yes
  2231             ;;
  2232             netbsd|openbsd)
  2233                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2234                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2235                 have_audio=yes
  2236             ;;
  2237             aix)
  2238                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
  2239                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2240                 have_audio=yes
  2241             ;;
  2242           esac
  2243         fi
  2244         # Set up files for the atomic operations library
  2245         if test x$enable_atomic = xyes; then
  2246           case $ARCH in
  2247             linux)
  2248                 AC_DEFINE(SDL_ATOMIC_LINUX)
  2249                 SOURCES="$SOURCES $srcdir/src/atomic/linux/*.c"
  2250                 have_atomic=yes
  2251             ;;
  2252           esac
  2253         fi
  2254         # Set up files for the joystick library
  2255         if test x$enable_joystick = xyes; then
  2256           case $ARCH in
  2257             linux)
  2258                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2259                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2260                 have_joystick=yes
  2261             ;;
  2262           esac
  2263         fi
  2264         # Set up files for the haptic library
  2265         if test x$enable_haptic = xyes; then
  2266            if test x$use_input_events = xyes; then
  2267              case $ARCH in
  2268                linux)
  2269                    AC_DEFINE(SDL_HAPTIC_LINUX)
  2270                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2271                    have_haptic=yes
  2272                ;;
  2273              esac
  2274            fi
  2275         fi
  2276         # Set up files for the power library
  2277         if test x$enable_power = xyes; then
  2278              case $ARCH in
  2279                linux)
  2280                    AC_DEFINE(SDL_POWER_LINUX)
  2281                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2282                    have_power=yes
  2283                ;;
  2284              esac
  2285         fi
  2286         # Set up files for the thread library
  2287         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2288             AC_DEFINE(SDL_THREAD_SPROC)
  2289             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2290             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2291             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2292             have_threads=yes
  2293         fi
  2294         # Set up files for the timer library
  2295         if test x$enable_timers = xyes; then
  2296             AC_DEFINE(SDL_TIMER_UNIX)
  2297             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2298             have_timers=yes
  2299         fi
  2300         ;;
  2301     *-*-qnx*)
  2302 
  2303         EXTRA_CFLAGS="-I/usr/include $CFLAGS"
  2304         EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
  2305 
  2306         ARCH=qnx
  2307         CheckVisibilityHidden
  2308         CheckDummyVideo
  2309         CheckDiskAudio
  2310         CheckDummyAudio
  2311         CheckDLOPEN
  2312         CheckPulseAudio
  2313         CheckESD
  2314         CheckNAS
  2315         CheckPHOTON
  2316         CheckQNXGF
  2317         CheckX11
  2318         CheckOpenGLX11
  2319         CheckPTHREAD
  2320         CheckClockGettime
  2321 
  2322 
  2323         # Set up files for the audio library
  2324         if test x$enable_audio = xyes; then
  2325             AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
  2326             SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
  2327             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2328             have_audio=yes
  2329         fi
  2330         # Set up files for the timer library
  2331         if test x$enable_timers = xyes; then
  2332             AC_DEFINE(SDL_TIMER_UNIX)
  2333             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2334             have_timers=yes
  2335         fi
  2336         # Setup files for the atomic operations
  2337         if test x$enable_atomic = xyes; then
  2338                 AC_DEFINE(SDL_ATOMIC_QNX)
  2339                 SOURCES="$SOURCES $srcdir/src/atomic/qnx/*.c"
  2340                 have_atomic=yes
  2341         fi
  2342         # Set up dummy files for the joystick for now
  2343         if test x$enable_joystick = xyes; then
  2344             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2345             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2346             have_joystick=yes
  2347         fi
  2348         # Set up dummy files for the haptic for now
  2349         if test x$enable_haptic = xyes; then
  2350             AC_DEFINE(SDL_HAPTIC_DUMMY)
  2351             SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2352             have_haptic=yes
  2353         fi
  2354         ;;
  2355     *-wince* | *-mingw32ce)
  2356         ARCH=win32
  2357         CheckDummyVideo
  2358         CheckDiskAudio
  2359         CheckDummyAudio
  2360         CheckWIN32
  2361         #SOURCES="$SOURCES $srcdir/src/video/gapi/*.c"
  2362         #AC_DEFINE(SDL_VIDEO_DRIVER_GAPI)
  2363         if test x$enable_video = xyes; then
  2364             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2365             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2366             have_video=yes
  2367             AC_ARG_ENABLE(render-gdi,
  2368 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2369                                 , enable_render_gdi=yes)
  2370             if test x$enable_render_gdi = xyes; then
  2371                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2372             fi
  2373             AC_ARG_ENABLE(render-gapi,
  2374 AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
  2375                                 , enable_render_gapi=yes)
  2376             if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
  2377                 AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
  2378             fi
  2379             AC_ARG_ENABLE(render-ddraw,
  2380 AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
  2381                                 , enable_render_ddraw=yes)
  2382             if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
  2383                 AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
  2384             fi
  2385             AC_ARG_ENABLE(render-d3d,
  2386 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2387                                 , enable_render_d3d=yes)
  2388             enable_render_d3d=no
  2389             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2390                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2391             fi
  2392         fi
  2393         # Set up files for the audio library
  2394         if test x$enable_audio = xyes; then
  2395             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2396             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2397             if test x$have_dsound = xyes; then
  2398                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2399                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2400             fi
  2401             have_audio=yes
  2402         fi
  2403         # Set up files for the thread library
  2404         if test x$enable_threads = xyes; then
  2405             AC_DEFINE(SDL_THREAD_WIN32)
  2406             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2407             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2408             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2409             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2410             have_threads=yes
  2411         fi
  2412         # Set up files for the timer library
  2413         if test x$enable_timers = xyes; then
  2414             AC_DEFINE(SDL_TIMER_WINCE)
  2415             SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
  2416             have_timers=yes
  2417         fi
  2418         # Set up files for the shared object loading library
  2419         if test x$enable_loadso = xyes; then
  2420             AC_DEFINE(SDL_LOADSO_WIN32)
  2421             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2422             have_loadso=yes
  2423         fi
  2424         # Set up files for the system power library
  2425         if test x$enable_power = xyes; then
  2426             AC_DEFINE(SDL_POWER_WINDOWS)
  2427             SOURCES="$SOURCES $srcdir/src/power/windows/*.c"
  2428             have_power=yes
  2429         fi
  2430         # Set up the system libraries we need
  2431         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
  2432         # The Win32 platform requires special setup
  2433         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2434         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
  2435         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2436         ;;
  2437     *-*-cygwin* | *-*-mingw32*)
  2438         ARCH=win32
  2439         if test "$build" != "$host"; then # cross-compiling
  2440             # Default cross-compile location
  2441             ac_default_prefix=/usr/local/cross-tools/i386-mingw32
  2442         else
  2443             # Look for the location of the tools and install there
  2444             if test "$BUILD_PREFIX" != ""; then
  2445                 ac_default_prefix=$BUILD_PREFIX
  2446             fi
  2447         fi
  2448         CheckDummyVideo
  2449         CheckDiskAudio
  2450         CheckDummyAudio
  2451         CheckWIN32
  2452         CheckWIN32GL
  2453         CheckDIRECTX
  2454         # Set up files for the video library
  2455         if test x$enable_video = xyes; then
  2456             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2457             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2458             have_video=yes
  2459             AC_ARG_ENABLE(render-gdi,
  2460 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2461                                 , enable_render_gdi=yes)
  2462             if test x$enable_render_gdi = xyes; then
  2463                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2464             fi
  2465             AC_ARG_ENABLE(render-d3d,
  2466 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2467                                 , enable_render_d3d=yes)
  2468             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2469                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2470             fi
  2471         fi
  2472         # Set up files for the audio library
  2473         if test x$enable_audio = xyes; then
  2474             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2475             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2476             if test x$have_dsound = xyes; then
  2477                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2478                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2479             fi
  2480             have_audio=yes
  2481         fi
  2482         # Set up files for the atomic operations library
  2483         if test x$enable_atomic = xyes; then
  2484             AC_DEFINE(SDL_ATOMIC_WIN32)
  2485             SOURCES="$SOURCES $srcdir/src/atomic/win32/*.c"
  2486             have_atomic=yes
  2487         fi
  2488         # Set up files for the joystick library
  2489         if test x$enable_joystick = xyes; then
  2490             if test x$have_dinput = xyes; then
  2491                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2492                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
  2493                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8 -lole32"
  2494             else
  2495                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2496                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
  2497             fi
  2498             have_joystick=yes
  2499         fi
  2500         if test x$enable_haptic = xyes; then
  2501             if test x$have_dinput = xyes; then
  2502                 AC_DEFINE(SDL_HAPTIC_DINPUT)
  2503                 SOURCES="$SOURCES $srcdir/src/haptic/win32/SDL_syshaptic.c"
  2504                 have_haptic=yes
  2505             fi
  2506         fi
  2507         if test x$enable_power = xyes; then
  2508             AC_DEFINE(SDL_POWER_WINDOWS)
  2509             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2510             have_power=yes
  2511         fi
  2512         # Set up files for the thread library
  2513         if test x$enable_threads = xyes; then
  2514             AC_DEFINE(SDL_THREAD_WIN32)
  2515             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2516             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2517             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2518             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2519             have_threads=yes
  2520         fi
  2521         # Set up files for the timer library
  2522         if test x$enable_timers = xyes; then
  2523             AC_DEFINE(SDL_TIMER_WIN32)
  2524             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2525             have_timers=yes
  2526         fi
  2527         # Set up files for the shared object loading library
  2528         if test x$enable_loadso = xyes; then
  2529             AC_DEFINE(SDL_LOADSO_WIN32)
  2530             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2531             have_loadso=yes
  2532         fi
  2533         # Set up the system libraries we need
  2534         # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
  2535         # You can get this here: http://libunicows.sourceforge.net/
  2536         #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
  2537         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm"
  2538         # The Win32 platform requires special setup
  2539         VERSION_SOURCES="$srcdir/src/main/win32/*.rc"
  2540         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2541         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2542         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2543         ;;
  2544     *-*-beos* | *-*-haiku*)
  2545         ARCH=beos
  2546         ac_default_prefix=/boot/develop/tools/gnupro
  2547         CheckDummyVideo
  2548         CheckDiskAudio
  2549         CheckDummyAudio
  2550         CheckBWINDOW
  2551         CheckBeGL
  2552         # Set up files for the audio library
  2553         if test x$enable_audio = xyes; then
  2554             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
  2555             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2556             have_audio=yes
  2557         fi
  2558         # Set up files for the joystick library
  2559         if test x$enable_joystick = xyes; then
  2560             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2561             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2562             have_joystick=yes
  2563         fi
  2564         # Set up files for the thread library
  2565         if test x$enable_threads = xyes; then
  2566             AC_DEFINE(SDL_THREAD_BEOS)
  2567             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2568             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2569             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2570             have_threads=yes
  2571         fi
  2572         # Set up files for the timer library
  2573         if test x$enable_timers = xyes; then
  2574             AC_DEFINE(SDL_TIMER_BEOS)
  2575             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2576             have_timers=yes
  2577         fi
  2578         # Set up files for the shared object loading library
  2579         if test x$enable_loadso = xyes; then
  2580             AC_DEFINE(SDL_LOADSO_BEOS)
  2581             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2582             have_loadso=yes
  2583         fi
  2584         # Set up files for the system power library
  2585         if test x$enable_power = xyes; then
  2586             AC_DEFINE(SDL_POWER_BEOS)
  2587             SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
  2588             have_power=yes
  2589         fi
  2590         # The BeOS platform requires special setup.
  2591         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2592         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2593         ;;
  2594     *-*-darwin* )
  2595         # This could be either full "Mac OS X", or plain "Darwin" which is
  2596         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2597         # Next line is broken, and a few files below require Mac OS X (full)
  2598         ARCH=macosx
  2599 
  2600         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2601         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2602         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2603 
  2604         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2605         # is -lm which is not needed under Mac OS X. But for some reasons it
  2606         # also tends to contain spurious -L switches, which we don't want to
  2607         # use here or in sdl-config. Hence we reset it.
  2608         EXTRA_LDFLAGS=""
  2609 
  2610         CheckVisibilityHidden
  2611         CheckDummyVideo
  2612         CheckDiskAudio
  2613         CheckDummyAudio
  2614         CheckDLOPEN
  2615 
  2616         # Set up files for the shared object loading library
  2617         # (this needs to be done before the dynamic X11 check)
  2618         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2619             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2620             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2621             have_loadso=yes
  2622         fi
  2623 
  2624         CheckCOCOA
  2625         CheckX11
  2626         CheckMacGL
  2627         CheckOpenGLX11
  2628         CheckPTHREAD
  2629 
  2630         # Good optimization on Mac OS X, yes...
  2631         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2632 
  2633         # Need this or things might misbuild on a G3.
  2634         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2635 
  2636         # Set up files for the audio library
  2637         if test x$enable_audio = xyes; then
  2638             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2639             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2640             have_audio=yes
  2641         fi
  2642         # Set up files for the atomic operations library
  2643         if test x$enable_atomic = xyes; then
  2644             AC_DEFINE(SDL_ATOMIC_MACOSX)
  2645             SOURCES="$SOURCES $srcdir/src/atomic/macosx/*.c"
  2646             have_atomic=yes
  2647         fi
  2648         # Set up files for the joystick library
  2649         if test x$enable_joystick = xyes; then
  2650             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2651             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2652             have_joystick=yes
  2653         fi
  2654         # Set up files for the haptic library
  2655         if test x$enable_haptic = xyes; then
  2656             AC_DEFINE(SDL_HAPTIC_IOKIT)
  2657             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2658             have_haptic=yes
  2659             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2660         fi
  2661         # Set up files for the power library
  2662         if test x$enable_power = xyes; then
  2663             AC_DEFINE(SDL_POWER_MACOSX)
  2664             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2665             have_power=yes
  2666         fi
  2667         # Set up files for the timer library
  2668         if test x$enable_timers = xyes; then
  2669             AC_DEFINE(SDL_TIMER_UNIX)
  2670             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2671             have_timers=yes
  2672         fi
  2673         # The Mac OS X platform requires special setup.
  2674         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2675         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2676         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2677         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2678         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2679         # If either the audio or CD driver is used, add the AudioUnit framework
  2680         if test x$enable_audio = xyes; then
  2681             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2682         fi
  2683         ;;
  2684     *-riscos)
  2685         ARCH=riscos
  2686         CheckOSS
  2687         CheckPTHREAD
  2688         # Set up files for the video library
  2689         if test x$enable_video = xyes; then
  2690             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2691             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2692             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2693             have_video=yes
  2694         fi
  2695         # Set up files for the joystick library
  2696         if test x$enable_joystick = xyes; then
  2697             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2698             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2699             have_joystick=yes
  2700         fi
  2701         # Set up files for the timer library
  2702         if test x$enable_timers = xyes; then
  2703             AC_DEFINE(SDL_TIMER_RISCOS)
  2704             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2705             have_timers=yes
  2706         fi
  2707         # The RISC OS platform requires special setup.
  2708         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2709         ;;
  2710     *)
  2711         AC_MSG_ERROR([
  2712 *** Unsupported host:  Please add to configure.in
  2713         ])
  2714         ;;
  2715 esac
  2716 
  2717 # Verify that we have all the platform specific files we need
  2718 
  2719 if test x$have_joystick != xyes; then
  2720     if test x$enable_joystick = xyes; then
  2721         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2722     fi
  2723     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2724 fi
  2725 if test x$have_haptic != xyes; then
  2726     if test x$enable_haptic = xyes; then
  2727         AC_DEFINE(SDL_HAPTIC_DISABLED)
  2728     fi
  2729     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2730 fi
  2731 if test x$have_threads != xyes; then
  2732     if test x$enable_threads = xyes; then
  2733         AC_DEFINE(SDL_THREADS_DISABLED)
  2734     fi
  2735     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2736 fi
  2737 if test x$have_timers != xyes; then
  2738     if test x$enable_timers = xyes; then
  2739         AC_DEFINE(SDL_TIMERS_DISABLED)
  2740     fi
  2741     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2742 fi
  2743 if test x$have_loadso != xyes; then
  2744     if test x$enable_loadso = xyes; then
  2745         AC_DEFINE(SDL_LOADSO_DISABLED)
  2746     fi
  2747     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2748 fi
  2749 if test x$SDLMAIN_SOURCES = x; then
  2750     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2751 fi
  2752 
  2753 OBJECTS=`echo $SOURCES`
  2754 DEPENDS=`echo $SOURCES`
  2755 for EXT in asm cc m c S; do
  2756     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2757     DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.'$EXT',\\
  2758 $(objects)/\2.lo: \1/\2.'$EXT'\\
  2759 	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c $< -o $@,g'`
  2760 done
  2761 
  2762 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2763 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2764 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2765 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
  2766 $(objects)/\2.o: \1/\2.rc\\
  2767 	\$(WINDRES) \$< \$@,g'`
  2768 
  2769 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2770 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2771 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2772 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
  2773 $(objects)/\2.o: \1/\2.c\\
  2774 	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c $< -o $@,g'`
  2775 
  2776 # Set runtime shared library paths as needed
  2777 
  2778 if test "x$enable_rpath" = "xyes"; then
  2779   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2780     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2781   fi
  2782   if test $ARCH = solaris; then
  2783     SDL_RLD_FLAGS="-R\${libdir}"
  2784   fi
  2785 else
  2786   SDL_RLD_FLAGS=""
  2787 fi
  2788 
  2789 case "$ARCH" in
  2790   macosx)
  2791     # Evil hack to allow static linking on Mac OS X
  2792     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2793     ;;
  2794   *)
  2795     SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2796     ;;
  2797 esac
  2798 
  2799 dnl Expand the cflags and libraries needed by apps using SDL
  2800 AC_SUBST(SDL_CFLAGS)
  2801 AC_SUBST(SDL_LIBS)
  2802 AC_SUBST(SDL_STATIC_LIBS)
  2803 AC_SUBST(SDL_RLD_FLAGS)
  2804 if test x$enable_shared = xyes; then
  2805     ENABLE_SHARED_TRUE=
  2806     ENABLE_SHARED_FALSE="#"
  2807 else
  2808     ENABLE_SHARED_TRUE="#"
  2809     ENABLE_SHARED_FALSE=
  2810 fi
  2811 if test x$enable_static = xyes; then
  2812     ENABLE_STATIC_TRUE=
  2813     ENABLE_STATIC_FALSE="#"
  2814 else
  2815     ENABLE_STATIC_TRUE="#"
  2816     ENABLE_STATIC_FALSE=
  2817 fi
  2818 AC_SUBST(ENABLE_SHARED_TRUE)
  2819 AC_SUBST(ENABLE_SHARED_FALSE)
  2820 AC_SUBST(ENABLE_STATIC_TRUE)
  2821 AC_SUBST(ENABLE_STATIC_FALSE)
  2822 
  2823 dnl Expand the sources and objects needed to build the library
  2824 AC_SUBST(ac_aux_dir)
  2825 AC_SUBST(INCLUDE)
  2826 AC_SUBST(OBJECTS)
  2827 AC_SUBST(DEPENDS)
  2828 AC_SUBST(VERSION_OBJECTS)
  2829 AC_SUBST(VERSION_DEPENDS)
  2830 AC_SUBST(SDLMAIN_OBJECTS)
  2831 AC_SUBST(SDLMAIN_DEPENDS)
  2832 AC_SUBST(BUILD_CFLAGS)
  2833 AC_SUBST(EXTRA_CFLAGS)
  2834 AC_SUBST(BUILD_LDFLAGS)
  2835 AC_SUBST(EXTRA_LDFLAGS)
  2836 AC_SUBST(WINDRES)
  2837 
  2838 AC_OUTPUT([
  2839     Makefile sdl-config SDL.spec sdl.pc
  2840 ])