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