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