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