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