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