configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 21 Jun 2006 07:57:59 +0000
branchSDL-1.3
changeset 1697 393092a3ebf6
parent 1692 75f2ace8511a
child 1700 21184e1d04c3
permissions -rw-r--r--
Fixed bug #157
[patch tweaked to handle older nasm, which doesn't support :function syntax]

------- Comment #5 From Mike Frysinger 2006-05-22 01:24 [reply] -------
Created an attachment (id=132) [edit]
libsdl-hidden-nasm.patch

here's the patch i posted here:
http://www.libsdl.org/pipermail/sdl/2006-March/073618.html

this will hide the symbols dynamically if the build nasm/yasm supports the
hidden stuff ... in other words, this patch should be safe with both older and
new versions of nasm/yasm
     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             AC_ARG_ENABLE(x11-shared,
   817 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=yes]]]),
   818                           , enable_x11_shared=yes)
   819 
   820             case "$host" in
   821                 *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
   822                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
   823                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
   824                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
   825                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
   826                     ;;
   827                 *-*-osf*)
   828                     x11_lib='libX11.so'
   829                     x11ext_lib='libXext.so'
   830                     ;;
   831                 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
   832                     x11_lib='libX11.so'
   833                     x11ext_lib='libXext.so'
   834                     ;;
   835                 *)
   836                     x11_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`]
   837                     for path in $x11_lib_path /usr/lib /usr/X11/lib /usr/X11R6/lib; do
   838                         if test "x$x11_lib" = "x"; then
   839                             x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   840 							if test "x$x11_lib" = "x"; then
   841 								x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   842 							fi
   843                         fi
   844                         if test "x$x11ext_lib" = "x"; then
   845                             x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   846 							if test "x$x11ext_lib" = "x"; then
   847 								x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   848 							fi
   849                         fi
   850                         if test "x$xrender_lib" = "x"; then
   851                             xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   852 							if test "x$xrender_lib" = "x"; then
   853 								xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   854 							fi
   855                         fi
   856                         if test "x$xrandr_lib" = "x"; then
   857                             xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   858 							if test "x$xrandr_lib" = "x"; then
   859 								xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   860 							fi
   861                         fi
   862                     done
   863                     ;;
   864             esac
   865 
   866             X_CFLAGS="$X_CFLAGS -DXTHREADS"
   867             if test x$ac_cv_func_shmat != xyes; then
   868                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
   869             fi
   870             CFLAGS="$CFLAGS $X_CFLAGS"
   871             LDFLAGS="$LDFLAGS $X_LIBS"
   872 
   873             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
   874             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
   875             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
   876             if test x$have_loadso != xyes && \
   877                test x$enable_x11_shared = xyes; then
   878                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
   879             fi
   880             if test x$have_loadso = xyes && \
   881                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
   882                 echo "-- dynamic libX11 -> $x11_lib"
   883                 echo "-- dynamic libX11ext -> $x11ext_lib"
   884                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
   885                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
   886             else
   887                 enable_x11_shared=no
   888                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
   889             fi
   890             have_video=yes
   891 
   892             AC_ARG_ENABLE(dga,
   893 AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [[default=yes]]]),
   894                           , enable_dga=yes)
   895             if test x$enable_dga = xyes; then
   896                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c"
   897             fi
   898             AC_ARG_ENABLE(video-dga,
   899 AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [[default=yes]]]),
   900                   , enable_video_dga=yes)
   901             if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then
   902                 AC_DEFINE(SDL_VIDEO_DRIVER_DGA)
   903                 SOURCES="$SOURCES $srcdir/src/video/dga/*.c"
   904             fi
   905             AC_ARG_ENABLE(video-x11-dgamouse,
   906 AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [[default=yes]]]),
   907                           , enable_video_x11_dgamouse=yes)
   908             if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then
   909                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE)
   910             fi
   911             AC_ARG_ENABLE(video-x11-vm,
   912 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
   913                           , enable_video_x11_vm=yes)
   914             if test x$enable_video_x11_vm = xyes; then
   915                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
   916                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
   917             fi
   918             AC_ARG_ENABLE(video-x11-xv,
   919 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
   920                           , enable_video_x11_xv=yes)
   921             if test x$enable_video_x11_xv = xyes; then
   922                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
   923                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
   924             fi
   925             AC_ARG_ENABLE(video-x11-xinerama,
   926 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
   927                             , enable_video_x11_xinerama=yes)
   928             if test x$enable_video_x11_xinerama = xyes; then
   929                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
   930                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
   931             fi
   932             AC_ARG_ENABLE(video-x11-xme,
   933 AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [[default=yes]]]),
   934                             , enable_video_x11_xme=yes)
   935             if test x$enable_video_x11_xme = xyes; then
   936                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
   937                 SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
   938             fi
   939             AC_ARG_ENABLE(video-x11-xrandr,
   940 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
   941                             , enable_video_x11_xrandr=yes)
   942             if test x$enable_video_x11_xrandr = xyes; then
   943                 definitely_enable_video_x11_xrandr=no
   944                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
   945                                 have_xrandr_h_hdr=yes,
   946                                 have_xrandr_h_hdr=no,
   947                                 [#include <X11/Xlib.h>
   948                                 ])
   949                 if test x$have_xrandr_h_hdr = xyes; then
   950                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
   951                         echo "-- dynamic libXrender -> $xrender_lib"
   952                         echo "-- dynamic libXrandr -> $xrandr_lib"
   953                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
   954                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
   955                         definitely_enable_video_x11_xrandr=yes
   956                     else
   957                         AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
   958                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
   959                         if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then
   960                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender"
   961                             definitely_enable_video_x11_xrandr=yes
   962                         fi
   963                     fi
   964                 fi
   965             fi
   966             if test x$definitely_enable_video_x11_xrandr = xyes; then
   967                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
   968             fi
   969             AC_ARG_ENABLE(video-x11-dpms,
   970 AC_HELP_STRING([--enable-video-x11-dpms], [enable X11 DPMS extension [[default=yes]]]),
   971                             , enable_video_x11_dpms=yes)
   972             if test x$enable_video_x11_dpms = xyes; then
   973                 AC_CHECK_HEADER(X11/extensions/dpms.h,
   974                                 have_dpms_h_hdr=yes,
   975                                 have_dpms_h_hdr=no,
   976                                 [#include <X11/Xlib.h>
   977                                 ])
   978                 if test x$have_dpms_h_hdr = xyes; then
   979                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_DPMS)
   980                 fi
   981             fi
   982         fi
   983     fi
   984 }
   985 
   986 dnl Check for QNX photon video driver
   987 CheckPHOTON()
   988 {
   989     AC_ARG_ENABLE(video-photon,
   990 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
   991                   , enable_video_photon=yes)
   992     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
   993         AC_MSG_CHECKING(for QNX Photon support)
   994         video_photon=no
   995         AC_TRY_COMPILE([
   996           #include <Ph.h>
   997           #include <Pt.h>
   998           #include <photon/Pg.h>
   999           #include <photon/PdDirect.h>
  1000         ],[
  1001          PgDisplaySettings_t *visual;
  1002         ],[
  1003         video_photon=yes
  1004         ])
  1005         AC_MSG_RESULT($video_photon)
  1006         if test x$video_photon = xyes; then
  1007             AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
  1008             SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
  1009             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph"
  1010             have_video=yes
  1011 
  1012             CheckOpenGLQNX
  1013         fi
  1014     fi
  1015 }
  1016 
  1017 dnl Set up the BWindow video driver if enabled
  1018 CheckBWINDOW()
  1019 {
  1020     if test x$enable_video = xyes; then
  1021         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
  1022         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
  1023         have_video=yes
  1024     fi
  1025 }
  1026 
  1027 dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
  1028 CheckCARBON()
  1029 {
  1030     AC_ARG_ENABLE(video-carbon,
  1031 AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [[default=no]]]),
  1032                   , enable_video_carbon=no)
  1033     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  1034         AC_MSG_CHECKING(for Carbon framework)
  1035         have_carbon=no
  1036         AC_TRY_COMPILE([
  1037           #include <Carbon/Carbon.h>
  1038         ],[
  1039         ],[
  1040         have_carbon=yes
  1041         ])
  1042         AC_MSG_RESULT($have_carbon)
  1043         if test x$have_carbon = xyes; then
  1044             AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX)
  1045             SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c"
  1046             SOURCES="$SOURCES $srcdir/src/video/macrom/*.c"
  1047             have_video=yes
  1048         fi
  1049     fi
  1050 }
  1051 
  1052 dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
  1053 CheckCOCOA()
  1054 {
  1055     AC_ARG_ENABLE(video-cocoa,
  1056 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [[default=yes]]]),
  1057                   , enable_video_cocoa=yes)
  1058     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1059         save_CFLAGS="$CFLAGS"
  1060         dnl work around that we don't have Objective-C support in autoconf
  1061         CFLAGS="$CFLAGS -x objective-c"
  1062         AC_MSG_CHECKING(for Cocoa framework)
  1063         have_cocoa=no
  1064         AC_TRY_COMPILE([
  1065           #import <Cocoa/Cocoa.h>
  1066         ],[
  1067         ],[
  1068         have_cocoa=yes
  1069         ])
  1070         AC_MSG_RESULT($have_cocoa)
  1071         CFLAGS="$save_CFLAGS"
  1072         if test x$have_cocoa = xyes; then
  1073             AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ)
  1074             SOURCES="$SOURCES $srcdir/src/video/quartz/*.m"
  1075             have_video=yes
  1076         fi
  1077     fi
  1078 }
  1079 
  1080 dnl Find the framebuffer console includes
  1081 CheckFBCON()
  1082 {
  1083     AC_ARG_ENABLE(video-fbcon,
  1084 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=yes]]]),
  1085                   , enable_video_fbcon=yes)
  1086     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
  1087         AC_MSG_CHECKING(for framebuffer console support)
  1088         video_fbcon=no
  1089         AC_TRY_COMPILE([
  1090          #include <linux/fb.h>
  1091          #include <linux/kd.h>
  1092          #include <linux/keyboard.h>
  1093         ],[
  1094         ],[
  1095         video_fbcon=yes
  1096         ])
  1097         AC_MSG_RESULT($video_fbcon)
  1098         if test x$video_fbcon = xyes; then
  1099             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
  1100             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
  1101             have_video=yes
  1102         fi
  1103     fi
  1104 }
  1105 
  1106 dnl Find DirectFB
  1107 CheckDirectFB()
  1108 {
  1109     AC_ARG_ENABLE(video-directfb,
  1110 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=yes]]]),
  1111                   , enable_video_directfb=yes)
  1112     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1113         video_directfb=no
  1114 
  1115         DIRECTFB_REQUIRED_VERSION=0.9.15
  1116 
  1117         AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
  1118         if test x$DIRECTFBCONFIG = xno; then
  1119             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1120             AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1121             if test x$PKG_CONFIG != xno; then
  1122                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1123                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1124                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1125                     video_directfb=yes
  1126                 fi
  1127             fi
  1128             AC_MSG_RESULT($video_directfb)
  1129         else
  1130             AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1131             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1132             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1133             set -- `directfb-config --version | sed 's/\./ /g'`
  1134             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1135             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1136                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1137                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1138                 video_directfb=yes
  1139             fi
  1140             AC_MSG_RESULT($video_directfb)
  1141         fi
  1142 
  1143         if test x$video_directfb = xyes; then
  1144             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1145             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1146             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1147             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1148             have_video=yes
  1149         fi
  1150     fi
  1151 }
  1152 
  1153 dnl See if we're running on PlayStation 2 hardware
  1154 CheckPS2GS()
  1155 {
  1156     AC_ARG_ENABLE(video-ps2gs,
  1157 AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=yes]]]),
  1158                   , enable_video_ps2gs=yes)
  1159     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
  1160         AC_MSG_CHECKING(for PlayStation 2 GS support)
  1161         video_ps2gs=no
  1162         AC_TRY_COMPILE([
  1163          #include <linux/ps2/dev.h>
  1164          #include <linux/ps2/gs.h>
  1165         ],[
  1166         ],[
  1167         video_ps2gs=yes
  1168         ])
  1169         AC_MSG_RESULT($video_ps2gs)
  1170         if test x$video_ps2gs = xyes; then
  1171             AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
  1172             SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
  1173             have_video=yes
  1174         fi
  1175     fi
  1176 }
  1177 
  1178 dnl Find the GGI includes
  1179 CheckGGI()
  1180 {
  1181     AC_ARG_ENABLE(video-ggi,
  1182 AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [[default=no]]]),
  1183                   , enable_video_ggi=no)
  1184     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
  1185         AC_MSG_CHECKING(for GGI support)
  1186         video_ggi=no
  1187         AC_TRY_COMPILE([
  1188          #include <ggi/ggi.h>
  1189          #include <ggi/gii.h>
  1190         ],[
  1191         ],[
  1192         video_ggi=yes
  1193         ])
  1194         AC_MSG_RESULT($video_ggi)
  1195         if test x$video_ggi = xyes; then
  1196             AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
  1197             SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
  1198             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lggi -lgii -lgg"
  1199             have_video=yes
  1200         fi
  1201     fi
  1202 }
  1203 
  1204 dnl Find the SVGAlib includes and libraries
  1205 CheckSVGA()
  1206 {
  1207     AC_ARG_ENABLE(video-svga,
  1208 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=yes]]]),
  1209                   , enable_video_svga=yes)
  1210     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1211         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1212         video_svga=no
  1213         AC_TRY_COMPILE([
  1214          #include <vga.h>
  1215          #include <vgamouse.h>
  1216          #include <vgakeyboard.h>
  1217         ],[
  1218          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1219              exit(0);
  1220          }
  1221         ],[
  1222         video_svga=yes
  1223         ])
  1224         AC_MSG_RESULT($video_svga)
  1225         if test x$video_svga = xyes; then
  1226             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1227             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1228             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
  1229             have_video=yes
  1230         fi
  1231     fi
  1232 }
  1233 
  1234 dnl Find the VGL includes and libraries
  1235 CheckVGL()
  1236 {
  1237     AC_ARG_ENABLE(video-vgl,
  1238 AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [[default=yes]]]),
  1239                   , enable_video_vgl=yes)
  1240     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
  1241         AC_MSG_CHECKING(for libVGL support)
  1242         video_vgl=no
  1243         AC_TRY_COMPILE([
  1244          #include <sys/fbio.h>
  1245          #include <sys/consio.h>
  1246          #include <sys/kbio.h>
  1247          #include <vgl.h>
  1248         ],[
  1249          VGLBitmap bitmap;
  1250          bitmap.Type = VIDBUF32;
  1251          bitmap.PixelBytes = 4;
  1252          exit(bitmap.Bitmap);
  1253         ],[
  1254         video_vgl=yes
  1255         ])
  1256         AC_MSG_RESULT($video_vgl)
  1257         if test x$video_vgl = xyes; then
  1258             AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
  1259             SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
  1260             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl"
  1261             have_video=yes
  1262         fi
  1263     fi
  1264 }
  1265 
  1266 dnl Set up the wscons video driver if enabled
  1267 CheckWscons()
  1268 {
  1269     AC_ARG_ENABLE(video-wscons,
  1270 AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [[default=yes]]]),
  1271                   , enable_video_wscons=yes)
  1272     if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
  1273         AC_MSG_CHECKING(for wscons support)
  1274         video_wscons=no
  1275         AC_TRY_COMPILE([
  1276          #include <sys/time.h>
  1277          #include <dev/wscons/wsconsio.h>
  1278          #include <dev/wscons/wsdisplay_usl_io.h>
  1279         ],[
  1280          int wsmode = WSDISPLAYIO_MODE_DUMBFB;
  1281         ],[
  1282         video_wscons=yes
  1283         ])
  1284         AC_MSG_RESULT($video_wscons)
  1285         if test x$video_wscons = xyes; then
  1286             AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
  1287             SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
  1288             have_video=yes
  1289         fi
  1290     fi
  1291 }
  1292 
  1293 
  1294 dnl Find the AAlib includes
  1295 CheckAAlib()
  1296 {
  1297     AC_ARG_ENABLE(video-aalib,
  1298 AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [[default=no]]]),
  1299                   , enable_video_aalib=no)
  1300     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
  1301         AC_MSG_CHECKING(for AAlib support)
  1302         video_aalib=no
  1303         AC_TRY_COMPILE([
  1304          #include <aalib.h>
  1305         ],[
  1306         ],[
  1307         video_aalib=yes
  1308         ])
  1309         AC_MSG_RESULT($video_aalib)
  1310         if test x$video_aalib = xyes; then
  1311             AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
  1312             SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
  1313             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laa"
  1314             have_video=yes
  1315         fi
  1316     fi
  1317 }
  1318 
  1319 dnl Set up the QTopia video driver if enabled
  1320 CheckQtopia()
  1321 {
  1322     AC_ARG_ENABLE(video-qtopia,
  1323 AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [[default=no]]]),
  1324                   , enable_video_qtopia=no)
  1325     if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
  1326         AC_MSG_CHECKING(for Qtopia support)
  1327         video_qtopia=no
  1328         QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
  1329         AC_LANG_CPLUSPLUS
  1330         OLD_CXX="$CXXFLAGS"
  1331         CXXFLAGS="$QTOPIA_FLAGS"
  1332         AC_TRY_COMPILE([
  1333          #include <qpe/qpeapplication.h>
  1334         ],[
  1335         ],[
  1336         video_qtopia=yes
  1337         ])
  1338         CXXFLAGS="$OLD_CXX"
  1339         AC_MSG_RESULT($video_qtopia)
  1340         if test x$video_qtopia = xyes; then
  1341             AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
  1342             SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
  1343             SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc"
  1344             EXTRA_CFLAGS="$EXTRA_CFLAGS $QTOPIA_FLAGS"
  1345             SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
  1346             SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
  1347             have_video=yes
  1348         fi
  1349         AC_LANG_C
  1350     fi
  1351 }
  1352 
  1353 dnl Set up the PicoGUI video driver if enabled
  1354 CheckPicoGUI()
  1355 {
  1356     AC_ARG_ENABLE(video-picogui,
  1357 AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [[default=no]]]),
  1358                   , enable_video_picogui=no)
  1359     if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
  1360         AC_MSG_CHECKING(for PicoGUI support)
  1361         video_picogui=no
  1362         AC_TRY_COMPILE([
  1363          #include <picogui.h>
  1364         ],[
  1365         ],[
  1366         video_picogui=yes
  1367         ])
  1368         AC_MSG_RESULT($video_picogui)
  1369         if test x$video_picogui = xyes; then
  1370             AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI)
  1371             SOURCES="$SOURCES $srcdir/src/video/picogui/*.c"
  1372             SDL_LIBS="$SDL_LIBS -lpgui"
  1373             have_video=yes
  1374         fi
  1375     fi
  1376 }
  1377 
  1378 dnl Set up the Atari Bios keyboard driver
  1379 CheckAtariBiosEvent()
  1380 {
  1381     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
  1382     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S"
  1383 }
  1384 
  1385 dnl Set up the Atari Xbios driver
  1386 CheckAtariXbiosVideo()
  1387 {
  1388     AC_ARG_ENABLE(xbios,
  1389 AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [[default=yes]]]),
  1390                   , enable_video_xbios=yes)
  1391     video_xbios=no
  1392     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1393         video_xbios=yes
  1394         AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
  1395         SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
  1396         have_video=yes
  1397     fi
  1398 }
  1399 
  1400 dnl Set up the Atari Gem driver
  1401 CheckAtariGemVideo()
  1402 {
  1403     AC_ARG_ENABLE(gem,
  1404 AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [[default=yes]]]),
  1405                   , enable_video_gem=yes)
  1406     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1407         video_gem=no
  1408         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1409         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1410         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1411             video_gem=yes
  1412             AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
  1413             SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
  1414             SDL_LIBS="$SDL_LIBS -lgem"
  1415             have_video=yes
  1416         fi
  1417     fi
  1418 }
  1419 
  1420 dnl rcg04172001 Set up the Null video driver.
  1421 CheckDummyVideo()
  1422 {
  1423     AC_ARG_ENABLE(video-dummy,
  1424 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1425                   , enable_video_dummy=yes)
  1426     if test x$enable_video_dummy = xyes; then
  1427         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1428         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1429         have_video=yes
  1430     fi
  1431 }
  1432 
  1433 dnl Check to see if OpenGL support is desired
  1434 AC_ARG_ENABLE(video-opengl,
  1435 AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [[default=yes]]]),
  1436               , enable_video_opengl=yes)
  1437 
  1438 dnl Find OpenGL
  1439 CheckOpenGLX11()
  1440 {
  1441     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1442         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1443         video_opengl=no
  1444         AC_TRY_COMPILE([
  1445          #include <GL/gl.h>
  1446          #include <GL/glx.h>
  1447         ],[
  1448         ],[
  1449         video_opengl=yes
  1450         ])
  1451         AC_MSG_RESULT($video_opengl)
  1452         if test x$video_opengl = xyes; then
  1453             AC_DEFINE(SDL_VIDEO_OPENGL)
  1454             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1455         fi
  1456     fi
  1457 }
  1458 
  1459 dnl Find QNX RtP OpenGL
  1460 CheckOpenGLQNX()
  1461 {
  1462     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1463         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1464         video_opengl=no
  1465         AC_TRY_COMPILE([
  1466          #include <GL/gl.h>
  1467         ],[
  1468         ],[
  1469         video_opengl=yes
  1470         ])
  1471         AC_MSG_RESULT($video_opengl)
  1472         if test x$video_opengl = xyes; then
  1473             AC_DEFINE(SDL_VIDEO_OPENGL)
  1474             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1475         fi
  1476     fi
  1477 }
  1478 
  1479 dnl Check for Win32 OpenGL
  1480 CheckWIN32GL()
  1481 {
  1482     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1483         AC_DEFINE(SDL_VIDEO_OPENGL)
  1484         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1485     fi
  1486 }
  1487 
  1488 dnl Check for BeOS OpenGL
  1489 CheckBeGL()
  1490 {
  1491     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1492         AC_DEFINE(SDL_VIDEO_OPENGL)
  1493         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1494     fi
  1495 }
  1496 
  1497 dnl Check for MacOS OpenGL
  1498 CheckMacGL()
  1499 {
  1500     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1501         AC_DEFINE(SDL_VIDEO_OPENGL)
  1502         case "$host" in
  1503             *-*-darwin*)
  1504                 if test x$enable_video_cocoa = xyes; then
  1505                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1506                 fi
  1507                 if test x$enable_video_carbon = xyes; then
  1508                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AGL"
  1509                 fi
  1510         esac
  1511     fi
  1512 }
  1513 
  1514 dnl Find glSDL
  1515 CheckglSDL()
  1516 {
  1517     AC_ARG_ENABLE(video-glsdl,
  1518 [  --enable-video-glsdl    use glSDL video driver [default=yes]],
  1519                   , enable_video_glsdl=yes)
  1520     AC_MSG_CHECKING(for glSDL support)
  1521     AC_MSG_RESULT($video_opengl)
  1522     if test x$video_opengl = xyes -a x$enable_video_glsdl = xyes; then
  1523         AC_DEFINE(SDL_VIDEO_DRIVER_GLSDL)
  1524         SOURCES="$SOURCES $srcdir/src/video/glsdl/*.c"
  1525     fi
  1526 }
  1527 
  1528 dnl Check for Mesa offscreen rendering
  1529 CheckAtariOSMesa()
  1530 {
  1531     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1532         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1533         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1534 
  1535         # Static linking to -lOSMesa
  1536         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1537         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1538             # -lOSMesa is really the static library
  1539             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1540                 OSMESA_LIBS="-lOSMesa"
  1541             fi
  1542         else
  1543             # -lOSMesa is a loader for OSMesa.ldg
  1544             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1545             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1546         fi
  1547         AC_DEFINE(SDL_VIDEO_OPENGL)
  1548         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1549         SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
  1550         SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
  1551 
  1552         AC_ARG_ENABLE(osmesa-shared,
  1553 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]),
  1554                               , enable_osmesa_shared=yes)
  1555         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1556             # Dynamic linking
  1557             if test "x$have_osmesa_hdr" = "xyes"; then
  1558                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1559             fi
  1560         fi
  1561     fi
  1562 }
  1563 
  1564 dnl See if we can use the new unified event interface in Linux 2.4
  1565 CheckInputEvents()
  1566 {
  1567     dnl Check for Linux 2.4 unified input event interface support
  1568     AC_ARG_ENABLE(input-events,
  1569 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1570                   , enable_input_events=yes)
  1571     if test x$enable_input_events = xyes; then
  1572         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1573         use_input_events=no
  1574         AC_TRY_COMPILE([
  1575           #include <linux/input.h>
  1576         ],[
  1577           #ifndef EVIOCGNAME
  1578           #error EVIOCGNAME() ioctl not available
  1579           #endif
  1580         ],[
  1581         use_input_events=yes
  1582         ])
  1583         AC_MSG_RESULT($use_input_events)
  1584         if test x$use_input_events = xyes; then
  1585             AC_DEFINE(SDL_INPUT_LINUXEV)
  1586         fi
  1587     fi
  1588 }
  1589 
  1590 dnl See if we can use the Touchscreen input library
  1591 CheckTslib()
  1592 {
  1593     AC_ARG_ENABLE(input-tslib,
  1594 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1595                   , enable_input_tslib=yes)
  1596     if test x$enable_input_tslib = xyes; then
  1597         AC_MSG_CHECKING(for Touchscreen library support)
  1598         enable_input_tslib=no
  1599         AC_TRY_COMPILE([
  1600           #include "tslib.h"
  1601         ],[
  1602         ],[
  1603         enable_input_tslib=yes
  1604         ])
  1605         AC_MSG_RESULT($enable_input_tslib)
  1606         if test x$enable_input_tslib = xyes; then
  1607             AC_DEFINE(SDL_INPUT_TSLIB)
  1608             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1609         fi
  1610     fi
  1611 }
  1612 
  1613 dnl See if we can use GNU pth library for threads
  1614 CheckPTH()
  1615 {
  1616     dnl Check for pth support
  1617     AC_ARG_ENABLE(pth,
  1618 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
  1619                   , enable_pth=yes)
  1620     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1621         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1622         if test "$PTH_CONFIG" = "no"; then
  1623             use_pth=no
  1624         else
  1625             use_pth=yes
  1626         fi
  1627         AC_MSG_CHECKING(pth)
  1628         AC_MSG_RESULT($use_pth)
  1629         if test "x$use_pth" = xyes; then
  1630             AC_DEFINE(SDL_THREAD_PTH)
  1631             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1632             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1633             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1634             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1635             have_threads=yes
  1636         fi
  1637     fi
  1638 }
  1639 
  1640 dnl See what type of thread model to use on Linux and Solaris
  1641 CheckPTHREAD()
  1642 {
  1643     dnl Check for pthread support
  1644     AC_ARG_ENABLE(pthreads,
  1645 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1646                   , enable_pthreads=yes)
  1647     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1648     AC_ARG_ENABLE(pthread-sem,
  1649 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1650                   , enable_pthread_sem=yes)
  1651     case "$host" in
  1652         *-*-linux*|*-*-uclinux*)
  1653             pthread_cflags="-D_REENTRANT"
  1654             pthread_lib="-lpthread"
  1655             ;;
  1656         *-*-bsdi*)
  1657             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1658             pthread_lib=""
  1659             ;;
  1660         *-*-darwin*)
  1661             pthread_cflags="-D_THREAD_SAFE"
  1662 # causes Carbon.p complaints?
  1663 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1664             ;;
  1665         *-*-freebsd*|*-*-dragonfly*)
  1666             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1667             pthread_lib="-pthread"
  1668             ;;
  1669         *-*-netbsd*)
  1670             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1671             pthread_lib="-L/usr/lib -lpthread"
  1672             ;;
  1673         *-*-openbsd*)
  1674             pthread_cflags="-D_REENTRANT"
  1675             pthread_lib="-pthread"
  1676             ;;
  1677         *-*-solaris*)
  1678             pthread_cflags="-D_REENTRANT"
  1679             pthread_lib="-lpthread -lposix4"
  1680             ;;
  1681         *-*-sysv5*)
  1682             pthread_cflags="-D_REENTRANT -Kthread"
  1683             pthread_lib=""
  1684             ;;
  1685         *-*-irix*)
  1686             pthread_cflags="-D_SGI_MP_SOURCE"
  1687             pthread_lib="-lpthread"
  1688             ;;
  1689         *-*-aix*)
  1690             pthread_cflags="-D_REENTRANT -mthreads"
  1691             pthread_lib="-lpthread"
  1692             ;;
  1693         *-*-hpux11*)
  1694             pthread_cflags="-D_REENTRANT"
  1695             pthread_lib="-L/usr/lib -lpthread"
  1696             ;;
  1697         *-*-qnx*)
  1698             pthread_cflags=""
  1699             pthread_lib=""
  1700             ;;
  1701         *-*-osf*)
  1702             pthread_cflags="-D_REENTRANT"
  1703             if test x$ac_cv_prog_gcc = xyes; then
  1704                 pthread_lib="-lpthread -lrt"
  1705             else
  1706                 pthread_lib="-lpthread -lexc -lrt"
  1707             fi
  1708             ;;
  1709         *)
  1710             pthread_cflags="-D_REENTRANT"
  1711             pthread_lib="-lpthread"
  1712             ;;
  1713     esac
  1714     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1715         # Save the original compiler flags and libraries
  1716         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1717         # Add the pthread compiler flags and libraries
  1718         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1719         # Check to see if we have pthread support on this system
  1720         AC_MSG_CHECKING(for pthreads)
  1721         use_pthreads=no
  1722         AC_TRY_LINK([
  1723          #include <pthread.h>
  1724         ],[
  1725          pthread_attr_t type;
  1726          pthread_attr_init(&type);
  1727         ],[
  1728         use_pthreads=yes
  1729         ])
  1730         AC_MSG_RESULT($use_pthreads)
  1731         # Restore the compiler flags and libraries
  1732         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1733 
  1734         # Do futher testing if we have pthread support...
  1735         if test x$use_pthreads = xyes; then
  1736             AC_DEFINE(SDL_THREAD_PTHREAD)
  1737             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1738             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1739             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1740             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1741 
  1742             # Save the original compiler flags and libraries
  1743             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1744             # Add the pthread compiler flags and libraries
  1745             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1746 
  1747             # Check to see if recursive mutexes are available
  1748             AC_MSG_CHECKING(for recursive mutexes)
  1749             has_recursive_mutexes=no
  1750             if test x$has_recursive_mutexes = xno; then
  1751                 AC_TRY_COMPILE([
  1752                   #include <pthread.h>
  1753                 ],[
  1754                   pthread_mutexattr_t attr;
  1755                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1756                 ],[
  1757                 has_recursive_mutexes=yes
  1758                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1759                 ])
  1760             fi
  1761             if test x$has_recursive_mutexes = xno; then
  1762                 AC_TRY_COMPILE([
  1763                   #include <pthread.h>
  1764                 ],[
  1765                   pthread_mutexattr_t attr;
  1766                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1767                 ],[
  1768                 has_recursive_mutexes=yes
  1769                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1770                 ])
  1771             fi
  1772             AC_MSG_RESULT($has_recursive_mutexes)
  1773 
  1774             # Check to see if pthread semaphore support is missing
  1775             if test x$enable_pthread_sem = xyes; then
  1776                 AC_MSG_CHECKING(for pthread semaphores)
  1777                 have_pthread_sem=no
  1778                 AC_TRY_COMPILE([
  1779                   #include <pthread.h>
  1780                   #include <semaphore.h>
  1781                 ],[
  1782                 ],[
  1783                 have_pthread_sem=yes
  1784                 ])
  1785                 AC_MSG_RESULT($have_pthread_sem)
  1786             fi
  1787 
  1788             # Restore the compiler flags and libraries
  1789             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1790 
  1791             # Basic thread creation functions
  1792             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1793 
  1794             # Semaphores
  1795             # We can fake these with mutexes and condition variables if necessary
  1796             if test x$have_pthread_sem = xyes; then
  1797                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1798             else
  1799                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1800             fi
  1801 
  1802             # Mutexes
  1803             # We can fake these with semaphores if necessary
  1804             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1805 
  1806             # Condition variables
  1807             # We can fake these with semaphores and mutexes if necessary
  1808             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1809 
  1810             have_threads=yes
  1811         else
  1812             CheckPTH
  1813         fi
  1814     fi
  1815 }
  1816 
  1817 dnl Determine whether the compiler can produce Win32 executables
  1818 CheckWIN32()
  1819 {
  1820     AC_MSG_CHECKING(Win32 compiler)
  1821     have_win32_gcc=no
  1822     AC_TRY_COMPILE([
  1823      #include <windows.h>
  1824     ],[
  1825     ],[
  1826     have_win32_gcc=yes
  1827     ])
  1828     AC_MSG_RESULT($have_win32_gcc)
  1829     if test x$have_win32_gcc != xyes; then
  1830        AC_MSG_ERROR([
  1831 *** Your compiler ($CC) does not produce Win32 executables!
  1832        ])
  1833     fi
  1834 
  1835     dnl See if the user wants to redirect standard output to files
  1836     AC_ARG_ENABLE(stdio-redirect,
  1837 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  1838                   , enable_stdio_redirect=yes)
  1839     if test x$enable_stdio_redirect != xyes; then
  1840         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  1841     fi
  1842 
  1843     if test x$enable_video = xyes; then
  1844         AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
  1845         SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
  1846         SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
  1847         have_video=yes
  1848     fi
  1849 }
  1850 
  1851 dnl Find the DirectX includes and libraries
  1852 CheckDIRECTX()
  1853 {
  1854     AC_ARG_ENABLE(directx,
  1855 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  1856                   , enable_directx=yes)
  1857     if test x$enable_directx = xyes; then
  1858         have_directx=no
  1859         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1860         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1861         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1862         if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
  1863             have_directx=yes
  1864         fi
  1865         if test x$enable_video = xyes -a x$have_directx = xyes; then
  1866             AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
  1867             SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
  1868             have_video=yes
  1869         fi
  1870     fi
  1871 }
  1872 
  1873 dnl Check for the dlfcn.h interface for dynamically loading objects
  1874 CheckDLOPEN()
  1875 {
  1876     AC_ARG_ENABLE(sdl-dlopen,
  1877 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1878                   , enable_sdl_dlopen=yes)
  1879     if test x$enable_sdl_dlopen = xyes; then
  1880         AC_MSG_CHECKING(for dlopen)
  1881         have_dlopen=no
  1882         AC_TRY_COMPILE([
  1883          #include <dlfcn.h>
  1884         ],[
  1885          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1886          #error Use dlcompat for Mac OS X 10.2 compatibility
  1887          #endif
  1888         ],[
  1889         have_dlopen=yes
  1890         ])
  1891         AC_MSG_RESULT($have_dlopen)
  1892 
  1893         if test x$have_dlopen = xyes; then
  1894             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1895                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1896                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1897             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1898             if test x$have_dlvsym = xyes; then
  1899                 AC_DEFINE(HAVE_DLVSYM)
  1900             fi
  1901             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1902             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1903             have_loadso=yes
  1904         fi
  1905     fi
  1906 }
  1907 
  1908 dnl Set up the Atari LDG (shared object loader)
  1909 CheckAtariLdg()
  1910 {
  1911     AC_ARG_ENABLE(atari-ldg,
  1912 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]),
  1913                   , enable_atari_ldg=yes)
  1914     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1915         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1916         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1917         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1918             AC_DEFINE(SDL_LOADSO_LDG)
  1919             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1920             SDL_LIBS="$SDL_LIBS -lldg -lgem"
  1921             have_loadso=yes
  1922         fi
  1923     fi
  1924 }
  1925 
  1926 dnl Check for the usbhid(3) library on *BSD
  1927 CheckUSBHID()
  1928 {
  1929     if test x$enable_joystick = xyes; then
  1930         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1931         if test x$have_libusbhid = xyes; then
  1932             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1933             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1934             USB_LIBS="$USB_LIBS -lusbhid"
  1935         else
  1936             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1937             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1938             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1939         fi
  1940             
  1941         save_CFLAGS="$CFLAGS"
  1942         CFLAGS="$CFLAGS $USB_CFLAGS"
  1943 
  1944         AC_MSG_CHECKING(for usbhid)
  1945         have_usbhid=no
  1946         AC_TRY_COMPILE([
  1947           #include <sys/types.h>
  1948           #if defined(HAVE_USB_H)
  1949           #include <usb.h>
  1950           #endif
  1951           #ifdef __DragonFly__
  1952           # include <bus/usb/usb.h>
  1953           # include <bus/usb/usbhid.h>
  1954           #else
  1955           # include <dev/usb/usb.h>
  1956           # include <dev/usb/usbhid.h>
  1957           #endif
  1958           #if defined(HAVE_USBHID_H)
  1959           #include <usbhid.h>
  1960           #elif defined(HAVE_LIBUSB_H)
  1961           #include <libusb.h>
  1962           #elif defined(HAVE_LIBUSBHID_H)
  1963           #include <libusbhid.h>
  1964           #endif
  1965         ],[
  1966           struct report_desc *repdesc;
  1967           struct usb_ctl_report *repbuf;
  1968           hid_kind_t hidkind;
  1969         ],[
  1970         have_usbhid=yes
  1971         ])
  1972         AC_MSG_RESULT($have_usbhid)
  1973 
  1974         if test x$have_usbhid = xyes; then
  1975             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1976             have_usbhid_ucr_data=no
  1977             AC_TRY_COMPILE([
  1978               #include <sys/types.h>
  1979               #if defined(HAVE_USB_H)
  1980               #include <usb.h>
  1981               #endif
  1982               #ifdef __DragonFly__
  1983               # include <bus/usb/usb.h>
  1984               # include <bus/usb/usbhid.h>
  1985               #else
  1986               # include <dev/usb/usb.h>
  1987               # include <dev/usb/usbhid.h>
  1988               #endif
  1989               #if defined(HAVE_USBHID_H)
  1990               #include <usbhid.h>
  1991               #elif defined(HAVE_LIBUSB_H)
  1992               #include <libusb.h>
  1993               #elif defined(HAVE_LIBUSBHID_H)
  1994               #include <libusbhid.h>
  1995               #endif
  1996             ],[
  1997               struct usb_ctl_report buf;
  1998               if (buf.ucr_data) { }
  1999             ],[
  2000             have_usbhid_ucr_data=yes
  2001             ])
  2002             if test x$have_usbhid_ucr_data = xyes; then
  2003                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2004             fi
  2005             AC_MSG_RESULT($have_usbhid_ucr_data)
  2006             
  2007             AC_MSG_CHECKING(for new usbhid API)
  2008             have_usbhid_new=no
  2009             AC_TRY_COMPILE([
  2010               #include <sys/types.h>
  2011               #if defined(HAVE_USB_H)
  2012               #include <usb.h>
  2013               #endif
  2014               #include <dev/usb/usb.h>
  2015               #include <dev/usb/usbhid.h>
  2016               #if defined(HAVE_USBHID_H)
  2017               #include <usbhid.h>
  2018               #elif defined(HAVE_LIBUSB_H)
  2019               #include <libusb.h>
  2020               #elif defined(HAVE_LIBUSBHID_H)
  2021               #include <libusbhid.h>
  2022               #endif
  2023             ],[
  2024               report_desc_t d;
  2025               hid_start_parse(d, 1, 1);
  2026             ],[
  2027             have_usbhid_new=yes
  2028             ])
  2029             if test x$have_usbhid_new = xyes; then
  2030                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2031             fi
  2032             AC_MSG_RESULT($have_usbhid_new)
  2033 
  2034             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2035             have_machine_joystick=no
  2036             AC_TRY_COMPILE([
  2037               #include <machine/joystick.h>
  2038             ],[
  2039               struct joystick t;
  2040             ],[
  2041             have_machine_joystick=yes
  2042             ])
  2043             if test x$have_machine_joystick = xyes; then
  2044                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2045             fi
  2046             AC_MSG_RESULT($have_machine_joystick)
  2047 
  2048             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2049             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2050             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2051             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2052             have_joystick=yes
  2053         fi
  2054         CFLAGS="$save_CFLAGS"
  2055     fi
  2056 }
  2057 
  2058 dnl Check for clock_gettime()
  2059 CheckClockGettime()
  2060 {
  2061     AC_ARG_ENABLE(clock_gettime,
  2062 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2063                   , enable_clock_gettime=no)
  2064     if test x$enable_clock_gettime = xyes; then
  2065         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2066         if test x$have_clock_gettime = xyes; then
  2067             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2068             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2069         fi
  2070     fi
  2071 }
  2072 
  2073 dnl Check for a valid linux/version.h
  2074 CheckLinuxVersion()
  2075 {
  2076     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2077     if test x$have_linux_version_h = xyes; then
  2078         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2079     fi
  2080 }
  2081 
  2082 dnl Check if we want to use RPATH
  2083 CheckRPATH()
  2084 {
  2085     AC_ARG_ENABLE(rpath,
  2086 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2087                   , enable_rpath=yes)
  2088 }
  2089 
  2090 dnl Set up the configuration based on the host platform!
  2091 case "$host" in
  2092     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2093         ARCH=linux
  2094         CheckDummyVideo
  2095         CheckIPod
  2096         # Set up files for the timer library
  2097         if test x$enable_timers = xyes; then
  2098             AC_DEFINE(SDL_TIMER_UNIX)
  2099             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2100             have_timers=yes
  2101         fi
  2102         ;;
  2103     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  2104         case "$host" in
  2105             *-*-linux*)         ARCH=linux ;;
  2106             *-*-uclinux*)       ARCH=linux ;;
  2107             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2108             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2109             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2110             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2111             *-*-bsdi*)          ARCH=bsdi ;;
  2112             *-*-freebsd*)       ARCH=freebsd ;;
  2113             *-*-dragonfly*)     ARCH=freebsd ;;
  2114             *-*-netbsd*)        ARCH=netbsd ;;
  2115             *-*-openbsd*)       ARCH=openbsd ;;
  2116             *-*-sysv5*)         ARCH=sysv5 ;;
  2117             *-*-solaris*)       ARCH=solaris ;;
  2118             *-*-hpux*)          ARCH=hpux ;;
  2119             *-*-irix*)          ARCH=irix ;;
  2120             *-*-aix*)           ARCH=aix ;;
  2121             *-*-osf*)           ARCH=osf ;;
  2122         esac
  2123         CheckVisibilityHidden
  2124         CheckDummyVideo
  2125         CheckDiskAudio
  2126         CheckDummyAudio
  2127         CheckDLOPEN
  2128         CheckNASM
  2129         CheckAltivec
  2130         CheckOSS
  2131         CheckDMEDIA
  2132         CheckMME
  2133         CheckALSA
  2134         CheckARTSC
  2135         CheckESD
  2136         CheckNAS
  2137         CheckX11
  2138         CheckNANOX
  2139         CheckFBCON
  2140         CheckDirectFB
  2141         CheckPS2GS
  2142         CheckGGI
  2143         CheckSVGA
  2144         CheckVGL
  2145         CheckWscons
  2146         CheckAAlib
  2147         CheckQtopia
  2148         CheckPicoGUI
  2149         CheckOpenGLX11
  2150         CheckglSDL
  2151         CheckInputEvents
  2152         CheckTslib
  2153         CheckUSBHID
  2154         CheckPTHREAD
  2155         CheckClockGettime
  2156         CheckLinuxVersion
  2157         CheckRPATH
  2158         # Set up files for the audio library
  2159         if test x$enable_audio = xyes; then
  2160           case $ARCH in
  2161             sysv5|solaris|hpux)
  2162                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2163                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2164                 have_audio=yes
  2165             ;;
  2166             netbsd|openbsd)
  2167                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2168                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2169                 have_audio=yes
  2170             ;;
  2171             aix)
  2172                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
  2173                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2174                 have_audio=yes
  2175             ;;
  2176           esac
  2177         fi
  2178         # Set up files for the joystick library
  2179         if test x$enable_joystick = xyes; then
  2180           case $ARCH in
  2181             linux)
  2182                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2183                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2184                 have_joystick=yes
  2185             ;;
  2186           esac
  2187         fi
  2188         # Set up files for the cdrom library
  2189         if test x$enable_cdrom = xyes; then
  2190           case $ARCH in
  2191             linux|solaris)
  2192                 AC_DEFINE(SDL_CDROM_LINUX)
  2193                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2194                 have_cdrom=yes
  2195             ;;
  2196             *freebsd*)
  2197                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2198                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2199                 have_cdrom=yes
  2200             ;;
  2201             *openbsd*|*netbsd*)
  2202                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2203                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2204                 have_cdrom=yes
  2205             ;;
  2206             bsdi)
  2207                 AC_DEFINE(SDL_CDROM_BSDI)
  2208                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2209                 have_cdrom=yes
  2210             ;;
  2211             aix)
  2212                 AC_DEFINE(SDL_CDROM_AIX)
  2213                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2214                 have_cdrom=yes
  2215             ;;
  2216             osf)
  2217                 AC_DEFINE(SDL_CDROM_OSF)
  2218                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2219                 have_cdrom=yes
  2220             ;;
  2221           esac
  2222         fi
  2223         # Set up files for the thread library
  2224         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2225             AC_DEFINE(SDL_THREAD_SPROC)
  2226             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2227             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2228             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2229             have_threads=yes
  2230         fi
  2231         # Set up files for the timer library
  2232         if test x$enable_timers = xyes; then
  2233             AC_DEFINE(SDL_TIMER_UNIX)
  2234             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2235             have_timers=yes
  2236         fi
  2237         ;;
  2238     *-*-qnx*)
  2239         ARCH=qnx
  2240         CheckDummyVideo
  2241         CheckDiskAudio
  2242         CheckDummyAudio
  2243         # CheckNASM
  2244         CheckDLOPEN
  2245         CheckNAS
  2246         CheckPHOTON
  2247         CheckX11
  2248         CheckOpenGLX11
  2249         CheckglSDL
  2250         CheckPTHREAD
  2251         # Set up files for the audio library
  2252         if test x$enable_audio = xyes; then
  2253             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2254             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2255             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2256             have_audio=yes
  2257         fi
  2258         # Set up files for the cdrom library
  2259         if test x$enable_cdrom = xyes; then
  2260             AC_DEFINE(SDL_CDROM_QNX)
  2261             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2262             have_cdrom=yes
  2263         fi
  2264         # Set up files for the timer library
  2265         if test x$enable_timers = xyes; then
  2266             AC_DEFINE(SDL_TIMER_UNIX)
  2267             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2268             have_timers=yes
  2269         fi
  2270         ;;
  2271     *-*-cygwin* | *-*-mingw32*)
  2272         ARCH=win32
  2273         if test "$build" != "$host"; then # cross-compiling
  2274             # Default cross-compile location
  2275             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2276         else
  2277             # Look for the location of the tools and install there
  2278             if test "$BUILD_PREFIX" != ""; then
  2279                 ac_default_prefix=$BUILD_PREFIX
  2280             fi
  2281         fi
  2282         CheckDummyVideo
  2283         CheckDiskAudio
  2284         CheckDummyAudio
  2285         CheckWIN32
  2286         CheckWIN32GL
  2287         CheckglSDL
  2288         CheckDIRECTX
  2289         CheckNASM
  2290         # Set up files for the audio library
  2291         if test x$enable_audio = xyes; then
  2292             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2293             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2294             if test x$have_directx = xyes; then
  2295                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2296                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2297             fi
  2298             have_audio=yes
  2299         fi
  2300         # Set up files for the joystick library
  2301         if test x$enable_joystick = xyes; then
  2302             if test x$have_directx = xyes; then
  2303                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2304                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
  2305             else
  2306                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2307                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
  2308             fi
  2309             have_joystick=yes
  2310         fi
  2311         # Set up files for the cdrom library
  2312         if test x$enable_cdrom = xyes; then
  2313             AC_DEFINE(SDL_CDROM_WIN32)
  2314             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2315             have_cdrom=yes
  2316         fi
  2317         # Set up files for the thread library
  2318         if test x$enable_threads = xyes; then
  2319             AC_DEFINE(SDL_THREAD_WIN32)
  2320             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2321             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2322             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2323             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2324             have_threads=yes
  2325         fi
  2326         # Set up files for the timer library
  2327         if test x$enable_timers = xyes; then
  2328             AC_DEFINE(SDL_TIMER_WIN32)
  2329             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2330             have_timers=yes
  2331         fi
  2332         # Set up files for the shared object loading library
  2333         if test x$enable_loadso = xyes; then
  2334             AC_DEFINE(SDL_LOADSO_WIN32)
  2335             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2336             have_loadso=yes
  2337         fi
  2338         # Set up the system libraries we need
  2339         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
  2340         if test x$have_directx = xyes; then
  2341             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
  2342         fi
  2343         # The Win32 platform requires special setup
  2344         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2345         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2346         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2347         ;;
  2348     *-*-beos*)
  2349         ARCH=beos
  2350         ac_default_prefix=/boot/develop/tools/gnupro
  2351         CheckDummyVideo
  2352         CheckDiskAudio
  2353         CheckDummyAudio
  2354         CheckNASM
  2355         CheckBWINDOW
  2356         CheckBeGL
  2357         CheckglSDL
  2358         # Set up files for the audio library
  2359         if test x$enable_audio = xyes; then
  2360             AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
  2361             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2362             have_audio=yes
  2363         fi
  2364         # Set up files for the joystick library
  2365         if test x$enable_joystick = xyes; then
  2366             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2367             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2368             have_joystick=yes
  2369         fi
  2370         # Set up files for the cdrom library
  2371         if test x$enable_cdrom = xyes; then
  2372             AC_DEFINE(SDL_CDROM_BEOS)
  2373             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2374             have_cdrom=yes
  2375         fi
  2376         # Set up files for the thread library
  2377         if test x$enable_threads = xyes; then
  2378             AC_DEFINE(SDL_THREAD_BEOS)
  2379             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2380             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2381             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2382             have_threads=yes
  2383         fi
  2384         # Set up files for the timer library
  2385         if test x$enable_timers = xyes; then
  2386             AC_DEFINE(SDL_TIMER_BEOS)
  2387             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2388             have_timers=yes
  2389         fi
  2390         # Set up files for the shared object loading library
  2391         if test x$enable_loadso = xyes; then
  2392             AC_DEFINE(SDL_LOADSO_BEOS)
  2393             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2394             have_loadso=yes
  2395         fi
  2396         # The BeOS platform requires special setup.
  2397         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2398         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2399         ;;
  2400     *-*-darwin* )
  2401         # This could be either full "Mac OS X", or plain "Darwin" which is
  2402         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2403         # Next line is broken, and a few files below require Mac OS X (full)
  2404         ARCH=macosx
  2405 
  2406         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2407         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2408         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2409 
  2410         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2411         # is -lm which is not needed under Mac OS X. But for some reasons it
  2412         # also tends to contain spurious -L switches, which we don't want to
  2413         # use here or in sdl-config. Hence we reset it.
  2414         EXTRA_LDFLAGS=""
  2415 
  2416         CheckVisibilityHidden
  2417         CheckDummyVideo
  2418         CheckDiskAudio
  2419         CheckDummyAudio
  2420         CheckDLOPEN
  2421 
  2422         # Set up files for the shared object loading library
  2423         # (this needs to be done before the dynamic X11 check)
  2424         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2425             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2426             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2427             have_loadso=yes
  2428         fi
  2429 
  2430         CheckCOCOA
  2431         CheckCARBON
  2432         CheckX11
  2433         CheckMacGL
  2434         CheckOpenGLX11
  2435         CheckglSDL
  2436         CheckPTHREAD
  2437         CheckAltivec
  2438 
  2439         # Need this or things might misbuild on a G3.
  2440         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2441 
  2442         # Set up files for the audio library
  2443         if test x$enable_audio = xyes; then
  2444             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2445             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2446             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2447             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2448             have_audio=yes
  2449         fi
  2450         # Set up files for the joystick library
  2451         if test x$enable_joystick = xyes; then
  2452             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2453             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2454             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2455             have_joystick=yes
  2456         fi
  2457         # Set up files for the cdrom library
  2458         if test x$enable_cdrom = xyes; then
  2459             AC_DEFINE(SDL_CDROM_MACOSX)
  2460             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2461             have_cdrom=yes
  2462         fi
  2463         # Set up files for the timer library
  2464         if test x$enable_timers = xyes; then
  2465             AC_DEFINE(SDL_TIMER_UNIX)
  2466             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2467             have_timers=yes
  2468         fi
  2469         # The Mac OS X platform requires special setup.
  2470         SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
  2471         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2472         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2473         if test x$enable_video_cocoa = xyes; then
  2474             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2475         fi
  2476         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
  2477             # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2478             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices"
  2479             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2480         fi
  2481         # If either the audio or CD driver is used, add the AudioUnit framework
  2482         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2483             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2484         fi
  2485         ;;
  2486     *-*-mint*)
  2487         ARCH=mint
  2488         CheckDummyVideo
  2489         CheckDiskAudio
  2490         CheckDummyAudio
  2491         CheckAtariBiosEvent
  2492         CheckAtariXbiosVideo
  2493         CheckAtariGemVideo
  2494         CheckAtariAudio
  2495         CheckAtariLdg
  2496         CheckAtariOSMesa
  2497         CheckglSDL
  2498         CheckPTH
  2499         # Set up files for the audio library
  2500         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2501             if test x$enable_audio = xyes; then
  2502                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2503                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2504                 have_audio=yes
  2505             fi
  2506         fi
  2507         # Set up files for the joystick library
  2508         if test x$enable_joystick = xyes; then
  2509             AC_DEFINE(SDL_JOYSTICK_MINT)
  2510             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2511             have_joystick=yes
  2512         fi
  2513         # Set up files for the cdrom library
  2514         if test x$enable_cdrom = xyes; then
  2515             AC_DEFINE(SDL_CDROM_MINT)
  2516             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2517             have_cdrom=yes
  2518         fi
  2519         # Set up files for the timer library
  2520         if test x$enable_timers = xyes; then
  2521             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2522                 AC_DEFINE(SDL_TIMER_UNIX)
  2523                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2524             else
  2525                 AC_DEFINE(SDL_TIMER_MINT)
  2526                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2527                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2528             fi
  2529             have_timers=yes
  2530         fi
  2531         ;;
  2532     *-riscos)
  2533         ARCH=riscos
  2534         CheckOSS
  2535         CheckPTHREAD
  2536         # Set up files for the video library
  2537         if test x$enable_video = xyes; then
  2538             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2539             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2540             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2541             have_video=yes
  2542         fi
  2543         # Set up files for the joystick library
  2544         if test x$enable_joystick = xyes; then
  2545             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2546             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2547             have_joystick=yes
  2548         fi
  2549         # Set up files for the timer library
  2550         if test x$enable_timers = xyes; then
  2551             AC_DEFINE(SDL_TIMER_RISCOS)
  2552             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2553             have_timers=yes
  2554         fi
  2555         # The RISC OS platform requires special setup.
  2556         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2557         ;;
  2558     *)
  2559         AC_MSG_ERROR([
  2560 *** Unsupported host:  Please add to configure.in
  2561         ])
  2562         ;;
  2563 esac
  2564 
  2565 # Verify that we have all the platform specific files we need
  2566 if test x$have_joystick != xyes; then
  2567     if test x$enable_joystick = xyes; then
  2568         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2569     fi
  2570     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2571 fi
  2572 if test x$have_cdrom != xyes; then
  2573     if test x$enable_cdrom = xyes; then
  2574         AC_DEFINE(SDL_CDROM_DISABLED)
  2575     fi
  2576     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2577 fi
  2578 if test x$have_threads != xyes; then
  2579     if test x$enable_threads = xyes; then
  2580         AC_DEFINE(SDL_THREADS_DISABLED)
  2581     fi
  2582     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2583 fi
  2584 if test x$have_timers != xyes; then
  2585     if test x$enable_timers = xyes; then
  2586         AC_DEFINE(SDL_TIMERS_DISABLED)
  2587     fi
  2588     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2589 fi
  2590 if test x$have_loadso != xyes; then
  2591     if test x$enable_loadso = xyes; then
  2592         AC_DEFINE(SDL_LOADSO_DISABLED)
  2593     fi
  2594     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2595 fi
  2596 if test x$SDLMAIN_SOURCES = x; then
  2597     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2598 fi
  2599 
  2600 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2601 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2602 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2603 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2604 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2605 
  2606 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2607 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
  2608 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2609 
  2610 # Set runtime shared library paths as needed
  2611 
  2612 if test "x$enable_rpath" = "xyes"; then
  2613   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2614     SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2615   fi
  2616   if test $ARCH = solaris; then
  2617     SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2618   fi
  2619 else
  2620   SDL_RLD_FLAGS=""
  2621 fi
  2622 
  2623 case "$ARCH" in
  2624   macosx)
  2625     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2626       SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa"
  2627     fi
  2628     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  2629       SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon"
  2630     fi
  2631     # Evil hack to allow static linking on Mac OS X
  2632     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a $EXTRA_LDFLAGS"
  2633     ;;
  2634   *)
  2635     SDL_STATIC_LIBS="$SDL_LIBS"
  2636     ;;
  2637 esac
  2638 
  2639 dnl Expand the cflags and libraries needed by apps using SDL
  2640 AC_SUBST(SDL_CFLAGS)
  2641 AC_SUBST(SDL_LIBS)
  2642 AC_SUBST(SDL_STATIC_LIBS)
  2643 AC_SUBST(SDL_RLD_FLAGS)
  2644 if test x$enable_shared = xyes; then
  2645     ENABLE_SHARED_TRUE=
  2646     ENABLE_SHARED_FALSE="#"
  2647 else
  2648     ENABLE_SHARED_TRUE="#"
  2649     ENABLE_SHARED_FALSE=
  2650 fi
  2651 if test x$enable_static = xyes; then
  2652     ENABLE_STATIC_TRUE=
  2653     ENABLE_STATIC_FALSE="#"
  2654 else
  2655     ENABLE_STATIC_TRUE="#"
  2656     ENABLE_STATIC_FALSE=
  2657 fi
  2658 AC_SUBST(ENABLE_SHARED_TRUE)
  2659 AC_SUBST(ENABLE_SHARED_FALSE)
  2660 AC_SUBST(ENABLE_STATIC_TRUE)
  2661 AC_SUBST(ENABLE_STATIC_FALSE)
  2662 
  2663 dnl Expand the sources and objects needed to build the library
  2664 AC_SUBST(ac_aux_dir)
  2665 AC_SUBST(INCLUDE)
  2666 AC_SUBST(SOURCES)
  2667 AC_SUBST(OBJECTS)
  2668 AC_SUBST(SDLMAIN_SOURCES)
  2669 AC_SUBST(SDLMAIN_OBJECTS)
  2670 AC_SUBST(BUILD_CFLAGS)
  2671 AC_SUBST(EXTRA_CFLAGS)
  2672 AC_SUBST(BUILD_LDFLAGS)
  2673 AC_SUBST(EXTRA_LDFLAGS)
  2674 
  2675 AC_OUTPUT([
  2676     Makefile sdl-config SDL.spec SDL.qpg sdl.pc
  2677 ], [
  2678     : >build-deps
  2679     if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
  2680 ])