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