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