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