configure.in
author Sam Lantinga <slouken@libsdl.org>
Tue, 24 Feb 2004 19:22:22 +0000
changeset 856 d3165b90ee42
parent 846 96ba4eab74fb
child 865 92615154bb68
permissions -rw-r--r--
Date: Mon, 23 Feb 2004 19:00:23 +0100
From: "Juergen \"George\" Sawinski"
Subject: Problems compiling libsdl with gcc 3.3

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