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