configure.in
author Sam Lantinga <slouken@lokigames.com>
Thu, 10 May 2001 18:04:03 +0000
changeset 16 735e5a8696d0
parent 1 cf2af46e9e2a
child 19 8cc4dbfab9ab
permissions -rw-r--r--
Added --disable-dga configure option to disable DGA entirely
     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=1
    18 SDL_INTERFACE_AGE=1
    19 SDL_BINARY_AGE=1
    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 Setup for automake
    41 AM_INIT_AUTOMAKE(SDL, $SDL_VERSION)
    42 
    43 dnl Detect the canonical host and target build environment
    44 AC_CANONICAL_HOST
    45 AC_CANONICAL_TARGET
    46 
    47 dnl Check for tools
    48 
    49 AC_LIBTOOL_WIN32_DLL
    50 AM_PROG_LIBTOOL
    51 AC_PROG_MAKE_SET
    52 AC_PROG_CC
    53 AC_C_INLINE
    54 AC_C_CONST
    55 case "$target" in
    56     *-*-beos*)
    57         AC_PROG_CXX
    58         ;;
    59     *-*-aix*)
    60         AC_PROG_CXX
    61         ;;
    62     # This is stupid, but necessary on some versions of Linux (joysticks)
    63     *-*-linux*)
    64         AC_PROG_CXX
    65         ;;
    66 esac
    67 AC_PROG_INSTALL
    68 AC_FUNC_ALLOCA
    69 
    70 dnl The alpha architecture needs special flags for binary portability
    71 case "$target" in
    72     alpha*-*-linux*)
    73         if test x$ac_cv_prog_gcc = xyes; then
    74             CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
    75         fi
    76         ;;
    77 esac
    78 
    79 dnl Add compiler-specific optimization flags
    80 
    81 dnl See if the user wants aggressive optimizations of the code
    82 AC_ARG_ENABLE(debug,
    83 [  --enable-debug          Disable aggressive optimizations [default=yes]],
    84               , enable_debug=yes)
    85 if test x$enable_debug != xyes; then
    86     if test x$ac_cv_prog_gcc = xyes; then
    87         CFLAGS="$CFLAGS -fexpensive-optimizations"
    88         # Ack! This breaks the MMX YV12 conversion on gcc 2.95.2
    89         # CFLAGS="$CFLAGS -fomit-frame-pointer"
    90     fi
    91     case "$target" in
    92         i486-*-*)
    93             if test x$ac_cv_prog_gcc = xyes; then
    94                 CFLAGS="$CFLAGS -march=486"
    95             fi
    96             ;;
    97         i?86-*-*)
    98             if test x$ac_cv_prog_gcc = xyes; then
    99                 CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro"
   100             fi
   101             ;;
   102         *-*-osf*)
   103             if test x$ac_cv_prog_gcc != xyes; then
   104                 CFLAGS="-g3 -fast -arch host"
   105             fi
   106             ;;
   107     esac
   108 fi
   109 
   110 dnl Add verbose warnings by default, and allow ANSI compliance checking
   111 AC_ARG_ENABLE(strict-ansi,
   112 [  --enable-strict-ansi    Enable strict ANSI compliance build [default=no]],
   113               , enable_strict_ansi=no)
   114 if test x$ac_cv_prog_gcc = xyes; then
   115     CFLAGS="$CFLAGS -Wall"
   116     if test x$enable_strict_ansi = xyes; then
   117         CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
   118     fi
   119 fi
   120 
   121 dnl Initialize the compiler and linker flags for SDL applications
   122 
   123 SDL_CFLAGS=""
   124 SDL_LIBS="-lSDL"
   125 
   126 dnl Add the math library for the new gamma correction support
   127 
   128 case "$target" in
   129     *-*-cygwin* | *-*-mingw32*)
   130         MATHLIB=""
   131         ;;
   132     *-*-beos*)
   133         MATHLIB=""
   134         ;;
   135     *-*-darwin*)
   136         MATHLIB=""
   137         ;;
   138     *)
   139         MATHLIB="-lm"
   140         ;;
   141 esac
   142 SYSTEM_LIBS="$SYSTEM_LIBS $MATHLIB"
   143 
   144 dnl Enable/disable various subsystems of the SDL library
   145 
   146 AC_ARG_ENABLE(audio,
   147 [  --enable-audio          Enable the audio subsystem [default=yes]],
   148               , enable_audio=yes)
   149 if test x$enable_audio = xyes; then
   150     SDL_EXTRADIRS="$SDL_EXTRADIRS audio"
   151     SDL_EXTRALIBS="$SDL_EXTRALIBS audio/libaudio.la"
   152 else
   153     CFLAGS="$CFLAGS -DDISABLE_AUDIO"
   154 fi
   155 AC_ARG_ENABLE(video,
   156 [  --enable-video          Enable the video subsystem [default=yes]],
   157               , enable_video=yes)
   158 if test x$enable_video = xyes; then
   159     SDL_EXTRADIRS="$SDL_EXTRADIRS video"
   160     SDL_EXTRALIBS="$SDL_EXTRALIBS video/libvideo.la"
   161 else
   162     CFLAGS="$CFLAGS -DDISABLE_VIDEO"
   163 fi
   164 AC_ARG_ENABLE(events,
   165 [  --enable-events         Enable the events subsystem [default=yes]],
   166               , enable_events=yes)
   167 if test x$enable_video = xyes -a x$enable_events = xyes; then
   168     SDL_EXTRADIRS="$SDL_EXTRADIRS events"
   169     SDL_EXTRALIBS="$SDL_EXTRALIBS events/libevents.la"
   170 else
   171     CFLAGS="$CFLAGS -DDISABLE_EVENTS"
   172 fi
   173 AC_ARG_ENABLE(joystick,
   174 [  --enable-joystick       Enable the joystick subsystem [default=yes]],
   175               , enable_joystick=yes)
   176 if test x$enable_joystick = xyes; then
   177     SDL_EXTRADIRS="$SDL_EXTRADIRS joystick"
   178     SDL_EXTRALIBS="$SDL_EXTRALIBS joystick/libjoystick.la"
   179 else
   180     CFLAGS="$CFLAGS -DDISABLE_JOYSTICK"
   181 fi
   182 AC_ARG_ENABLE(cdrom,
   183 [  --enable-cdrom          Enable the cdrom subsystem [default=yes]],
   184               , enable_cdrom=yes)
   185 if test x$enable_cdrom = xyes; then
   186     SDL_EXTRADIRS="$SDL_EXTRADIRS cdrom"
   187     SDL_EXTRALIBS="$SDL_EXTRALIBS cdrom/libcdrom.la"
   188 else
   189     CFLAGS="$CFLAGS -DDISABLE_CDROM"
   190 fi
   191 AC_ARG_ENABLE(threads,
   192 [  --enable-threads        Enable the threading subsystem [default=yes]],
   193               , enable_threads=yes)
   194 SDL_EXTRADIRS="$SDL_EXTRADIRS thread"
   195 SDL_EXTRALIBS="$SDL_EXTRALIBS thread/libthread.la"
   196 if test x$enable_threads != xyes; then
   197     CFLAGS="$CFLAGS -DDISABLE_THREADS"
   198     COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
   199     COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
   200     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
   201     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
   202     COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
   203     COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
   204     COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
   205     COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
   206 fi
   207 AC_ARG_ENABLE(timers,
   208 [  --enable-timers         Enable the timer subsystem [default=yes]],
   209               , enable_timers=yes)
   210 if test x$enable_timers = xyes; then
   211     SDL_EXTRADIRS="$SDL_EXTRADIRS timer"
   212     SDL_EXTRALIBS="$SDL_EXTRALIBS timer/libtimer.la"
   213 else
   214     CFLAGS="$CFLAGS -DDISABLE_TIMERS"
   215 fi
   216 AC_ARG_ENABLE(endian,
   217 [  --enable-endian         Enable the endian subsystem [default=yes]],
   218               , enable_endian=yes)
   219 if test x$enable_endian = xyes; then
   220     SDL_EXTRADIRS="$SDL_EXTRADIRS endian"
   221     SDL_EXTRALIBS="$SDL_EXTRALIBS endian/libendian.la"
   222 else
   223     CFLAGS="$CFLAGS -DDISABLE_ENDIAN"
   224 fi
   225 AC_ARG_ENABLE(file,
   226 [  --enable-file           Enable the file subsystem [default=yes]],
   227               , enable_file=yes)
   228 if test x$enable_file = xyes; then
   229     SDL_EXTRADIRS="$SDL_EXTRADIRS file"
   230     SDL_EXTRALIBS="$SDL_EXTRALIBS file/libfile.la"
   231 else
   232     CFLAGS="$CFLAGS -DDISABLE_FILE"
   233 fi
   234 
   235 dnl See if the OSS audio interface is supported
   236 CheckOSS()
   237 {
   238     AC_ARG_ENABLE(oss,
   239 [  --enable-oss            support the OSS audio API [default=yes]],
   240                   , enable_oss=yes)
   241     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
   242         AC_MSG_CHECKING(for OSS audio support)
   243         have_oss=no
   244         AC_TRY_COMPILE([
   245           #ifdef linux
   246           #include <linux/soundcard.h>
   247           #endif
   248           #ifdef __FreeBSD__
   249           #include <machine/soundcard.h>
   250           #endif
   251           #ifdef __bsdi__
   252           #include <sys/soundcard.h>
   253           #endif
   254           #ifdef __OpenBSD__
   255           #include <soundcard.h>
   256           #endif
   257           #ifdef __USLC__
   258           #include <sys/soundcard.h>
   259           #endif
   260         ],[
   261 	  int arg = SNDCTL_DSP_SETFRAGMENT;
   262         ],[
   263         have_oss=yes
   264         ])
   265         AC_MSG_RESULT($have_oss)
   266         if test x$have_oss = xyes; then
   267             CFLAGS="$CFLAGS -DOSS_SUPPORT"
   268             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
   269             AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
   270             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
   271             AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la"
   272         fi
   273     fi
   274 }
   275 
   276 dnl See if the ALSA audio interface is supported
   277 CheckALSA()
   278 {
   279     AC_ARG_ENABLE(alsa,
   280 [  --enable-alsa           support the ALSA audio API [default=yes]],
   281                   , enable_alsa=yes)
   282     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
   283         have_alsa=no
   284         AC_CHECK_HEADER(sys/asoundlib.h, have_alsa_hdr=yes)
   285         AC_CHECK_LIB(asound, snd_pcm_open, have_alsa_lib=yes)
   286         if test x$have_alsa_hdr = xyes -a x$have_alsa_lib = xyes; then
   287             CFLAGS="$CFLAGS -DALSA_SUPPORT"
   288             SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
   289             AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa"
   290             AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la"
   291         fi
   292     fi
   293 }
   294 
   295 dnl Find the ESD includes and libraries
   296 CheckESD()
   297 {
   298     AC_ARG_ENABLE(esd,
   299 [  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
   300                   , enable_esd=yes)
   301     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   302         AM_PATH_ESD(0.2.8, [
   303             CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
   304             SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
   305             AUDIO_SUBDIRS="$AUDIO_SUBDIRS esd"
   306             AUDIO_DRIVERS="$AUDIO_DRIVERS esd/libaudio_esd.la"
   307         ])
   308     fi
   309 }
   310 
   311 CheckARTSC()
   312 {
   313     AC_ARG_ENABLE(arts,
   314 [  --enable-arts           support the Analog Real Time Synthesizer [default=yes]],
   315                   , enable_arts=yes)
   316     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   317         AC_PATH_PROG(ARTSCCONFIG, artsc-config)
   318         if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"'; then
   319             : # arts isn't installed
   320         else
   321             ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
   322             ARTSC_LIBS=`$ARTSCCONFIG --libs`
   323             AC_MSG_CHECKING(for aRts development environment)
   324             audio_arts=no
   325             save_CFLAGS="$CFLAGS"
   326             CFLAGS="$CFLAGS $ARTSC_CFLAGS"
   327             AC_TRY_COMPILE([
   328              #include <artsc.h>
   329             ],[
   330              arts_stream_t stream;
   331             ],[
   332             audio_arts=yes
   333             ])
   334             CFLAGS="$save_CFLAGS"
   335             AC_MSG_RESULT($audio_arts)
   336             if test x$audio_arts = xyes; then
   337                 CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
   338                 SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
   339                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS arts"
   340                 AUDIO_DRIVERS="$AUDIO_DRIVERS arts/libaudio_arts.la"
   341             fi
   342         fi
   343     fi
   344 }
   345 
   346 dnl See if the NAS audio interface is supported
   347 CheckNAS()
   348 {
   349     AC_ARG_ENABLE(nas,
   350 [  --enable-nas		  support the NAS audio API [default=yes]],
   351 		, enable_nas=yes)
   352     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   353 	AC_MSG_CHECKING(for NAS audio support)
   354 	have_nas=no
   355 	if test -r /usr/X11R6/include/audio/audiolib.h ; then
   356 		have_nas=yes
   357 	fi
   358 	AC_MSG_RESULT($have_nas)
   359 	if test x$have_nas = xyes; then
   360 	    CFLAGS="$CFLAGS -DNAS_SUPPORT"
   361 	    SYSTEM_LIBS="$SYSTEM_LIBS -laudio -lXt"
   362 	    AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
   363 	    AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
   364 	fi
   365     fi
   366 }
   367 
   368 dnl See if we can use x86 assembly blitters
   369 CheckNASM()
   370 {
   371     dnl Make sure we are running on an x86 platform
   372     case $target in
   373         i?86*)
   374             ;;
   375         *)
   376         # Nope, bail early.
   377             return
   378             ;;
   379     esac
   380     dnl Check for NASM (for assembly blit routines)
   381     AC_ARG_ENABLE(nasm,
   382 [  --enable-nasm           use nasm assembly blitters on x86 [default=yes]],
   383                   , enable_nasm=yes)
   384     if test x$enable_video = xyes -a x$enable_nasm = xyes; then
   385         AC_PATH_PROG(NASM, nasm)
   386         if test x$NASM = x -o x$NASM = x'"$NASM"'; then
   387             : # nasm isn't installed
   388         else
   389             CFLAGS="$CFLAGS -DUSE_ASMBLIT -I$srcdir/hermes"
   390             case $ARCH in
   391               win32)
   392                   NASMFLAGS="-f win32"
   393                   ;;
   394               *)
   395                   NASMFLAGS="-f elf"
   396                   ;;
   397             esac
   398             AC_SUBST(NASMFLAGS)
   399             CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes"
   400             SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
   401             SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
   402         fi
   403     fi
   404 }
   405 
   406 dnl Find the X11 include and library directories
   407 CheckX11()
   408 {
   409     AC_ARG_ENABLE(video-x11,
   410 [  --enable-video-x11      use X11 video driver [default=yes]],
   411                   , enable_video_x11=yes)
   412     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
   413         AC_PATH_X
   414         AC_PATH_XTRA
   415         if test x$have_x = xyes; then
   416             CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11"
   417             if test x$ac_cv_func_shmat != xyes; then
   418                 CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
   419             fi
   420             SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
   421             VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
   422             VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"
   423 
   424             AC_ARG_ENABLE(video-x11-vm,
   425 [  --enable-video-x11-vm   use X11 VM extension for fullscreen [default=yes]],
   426                           , enable_video_x11_vm=yes)
   427             if test x$enable_video_x11_vm = xyes; then
   428                 AC_MSG_CHECKING(for XFree86 VidMode 1.0 support)
   429                 video_x11_vm=no
   430                 AC_TRY_COMPILE([
   431                  #include <X11/Xlib.h>
   432                  #include <X11/extensions/xf86vmode.h>
   433                 ],[
   434                 ],[
   435                 video_x11_vm=yes
   436                 ])
   437                 AC_MSG_RESULT($video_x11_vm)
   438                 if test x$video_x11_vm = xyes; then
   439                     CFLAGS="$CFLAGS -DXFREE86_VM"
   440                     # Check for nasty XFree86 4.0/Glide hack
   441                     AC_ARG_ENABLE(xfree86_glidehack,
   442 [  --enable-xfree86-glidehack Alternate vidmode lib for old Glide [default=no]],
   443                                   , enable_xfreeglidehack=no)
   444                     if test x$enable_xfree86_glidehack = xyes; then
   445                         ac_save_libs="$LIBS"
   446                         LIBS="$LIBS $X_LIBS -lX11 -lXext"
   447                         if test x$xfree86_glidehack = x; then
   448                             AC_CHECK_LIB(Xxf86vm, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm)
   449                         fi
   450                         if test x$xfree86_glidehack = x; then
   451                             AC_CHECK_LIB(Xxf86vm40, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm40)
   452                         fi
   453                         LIBS="$ac_save_libs"
   454                     fi
   455                     if test x$xfree86_glidehack != x; then
   456                         CFLAGS="$CFLAGS -DXFREE86_VM_DYNAMIC_HACK"
   457                         SYSTEM_LIBS="$SYSTEM_LIBS -l$xfree86_glidehack"
   458                     else
   459                         SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86vm"
   460                     fi
   461                     AC_MSG_CHECKING(for XFree86 VidMode gamma support)
   462                     video_x11_vmgamma=no
   463                     AC_TRY_COMPILE([
   464                      #include <X11/Xlib.h>
   465                      #include <X11/extensions/xf86vmode.h>
   466                     ],[
   467                      XF86VidModeGamma gamma;
   468                     ],[
   469                     video_x11_vmgamma=yes
   470                     ])
   471                     AC_MSG_RESULT($video_x11_vmgamma)
   472                     if test x$video_x11_vmgamma = xyes; then
   473                         CFLAGS="$CFLAGS -DXFREE86_VMGAMMA"
   474                     fi
   475                 fi
   476             fi
   477             AC_ARG_ENABLE(dga,
   478 [  --enable-dga            allow use of X11 DGA code [default=yes]],
   479                           , enable_dga=yes)
   480             AC_ARG_ENABLE(video-x11-dgamouse,
   481 [  --enable-video-x11-dgamouse  use X11 DGA for mouse events [default=yes]],
   482                           , enable_video_x11_dgamouse=yes)
   483             if test x$enable_dga = xyes; then
   484                 AC_MSG_CHECKING(for XFree86 DGA 1.0 support)
   485                 video_x11_dga=no
   486                 AC_TRY_COMPILE([
   487                  #include <X11/Xlib.h>
   488                  #include <X11/extensions/xf86dga.h>
   489                 ],[
   490                 ],[
   491                 video_x11_dga=yes
   492                 ])
   493                 AC_MSG_RESULT($video_x11_dga)
   494                 if test x$video_x11_dga = xyes; then
   495                     CFLAGS="$CFLAGS -DXFREE86_DGAMOUSE"
   496                     if test x$enable_video_x11_dgamouse = xyes; then
   497                         CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE"
   498                     fi
   499                     SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86dga"
   500                 fi
   501             fi
   502             AC_ARG_ENABLE(video-x11-xv,
   503 [  --enable-video-x11-xv   use X11 XvImage extension for video [default=yes]],
   504                           , enable_video_x11_xv=yes)
   505             if test x$enable_video_x11_xv = xyes; then
   506                 AC_MSG_CHECKING(for XFree86 XvImage support)
   507                 video_x11_xv=no
   508                 AC_TRY_COMPILE([
   509                  #include <X11/Xlib.h>
   510                  #include <sys/ipc.h>
   511                  #include <sys/shm.h>
   512                  #include <X11/extensions/XShm.h>
   513                  #include <X11/extensions/Xvlib.h>
   514                 ],[
   515                  XvImage *image;
   516                 ],[
   517                 video_x11_xv=yes
   518                 ])
   519                 AC_MSG_RESULT($video_x11_xv)
   520                 if test x$video_x11_xv = xyes; then
   521                     CFLAGS="$CFLAGS -DXFREE86_XV"
   522                     SYSTEM_LIBS="$SYSTEM_LIBS -lXv"
   523                 fi
   524             fi
   525         fi
   526     fi
   527 }
   528 CheckPHOTON()
   529 {
   530     AC_ARG_ENABLE(video-photon,
   531 [  --enable-video-photon   use QNX Photonvideo driver [default=yes]],
   532                   , enable_video_photon=yes)
   533     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
   534         AC_MSG_CHECKING(for QNX Photon support)
   535         video_photon=no
   536         AC_TRY_COMPILE([
   537           #include <Ph.h>
   538           #include <Pt.h>
   539           #include <photon/Pg.h>
   540           #include <photon/PdDirect.h>
   541         ],[
   542          PgDisplaySettings_t *visual;
   543         ],[
   544         video_photon=yes
   545         ])
   546         AC_MSG_RESULT($video_photon)
   547         if test x$video_photon = xyes; then
   548             SYSTEM_LIBS="$SYSTEM_LIBS -lph"
   549             VIDEO_SUBDIRS="$VIDEO_SUBDIRS photon"
   550             VIDEO_DRIVERS="$VIDEO_DRIVERS photon/libvideo_photon.la"
   551         fi
   552     fi
   553 }
   554 
   555 dnl Find the X11 DGA 2.0 include and library directories
   556 CheckDGA()
   557 {
   558     AC_ARG_ENABLE(video-dga,
   559 [  --enable-video-dga      use DGA 2.0 video driver [default=yes]],
   560                   , enable_video_dga=yes)
   561     if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
   562         AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
   563         video_x11_dga2=no
   564         AC_TRY_COMPILE([
   565          #include <X11/Xlib.h>
   566          #include <X11/extensions/xf86dga.h>
   567         ],[
   568          XDGAEvent xevent;
   569         ],[
   570         video_x11_dga2=yes
   571         ])
   572         AC_MSG_RESULT($video_x11_dga2)
   573         if test x$video_x11_dga2 = xyes; then
   574             CFLAGS="$CFLAGS -DENABLE_DGA"
   575             VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
   576             VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
   577         fi
   578     fi
   579 }
   580 
   581 dnl Find the framebuffer console includes
   582 CheckFBCON()
   583 {
   584     AC_ARG_ENABLE(video-fbcon,
   585 [  --enable-video-fbcon    use framebuffer console video driver [default=yes]],
   586                   , enable_video_fbcon=yes)
   587     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
   588         AC_MSG_CHECKING(for framebuffer console support)
   589         video_fbcon=no
   590         AC_TRY_COMPILE([
   591          #include <linux/fb.h>
   592          #include <linux/kd.h>
   593          #include <linux/keyboard.h>
   594         ],[
   595         ],[
   596         video_fbcon=yes
   597         ])
   598         AC_MSG_RESULT($video_fbcon)
   599         if test x$video_fbcon = xyes; then
   600             CFLAGS="$CFLAGS -DENABLE_FBCON"
   601             VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon"
   602             VIDEO_DRIVERS="$VIDEO_DRIVERS fbcon/libvideo_fbcon.la"
   603         fi
   604     fi
   605 }
   606 
   607 dnl Find the GGI includes
   608 CheckGGI()
   609 {
   610     AC_ARG_ENABLE(video-ggi,
   611 [  --enable-video-ggi      use GGI video driver [default=no]],
   612                   , enable_video_ggi=no)
   613     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
   614         AC_MSG_CHECKING(for GGI support)
   615         video_ggi=no
   616         AC_TRY_COMPILE([
   617          #include <ggi/ggi.h>
   618          #include <ggi/gii.h>
   619         ],[
   620         ],[
   621         video_ggi=yes
   622         ])
   623         AC_MSG_RESULT($video_ggi)
   624         if test x$video_ggi = xyes; then
   625             CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_GGI"
   626             SYSTEM_LIBS="$SYSTEM_LIBS -lggi -lgii -lgg"
   627 
   628             VIDEO_SUBDIRS="$VIDEO_SUBDIRS ggi"
   629             VIDEO_DRIVERS="$VIDEO_DRIVERS ggi/libvideo_ggi.la"
   630         fi
   631     fi
   632 }
   633 
   634 dnl Find the SVGAlib includes and libraries
   635 CheckSVGA()
   636 {
   637     AC_ARG_ENABLE(video-svga,
   638 [  --enable-video-svga     use SVGAlib video driver [default=no]],
   639                   , enable_video_svga=no)
   640     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
   641         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
   642         video_svga=no
   643         AC_TRY_COMPILE([
   644          #include <vga.h>
   645          #include <vgamouse.h>
   646          #include <vgakeyboard.h>
   647         ],[
   648          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
   649              exit(0);
   650          }
   651         ],[
   652         video_svga=yes
   653         ])
   654         AC_MSG_RESULT($video_svga)
   655         if test x$video_svga = xyes; then
   656             CFLAGS="$CFLAGS -DENABLE_SVGALIB"
   657             SYSTEM_LIBS="$SYSTEM_LIBS -lvga"
   658 
   659             VIDEO_SUBDIRS="$VIDEO_SUBDIRS svga"
   660             VIDEO_DRIVERS="$VIDEO_DRIVERS svga/libvideo_svga.la"
   661         fi
   662     fi
   663 }
   664 
   665 dnl Find the AAlib includes
   666 CheckAAlib()
   667 {
   668     AC_ARG_ENABLE(video-aalib,
   669 [  --enable-video-aalib    use AAlib video driver [default=no]],
   670                   , enable_video_aalib=no)
   671     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
   672         AC_MSG_CHECKING(for AAlib support)
   673         video_aalib=no
   674         AC_TRY_COMPILE([
   675          #include <aalib.h>
   676         ],[
   677         ],[
   678         video_aalib=yes
   679         ])
   680         AC_MSG_RESULT($video_aalib)
   681         if test x$video_aalib = xyes; then
   682             CFLAGS="$CFLAGS -DENABLE_AALIB"
   683             SYSTEM_LIBS="$SYSTEM_LIBS -laa"
   684 
   685             VIDEO_SUBDIRS="$VIDEO_SUBDIRS aalib"
   686             VIDEO_DRIVERS="$VIDEO_DRIVERS aalib/libvideo_aa.la"
   687         fi
   688     fi
   689 }
   690 
   691 dnl rcg04172001 Set up the Null video driver.
   692 CheckDummyVideo()
   693 {
   694     AC_ARG_ENABLE(video-dummy,
   695 [  --enable-video-dummy    use dummy video driver [default=no]],
   696                   , enable_video_dummy=no)
   697     if test x$enable_video_dummy = xyes; then
   698       CFLAGS="$CFLAGS -DENABLE_DUMMYVIDEO"
   699       VIDEO_SUBDIRS="$VIDEO_SUBDIRS dummy"
   700       VIDEO_DRIVERS="$VIDEO_DRIVERS dummy/libvideo_null.la"
   701     fi
   702 }
   703 
   704 dnl Check to see if OpenGL support is desired
   705 AC_ARG_ENABLE(video-opengl,
   706 [  --enable-video-opengl   include OpenGL context creation [default=yes]],
   707               , enable_video_opengl=yes)
   708 
   709 dnl Find OpenGL
   710 CheckOpenGL()
   711 {
   712     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   713         AC_MSG_CHECKING(for OpenGL (GLX) support)
   714         video_opengl=no
   715         AC_TRY_COMPILE([
   716          #include <GL/gl.h>
   717          #include <GL/glx.h>
   718          #include <dlfcn.h> /* For loading extensions */
   719         ],[
   720         ],[
   721         video_opengl=yes
   722         ])
   723         AC_MSG_RESULT($video_opengl)
   724         if test x$video_opengl = xyes; then
   725             CFLAGS="$CFLAGS -DHAVE_OPENGL"
   726             AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl")
   727         fi
   728     fi
   729 }
   730 
   731 dnl Check for BeOS OpenGL
   732 CheckBeGL()
   733 {
   734     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   735         CFLAGS="$CFLAGS -DHAVE_OPENGL"
   736         SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
   737     fi
   738 }
   739 
   740 dnl Check for MacOS OpenGL
   741 CheckMacGL()
   742 {
   743     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   744         CFLAGS="$CFLAGS -DHAVE_OPENGL"
   745         case "$target" in
   746             *-*-darwin*)
   747                 SDL_LIBS="$SDL_LIBS -framework OpenGL -framework AGL"
   748         esac
   749     fi
   750 }
   751 
   752 dnl See if we can use the new unified event interface in Linux 2.4
   753 CheckInputEvents()
   754 {
   755     dnl Check for Linux 2.4 unified input event interface support
   756     AC_ARG_ENABLE(input-events,
   757 [  --enable-input-events   use Linux 2.4 unified input interface [default=yes]],
   758                   , enable_input_events=yes)
   759     if test x$enable_input_events = xyes; then
   760         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
   761         use_input_events=no
   762         AC_TRY_COMPILE([
   763           #include <linux/input.h>
   764         ],[
   765           #ifndef EVIOCGNAME
   766           #error EVIOCGNAME() ioctl not available
   767           #endif
   768         ],[
   769         use_input_events=yes
   770         ])
   771         AC_MSG_RESULT($use_input_events)
   772         if test x$use_input_events = xyes; then
   773             CFLAGS="$CFLAGS -DUSE_INPUT_EVENTS"
   774         fi
   775     fi
   776 }
   777 
   778 dnl See what type of thread model to use on Linux and Solaris
   779 CheckPTHREAD()
   780 {
   781     dnl Check for pthread support
   782     AC_ARG_ENABLE(pthreads,
   783 [  --enable-pthreads       use POSIX threads for multi-threading [default=yes]],
   784                   , enable_pthreads=yes)
   785     dnl This is used on Linux for glibc binary compatibility (Doh!)
   786     AC_ARG_ENABLE(pthread-sem,
   787 [    --enable-pthread-sem  use pthread semaphores [default=yes]],
   788                   , enable_pthread_sem=yes)
   789     ac_save_libs="$LIBS"
   790     case "$target" in
   791         *-*-bsdi*)
   792             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
   793             pthread_lib=""
   794             ;;
   795         *-*-darwin*)
   796             pthread_cflags="-D_THREAD_SAFE"
   797 # causes Carbon.p complaints?
   798 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
   799             ;;
   800         *-*-freebsd*)
   801             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
   802             pthread_lib="-pthread"
   803             ;;
   804         *-*-openbsd*)
   805             pthread_cflags="-D_REENTRANT"
   806             pthread_lib="-pthread"
   807             ;;
   808         *-*-solaris*)
   809             pthread_cflags="-D_REENTRANT"
   810             pthread_lib="-lpthread -lposix4"
   811             ;;
   812         *-*-sysv5*)
   813             pthread_cflags="-D_REENTRANT -Kthread"
   814             pthread_lib=""
   815             ;;
   816         *-*-irix*)
   817             pthread_cflags="-D_SGI_MP_SOURCE"
   818             pthread_lib="-lpthread"
   819             ;;
   820         *-*-aix*)
   821             pthread_cflags="-D_REENTRANT -mthreads"
   822             pthread_lib="-lpthread"
   823             ;;
   824         *-*-qnx*)
   825             pthread_cflags=""
   826             pthread_lib=""
   827             ;;
   828         *)
   829             pthread_cflags="-D_REENTRANT"
   830             pthread_lib="-lpthread"
   831             ;;
   832     esac
   833     LIBS="$LIBS $pthread_lib"
   834     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
   835         AC_MSG_CHECKING(for pthreads)
   836         use_pthreads=no
   837         AC_TRY_LINK([
   838          #include <pthread.h>
   839         ],[
   840          pthread_attr_t type;
   841          pthread_attr_init(&type);
   842         ],[
   843         use_pthreads=yes
   844         ])
   845         AC_MSG_RESULT($use_pthreads)
   846         if test x$use_pthreads = xyes; then
   847             CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
   848             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
   849             SDL_LIBS="$SDL_LIBS $pthread_lib"
   850 
   851             # Check to see if recursive mutexes are available
   852             AC_MSG_CHECKING(for recursive mutexes)
   853             has_recursive_mutexes=no
   854             AC_TRY_LINK([
   855               #include <pthread.h>
   856             ],[
   857               pthread_mutexattr_t attr;
   858               #ifdef linux
   859               pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
   860               #else
   861               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
   862               #endif
   863             ],[
   864             has_recursive_mutexes=yes
   865             ])
   866             # Some systems have broken recursive mutex implementations
   867             case "$target" in
   868                 *-*-solaris*)
   869                     has_recursive_mutexes=no
   870                     ;;
   871             esac
   872             AC_MSG_RESULT($has_recursive_mutexes)
   873             if test x$has_recursive_mutexes != xyes; then
   874                 CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
   875             fi
   876 
   877             # Check to see if this is broken glibc 2.0 pthreads
   878             case "$target" in
   879                 *-*-linux*)
   880                     AC_MSG_CHECKING(for broken glibc 2.0 pthreads)
   881                     glibc20_pthreads=no
   882                     AC_TRY_COMPILE([
   883                       #include <features.h>
   884                       #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
   885                       #warning Working around a bug in glibc 2.0 pthreads
   886                       #else
   887                       #error pthread implementation okay
   888                       #endif /* glibc 2.0 */
   889                     ],[
   890                     ],[
   891                     glibc20_pthreads=yes
   892                     ])
   893                     AC_MSG_RESULT($glibc20_pthreads)
   894             esac
   895         fi
   896     fi
   897     LIBS="$ac_save_libs"
   898 
   899     AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
   900     have_semun=no
   901     AC_TRY_COMPILE([
   902       #include <sys/types.h>
   903       #include <sys/sem.h>
   904     ],[
   905       union semun t;
   906     ],[
   907     have_semun=yes
   908     ])
   909     AC_MSG_RESULT($have_semun)
   910     if test x$have_semun = xyes; then
   911         CFLAGS="$CFLAGS -DHAVE_SEMUN"
   912     fi
   913 
   914     # See if we can use clone() on Linux directly
   915     use_clone=no
   916     if test x$enable_threads = xyes -a x$use_pthreads != xyes; then
   917         case "$target" in
   918             *-*-linux*)
   919                 use_clone=yes
   920                 ;;
   921             *)
   922                 CFLAGS="$CFLAGS -DFORK_HACK"
   923                 ;;
   924         esac
   925     fi
   926     AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
   927 }
   928 
   929 dnl Determine whether the compiler can produce Win32 executables
   930 CheckWIN32()
   931 {
   932     AC_MSG_CHECKING(Win32 compiler)
   933     have_win32_gcc=no
   934     AC_TRY_COMPILE([
   935      #include <windows.h>
   936     ],[
   937     ],[
   938     have_win32_gcc=yes
   939     ])
   940     AC_MSG_RESULT($have_win32_gcc)
   941     if test x$have_win32_gcc != xyes; then
   942        AC_MSG_ERROR([
   943 *** Your compiler ($CC) does not produce Win32 executables!
   944        ])
   945     fi
   946 
   947     dnl See if the user wants to redirect standard output to files
   948     AC_ARG_ENABLE(stdio-redirect,
   949 [  --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]],
   950                   , enable_stdio_redirect=yes)
   951     if test x$enable_stdio_redirect != xyes; then
   952         CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT"
   953     fi
   954 }
   955 
   956 dnl Find the DirectX includes and libraries
   957 CheckDIRECTX()
   958 {
   959     AC_ARG_ENABLE(directx,
   960 [  --enable-directx        use DirectX for Win32 audio/video [default=yes]],
   961                   , enable_directx=yes)
   962     if test x$enable_directx = xyes; then
   963         AC_MSG_CHECKING(for DirectX headers and libraries)
   964         use_directx=no
   965         AC_TRY_COMPILE([
   966          #include "src/video/windx5/directx.h"
   967         ],[
   968         ],[
   969         use_directx=yes
   970         ])
   971         AC_MSG_RESULT($use_directx)
   972     fi
   973     AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
   974 
   975     CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
   976     SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
   977     VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
   978     VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
   979     # Enable the DIB driver
   980     CFLAGS="$CFLAGS -DENABLE_WINDIB"
   981     VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
   982     VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
   983     # See if we should enable the DirectX driver
   984     if test x$use_directx = xyes; then
   985         CFLAGS="$CFLAGS -DENABLE_DIRECTX"
   986         SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
   987         VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
   988         VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
   989     fi
   990 }
   991 
   992 dnl Set up the BWindow video driver on BeOS
   993 CheckBWINDOW()
   994 {
   995     CFLAGS="$CFLAGS -DENABLE_BWINDOW"
   996     VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
   997     VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
   998 }
   999 
  1000 dnl Set up the Mac toolbox video driver for Mac OS 7-9
  1001 CheckTOOLBOX()
  1002 {
  1003     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
  1004     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
  1005     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
  1006     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
  1007 }
  1008 
  1009 dnl Set up the Mac toolbox video driver for Mac OS X
  1010 CheckCARBON()
  1011 {
  1012     # "MACOSX" is not an official definition, but it's commonly
  1013     # accepted as a way to differentiate between what runs on X
  1014     # and what runs on older Macs - while in theory "Carbon" defns
  1015     # are consistent between the two, in practice Carbon is still
  1016     # changing. -sts Aug 2000
  1017     mac_autoconf_target_workaround="MAC"
  1018     CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
  1019       -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"
  1020     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
  1021     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
  1022     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
  1023     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
  1024 }
  1025 
  1026 dnl Set up the kernel statistics library for Solaris
  1027 CheckKSTAT()
  1028 {
  1029     CFLAGS="$CFLAGS -DHAVE_KSTAT"
  1030     SYSTEM_LIBS="$SYSTEM_LIBS -lkstat"
  1031 }
  1032 
  1033 case "$target" in
  1034     *-*-linux*)
  1035         ARCH=linux
  1036         CheckDummyVideo
  1037         CheckNASM
  1038         CheckOSS
  1039         CheckALSA
  1040         CheckARTSC
  1041         CheckESD
  1042         CheckNAS
  1043         CheckX11
  1044         CheckDGA
  1045         CheckFBCON
  1046         CheckGGI
  1047         CheckSVGA
  1048         CheckAAlib
  1049         CheckOpenGL
  1050         CheckInputEvents
  1051         CheckPTHREAD
  1052         # Set up files for the main() stub
  1053         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1054         # Set up files for the audio library
  1055         # We use the OSS and ALSA API's, not the Sun audio API
  1056         #if test x$enable_audio = xyes; then
  1057         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1058         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1059         #fi
  1060         # Set up files for the joystick library
  1061         if test x$enable_joystick = xyes; then
  1062             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
  1063             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
  1064         fi
  1065         # Set up files for the cdrom library
  1066         if test x$enable_cdrom = xyes; then
  1067             COPY_ARCH_SRC(src/cdrom, linux, SDL_syscdrom.c)
  1068         fi
  1069         # Set up files for the thread library
  1070         if test x$enable_threads = xyes; then
  1071             if test x$use_pthreads != xyes; then
  1072                 COPY_ARCH_SRC(src/thread, linux, clone.S)
  1073             fi
  1074             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1075             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1076             if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
  1077                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1078             else
  1079                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1080             fi
  1081             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1082             if test x$glibc20_pthreads = xyes; then
  1083                 COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1084                 COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1085                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1086                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1087             else
  1088                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1089                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1090                 COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1091                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1092             fi
  1093         fi
  1094         # Set up files for the timer library
  1095         if test x$enable_timers = xyes; then
  1096             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1097         fi
  1098         ;;
  1099     *-*-bsdi*)
  1100         ARCH=bsdi
  1101         CheckDummyVideo
  1102         CheckNASM
  1103         CheckOSS
  1104         CheckNAS
  1105         CheckX11
  1106         CheckDGA
  1107         CheckSVGA
  1108         CheckAAlib
  1109         CheckOpenGL
  1110         CheckPTHREAD
  1111         # Set up files for the main() stub
  1112         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1113         # Set up files for the joystick library
  1114         # (No joystick support yet)
  1115         if test x$enable_joystick = xyes; then
  1116             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1117             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1118         fi
  1119         # Set up files for the cdrom library
  1120         # (No cdrom support yet)
  1121         if test x$enable_cdrom = xyes; then
  1122             COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c)
  1123         fi
  1124         # Set up files for the thread library
  1125         if test x$enable_threads = xyes; then
  1126             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1127             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1128             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1129             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1130             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1131             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1132             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1133             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1134         fi
  1135         # Set up files for the timer library
  1136         if test x$enable_timers = xyes; then
  1137             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1138         fi
  1139         ;;
  1140     *-*-freebsd*)
  1141         ARCH=freebsd
  1142         CheckDummyVideo
  1143         CheckNASM
  1144         CheckOSS
  1145         CheckARTSC
  1146         CheckESD
  1147         CheckNAS
  1148         CheckX11
  1149         CheckDGA
  1150         CheckSVGA
  1151         CheckAAlib
  1152         CheckOpenGL
  1153         CheckPTHREAD
  1154         # Set up files for the main() stub
  1155         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1156         # Set up files for the audio library
  1157         # We use the OSS and ALSA API's, not the Sun audio API
  1158         #if test x$enable_audio = xyes; then
  1159         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1160         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1161         #fi
  1162         # Set up files for the joystick library
  1163         # (No joystick support yet)
  1164         if test x$enable_joystick = xyes; then
  1165             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1166             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1167         fi
  1168         # Set up files for the cdrom library
  1169         if test x$enable_cdrom = xyes; then
  1170             COPY_ARCH_SRC(src/cdrom, freebsd, SDL_syscdrom.c)
  1171         fi
  1172         # Set up files for the thread library
  1173         if test x$enable_threads = xyes; then
  1174             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1175             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1176             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1177             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1178             if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
  1179                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1180             else
  1181                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1182             fi
  1183             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1184             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1185             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1186         fi
  1187         # Set up files for the timer library
  1188         if test x$enable_timers = xyes; then
  1189             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1190         fi
  1191         ;;
  1192     *-*-netbsd*)
  1193         ARCH=netbsd
  1194         CheckDummyVideo
  1195         CheckNASM
  1196         CheckOSS
  1197         CheckARTSC
  1198         CheckESD
  1199         CheckNAS
  1200         CheckX11
  1201         CheckAAlib
  1202         CheckOpenGL
  1203         CheckPTHREAD
  1204         # Set up files for the main() stub
  1205         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1206         # Set up files for the audio library
  1207         if test x$enable_audio = xyes; then
  1208             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1209             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1210         fi
  1211         # Set up files for the joystick library
  1212         # (No joystick support yet)
  1213         if test x$enable_joystick = xyes; then
  1214             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1215             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1216         fi
  1217         # Set up files for the cdrom library
  1218         if test x$enable_cdrom = xyes; then
  1219             COPY_ARCH_SRC(src/cdrom, openbsd, SDL_syscdrom.c)
  1220         fi
  1221         # Set up files for the thread library
  1222         if test x$enable_threads = xyes; then
  1223             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1224             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1225             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1226             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1227 	    if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
  1228 		COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1229 	    else
  1230 		COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1231 	    fi
  1232             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1233             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1234             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1235         fi
  1236         # Set up files for the timer library
  1237         if test x$enable_timers = xyes; then
  1238             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1239         fi
  1240         # NetBSD does not define "unix"
  1241         CFLAGS="$CFLAGS -Dunix"
  1242         ;;
  1243     *-*-openbsd*)
  1244         ARCH=openbsd
  1245         CFLAGS="$CFLAGS -Dunix"
  1246         CheckDummyVideo
  1247         CheckNASM
  1248         CheckOSS
  1249         CheckARTSC
  1250         CheckESD
  1251         CheckNAS
  1252         CheckX11
  1253         CheckAAlib
  1254         CheckOpenGL
  1255         CheckPTHREAD
  1256         # Set up files for the main() stub
  1257         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1258         # Set up files for the audio library
  1259         if test x$enable_audio = xyes; then
  1260             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1261             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1262         fi
  1263         # Set up files for the joystick library
  1264         # (No joystick support yet)
  1265         if test x$enable_joystick = xyes; then
  1266             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1267             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1268         fi
  1269         # Set up files for the cdrom library
  1270         if test x$enable_cdrom = xyes; then
  1271             COPY_ARCH_SRC(src/cdrom, openbsd, SDL_syscdrom.c)
  1272         fi
  1273         # Set up files for the thread library
  1274         if test x$enable_threads = xyes; then
  1275             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1276             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1277             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1278             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1279             if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
  1280                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1281             else
  1282                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1283             fi
  1284             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1285             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1286             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1287         fi
  1288         # Set up files for the timer library
  1289         if test x$enable_timers = xyes; then
  1290             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1291         fi
  1292         ;;
  1293     *-*-sysv5*)
  1294         ARCH=sysv5
  1295         CheckDummyVideo
  1296         CheckNASM
  1297         CheckOSS
  1298         CheckARTSC
  1299         CheckESD
  1300         CheckNAS
  1301         CheckX11
  1302         CheckAAlib
  1303         CheckOpenGL
  1304         CheckPTHREAD
  1305         CheckKSTAT
  1306         # Set up files for the main() stub
  1307         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1308         # Set up files for the audio library
  1309         if test x$enable_audio = xyes; then
  1310             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1311             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1312         fi
  1313         # Set up files for the joystick library
  1314         # (No joystick support yet)
  1315         if test x$enable_joystick = xyes; then
  1316             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1317             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1318         fi
  1319         # Set up files for the cdrom library
  1320         if test x$enable_cdrom = xyes; then
  1321             COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c)
  1322         fi
  1323         # Set up files for the thread library
  1324         if test x$enable_threads = xyes; then
  1325             COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
  1326             COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
  1327             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1328             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1329             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1330             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1331             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1332             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1333         fi
  1334         # Set up files for the timer library
  1335         if test x$enable_timers = xyes; then
  1336             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1337         fi
  1338         ;;
  1339     *-*-solaris*)
  1340         ARCH=solaris
  1341         CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
  1342         CheckDummyVideo
  1343         CheckNASM
  1344         CheckARTSC
  1345         CheckESD
  1346         CheckNAS
  1347         CheckX11
  1348         CheckAAlib
  1349         CheckOpenGL
  1350         CheckPTHREAD
  1351         CheckKSTAT
  1352         # Set up files for the main() stub
  1353         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1354         # Set up files for the audio library
  1355         if test x$enable_audio = xyes; then
  1356             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1357             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1358         fi
  1359         # Set up files for the joystick library
  1360         # (No joystick support yet)
  1361         if test x$enable_joystick = xyes; then
  1362             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1363             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1364         fi
  1365         # Set up files for the cdrom library
  1366         if test x$enable_cdrom = xyes; then
  1367             COPY_ARCH_SRC(src/cdrom, linux, SDL_syscdrom.c)
  1368         fi
  1369         # Set up files for the thread library
  1370         if test x$enable_threads = xyes; then
  1371             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1372             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1373             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1374             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1375             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1376             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1377             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1378             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1379         fi
  1380         # Set up files for the timer library
  1381         if test x$enable_timers = xyes; then
  1382             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1383         fi
  1384         ;;
  1385     *-*-irix*)
  1386         ARCH=irix
  1387         CheckDummyVideo
  1388         CheckNAS
  1389         CheckX11
  1390         CheckAAlib
  1391         CheckOpenGL
  1392         CheckPTHREAD
  1393         # Set up files for the main() stub
  1394         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1395         # Set up files for the audio library
  1396         if test x$enable_audio = xyes; then
  1397             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dmedia"
  1398             AUDIO_DRIVERS="$AUDIO_DRIVERS dmedia/libaudio_dmedia.la"
  1399             LIBS="$LIBS -laudio"
  1400         fi
  1401         # Set up files for the joystick library
  1402         # (No joystick support yet)
  1403         if test x$enable_joystick = xyes; then
  1404             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1405             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1406         fi
  1407         # Set up files for the cdrom library
  1408         # (No CD-ROM support yet)
  1409         if test x$enable_cdrom = xyes; then
  1410             COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c)
  1411         fi
  1412         # Set up files for the thread library
  1413         if test x$enable_threads = xyes; then
  1414             if test x$use_pthreads = xyes; then
  1415                 COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1416                 COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1417                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1418                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1419                 if test x$enable_pthread_sem != xyes; then
  1420                     COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1421                 else
  1422                     COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1423                 fi
  1424                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1425                 COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1426                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1427             else
  1428                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
  1429                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
  1430                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1431                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1432                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1433                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1434                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1435                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1436             fi
  1437         fi
  1438         # Set up files for the timer library
  1439         if test x$enable_timers = xyes; then
  1440             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1441         fi
  1442         ;;
  1443     *-*-hpux*)
  1444         ARCH=hpux
  1445         CheckDummyVideo
  1446         CheckNAS
  1447         CheckX11
  1448         CheckGGI
  1449         CheckAAlib
  1450         CheckOpenGL
  1451         CheckPTHREAD
  1452         # Set up files for the main() stub
  1453         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1454         # Set up files for the audio library
  1455         if test x$enable_audio = xyes; then
  1456             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1457             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1458         fi
  1459         # Set up files for the joystick library
  1460         # (No joystick support yet)
  1461         if test x$enable_joystick = xyes; then
  1462             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1463             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1464         fi
  1465         # Set up files for the cdrom library
  1466         # (No CD-ROM support yet)
  1467         if test x$enable_cdrom = xyes; then
  1468             COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c)
  1469         fi
  1470         # Set up files for the thread library
  1471         if test x$enable_threads = xyes; then
  1472             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1473             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1474             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1475             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1476             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1477             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1478             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1479             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1480         fi
  1481         # Set up files for the timer library
  1482         if test x$enable_timers = xyes; then
  1483             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1484         fi
  1485         ;;
  1486     *-*-aix*)
  1487         ARCH=aix
  1488         CheckDummyVideo
  1489         CheckNAS
  1490         CheckX11
  1491         CheckGGI
  1492         CheckAAlib
  1493         CheckOpenGL
  1494         CheckPTHREAD
  1495         # Set up files for the main() stub
  1496         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1497         # Set up files for the audio library
  1498         if test x$enable_audio = xyes; then
  1499             AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
  1500             AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la"
  1501         fi
  1502         # Set up files for the joystick library
  1503         # (No joystick support yet)
  1504         if test x$enable_joystick = xyes; then
  1505             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1506             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1507         fi
  1508         # Set up files for the cdrom library
  1509         if test x$enable_cdrom = xyes; then
  1510             COPY_ARCH_SRC(src/cdrom, aix, SDL_syscdrom.c)
  1511         fi
  1512         # Set up files for the thread library
  1513         if test x$enable_threads = xyes; then
  1514             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1515             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1516             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1517             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1518             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1519             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1520             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1521             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1522         fi
  1523         # Set up files for the timer library
  1524         if test x$enable_timers = xyes; then
  1525             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1526         fi
  1527         ;;
  1528     *-*-osf*)
  1529         ARCH=osf
  1530         CheckDummyVideo
  1531         CheckNAS
  1532         CheckX11
  1533         CheckGGI
  1534         CheckAAlib
  1535         CheckOpenGL
  1536         CheckPTHREAD
  1537         # Set up files for the main() stub
  1538         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1539         # Set up files for the audio library
  1540         if test x$enable_audio = xyes; then
  1541             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1542             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1543         fi
  1544         # Set up files for the joystick library
  1545         # (No joystick support yet)
  1546         if test x$enable_joystick = xyes; then
  1547             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1548             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1549         fi
  1550         # Set up files for the cdrom library
  1551         # (No cdrom support yet)
  1552         if test x$enable_cdrom = xyes; then
  1553             COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c)
  1554         fi
  1555         # Set up files for the thread library
  1556         if test x$enable_threads = xyes; then
  1557             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1558             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1559             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1560             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1561             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1562             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1563             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1564             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1565         fi
  1566         # Set up files for the timer library
  1567         if test x$enable_timers = xyes; then
  1568             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1569         fi
  1570         ;;
  1571     *-*-qnx*)
  1572         ARCH=qnx
  1573         CheckDummyVideo
  1574         CheckNAS
  1575         CheckPHOTON
  1576         CheckX11
  1577         CheckOpenGL
  1578         CheckPTHREAD
  1579         # Set up files for the main() stub
  1580         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1581         # Set up files for the audio library
  1582         if test x$enable_audio = xyes; then
  1583             CFLAGS="$CFLAGS -DALSA_SUPPORT"
  1584             SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
  1585             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto"
  1586             AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la"
  1587             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1588             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1589         fi
  1590         # Set up files for the joystick library
  1591         if test x$enable_joystick = xyes; then
  1592         # (No joystick support yet)
  1593             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1594             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1595         fi
  1596         # Set up files for the cdrom library
  1597         if test x$enable_cdrom = xyes; then
  1598             COPY_ARCH_SRC(src/cdrom, qnx, SDL_syscdrom.c)
  1599         fi
  1600         # Set up files for the thread library
  1601         if test x$enable_threads = xyes; then
  1602             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1603             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1604             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1605             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1606             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1607             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1608             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1609             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1610         fi
  1611         # Set up files for the timer library
  1612         if test x$enable_timers = xyes; then
  1613             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1614         fi
  1615         ;;
  1616     *-*-cygwin* | *-*-mingw32*)
  1617         ARCH=win32
  1618         if test "$build" != "$target"; then # cross-compiling
  1619             # Default cross-compile location
  1620             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  1621         else
  1622             # Look for the location of the tools and install there
  1623             if [ "$BUILD_PREFIX" != "" ]; then
  1624                 ac_default_prefix=$BUILD_PREFIX
  1625             fi
  1626         fi
  1627         CheckDummyVideo
  1628         CheckWIN32
  1629         CheckDIRECTX
  1630         CheckNASM
  1631         # Set up files for the main() stub
  1632         COPY_ARCH_SRC(src/main, win32, SDL_main.c)
  1633         # Set up files for the audio library
  1634         if test x$enable_audio = xyes; then
  1635             AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
  1636             AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la"
  1637             if test x$use_directx = xyes; then
  1638     	        AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5"
  1639     	        AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la"
  1640             fi
  1641         fi
  1642         # Set up files for the joystick library
  1643         if test x$enable_joystick = xyes; then
  1644             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32"
  1645             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la"
  1646         fi
  1647         # Set up files for the cdrom library
  1648         if test x$enable_cdrom = xyes; then
  1649             COPY_ARCH_SRC(src/cdrom, win32, SDL_syscdrom.c)
  1650         fi
  1651         # Set up files for the thread library
  1652         if test x$enable_threads = xyes; then
  1653             COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
  1654             COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
  1655             COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c)
  1656             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1657             COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c)
  1658             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1659             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1660             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1661         fi
  1662         # Set up files for the timer library
  1663         if test x$enable_timers = xyes; then
  1664             COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c)
  1665         fi
  1666         # The Win32 platform requires special setup
  1667         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  1668         case "$target" in
  1669             *-*-cygwin*)
  1670                 CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix"
  1671                 SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix"
  1672                 LIBS="$LIBS -mno-cygwin"
  1673                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
  1674                 ;;
  1675             *-*-mingw32*)
  1676                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  1677                 ;;
  1678         esac
  1679         ;;
  1680     *-*-beos*)
  1681         ARCH=beos
  1682         ac_default_prefix=/boot/develop/tools/gnupro
  1683         CheckDummyVideo
  1684         CheckNASM
  1685         CheckBWINDOW
  1686         CheckBeGL
  1687         # Set up files for the main() stub
  1688         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1689         COPY_ARCH_SRC(src/main, beos, SDL_BeApp.cc)
  1690         COPY_ARCH_SRC(src/main, beos, SDL_BeApp.h)
  1691         # Set up files for the audio library
  1692         if test x$enable_audio = xyes; then
  1693             AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
  1694             AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la"
  1695         fi
  1696         # Set up files for the joystick library
  1697         if test x$enable_joystick = xyes; then
  1698             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos"
  1699             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la"
  1700         fi
  1701         # Set up files for the cdrom library
  1702         if test x$enable_cdrom = xyes; then
  1703             COPY_ARCH_SRC(src/cdrom, beos, SDL_syscdrom.c)
  1704         fi
  1705         # Set up files for the thread library
  1706         if test x$enable_threads = xyes; then
  1707             COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
  1708             COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
  1709             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1710             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1711             COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c)
  1712             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1713             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1714             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1715         fi
  1716         # Set up files for the timer library
  1717         if test x$enable_timers = xyes; then
  1718             COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c)
  1719         fi
  1720         # The BeOS platform requires special libraries
  1721         SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  1722         ;;
  1723     *-*-macos*)
  1724         # This would be used if cross-compiling to MacOS 9.  No way to
  1725         # use it at present, but Apple is working on a X-to-9 compiler
  1726         # for which this case would be handy.
  1727         ARCH=macos
  1728         CheckDummyVideo
  1729         CheckTOOLBOX
  1730         CheckMacGL
  1731         # Set up files for the main() stub
  1732         COPY_ARCH_SRC(src/main, macos, SDL_main.c)
  1733         # Set up files for the audio library
  1734         if test x$enable_audio = xyes; then
  1735             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  1736             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  1737         fi
  1738         # Set up files for the joystick library
  1739         if test x$enable_joystick = xyes; then
  1740             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos"
  1741             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la"
  1742         fi
  1743         # Set up files for the cdrom library
  1744         if test x$enable_cdrom = xyes; then
  1745             COPY_ARCH_SRC(src/cdrom, macos, SDL_syscdrom.c)
  1746         fi
  1747         # Set up files for the thread library
  1748         if test x$enable_threads = xyes; then
  1749             COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
  1750             COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
  1751             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1752             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1753             COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c)
  1754             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1755             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1756             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1757         fi
  1758         # Set up files for the timer library
  1759         if test x$enable_timers = xyes; then
  1760             COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c)
  1761         fi
  1762         # The MacOS platform requires special setup
  1763         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  1764         SDL_LIBS="-lSDLmain $SDL_LIBS"
  1765         ;;
  1766     *-*-darwin* )
  1767         # Strictly speaking, we want "Mac OS X", not "Darwin", which is
  1768         # just the OS X kernel sans upper layers like Carbon.  But
  1769         # config.guess comes back with "darwin", so go with the flow.
  1770         ARCH=macos
  1771         CheckDummyVideo
  1772         CheckCARBON
  1773         CheckMacGL
  1774         CheckPTHREAD
  1775         # Set up files for the main() stub
  1776         # COPY_ARCH_SRC(src/main, macos, SDL_main.c)
  1777         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1778         # Set up files for the audio library
  1779         if test x$enable_audio = xyes; then
  1780             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  1781             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  1782         fi
  1783         # Set up files for the joystick library
  1784         if test x$enable_joystick = xyes; then
  1785             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1786             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1787         fi
  1788         # Set up files for the cdrom library
  1789         if test x$enable_cdrom = xyes; then
  1790             COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c)
  1791         fi
  1792         # Set up files for the thread library
  1793         if test x$enable_threads = xyes; then
  1794             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1795             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1796             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1797             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1798             if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then
  1799                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1800             else
  1801                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1802             fi
  1803             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1804             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1805             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1806         fi
  1807         # Set up files for the timer library
  1808         if test x$enable_timers = xyes; then
  1809             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1810         fi
  1811         # The MacOS X platform requires special setup
  1812         SDL_CFLAGS="$SDL_CFLAGS -F/System/Library/Frameworks/Carbon.framework"
  1813         SDL_LIBS="$SDL_LIBS -framework Carbon"
  1814         ;;
  1815     *)
  1816         AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
  1817         ;;
  1818 esac
  1819 AC_SUBST(ARCH)
  1820 
  1821 # Set the conditional variables for this target
  1822 AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
  1823 AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
  1824 AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
  1825 AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
  1826 AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
  1827 AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd)
  1828 AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix)
  1829 AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
  1830 AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
  1831 AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
  1832 
  1833 # Set conditional variables for shared and static library selection.
  1834 # These are not used in any Makefile.am but in sdl-config.in.
  1835 AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
  1836 AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes])
  1837 
  1838 # Set runtime shared library paths as needed
  1839 
  1840 if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
  1841   SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  1842 fi
  1843 
  1844 if test $ARCH = solaris; then
  1845   SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  1846 fi
  1847 
  1848 if test $ARCH = openbsd; then
  1849   SDL_RLD_FLAGS="-Wl,-R\${exec_prefix}/lib -Wl,-R\${X11BASE}/lib"
  1850 fi
  1851 
  1852 dnl Output the video drivers we use
  1853 if test x$enable_video = xtrue; then
  1854     if test "$VIDEO_SUBDIRS" = ""; then
  1855         AC_MSG_ERROR(*** No video drivers are enabled!)
  1856     fi
  1857 fi
  1858 AC_SUBST(AUDIO_SUBDIRS)
  1859 AC_SUBST(AUDIO_DRIVERS)
  1860 AC_SUBST(VIDEO_SUBDIRS)
  1861 AC_SUBST(VIDEO_DRIVERS)
  1862 AC_SUBST(JOYSTICK_SUBDIRS)
  1863 AC_SUBST(JOYSTICK_DRIVERS)
  1864 AC_SUBST(SDL_EXTRADIRS)
  1865 AC_SUBST(SDL_EXTRALIBS)
  1866 AC_SUBST(SYSTEM_LIBS)
  1867 
  1868 dnl Expand the cflags and libraries needed by apps using SDL
  1869 AC_SUBST(SDL_CFLAGS)
  1870 AC_SUBST(SDL_LIBS)
  1871 AC_SUBST(SDL_RLD_FLAGS)
  1872 
  1873 dnl Expand the libraries needed for static linking
  1874 AC_SUBST(SYSTEM_LIBS)
  1875 dnl Expand the include directories for building SDL
  1876 CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
  1877 CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
  1878 CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/$ARCH"
  1879 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main"
  1880 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
  1881 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
  1882 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
  1883 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
  1884 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
  1885 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
  1886 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
  1887 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian"
  1888 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
  1889 CXXFLAGS="$CFLAGS"
  1890 
  1891 # Finally create all the generated files
  1892 dnl Important: Any directory that you want to be in the distcheck should
  1893 dnl            have a file listed here, so that configure generates the
  1894 dnl            subdirectories on the build target.
  1895 AC_OUTPUT([
  1896 Makefile
  1897 docs/Makefile
  1898 docs/html/Makefile
  1899 docs/man3/Makefile
  1900 include/Makefile
  1901 src/Makefile
  1902 src/main/Makefile
  1903 src/audio/Makefile
  1904 src/audio/alsa/Makefile
  1905 src/audio/arts/Makefile
  1906 src/audio/baudio/Makefile
  1907 src/audio/dma/Makefile
  1908 src/audio/dmedia/Makefile
  1909 src/audio/dsp/Makefile
  1910 src/audio/esd/Makefile
  1911 src/audio/macrom/Makefile
  1912 src/audio/nas/Makefile
  1913 src/audio/nto/Makefile
  1914 src/audio/paudio/Makefile
  1915 src/audio/sun/Makefile
  1916 src/audio/ums/Makefile
  1917 src/audio/windib/Makefile
  1918 src/audio/windx5/Makefile
  1919 src/video/Makefile
  1920 src/video/cybergfx/Makefile
  1921 src/video/x11/Makefile
  1922 src/video/dga/Makefile
  1923 src/video/fbcon/Makefile
  1924 src/video/ggi/Makefile
  1925 src/video/maccommon/Makefile
  1926 src/video/macdsp/Makefile
  1927 src/video/macrom/Makefile
  1928 src/video/svga/Makefile
  1929 src/video/aalib/Makefile
  1930 src/video/wincommon/Makefile
  1931 src/video/windib/Makefile
  1932 src/video/windx5/Makefile
  1933 src/video/bwindow/Makefile
  1934 src/video/photon/Makefile
  1935 src/video/dummy/Makefile
  1936 src/events/Makefile
  1937 src/joystick/Makefile
  1938 src/joystick/beos/Makefile
  1939 src/joystick/dummy/Makefile
  1940 src/joystick/linux/Makefile
  1941 src/joystick/macos/Makefile
  1942 src/joystick/win32/Makefile
  1943 src/cdrom/Makefile
  1944 src/thread/Makefile
  1945 src/timer/Makefile
  1946 src/endian/Makefile
  1947 src/file/Makefile
  1948 src/hermes/Makefile
  1949 sdl-config
  1950 SDL.spec
  1951 ], [chmod +x sdl-config])