configure.in
author Sam Lantinga
Tue, 21 Aug 2001 07:19:59 +0000
changeset 158 4382c38dfbee
parent 153 2839f45bdba0
child 166 39877400bd1e
permissions -rw-r--r--
Date: Tue, 21 Aug 2001 03:50:01 +0200
From: Max Horn <max@quendi.de>
Subject: New patch for OS X

Attached a .patch file for SDL/OSX with some nice bug fixes / enhancments.

* fixes the activation issues, which also caused the window to be
always drawn like an inactive. The close/minimize widgets now are
animated properly, too.

* the menu items are automatically adjusted to use the app name
instead of just "SDL App". I did this so that we really can use one
central SDLMain.nib file, w/o requiring developers to make a copy of
it and adjust it.

* libSDLMain now contains the proper cocoa code, not as before the
carbon code. This means apps no longer have to carry a copy of
SDLMain.m/SDLMain.h

* revamped configure.in to properly build a Cocoa/Quartz SDL lib, not
a Carbon based SDL lib
     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     CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
  1200       -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
  1201       -DENABLE_QUARTZ -DMACOSX -DTARGET_API_MAC_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
  1202     VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
  1203     VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
  1204 }
  1205 
  1206 dnl Set up the kernel statistics library for Solaris
  1207 CheckKSTAT()
  1208 {
  1209     CFLAGS="$CFLAGS -DHAVE_KSTAT"
  1210     SYSTEM_LIBS="$SYSTEM_LIBS -lkstat"
  1211 }
  1212 
  1213 case "$target" in
  1214     *-*-linux*)
  1215         ARCH=linux
  1216         CheckDummyVideo
  1217         CheckDiskAudio
  1218         CheckNASM
  1219         CheckOSS
  1220         CheckALSA
  1221         CheckARTSC
  1222         CheckESD
  1223         CheckNAS
  1224         CheckX11
  1225         CheckNANOX
  1226         CheckDGA
  1227         CheckFBCON
  1228         CheckPS2GS
  1229         CheckGGI
  1230         CheckSVGA
  1231         CheckAAlib
  1232         CheckOpenGL
  1233         CheckInputEvents
  1234         CheckPTHREAD
  1235         # Set up files for the main() stub
  1236         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1237         # Set up files for the audio library
  1238         # We use the OSS and ALSA API's, not the Sun audio API
  1239         #if test x$enable_audio = xyes; then
  1240         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1241         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1242         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1243         #fi
  1244         # Set up files for the joystick library
  1245         if test x$enable_joystick = xyes; then
  1246             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
  1247             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
  1248         fi
  1249         # Set up files for the cdrom library
  1250         if test x$enable_cdrom = xyes; then
  1251             CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
  1252             CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
  1253         fi
  1254         # Set up files for the thread library
  1255         if test x$enable_threads = xyes; then
  1256             if test x$use_pthreads != xyes; then
  1257                 COPY_ARCH_SRC(src/thread, linux, clone.S)
  1258             fi
  1259             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1260             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1261             if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
  1262                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1263             else
  1264                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1265             fi
  1266             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1267             if test x$glibc20_pthreads = xyes; then
  1268                 COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1269                 COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1270                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1271                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1272             else
  1273                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1274                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1275                 COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1276                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1277             fi
  1278         fi
  1279         # Set up files for the timer library
  1280         if test x$enable_timers = xyes; then
  1281             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1282         fi
  1283         ;;
  1284     *-*-bsdi*)
  1285         ARCH=bsdi
  1286         CheckDummyVideo
  1287         CheckDiskAudio
  1288         CheckNASM
  1289         CheckOSS
  1290         CheckARTSC
  1291         CheckESD
  1292         CheckNAS
  1293         CheckX11
  1294         CheckDGA
  1295         CheckSVGA
  1296         CheckAAlib
  1297         CheckOpenGL
  1298         CheckPTHREAD
  1299         # Set up files for the main() stub
  1300         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1301         # Set up files for the audio library
  1302         # We use the OSS and ALSA API's, not the Sun audio API
  1303         #if test x$enable_audio = xyes; then
  1304         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1305         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1306         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1307         #fi
  1308         # Set up files for the joystick library
  1309         # (No joystick support yet)
  1310         if test x$enable_joystick = xyes; then
  1311             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1312             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1313         fi
  1314         # Set up files for the cdrom library
  1315         # (No cdrom support yet)
  1316         if test x$enable_cdrom = xyes; then
  1317             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  1318             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  1319         fi
  1320         # Set up files for the thread library
  1321         if test x$enable_threads = xyes; then
  1322             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1323             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1324             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1325             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1326             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1327             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1328             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1329             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1330         fi
  1331         # Set up files for the timer library
  1332         if test x$enable_timers = xyes; then
  1333             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1334         fi
  1335         ;;
  1336     *-*-freebsd*)
  1337         ARCH=freebsd
  1338         CheckDummyVideo
  1339         CheckDiskAudio
  1340         CheckVGL
  1341         CheckNASM
  1342         CheckOSS
  1343         CheckARTSC
  1344         CheckESD
  1345         CheckNAS
  1346         CheckX11
  1347         CheckDGA
  1348         CheckSVGA
  1349         CheckAAlib
  1350         CheckOpenGL
  1351         CheckPTHREAD
  1352         # Set up files for the main() stub
  1353         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1354         # Set up files for the audio library
  1355         # We use the OSS and ALSA API's, not the Sun audio API
  1356         #if test x$enable_audio = xyes; then
  1357         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1358         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1359         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1360         #fi
  1361         # Set up files for the joystick library
  1362         # (No joystick support yet)
  1363         if test x$enable_joystick = xyes; then
  1364             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1365             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1366         fi
  1367         # Set up files for the cdrom library
  1368         if test x$enable_cdrom = xyes; then
  1369             CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
  1370             CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
  1371         fi
  1372         # Set up files for the thread library
  1373         if test x$enable_threads = xyes; then
  1374             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1375             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1376             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1377             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1378             if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
  1379                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1380             else
  1381                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1382             fi
  1383             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1384             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1385             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1386         fi
  1387         # Set up files for the timer library
  1388         if test x$enable_timers = xyes; then
  1389             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1390         fi
  1391         ;;
  1392     *-*-netbsd*)
  1393         ARCH=netbsd
  1394         CheckDummyVideo
  1395         CheckDiskAudio
  1396         CheckNASM
  1397         CheckOSS
  1398         CheckARTSC
  1399         CheckESD
  1400         CheckNAS
  1401         CheckX11
  1402         CheckAAlib
  1403         CheckOpenGL
  1404         CheckPTHREAD
  1405         # Set up files for the main() stub
  1406         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1407         # Set up files for the audio library
  1408         if test x$enable_audio = xyes; then
  1409             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1410             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1411             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1412         fi
  1413         # Set up files for the joystick library
  1414         # (No joystick support yet)
  1415         if test x$enable_joystick = xyes; then
  1416             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1417             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1418         fi
  1419         # Set up files for the cdrom library
  1420         if test x$enable_cdrom = xyes; then
  1421             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  1422             CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  1423         fi
  1424         # Set up files for the thread library
  1425         if test x$enable_threads = xyes; then
  1426             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1427             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1428             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1429             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1430             if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
  1431                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1432             else
  1433                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1434             fi
  1435             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1436             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1437             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1438         fi
  1439         # Set up files for the timer library
  1440         if test x$enable_timers = xyes; then
  1441             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1442         fi
  1443         # NetBSD does not define "unix"
  1444         CFLAGS="$CFLAGS -Dunix -D_POSIX_THREAD_SYSCALL_SOFT=1"
  1445         ;;
  1446     *-*-openbsd*)
  1447         ARCH=openbsd
  1448         CheckDummyVideo
  1449         CheckDiskAudio
  1450         CheckOPENBSDAUDIO
  1451         CheckNASM
  1452         CheckOSS
  1453         CheckARTSC
  1454         CheckESD
  1455         CheckNAS
  1456         CheckX11
  1457         CheckAAlib
  1458         CheckOpenGL
  1459         CheckPTHREAD
  1460         # Set up files for the main() stub
  1461         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1462         # Set up files for the audio library
  1463         # We use the OSS and native API's, not the Sun audio API
  1464         #if test x$enable_audio = xyes; then
  1465         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1466         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1467         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1468         #fi
  1469         # OpenBSD needs linking with ossaudio emulation library
  1470         if test x$have_oss = xyes; then
  1471             SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio"
  1472         fi
  1473         # Set up files for the joystick library
  1474         # (No joystick support yet)
  1475         if test x$enable_joystick = xyes; then
  1476             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1477             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1478         fi
  1479         # Set up files for the cdrom library
  1480         if test x$enable_cdrom = xyes; then
  1481             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  1482             CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  1483         fi
  1484         # Set up files for the thread library
  1485         if test x$enable_threads = xyes; then
  1486             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1487             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1488             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1489             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1490             if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
  1491                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1492             else
  1493                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1494             fi
  1495             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1496             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1497             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1498         fi
  1499         # Set up files for the timer library
  1500         if test x$enable_timers = xyes; then
  1501             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1502         fi
  1503         # OpenBSD does not define "unix"
  1504         CFLAGS="$CFLAGS -Dunix"
  1505         ;;
  1506     *-*-sysv5*)
  1507         ARCH=sysv5
  1508         CheckDummyVideo
  1509         CheckDiskAudio
  1510         CheckNASM
  1511         CheckOSS
  1512         CheckARTSC
  1513         CheckESD
  1514         CheckNAS
  1515         CheckX11
  1516         CheckAAlib
  1517         CheckOpenGL
  1518         CheckPTHREAD
  1519         CheckKSTAT
  1520         # Set up files for the main() stub
  1521         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1522         # Set up files for the audio library
  1523         if test x$enable_audio = xyes; then
  1524             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1525             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1526             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1527         fi
  1528         # Set up files for the joystick library
  1529         # (No joystick support yet)
  1530         if test x$enable_joystick = xyes; then
  1531             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1532             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1533         fi
  1534         # Set up files for the cdrom library
  1535         if test x$enable_cdrom = xyes; then
  1536             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  1537             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  1538         fi
  1539         # Set up files for the thread library
  1540         if test x$enable_threads = xyes; then
  1541             COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
  1542             COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
  1543             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1544             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1545             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1546             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1547             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1548             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1549         fi
  1550         # Set up files for the timer library
  1551         if test x$enable_timers = xyes; then
  1552             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1553         fi
  1554         ;;
  1555     *-*-solaris*)
  1556         ARCH=solaris
  1557         CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
  1558         CheckDummyVideo
  1559         CheckDiskAudio
  1560         CheckNASM
  1561         CheckOSS
  1562         CheckARTSC
  1563         CheckESD
  1564         CheckNAS
  1565         CheckX11
  1566         CheckAAlib
  1567         CheckOpenGL
  1568         CheckPTHREAD
  1569         CheckKSTAT
  1570         # Set up files for the main() stub
  1571         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1572         # Set up files for the audio library
  1573         if test x$enable_audio = xyes; then
  1574             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1575             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1576             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1577         fi
  1578         # Set up files for the joystick library
  1579         # (No joystick support yet)
  1580         if test x$enable_joystick = xyes; then
  1581             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1582             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1583         fi
  1584         # Set up files for the cdrom library
  1585         if test x$enable_cdrom = xyes; then
  1586             CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
  1587             CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
  1588         fi
  1589         # Set up files for the thread library
  1590         if test x$enable_threads = xyes; then
  1591             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1592             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1593             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1594             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1595             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1596             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1597             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1598             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1599         fi
  1600         # Set up files for the timer library
  1601         if test x$enable_timers = xyes; then
  1602             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1603         fi
  1604         ;;
  1605     *-*-irix*)
  1606         ARCH=irix
  1607         CheckDummyVideo
  1608         CheckDiskAudio
  1609         CheckDMEDIA
  1610         CheckESD
  1611         CheckNAS
  1612         CheckX11
  1613         CheckAAlib
  1614         CheckOpenGL
  1615         CheckPTHREAD
  1616         # Set up files for the main() stub
  1617         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1618         # We use the dmedia audio API, not the Sun audio API
  1619         #if test x$enable_audio = xyes; then
  1620         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1621         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1622         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1623         #fi
  1624         # Set up files for the joystick library
  1625         # (No joystick support yet)
  1626         if test x$enable_joystick = xyes; then
  1627             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1628             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1629         fi
  1630         # Set up files for the cdrom library
  1631         # (No CD-ROM support yet)
  1632         if test x$enable_cdrom = xyes; then
  1633             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  1634             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  1635         fi
  1636         # Set up files for the thread library
  1637         if test x$enable_threads = xyes; then
  1638             if test x$use_pthreads = xyes; then
  1639                 COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1640                 COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1641                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1642                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1643                 if test x$have_pthread_sem != xyes; then
  1644                     COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1645                 else
  1646                     COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1647                 fi
  1648                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1649                 COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1650                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1651             else
  1652                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
  1653                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
  1654                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1655                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1656                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1657                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1658                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1659                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1660             fi
  1661         fi
  1662         # Set up files for the timer library
  1663         if test x$enable_timers = xyes; then
  1664             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1665         fi
  1666         ;;
  1667     *-*-hpux*)
  1668         ARCH=hpux
  1669         CheckDummyVideo
  1670         CheckDiskAudio
  1671         CheckOSS
  1672         CheckNAS
  1673         CheckX11
  1674         CheckGGI
  1675         CheckAAlib
  1676         CheckOpenGL
  1677         CheckPTHREAD
  1678         # Set up files for the main() stub
  1679         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1680         # Set up files for the audio library
  1681         if test x$enable_audio = xyes; then
  1682             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1683             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1684             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1685         fi
  1686         # Set up files for the joystick library
  1687         # (No joystick support yet)
  1688         if test x$enable_joystick = xyes; then
  1689             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1690             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1691         fi
  1692         # Set up files for the cdrom library
  1693         # (No CD-ROM support yet)
  1694         if test x$enable_cdrom = xyes; then
  1695             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  1696             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  1697         fi
  1698         # Set up files for the thread library
  1699         if test x$enable_threads = xyes; then
  1700             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1701             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1702             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1703             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1704             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1705             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1706             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1707             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1708         fi
  1709         # Set up files for the timer library
  1710         if test x$enable_timers = xyes; then
  1711             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1712         fi
  1713         ;;
  1714     *-*-aix*)
  1715         ARCH=aix
  1716         CheckDummyVideo
  1717         CheckDiskAudio
  1718         CheckOSS
  1719         CheckNAS
  1720         CheckX11
  1721         CheckGGI
  1722         CheckAAlib
  1723         CheckOpenGL
  1724         CheckPTHREAD
  1725         # Set up files for the main() stub
  1726         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1727         # Set up files for the audio library
  1728         if test x$enable_audio = xyes; then
  1729             AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
  1730             AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la"
  1731         fi
  1732         # Set up files for the joystick library
  1733         # (No joystick support yet)
  1734         if test x$enable_joystick = xyes; then
  1735             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1736             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1737         fi
  1738         # Set up files for the cdrom library
  1739         if test x$enable_cdrom = xyes; then
  1740             CDROM_SUBDIRS="$CDROM_SUBDIRS aix"
  1741             CDROM_DRIVERS="$CDROM_DRIVERS aix/libcdrom_aix.la"
  1742         fi
  1743         # Set up files for the thread library
  1744         if test x$enable_threads = xyes; then
  1745             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1746             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1747             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1748             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1749             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1750             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1751             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1752             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1753         fi
  1754         # Set up files for the timer library
  1755         if test x$enable_timers = xyes; then
  1756             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1757         fi
  1758         ;;
  1759     *-*-osf*)
  1760         ARCH=osf
  1761         CheckDummyVideo
  1762         CheckDiskAudio
  1763         CheckNAS
  1764         CheckX11
  1765         CheckGGI
  1766         CheckAAlib
  1767         CheckOpenGL
  1768         CheckPTHREAD
  1769         # Set up files for the main() stub
  1770         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1771         # Set up files for the audio library
  1772         if test x$enable_audio = xyes; then
  1773             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1774             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1775             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1776         fi
  1777         # Set up files for the joystick library
  1778         # (No joystick support yet)
  1779         if test x$enable_joystick = xyes; then
  1780             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1781             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1782         fi
  1783         # Set up files for the cdrom library
  1784         # (No cdrom support yet)
  1785         if test x$enable_cdrom = xyes; then
  1786             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  1787             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  1788         fi
  1789         # Set up files for the thread library
  1790         if test x$enable_threads = xyes; then
  1791             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1792             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1793             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1794             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1795             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1796             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1797             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1798             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1799         fi
  1800         # Set up files for the timer library
  1801         if test x$enable_timers = xyes; then
  1802             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1803         fi
  1804         ;;
  1805     *-*-qnx*)
  1806         ARCH=qnx
  1807         CheckDummyVideo
  1808         CheckDiskAudio
  1809         CheckNAS
  1810         CheckPHOTON
  1811         CheckX11
  1812         CheckOpenGL
  1813         CheckPTHREAD
  1814         # Set up files for the main() stub
  1815         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1816         # Set up files for the audio library
  1817         if test x$enable_audio = xyes; then
  1818             CFLAGS="$CFLAGS -DALSA_SUPPORT"
  1819             SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
  1820             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto"
  1821             AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la"
  1822         fi
  1823         # Set up files for the joystick library
  1824         if test x$enable_joystick = xyes; then
  1825         # (No joystick support yet)
  1826             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1827             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1828         fi
  1829         # Set up files for the cdrom library
  1830         if test x$enable_cdrom = xyes; then
  1831             CDROM_SUBDIRS="$CDROM_SUBDIRS qnx"
  1832             CDROM_DRIVERS="$CDROM_DRIVERS qnx/libcdrom_qnx.la"
  1833         fi
  1834         # Set up files for the thread library
  1835         if test x$enable_threads = xyes; then
  1836             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1837             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1838             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1839             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1840             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1841             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1842             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1843             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1844         fi
  1845         # Set up files for the timer library
  1846         if test x$enable_timers = xyes; then
  1847             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1848         fi
  1849         ;;
  1850     *-*-cygwin* | *-*-mingw32*)
  1851         ARCH=win32
  1852         if test "$build" != "$target"; then # cross-compiling
  1853             # Default cross-compile location
  1854             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  1855         else
  1856             # Look for the location of the tools and install there
  1857             if [ "$BUILD_PREFIX" != "" ]; then
  1858                 ac_default_prefix=$BUILD_PREFIX
  1859             fi
  1860         fi
  1861         CheckDummyVideo
  1862         CheckDiskAudio
  1863         CheckWIN32
  1864         CheckDIRECTX
  1865         CheckNASM
  1866         # Set up files for the main() stub
  1867         COPY_ARCH_SRC(src/main, win32, SDL_main.c)
  1868         # Set up files for the audio library
  1869         if test x$enable_audio = xyes; then
  1870             AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
  1871             AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la"
  1872             if test x$use_directx = xyes; then
  1873                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5"
  1874                 AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la"
  1875             fi
  1876         fi
  1877         # Set up files for the joystick library
  1878         if test x$enable_joystick = xyes; then
  1879             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32"
  1880             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la"
  1881         fi
  1882         # Set up files for the cdrom library
  1883         if test x$enable_cdrom = xyes; then
  1884             CDROM_SUBDIRS="$CDROM_SUBDIRS win32"
  1885             CDROM_DRIVERS="$CDROM_DRIVERS win32/libcdrom_win32.la"
  1886         fi
  1887         # Set up files for the thread library
  1888         if test x$enable_threads = xyes; then
  1889             COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
  1890             COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
  1891             COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c)
  1892             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1893             COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c)
  1894             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1895             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1896             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1897         fi
  1898         # Set up files for the timer library
  1899         if test x$enable_timers = xyes; then
  1900             COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c)
  1901         fi
  1902         # The Win32 platform requires special setup
  1903         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  1904         case "$target" in
  1905             *-*-cygwin*)
  1906                 CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix"
  1907                 SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix"
  1908                 LIBS="$LIBS -mno-cygwin"
  1909                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
  1910                 ;;
  1911             *-*-mingw32*)
  1912                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  1913                 ;;
  1914         esac
  1915         ;;
  1916     *-*-beos*)
  1917         ARCH=beos
  1918         ac_default_prefix=/boot/develop/tools/gnupro
  1919         CheckDummyVideo
  1920         CheckDiskAudio
  1921         CheckNASM
  1922         CheckBWINDOW
  1923         CheckBeGL
  1924         # Set up files for the main() stub
  1925         COPY_ARCH_SRC(src/main, linux, SDL_main.c)
  1926         COPY_ARCH_SRC(src/main, beos, SDL_BeApp.cc)
  1927         COPY_ARCH_SRC(src/main, beos, SDL_BeApp.h)
  1928         # Set up files for the audio library
  1929         if test x$enable_audio = xyes; then
  1930             AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
  1931             AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la"
  1932         fi
  1933         # Set up files for the joystick library
  1934         if test x$enable_joystick = xyes; then
  1935             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos"
  1936             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la"
  1937         fi
  1938         # Set up files for the cdrom library
  1939         if test x$enable_cdrom = xyes; then
  1940             CDROM_SUBDIRS="$CDROM_SUBDIRS beos"
  1941             CDROM_DRIVERS="$CDROM_DRIVERS beos/libcdrom_beos.la"
  1942         fi
  1943         # Set up files for the thread library
  1944         if test x$enable_threads = xyes; then
  1945             COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
  1946             COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
  1947             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1948             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1949             COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c)
  1950             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1951             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1952             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1953         fi
  1954         # Set up files for the timer library
  1955         if test x$enable_timers = xyes; then
  1956             COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c)
  1957         fi
  1958         # The BeOS platform requires special libraries
  1959         SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  1960         ;;
  1961     *-*-macos*)
  1962         # This would be used if cross-compiling to MacOS 9.  No way to
  1963         # use it at present, but Apple is working on a X-to-9 compiler
  1964         # for which this case would be handy.
  1965         ARCH=macos
  1966         CheckDummyVideo
  1967         CheckDiskAudio
  1968         CheckTOOLBOX
  1969         CheckMacGL
  1970         # Set up files for the main() stub
  1971         COPY_ARCH_SRC(src/main, macos, SDL_main.c)
  1972         # Set up files for the audio library
  1973         if test x$enable_audio = xyes; then
  1974             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  1975             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  1976         fi
  1977         # Set up files for the joystick library
  1978         if test x$enable_joystick = xyes; then
  1979             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos"
  1980             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la"
  1981         fi
  1982         # Set up files for the cdrom library
  1983         if test x$enable_cdrom = xyes; then
  1984             CDROM_SUBDIRS="$CDROM_SUBDIRS macos"
  1985             CDROM_DRIVERS="$CDROM_DRIVERS macos/libcdrom_macos.la"
  1986         fi
  1987         # Set up files for the thread library
  1988         if test x$enable_threads = xyes; then
  1989             COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
  1990             COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
  1991             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1992             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1993             COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c)
  1994             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1995             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1996             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1997         fi
  1998         # Set up files for the timer library
  1999         if test x$enable_timers = xyes; then
  2000             COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c)
  2001         fi
  2002         # The MacOS platform requires special setup
  2003         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2004         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2005         ;;
  2006     *-*-darwin* )
  2007         # Strictly speaking, we want "Mac OS X", not "Darwin", which is
  2008         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2009         # But config.guess comes back with "darwin", so go with the flow.
  2010         ARCH=macosx
  2011         CheckDummyVideo
  2012         CheckDiskAudio
  2013         CheckQUARTZ
  2014         CheckMacGL
  2015         CheckPTHREAD
  2016         # Set up files for the main() stub
  2017         COPY_ARCH_SRC(src/main, macosx, SDLmain.m)
  2018         COPY_ARCH_SRC(src/main, macosx, SDLmain.h)
  2019         # Set up files for the audio library
  2020         if test x$enable_audio = xyes; then
  2021             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  2022             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  2023         fi
  2024         # Set up files for the joystick library
  2025         if test x$enable_joystick = xyes; then
  2026             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2027             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2028         fi
  2029         # Set up files for the cdrom library
  2030         if test x$enable_cdrom = xyes; then
  2031             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2032             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2033         fi
  2034         # Set up files for the thread library
  2035         if test x$enable_threads = xyes; then
  2036             COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  2037             COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  2038             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  2039             COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  2040             if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
  2041                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  2042             else
  2043                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  2044             fi
  2045             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2046             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2047             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2048         fi
  2049         # Set up files for the timer library
  2050         if test x$enable_timers = xyes; then
  2051             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2052         fi
  2053         # The MacOS X platform requires special setup
  2054         SDL_CFLAGS="$SDL_CFLAGS -F/System/Library/Frameworks/Carbon.framework -F/System/Library/Frameworks/Cocoa.framework"
  2055         SDL_LIBS="-lSDLmain $SDL_LIBS -framework Carbon -framework Cocoa"
  2056         ;;
  2057     *)
  2058         AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
  2059         ;;
  2060 esac
  2061 AC_SUBST(ARCH)
  2062 
  2063 # Set the conditional variables for this target
  2064 AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
  2065 AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
  2066 AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
  2067 AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
  2068 AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
  2069 AM_CONDITIONAL(TARGET_NETBSD, test $ARCH = netbsd)
  2070 AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd)
  2071 AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix)
  2072 AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
  2073 AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
  2074 AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
  2075 AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
  2076 
  2077 # Set conditional variables for shared and static library selection.
  2078 # These are not used in any Makefile.am but in sdl-config.in.
  2079 AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
  2080 AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes])
  2081 
  2082 # Set runtime shared library paths as needed
  2083 
  2084 if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
  2085   SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2086 fi
  2087 
  2088 if test $ARCH = solaris; then
  2089   SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2090 fi
  2091 
  2092 if test $ARCH = openbsd; then
  2093   SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib $SYSTEM_LIBS"
  2094 fi
  2095 
  2096 dnl Output the video drivers we use
  2097 if test x$enable_video = xtrue; then
  2098     if test "$VIDEO_SUBDIRS" = ""; then
  2099         AC_MSG_ERROR(*** No video drivers are enabled!)
  2100     fi
  2101 fi
  2102 AC_SUBST(AUDIO_SUBDIRS)
  2103 AC_SUBST(AUDIO_DRIVERS)
  2104 AC_SUBST(VIDEO_SUBDIRS)
  2105 AC_SUBST(VIDEO_DRIVERS)
  2106 AC_SUBST(JOYSTICK_SUBDIRS)
  2107 AC_SUBST(JOYSTICK_DRIVERS)
  2108 AC_SUBST(CDROM_SUBDIRS)
  2109 AC_SUBST(CDROM_DRIVERS)
  2110 AC_SUBST(SDL_EXTRADIRS)
  2111 AC_SUBST(SDL_EXTRALIBS)
  2112 AC_SUBST(SYSTEM_LIBS)
  2113 
  2114 dnl Expand the cflags and libraries needed by apps using SDL
  2115 AC_SUBST(SDL_CFLAGS)
  2116 AC_SUBST(SDL_LIBS)
  2117 AC_SUBST(SDL_RLD_FLAGS)
  2118 
  2119 dnl Expand the libraries needed for static linking
  2120 AC_SUBST(SYSTEM_LIBS)
  2121 dnl Expand the include directories for building SDL
  2122 CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
  2123 CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
  2124 CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/$ARCH"
  2125 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main"
  2126 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
  2127 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
  2128 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
  2129 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
  2130 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
  2131 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
  2132 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
  2133 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian"
  2134 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
  2135 CXXFLAGS="$CFLAGS"
  2136 
  2137 
  2138 # Check for darwin at the very end and set up the Objective C compiler
  2139 # We do this here so that we get the full CFLAGS into OBJCFLAGS
  2140 case "$target" in
  2141     *-*-darwin*)
  2142         OBJC="cc"
  2143         OBJCFLAGS="$CFLAGS"
  2144         AC_SUBST(OBJC)
  2145         AC_SUBST(OBJCFLAGS)
  2146         ;;
  2147 esac
  2148 
  2149 # Finally create all the generated files
  2150 dnl Important: Any directory that you want to be in the distcheck should
  2151 dnl            have a file listed here, so that configure generates the
  2152 dnl            subdirectories on the build target.
  2153 AC_OUTPUT([
  2154 Makefile
  2155 docs/Makefile
  2156 docs/html/Makefile
  2157 docs/man3/Makefile
  2158 include/Makefile
  2159 src/Makefile
  2160 src/main/Makefile
  2161 src/audio/Makefile
  2162 src/audio/alsa/Makefile
  2163 src/audio/arts/Makefile
  2164 src/audio/baudio/Makefile
  2165 src/audio/dma/Makefile
  2166 src/audio/dmedia/Makefile
  2167 src/audio/dsp/Makefile
  2168 src/audio/esd/Makefile
  2169 src/audio/macrom/Makefile
  2170 src/audio/nas/Makefile
  2171 src/audio/nto/Makefile
  2172 src/audio/openbsd/Makefile
  2173 src/audio/paudio/Makefile
  2174 src/audio/sun/Makefile
  2175 src/audio/ums/Makefile
  2176 src/audio/windib/Makefile
  2177 src/audio/windx5/Makefile
  2178 src/audio/disk/Makefile
  2179 src/video/Makefile
  2180 src/video/cybergfx/Makefile
  2181 src/video/x11/Makefile
  2182 src/video/dga/Makefile
  2183 src/video/nanox/Makefile
  2184 src/video/fbcon/Makefile
  2185 src/video/ps2gs/Makefile
  2186 src/video/ggi/Makefile
  2187 src/video/maccommon/Makefile
  2188 src/video/macdsp/Makefile
  2189 src/video/macrom/Makefile
  2190 src/video/quartz/Makefile
  2191 src/video/svga/Makefile
  2192 src/video/vgl/Makefile
  2193 src/video/aalib/Makefile
  2194 src/video/wincommon/Makefile
  2195 src/video/windib/Makefile
  2196 src/video/windx5/Makefile
  2197 src/video/bwindow/Makefile
  2198 src/video/photon/Makefile
  2199 src/video/dummy/Makefile
  2200 src/events/Makefile
  2201 src/joystick/Makefile
  2202 src/joystick/amigaos/Makefile
  2203 src/joystick/beos/Makefile
  2204 src/joystick/dummy/Makefile
  2205 src/joystick/linux/Makefile
  2206 src/joystick/macos/Makefile
  2207 src/joystick/win32/Makefile
  2208 src/cdrom/Makefile
  2209 src/cdrom/aix/Makefile
  2210 src/cdrom/beos/Makefile
  2211 src/cdrom/dummy/Makefile
  2212 src/cdrom/freebsd/Makefile
  2213 src/cdrom/linux/Makefile
  2214 src/cdrom/macos/Makefile
  2215 src/cdrom/openbsd/Makefile
  2216 src/cdrom/qnx/Makefile
  2217 src/cdrom/win32/Makefile
  2218 src/thread/Makefile
  2219 src/timer/Makefile
  2220 src/endian/Makefile
  2221 src/file/Makefile
  2222 src/hermes/Makefile
  2223 sdl-config
  2224 SDL.spec
  2225 ], [chmod +x sdl-config])