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