configure.in
author Patrice Mandin <patmandin@gmail.com>
Wed, 17 Nov 2004 23:13:15 +0000
changeset 978 3b1ba22f5a28
parent 973 795ac5fbe260
child 989 475166d13b44
permissions -rw-r--r--
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
     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 Check for Mesa offscreen rendering
  1133 CheckOSMesa()
  1134 {
  1135     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1136         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1137         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1138         if test x$have_osmesa_hdr = xyes -a x$have_osmesa_lib = xyes; then
  1139     	    CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1140 			SYSTEM_LIBS="$SYSTEM_LIBS -lOSMesa"
  1141         fi
  1142     fi
  1143 }
  1144 
  1145 dnl See if we can use the new unified event interface in Linux 2.4
  1146 CheckInputEvents()
  1147 {
  1148     dnl Check for Linux 2.4 unified input event interface support
  1149     AC_ARG_ENABLE(input-events,
  1150 [  --enable-input-events   use Linux 2.4 unified input interface [default=yes]],
  1151                   , enable_input_events=yes)
  1152     if test x$enable_input_events = xyes; then
  1153         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1154         use_input_events=no
  1155         AC_TRY_COMPILE([
  1156           #include <linux/input.h>
  1157         ],[
  1158           #ifndef EVIOCGNAME
  1159           #error EVIOCGNAME() ioctl not available
  1160           #endif
  1161         ],[
  1162         use_input_events=yes
  1163         ])
  1164         AC_MSG_RESULT($use_input_events)
  1165         if test x$use_input_events = xyes; then
  1166             CFLAGS="$CFLAGS -DUSE_INPUT_EVENTS"
  1167         fi
  1168     fi
  1169 }
  1170 
  1171 dnl See if we can use GNU pth library for threads
  1172 CheckPTH()
  1173 {
  1174     dnl Check for pth support
  1175     AC_ARG_ENABLE(pth,
  1176 [  --enable-pth            use GNU pth library for multi-threading [default=yes]],
  1177                   , enable_pth=yes)
  1178     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1179         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1180         if test "$PTH_CONFIG" = "no"; then
  1181             use_pth=no
  1182         else
  1183             PTH_CFLAGS=`$PTH_CONFIG --cflags`
  1184             PTH_LIBS=`$PTH_CONFIG --libs --all`
  1185             SDL_CFLAGS="$SDL_CFLAGS $PTH_CFLAGS"
  1186             SDL_LIBS="$SDL_LIBS $PTH_LIBS"
  1187             CFLAGS="$CFLAGS -DENABLE_PTH"
  1188             use_pth=yes
  1189         fi
  1190         AC_MSG_CHECKING(pth)
  1191         if test "x$use_pth" = xyes; then
  1192             AC_MSG_RESULT(yes)
  1193         else
  1194             AC_MSG_RESULT(no)
  1195         fi
  1196     fi
  1197 }
  1198 
  1199 dnl See what type of thread model to use on Linux and Solaris
  1200 CheckPTHREAD()
  1201 {
  1202     dnl Check for pthread support
  1203     AC_ARG_ENABLE(pthreads,
  1204 [  --enable-pthreads       use POSIX threads for multi-threading [default=yes]],
  1205                   , enable_pthreads=yes)
  1206     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1207     AC_ARG_ENABLE(pthread-sem,
  1208 [  --enable-pthread-sem    use pthread semaphores [default=yes]],
  1209                   , enable_pthread_sem=yes)
  1210     case "$target" in
  1211         *-*-bsdi*)
  1212             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1213             pthread_lib=""
  1214             ;;
  1215         *-*-darwin*)
  1216             pthread_cflags="-D_THREAD_SAFE"
  1217 # causes Carbon.p complaints?
  1218 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1219             ;;
  1220         *-*-freebsd*)
  1221             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1222             pthread_lib="-pthread"
  1223             ;;
  1224         *-*-netbsd*)
  1225             pthread_cflags="-I/usr/pkg/include -D_REENTRANT"
  1226             pthread_lib="-L/usr/pkg/lib -lpthread -lsem"
  1227             ;;
  1228         *-*-openbsd*)
  1229             pthread_cflags="-D_REENTRANT"
  1230             pthread_lib="-pthread"
  1231             ;;
  1232         *-*-solaris*)
  1233             pthread_cflags="-D_REENTRANT"
  1234             pthread_lib="-lpthread -lposix4"
  1235             ;;
  1236         *-*-sysv5*)
  1237             pthread_cflags="-D_REENTRANT -Kthread"
  1238             pthread_lib=""
  1239             ;;
  1240         *-*-irix*)
  1241             pthread_cflags="-D_SGI_MP_SOURCE"
  1242             pthread_lib="-lpthread"
  1243             ;;
  1244         *-*-aix*)
  1245             pthread_cflags="-D_REENTRANT -mthreads"
  1246             pthread_lib="-lpthread"
  1247             ;;
  1248         *-*-hpux11*)
  1249             pthread_cflags="-D_REENTRANT"
  1250             pthread_lib="-L/usr/lib -lpthread"
  1251             ;;
  1252         *-*-qnx*)
  1253             pthread_cflags=""
  1254             pthread_lib=""
  1255             ;;
  1256         *-*-osf*)
  1257             if test x$ac_cv_prog_gcc = xyes; then
  1258                 pthread_cflags="-D_REENTRANT"
  1259                 pthread_lib="-lpthread -lrt"
  1260             else
  1261                 pthread_cflags="-pthread"
  1262                 pthread_lib="-lpthread -lrt"
  1263             fi
  1264             ;;
  1265         *)
  1266             pthread_cflags="-D_REENTRANT"
  1267             pthread_lib="-lpthread"
  1268             ;;
  1269     esac
  1270     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1271         # Save the original compiler flags and libraries
  1272         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1273         # Add the pthread compiler flags and libraries
  1274         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1275         # Check to see if we have pthread support on this system
  1276         AC_MSG_CHECKING(for pthreads)
  1277         use_pthreads=no
  1278         AC_TRY_LINK([
  1279          #include <pthread.h>
  1280         ],[
  1281          pthread_attr_t type;
  1282          pthread_attr_init(&type);
  1283         ],[
  1284         use_pthreads=yes
  1285         ])
  1286         AC_MSG_RESULT($use_pthreads)
  1287         # Restore the compiler flags and libraries
  1288         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1289         # Do futher testing if we have pthread support...
  1290         if test x$use_pthreads = xyes; then
  1291             CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
  1292             LIBS="$LIBS $pthread_lib"
  1293             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1294             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1295 
  1296             # Check to see if recursive mutexes are available
  1297             AC_MSG_CHECKING(for recursive mutexes)
  1298             has_recursive_mutexes=no
  1299             AC_TRY_LINK([
  1300               #include <pthread.h>
  1301             ],[
  1302               pthread_mutexattr_t attr;
  1303               #if defined(linux) && !(defined(__arm__) && defined(QWS))
  1304               pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1305               #else
  1306               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1307               #endif
  1308             ],[
  1309             has_recursive_mutexes=yes
  1310             ])
  1311             # Some systems have broken recursive mutex implementations
  1312             case "$target" in
  1313                 *-*-darwin*)
  1314                     has_recursive_mutexes=no
  1315                     ;;
  1316                 *-*-solaris*)
  1317                     has_recursive_mutexes=no
  1318                     ;;
  1319             esac
  1320             AC_MSG_RESULT($has_recursive_mutexes)
  1321             if test x$has_recursive_mutexes != xyes; then
  1322                 CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
  1323             fi
  1324 
  1325             # Check to see if pthread semaphore support is missing
  1326             if test x$enable_pthread_sem = xyes; then
  1327                 AC_MSG_CHECKING(for pthread semaphores)
  1328                 have_pthread_sem=no
  1329                 AC_TRY_COMPILE([
  1330                   #include <pthread.h>
  1331                   #include <semaphore.h>
  1332                 ],[
  1333                 ],[
  1334                 have_pthread_sem=yes
  1335                 ])
  1336                 AC_MSG_RESULT($have_pthread_sem)
  1337             fi
  1338 
  1339             # Check to see if this is broken glibc 2.0 pthreads
  1340             case "$target" in
  1341                 *-*-linux*)
  1342                     AC_MSG_CHECKING(for broken glibc 2.0 pthreads)
  1343                     glibc20_pthreads=no
  1344                     AC_TRY_COMPILE([
  1345                       #include <features.h>
  1346                       #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
  1347                       #warning Working around a bug in glibc 2.0 pthreads
  1348                       #else
  1349                       #error pthread implementation okay
  1350                       #endif /* glibc 2.0 */
  1351                     ],[
  1352                     ],[
  1353                     glibc20_pthreads=yes
  1354                     ])
  1355                     AC_MSG_RESULT($glibc20_pthreads)
  1356             esac
  1357         fi
  1358     fi
  1359 
  1360     AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
  1361     have_semun=no
  1362     AC_TRY_COMPILE([
  1363       #include <sys/types.h>
  1364       #include <sys/sem.h>
  1365     ],[
  1366       union semun t;
  1367     ],[
  1368     have_semun=yes
  1369     ])
  1370     AC_MSG_RESULT($have_semun)
  1371     if test x$have_semun = xyes; then
  1372         CFLAGS="$CFLAGS -DHAVE_SEMUN"
  1373     fi
  1374 
  1375     # See if we can use GNU Pth or clone() on Linux directly
  1376     if test x$enable_threads = xyes -a x$use_pthreads != xyes; then
  1377         CheckPTH
  1378         if test x$use_pth != xyes; then
  1379             case "$target" in
  1380                 *-*-linux*)
  1381                     use_clone=yes
  1382                     ;;
  1383             esac
  1384         fi
  1385     fi
  1386 }
  1387 
  1388 # Note that we need to have either semaphores or to have mutexes and
  1389 # condition variables to implement all thread synchronization primitives
  1390 CopyUnixThreadSource()
  1391 {
  1392     if test x$use_pthreads = xyes -o x$use_clone = xyes; then
  1393         # Basic thread creation functions
  1394         COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1395         COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1396 
  1397         # Semaphores
  1398         # We can fake these with mutexes and condition variables if necessary
  1399         if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
  1400             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1401         else
  1402             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1403         fi
  1404         COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1405 
  1406         # Mutexes
  1407         # We can fake these with semaphores if necessary
  1408         case "$target" in
  1409             *-*-bsdi*)
  1410                 COPY_ARCH_SRC(src/thread, bsdi, SDL_syssem.c)
  1411                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1412                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1413                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1414                 ;;
  1415             *)
  1416                 if test x$glibc20_pthreads = xyes; then
  1417                     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1418                     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1419                 else
  1420                     COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1421                     COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1422                 fi
  1423                 ;;
  1424         esac
  1425 
  1426         # Condition variables
  1427         # We can fake these with semaphores and mutexes if necessary
  1428         if test x$glibc20_pthreads = xyes -o x$has_recursive_mutexes != xyes; then
  1429             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1430         else
  1431             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1432         fi
  1433         COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1434 
  1435     elif test x$use_pth = xyes; then
  1436         COPY_ARCH_SRC(src/thread, pth, SDL_systhread.c)
  1437         COPY_ARCH_SRC(src/thread, pth, SDL_systhread_c.h)
  1438         COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex.c)
  1439         COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex_c.h)
  1440         COPY_ARCH_SRC(src/thread, pth, SDL_syscond.c)
  1441         COPY_ARCH_SRC(src/thread, pth, SDL_syscond_c.h)
  1442         COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1443         COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1444     else
  1445        AC_MSG_ERROR([
  1446 *** No thread support detected
  1447        ])
  1448     fi
  1449 }
  1450 
  1451 dnl See if we can use sigaction() instead of signal()
  1452 CheckSIGACTION()
  1453 {
  1454     dnl Check for sigaction support
  1455     AC_ARG_ENABLE(sigaction,
  1456 [  --enable-sigaction      use sigaction instead of signal [default=yes]],
  1457                   , enable_sigaction=yes)
  1458     if test x$enable_sigaction = xyes; then
  1459         AC_MSG_CHECKING(sigaction)
  1460         have_sigaction=no
  1461         AC_TRY_COMPILE([
  1462          #include <signal.h>
  1463         ],[
  1464          struct sigaction junk;
  1465          sigaction(0, &junk, &junk);
  1466         ],[
  1467         have_sigaction=yes
  1468         ])
  1469         AC_MSG_RESULT($have_sigaction)
  1470         if test x$have_sigaction = xyes; then
  1471             CFLAGS="$CFLAGS -DHAVE_SIGACTION"
  1472         fi
  1473     fi
  1474 }
  1475 
  1476 dnl Determine whether the compiler can produce Win32 executables
  1477 CheckWIN32()
  1478 {
  1479     AC_MSG_CHECKING(Win32 compiler)
  1480     have_win32_gcc=no
  1481     AC_TRY_COMPILE([
  1482      #include <windows.h>
  1483     ],[
  1484     ],[
  1485     have_win32_gcc=yes
  1486     ])
  1487     AC_MSG_RESULT($have_win32_gcc)
  1488     if test x$have_win32_gcc != xyes; then
  1489        AC_MSG_ERROR([
  1490 *** Your compiler ($CC) does not produce Win32 executables!
  1491        ])
  1492     fi
  1493 
  1494     dnl See if the user wants to redirect standard output to files
  1495     AC_ARG_ENABLE(stdio-redirect,
  1496 [  --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]],
  1497                   , enable_stdio_redirect=yes)
  1498     if test x$enable_stdio_redirect != xyes; then
  1499         CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT"
  1500     fi
  1501 }
  1502 
  1503 dnl Find the DirectX includes and libraries
  1504 CheckDIRECTX()
  1505 {
  1506     AC_ARG_ENABLE(directx,
  1507 [  --enable-directx        use DirectX for Win32 audio/video [default=yes]],
  1508                   , enable_directx=yes)
  1509     if test x$enable_directx = xyes; then
  1510         AC_MSG_CHECKING(for DirectX headers and libraries)
  1511         use_directx=no
  1512         tmp_cflags=$CFLAGS
  1513         CFLAGS="$CFLAGS -I$srcdir"
  1514         AC_TRY_COMPILE([
  1515          #include "src/video/windx5/directx.h"
  1516         ],[
  1517         ],[
  1518         use_directx=yes
  1519         ])
  1520         CFLAGS=$tmp_cflags
  1521         AC_MSG_RESULT($use_directx)
  1522     fi
  1523 
  1524     CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
  1525     SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
  1526     VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
  1527     VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
  1528     # Enable the DIB driver
  1529     CFLAGS="$CFLAGS -DENABLE_WINDIB"
  1530     VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
  1531     VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
  1532     # See if we should enable the DirectX driver
  1533     if test x$use_directx = xyes; then
  1534         CFLAGS="$CFLAGS -DENABLE_DIRECTX"
  1535         SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
  1536         VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
  1537         VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
  1538     fi
  1539 }
  1540 
  1541 dnl Set up the BWindow video driver on BeOS
  1542 CheckBWINDOW()
  1543 {
  1544     CFLAGS="$CFLAGS -DENABLE_BWINDOW"
  1545     VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
  1546     VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
  1547 }
  1548 
  1549 dnl Set up the QTopia video driver if enabled
  1550 CheckQtopia()
  1551 {
  1552     AC_ARG_ENABLE(video-qtopia,
  1553 [  --enable-video-qtopia   use Qtopia video driver [default=no]],
  1554                   , enable_video_qtopia=no)
  1555     if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
  1556         AC_MSG_CHECKING(for Qtopia support)
  1557         video_qtopia=no
  1558         AC_LANG_CPLUSPLUS
  1559         OLD_CXX="$CXXFLAGS"
  1560         CXXFLAGS="-DQT_QWS_EBX -fno-rtti -fno-exceptions -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG"
  1561         AC_TRY_COMPILE([
  1562          #include <qpe/qpeapplication.h>
  1563         ],[
  1564         ],[
  1565         video_qtopia=yes
  1566         ])
  1567         CXXFLAGS="$OLD_CXX"
  1568         AC_MSG_RESULT($video_qtopia)
  1569         if test x$video_qtopia = xyes; then
  1570             CFLAGS="$CFLAGS -DENABLE_QTOPIA -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
  1571             SDL_LIBS="$SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
  1572             SDL_CFLAGS="$SDL_CFLAGS -DQWS"	  
  1573             VIDEO_SUBDIRS="$VIDEO_SUBDIRS qtopia"
  1574             VIDEO_DRIVERS="$VIDEO_DRIVERS qtopia/libvideo_qtopia.la"
  1575         else
  1576 	AC_MSG_ERROR([
  1577 *** Failed to find Qtopia includes. Make sure that the QTDIR and QPEDIR
  1578 *** environment variables are set correctly.])
  1579         fi
  1580         AC_LANG_C
  1581     fi
  1582 }
  1583 
  1584 dnl Set up the PicoGUI video driver if enabled
  1585 CheckPicoGUI()
  1586 {
  1587     AC_ARG_ENABLE(video-picogui,
  1588 [  --enable-video-picogui  use PicoGUI video driver [default=no]],
  1589                   , enable_video_picogui=no)
  1590     if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
  1591         AC_MSG_CHECKING(for PicoGUI support)
  1592         video_picogui=no
  1593         AC_TRY_COMPILE([
  1594          #include <picogui.h>
  1595         ],[
  1596         ],[
  1597         video_picogui=yes
  1598         ])
  1599         AC_MSG_RESULT($video_picogui)
  1600         if test x$video_picogui = xyes; then
  1601 	    SDL_LIBS="$SDL_LIBS -lpgui"
  1602             CFLAGS="$CFLAGS -DENABLE_PICOGUI"
  1603             VIDEO_SUBDIRS="$VIDEO_SUBDIRS picogui"
  1604             VIDEO_DRIVERS="$VIDEO_DRIVERS picogui/libvideo_picogui.la"
  1605         fi
  1606         AC_LANG_C
  1607     fi
  1608 }
  1609 
  1610 dnl Set up the Mac toolbox video driver for Mac OS 7-9
  1611 CheckTOOLBOX()
  1612 {
  1613     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
  1614     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
  1615     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
  1616     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
  1617 }
  1618 
  1619 dnl Set up the Mac toolbox video driver for Mac OS X
  1620 CheckCARBON()
  1621 {
  1622     # "MACOSX" is not an official definition, but it's commonly
  1623     # accepted as a way to differentiate between what runs on X
  1624     # and what runs on older Macs - while in theory "Carbon" defns
  1625     # are consistent between the two, in practice Carbon is still
  1626     # changing. -sts Aug 2000
  1627     mac_autoconf_target_workaround="MAC"
  1628     CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
  1629       -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"
  1630     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
  1631     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
  1632     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
  1633     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
  1634 }
  1635 
  1636 dnl Set up the Mac toolbox video driver for Mac OS X
  1637 CheckQUARTZ()
  1638 {
  1639     # "MACOSX" is not an official definition, but it's commonly
  1640     # accepted as a way to differentiate between what runs on X
  1641     # and what runs on older Macs - while in theory "Carbon" defns
  1642     # are consistent between the two, in practice Carbon is still
  1643     # changing. -sts Aug 2000
  1644     mac_autoconf_target_workaround="MAC"
  1645     CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
  1646       -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
  1647       -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
  1648     VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
  1649     VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
  1650 }
  1651 
  1652 dnl Check for the dlfcn.h interface for dynamically loading objects
  1653 CheckDLOPEN()
  1654 {
  1655     AC_ARG_ENABLE(sdl-dlopen,
  1656 [  --enable-sdl-dlopen     use dlopen for shared object loading [default=yes]],
  1657                   , enable_sdl_dlopen=yes)
  1658     if test x$enable_sdl_dlopen = xyes; then
  1659         AC_MSG_CHECKING(for dlopen)
  1660         use_dlopen=no
  1661         AC_TRY_COMPILE([
  1662          #include <dlfcn.h>
  1663         ],[
  1664         ],[
  1665         use_dlopen=yes
  1666         ])
  1667         AC_MSG_RESULT($use_dlopen)
  1668 
  1669         if test x$use_dlopen = xyes; then
  1670             CFLAGS="$CFLAGS -DUSE_DLOPEN"
  1671             AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS",
  1672                AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl",
  1673                   AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl")))
  1674         fi
  1675     fi
  1676 }
  1677 
  1678 dnl Set up the Atari LDG (shared object loader)
  1679 CheckAtariLdg()
  1680 {
  1681     AC_ARG_ENABLE(atari-ldg,
  1682 [  --enable-atari-ldg      use Atari LDG for shared object loading [default=yes]],
  1683                   , enable_atari_ldg=yes)
  1684     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1685         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1686         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1687         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1688             CFLAGS="$CFLAGS -DENABLE_LDG"
  1689             SYSTEM_LIBS="$SYSTEM_LIBS -lldg -lgem"
  1690         fi
  1691     fi
  1692 }
  1693 
  1694 dnl Check for the usbhid(3) library on *BSD
  1695 CheckUSBHID()
  1696 {
  1697     if test x$enable_joystick = xyes; then
  1698         have_libusbhid=no
  1699         have_libusb=no
  1700         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1701         AC_CHECK_LIB(usb, hid_init, have_libusb=yes)
  1702         if test x$have_libusbhid = xyes; then
  1703             SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
  1704         fi
  1705         if test x$have_libusb = xyes; then
  1706             SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
  1707         fi
  1708 
  1709         AC_CHECK_HEADER(usb.h, have_usb_h=yes)
  1710         AC_CHECK_HEADER(usbhid.h, have_usbhid_h=yes)
  1711         AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
  1712         AC_CHECK_HEADER(libusbhid.h, have_libusbhid_h=yes)
  1713         if test x$have_usb_h = xyes; then
  1714             CFLAGS="$CFLAGS -DHAVE_USB_H"
  1715         fi
  1716         if test x$have_usbhid_h = xyes; then
  1717             CFLAGS="$CFLAGS -DHAVE_USBHID_H"
  1718         fi
  1719         if test x$have_libusb_h = xyes; then
  1720             CFLAGS="$CFLAGS -DHAVE_LIBUSB_H"
  1721         fi
  1722         if test x$have_libusbhid_h = xyes; then
  1723             CFLAGS="$CFLAGS -DHAVE_LIBUSBHID_H"
  1724         fi
  1725 
  1726         AC_MSG_CHECKING(for usbhid)
  1727         have_usbhid=no
  1728         AC_TRY_COMPILE([
  1729           #include <sys/types.h>
  1730           #if defined(HAVE_USB_H)
  1731           #include <usb.h>
  1732           #endif
  1733           #include <dev/usb/usb.h>
  1734           #include <dev/usb/usbhid.h>
  1735           #if defined(HAVE_USBHID_H)
  1736           #include <usbhid.h>
  1737           #elif defined(HAVE_LIBUSB_H)
  1738           #include <libusb.h>
  1739           #elif defined(HAVE_LIBUSBHID_H)
  1740           #include <libusbhid.h>
  1741           #endif
  1742         ],[
  1743           struct report_desc *repdesc;
  1744           struct usb_ctl_report *repbuf;
  1745           hid_kind_t hidkind;
  1746         ],[
  1747         have_usbhid=yes
  1748         ])
  1749         AC_MSG_RESULT($have_usbhid)
  1750 
  1751         if test x$have_usbhid = xyes; then
  1752             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1753             have_usbhid_ucr_data=no
  1754             AC_TRY_COMPILE([
  1755               #include <sys/types.h>
  1756               #if defined(HAVE_USB_H)
  1757               #include <usb.h>
  1758               #endif
  1759               #include <dev/usb/usb.h>
  1760               #include <dev/usb/usbhid.h>
  1761               #if defined(HAVE_USBHID_H)
  1762               #include <usbhid.h>
  1763               #elif defined(HAVE_LIBUSB_H)
  1764               #include <libusb.h>
  1765               #elif defined(HAVE_LIBUSBHID_H)
  1766               #include <libusbhid.h>
  1767               #endif
  1768             ],[
  1769               struct usb_ctl_report buf;
  1770               if (buf.ucr_data) { }
  1771             ],[
  1772             have_usbhid_ucr_data=yes
  1773             ])
  1774             if test x$have_usbhid_ucr_data = xyes; then
  1775                 CFLAGS="$CFLAGS -DUSBHID_UCR_DATA"
  1776             fi
  1777             AC_MSG_RESULT($have_usbhid_ucr_data)
  1778             
  1779 	    AC_MSG_CHECKING(for new usbhid API)
  1780             have_usbhid_new=no
  1781             AC_TRY_COMPILE([
  1782               #include <sys/types.h>
  1783               #if defined(HAVE_USB_H)
  1784               #include <usb.h>
  1785               #endif
  1786               #include <dev/usb/usb.h>
  1787               #include <dev/usb/usbhid.h>
  1788               #if defined(HAVE_USBHID_H)
  1789               #include <usbhid.h>
  1790               #elif defined(HAVE_LIBUSB_H)
  1791               #include <libusb.h>
  1792               #elif defined(HAVE_LIBUSBHID_H)
  1793               #include <libusbhid.h>
  1794               #endif
  1795             ],[
  1796               report_desc_t d;
  1797 	      hid_start_parse(d, 1, 1);
  1798             ],[
  1799             have_usbhid_new=yes
  1800             ])
  1801             if test x$have_usbhid_new = xyes; then
  1802                 CFLAGS="$CFLAGS -DUSBHID_NEW"
  1803             fi
  1804             AC_MSG_RESULT($have_usbhid_new)
  1805 
  1806             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
  1807             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
  1808         fi
  1809     fi
  1810 }
  1811 
  1812 dnl Check for altivec instruction support using gas syntax
  1813 CheckAltivec()
  1814 {
  1815     AC_MSG_CHECKING(for GCC Altivec instruction support)
  1816     have_gcc_altivec=no
  1817     AC_TRY_COMPILE([
  1818     ],[
  1819         asm volatile ("mtspr 256, %0\n\t"
  1820                       "vand %%v0, %%v0, %%v0"
  1821                       :
  1822                       : "r" (-1));
  1823     ],[
  1824     have_gcc_altivec=yes
  1825     ])
  1826     if test x$have_gcc_altivec = xyes; then
  1827         CFLAGS="$CFLAGS -DGCC_ALTIVEC"
  1828     fi
  1829     AC_MSG_RESULT($have_gcc_altivec)
  1830 }
  1831 
  1832 case "$target" in
  1833     *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu)
  1834         case "$target" in
  1835           *-*-linux*) ARCH=linux ;;
  1836           *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
  1837           *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
  1838           *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
  1839           *-*-gnu*) ARCH=gnu ;; # must be last
  1840         esac
  1841         CheckDummyVideo
  1842         CheckDiskAudio
  1843         CheckDLOPEN
  1844         CheckNASM
  1845         CheckOSS
  1846         CheckALSA
  1847         CheckARTSC
  1848         CheckESD
  1849         CheckNAS
  1850         CheckX11
  1851         CheckNANOX
  1852         CheckDGA
  1853         CheckFBCON
  1854         CheckDirectFB
  1855         CheckPS2GS
  1856         CheckGGI
  1857         CheckSVGA
  1858         CheckAAlib
  1859         CheckQtopia
  1860         CheckPicoGUI
  1861         CheckOpenGL
  1862         CheckInputEvents
  1863         CheckPTHREAD
  1864         CheckSIGACTION
  1865         CheckAltivec
  1866         # Set up files for the main() stub
  1867         if test "x$video_qtopia" = "xyes"; then
  1868           SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  1869           SDL_LIBS="-lSDLmain $SDL_LIBS"
  1870         fi
  1871         # Set up files for the audio library
  1872         # We use the OSS and ALSA API's, not the Sun audio API
  1873         #if test x$enable_audio = xyes; then
  1874         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1875         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1876         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1877         #fi
  1878         # Set up files for the joystick library
  1879         if test x$enable_joystick = xyes; then
  1880 	  case $ARCH in
  1881 	    linux)
  1882               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
  1883               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
  1884 	    ;;
  1885 	    gnu)
  1886               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1887               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1888 	    ;;
  1889 	    k*bsd-gnu)
  1890               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
  1891               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
  1892 	    ;;
  1893 	  esac
  1894         fi
  1895         # Set up files for the cdrom library
  1896         if test x$enable_cdrom = xyes; then
  1897 	  case $ARCH in
  1898 	    linux)
  1899               CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
  1900               CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
  1901 	    ;;
  1902 	    gnu)
  1903               CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  1904               CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  1905 	    ;;
  1906 	    kfreebsd-gnu)
  1907               CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
  1908               CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
  1909 	    ;;
  1910 	    knetbsd-gnu|kopenbsd-gnu)
  1911               CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  1912               CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  1913 	    ;;
  1914 	  esac
  1915         fi
  1916         # Set up files for the thread library
  1917         if test x$enable_threads = xyes; then
  1918             CopyUnixThreadSource
  1919         fi
  1920         # Set up files for the timer library
  1921         if test x$enable_timers = xyes; then
  1922             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1923         fi
  1924         ;;
  1925     *-*-bsdi*)
  1926         ARCH=bsdi
  1927         CheckDummyVideo
  1928         CheckDiskAudio
  1929         CheckDLOPEN
  1930         CheckNASM
  1931         CheckOSS
  1932         CheckARTSC
  1933         CheckESD
  1934         CheckNAS
  1935         CheckX11
  1936         CheckDGA
  1937         CheckSVGA
  1938         CheckAAlib
  1939         CheckOpenGL
  1940         CheckPTHREAD
  1941         CheckSIGACTION
  1942         # Set up files for the audio library
  1943         # We use the OSS and ALSA API's, not the Sun audio API
  1944         #if test x$enable_audio = xyes; then
  1945         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1946         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1947         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1948         #fi
  1949         # Set up files for the joystick library
  1950         # (No joystick support yet)
  1951         if test x$enable_joystick = xyes; then
  1952             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1953             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1954         fi
  1955         # Set up files for the cdrom library
  1956         if test x$enable_cdrom = xyes; then
  1957             CDROM_SUBDIRS="$CDROM_SUBDIRS bsdi"
  1958             CDROM_DRIVERS="$CDROM_DRIVERS bsdi/libcdrom_bsdi.la"
  1959         fi
  1960         # Set up files for the thread library
  1961         if test x$enable_threads = xyes; then
  1962             CopyUnixThreadSource
  1963         fi
  1964         # Set up files for the timer library
  1965         if test x$enable_timers = xyes; then
  1966             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1967         fi
  1968         ;;
  1969     *-*-freebsd*)
  1970         ARCH=freebsd
  1971         CheckDummyVideo
  1972         CheckDiskAudio
  1973         CheckDLOPEN
  1974         CheckVGL
  1975         CheckNASM
  1976         CheckOSS
  1977         CheckARTSC
  1978         CheckESD
  1979         CheckNAS
  1980         CheckX11
  1981         CheckDGA
  1982         CheckSVGA
  1983         CheckAAlib
  1984         CheckOpenGL
  1985         CheckPTHREAD
  1986         CheckSIGACTION
  1987         CheckUSBHID
  1988         # Set up files for the audio library
  1989         # We use the OSS and ALSA API's, not the Sun audio API
  1990         #if test x$enable_audio = xyes; then
  1991         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1992         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1993         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1994         #fi
  1995         # Set up files for the cdrom library
  1996         if test x$enable_cdrom = xyes; then
  1997             CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
  1998             CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
  1999         fi
  2000         # Set up files for the thread library
  2001         if test x$enable_threads = xyes; then
  2002             CopyUnixThreadSource
  2003         fi
  2004         # Set up files for the timer library
  2005         if test x$enable_timers = xyes; then
  2006             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2007         fi
  2008         ;;
  2009     *-*-netbsd*)
  2010         ARCH=netbsd
  2011         CheckDummyVideo
  2012         CheckDiskAudio
  2013         CheckDLOPEN
  2014         CheckNASM
  2015         CheckOSS
  2016         CheckARTSC
  2017         CheckESD
  2018         CheckNAS
  2019         CheckX11
  2020         CheckAAlib
  2021         CheckOpenGL
  2022         CheckPTHREAD
  2023         CheckSIGACTION
  2024         CheckUSBHID
  2025         # Set up files for the audio library
  2026         if test x$enable_audio = xyes; then
  2027             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2028             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2029             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2030         fi
  2031         # Set up files for the cdrom library
  2032         if test x$enable_cdrom = xyes; then
  2033             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  2034             CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  2035         fi
  2036         # Set up files for the thread library
  2037         if test x$enable_threads = xyes; then
  2038             if test x$use_pthreads = xyes; then
  2039                 CFLAGS="$CFLAGS -D_POSIX_THREAD_SYSCALL_SOFT=1"
  2040             fi
  2041             CopyUnixThreadSource
  2042         fi
  2043         # Set up files for the timer library
  2044         if test x$enable_timers = xyes; then
  2045             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2046         fi
  2047         # NetBSD does not define "unix"
  2048         CFLAGS="$CFLAGS -Dunix"
  2049         ;;
  2050     *-*-openbsd*)
  2051         ARCH=openbsd
  2052         CheckDummyVideo
  2053         CheckDiskAudio
  2054         CheckDLOPEN
  2055         CheckNASM
  2056         CheckOSS
  2057         CheckARTSC
  2058         CheckESD
  2059         CheckNAS
  2060         CheckX11
  2061         CheckAAlib
  2062         CheckOpenGL
  2063         CheckPTHREAD
  2064         CheckSIGACTION
  2065         CheckUSBHID
  2066         # Set up files for the audio library
  2067         if test x$enable_audio = xyes; then
  2068             CFLAGS="$CFLAGS -DOPENBSD_AUDIO_SUPPORT"
  2069             AUDIO_SUBDIRS="$AUDIO_SUBDIRS openbsd"
  2070             AUDIO_DRIVERS="$AUDIO_DRIVERS openbsd/libaudio_openbsd.la"
  2071         fi
  2072         # OpenBSD needs linking with ossaudio emulation library
  2073         if test x$have_oss = xyes; then
  2074             SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio"
  2075         fi
  2076         # Set up files for the cdrom library
  2077         if test x$enable_cdrom = xyes; then
  2078             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  2079             CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  2080         fi
  2081         # Set up files for the thread library
  2082         if test x$enable_threads = xyes; then
  2083             CopyUnixThreadSource
  2084         fi
  2085         # Set up files for the timer library
  2086         if test x$enable_timers = xyes; then
  2087             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2088         fi
  2089         # OpenBSD does not define "unix"
  2090         CFLAGS="$CFLAGS -Dunix"
  2091         ;;
  2092     *-*-sysv5*)
  2093         ARCH=sysv5
  2094         CheckDummyVideo
  2095         CheckDiskAudio
  2096         CheckDLOPEN
  2097         CheckNASM
  2098         CheckOSS
  2099         CheckARTSC
  2100         CheckESD
  2101         CheckNAS
  2102         CheckX11
  2103         CheckAAlib
  2104         CheckOpenGL
  2105         CheckPTHREAD
  2106         CheckSIGACTION
  2107         # Set up files for the audio library
  2108         if test x$enable_audio = xyes; then
  2109             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2110             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2111             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2112         fi
  2113         # Set up files for the joystick library
  2114         # (No joystick support yet)
  2115         if test x$enable_joystick = xyes; then
  2116             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2117             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2118         fi
  2119         # Set up files for the cdrom library
  2120         if test x$enable_cdrom = xyes; then
  2121             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2122             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2123         fi
  2124         # Set up files for the thread library
  2125         if test x$enable_threads = xyes; then
  2126             CopyUnixThreadSource
  2127         fi
  2128         # Set up files for the timer library
  2129         if test x$enable_timers = xyes; then
  2130             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2131         fi
  2132         ;;
  2133     *-*-solaris*)
  2134         ARCH=solaris
  2135         CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
  2136         CheckDummyVideo
  2137         CheckDiskAudio
  2138         CheckDLOPEN
  2139         CheckNASM
  2140         CheckOSS
  2141         CheckARTSC
  2142         CheckESD
  2143         CheckNAS
  2144         CheckX11
  2145         CheckAAlib
  2146         CheckOpenGL
  2147         CheckPTHREAD
  2148         CheckSIGACTION
  2149         # Set up files for the audio library
  2150         if test x$enable_audio = xyes; then
  2151             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2152             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2153             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2154         fi
  2155         # Set up files for the joystick library
  2156         # (No joystick support yet)
  2157         if test x$enable_joystick = xyes; then
  2158             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2159             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2160         fi
  2161         # Set up files for the cdrom library
  2162         if test x$enable_cdrom = xyes; then
  2163             CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
  2164             CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
  2165         fi
  2166         # Set up files for the thread library
  2167         if test x$enable_threads = xyes; then
  2168             CopyUnixThreadSource
  2169         fi
  2170         # Set up files for the timer library
  2171         if test x$enable_timers = xyes; then
  2172             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2173         fi
  2174         ;;
  2175     *-*-irix*)
  2176         ARCH=irix
  2177         CheckDummyVideo
  2178         CheckDiskAudio
  2179         CheckDLOPEN
  2180         CheckDMEDIA
  2181         CheckESD
  2182         CheckNAS
  2183         CheckX11
  2184         CheckAAlib
  2185         CheckOpenGL
  2186         CheckPTHREAD
  2187         CheckSIGACTION
  2188         # We use the dmedia audio API, not the Sun audio API
  2189         #if test x$enable_audio = xyes; then
  2190         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2191         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2192         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2193         #fi
  2194         # Set up files for the joystick library
  2195         # (No joystick support yet)
  2196         if test x$enable_joystick = xyes; then
  2197             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2198             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2199         fi
  2200         # Set up files for the cdrom library
  2201         # (No CD-ROM support yet)
  2202         if test x$enable_cdrom = xyes; then
  2203             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2204             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2205         fi
  2206         # Set up files for the thread library
  2207         if test x$enable_threads = xyes; then
  2208             if test x$use_pthreads = xyes -o x$use_pth = xyes; then
  2209                 CopyUnixThreadSource
  2210             else
  2211                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
  2212                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
  2213                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  2214                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  2215                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  2216                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2217                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2218                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2219             fi
  2220         fi
  2221         # Set up files for the timer library
  2222         if test x$enable_timers = xyes; then
  2223             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2224         fi
  2225         ;;
  2226     *-*-hpux*)
  2227         ARCH=hpux
  2228         CheckDummyVideo
  2229         CheckDiskAudio
  2230         CheckDLOPEN
  2231         CheckOSS
  2232         CheckNAS
  2233         CheckX11
  2234         CheckGGI
  2235         CheckAAlib
  2236         CheckOpenGL
  2237         CheckPTHREAD
  2238         CheckSIGACTION
  2239         # Set up files for the audio library
  2240         if test x$enable_audio = xyes; then
  2241             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2242             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2243             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2244         fi
  2245         # Set up files for the joystick library
  2246         # (No joystick support yet)
  2247         if test x$enable_joystick = xyes; then
  2248             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2249             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2250         fi
  2251         # Set up files for the cdrom library
  2252         # (No CD-ROM support yet)
  2253         if test x$enable_cdrom = xyes; then
  2254             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2255             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2256         fi
  2257         # Set up files for the thread library
  2258         if test x$enable_threads = xyes; then
  2259             CopyUnixThreadSource
  2260         fi
  2261         # Set up files for the timer library
  2262         if test x$enable_timers = xyes; then
  2263             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2264         fi
  2265         ;;
  2266     *-*-aix*)
  2267         ARCH=aix
  2268         CheckDummyVideo
  2269         CheckDiskAudio
  2270         CheckDLOPEN
  2271         CheckOSS
  2272         CheckNAS
  2273         CheckX11
  2274         CheckGGI
  2275         CheckAAlib
  2276         CheckOpenGL
  2277         CheckPTHREAD
  2278         CheckSIGACTION
  2279         # Set up files for the audio library
  2280         if test x$enable_audio = xyes; then
  2281             AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
  2282             AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la"
  2283         fi
  2284         # Set up files for the joystick library
  2285         # (No joystick support yet)
  2286         if test x$enable_joystick = xyes; then
  2287             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2288             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2289         fi
  2290         # Set up files for the cdrom library
  2291         if test x$enable_cdrom = xyes; then
  2292             CDROM_SUBDIRS="$CDROM_SUBDIRS aix"
  2293             CDROM_DRIVERS="$CDROM_DRIVERS aix/libcdrom_aix.la"
  2294         fi
  2295         # Set up files for the thread library
  2296         if test x$enable_threads = xyes; then
  2297             CopyUnixThreadSource
  2298         fi
  2299         # Set up files for the timer library
  2300         if test x$enable_timers = xyes; then
  2301             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2302         fi
  2303         ;;
  2304     *-*-osf*)
  2305         ARCH=osf
  2306         CheckDummyVideo
  2307         CheckDiskAudio
  2308         CheckDLOPEN
  2309         CheckNAS
  2310         CheckX11
  2311         CheckGGI
  2312         CheckAAlib
  2313         CheckOpenGL
  2314         CheckPTHREAD
  2315         CheckSIGACTION
  2316         # Set up files for the audio library
  2317         if test x$enable_audio = xyes; then
  2318             CFLAGS="$CFLAGS -I/usr/include/mme -DMMEAUDIO_SUPPORT"
  2319             SYSTEM_LIBS="$SYSTEM_LIBS -lmme"
  2320             AUDIO_SUBDIRS="$AUDIO_SUBDIRS mme"
  2321             AUDIO_DRIVERS="$AUDIO_DRIVERS mme/libaudio_mme.la"
  2322         fi
  2323         # Set up files for the joystick library
  2324         # (No joystick support yet)
  2325         if test x$enable_joystick = xyes; then
  2326             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2327             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2328         fi
  2329         # Set up files for the cdrom library
  2330         # (No cdrom support yet)
  2331         if test x$enable_cdrom = xyes; then
  2332             CDROM_SUBDIRS="$CDROM_SUBDIRS osf"
  2333             CDROM_DRIVERS="$CDROM_DRIVERS osf/libcdrom_osf.la"
  2334         fi
  2335         # Set up files for the thread library
  2336         if test x$enable_threads = xyes; then
  2337             CopyUnixThreadSource
  2338         fi
  2339         # Set up files for the timer library
  2340         if test x$enable_timers = xyes; then
  2341             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2342         fi
  2343         ;;
  2344     *-*-qnx*)
  2345         ARCH=qnx
  2346         CheckDummyVideo
  2347         CheckDiskAudio
  2348         # CheckNASM
  2349         CheckDLOPEN
  2350         CheckNAS
  2351         CheckPHOTON
  2352         CheckX11
  2353         CheckOpenGL
  2354         CheckPTHREAD
  2355         CheckSIGACTION
  2356         # Set up files for the audio library
  2357         if test x$enable_audio = xyes; then
  2358             CFLAGS="$CFLAGS -DQNXNTOAUDIO_SUPPORT"
  2359             SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
  2360             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto"
  2361             AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la"
  2362         fi
  2363         # Set up files for the joystick library
  2364         if test x$enable_joystick = xyes; then
  2365         # (No joystick support yet)
  2366             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2367             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2368         fi
  2369         # Set up files for the cdrom library
  2370         if test x$enable_cdrom = xyes; then
  2371             CDROM_SUBDIRS="$CDROM_SUBDIRS qnx"
  2372             CDROM_DRIVERS="$CDROM_DRIVERS qnx/libcdrom_qnx.la"
  2373         fi
  2374         # Set up files for the thread library
  2375         if test x$enable_threads = xyes; then
  2376             CopyUnixThreadSource
  2377         fi
  2378         # Set up files for the timer library
  2379         if test x$enable_timers = xyes; then
  2380             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2381         fi
  2382         ;;
  2383     *-*-cygwin* | *-*-mingw32*)
  2384         ARCH=win32
  2385         if test "$build" != "$target"; then # cross-compiling
  2386             # Default cross-compile location
  2387             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2388         else
  2389             # Look for the location of the tools and install there
  2390             if test "$BUILD_PREFIX" != ""; then
  2391                 ac_default_prefix=$BUILD_PREFIX
  2392             fi
  2393         fi
  2394         CheckDummyVideo
  2395         CheckDiskAudio
  2396         CheckWIN32
  2397         CheckDIRECTX
  2398         CheckNASM
  2399         # Set up files for the audio library
  2400         if test x$enable_audio = xyes; then
  2401             AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
  2402             AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la"
  2403             if test x$use_directx = xyes; then
  2404                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5"
  2405                 AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la"
  2406             fi
  2407         fi
  2408         # Set up files for the joystick library
  2409         if test x$enable_joystick = xyes; then
  2410             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32"
  2411             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la"
  2412         fi
  2413         # Set up files for the cdrom library
  2414         if test x$enable_cdrom = xyes; then
  2415             CDROM_SUBDIRS="$CDROM_SUBDIRS win32"
  2416             CDROM_DRIVERS="$CDROM_DRIVERS win32/libcdrom_win32.la"
  2417         fi
  2418         # Set up files for the thread library
  2419         if test x$enable_threads = xyes; then
  2420             COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
  2421             COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
  2422             COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c)
  2423             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2424             COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c)
  2425             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2426             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2427             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2428         fi
  2429         # Set up files for the timer library
  2430         if test x$enable_timers = xyes; then
  2431             COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c)
  2432         fi
  2433         # The Win32 platform requires special setup
  2434         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2435         case "$target" in
  2436             *-*-cygwin*)
  2437                 CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
  2438                 SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
  2439                 LIBS="$LIBS -mno-cygwin"
  2440                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
  2441                 ;;
  2442             *-*-mingw32*)
  2443                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2444                 ;;
  2445         esac
  2446         ;;
  2447     *-*-beos*)
  2448         ARCH=beos
  2449         ac_default_prefix=/boot/develop/tools/gnupro
  2450         CheckDummyVideo
  2451         CheckDiskAudio
  2452         CheckNASM
  2453         CheckBWINDOW
  2454         CheckBeGL
  2455         # Set up files for the audio library
  2456         if test x$enable_audio = xyes; then
  2457             AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
  2458             AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la"
  2459         fi
  2460         # Set up files for the joystick library
  2461         if test x$enable_joystick = xyes; then
  2462             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos"
  2463             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la"
  2464         fi
  2465         # Set up files for the cdrom library
  2466         if test x$enable_cdrom = xyes; then
  2467             CDROM_SUBDIRS="$CDROM_SUBDIRS beos"
  2468             CDROM_DRIVERS="$CDROM_DRIVERS beos/libcdrom_beos.la"
  2469         fi
  2470         # Set up files for the thread library
  2471         if test x$enable_threads = xyes; then
  2472             COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
  2473             COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
  2474             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  2475             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2476             COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c)
  2477             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2478             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2479             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2480         fi
  2481         # Set up files for the timer library
  2482         if test x$enable_timers = xyes; then
  2483             COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c)
  2484         fi
  2485         # The BeOS platform requires special libraries
  2486         SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2487         ;;
  2488     *-*-macos*)
  2489         # This would be used if cross-compiling to MacOS 9.  No way to
  2490         # use it at present, but Apple is working on a X-to-9 compiler
  2491         # for which this case would be handy.
  2492         ARCH=macos
  2493         CheckDummyVideo
  2494         CheckDiskAudio
  2495         CheckTOOLBOX
  2496         CheckMacGL
  2497         # Set up files for the audio library
  2498         if test x$enable_audio = xyes; then
  2499             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  2500             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  2501         fi
  2502         # Set up files for the joystick library
  2503         if test x$enable_joystick = xyes; then
  2504             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos"
  2505             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la"
  2506         fi
  2507         # Set up files for the cdrom library
  2508         if test x$enable_cdrom = xyes; then
  2509             CDROM_SUBDIRS="$CDROM_SUBDIRS macos"
  2510             CDROM_DRIVERS="$CDROM_DRIVERS macos/libcdrom_macos.la"
  2511         fi
  2512         # Set up files for the thread library
  2513         if test x$enable_threads = xyes; then
  2514             COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
  2515             COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
  2516             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  2517             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2518             COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c)
  2519             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2520             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2521             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2522         fi
  2523         # Set up files for the timer library
  2524         if test x$enable_timers = xyes; then
  2525             COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c)
  2526         fi
  2527         # The MacOS platform requires special setup
  2528         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2529         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2530         ;;
  2531     *-*-darwin* )
  2532         # Strictly speaking, we want "Mac OS X", not "Darwin", which is
  2533         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2534         # But config.guess comes back with "darwin", so go with the flow.
  2535         ARCH=macosx
  2536         CheckDummyVideo
  2537         CheckDiskAudio
  2538         CheckQUARTZ
  2539         CheckMacGL
  2540         CheckPTHREAD
  2541         CheckSIGACTION
  2542         # If either the audio or CD driver is used, add the AudioUnit framework
  2543         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2544             SYSTEM_LIBS="$SYSTEM_LIBS -framework AudioToolbox -framework AudioUnit"
  2545         fi
  2546         # Set up files for the audio library
  2547         if test x$enable_audio = xyes; then
  2548             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macosx"
  2549             AUDIO_DRIVERS="$AUDIO_DRIVERS macosx/libaudio_macosx.la"
  2550             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  2551             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  2552         fi
  2553         # Set up files for the joystick library
  2554         if test x$enable_joystick = xyes; then
  2555             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin"
  2556             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la"
  2557             SYSTEM_LIBS="$SYSTEM_LIBS -framework IOKit"
  2558         fi
  2559         # Set up files for the cdrom library
  2560         if test x$enable_cdrom = xyes; then
  2561             CDROM_SUBDIRS="$CDROM_SUBDIRS macosx"
  2562             CDROM_DRIVERS="$CDROM_DRIVERS macosx/libcdrom_macosx.la"
  2563             SYSTEM_LIBS="$SYSTEM_LIBS -lstdc++"
  2564         fi
  2565         # Set up files for the thread library
  2566         if test x$enable_threads = xyes; then
  2567             CopyUnixThreadSource
  2568         fi
  2569         # Set up files for the timer library
  2570         if test x$enable_timers = xyes; then
  2571             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2572         fi
  2573         # The MacOS X platform requires special setup.
  2574         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2575         # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2576         SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa -framework Carbon -framework QuickTime"
  2577         ;;
  2578     *-*-mint*)
  2579         ARCH=mint
  2580         CheckDummyVideo
  2581         CheckDiskAudio
  2582         CheckAtariBiosEvent
  2583         CheckAtariXbiosVideo
  2584         CheckAtariGemVideo
  2585         CheckAtariAudio
  2586         CheckAtariLdg
  2587         CheckPTH
  2588 		CheckOSMesa
  2589         # Set up files for the audio library
  2590         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2591             if test x$enable_audio = xyes; then
  2592                 CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2593                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2594                 AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2595             fi
  2596         fi
  2597         # Set up files for the joystick library
  2598         if test x$enable_joystick = xyes; then
  2599             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS mint"
  2600             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS mint/libjoystick_mint.la"
  2601         fi
  2602         # Set up files for the cdrom library
  2603         if test x$enable_cdrom = xyes; then
  2604             CDROM_SUBDIRS="$CDROM_SUBDIRS mint"
  2605             CDROM_DRIVERS="$CDROM_DRIVERS mint/libcdrom_mint.la"
  2606         fi
  2607         # Set up files for the thread library
  2608         if test x$enable_threads = xyes; then
  2609             CopyUnixThreadSource
  2610         fi
  2611         # Set up files for the timer library
  2612         if test x$enable_timers = xyes; then
  2613             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2614                 COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2615             else
  2616                 COPY_ARCH_SRC(src/timer, mint, SDL_systimer.c)
  2617             fi
  2618         fi
  2619         # MiNT does not define "unix"
  2620         CFLAGS="$CFLAGS -Dunix"
  2621         ;;
  2622     *-*-riscos)
  2623         ARCH=riscos
  2624         # Set up files for the video library
  2625         if test x$enable_video = xyes; then
  2626             VIDEO_SUBDIRS="$VIDEO_SUBDIRS riscos"
  2627             VIDEO_DRIVERS="$VIDEO_DRIVERS riscos/libvideo_riscos.la"
  2628         fi
  2629         # Set up files for the audio library
  2630         if test x$enable_audio = xyes; then
  2631             AUDIO_SUBDIRS="$AUDIO_SUBDIRS riscos"
  2632             AUDIO_DRIVERS="$AUDIO_DRIVERS riscos/libaudio_riscos.la"
  2633         fi
  2634         # Set up files for the joystick library
  2635         if test x$enable_joystick = xyes; then
  2636             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS riscos"
  2637             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS riscos/libjoystick_riscos.la"
  2638         fi
  2639         # Set up files for the cdrom library
  2640         if test x$enable_cdrom = xyes; then
  2641             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2642             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2643         fi
  2644         # Set up files for the thread library
  2645         if test x$enable_threads = xyes; then
  2646             COPY_ARCH_SRC(src/thread, riscos, SDL_systhread.c)
  2647             COPY_ARCH_SRC(src/thread, riscos, SDL_systhread_c.h)
  2648             COPY_ARCH_SRC(src/thread, riscos, SDL_sysmutex.c)
  2649             COPY_ARCH_SRC(src/thread, riscos, SDL_sysmutex_c.h)
  2650             COPY_ARCH_SRC(src/thread, riscos, SDL_syssem.c)
  2651             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2652             COPY_ARCH_SRC(src/thread, riscos, SDL_syscond.c)
  2653             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2654         else
  2655             CFLAGS="$CFLAGS -DDISABLE_THREADS"
  2656         fi
  2657         # Set up files for the timer library
  2658         if test x$enable_timers = xyes; then
  2659             COPY_ARCH_SRC(src/timer, riscos, SDL_systimer.c)
  2660         fi
  2661 
  2662         CFLAGS="$CFLAGS -DENABLE_RISCOS -DDRENDERER_SUPPORT"
  2663 
  2664         SYSTEM_LIBS="$SYSTEM_LIBS -ljpeg -ltiff -lpng -lz"
  2665         ;;
  2666     *)
  2667         AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
  2668         ;;
  2669 esac
  2670 AC_SUBST(ARCH)
  2671 
  2672 # Set the conditional variables for this target
  2673 AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
  2674 AM_CONDITIONAL(TARGET_QTOPIA, test "x$video_qtopia" = "xyes")
  2675 AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
  2676 AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
  2677 AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
  2678 AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
  2679 AM_CONDITIONAL(TARGET_NETBSD, test $ARCH = netbsd)
  2680 AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd)
  2681 AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix)
  2682 AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
  2683 AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
  2684 AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
  2685 AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
  2686 AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
  2687 AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)
  2688 
  2689 # More automake conditionals
  2690 AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
  2691 AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
  2692 AM_CONDITIONAL(HAVE_NASM, test x$use_nasm = xyes)
  2693 
  2694 # Set conditional variables for shared and static library selection.
  2695 # These are not used in any Makefile.am but in sdl-config.in.
  2696 AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
  2697 AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes])
  2698 
  2699 # Set runtime shared library paths as needed
  2700 
  2701 if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
  2702   SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2703 fi
  2704 if test $ARCH = solaris; then
  2705   SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2706 fi
  2707 
  2708 case "$ARCH" in
  2709   openbsd | netbsd | bsdi)
  2710     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2711     ;;
  2712   qnx)
  2713     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2714     ;;
  2715   macosx)
  2716     SHARED_SYSTEM_LIBS="-framework Cocoa"
  2717     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2718       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
  2719     fi
  2720     ;;
  2721   *)
  2722     SHARED_SYSTEM_LIBS=""
  2723     ;;
  2724 esac
  2725 
  2726 case "$ARCH" in
  2727   macosx)
  2728     # Evil hack to allow static linking on Mac OS X
  2729     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a"
  2730     ;;
  2731   *)
  2732     SDL_STATIC_LIBS="$SDL_LIBS"
  2733     ;;
  2734 esac
  2735 
  2736 
  2737 STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
  2738 
  2739 dnl Output the video drivers we use
  2740 if test x$enable_video = xtrue; then
  2741     if test "$VIDEO_SUBDIRS" = ""; then
  2742         AC_MSG_ERROR(*** No video drivers are enabled!)
  2743     fi
  2744 fi
  2745 AC_SUBST(AUDIO_SUBDIRS)
  2746 AC_SUBST(AUDIO_DRIVERS)
  2747 AC_SUBST(VIDEO_SUBDIRS)
  2748 AC_SUBST(VIDEO_DRIVERS)
  2749 AC_SUBST(JOYSTICK_SUBDIRS)
  2750 AC_SUBST(JOYSTICK_DRIVERS)
  2751 AC_SUBST(CDROM_SUBDIRS)
  2752 AC_SUBST(CDROM_DRIVERS)
  2753 AC_SUBST(SDL_EXTRADIRS)
  2754 AC_SUBST(SDL_EXTRALIBS)
  2755 
  2756 dnl Expand the cflags and libraries needed by apps using SDL
  2757 AC_SUBST(SDL_CFLAGS)
  2758 AC_SUBST(SDL_LIBS)
  2759 AC_SUBST(SDL_STATIC_LIBS)
  2760 AC_SUBST(SDL_RLD_FLAGS)
  2761 
  2762 dnl Expand the libraries needed for static and dynamic linking
  2763 AC_SUBST(STATIC_SYSTEM_LIBS)
  2764 AC_SUBST(SHARED_SYSTEM_LIBS)
  2765 AC_SUBST(SYSTEM_LIBS)
  2766 
  2767 dnl Expand the include directories for building SDL
  2768 CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
  2769 CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
  2770 CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/main/$ARCH"
  2771 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
  2772 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
  2773 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/XFree86/extensions"
  2774 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
  2775 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
  2776 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
  2777 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
  2778 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
  2779 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian"
  2780 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
  2781 CFLAGS="$CFLAGS -I\$(top_builddir)/src/thread"
  2782 CXXFLAGS="$CFLAGS"
  2783 
  2784 
  2785 # Check for darwin at the very end and set up the Objective C compiler
  2786 # We do this here so that we get the full CFLAGS into OBJCFLAGS
  2787 case "$target" in
  2788     *-*-darwin*)
  2789         dnl AC_PROG_OBJC doesn't seem to exist, this is the SDL workaround
  2790         AC_MSG_CHECKING(for an Objective-C compiler)
  2791         OBJC="$CC"
  2792         AC_SUBST(OBJC)
  2793         OBJCFLAGS="$CFLAGS"
  2794         AC_SUBST(OBJCFLAGS)
  2795         dnl _AM_DEPENDENCIES(OBJC) doesn't work, so hard code OBJCDEPMODE here
  2796         dnl _AM_DEPENDENCIES(OBJC)
  2797         dnl Of course, hard coding doesn't work for some versions of automake
  2798         OBJCDEPMODE="depmode=gcc"
  2799         AC_SUBST(OBJCDEPMODE)
  2800         dnl Trying this to satisfy everybody...
  2801         AC_MSG_RESULT(not implemented yet)
  2802         ;;
  2803 esac
  2804 
  2805 # Finally create all the generated files
  2806 dnl Important: Any directory that you want to be in the distcheck should
  2807 dnl            have a file listed here, so that configure generates the
  2808 dnl            subdirectories on the build target.
  2809 AC_OUTPUT([
  2810 Makefile
  2811 docs/Makefile
  2812 docs/html/Makefile
  2813 docs/man3/Makefile
  2814 include/Makefile
  2815 src/Makefile
  2816 src/main/Makefile
  2817 src/main/macosx/Makefile
  2818 src/main/macosx/Info.plist
  2819 src/audio/Makefile
  2820 src/audio/alsa/Makefile
  2821 src/audio/arts/Makefile
  2822 src/audio/baudio/Makefile
  2823 src/audio/dc/Makefile
  2824 src/audio/disk/Makefile
  2825 src/audio/dma/Makefile
  2826 src/audio/dmedia/Makefile
  2827 src/audio/dsp/Makefile
  2828 src/audio/esd/Makefile
  2829 src/audio/macosx/Makefile
  2830 src/audio/macrom/Makefile
  2831 src/audio/mint/Makefile
  2832 src/audio/mme/Makefile
  2833 src/audio/nas/Makefile
  2834 src/audio/nto/Makefile
  2835 src/audio/openbsd/Makefile
  2836 src/audio/paudio/Makefile
  2837 src/audio/riscos/Makefile
  2838 src/audio/sun/Makefile
  2839 src/audio/ums/Makefile
  2840 src/audio/windib/Makefile
  2841 src/audio/windx5/Makefile
  2842 src/video/Makefile
  2843 src/video/aalib/Makefile
  2844 src/video/ataricommon/Makefile
  2845 src/video/bwindow/Makefile
  2846 src/video/cybergfx/Makefile
  2847 src/video/dc/Makefile
  2848 src/video/dga/Makefile
  2849 src/video/directfb/Makefile
  2850 src/video/dummy/Makefile
  2851 src/video/epoc/Makefile
  2852 src/video/fbcon/Makefile
  2853 src/video/gem/Makefile
  2854 src/video/ggi/Makefile
  2855 src/video/maccommon/Makefile
  2856 src/video/macdsp/Makefile
  2857 src/video/macrom/Makefile
  2858 src/video/nanox/Makefile
  2859 src/video/photon/Makefile
  2860 src/video/picogui/Makefile
  2861 src/video/ps2gs/Makefile
  2862 src/video/qtopia/Makefile
  2863 src/video/quartz/Makefile
  2864 src/video/riscos/Makefile
  2865 src/video/svga/Makefile
  2866 src/video/vgl/Makefile
  2867 src/video/wincommon/Makefile
  2868 src/video/windib/Makefile
  2869 src/video/windx5/Makefile
  2870 src/video/x11/Makefile
  2871 src/video/xbios/Makefile
  2872 src/video/XFree86/Makefile
  2873 src/video/XFree86/extensions/Makefile
  2874 src/video/XFree86/Xinerama/Makefile
  2875 src/video/XFree86/Xv/Makefile
  2876 src/video/XFree86/Xxf86dga/Makefile
  2877 src/video/XFree86/Xxf86vm/Makefile
  2878 src/events/Makefile
  2879 src/joystick/Makefile
  2880 src/joystick/amigaos/Makefile
  2881 src/joystick/beos/Makefile
  2882 src/joystick/bsd/Makefile
  2883 src/joystick/darwin/Makefile
  2884 src/joystick/dc/Makefile
  2885 src/joystick/dummy/Makefile
  2886 src/joystick/linux/Makefile
  2887 src/joystick/macos/Makefile
  2888 src/joystick/mint/Makefile
  2889 src/joystick/riscos/Makefile
  2890 src/joystick/win32/Makefile
  2891 src/cdrom/Makefile
  2892 src/cdrom/aix/Makefile
  2893 src/cdrom/beos/Makefile
  2894 src/cdrom/dc/Makefile
  2895 src/cdrom/dummy/Makefile
  2896 src/cdrom/bsdi/Makefile
  2897 src/cdrom/freebsd/Makefile
  2898 src/cdrom/linux/Makefile
  2899 src/cdrom/macos/Makefile
  2900 src/cdrom/macosx/Makefile
  2901 src/cdrom/mint/Makefile
  2902 src/cdrom/openbsd/Makefile
  2903 src/cdrom/osf/Makefile
  2904 src/cdrom/qnx/Makefile
  2905 src/cdrom/win32/Makefile
  2906 src/thread/Makefile
  2907 src/timer/Makefile
  2908 src/endian/Makefile
  2909 src/file/Makefile
  2910 src/cpuinfo/Makefile
  2911 src/hermes/Makefile
  2912 sdl-config
  2913 SDL.spec
  2914 SDL.qpg
  2915 ], [chmod +x sdl-config])