configure.in
author Sam Lantinga <slouken@libsdl.org>
Sat, 21 Aug 2004 02:06:30 +0000
changeset 935 f8d5ddc7aef1
parent 886 05c551e5bc64
child 936 84f930aebaeb
permissions -rw-r--r--
Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
     1 dnl Process this file with autoconf to produce a configure script.
     2 AC_INIT(README)
     3 
     4 dnl Set various version strings - taken gratefully from the GTk sources
     5 #
     6 # Making releases:
     7 # Edit include/SDL/SDL_version.h and change the version, then:
     8 #   SDL_MICRO_VERSION += 1;
     9 #   SDL_INTERFACE_AGE += 1;
    10 #   SDL_BINARY_AGE += 1;
    11 # if any functions have been added, set SDL_INTERFACE_AGE to 0.
    12 # if backwards compatibility has been broken,
    13 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
    14 #
    15 SDL_MAJOR_VERSION=1
    16 SDL_MINOR_VERSION=2
    17 SDL_MICRO_VERSION=8
    18 SDL_INTERFACE_AGE=1
    19 SDL_BINARY_AGE=8
    20 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
    21 
    22 AC_SUBST(SDL_MAJOR_VERSION)
    23 AC_SUBST(SDL_MINOR_VERSION)
    24 AC_SUBST(SDL_MICRO_VERSION)
    25 AC_SUBST(SDL_INTERFACE_AGE)
    26 AC_SUBST(SDL_BINARY_AGE)
    27 AC_SUBST(SDL_VERSION)
    28 
    29 # libtool versioning
    30 LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
    31 LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
    32 LT_REVISION=$SDL_INTERFACE_AGE
    33 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
    34 
    35 AC_SUBST(LT_RELEASE)
    36 AC_SUBST(LT_CURRENT)
    37 AC_SUBST(LT_REVISION)
    38 AC_SUBST(LT_AGE)
    39 
    40 dnl Detect the canonical host and target build environment
    41 AC_CANONICAL_SYSTEM
    42 
    43 dnl Setup for automake
    44 AM_INIT_AUTOMAKE(SDL, $SDL_VERSION)
    45 
    46 dnl Check for tools
    47 
    48 AC_LIBTOOL_WIN32_DLL
    49 AM_PROG_LIBTOOL
    50 AC_PROG_MAKE_SET
    51 AC_PROG_CC
    52 AC_C_INLINE
    53 AC_C_CONST
    54 AC_PROG_CXX
    55 AC_PROG_INSTALL
    56 AC_FUNC_ALLOCA
    57 ASFLAGS=""
    58 AC_SUBST(ASFLAGS)
    59 CCAS="$CC"
    60 AC_SUBST(CCAS)
    61 CCASFLAGS=""
    62 AC_SUBST(CCASFLAGS)
    63 AM_CONDITIONAL([am__fastdepOBJC], false)
    64 
    65 dnl The alpha architecture needs special flags for binary portability
    66 case "$target" in
    67     alpha*-*-linux*)
    68         if test x$ac_cv_prog_gcc = xyes; then
    69             CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
    70         fi
    71         ;;
    72 esac
    73 
    74 dnl Add compiler-specific optimization flags
    75 
    76 dnl See if the user wants aggressive optimizations of the code
    77 AC_ARG_ENABLE(debug,
    78 [  --enable-debug          Disable aggressive optimizations [default=yes]],
    79               , enable_debug=yes)
    80 if test x$enable_debug != xyes; then
    81     if test x$ac_cv_prog_gcc = xyes; then
    82         CFLAGS="$CFLAGS -fexpensive-optimizations"
    83         # Ack! This breaks the MMX YV12 conversion on gcc 2.95.2
    84         # CFLAGS="$CFLAGS -fomit-frame-pointer"
    85     fi
    86     case "$target" in
    87         i486-*-*)
    88             if test x$ac_cv_prog_gcc = xyes; then
    89                 CFLAGS="$CFLAGS -march=i486"
    90             fi
    91             ;;
    92         i?86-*-*)
    93             if test x$ac_cv_prog_gcc = xyes; then
    94                 CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro"
    95             fi
    96             ;;
    97         *-*-osf*)
    98             if test x$ac_cv_prog_gcc != xyes; then
    99                 CFLAGS="-g3 -fast -arch host"
   100             fi
   101             ;;
   102     esac
   103 fi
   104 
   105 dnl Add verbose warnings by default, and allow ANSI compliance checking
   106 AC_ARG_ENABLE(strict-ansi,
   107 [  --enable-strict-ansi    Enable strict ANSI compliance build [default=no]],
   108               , enable_strict_ansi=no)
   109 if test x$ac_cv_prog_gcc = xyes; then
   110     CFLAGS="$CFLAGS -Wall"
   111     if test x$enable_strict_ansi = xyes; then
   112         CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
   113     fi
   114 fi
   115 
   116 dnl Initialize the compiler and linker flags for SDL applications
   117 
   118 SDL_CFLAGS=""
   119 SDL_LIBS="-lSDL"
   120 
   121 dnl Add the math library for the new gamma correction support
   122 
   123 case "$target" in
   124     *-*-cygwin* | *-*-mingw32*)
   125         MATHLIB=""
   126         ;;
   127     *-*-beos*)
   128         MATHLIB=""
   129         ;;
   130     *-*-darwin*)
   131         MATHLIB=""
   132         ;;
   133     *)
   134         MATHLIB="-lm"
   135         ;;
   136 esac
   137 SYSTEM_LIBS="$SYSTEM_LIBS $MATHLIB"
   138 
   139 dnl Enable/disable various subsystems of the SDL library
   140 
   141 AC_ARG_ENABLE(audio,
   142 [  --enable-audio          Enable the audio subsystem [default=yes]],
   143               , enable_audio=yes)
   144 if test x$enable_audio = xyes; then
   145     SDL_EXTRADIRS="$SDL_EXTRADIRS audio"
   146     SDL_EXTRALIBS="$SDL_EXTRALIBS audio/libaudio.la"
   147 else
   148     CFLAGS="$CFLAGS -DDISABLE_AUDIO"
   149 fi
   150 AC_ARG_ENABLE(video,
   151 [  --enable-video          Enable the video subsystem [default=yes]],
   152               , enable_video=yes)
   153 if test x$enable_video = xyes; then
   154     SDL_EXTRADIRS="$SDL_EXTRADIRS video"
   155     SDL_EXTRALIBS="$SDL_EXTRALIBS video/libvideo.la"
   156 else
   157     CFLAGS="$CFLAGS -DDISABLE_VIDEO"
   158 fi
   159 AC_ARG_ENABLE(events,
   160 [  --enable-events         Enable the events subsystem [default=yes]],
   161               , enable_events=yes)
   162 if test x$enable_video = xyes -a x$enable_events = xyes; then
   163     SDL_EXTRADIRS="$SDL_EXTRADIRS events"
   164     SDL_EXTRALIBS="$SDL_EXTRALIBS events/libevents.la"
   165 else
   166     CFLAGS="$CFLAGS -DDISABLE_EVENTS"
   167 fi
   168 AC_ARG_ENABLE(joystick,
   169 [  --enable-joystick       Enable the joystick subsystem [default=yes]],
   170               , enable_joystick=yes)
   171 if test x$enable_joystick = xyes; then
   172     SDL_EXTRADIRS="$SDL_EXTRADIRS joystick"
   173     SDL_EXTRALIBS="$SDL_EXTRALIBS joystick/libjoystick.la"
   174 else
   175     CFLAGS="$CFLAGS -DDISABLE_JOYSTICK"
   176 fi
   177 AC_ARG_ENABLE(cdrom,
   178 [  --enable-cdrom          Enable the cdrom subsystem [default=yes]],
   179               , enable_cdrom=yes)
   180 if test x$enable_cdrom = xyes; then
   181     SDL_EXTRADIRS="$SDL_EXTRADIRS cdrom"
   182     SDL_EXTRALIBS="$SDL_EXTRALIBS cdrom/libcdrom.la"
   183 else
   184     CFLAGS="$CFLAGS -DDISABLE_CDROM"
   185 fi
   186 AC_ARG_ENABLE(threads,
   187 [  --enable-threads        Enable the threading subsystem [default=yes]],
   188               , enable_threads=yes)
   189 SDL_EXTRADIRS="$SDL_EXTRADIRS thread"
   190 SDL_EXTRALIBS="$SDL_EXTRALIBS thread/libthread.la"
   191 if test x$enable_threads != xyes; then
   192     CFLAGS="$CFLAGS -DDISABLE_THREADS"
   193     COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
   194     COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
   195     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
   196     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
   197     COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
   198     COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
   199     COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
   200     COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
   201 fi
   202 AC_ARG_ENABLE(timers,
   203 [  --enable-timers         Enable the timer subsystem [default=yes]],
   204               , enable_timers=yes)
   205 if test x$enable_timers = xyes; then
   206     SDL_EXTRADIRS="$SDL_EXTRADIRS timer"
   207     SDL_EXTRALIBS="$SDL_EXTRALIBS timer/libtimer.la"
   208 else
   209     CFLAGS="$CFLAGS -DDISABLE_TIMERS"
   210 fi
   211 AC_ARG_ENABLE(endian,
   212 [  --enable-endian         Enable the endian subsystem [default=yes]],
   213               , enable_endian=yes)
   214 if test x$enable_endian = xyes; then
   215     SDL_EXTRADIRS="$SDL_EXTRADIRS endian"
   216     SDL_EXTRALIBS="$SDL_EXTRALIBS endian/libendian.la"
   217 else
   218     CFLAGS="$CFLAGS -DDISABLE_ENDIAN"
   219 fi
   220 AC_ARG_ENABLE(file,
   221 [  --enable-file           Enable the file subsystem [default=yes]],
   222               , enable_file=yes)
   223 if test x$enable_file = xyes; then
   224     SDL_EXTRADIRS="$SDL_EXTRADIRS file"
   225     SDL_EXTRALIBS="$SDL_EXTRALIBS file/libfile.la"
   226 else
   227     CFLAGS="$CFLAGS -DDISABLE_FILE"
   228 fi
   229 AC_ARG_ENABLE(cpuinfo,
   230 [  --enable-cpuinfo        Enable the cpuinfo subsystem [default=yes]],
   231               , enable_cpuinfo=yes)
   232 if test x$enable_cpuinfo = xyes; then
   233     SDL_EXTRADIRS="$SDL_EXTRADIRS cpuinfo"
   234     SDL_EXTRALIBS="$SDL_EXTRALIBS cpuinfo/libcpuinfo.la"
   235 else
   236     CFLAGS="$CFLAGS -DDISABLE_CPUINFO"
   237 fi
   238 
   239 dnl See if the OSS audio interface is supported
   240 CheckOSS()
   241 {
   242     AC_ARG_ENABLE(oss,
   243 [  --enable-oss            support the OSS audio API [default=yes]],
   244                   , enable_oss=yes)
   245     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
   246         AC_MSG_CHECKING(for OSS audio support)
   247         have_oss=no
   248         if test x$have_oss != xyes; then
   249             AC_TRY_COMPILE([
   250               #include <sys/soundcard.h>
   251             ],[
   252               int arg = SNDCTL_DSP_SETFRAGMENT;
   253             ],[
   254             have_oss=yes
   255             ])
   256         fi
   257         if test x$have_oss != xyes; then
   258             AC_TRY_COMPILE([
   259               #include <soundcard.h>
   260             ],[
   261               int arg = SNDCTL_DSP_SETFRAGMENT;
   262             ],[
   263             have_oss=yes
   264             CFLAGS="$CFLAGS -DOSS_USE_SOUNDCARD_H"
   265             ])
   266         fi
   267         AC_MSG_RESULT($have_oss)
   268         if test x$have_oss = xyes; then
   269             CFLAGS="$CFLAGS -DOSS_SUPPORT"
   270             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
   271             AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
   272             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
   273             AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la"
   274         fi
   275     fi
   276 }
   277 
   278 dnl See if the ALSA audio interface is supported
   279 CheckALSA()
   280 {
   281     AC_ARG_ENABLE(alsa,
   282 [  --enable-alsa           support the ALSA audio API [default=yes]],
   283                   , enable_alsa=yes)
   284     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
   285         AC_MSG_CHECKING(for ALSA audio support)
   286         have_alsa=no
   287         AC_TRY_COMPILE([
   288           #include <alsa/asoundlib.h>
   289         ],[
   290           #if SND_LIB_VERSION < ((0<<16)|(9<<8)|0)
   291           #error Your version of ALSA is too old
   292           #endif
   293           snd_pcm_t *pcm_handle;
   294         ],[
   295         AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes)
   296         ])
   297         if test x$have_alsa = xyes; then
   298             AC_ARG_ENABLE(alsa-shared,
   299 [  --enable-alsa-shared     dynamically load ALSA audio support [default=yes]],
   300                           , enable_alsa_shared=yes)
   301             alsa_lib=`ls /usr/lib/libasound.so.* | sed 's/.*\/\(.*\)/\1/; q'`
   302             if test x$use_dlopen != xyes && \
   303                test x$enable_alsa_shared = xyes; then
   304                 AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
   305             fi
   306             if test x$use_dlopen = xyes && \
   307                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   308                 CFLAGS="$CFLAGS -DALSA_SUPPORT -DALSA_DYNAMIC=\$(alsa_lib)"
   309                 AC_SUBST(alsa_lib)
   310             else
   311                 CFLAGS="$CFLAGS -DALSA_SUPPORT"
   312                 SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
   313             fi
   314             AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa"
   315             AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la"
   316         else
   317             AC_MSG_RESULT($have_alsa)
   318         fi
   319     fi
   320 }
   321 
   322 dnl Check whether we want to use IRIX 6.5+ native audio or not
   323 CheckDMEDIA()
   324 {
   325     if test x$enable_audio = xyes; then
   326         AC_MSG_CHECKING(for dmedia audio support)
   327         have_dmedia=no
   328         AC_TRY_COMPILE([
   329           #include <dmedia/audio.h>
   330         ],[
   331           ALport audio_port;
   332         ],[
   333         have_dmedia=yes
   334         ])
   335         AC_MSG_RESULT($have_dmedia)
   336         # Set up files for the audio library
   337         if test x$have_dmedia = xyes; then
   338             CFLAGS="$CFLAGS -DDMEDIA_SUPPORT"
   339             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dmedia"
   340             AUDIO_DRIVERS="$AUDIO_DRIVERS dmedia/libaudio_dmedia.la"
   341             SYSTEM_LIBS="$SYSTEM_LIBS -laudio"
   342         fi
   343     fi
   344 }
   345 
   346 dnl Find the ESD includes and libraries
   347 CheckESD()
   348 {
   349     AC_ARG_ENABLE(esd,
   350 [  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
   351                   , enable_esd=yes)
   352     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   353         use_esd=no
   354         AM_PATH_ESD(0.2.8, use_esd=yes)
   355         if test x$use_esd = xyes; then
   356             AC_ARG_ENABLE(esd-shared,
   357 [  --enable-esd-shared     dynamically load ESD audio support [default=yes]],
   358                           , enable_esd_shared=yes)
   359             esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
   360             esd_lib=`ls $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   361             echo "-- $esd_lib_spec -> $esd_lib"
   362             if test x$use_dlopen != xyes && \
   363                test x$enable_esd_shared = xyes; then
   364                 AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
   365             fi
   366             if test x$use_dlopen = xyes && \
   367                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   368                 CFLAGS="$CFLAGS -DESD_SUPPORT -DESD_DYNAMIC=\$(esd_lib) $ESD_CFLAGS"
   369                 AC_SUBST(esd_lib)
   370             else
   371                 CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
   372                 SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
   373             fi
   374             AUDIO_SUBDIRS="$AUDIO_SUBDIRS esd"
   375             AUDIO_DRIVERS="$AUDIO_DRIVERS esd/libaudio_esd.la"
   376         fi
   377     fi
   378 }
   379 
   380 CheckARTSC()
   381 {
   382     AC_ARG_ENABLE(arts,
   383 [  --enable-arts           support the Analog Real Time Synthesizer [default=yes]],
   384                   , enable_arts=yes)
   385     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   386         AC_PATH_PROG(ARTSCCONFIG, artsc-config)
   387         if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"'; then
   388             : # arts isn't installed
   389         else
   390             ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
   391             ARTSC_LIBS=`$ARTSCCONFIG --libs`
   392             ARTSC_PREFIX=`$ARTSCCONFIG --arts-prefix`
   393             AC_MSG_CHECKING(for aRts development environment)
   394             audio_arts=no
   395             save_CFLAGS="$CFLAGS"
   396             CFLAGS="$CFLAGS $ARTSC_CFLAGS"
   397             AC_TRY_COMPILE([
   398              #include <artsc.h>
   399             ],[
   400              arts_stream_t stream;
   401             ],[
   402             audio_arts=yes
   403             ])
   404             CFLAGS="$save_CFLAGS"
   405             AC_MSG_RESULT($audio_arts)
   406             if test x$audio_arts = xyes; then
   407                 AC_ARG_ENABLE(arts-shared,
   408 [  --enable-arts-shared    dynamically load aRts audio support [default=yes]],
   409                               , enable_arts_shared=yes)
   410                 arts_lib_spec="$ARTSC_PREFIX/lib/libartsc.so.*"
   411                 arts_lib=`ls $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   412                 echo "-- $arts_lib_spec -> $arts_lib"
   413                 if test x$use_dlopen != xyes && \
   414                    test x$enable_arts_shared = xyes; then
   415                     AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
   416                 fi
   417                 if test x$use_dlopen = xyes && \
   418                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   419                     CFLAGS="$CFLAGS -DARTSC_SUPPORT -DARTSC_DYNAMIC=\$(arts_lib) $ARTSC_CFLAGS"
   420                     AC_SUBST(arts_lib)
   421                 else
   422                     CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
   423                     SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
   424                 fi
   425                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS arts"
   426                 AUDIO_DRIVERS="$AUDIO_DRIVERS arts/libaudio_arts.la"
   427             fi
   428         fi
   429     fi
   430 }
   431 
   432 dnl See if the NAS audio interface is supported
   433 CheckNAS()
   434 {
   435     AC_ARG_ENABLE(nas,
   436 [  --enable-nas            support the NAS audio API [default=yes]],
   437                   , enable_nas=yes)
   438     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   439         AC_MSG_CHECKING(for NAS audio support)
   440         have_nas=no
   441         if test -r /usr/X11R6/include/audio/audiolib.h; then
   442             have_nas=yes
   443             CFLAGS="$CFLAGS -DNAS_SUPPORT -I/usr/X11R6/include/"
   444             SYSTEM_LIBS="$SYSTEM_LIBS -laudio -lXt"
   445             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
   446             AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
   447 
   448         dnl On IRIX, the NAS includes are in a different directory,
   449         dnl and libnas must be explicitly linked in
   450 
   451         elif test -r /usr/freeware/include/nas/audiolib.h; then
   452             have_nas=yes
   453             CFLAGS="$CFLAGS -DNAS_SUPPORT"
   454             SYSTEM_LIBS="$SYSTEM_LIBS -lnas -lXt"
   455             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
   456             AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
   457         fi
   458         AC_MSG_RESULT($have_nas)
   459     fi
   460 }
   461 
   462 dnl rcg07142001 See if the user wants the disk writer audio driver...
   463 CheckDiskAudio()
   464 {
   465     AC_ARG_ENABLE(diskaudio,
   466 [  --enable-diskaudio      support the disk writer audio driver [default=yes]],
   467                   , enable_diskaudio=yes)
   468     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
   469         CFLAGS="$CFLAGS -DDISKAUD_SUPPORT"
   470         AUDIO_SUBDIRS="$AUDIO_SUBDIRS disk"
   471         AUDIO_DRIVERS="$AUDIO_DRIVERS disk/libaudio_disk.la"
   472     fi
   473 }
   474 
   475 dnl Set up the Atari Audio driver
   476 CheckAtariAudio()
   477 {
   478     AC_ARG_ENABLE(mintaudio,
   479 [  --enable-mintaudio      support Atari audio driver [default=yes]],
   480                   , enable_mintaudio=yes)
   481     if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
   482         mintaudio=no
   483         AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
   484         if test x$have_mint_falcon_hdr = xyes; then
   485             mintaudio=yes
   486             CFLAGS="$CFLAGS -DMINTAUDIO_SUPPORT"
   487             AUDIO_SUBDIRS="$AUDIO_SUBDIRS mint"
   488             AUDIO_DRIVERS="$AUDIO_DRIVERS mint/libaudio_mintaudio.la"
   489         fi
   490     fi
   491 }
   492 
   493 dnl Check whether we want to use CoreAudio
   494 CheckCoreAudio()
   495 {
   496     if test x$enable_audio = xyes; then
   497         AC_MSG_CHECKING(for CoreAudio audio support)
   498         have_coreaudio=no
   499         AC_TRY_COMPILE([
   500           #include <AudioUnit/AudioUnit.h>
   501         ],[
   502           AudioUnitInputCallback callback;
   503         ],[
   504         have_coreaudio=yes
   505         ])
   506         AC_MSG_RESULT($have_coreaudio)
   507         # Set up files for the audio library
   508         if test x$have_coreaudio = xyes; then
   509             CFLAGS="$CFLAGS -DCOREAUDIO_SUPPORT"
   510             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macosx"
   511             AUDIO_DRIVERS="$AUDIO_DRIVERS macosx/libaudio_macosx.la"
   512         fi
   513     fi
   514 }
   515 
   516 dnl See if we can use x86 assembly blitters
   517 # NASM is available from: http://nasm.octium.net/
   518 CheckNASM()
   519 {
   520     dnl Make sure we are running on an x86 platform
   521     case $target in
   522         i?86*)
   523             ;;
   524         *)
   525         # Nope, bail early.
   526             return
   527             ;;
   528     esac
   529     dnl Check for NASM (for assembly blit routines)
   530     AC_ARG_ENABLE(nasm,
   531 [  --enable-nasm           use nasm assembly blitters on x86 [default=yes]],
   532                   , enable_nasm=yes)
   533     if test x$enable_video = xyes -a x$enable_nasm = xyes; then
   534         AC_PATH_PROG(NASM, nasm)
   535         if test x$NASM = x -o x$NASM = x'"$NASM"'; then
   536             : # nasm isn't installed
   537         else
   538             CFLAGS="$CFLAGS -DUSE_ASMBLIT -I$srcdir/hermes"
   539             case $ARCH in
   540               win32)
   541                   NASMFLAGS="-f win32"
   542                   ;;
   543               openbsd)
   544                   NASMFLAGS="-f aoutb"
   545                   ;;
   546               *)
   547                   NASMFLAGS="-f elf"
   548                   ;;
   549             esac
   550             AC_SUBST(NASMFLAGS)
   551             CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes"
   552             SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
   553             SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
   554             use_nasm=yes
   555             
   556             case "$target" in
   557                 # this line is needed for QNX, because it's not defined the __ELF__
   558                 *-*-qnx*) CFLAGS="$CFLAGS -D__ELF__"
   559                           ;;
   560 
   561             esac
   562 
   563         fi
   564     fi
   565 }
   566 
   567 dnl Find the nanox include and library directories
   568 CheckNANOX()
   569 {
   570     AC_ARG_ENABLE(video-nanox,
   571         [  --enable-video-nanox use nanox video driver [default=no]],
   572         , enable_video_nanox=no)
   573     AC_ARG_ENABLE(nanox-debug,  
   574         [  --enable-nanox-debug print debug messages [default=no]],
   575         , enable_nanox_debug=no)
   576     AC_ARG_ENABLE(nanox-share-memory,  
   577         [  --enable-nanox-share-memory use share memory [default=no]],
   578         , enable_nanox_share_memory=no)
   579     AC_ARG_ENABLE(nanox_direct_fb, 
   580         [  --enable-nanox-direct-fb use direct framebuffer access [default=no]],
   581         , enable_nanox_direct_fb=no)
   582 
   583     if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
   584         if test x$enable_nanox_debug = xyes; then
   585             CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
   586         fi
   587 
   588         if test x$enable_nanox_share_memory = xyes; then
   589             CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
   590         fi
   591 
   592         if test x$enable_nanox_direct_fb = xyes; then
   593             CFLAGS="$CFLAGS -DENABLE_NANOX_DIRECT_FB"
   594         fi
   595 
   596         CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
   597         SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
   598         VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
   599         VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
   600     fi
   601 }
   602 
   603 dnl Find the X11 include and library directories
   604 CheckX11()
   605 {
   606     AC_ARG_ENABLE(video-x11,
   607 [  --enable-video-x11      use X11 video driver [default=yes]],
   608                   , enable_video_x11=yes)
   609     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
   610         AC_PATH_X
   611         AC_PATH_XTRA
   612         if test x$have_x = xyes; then
   613             CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -DXTHREADS -I$srcdir/include -I$srcdir/src/video"
   614             if test x$ac_cv_func_shmat != xyes; then
   615                 CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
   616             fi
   617             SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
   618             VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
   619             VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"
   620 
   621             AC_ARG_ENABLE(video-x11-vm,
   622 [  --enable-video-x11-vm   use X11 VM extension for fullscreen [default=yes]],
   623                           , enable_video_x11_vm=yes)
   624             if test x$enable_video_x11_vm = xyes; then
   625                 AC_MSG_CHECKING(for XFree86 VidMode 1.0 support)
   626                 video_x11_vm=no
   627                 AC_TRY_COMPILE([
   628                  #include <X11/Xlib.h>
   629                  #include <XFree86/extensions/xf86vmode.h>
   630                 ],[
   631                 ],[
   632                 video_x11_vm=yes
   633                 ])
   634                 AC_MSG_RESULT($video_x11_vm)
   635                 if test x$video_x11_vm = xyes; then
   636                     CFLAGS="$CFLAGS -DXFREE86_VM"
   637                     VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86vm"
   638                     VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86vm/libXFree86_Xxf86vm.la"
   639                     AC_MSG_CHECKING(for XFree86 VidMode gamma support)
   640                     video_x11_vmgamma=no
   641                     AC_TRY_COMPILE([
   642                      #include <X11/Xlib.h>
   643                      #include <XFree86/extensions/xf86vmode.h>
   644                     ],[
   645                      SDL_NAME(XF86VidModeGamma) gamma;
   646                     ],[
   647                     video_x11_vmgamma=yes
   648                     ])
   649                     AC_MSG_RESULT($video_x11_vmgamma)
   650                     if test x$video_x11_vmgamma = xyes; then
   651                         CFLAGS="$CFLAGS -DXFREE86_VMGAMMA"
   652                     fi
   653                 fi
   654             fi
   655             AC_ARG_ENABLE(dga,
   656 [  --enable-dga            allow use of X11 DGA code [default=yes]],
   657                           , enable_dga=yes)
   658             AC_ARG_ENABLE(video-x11-dgamouse,
   659 [  --enable-video-x11-dgamouse  use X11 DGA for mouse events [default=yes]],
   660                           , enable_video_x11_dgamouse=yes)
   661             if test x$enable_dga = xyes; then
   662                 AC_MSG_CHECKING(for XFree86 DGA 1.0 support)
   663                 video_x11_dga=no
   664                 AC_TRY_COMPILE([
   665                  #include <X11/Xlib.h>
   666                  #include <XFree86/extensions/xf86dga.h>
   667                 ],[
   668                 ],[
   669                 video_x11_dga=yes
   670                 ])
   671                 AC_MSG_RESULT($video_x11_dga)
   672                 if test x$video_x11_dga = xyes; then
   673                     CFLAGS="$CFLAGS -DXFREE86_DGAMOUSE"
   674                     if test x$enable_video_x11_dgamouse = xyes; then
   675                         CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE"
   676                     fi
   677                     VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86dga"
   678                     VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86dga/libXFree86_Xxf86dga.la"
   679                 fi
   680             fi
   681             AC_ARG_ENABLE(video-x11-xv,
   682 [  --enable-video-x11-xv   use X11 XvImage extension for video [default=yes]],
   683                           , enable_video_x11_xv=yes)
   684             if test x$enable_video_x11_xv = xyes; then
   685                 AC_MSG_CHECKING(for XFree86 XvImage support)
   686                 video_x11_xv=no
   687                 AC_TRY_COMPILE([
   688                  #include <X11/Xlib.h>
   689                  #include <sys/ipc.h>
   690                  #include <sys/shm.h>
   691                  #include <X11/extensions/XShm.h>
   692                  #include <XFree86/extensions/Xvlib.h>
   693                 ],[
   694                  SDL_NAME(XvImage) *image;
   695                 ],[
   696                 video_x11_xv=yes
   697                 ])
   698                 AC_MSG_RESULT($video_x11_xv)
   699                 if test x$video_x11_xv = xyes; then
   700                     CFLAGS="$CFLAGS -DXFREE86_XV"
   701                     VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xv"
   702                     VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xv/libXFree86_Xv.la"
   703                 fi
   704             fi
   705             AC_ARG_ENABLE(video-x11-xinerama,
   706 [  --enable-video-x11-xinerama   enable X11 Xinerama support [default=yes]],
   707                             , enable_video_x11_xinerama=yes)
   708             if test x$enable_video_x11_xinerama = xyes; then
   709                 AC_MSG_CHECKING(for X11 Xinerama support)
   710                 video_x11_xinerama=no
   711                 AC_TRY_COMPILE([
   712                  #include <X11/Xlib.h>
   713                  #include <XFree86/extensions/Xinerama.h>
   714                 ],[
   715                  SDL_NAME(XineramaScreenInfo) *xinerama;
   716                 ],[
   717                 video_x11_xinerama=yes
   718                 ])
   719                 AC_MSG_RESULT($video_x11_xinerama)
   720                 if test x$video_x11_xinerama = xyes; then
   721                     CFLAGS="$CFLAGS -DHAVE_XINERAMA"
   722                     VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xinerama"
   723                     VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xinerama/libXFree86_Xinerama.la"
   724                 fi
   725             fi
   726             AC_ARG_ENABLE(video-x11-xme,
   727 [  --enable-video-x11-xme  enable Xi Graphics XME for fullscreen [default=yes]],
   728                             , enable_video_x11_xme=yes)
   729             if test x$enable_video_x11_xme = xyes; then
   730                 AC_MSG_CHECKING(for Xi Graphics XiGMiscExtension support)
   731                 video_x11_xme=no
   732                 AC_TRY_COMPILE([
   733                  #include <X11/Xlib.h>
   734                  #include <X11/extensions/xme.h>
   735                 ],[
   736                  XiGMiscResolutionInfo *resolutions;
   737                 ],[
   738                 video_x11_xme=yes
   739                 ])
   740                 AC_MSG_RESULT($video_x11_xme)
   741                 if test x$video_x11_xme = xyes; then
   742                     CFLAGS="$CFLAGS -DHAVE_XIGXME"
   743                     SYSTEM_LIBS="$SYSTEM_LIBS -lxme"
   744                 fi
   745             fi
   746         fi
   747     fi
   748 }
   749 
   750 dnl Find the X11 DGA 2.0 include and library directories
   751 CheckDGA()
   752 {
   753     AC_ARG_ENABLE(video-dga,
   754 [  --enable-video-dga      use DGA 2.0 video driver [default=yes]],
   755                   , enable_video_dga=yes)
   756     if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
   757         save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS -Isrc/video"
   758         AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
   759         video_x11_dga2=no
   760         AC_TRY_COMPILE([
   761          #include <X11/Xlib.h>
   762          #include <XFree86/extensions/xf86dga.h>
   763         ],[
   764          SDL_NAME(XDGAEvent) xevent;
   765         ],[
   766         video_x11_dga2=yes
   767         ])
   768         AC_MSG_RESULT($video_x11_dga2)
   769         if test x$video_x11_dga2 = xyes; then
   770             CFLAGS="$CFLAGS -DENABLE_DGA"
   771             VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
   772             VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
   773         fi
   774     fi
   775 }
   776 
   777 CheckPHOTON()
   778 {
   779     AC_ARG_ENABLE(video-photon,
   780 [  --enable-video-photon   use QNX Photon video driver [default=yes]],
   781                   , enable_video_photon=yes)
   782     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
   783         AC_MSG_CHECKING(for QNX Photon support)
   784         video_photon=no
   785         AC_TRY_COMPILE([
   786           #include <Ph.h>
   787           #include <Pt.h>
   788           #include <photon/Pg.h>
   789           #include <photon/PdDirect.h>
   790         ],[
   791          PgDisplaySettings_t *visual;
   792         ],[
   793         video_photon=yes
   794         ])
   795         AC_MSG_RESULT($video_photon)
   796         if test x$video_photon = xyes; then
   797             CFLAGS="$CFLAGS -DENABLE_PHOTON"
   798             SYSTEM_LIBS="$SYSTEM_LIBS -lph"
   799             VIDEO_SUBDIRS="$VIDEO_SUBDIRS photon"
   800             VIDEO_DRIVERS="$VIDEO_DRIVERS photon/libvideo_photon.la"
   801             CheckOpenGLQNX
   802         fi
   803     fi
   804 }
   805 
   806 dnl Find the framebuffer console includes
   807 CheckFBCON()
   808 {
   809     AC_ARG_ENABLE(video-fbcon,
   810 [  --enable-video-fbcon    use framebuffer console video driver [default=yes]],
   811                   , enable_video_fbcon=yes)
   812     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
   813         AC_MSG_CHECKING(for framebuffer console support)
   814         video_fbcon=no
   815         AC_TRY_COMPILE([
   816          #include <linux/fb.h>
   817          #include <linux/kd.h>
   818          #include <linux/keyboard.h>
   819         ],[
   820         ],[
   821         video_fbcon=yes
   822         ])
   823         AC_MSG_RESULT($video_fbcon)
   824         if test x$video_fbcon = xyes; then
   825             CFLAGS="$CFLAGS -DENABLE_FBCON"
   826             VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon"
   827             VIDEO_DRIVERS="$VIDEO_DRIVERS fbcon/libvideo_fbcon.la"
   828         fi
   829     fi
   830 }
   831 
   832 dnl Find DirectFB
   833 CheckDirectFB()
   834 {
   835     AC_ARG_ENABLE(video-directfb,
   836 [  --enable-video-directfb use DirectFB video driver [default=no]],
   837                   , enable_video_directfb=no)
   838     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
   839         video_directfb=no
   840 
   841         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   842         if test x$PKG_CONFIG = xno ; then
   843             AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
   844         else
   845             AC_MSG_CHECKING(for DirectFB support)
   846 
   847             if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
   848                 AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
   849             fi
   850 
   851             DIRECTFB_REQUIRED_VERSION=0.9.15
   852 
   853             if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
   854                 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
   855                 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
   856                 video_directfb=yes
   857             fi
   858         fi
   859 
   860         AC_MSG_RESULT($video_directfb)
   861         if test x$video_directfb = xyes; then
   862             CFLAGS="$CFLAGS -DENABLE_DIRECTFB"
   863             VIDEO_SUBDIRS="$VIDEO_SUBDIRS directfb"
   864             VIDEO_DRIVERS="$VIDEO_DRIVERS directfb/libvideo_directfb.la"
   865 
   866             AC_SUBST(DIRECTFB_CFLAGS)
   867             AC_SUBST(DIRECTFB_LIBS)
   868         fi
   869     fi
   870 }
   871 
   872 dnl See if we're running on PlayStation 2 hardware
   873 CheckPS2GS()
   874 {
   875     AC_ARG_ENABLE(video-ps2gs,
   876 [  --enable-video-ps2gs    use PlayStation 2 GS video driver [default=yes]],
   877                   , enable_video_ps2gs=yes)
   878     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
   879         AC_MSG_CHECKING(for PlayStation 2 GS support)
   880         video_ps2gs=no
   881         AC_TRY_COMPILE([
   882          #include <linux/ps2/dev.h>
   883          #include <linux/ps2/gs.h>
   884         ],[
   885         ],[
   886         video_ps2gs=yes
   887         ])
   888         AC_MSG_RESULT($video_ps2gs)
   889         if test x$video_ps2gs = xyes; then
   890             CFLAGS="$CFLAGS -DENABLE_PS2GS"
   891             VIDEO_SUBDIRS="$VIDEO_SUBDIRS ps2gs"
   892             VIDEO_DRIVERS="$VIDEO_DRIVERS ps2gs/libvideo_ps2gs.la"
   893         fi
   894     fi
   895 }
   896 
   897 dnl Find the GGI includes
   898 CheckGGI()
   899 {
   900     AC_ARG_ENABLE(video-ggi,
   901 [  --enable-video-ggi      use GGI video driver [default=no]],
   902                   , enable_video_ggi=no)
   903     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
   904         AC_MSG_CHECKING(for GGI support)
   905         video_ggi=no
   906         AC_TRY_COMPILE([
   907          #include <ggi/ggi.h>
   908          #include <ggi/gii.h>
   909         ],[
   910         ],[
   911         video_ggi=yes
   912         ])
   913         AC_MSG_RESULT($video_ggi)
   914         if test x$video_ggi = xyes; then
   915             CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_GGI"
   916             SYSTEM_LIBS="$SYSTEM_LIBS -lggi -lgii -lgg"
   917 
   918             VIDEO_SUBDIRS="$VIDEO_SUBDIRS ggi"
   919             VIDEO_DRIVERS="$VIDEO_DRIVERS ggi/libvideo_ggi.la"
   920         fi
   921     fi
   922 }
   923 
   924 dnl Find the SVGAlib includes and libraries
   925 CheckSVGA()
   926 {
   927     AC_ARG_ENABLE(video-svga,
   928 [  --enable-video-svga     use SVGAlib video driver [default=no]],
   929                   , enable_video_svga=no)
   930     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
   931         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
   932         video_svga=no
   933         AC_TRY_COMPILE([
   934          #include <vga.h>
   935          #include <vgamouse.h>
   936          #include <vgakeyboard.h>
   937         ],[
   938          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
   939              exit(0);
   940          }
   941         ],[
   942         video_svga=yes
   943         ])
   944         AC_MSG_RESULT($video_svga)
   945         if test x$video_svga = xyes; then
   946             CFLAGS="$CFLAGS -DENABLE_SVGALIB"
   947             SYSTEM_LIBS="$SYSTEM_LIBS -lvga"
   948 
   949             VIDEO_SUBDIRS="$VIDEO_SUBDIRS svga"
   950             VIDEO_DRIVERS="$VIDEO_DRIVERS svga/libvideo_svga.la"
   951         fi
   952     fi
   953 }
   954 
   955 dnl Find the VGL includes and libraries
   956 CheckVGL()
   957 {
   958     AC_ARG_ENABLE(video-vgl,
   959 [  --enable-video-vgl      use VGL video driver [default=no]],
   960                   , enable_video_vgl=no)
   961     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
   962         AC_MSG_CHECKING(for libVGL support)
   963         video_vgl=no
   964         AC_TRY_COMPILE([
   965          #include <sys/fbio.h>
   966          #include <sys/consio.h>
   967          #include <sys/kbio.h>
   968          #include <vgl.h>
   969         ],[
   970          VGLBitmap bitmap;
   971          exit(bitmap.Bitmap);
   972         ],[
   973         video_vgl=yes
   974         ])
   975         AC_MSG_RESULT($video_vgl)
   976         if test x$video_vgl = xyes; then
   977             CFLAGS="$CFLAGS -DENABLE_VGL"
   978             SYSTEM_LIBS="$SYSTEM_LIBS -lvgl"
   979 
   980             VIDEO_SUBDIRS="$VIDEO_SUBDIRS vgl"
   981             VIDEO_DRIVERS="$VIDEO_DRIVERS vgl/libvideo_vgl.la"
   982         fi
   983     fi
   984 }
   985 
   986 dnl Find the AAlib includes
   987 CheckAAlib()
   988 {
   989     AC_ARG_ENABLE(video-aalib,
   990 [  --enable-video-aalib    use AAlib video driver [default=no]],
   991                   , enable_video_aalib=no)
   992     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
   993         AC_MSG_CHECKING(for AAlib support)
   994         video_aalib=no
   995         AC_TRY_COMPILE([
   996          #include <aalib.h>
   997         ],[
   998         ],[
   999         video_aalib=yes
  1000         ])
  1001         AC_MSG_RESULT($video_aalib)
  1002         if test x$video_aalib = xyes; then
  1003             CFLAGS="$CFLAGS -DENABLE_AALIB"
  1004             SYSTEM_LIBS="$SYSTEM_LIBS -laa"
  1005 
  1006             VIDEO_SUBDIRS="$VIDEO_SUBDIRS aalib"
  1007             VIDEO_DRIVERS="$VIDEO_DRIVERS aalib/libvideo_aa.la"
  1008         fi
  1009     fi
  1010 }
  1011 
  1012 dnl Set up the Atari Xbios driver
  1013 CheckAtariXbiosVideo()
  1014 {
  1015     AC_ARG_ENABLE(xbios,
  1016 [  --enable-video-xbios    use Atari Xbios video driver [default=yes]],
  1017                   , enable_video_xbios=yes)
  1018     video_xbios=no
  1019     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1020         video_xbios=yes
  1021         CFLAGS="$CFLAGS -DENABLE_XBIOS"
  1022         VIDEO_SUBDIRS="$VIDEO_SUBDIRS xbios"
  1023         VIDEO_DRIVERS="$VIDEO_DRIVERS xbios/libvideo_xbios.la"
  1024     fi
  1025 }
  1026 
  1027 dnl Set up the Atari Gem driver
  1028 CheckAtariGemVideo()
  1029 {
  1030     AC_ARG_ENABLE(gem,
  1031 [  --enable-video-gem      use Atari Gem video driver [default=yes]],
  1032                   , enable_video_gem=yes)
  1033     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1034         video_gem=no
  1035         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1036         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1037         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1038             video_gem=yes
  1039             CFLAGS="$CFLAGS -DENABLE_GEM"
  1040             SYSTEM_LIBS="$SYSTEM_LIBS -lgem"
  1041             VIDEO_SUBDIRS="$VIDEO_SUBDIRS gem"
  1042             VIDEO_DRIVERS="$VIDEO_DRIVERS gem/libvideo_gem.la"
  1043         fi
  1044     fi
  1045 }
  1046 
  1047 dnl Set up the Atari Bios keyboard driver
  1048 CheckAtariBiosEvent()
  1049 {
  1050     CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/ataricommon"
  1051     VIDEO_SUBDIRS="$VIDEO_SUBDIRS ataricommon"
  1052     VIDEO_DRIVERS="$VIDEO_DRIVERS ataricommon/libvideo_ataricommon.la"
  1053 }
  1054 
  1055 dnl rcg04172001 Set up the Null video driver.
  1056 CheckDummyVideo()
  1057 {
  1058     AC_ARG_ENABLE(video-dummy,
  1059 [  --enable-video-dummy    use dummy video driver [default=yes]],
  1060                   , enable_video_dummy=yes)
  1061     if test x$enable_video_dummy = xyes; then
  1062       CFLAGS="$CFLAGS -DENABLE_DUMMYVIDEO"
  1063       VIDEO_SUBDIRS="$VIDEO_SUBDIRS dummy"
  1064       VIDEO_DRIVERS="$VIDEO_DRIVERS dummy/libvideo_null.la"
  1065     fi
  1066 }
  1067 
  1068 dnl Check to see if OpenGL support is desired
  1069 AC_ARG_ENABLE(video-opengl,
  1070 [  --enable-video-opengl   include OpenGL context creation [default=yes]],
  1071               , enable_video_opengl=yes)
  1072 
  1073 dnl Find OpenGL
  1074 CheckOpenGL()
  1075 {
  1076     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1077         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1078         video_opengl=no
  1079         AC_TRY_COMPILE([
  1080          #include <GL/gl.h>
  1081          #include <GL/glx.h>
  1082          #include <dlfcn.h> /* For loading extensions */
  1083         ],[
  1084         ],[
  1085         video_opengl=yes
  1086         ])
  1087         AC_MSG_RESULT($video_opengl)
  1088         if test x$video_opengl = xyes; then
  1089             CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1090             if test x$use_dlopen != xyes; then
  1091                 AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl")
  1092             fi
  1093         fi
  1094     fi
  1095 }
  1096 
  1097 dnl Find QNX RtP OpenGL
  1098 CheckOpenGLQNX()
  1099 {
  1100     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1101         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1102         video_opengl=no
  1103         AC_TRY_COMPILE([
  1104          #include <GL/gl.h>
  1105         ],[
  1106         ],[
  1107         video_opengl=yes
  1108         ])
  1109         AC_MSG_RESULT($video_opengl)
  1110         if test x$video_opengl = xyes; then
  1111             CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1112             SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
  1113             if test x$use_dlopen != xyes; then
  1114                 AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS", AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl"))
  1115             fi
  1116         fi
  1117     fi
  1118 }
  1119 
  1120 dnl Check for BeOS OpenGL
  1121 CheckBeGL()
  1122 {
  1123     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1124         CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1125         SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
  1126     fi
  1127 }
  1128 
  1129 dnl Check for MacOS OpenGL
  1130 CheckMacGL()
  1131 {
  1132     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1133         CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1134         case "$target" in
  1135             *-*-darwin*)
  1136                 SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL -framework AGL"
  1137         esac
  1138     fi
  1139 }
  1140 
  1141 dnl See if we can use the new unified event interface in Linux 2.4
  1142 CheckInputEvents()
  1143 {
  1144     dnl Check for Linux 2.4 unified input event interface support
  1145     AC_ARG_ENABLE(input-events,
  1146 [  --enable-input-events   use Linux 2.4 unified input interface [default=yes]],
  1147                   , enable_input_events=yes)
  1148     if test x$enable_input_events = xyes; then
  1149         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1150         use_input_events=no
  1151         AC_TRY_COMPILE([
  1152           #include <linux/input.h>
  1153         ],[
  1154           #ifndef EVIOCGNAME
  1155           #error EVIOCGNAME() ioctl not available
  1156           #endif
  1157         ],[
  1158         use_input_events=yes
  1159         ])
  1160         AC_MSG_RESULT($use_input_events)
  1161         if test x$use_input_events = xyes; then
  1162             CFLAGS="$CFLAGS -DUSE_INPUT_EVENTS"
  1163         fi
  1164     fi
  1165 }
  1166 
  1167 dnl See if we can use GNU pth library for threads
  1168 CheckPTH()
  1169 {
  1170     dnl Check for pth support
  1171     AC_ARG_ENABLE(pth,
  1172 [  --enable-pth            use GNU pth library for multi-threading [default=yes]],
  1173                   , enable_pth=yes)
  1174     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1175         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1176         if test "$PTH_CONFIG" = "no"; then
  1177             use_pth=no
  1178         else
  1179             PTH_CFLAGS=`$PTH_CONFIG --cflags`
  1180             PTH_LIBS=`$PTH_CONFIG --libs --all`
  1181             SDL_CFLAGS="$SDL_CFLAGS $PTH_CFLAGS"
  1182             SDL_LIBS="$SDL_LIBS $PTH_LIBS"
  1183             CFLAGS="$CFLAGS -DENABLE_PTH"
  1184             use_pth=yes
  1185         fi
  1186         AC_MSG_CHECKING(pth)
  1187         if test "x$use_pth" = xyes; then
  1188             AC_MSG_RESULT(yes)
  1189         else
  1190             AC_MSG_RESULT(no)
  1191         fi
  1192     fi
  1193 }
  1194 
  1195 dnl See what type of thread model to use on Linux and Solaris
  1196 CheckPTHREAD()
  1197 {
  1198     dnl Check for pthread support
  1199     AC_ARG_ENABLE(pthreads,
  1200 [  --enable-pthreads       use POSIX threads for multi-threading [default=yes]],
  1201                   , enable_pthreads=yes)
  1202     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1203     AC_ARG_ENABLE(pthread-sem,
  1204 [  --enable-pthread-sem    use pthread semaphores [default=yes]],
  1205                   , enable_pthread_sem=yes)
  1206     case "$target" in
  1207         *-*-bsdi*)
  1208             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1209             pthread_lib=""
  1210             ;;
  1211         *-*-darwin*)
  1212             pthread_cflags="-D_THREAD_SAFE"
  1213 # causes Carbon.p complaints?
  1214 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1215             ;;
  1216         *-*-freebsd*)
  1217             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1218             pthread_lib="-pthread"
  1219             ;;
  1220         *-*-netbsd*)
  1221             pthread_cflags="-I/usr/pkg/include -D_REENTRANT"
  1222             pthread_lib="-L/usr/pkg/lib -lpthread -lsem"
  1223             ;;
  1224         *-*-openbsd*)
  1225             pthread_cflags="-D_REENTRANT"
  1226             pthread_lib="-pthread"
  1227             ;;
  1228         *-*-solaris*)
  1229             pthread_cflags="-D_REENTRANT"
  1230             pthread_lib="-lpthread -lposix4"
  1231             ;;
  1232         *-*-sysv5*)
  1233             pthread_cflags="-D_REENTRANT -Kthread"
  1234             pthread_lib=""
  1235             ;;
  1236         *-*-irix*)
  1237             pthread_cflags="-D_SGI_MP_SOURCE"
  1238             pthread_lib="-lpthread"
  1239             ;;
  1240         *-*-aix*)
  1241             pthread_cflags="-D_REENTRANT -mthreads"
  1242             pthread_lib="-lpthread"
  1243             ;;
  1244         *-*-hpux11*)
  1245             pthread_cflags="-D_REENTRANT"
  1246             pthread_lib="-L/usr/lib -lpthread"
  1247             ;;
  1248         *-*-qnx*)
  1249             pthread_cflags=""
  1250             pthread_lib=""
  1251             ;;
  1252         *-*-osf*)
  1253             if test x$ac_cv_prog_gcc = xyes; then
  1254                 pthread_cflags="-D_REENTRANT"
  1255                 pthread_lib="-lpthread -lrt"
  1256             else
  1257                 pthread_cflags="-pthread"
  1258                 pthread_lib="-lpthread -lrt"
  1259             fi
  1260             ;;
  1261         *)
  1262             pthread_cflags="-D_REENTRANT"
  1263             pthread_lib="-lpthread"
  1264             ;;
  1265     esac
  1266     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1267         # Save the original compiler flags and libraries
  1268         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1269         # Add the pthread compiler flags and libraries
  1270         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1271         # Check to see if we have pthread support on this system
  1272         AC_MSG_CHECKING(for pthreads)
  1273         use_pthreads=no
  1274         AC_TRY_LINK([
  1275          #include <pthread.h>
  1276         ],[
  1277          pthread_attr_t type;
  1278          pthread_attr_init(&type);
  1279         ],[
  1280         use_pthreads=yes
  1281         ])
  1282         AC_MSG_RESULT($use_pthreads)
  1283         # Restore the compiler flags and libraries
  1284         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1285         # Do futher testing if we have pthread support...
  1286         if test x$use_pthreads = xyes; then
  1287             CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
  1288             LIBS="$LIBS $pthread_lib"
  1289             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1290             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1291 
  1292             # Check to see if recursive mutexes are available
  1293             AC_MSG_CHECKING(for recursive mutexes)
  1294             has_recursive_mutexes=no
  1295             AC_TRY_LINK([
  1296               #include <pthread.h>
  1297             ],[
  1298               pthread_mutexattr_t attr;
  1299               #if defined(linux) && !(defined(__arm__) && defined(QWS))
  1300               pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1301               #else
  1302               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1303               #endif
  1304             ],[
  1305             has_recursive_mutexes=yes
  1306             ])
  1307             # Some systems have broken recursive mutex implementations
  1308             case "$target" in
  1309                 *-*-darwin*)
  1310                     has_recursive_mutexes=no
  1311                     ;;
  1312                 *-*-solaris*)
  1313                     has_recursive_mutexes=no
  1314                     ;;
  1315             esac
  1316             AC_MSG_RESULT($has_recursive_mutexes)
  1317             if test x$has_recursive_mutexes != xyes; then
  1318                 CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
  1319             fi
  1320 
  1321             # Check to see if pthread semaphore support is missing
  1322             if test x$enable_pthread_sem = xyes; then
  1323                 AC_MSG_CHECKING(for pthread semaphores)
  1324                 have_pthread_sem=no
  1325                 AC_TRY_COMPILE([
  1326                   #include <pthread.h>
  1327                   #include <semaphore.h>
  1328                 ],[
  1329                 ],[
  1330                 have_pthread_sem=yes
  1331                 ])
  1332                 AC_MSG_RESULT($have_pthread_sem)
  1333             fi
  1334 
  1335             # Check to see if this is broken glibc 2.0 pthreads
  1336             case "$target" in
  1337                 *-*-linux*)
  1338                     AC_MSG_CHECKING(for broken glibc 2.0 pthreads)
  1339                     glibc20_pthreads=no
  1340                     AC_TRY_COMPILE([
  1341                       #include <features.h>
  1342                       #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
  1343                       #warning Working around a bug in glibc 2.0 pthreads
  1344                       #else
  1345                       #error pthread implementation okay
  1346                       #endif /* glibc 2.0 */
  1347                     ],[
  1348                     ],[
  1349                     glibc20_pthreads=yes
  1350                     ])
  1351                     AC_MSG_RESULT($glibc20_pthreads)
  1352             esac
  1353         fi
  1354     fi
  1355 
  1356     AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
  1357     have_semun=no
  1358     AC_TRY_COMPILE([
  1359       #include <sys/types.h>
  1360       #include <sys/sem.h>
  1361     ],[
  1362       union semun t;
  1363     ],[
  1364     have_semun=yes
  1365     ])
  1366     AC_MSG_RESULT($have_semun)
  1367     if test x$have_semun = xyes; then
  1368         CFLAGS="$CFLAGS -DHAVE_SEMUN"
  1369     fi
  1370 
  1371     # See if we can use GNU Pth or clone() on Linux directly
  1372     if test x$enable_threads = xyes -a x$use_pthreads != xyes; then
  1373         CheckPTH
  1374         if test x$use_pth != xyes; then
  1375             case "$target" in
  1376                 *-*-linux*)
  1377                     use_clone=yes
  1378                     ;;
  1379             esac
  1380         fi
  1381     fi
  1382 }
  1383 
  1384 # Note that we need to have either semaphores or to have mutexes and
  1385 # condition variables to implement all thread synchronization primitives
  1386 CopyUnixThreadSource()
  1387 {
  1388     if test x$use_pthreads = xyes -o x$use_clone = xyes; then
  1389         # Basic thread creation functions
  1390         COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1391         COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1392 
  1393         # Semaphores
  1394         # We can fake these with mutexes and condition variables if necessary
  1395         if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
  1396             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1397         else
  1398             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1399         fi
  1400         COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1401 
  1402         # Mutexes
  1403         # We can fake these with semaphores if necessary
  1404         case "$target" in
  1405             *-*-bsdi*)
  1406                 COPY_ARCH_SRC(src/thread, bsdi, SDL_syssem.c)
  1407                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1408                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1409                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1410                 ;;
  1411             *)
  1412                 if test x$glibc20_pthreads = xyes; then
  1413                     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1414                     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1415                 else
  1416                     COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1417                     COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1418                 fi
  1419                 ;;
  1420         esac
  1421 
  1422         # Condition variables
  1423         # We can fake these with semaphores and mutexes if necessary
  1424         if test x$glibc20_pthreads = xyes -o x$has_recursive_mutexes != xyes; then
  1425             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1426         else
  1427             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1428         fi
  1429         COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1430 
  1431     elif test x$use_pth = xyes; then
  1432         COPY_ARCH_SRC(src/thread, pth, SDL_systhread.c)
  1433         COPY_ARCH_SRC(src/thread, pth, SDL_systhread_c.h)
  1434         COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex.c)
  1435         COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex_c.h)
  1436         COPY_ARCH_SRC(src/thread, pth, SDL_syscond.c)
  1437         COPY_ARCH_SRC(src/thread, pth, SDL_syscond_c.h)
  1438         COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1439         COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1440     else
  1441        AC_MSG_ERROR([
  1442 *** No thread support detected
  1443        ])
  1444     fi
  1445 }
  1446 
  1447 dnl See if we can use sigaction() instead of signal()
  1448 CheckSIGACTION()
  1449 {
  1450     dnl Check for sigaction support
  1451     AC_ARG_ENABLE(sigaction,
  1452 [  --enable-sigaction      use sigaction instead of signal [default=yes]],
  1453                   , enable_sigaction=yes)
  1454     if test x$enable_sigaction = xyes; then
  1455         AC_MSG_CHECKING(sigaction)
  1456         have_sigaction=no
  1457         AC_TRY_COMPILE([
  1458          #include <signal.h>
  1459         ],[
  1460          struct sigaction junk;
  1461          sigaction(0, &junk, &junk);
  1462         ],[
  1463         have_sigaction=yes
  1464         ])
  1465         AC_MSG_RESULT($have_sigaction)
  1466         if test x$have_sigaction = xyes; then
  1467             CFLAGS="$CFLAGS -DHAVE_SIGACTION"
  1468         fi
  1469     fi
  1470 }
  1471 
  1472 dnl Determine whether the compiler can produce Win32 executables
  1473 CheckWIN32()
  1474 {
  1475     AC_MSG_CHECKING(Win32 compiler)
  1476     have_win32_gcc=no
  1477     AC_TRY_COMPILE([
  1478      #include <windows.h>
  1479     ],[
  1480     ],[
  1481     have_win32_gcc=yes
  1482     ])
  1483     AC_MSG_RESULT($have_win32_gcc)
  1484     if test x$have_win32_gcc != xyes; then
  1485        AC_MSG_ERROR([
  1486 *** Your compiler ($CC) does not produce Win32 executables!
  1487        ])
  1488     fi
  1489 
  1490     dnl See if the user wants to redirect standard output to files
  1491     AC_ARG_ENABLE(stdio-redirect,
  1492 [  --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]],
  1493                   , enable_stdio_redirect=yes)
  1494     if test x$enable_stdio_redirect != xyes; then
  1495         CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT"
  1496     fi
  1497 }
  1498 
  1499 dnl Find the DirectX includes and libraries
  1500 CheckDIRECTX()
  1501 {
  1502     AC_ARG_ENABLE(directx,
  1503 [  --enable-directx        use DirectX for Win32 audio/video [default=yes]],
  1504                   , enable_directx=yes)
  1505     if test x$enable_directx = xyes; then
  1506         AC_MSG_CHECKING(for DirectX headers and libraries)
  1507         use_directx=no
  1508         tmp_cflags=$CFLAGS
  1509         CFLAGS="$CFLAGS -I$srcdir"
  1510         AC_TRY_COMPILE([
  1511          #include "src/video/windx5/directx.h"
  1512         ],[
  1513         ],[
  1514         use_directx=yes
  1515         ])
  1516         CFLAGS=$tmp_cflags
  1517         AC_MSG_RESULT($use_directx)
  1518     fi
  1519 
  1520     CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
  1521     SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
  1522     VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
  1523     VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
  1524     # Enable the DIB driver
  1525     CFLAGS="$CFLAGS -DENABLE_WINDIB"
  1526     VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
  1527     VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
  1528     # See if we should enable the DirectX driver
  1529     if test x$use_directx = xyes; then
  1530         CFLAGS="$CFLAGS -DENABLE_DIRECTX"
  1531         SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
  1532         VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
  1533         VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
  1534     fi
  1535 }
  1536 
  1537 dnl Set up the BWindow video driver on BeOS
  1538 CheckBWINDOW()
  1539 {
  1540     CFLAGS="$CFLAGS -DENABLE_BWINDOW"
  1541     VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
  1542     VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
  1543 }
  1544 
  1545 dnl Set up the QTopia video driver if enabled
  1546 CheckQtopia()
  1547 {
  1548     AC_ARG_ENABLE(video-qtopia,
  1549 [  --enable-video-qtopia   use Qtopia video driver [default=no]],
  1550                   , enable_video_qtopia=no)
  1551     if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
  1552         AC_MSG_CHECKING(for Qtopia support)
  1553         video_qtopia=no
  1554         AC_LANG_CPLUSPLUS
  1555         OLD_CXX="$CXXFLAGS"
  1556         CXXFLAGS="-DQT_QWS_EBX -fno-rtti -fno-exceptions -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG"
  1557         AC_TRY_COMPILE([
  1558          #include <qpe/qpeapplication.h>
  1559         ],[
  1560         ],[
  1561         video_qtopia=yes
  1562         ])
  1563         CXXFLAGS="$OLD_CXX"
  1564         AC_MSG_RESULT($video_qtopia)
  1565         if test x$video_qtopia = xyes; then
  1566             CFLAGS="$CFLAGS -DENABLE_QTOPIA -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
  1567             SDL_LIBS="$SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
  1568             SDL_CFLAGS="$SDL_CFLAGS -DQWS"	  
  1569             VIDEO_SUBDIRS="$VIDEO_SUBDIRS qtopia"
  1570             VIDEO_DRIVERS="$VIDEO_DRIVERS qtopia/libvideo_qtopia.la"
  1571         else
  1572 	AC_MSG_ERROR([
  1573 *** Failed to find Qtopia includes. Make sure that the QTDIR and QPEDIR
  1574 *** environment variables are set correctly.])
  1575         fi
  1576         AC_LANG_C
  1577     fi
  1578 }
  1579 
  1580 dnl Set up the PicoGUI video driver if enabled
  1581 CheckPicoGUI()
  1582 {
  1583     AC_ARG_ENABLE(video-picogui,
  1584 [  --enable-video-picogui  use PicoGUI video driver [default=no]],
  1585                   , enable_video_picogui=no)
  1586     if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
  1587         AC_MSG_CHECKING(for PicoGUI support)
  1588         video_picogui=no
  1589         AC_TRY_COMPILE([
  1590          #include <picogui.h>
  1591         ],[
  1592         ],[
  1593         video_picogui=yes
  1594         ])
  1595         AC_MSG_RESULT($video_picogui)
  1596         if test x$video_picogui = xyes; then
  1597 	    SDL_LIBS="$SDL_LIBS -lpgui"
  1598             CFLAGS="$CFLAGS -DENABLE_PICOGUI"
  1599             VIDEO_SUBDIRS="$VIDEO_SUBDIRS picogui"
  1600             VIDEO_DRIVERS="$VIDEO_DRIVERS picogui/libvideo_picogui.la"
  1601         fi
  1602         AC_LANG_C
  1603     fi
  1604 }
  1605 
  1606 dnl Set up the Mac toolbox video driver for Mac OS 7-9
  1607 CheckTOOLBOX()
  1608 {
  1609     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
  1610     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
  1611     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
  1612     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
  1613 }
  1614 
  1615 dnl Set up the Mac toolbox video driver for Mac OS X
  1616 CheckCARBON()
  1617 {
  1618     # "MACOSX" is not an official definition, but it's commonly
  1619     # accepted as a way to differentiate between what runs on X
  1620     # and what runs on older Macs - while in theory "Carbon" defns
  1621     # are consistent between the two, in practice Carbon is still
  1622     # changing. -sts Aug 2000
  1623     mac_autoconf_target_workaround="MAC"
  1624     CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
  1625       -fpascal-strings -DENABLE_TOOLBOX -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/maccommon -I\$(top_srcdir)/src/video/macrom -I\$(top_srcdir)/src/video/macdsp"
  1626     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
  1627     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
  1628     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
  1629     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
  1630 }
  1631 
  1632 dnl Set up the Mac toolbox video driver for Mac OS X
  1633 CheckQUARTZ()
  1634 {
  1635     # "MACOSX" is not an official definition, but it's commonly
  1636     # accepted as a way to differentiate between what runs on X
  1637     # and what runs on older Macs - while in theory "Carbon" defns
  1638     # are consistent between the two, in practice Carbon is still
  1639     # changing. -sts Aug 2000
  1640     mac_autoconf_target_workaround="MAC"
  1641     CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
  1642       -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
  1643       -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
  1644     VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
  1645     VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
  1646 }
  1647 
  1648 dnl Check for the dlfcn.h interface for dynamically loading objects
  1649 CheckDLOPEN()
  1650 {
  1651     AC_ARG_ENABLE(sdl-dlopen,
  1652 [  --enable-sdl-dlopen     use dlopen for shared object loading [default=yes]],
  1653                   , enable_sdl_dlopen=yes)
  1654     if test x$enable_sdl_dlopen = xyes; then
  1655         AC_MSG_CHECKING(for dlopen)
  1656         use_dlopen=no
  1657         AC_TRY_COMPILE([
  1658          #include <dlfcn.h>
  1659         ],[
  1660         ],[
  1661         use_dlopen=yes
  1662         ])
  1663         AC_MSG_RESULT($use_dlopen)
  1664 
  1665         if test x$use_dlopen = xyes; then
  1666             CFLAGS="$CFLAGS -DUSE_DLOPEN"
  1667             AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS",
  1668                AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl",
  1669                   AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl")))
  1670         fi
  1671     fi
  1672 }
  1673 
  1674 dnl Set up the Atari LDG (shared object loader)
  1675 CheckAtariLdg()
  1676 {
  1677     AC_ARG_ENABLE(atari-ldg,
  1678 [  --enable-atari-ldg      use Atari LDG for shared object loading [default=yes]],
  1679                   , enable_atari_ldg=yes)
  1680     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1681         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1682         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1683         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1684             CFLAGS="$CFLAGS -DENABLE_LDG"
  1685             SYSTEM_LIBS="$SYSTEM_LIBS -lldg -lgem"
  1686         fi
  1687     fi
  1688 }
  1689 
  1690 dnl Check for the usbhid(3) library on *BSD
  1691 CheckUSBHID()
  1692 {
  1693     if test x$enable_joystick = xyes; then
  1694         have_libusbhid=no
  1695         have_libusb=no
  1696         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1697         AC_CHECK_LIB(usb, hid_init, have_libusb=yes)
  1698         if test x$have_libusbhid = xyes; then
  1699             SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
  1700         fi
  1701         if test x$have_libusb = xyes; then
  1702             SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
  1703         fi
  1704 
  1705         AC_CHECK_HEADER(usb.h, have_usb_h=yes)
  1706         AC_CHECK_HEADER(usbhid.h, have_usbhid_h=yes)
  1707         AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
  1708         AC_CHECK_HEADER(libusbhid.h, have_libusbhid_h=yes)
  1709         if test x$have_usb_h = xyes; then
  1710             CFLAGS="$CFLAGS -DHAVE_USB_H"
  1711         fi
  1712         if test x$have_usbhid_h = xyes; then
  1713             CFLAGS="$CFLAGS -DHAVE_USBHID_H"
  1714         fi
  1715         if test x$have_libusb_h = xyes; then
  1716             CFLAGS="$CFLAGS -DHAVE_LIBUSB_H"
  1717         fi
  1718         if test x$have_libusbhid_h = xyes; then
  1719             CFLAGS="$CFLAGS -DHAVE_LIBUSBHID_H"
  1720         fi
  1721 
  1722         AC_MSG_CHECKING(for usbhid)
  1723         have_usbhid=no
  1724         AC_TRY_COMPILE([
  1725           #include <sys/types.h>
  1726           #if defined(HAVE_USB_H)
  1727           #include <usb.h>
  1728           #endif
  1729           #include <dev/usb/usb.h>
  1730           #include <dev/usb/usbhid.h>
  1731           #if defined(HAVE_USBHID_H)
  1732           #include <usbhid.h>
  1733           #elif defined(HAVE_LIBUSB_H)
  1734           #include <libusb.h>
  1735           #elif defined(HAVE_LIBUSBHID_H)
  1736           #include <libusbhid.h>
  1737           #endif
  1738         ],[
  1739           struct report_desc *repdesc;
  1740           struct usb_ctl_report *repbuf;
  1741           hid_kind_t hidkind;
  1742         ],[
  1743         have_usbhid=yes
  1744         ])
  1745         AC_MSG_RESULT($have_usbhid)
  1746 
  1747         if test x$have_usbhid = xyes; then
  1748             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1749             have_usbhid_ucr_data=no
  1750             AC_TRY_COMPILE([
  1751               #include <sys/types.h>
  1752               #if defined(HAVE_USB_H)
  1753               #include <usb.h>
  1754               #endif
  1755               #include <dev/usb/usb.h>
  1756               #include <dev/usb/usbhid.h>
  1757               #if defined(HAVE_USBHID_H)
  1758               #include <usbhid.h>
  1759               #elif defined(HAVE_LIBUSB_H)
  1760               #include <libusb.h>
  1761               #elif defined(HAVE_LIBUSBHID_H)
  1762               #include <libusbhid.h>
  1763               #endif
  1764             ],[
  1765               struct usb_ctl_report buf;
  1766               if (buf.ucr_data) { }
  1767             ],[
  1768             have_usbhid_ucr_data=yes
  1769             ])
  1770             if test x$have_usbhid_ucr_data = xyes; then
  1771                 CFLAGS="$CFLAGS -DUSBHID_UCR_DATA"
  1772             fi
  1773             AC_MSG_RESULT($have_usbhid_ucr_data)
  1774             
  1775 	    AC_MSG_CHECKING(for new usbhid API)
  1776             have_usbhid_new=no
  1777             AC_TRY_COMPILE([
  1778               #include <sys/types.h>
  1779               #if defined(HAVE_USB_H)
  1780               #include <usb.h>
  1781               #endif
  1782               #include <dev/usb/usb.h>
  1783               #include <dev/usb/usbhid.h>
  1784               #if defined(HAVE_USBHID_H)
  1785               #include <usbhid.h>
  1786               #elif defined(HAVE_LIBUSB_H)
  1787               #include <libusb.h>
  1788               #elif defined(HAVE_LIBUSBHID_H)
  1789               #include <libusbhid.h>
  1790               #endif
  1791             ],[
  1792               report_desc_t d;
  1793 	      hid_start_parse(d, 1, 1);
  1794             ],[
  1795             have_usbhid_new=yes
  1796             ])
  1797             if test x$have_usbhid_new = xyes; then
  1798                 CFLAGS="$CFLAGS -DUSBHID_NEW"
  1799             fi
  1800             AC_MSG_RESULT($have_usbhid_new)
  1801 
  1802             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
  1803             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
  1804         fi
  1805     fi
  1806 }
  1807 
  1808 dnl Check for altivec instruction support using gas syntax
  1809 CheckAltivec()
  1810 {
  1811     AC_MSG_CHECKING(for GCC Altivec instruction support)
  1812     have_gcc_altivec=no
  1813     AC_TRY_COMPILE([
  1814     ],[
  1815         asm volatile ("mtspr 256, %0\n\t"
  1816                       "vand %%v0, %%v0, %%v0"
  1817                       :
  1818                       : "r" (-1));
  1819     ],[
  1820     have_gcc_altivec=yes
  1821     ])
  1822     if test x$have_gcc_altivec = xyes; then
  1823         CFLAGS="$CFLAGS -DGCC_ALTIVEC"
  1824     fi
  1825     AC_MSG_RESULT($have_gcc_altivec)
  1826 }
  1827 
  1828 case "$target" in
  1829     *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu)
  1830         case "$target" in
  1831           *-*-linux*) ARCH=linux ;;
  1832           *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
  1833           *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
  1834           *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
  1835           *-*-gnu*) ARCH=gnu ;; # must be last
  1836         esac
  1837         CheckDummyVideo
  1838         CheckDiskAudio
  1839         CheckDLOPEN
  1840         CheckNASM
  1841         CheckOSS
  1842         CheckALSA
  1843         CheckARTSC
  1844         CheckESD
  1845         CheckNAS
  1846         CheckX11
  1847         CheckNANOX
  1848         CheckDGA
  1849         CheckFBCON
  1850         CheckDirectFB
  1851         CheckPS2GS
  1852         CheckGGI
  1853         CheckSVGA
  1854         CheckAAlib
  1855         CheckQtopia
  1856         CheckPicoGUI
  1857         CheckOpenGL
  1858         CheckInputEvents
  1859         CheckPTHREAD
  1860         CheckSIGACTION
  1861         CheckAltivec
  1862         # Set up files for the main() stub
  1863         if test "x$video_qtopia" = "xyes"; then
  1864           SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  1865           SDL_LIBS="-lSDLmain $SDL_LIBS"
  1866         fi
  1867         # Set up files for the audio library
  1868         # We use the OSS and ALSA API's, not the Sun audio API
  1869         #if test x$enable_audio = xyes; then
  1870         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1871         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1872         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1873         #fi
  1874         # Set up files for the joystick library
  1875         if test x$enable_joystick = xyes; then
  1876 	  case $ARCH in
  1877 	    linux)
  1878               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
  1879               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
  1880 	    ;;
  1881 	    gnu)
  1882               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1883               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1884 	    ;;
  1885 	    k*bsd-gnu)
  1886               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
  1887               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
  1888 	    ;;
  1889 	  esac
  1890         fi
  1891         # Set up files for the cdrom library
  1892         if test x$enable_cdrom = xyes; then
  1893 	  case $ARCH in
  1894 	    linux)
  1895               CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
  1896               CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
  1897 	    ;;
  1898 	    gnu)
  1899               CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  1900               CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  1901 	    ;;
  1902 	    kfreebsd-gnu)
  1903               CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
  1904               CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
  1905 	    ;;
  1906 	    knetbsd-gnu|kopenbsd-gnu)
  1907               CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  1908               CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  1909 	    ;;
  1910 	  esac
  1911         fi
  1912         # Set up files for the thread library
  1913         if test x$enable_threads = xyes; then
  1914             CopyUnixThreadSource
  1915         fi
  1916         # Set up files for the timer library
  1917         if test x$enable_timers = xyes; then
  1918             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1919         fi
  1920         ;;
  1921     *-*-bsdi*)
  1922         ARCH=bsdi
  1923         CheckDummyVideo
  1924         CheckDiskAudio
  1925         CheckDLOPEN
  1926         CheckNASM
  1927         CheckOSS
  1928         CheckARTSC
  1929         CheckESD
  1930         CheckNAS
  1931         CheckX11
  1932         CheckDGA
  1933         CheckSVGA
  1934         CheckAAlib
  1935         CheckOpenGL
  1936         CheckPTHREAD
  1937         CheckSIGACTION
  1938         # Set up files for the audio library
  1939         # We use the OSS and ALSA API's, not the Sun audio API
  1940         #if test x$enable_audio = xyes; then
  1941         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1942         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1943         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1944         #fi
  1945         # Set up files for the joystick library
  1946         # (No joystick support yet)
  1947         if test x$enable_joystick = xyes; then
  1948             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1949             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1950         fi
  1951         # Set up files for the cdrom library
  1952         if test x$enable_cdrom = xyes; then
  1953             CDROM_SUBDIRS="$CDROM_SUBDIRS bsdi"
  1954             CDROM_DRIVERS="$CDROM_DRIVERS bsdi/libcdrom_bsdi.la"
  1955         fi
  1956         # Set up files for the thread library
  1957         if test x$enable_threads = xyes; then
  1958             CopyUnixThreadSource
  1959         fi
  1960         # Set up files for the timer library
  1961         if test x$enable_timers = xyes; then
  1962             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1963         fi
  1964         ;;
  1965     *-*-freebsd*)
  1966         ARCH=freebsd
  1967         CheckDummyVideo
  1968         CheckDiskAudio
  1969         CheckDLOPEN
  1970         CheckVGL
  1971         CheckNASM
  1972         CheckOSS
  1973         CheckARTSC
  1974         CheckESD
  1975         CheckNAS
  1976         CheckX11
  1977         CheckDGA
  1978         CheckSVGA
  1979         CheckAAlib
  1980         CheckOpenGL
  1981         CheckPTHREAD
  1982         CheckSIGACTION
  1983         CheckUSBHID
  1984         # Set up files for the audio library
  1985         # We use the OSS and ALSA API's, not the Sun audio API
  1986         #if test x$enable_audio = xyes; then
  1987         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1988         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1989         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1990         #fi
  1991         # Set up files for the cdrom library
  1992         if test x$enable_cdrom = xyes; then
  1993             CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
  1994             CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
  1995         fi
  1996         # Set up files for the thread library
  1997         if test x$enable_threads = xyes; then
  1998             CopyUnixThreadSource
  1999         fi
  2000         # Set up files for the timer library
  2001         if test x$enable_timers = xyes; then
  2002             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2003         fi
  2004         ;;
  2005     *-*-netbsd*)
  2006         ARCH=netbsd
  2007         CheckDummyVideo
  2008         CheckDiskAudio
  2009         CheckDLOPEN
  2010         CheckNASM
  2011         CheckOSS
  2012         CheckARTSC
  2013         CheckESD
  2014         CheckNAS
  2015         CheckX11
  2016         CheckAAlib
  2017         CheckOpenGL
  2018         CheckPTHREAD
  2019         CheckSIGACTION
  2020         CheckUSBHID
  2021         # Set up files for the audio library
  2022         if test x$enable_audio = xyes; then
  2023             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2024             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2025             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2026         fi
  2027         # Set up files for the cdrom library
  2028         if test x$enable_cdrom = xyes; then
  2029             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  2030             CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  2031         fi
  2032         # Set up files for the thread library
  2033         if test x$enable_threads = xyes; then
  2034             if test x$use_pthreads = xyes; then
  2035                 CFLAGS="$CFLAGS -D_POSIX_THREAD_SYSCALL_SOFT=1"
  2036             fi
  2037             CopyUnixThreadSource
  2038         fi
  2039         # Set up files for the timer library
  2040         if test x$enable_timers = xyes; then
  2041             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2042         fi
  2043         # NetBSD does not define "unix"
  2044         CFLAGS="$CFLAGS -Dunix"
  2045         ;;
  2046     *-*-openbsd*)
  2047         ARCH=openbsd
  2048         CheckDummyVideo
  2049         CheckDiskAudio
  2050         CheckDLOPEN
  2051         CheckNASM
  2052         CheckOSS
  2053         CheckARTSC
  2054         CheckESD
  2055         CheckNAS
  2056         CheckX11
  2057         CheckAAlib
  2058         CheckOpenGL
  2059         CheckPTHREAD
  2060         CheckSIGACTION
  2061         CheckUSBHID
  2062         # Set up files for the audio library
  2063         if test x$enable_audio = xyes; then
  2064             CFLAGS="$CFLAGS -DOPENBSD_AUDIO_SUPPORT"
  2065             AUDIO_SUBDIRS="$AUDIO_SUBDIRS openbsd"
  2066             AUDIO_DRIVERS="$AUDIO_DRIVERS openbsd/libaudio_openbsd.la"
  2067         fi
  2068         # OpenBSD needs linking with ossaudio emulation library
  2069         if test x$have_oss = xyes; then
  2070             SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio"
  2071         fi
  2072         # Set up files for the cdrom library
  2073         if test x$enable_cdrom = xyes; then
  2074             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  2075             CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  2076         fi
  2077         # Set up files for the thread library
  2078         if test x$enable_threads = xyes; then
  2079             CopyUnixThreadSource
  2080         fi
  2081         # Set up files for the timer library
  2082         if test x$enable_timers = xyes; then
  2083             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2084         fi
  2085         # OpenBSD does not define "unix"
  2086         CFLAGS="$CFLAGS -Dunix"
  2087         ;;
  2088     *-*-sysv5*)
  2089         ARCH=sysv5
  2090         CheckDummyVideo
  2091         CheckDiskAudio
  2092         CheckDLOPEN
  2093         CheckNASM
  2094         CheckOSS
  2095         CheckARTSC
  2096         CheckESD
  2097         CheckNAS
  2098         CheckX11
  2099         CheckAAlib
  2100         CheckOpenGL
  2101         CheckPTHREAD
  2102         CheckSIGACTION
  2103         # Set up files for the audio library
  2104         if test x$enable_audio = xyes; then
  2105             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2106             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2107             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2108         fi
  2109         # Set up files for the joystick library
  2110         # (No joystick support yet)
  2111         if test x$enable_joystick = xyes; then
  2112             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2113             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2114         fi
  2115         # Set up files for the cdrom library
  2116         if test x$enable_cdrom = xyes; then
  2117             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2118             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2119         fi
  2120         # Set up files for the thread library
  2121         if test x$enable_threads = xyes; then
  2122             CopyUnixThreadSource
  2123         fi
  2124         # Set up files for the timer library
  2125         if test x$enable_timers = xyes; then
  2126             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2127         fi
  2128         ;;
  2129     *-*-solaris*)
  2130         ARCH=solaris
  2131         CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
  2132         CheckDummyVideo
  2133         CheckDiskAudio
  2134         CheckDLOPEN
  2135         CheckNASM
  2136         CheckOSS
  2137         CheckARTSC
  2138         CheckESD
  2139         CheckNAS
  2140         CheckX11
  2141         CheckAAlib
  2142         CheckOpenGL
  2143         CheckPTHREAD
  2144         CheckSIGACTION
  2145         # Set up files for the audio library
  2146         if test x$enable_audio = xyes; then
  2147             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2148             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2149             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2150         fi
  2151         # Set up files for the joystick library
  2152         # (No joystick support yet)
  2153         if test x$enable_joystick = xyes; then
  2154             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2155             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2156         fi
  2157         # Set up files for the cdrom library
  2158         if test x$enable_cdrom = xyes; then
  2159             CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
  2160             CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
  2161         fi
  2162         # Set up files for the thread library
  2163         if test x$enable_threads = xyes; then
  2164             CopyUnixThreadSource
  2165         fi
  2166         # Set up files for the timer library
  2167         if test x$enable_timers = xyes; then
  2168             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2169         fi
  2170         ;;
  2171     *-*-irix*)
  2172         ARCH=irix
  2173         CheckDummyVideo
  2174         CheckDiskAudio
  2175         CheckDLOPEN
  2176         CheckDMEDIA
  2177         CheckESD
  2178         CheckNAS
  2179         CheckX11
  2180         CheckAAlib
  2181         CheckOpenGL
  2182         CheckPTHREAD
  2183         CheckSIGACTION
  2184         # We use the dmedia audio API, not the Sun audio API
  2185         #if test x$enable_audio = xyes; then
  2186         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2187         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2188         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2189         #fi
  2190         # Set up files for the joystick library
  2191         # (No joystick support yet)
  2192         if test x$enable_joystick = xyes; then
  2193             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2194             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2195         fi
  2196         # Set up files for the cdrom library
  2197         # (No CD-ROM support yet)
  2198         if test x$enable_cdrom = xyes; then
  2199             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2200             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2201         fi
  2202         # Set up files for the thread library
  2203         if test x$enable_threads = xyes; then
  2204             if test x$use_pthreads = xyes -o x$use_pth = xyes; then
  2205                 CopyUnixThreadSource
  2206             else
  2207                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
  2208                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
  2209                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  2210                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  2211                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  2212                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2213                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2214                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2215             fi
  2216         fi
  2217         # Set up files for the timer library
  2218         if test x$enable_timers = xyes; then
  2219             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2220         fi
  2221         ;;
  2222     *-*-hpux*)
  2223         ARCH=hpux
  2224         CheckDummyVideo
  2225         CheckDiskAudio
  2226         CheckDLOPEN
  2227         CheckOSS
  2228         CheckNAS
  2229         CheckX11
  2230         CheckGGI
  2231         CheckAAlib
  2232         CheckOpenGL
  2233         CheckPTHREAD
  2234         CheckSIGACTION
  2235         # Set up files for the audio library
  2236         if test x$enable_audio = xyes; then
  2237             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2238             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2239             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2240         fi
  2241         # Set up files for the joystick library
  2242         # (No joystick support yet)
  2243         if test x$enable_joystick = xyes; then
  2244             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2245             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2246         fi
  2247         # Set up files for the cdrom library
  2248         # (No CD-ROM support yet)
  2249         if test x$enable_cdrom = xyes; then
  2250             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2251             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2252         fi
  2253         # Set up files for the thread library
  2254         if test x$enable_threads = xyes; then
  2255             CopyUnixThreadSource
  2256         fi
  2257         # Set up files for the timer library
  2258         if test x$enable_timers = xyes; then
  2259             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2260         fi
  2261         ;;
  2262     *-*-aix*)
  2263         ARCH=aix
  2264         CheckDummyVideo
  2265         CheckDiskAudio
  2266         CheckDLOPEN
  2267         CheckOSS
  2268         CheckNAS
  2269         CheckX11
  2270         CheckGGI
  2271         CheckAAlib
  2272         CheckOpenGL
  2273         CheckPTHREAD
  2274         CheckSIGACTION
  2275         # Set up files for the audio library
  2276         if test x$enable_audio = xyes; then
  2277             AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
  2278             AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la"
  2279         fi
  2280         # Set up files for the joystick library
  2281         # (No joystick support yet)
  2282         if test x$enable_joystick = xyes; then
  2283             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2284             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2285         fi
  2286         # Set up files for the cdrom library
  2287         if test x$enable_cdrom = xyes; then
  2288             CDROM_SUBDIRS="$CDROM_SUBDIRS aix"
  2289             CDROM_DRIVERS="$CDROM_DRIVERS aix/libcdrom_aix.la"
  2290         fi
  2291         # Set up files for the thread library
  2292         if test x$enable_threads = xyes; then
  2293             CopyUnixThreadSource
  2294         fi
  2295         # Set up files for the timer library
  2296         if test x$enable_timers = xyes; then
  2297             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2298         fi
  2299         ;;
  2300     *-*-osf*)
  2301         ARCH=osf
  2302         CheckDummyVideo
  2303         CheckDiskAudio
  2304         CheckDLOPEN
  2305         CheckNAS
  2306         CheckX11
  2307         CheckGGI
  2308         CheckAAlib
  2309         CheckOpenGL
  2310         CheckPTHREAD
  2311         CheckSIGACTION
  2312         # Set up files for the audio library
  2313         if test x$enable_audio = xyes; then
  2314             CFLAGS="$CFLAGS -I/usr/include/mme -DMMEAUDIO_SUPPORT"
  2315             SYSTEM_LIBS="$SYSTEM_LIBS -lmme"
  2316             AUDIO_SUBDIRS="$AUDIO_SUBDIRS mme"
  2317             AUDIO_DRIVERS="$AUDIO_DRIVERS mme/libaudio_mme.la"
  2318         fi
  2319         # Set up files for the joystick library
  2320         # (No joystick support yet)
  2321         if test x$enable_joystick = xyes; then
  2322             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2323             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2324         fi
  2325         # Set up files for the cdrom library
  2326         # (No cdrom support yet)
  2327         if test x$enable_cdrom = xyes; then
  2328             CDROM_SUBDIRS="$CDROM_SUBDIRS osf"
  2329             CDROM_DRIVERS="$CDROM_DRIVERS osf/libcdrom_osf.la"
  2330         fi
  2331         # Set up files for the thread library
  2332         if test x$enable_threads = xyes; then
  2333             CopyUnixThreadSource
  2334         fi
  2335         # Set up files for the timer library
  2336         if test x$enable_timers = xyes; then
  2337             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2338         fi
  2339         ;;
  2340     *-*-qnx*)
  2341         ARCH=qnx
  2342         CheckDummyVideo
  2343         CheckDiskAudio
  2344         # CheckNASM
  2345         CheckDLOPEN
  2346         CheckNAS
  2347         CheckPHOTON
  2348         CheckX11
  2349         CheckOpenGL
  2350         CheckPTHREAD
  2351         CheckSIGACTION
  2352         # Set up files for the audio library
  2353         if test x$enable_audio = xyes; then
  2354             CFLAGS="$CFLAGS -DQNXNTOAUDIO_SUPPORT"
  2355             SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
  2356             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto"
  2357             AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la"
  2358         fi
  2359         # Set up files for the joystick library
  2360         if test x$enable_joystick = xyes; then
  2361         # (No joystick support yet)
  2362             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2363             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2364         fi
  2365         # Set up files for the cdrom library
  2366         if test x$enable_cdrom = xyes; then
  2367             CDROM_SUBDIRS="$CDROM_SUBDIRS qnx"
  2368             CDROM_DRIVERS="$CDROM_DRIVERS qnx/libcdrom_qnx.la"
  2369         fi
  2370         # Set up files for the thread library
  2371         if test x$enable_threads = xyes; then
  2372             CopyUnixThreadSource
  2373         fi
  2374         # Set up files for the timer library
  2375         if test x$enable_timers = xyes; then
  2376             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2377         fi
  2378         ;;
  2379     *-*-cygwin* | *-*-mingw32*)
  2380         ARCH=win32
  2381         if test "$build" != "$target"; then # cross-compiling
  2382             # Default cross-compile location
  2383             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2384         else
  2385             # Look for the location of the tools and install there
  2386             if test "$BUILD_PREFIX" != ""; then
  2387                 ac_default_prefix=$BUILD_PREFIX
  2388             fi
  2389         fi
  2390         CheckDummyVideo
  2391         CheckDiskAudio
  2392         CheckWIN32
  2393         CheckDIRECTX
  2394         CheckNASM
  2395         # Set up files for the audio library
  2396         if test x$enable_audio = xyes; then
  2397             AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
  2398             AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la"
  2399             if test x$use_directx = xyes; then
  2400                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5"
  2401                 AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la"
  2402             fi
  2403         fi
  2404         # Set up files for the joystick library
  2405         if test x$enable_joystick = xyes; then
  2406             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32"
  2407             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la"
  2408         fi
  2409         # Set up files for the cdrom library
  2410         if test x$enable_cdrom = xyes; then
  2411             CDROM_SUBDIRS="$CDROM_SUBDIRS win32"
  2412             CDROM_DRIVERS="$CDROM_DRIVERS win32/libcdrom_win32.la"
  2413         fi
  2414         # Set up files for the thread library
  2415         if test x$enable_threads = xyes; then
  2416             COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
  2417             COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
  2418             COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c)
  2419             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2420             COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c)
  2421             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2422             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2423             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2424         fi
  2425         # Set up files for the timer library
  2426         if test x$enable_timers = xyes; then
  2427             COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c)
  2428         fi
  2429         # The Win32 platform requires special setup
  2430         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2431         case "$target" in
  2432             *-*-cygwin*)
  2433                 CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
  2434                 SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
  2435                 LIBS="$LIBS -mno-cygwin"
  2436                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
  2437                 ;;
  2438             *-*-mingw32*)
  2439                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2440                 ;;
  2441         esac
  2442         ;;
  2443     *-*-beos*)
  2444         ARCH=beos
  2445         ac_default_prefix=/boot/develop/tools/gnupro
  2446         CheckDummyVideo
  2447         CheckDiskAudio
  2448         CheckNASM
  2449         CheckBWINDOW
  2450         CheckBeGL
  2451         # Set up files for the audio library
  2452         if test x$enable_audio = xyes; then
  2453             AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
  2454             AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la"
  2455         fi
  2456         # Set up files for the joystick library
  2457         if test x$enable_joystick = xyes; then
  2458             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos"
  2459             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la"
  2460         fi
  2461         # Set up files for the cdrom library
  2462         if test x$enable_cdrom = xyes; then
  2463             CDROM_SUBDIRS="$CDROM_SUBDIRS beos"
  2464             CDROM_DRIVERS="$CDROM_DRIVERS beos/libcdrom_beos.la"
  2465         fi
  2466         # Set up files for the thread library
  2467         if test x$enable_threads = xyes; then
  2468             COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
  2469             COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
  2470             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  2471             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2472             COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c)
  2473             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2474             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2475             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2476         fi
  2477         # Set up files for the timer library
  2478         if test x$enable_timers = xyes; then
  2479             COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c)
  2480         fi
  2481         # The BeOS platform requires special libraries
  2482         SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2483         ;;
  2484     *-*-macos*)
  2485         # This would be used if cross-compiling to MacOS 9.  No way to
  2486         # use it at present, but Apple is working on a X-to-9 compiler
  2487         # for which this case would be handy.
  2488         ARCH=macos
  2489         CheckDummyVideo
  2490         CheckDiskAudio
  2491         CheckTOOLBOX
  2492         CheckMacGL
  2493         # Set up files for the audio library
  2494         if test x$enable_audio = xyes; then
  2495             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  2496             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  2497         fi
  2498         # Set up files for the joystick library
  2499         if test x$enable_joystick = xyes; then
  2500             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos"
  2501             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la"
  2502         fi
  2503         # Set up files for the cdrom library
  2504         if test x$enable_cdrom = xyes; then
  2505             CDROM_SUBDIRS="$CDROM_SUBDIRS macos"
  2506             CDROM_DRIVERS="$CDROM_DRIVERS macos/libcdrom_macos.la"
  2507         fi
  2508         # Set up files for the thread library
  2509         if test x$enable_threads = xyes; then
  2510             COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
  2511             COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
  2512             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  2513             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2514             COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c)
  2515             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2516             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2517             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2518         fi
  2519         # Set up files for the timer library
  2520         if test x$enable_timers = xyes; then
  2521             COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c)
  2522         fi
  2523         # The MacOS platform requires special setup
  2524         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2525         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2526         ;;
  2527     *-*-darwin* )
  2528         # Strictly speaking, we want "Mac OS X", not "Darwin", which is
  2529         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2530         # But config.guess comes back with "darwin", so go with the flow.
  2531         ARCH=macosx
  2532         CheckDummyVideo
  2533         CheckDiskAudio
  2534         CheckCoreAudio
  2535         CheckQUARTZ
  2536         CheckMacGL
  2537         CheckPTHREAD
  2538         CheckSIGACTION
  2539         # If either the audio or CD driver is used, add the AudioUnit framework
  2540         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2541             SYSTEM_LIBS="$SYSTEM_LIBS -framework AudioToolbox -framework AudioUnit"
  2542         fi
  2543         # Set up files for the audio library
  2544         if test x$enable_audio = xyes; then
  2545             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  2546             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  2547         fi
  2548         # Set up files for the joystick library
  2549         if test x$enable_joystick = xyes; then
  2550             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin"
  2551             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la"
  2552             SYSTEM_LIBS="$SYSTEM_LIBS -framework IOKit"
  2553         fi
  2554         # Set up files for the cdrom library
  2555         if test x$enable_cdrom = xyes; then
  2556             CDROM_SUBDIRS="$CDROM_SUBDIRS macosx"
  2557             CDROM_DRIVERS="$CDROM_DRIVERS macosx/libcdrom_macosx.la"
  2558             SYSTEM_LIBS="$SYSTEM_LIBS -lstdc++"
  2559         fi
  2560         # Set up files for the thread library
  2561         if test x$enable_threads = xyes; then
  2562             CopyUnixThreadSource
  2563         fi
  2564         # Set up files for the timer library
  2565         if test x$enable_timers = xyes; then
  2566             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2567         fi
  2568         # The MacOS X platform requires special setup.
  2569         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2570         # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2571         SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa -framework Carbon -framework QuickTime"
  2572         ;;
  2573     *-*-mint*)
  2574         ARCH=mint
  2575         CheckDummyVideo
  2576         CheckDiskAudio
  2577         CheckAtariBiosEvent
  2578         CheckAtariXbiosVideo
  2579         CheckAtariGemVideo
  2580         CheckAtariAudio
  2581         CheckAtariLdg
  2582         CheckPTH
  2583         # Set up files for the audio library
  2584         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2585             if test x$enable_audio = xyes; then
  2586                 CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2587                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2588                 AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2589             fi
  2590         fi
  2591         # Set up files for the joystick library
  2592         if test x$enable_joystick = xyes; then
  2593             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS mint"
  2594             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS mint/libjoystick_mint.la"
  2595         fi
  2596         # Set up files for the cdrom library
  2597         if test x$enable_cdrom = xyes; then
  2598             CDROM_SUBDIRS="$CDROM_SUBDIRS mint"
  2599             CDROM_DRIVERS="$CDROM_DRIVERS mint/libcdrom_mint.la"
  2600         fi
  2601         # Set up files for the thread library
  2602         if test x$enable_threads = xyes; then
  2603             CopyUnixThreadSource
  2604         fi
  2605         # Set up files for the timer library
  2606         if test x$enable_timers = xyes; then
  2607             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2608                 COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2609             else
  2610                 COPY_ARCH_SRC(src/timer, mint, SDL_systimer.c)
  2611             fi
  2612         fi
  2613         # MiNT does not define "unix"
  2614         CFLAGS="$CFLAGS -Dunix"
  2615         ;;
  2616     *-*-riscos)
  2617         ARCH=riscos
  2618         JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS riscos"
  2619         JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS riscos/libjoystick_riscos.la"
  2620         COPY_ARCH_SRC(src/timer, riscos, SDL_systimer.c)
  2621         VIDEO_SUBDIRS="$VIDEO_SUBDIRS riscos"
  2622         VIDEO_DRIVERS="$VIDEO_DRIVERS riscos/libvideo_riscos.la"
  2623         AUDIO_SUBDIRS="$AUDIO_SUBDIRS riscos"
  2624         AUDIO_DRIVERS="$AUDIO_DRIVERS riscos/libaudio_riscos.la"
  2625 
  2626         if test x$enable_cdrom = xyes; then
  2627             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2628             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2629         fi
  2630 
  2631         CFLAGS="$CFLAGS -DDISABLE_THREADS -DENABLE_RISCOS -DDRENDERER_SUPPORT"
  2632 
  2633         SYSTEM_LIBS="$SYSTEM_LIBS -ljpeg -ltiff -lpng -lz"
  2634         ;;
  2635     *)
  2636         AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
  2637         ;;
  2638 esac
  2639 AC_SUBST(ARCH)
  2640 
  2641 # Set the conditional variables for this target
  2642 AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
  2643 AM_CONDITIONAL(TARGET_QTOPIA, test "x$video_qtopia" = "xyes")
  2644 AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
  2645 AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
  2646 AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
  2647 AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
  2648 AM_CONDITIONAL(TARGET_NETBSD, test $ARCH = netbsd)
  2649 AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd)
  2650 AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix)
  2651 AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
  2652 AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
  2653 AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
  2654 AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
  2655 AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
  2656 AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)
  2657 
  2658 # More automake conditionals
  2659 AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
  2660 AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
  2661 AM_CONDITIONAL(HAVE_NASM, test x$use_nasm = xyes)
  2662 
  2663 # Set conditional variables for shared and static library selection.
  2664 # These are not used in any Makefile.am but in sdl-config.in.
  2665 AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
  2666 AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes])
  2667 
  2668 # Set runtime shared library paths as needed
  2669 
  2670 if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
  2671   SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2672 fi
  2673 if test $ARCH = solaris; then
  2674   SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2675 fi
  2676 
  2677 case "$ARCH" in
  2678   openbsd | netbsd | bsdi)
  2679     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2680     ;;
  2681   qnx)
  2682     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2683     ;;
  2684   macosx)
  2685     SHARED_SYSTEM_LIBS="-framework Cocoa"
  2686     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2687       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
  2688     fi
  2689     ;;
  2690   *)
  2691     SHARED_SYSTEM_LIBS=""
  2692     ;;
  2693 esac
  2694 
  2695 case "$ARCH" in
  2696   macosx)
  2697     # Evil hack to allow static linking on Mac OS X
  2698     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a"
  2699     ;;
  2700   *)
  2701     SDL_STATIC_LIBS="$SDL_LIBS"
  2702     ;;
  2703 esac
  2704 
  2705 
  2706 STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
  2707 
  2708 dnl Output the video drivers we use
  2709 if test x$enable_video = xtrue; then
  2710     if test "$VIDEO_SUBDIRS" = ""; then
  2711         AC_MSG_ERROR(*** No video drivers are enabled!)
  2712     fi
  2713 fi
  2714 AC_SUBST(AUDIO_SUBDIRS)
  2715 AC_SUBST(AUDIO_DRIVERS)
  2716 AC_SUBST(VIDEO_SUBDIRS)
  2717 AC_SUBST(VIDEO_DRIVERS)
  2718 AC_SUBST(JOYSTICK_SUBDIRS)
  2719 AC_SUBST(JOYSTICK_DRIVERS)
  2720 AC_SUBST(CDROM_SUBDIRS)
  2721 AC_SUBST(CDROM_DRIVERS)
  2722 AC_SUBST(SDL_EXTRADIRS)
  2723 AC_SUBST(SDL_EXTRALIBS)
  2724 
  2725 dnl Expand the cflags and libraries needed by apps using SDL
  2726 AC_SUBST(SDL_CFLAGS)
  2727 AC_SUBST(SDL_LIBS)
  2728 AC_SUBST(SDL_STATIC_LIBS)
  2729 AC_SUBST(SDL_RLD_FLAGS)
  2730 
  2731 dnl Expand the libraries needed for static and dynamic linking
  2732 AC_SUBST(STATIC_SYSTEM_LIBS)
  2733 AC_SUBST(SHARED_SYSTEM_LIBS)
  2734 AC_SUBST(SYSTEM_LIBS)
  2735 
  2736 dnl Expand the include directories for building SDL
  2737 CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
  2738 CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
  2739 CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/main/$ARCH"
  2740 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
  2741 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
  2742 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/XFree86/extensions"
  2743 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
  2744 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
  2745 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
  2746 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
  2747 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
  2748 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian"
  2749 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
  2750 CFLAGS="$CFLAGS -I\$(top_builddir)/src/thread"
  2751 CXXFLAGS="$CFLAGS"
  2752 
  2753 
  2754 # Check for darwin at the very end and set up the Objective C compiler
  2755 # We do this here so that we get the full CFLAGS into OBJCFLAGS
  2756 case "$target" in
  2757     *-*-darwin*)
  2758         dnl AC_PROG_OBJC doesn't seem to exist, this is the SDL workaround
  2759         AC_MSG_CHECKING(for an Objective-C compiler)
  2760         OBJC="$CC"
  2761         AC_SUBST(OBJC)
  2762         OBJCFLAGS="$CFLAGS"
  2763         AC_SUBST(OBJCFLAGS)
  2764         dnl _AM_DEPENDENCIES(OBJC) doesn't work, so hard code OBJCDEPMODE here
  2765         dnl _AM_DEPENDENCIES(OBJC)
  2766         dnl Of course, hard coding doesn't work for some versions of automake
  2767         OBJCDEPMODE="depmode=gcc"
  2768         AC_SUBST(OBJCDEPMODE)
  2769         dnl Trying this to satisfy everybody...
  2770         AC_MSG_RESULT(not implemented yet)
  2771         ;;
  2772 esac
  2773 
  2774 # Finally create all the generated files
  2775 dnl Important: Any directory that you want to be in the distcheck should
  2776 dnl            have a file listed here, so that configure generates the
  2777 dnl            subdirectories on the build target.
  2778 AC_OUTPUT([
  2779 Makefile
  2780 docs/Makefile
  2781 docs/html/Makefile
  2782 docs/man3/Makefile
  2783 include/Makefile
  2784 src/Makefile
  2785 src/main/Makefile
  2786 src/main/macosx/Makefile
  2787 src/main/macosx/Info.plist
  2788 src/audio/Makefile
  2789 src/audio/alsa/Makefile
  2790 src/audio/arts/Makefile
  2791 src/audio/baudio/Makefile
  2792 src/audio/dc/Makefile
  2793 src/audio/disk/Makefile
  2794 src/audio/dma/Makefile
  2795 src/audio/dmedia/Makefile
  2796 src/audio/dsp/Makefile
  2797 src/audio/esd/Makefile
  2798 src/audio/macosx/Makefile
  2799 src/audio/macrom/Makefile
  2800 src/audio/mint/Makefile
  2801 src/audio/mme/Makefile
  2802 src/audio/nas/Makefile
  2803 src/audio/nto/Makefile
  2804 src/audio/openbsd/Makefile
  2805 src/audio/paudio/Makefile
  2806 src/audio/riscos/Makefile
  2807 src/audio/sun/Makefile
  2808 src/audio/ums/Makefile
  2809 src/audio/windib/Makefile
  2810 src/audio/windx5/Makefile
  2811 src/video/Makefile
  2812 src/video/aalib/Makefile
  2813 src/video/ataricommon/Makefile
  2814 src/video/bwindow/Makefile
  2815 src/video/cybergfx/Makefile
  2816 src/video/dc/Makefile
  2817 src/video/dga/Makefile
  2818 src/video/directfb/Makefile
  2819 src/video/dummy/Makefile
  2820 src/video/epoc/Makefile
  2821 src/video/fbcon/Makefile
  2822 src/video/gem/Makefile
  2823 src/video/ggi/Makefile
  2824 src/video/maccommon/Makefile
  2825 src/video/macdsp/Makefile
  2826 src/video/macrom/Makefile
  2827 src/video/nanox/Makefile
  2828 src/video/photon/Makefile
  2829 src/video/picogui/Makefile
  2830 src/video/ps2gs/Makefile
  2831 src/video/qtopia/Makefile
  2832 src/video/quartz/Makefile
  2833 src/video/riscos/Makefile
  2834 src/video/svga/Makefile
  2835 src/video/vgl/Makefile
  2836 src/video/wincommon/Makefile
  2837 src/video/windib/Makefile
  2838 src/video/windx5/Makefile
  2839 src/video/x11/Makefile
  2840 src/video/xbios/Makefile
  2841 src/video/XFree86/Makefile
  2842 src/video/XFree86/extensions/Makefile
  2843 src/video/XFree86/Xinerama/Makefile
  2844 src/video/XFree86/Xv/Makefile
  2845 src/video/XFree86/Xxf86dga/Makefile
  2846 src/video/XFree86/Xxf86vm/Makefile
  2847 src/events/Makefile
  2848 src/joystick/Makefile
  2849 src/joystick/amigaos/Makefile
  2850 src/joystick/beos/Makefile
  2851 src/joystick/bsd/Makefile
  2852 src/joystick/darwin/Makefile
  2853 src/joystick/dc/Makefile
  2854 src/joystick/dummy/Makefile
  2855 src/joystick/linux/Makefile
  2856 src/joystick/macos/Makefile
  2857 src/joystick/mint/Makefile
  2858 src/joystick/riscos/Makefile
  2859 src/joystick/win32/Makefile
  2860 src/cdrom/Makefile
  2861 src/cdrom/aix/Makefile
  2862 src/cdrom/beos/Makefile
  2863 src/cdrom/dc/Makefile
  2864 src/cdrom/dummy/Makefile
  2865 src/cdrom/bsdi/Makefile
  2866 src/cdrom/freebsd/Makefile
  2867 src/cdrom/linux/Makefile
  2868 src/cdrom/macos/Makefile
  2869 src/cdrom/macosx/Makefile
  2870 src/cdrom/mint/Makefile
  2871 src/cdrom/openbsd/Makefile
  2872 src/cdrom/osf/Makefile
  2873 src/cdrom/qnx/Makefile
  2874 src/cdrom/win32/Makefile
  2875 src/thread/Makefile
  2876 src/timer/Makefile
  2877 src/endian/Makefile
  2878 src/file/Makefile
  2879 src/cpuinfo/Makefile
  2880 src/hermes/Makefile
  2881 sdl-config
  2882 SDL.spec
  2883 SDL.qpg
  2884 ], [chmod +x sdl-config])