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