configure.in
author Sam Lantinga
Wed, 21 Jun 2006 07:57:34 +0000
changeset 1871 9ff9a58fa1e3
parent 1865 d688ac43a76b
child 1875 4627eca2c02b
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=2
    19 SDL_MICRO_VERSION=10
    20 SDL_INTERFACE_AGE=3
    21 SDL_BINARY_AGE=10
    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 Check for Mesa offscreen rendering
  1515 CheckAtariOSMesa()
  1516 {
  1517     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1518         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1519         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1520 
  1521         # Static linking to -lOSMesa
  1522         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1523         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1524             # -lOSMesa is really the static library
  1525             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1526                 OSMESA_LIBS="-lOSMesa"
  1527             fi
  1528         else
  1529             # -lOSMesa is a loader for OSMesa.ldg
  1530             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1531             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1532         fi
  1533         AC_DEFINE(SDL_VIDEO_OPENGL)
  1534         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1535         SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
  1536         SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
  1537 
  1538         AC_ARG_ENABLE(osmesa-shared,
  1539 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]),
  1540                               , enable_osmesa_shared=yes)
  1541         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1542             # Dynamic linking
  1543             if test "x$have_osmesa_hdr" = "xyes"; then
  1544                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1545             fi
  1546         fi
  1547     fi
  1548 }
  1549 
  1550 dnl See if we can use the new unified event interface in Linux 2.4
  1551 CheckInputEvents()
  1552 {
  1553     dnl Check for Linux 2.4 unified input event interface support
  1554     AC_ARG_ENABLE(input-events,
  1555 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1556                   , enable_input_events=yes)
  1557     if test x$enable_input_events = xyes; then
  1558         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1559         use_input_events=no
  1560         AC_TRY_COMPILE([
  1561           #include <linux/input.h>
  1562         ],[
  1563           #ifndef EVIOCGNAME
  1564           #error EVIOCGNAME() ioctl not available
  1565           #endif
  1566         ],[
  1567         use_input_events=yes
  1568         ])
  1569         AC_MSG_RESULT($use_input_events)
  1570         if test x$use_input_events = xyes; then
  1571             AC_DEFINE(SDL_INPUT_LINUXEV)
  1572         fi
  1573     fi
  1574 }
  1575 
  1576 dnl See if we can use the Touchscreen input library
  1577 CheckTslib()
  1578 {
  1579     AC_ARG_ENABLE(input-tslib,
  1580 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1581                   , enable_input_tslib=yes)
  1582     if test x$enable_input_tslib = xyes; then
  1583         AC_MSG_CHECKING(for Touchscreen library support)
  1584         enable_input_tslib=no
  1585         AC_TRY_COMPILE([
  1586           #include "tslib.h"
  1587         ],[
  1588         ],[
  1589         enable_input_tslib=yes
  1590         ])
  1591         AC_MSG_RESULT($enable_input_tslib)
  1592         if test x$enable_input_tslib = xyes; then
  1593             AC_DEFINE(SDL_INPUT_TSLIB)
  1594             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1595         fi
  1596     fi
  1597 }
  1598 
  1599 dnl See if we can use GNU pth library for threads
  1600 CheckPTH()
  1601 {
  1602     dnl Check for pth support
  1603     AC_ARG_ENABLE(pth,
  1604 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
  1605                   , enable_pth=yes)
  1606     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1607         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1608         if test "$PTH_CONFIG" = "no"; then
  1609             use_pth=no
  1610         else
  1611             use_pth=yes
  1612         fi
  1613         AC_MSG_CHECKING(pth)
  1614         AC_MSG_RESULT($use_pth)
  1615         if test "x$use_pth" = xyes; then
  1616             AC_DEFINE(SDL_THREAD_PTH)
  1617             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1618             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1619             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1620             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1621             have_threads=yes
  1622         fi
  1623     fi
  1624 }
  1625 
  1626 dnl See what type of thread model to use on Linux and Solaris
  1627 CheckPTHREAD()
  1628 {
  1629     dnl Check for pthread support
  1630     AC_ARG_ENABLE(pthreads,
  1631 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1632                   , enable_pthreads=yes)
  1633     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1634     AC_ARG_ENABLE(pthread-sem,
  1635 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1636                   , enable_pthread_sem=yes)
  1637     case "$host" in
  1638         *-*-linux*|*-*-uclinux*)
  1639             pthread_cflags="-D_REENTRANT"
  1640             pthread_lib="-lpthread"
  1641             ;;
  1642         *-*-bsdi*)
  1643             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1644             pthread_lib=""
  1645             ;;
  1646         *-*-darwin*)
  1647             pthread_cflags="-D_THREAD_SAFE"
  1648 # causes Carbon.p complaints?
  1649 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1650             ;;
  1651         *-*-freebsd*|*-*-dragonfly*)
  1652             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1653             pthread_lib="-pthread"
  1654             ;;
  1655         *-*-netbsd*)
  1656             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1657             pthread_lib="-L/usr/lib -lpthread"
  1658             ;;
  1659         *-*-openbsd*)
  1660             pthread_cflags="-D_REENTRANT"
  1661             pthread_lib="-pthread"
  1662             ;;
  1663         *-*-solaris*)
  1664             pthread_cflags="-D_REENTRANT"
  1665             pthread_lib="-lpthread -lposix4"
  1666             ;;
  1667         *-*-sysv5*)
  1668             pthread_cflags="-D_REENTRANT -Kthread"
  1669             pthread_lib=""
  1670             ;;
  1671         *-*-irix*)
  1672             pthread_cflags="-D_SGI_MP_SOURCE"
  1673             pthread_lib="-lpthread"
  1674             ;;
  1675         *-*-aix*)
  1676             pthread_cflags="-D_REENTRANT -mthreads"
  1677             pthread_lib="-lpthread"
  1678             ;;
  1679         *-*-hpux11*)
  1680             pthread_cflags="-D_REENTRANT"
  1681             pthread_lib="-L/usr/lib -lpthread"
  1682             ;;
  1683         *-*-qnx*)
  1684             pthread_cflags=""
  1685             pthread_lib=""
  1686             ;;
  1687         *-*-osf*)
  1688             pthread_cflags="-D_REENTRANT"
  1689             if test x$ac_cv_prog_gcc = xyes; then
  1690                 pthread_lib="-lpthread -lrt"
  1691             else
  1692                 pthread_lib="-lpthread -lexc -lrt"
  1693             fi
  1694             ;;
  1695         *)
  1696             pthread_cflags="-D_REENTRANT"
  1697             pthread_lib="-lpthread"
  1698             ;;
  1699     esac
  1700     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1701         # Save the original compiler flags and libraries
  1702         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1703         # Add the pthread compiler flags and libraries
  1704         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1705         # Check to see if we have pthread support on this system
  1706         AC_MSG_CHECKING(for pthreads)
  1707         use_pthreads=no
  1708         AC_TRY_LINK([
  1709          #include <pthread.h>
  1710         ],[
  1711          pthread_attr_t type;
  1712          pthread_attr_init(&type);
  1713         ],[
  1714         use_pthreads=yes
  1715         ])
  1716         AC_MSG_RESULT($use_pthreads)
  1717         # Restore the compiler flags and libraries
  1718         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1719 
  1720         # Do futher testing if we have pthread support...
  1721         if test x$use_pthreads = xyes; then
  1722             AC_DEFINE(SDL_THREAD_PTHREAD)
  1723             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1724             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1725             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1726             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1727 
  1728             # Save the original compiler flags and libraries
  1729             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1730             # Add the pthread compiler flags and libraries
  1731             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1732 
  1733             # Check to see if recursive mutexes are available
  1734             AC_MSG_CHECKING(for recursive mutexes)
  1735             has_recursive_mutexes=no
  1736             if test x$has_recursive_mutexes = xno; then
  1737                 AC_TRY_COMPILE([
  1738                   #include <pthread.h>
  1739                 ],[
  1740                   pthread_mutexattr_t attr;
  1741                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1742                 ],[
  1743                 has_recursive_mutexes=yes
  1744                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1745                 ])
  1746             fi
  1747             if test x$has_recursive_mutexes = xno; then
  1748                 AC_TRY_COMPILE([
  1749                   #include <pthread.h>
  1750                 ],[
  1751                   pthread_mutexattr_t attr;
  1752                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1753                 ],[
  1754                 has_recursive_mutexes=yes
  1755                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1756                 ])
  1757             fi
  1758             AC_MSG_RESULT($has_recursive_mutexes)
  1759 
  1760             # Check to see if pthread semaphore support is missing
  1761             if test x$enable_pthread_sem = xyes; then
  1762                 AC_MSG_CHECKING(for pthread semaphores)
  1763                 have_pthread_sem=no
  1764                 AC_TRY_COMPILE([
  1765                   #include <pthread.h>
  1766                   #include <semaphore.h>
  1767                 ],[
  1768                 ],[
  1769                 have_pthread_sem=yes
  1770                 ])
  1771                 AC_MSG_RESULT($have_pthread_sem)
  1772             fi
  1773 
  1774             # Restore the compiler flags and libraries
  1775             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1776 
  1777             # Basic thread creation functions
  1778             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1779 
  1780             # Semaphores
  1781             # We can fake these with mutexes and condition variables if necessary
  1782             if test x$have_pthread_sem = xyes; then
  1783                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1784             else
  1785                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1786             fi
  1787 
  1788             # Mutexes
  1789             # We can fake these with semaphores if necessary
  1790             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1791 
  1792             # Condition variables
  1793             # We can fake these with semaphores and mutexes if necessary
  1794             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1795 
  1796             have_threads=yes
  1797         else
  1798             CheckPTH
  1799         fi
  1800     fi
  1801 }
  1802 
  1803 dnl Determine whether the compiler can produce Win32 executables
  1804 CheckWIN32()
  1805 {
  1806     AC_MSG_CHECKING(Win32 compiler)
  1807     have_win32_gcc=no
  1808     AC_TRY_COMPILE([
  1809      #include <windows.h>
  1810     ],[
  1811     ],[
  1812     have_win32_gcc=yes
  1813     ])
  1814     AC_MSG_RESULT($have_win32_gcc)
  1815     if test x$have_win32_gcc != xyes; then
  1816        AC_MSG_ERROR([
  1817 *** Your compiler ($CC) does not produce Win32 executables!
  1818        ])
  1819     fi
  1820 
  1821     dnl See if the user wants to redirect standard output to files
  1822     AC_ARG_ENABLE(stdio-redirect,
  1823 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  1824                   , enable_stdio_redirect=yes)
  1825     if test x$enable_stdio_redirect != xyes; then
  1826         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  1827     fi
  1828 
  1829     if test x$enable_video = xyes; then
  1830         AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
  1831         SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
  1832         SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
  1833         have_video=yes
  1834     fi
  1835 }
  1836 
  1837 dnl Find the DirectX includes and libraries
  1838 CheckDIRECTX()
  1839 {
  1840     AC_ARG_ENABLE(directx,
  1841 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  1842                   , enable_directx=yes)
  1843     if test x$enable_directx = xyes; then
  1844         have_directx=no
  1845         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1846         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1847         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1848         if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
  1849             have_directx=yes
  1850         fi
  1851         if test x$enable_video = xyes -a x$have_directx = xyes; then
  1852             AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
  1853             SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
  1854             have_video=yes
  1855         fi
  1856     fi
  1857 }
  1858 
  1859 dnl Check for the dlfcn.h interface for dynamically loading objects
  1860 CheckDLOPEN()
  1861 {
  1862     AC_ARG_ENABLE(sdl-dlopen,
  1863 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1864                   , enable_sdl_dlopen=yes)
  1865     if test x$enable_sdl_dlopen = xyes; then
  1866         AC_MSG_CHECKING(for dlopen)
  1867         have_dlopen=no
  1868         AC_TRY_COMPILE([
  1869          #include <dlfcn.h>
  1870         ],[
  1871          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1872          #error Use dlcompat for Mac OS X 10.2 compatibility
  1873          #endif
  1874         ],[
  1875         have_dlopen=yes
  1876         ])
  1877         AC_MSG_RESULT($have_dlopen)
  1878 
  1879         if test x$have_dlopen = xyes; then
  1880             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1881                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1882                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1883             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1884             if test x$have_dlvsym = xyes; then
  1885                 AC_DEFINE(HAVE_DLVSYM)
  1886             fi
  1887             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1888             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1889             have_loadso=yes
  1890         fi
  1891     fi
  1892 }
  1893 
  1894 dnl Set up the Atari LDG (shared object loader)
  1895 CheckAtariLdg()
  1896 {
  1897     AC_ARG_ENABLE(atari-ldg,
  1898 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]),
  1899                   , enable_atari_ldg=yes)
  1900     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1901         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1902         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1903         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1904             AC_DEFINE(SDL_LOADSO_LDG)
  1905             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1906             SDL_LIBS="$SDL_LIBS -lldg -lgem"
  1907             have_loadso=yes
  1908         fi
  1909     fi
  1910 }
  1911 
  1912 dnl Check for the usbhid(3) library on *BSD
  1913 CheckUSBHID()
  1914 {
  1915     if test x$enable_joystick = xyes; then
  1916         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1917         if test x$have_libusbhid = xyes; then
  1918             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1919             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1920             USB_LIBS="$USB_LIBS -lusbhid"
  1921         else
  1922             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1923             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1924             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1925         fi
  1926             
  1927         save_CFLAGS="$CFLAGS"
  1928         CFLAGS="$CFLAGS $USB_CFLAGS"
  1929 
  1930         AC_MSG_CHECKING(for usbhid)
  1931         have_usbhid=no
  1932         AC_TRY_COMPILE([
  1933           #include <sys/types.h>
  1934           #if defined(HAVE_USB_H)
  1935           #include <usb.h>
  1936           #endif
  1937           #ifdef __DragonFly__
  1938           # include <bus/usb/usb.h>
  1939           # include <bus/usb/usbhid.h>
  1940           #else
  1941           # include <dev/usb/usb.h>
  1942           # include <dev/usb/usbhid.h>
  1943           #endif
  1944           #if defined(HAVE_USBHID_H)
  1945           #include <usbhid.h>
  1946           #elif defined(HAVE_LIBUSB_H)
  1947           #include <libusb.h>
  1948           #elif defined(HAVE_LIBUSBHID_H)
  1949           #include <libusbhid.h>
  1950           #endif
  1951         ],[
  1952           struct report_desc *repdesc;
  1953           struct usb_ctl_report *repbuf;
  1954           hid_kind_t hidkind;
  1955         ],[
  1956         have_usbhid=yes
  1957         ])
  1958         AC_MSG_RESULT($have_usbhid)
  1959 
  1960         if test x$have_usbhid = xyes; then
  1961             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1962             have_usbhid_ucr_data=no
  1963             AC_TRY_COMPILE([
  1964               #include <sys/types.h>
  1965               #if defined(HAVE_USB_H)
  1966               #include <usb.h>
  1967               #endif
  1968               #ifdef __DragonFly__
  1969               # include <bus/usb/usb.h>
  1970               # include <bus/usb/usbhid.h>
  1971               #else
  1972               # include <dev/usb/usb.h>
  1973               # include <dev/usb/usbhid.h>
  1974               #endif
  1975               #if defined(HAVE_USBHID_H)
  1976               #include <usbhid.h>
  1977               #elif defined(HAVE_LIBUSB_H)
  1978               #include <libusb.h>
  1979               #elif defined(HAVE_LIBUSBHID_H)
  1980               #include <libusbhid.h>
  1981               #endif
  1982             ],[
  1983               struct usb_ctl_report buf;
  1984               if (buf.ucr_data) { }
  1985             ],[
  1986             have_usbhid_ucr_data=yes
  1987             ])
  1988             if test x$have_usbhid_ucr_data = xyes; then
  1989                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1990             fi
  1991             AC_MSG_RESULT($have_usbhid_ucr_data)
  1992             
  1993             AC_MSG_CHECKING(for new usbhid API)
  1994             have_usbhid_new=no
  1995             AC_TRY_COMPILE([
  1996               #include <sys/types.h>
  1997               #if defined(HAVE_USB_H)
  1998               #include <usb.h>
  1999               #endif
  2000               #include <dev/usb/usb.h>
  2001               #include <dev/usb/usbhid.h>
  2002               #if defined(HAVE_USBHID_H)
  2003               #include <usbhid.h>
  2004               #elif defined(HAVE_LIBUSB_H)
  2005               #include <libusb.h>
  2006               #elif defined(HAVE_LIBUSBHID_H)
  2007               #include <libusbhid.h>
  2008               #endif
  2009             ],[
  2010               report_desc_t d;
  2011               hid_start_parse(d, 1, 1);
  2012             ],[
  2013             have_usbhid_new=yes
  2014             ])
  2015             if test x$have_usbhid_new = xyes; then
  2016                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2017             fi
  2018             AC_MSG_RESULT($have_usbhid_new)
  2019 
  2020             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2021             have_machine_joystick=no
  2022             AC_TRY_COMPILE([
  2023               #include <machine/joystick.h>
  2024             ],[
  2025               struct joystick t;
  2026             ],[
  2027             have_machine_joystick=yes
  2028             ])
  2029             if test x$have_machine_joystick = xyes; then
  2030                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2031             fi
  2032             AC_MSG_RESULT($have_machine_joystick)
  2033 
  2034             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2035             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2036             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2037             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2038             have_joystick=yes
  2039         fi
  2040         CFLAGS="$save_CFLAGS"
  2041     fi
  2042 }
  2043 
  2044 dnl Check for clock_gettime()
  2045 CheckClockGettime()
  2046 {
  2047     AC_ARG_ENABLE(clock_gettime,
  2048 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2049                   , enable_clock_gettime=no)
  2050     if test x$enable_clock_gettime = xyes; then
  2051         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2052         if test x$have_clock_gettime = xyes; then
  2053             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2054             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2055         fi
  2056     fi
  2057 }
  2058 
  2059 dnl Check for a valid linux/version.h
  2060 CheckLinuxVersion()
  2061 {
  2062     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2063     if test x$have_linux_version_h = xyes; then
  2064         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2065     fi
  2066 }
  2067 
  2068 dnl Check if we want to use RPATH
  2069 CheckRPATH()
  2070 {
  2071     AC_ARG_ENABLE(rpath,
  2072 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2073                   , enable_rpath=yes)
  2074 }
  2075 
  2076 dnl Set up the configuration based on the host platform!
  2077 case "$host" in
  2078     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2079         ARCH=linux
  2080         CheckDummyVideo
  2081         CheckIPod
  2082         # Set up files for the timer library
  2083         if test x$enable_timers = xyes; then
  2084             AC_DEFINE(SDL_TIMER_UNIX)
  2085             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2086             have_timers=yes
  2087         fi
  2088         ;;
  2089     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  2090         case "$host" in
  2091             *-*-linux*)         ARCH=linux ;;
  2092             *-*-uclinux*)       ARCH=linux ;;
  2093             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2094             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2095             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2096             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2097             *-*-bsdi*)          ARCH=bsdi ;;
  2098             *-*-freebsd*)       ARCH=freebsd ;;
  2099             *-*-dragonfly*)     ARCH=freebsd ;;
  2100             *-*-netbsd*)        ARCH=netbsd ;;
  2101             *-*-openbsd*)       ARCH=openbsd ;;
  2102             *-*-sysv5*)         ARCH=sysv5 ;;
  2103             *-*-solaris*)       ARCH=solaris ;;
  2104             *-*-hpux*)          ARCH=hpux ;;
  2105             *-*-irix*)          ARCH=irix ;;
  2106             *-*-aix*)           ARCH=aix ;;
  2107             *-*-osf*)           ARCH=osf ;;
  2108         esac
  2109         CheckVisibilityHidden
  2110         CheckDummyVideo
  2111         CheckDiskAudio
  2112         CheckDummyAudio
  2113         CheckDLOPEN
  2114         CheckNASM
  2115         CheckAltivec
  2116         CheckOSS
  2117         CheckDMEDIA
  2118         CheckMME
  2119         CheckALSA
  2120         CheckARTSC
  2121         CheckESD
  2122         CheckNAS
  2123         CheckX11
  2124         CheckNANOX
  2125         CheckFBCON
  2126         CheckDirectFB
  2127         CheckPS2GS
  2128         CheckGGI
  2129         CheckSVGA
  2130         CheckVGL
  2131         CheckWscons
  2132         CheckAAlib
  2133         CheckQtopia
  2134         CheckPicoGUI
  2135         CheckOpenGLX11
  2136         CheckInputEvents
  2137         CheckTslib
  2138         CheckUSBHID
  2139         CheckPTHREAD
  2140         CheckClockGettime
  2141         CheckLinuxVersion
  2142         CheckRPATH
  2143         # Set up files for the audio library
  2144         if test x$enable_audio = xyes; then
  2145           case $ARCH in
  2146             sysv5|solaris|hpux)
  2147                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2148                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2149                 have_audio=yes
  2150             ;;
  2151             netbsd|openbsd)
  2152                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2153                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2154                 have_audio=yes
  2155             ;;
  2156             aix)
  2157                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
  2158                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2159                 have_audio=yes
  2160             ;;
  2161           esac
  2162         fi
  2163         # Set up files for the joystick library
  2164         if test x$enable_joystick = xyes; then
  2165           case $ARCH in
  2166             linux)
  2167                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2168                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2169                 have_joystick=yes
  2170             ;;
  2171           esac
  2172         fi
  2173         # Set up files for the cdrom library
  2174         if test x$enable_cdrom = xyes; then
  2175           case $ARCH in
  2176             linux|solaris)
  2177                 AC_DEFINE(SDL_CDROM_LINUX)
  2178                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2179                 have_cdrom=yes
  2180             ;;
  2181             *freebsd*)
  2182                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2183                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2184                 have_cdrom=yes
  2185             ;;
  2186             *openbsd*|*netbsd*)
  2187                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2188                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2189                 have_cdrom=yes
  2190             ;;
  2191             bsdi)
  2192                 AC_DEFINE(SDL_CDROM_BSDI)
  2193                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2194                 have_cdrom=yes
  2195             ;;
  2196             aix)
  2197                 AC_DEFINE(SDL_CDROM_AIX)
  2198                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2199                 have_cdrom=yes
  2200             ;;
  2201             osf)
  2202                 AC_DEFINE(SDL_CDROM_OSF)
  2203                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2204                 have_cdrom=yes
  2205             ;;
  2206           esac
  2207         fi
  2208         # Set up files for the thread library
  2209         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2210             AC_DEFINE(SDL_THREAD_SPROC)
  2211             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2212             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2213             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2214             have_threads=yes
  2215         fi
  2216         # Set up files for the timer library
  2217         if test x$enable_timers = xyes; then
  2218             AC_DEFINE(SDL_TIMER_UNIX)
  2219             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2220             have_timers=yes
  2221         fi
  2222         ;;
  2223     *-*-qnx*)
  2224         ARCH=qnx
  2225         CheckDummyVideo
  2226         CheckDiskAudio
  2227         CheckDummyAudio
  2228         # CheckNASM
  2229         CheckDLOPEN
  2230         CheckNAS
  2231         CheckPHOTON
  2232         CheckX11
  2233         CheckOpenGLX11
  2234         CheckPTHREAD
  2235         # Set up files for the audio library
  2236         if test x$enable_audio = xyes; then
  2237             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2238             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2239             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2240             have_audio=yes
  2241         fi
  2242         # Set up files for the cdrom library
  2243         if test x$enable_cdrom = xyes; then
  2244             AC_DEFINE(SDL_CDROM_QNX)
  2245             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2246             have_cdrom=yes
  2247         fi
  2248         # Set up files for the timer library
  2249         if test x$enable_timers = xyes; then
  2250             AC_DEFINE(SDL_TIMER_UNIX)
  2251             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2252             have_timers=yes
  2253         fi
  2254         ;;
  2255     *-*-cygwin* | *-*-mingw32*)
  2256         ARCH=win32
  2257         if test "$build" != "$host"; then # cross-compiling
  2258             # Default cross-compile location
  2259             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2260         else
  2261             # Look for the location of the tools and install there
  2262             if test "$BUILD_PREFIX" != ""; then
  2263                 ac_default_prefix=$BUILD_PREFIX
  2264             fi
  2265         fi
  2266         CheckDummyVideo
  2267         CheckDiskAudio
  2268         CheckDummyAudio
  2269         CheckWIN32
  2270         CheckWIN32GL
  2271         CheckDIRECTX
  2272         CheckNASM
  2273         # Set up files for the audio library
  2274         if test x$enable_audio = xyes; then
  2275             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2276             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2277             if test x$have_directx = xyes; then
  2278                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2279                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2280             fi
  2281             have_audio=yes
  2282         fi
  2283         # Set up files for the joystick library
  2284         if test x$enable_joystick = xyes; then
  2285             AC_DEFINE(SDL_JOYSTICK_WINMM)
  2286             SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
  2287             have_joystick=yes
  2288         fi
  2289         # Set up files for the cdrom library
  2290         if test x$enable_cdrom = xyes; then
  2291             AC_DEFINE(SDL_CDROM_WIN32)
  2292             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2293             have_cdrom=yes
  2294         fi
  2295         # Set up files for the thread library
  2296         if test x$enable_threads = xyes; then
  2297             AC_DEFINE(SDL_THREAD_WIN32)
  2298             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2299             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2300             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2301             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2302             have_threads=yes
  2303         fi
  2304         # Set up files for the timer library
  2305         if test x$enable_timers = xyes; then
  2306             AC_DEFINE(SDL_TIMER_WIN32)
  2307             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2308             have_timers=yes
  2309         fi
  2310         # Set up files for the shared object loading library
  2311         if test x$enable_loadso = xyes; then
  2312             AC_DEFINE(SDL_LOADSO_WIN32)
  2313             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2314             have_loadso=yes
  2315         fi
  2316         # Set up the system libraries we need
  2317         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
  2318         if test x$have_directx = xyes; then
  2319             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
  2320         fi
  2321         # The Win32 platform requires special setup
  2322         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2323         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2324         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2325         ;;
  2326     *-*-beos*)
  2327         ARCH=beos
  2328         ac_default_prefix=/boot/develop/tools/gnupro
  2329         CheckDummyVideo
  2330         CheckDiskAudio
  2331         CheckDummyAudio
  2332         CheckNASM
  2333         CheckBWINDOW
  2334         CheckBeGL
  2335         # Set up files for the audio library
  2336         if test x$enable_audio = xyes; then
  2337             AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
  2338             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2339             have_audio=yes
  2340         fi
  2341         # Set up files for the joystick library
  2342         if test x$enable_joystick = xyes; then
  2343             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2344             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2345             have_joystick=yes
  2346         fi
  2347         # Set up files for the cdrom library
  2348         if test x$enable_cdrom = xyes; then
  2349             AC_DEFINE(SDL_CDROM_BEOS)
  2350             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2351             have_cdrom=yes
  2352         fi
  2353         # Set up files for the thread library
  2354         if test x$enable_threads = xyes; then
  2355             AC_DEFINE(SDL_THREAD_BEOS)
  2356             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2357             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2358             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2359             have_threads=yes
  2360         fi
  2361         # Set up files for the timer library
  2362         if test x$enable_timers = xyes; then
  2363             AC_DEFINE(SDL_TIMER_BEOS)
  2364             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2365             have_timers=yes
  2366         fi
  2367         # Set up files for the shared object loading library
  2368         if test x$enable_loadso = xyes; then
  2369             AC_DEFINE(SDL_LOADSO_BEOS)
  2370             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2371             have_loadso=yes
  2372         fi
  2373         # The BeOS platform requires special setup.
  2374         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2375         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2376         ;;
  2377     *-*-darwin* )
  2378         # This could be either full "Mac OS X", or plain "Darwin" which is
  2379         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2380         # Next line is broken, and a few files below require Mac OS X (full)
  2381         ARCH=macosx
  2382 
  2383         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2384         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2385         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2386 
  2387         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2388         # is -lm which is not needed under Mac OS X. But for some reasons it
  2389         # also tends to contain spurious -L switches, which we don't want to
  2390         # use here or in sdl-config. Hence we reset it.
  2391         EXTRA_LDFLAGS=""
  2392 
  2393         CheckVisibilityHidden
  2394         CheckDummyVideo
  2395         CheckDiskAudio
  2396         CheckDummyAudio
  2397         CheckDLOPEN
  2398 
  2399         # Set up files for the shared object loading library
  2400         # (this needs to be done before the dynamic X11 check)
  2401         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2402             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2403             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2404             have_loadso=yes
  2405         fi
  2406 
  2407         CheckCOCOA
  2408         CheckCARBON
  2409         CheckX11
  2410         CheckMacGL
  2411         CheckOpenGLX11
  2412         CheckPTHREAD
  2413         CheckAltivec
  2414 
  2415         # Need this or things might misbuild on a G3.
  2416         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2417 
  2418         # Set up files for the audio library
  2419         if test x$enable_audio = xyes; then
  2420             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2421             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2422             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2423             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2424             have_audio=yes
  2425         fi
  2426         # Set up files for the joystick library
  2427         if test x$enable_joystick = xyes; then
  2428             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2429             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2430             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2431             have_joystick=yes
  2432         fi
  2433         # Set up files for the cdrom library
  2434         if test x$enable_cdrom = xyes; then
  2435             AC_DEFINE(SDL_CDROM_MACOSX)
  2436             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2437             have_cdrom=yes
  2438         fi
  2439         # Set up files for the timer library
  2440         if test x$enable_timers = xyes; then
  2441             AC_DEFINE(SDL_TIMER_UNIX)
  2442             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2443             have_timers=yes
  2444         fi
  2445         # The Mac OS X platform requires special setup.
  2446         SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
  2447         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2448         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2449         if test x$enable_video_cocoa = xyes; then
  2450             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2451         fi
  2452         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
  2453             # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2454             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices"
  2455             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2456         fi
  2457         # If either the audio or CD driver is used, add the AudioUnit framework
  2458         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2459             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2460         fi
  2461         ;;
  2462     *-*-mint*)
  2463         ARCH=mint
  2464         CheckDummyVideo
  2465         CheckDiskAudio
  2466         CheckDummyAudio
  2467         CheckAtariBiosEvent
  2468         CheckAtariXbiosVideo
  2469         CheckAtariGemVideo
  2470         CheckAtariAudio
  2471         CheckAtariLdg
  2472         CheckAtariOSMesa
  2473         CheckPTH
  2474         # Set up files for the audio library
  2475         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2476             if test x$enable_audio = xyes; then
  2477                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2478                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2479                 have_audio=yes
  2480             fi
  2481         fi
  2482         # Set up files for the joystick library
  2483         if test x$enable_joystick = xyes; then
  2484             AC_DEFINE(SDL_JOYSTICK_MINT)
  2485             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2486             have_joystick=yes
  2487         fi
  2488         # Set up files for the cdrom library
  2489         if test x$enable_cdrom = xyes; then
  2490             AC_DEFINE(SDL_CDROM_MINT)
  2491             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2492             have_cdrom=yes
  2493         fi
  2494         # Set up files for the timer library
  2495         if test x$enable_timers = xyes; then
  2496             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2497                 AC_DEFINE(SDL_TIMER_UNIX)
  2498                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2499             else
  2500                 AC_DEFINE(SDL_TIMER_MINT)
  2501                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2502                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2503             fi
  2504             have_timers=yes
  2505         fi
  2506         ;;
  2507     *-riscos)
  2508         ARCH=riscos
  2509         CheckOSS
  2510         CheckPTHREAD
  2511         # Set up files for the video library
  2512         if test x$enable_video = xyes; then
  2513             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2514             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2515             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2516             have_video=yes
  2517         fi
  2518         # Set up files for the joystick library
  2519         if test x$enable_joystick = xyes; then
  2520             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2521             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2522             have_joystick=yes
  2523         fi
  2524         # Set up files for the timer library
  2525         if test x$enable_timers = xyes; then
  2526             AC_DEFINE(SDL_TIMER_RISCOS)
  2527             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2528             have_timers=yes
  2529         fi
  2530         # The RISC OS platform requires special setup.
  2531         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2532         ;;
  2533     *)
  2534         AC_MSG_ERROR([
  2535 *** Unsupported host:  Please add to configure.in
  2536         ])
  2537         ;;
  2538 esac
  2539 
  2540 # Verify that we have all the platform specific files we need
  2541 if test x$have_joystick != xyes; then
  2542     if test x$enable_joystick = xyes; then
  2543         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2544     fi
  2545     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2546 fi
  2547 if test x$have_cdrom != xyes; then
  2548     if test x$enable_cdrom = xyes; then
  2549         AC_DEFINE(SDL_CDROM_DISABLED)
  2550     fi
  2551     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2552 fi
  2553 if test x$have_threads != xyes; then
  2554     if test x$enable_threads = xyes; then
  2555         AC_DEFINE(SDL_THREADS_DISABLED)
  2556     fi
  2557     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2558 fi
  2559 if test x$have_timers != xyes; then
  2560     if test x$enable_timers = xyes; then
  2561         AC_DEFINE(SDL_TIMERS_DISABLED)
  2562     fi
  2563     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2564 fi
  2565 if test x$have_loadso != xyes; then
  2566     if test x$enable_loadso = xyes; then
  2567         AC_DEFINE(SDL_LOADSO_DISABLED)
  2568     fi
  2569     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2570 fi
  2571 if test x$SDLMAIN_SOURCES = x; then
  2572     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2573 fi
  2574 
  2575 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2576 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2577 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2578 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2579 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2580 
  2581 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2582 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
  2583 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2584 
  2585 # Set runtime shared library paths as needed
  2586 
  2587 if test "x$enable_rpath" = "xyes"; then
  2588   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2589     SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2590   fi
  2591   if test $ARCH = solaris; then
  2592     SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2593   fi
  2594 else
  2595   SDL_RLD_FLAGS=""
  2596 fi
  2597 
  2598 case "$ARCH" in
  2599   macosx)
  2600     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2601       SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa"
  2602     fi
  2603     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  2604       SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon"
  2605     fi
  2606     # Evil hack to allow static linking on Mac OS X
  2607     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a $EXTRA_LDFLAGS"
  2608     ;;
  2609   *)
  2610     SDL_STATIC_LIBS="$SDL_LIBS"
  2611     ;;
  2612 esac
  2613 
  2614 dnl Expand the cflags and libraries needed by apps using SDL
  2615 AC_SUBST(SDL_CFLAGS)
  2616 AC_SUBST(SDL_LIBS)
  2617 AC_SUBST(SDL_STATIC_LIBS)
  2618 AC_SUBST(SDL_RLD_FLAGS)
  2619 if test x$enable_shared = xyes; then
  2620     ENABLE_SHARED_TRUE=
  2621     ENABLE_SHARED_FALSE="#"
  2622 else
  2623     ENABLE_SHARED_TRUE="#"
  2624     ENABLE_SHARED_FALSE=
  2625 fi
  2626 if test x$enable_static = xyes; then
  2627     ENABLE_STATIC_TRUE=
  2628     ENABLE_STATIC_FALSE="#"
  2629 else
  2630     ENABLE_STATIC_TRUE="#"
  2631     ENABLE_STATIC_FALSE=
  2632 fi
  2633 AC_SUBST(ENABLE_SHARED_TRUE)
  2634 AC_SUBST(ENABLE_SHARED_FALSE)
  2635 AC_SUBST(ENABLE_STATIC_TRUE)
  2636 AC_SUBST(ENABLE_STATIC_FALSE)
  2637 
  2638 dnl Expand the sources and objects needed to build the library
  2639 AC_SUBST(ac_aux_dir)
  2640 AC_SUBST(INCLUDE)
  2641 AC_SUBST(SOURCES)
  2642 AC_SUBST(OBJECTS)
  2643 AC_SUBST(SDLMAIN_SOURCES)
  2644 AC_SUBST(SDLMAIN_OBJECTS)
  2645 AC_SUBST(BUILD_CFLAGS)
  2646 AC_SUBST(EXTRA_CFLAGS)
  2647 AC_SUBST(BUILD_LDFLAGS)
  2648 AC_SUBST(EXTRA_LDFLAGS)
  2649 
  2650 AC_OUTPUT([
  2651     Makefile sdl-config SDL.spec SDL.qpg sdl.pc
  2652 ], [
  2653     : >build-deps
  2654     if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
  2655 ])