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