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