configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 15 Dec 2004 01:02:20 +0000
changeset 1014 cfcb2e1c36eb
parent 1009 027688378762
child 1019 e3b3130f3af8
permissions -rw-r--r--
Added change log notes
     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=8
    18 SDL_INTERFACE_AGE=1
    19 SDL_BINARY_AGE=8
    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_SYSTEM
    42 
    43 dnl Setup for automake
    44 AM_INIT_AUTOMAKE(SDL, $SDL_VERSION)
    45 
    46 dnl Check for tools
    47 
    48 AC_LIBTOOL_WIN32_DLL
    49 AM_PROG_LIBTOOL
    50 AC_PROG_MAKE_SET
    51 AC_PROG_CC
    52 AC_C_INLINE
    53 AC_C_CONST
    54 AC_PROG_CXX
    55 AC_PROG_INSTALL
    56 AC_FUNC_ALLOCA
    57 ASFLAGS=""
    58 AC_SUBST(ASFLAGS)
    59 CCAS="$CC"
    60 AC_SUBST(CCAS)
    61 CCASFLAGS=""
    62 AC_SUBST(CCASFLAGS)
    63 AM_CONDITIONAL([am__fastdepOBJC], false)
    64 
    65 dnl The alpha architecture needs special flags for binary portability
    66 case "$target" in
    67     alpha*-*-linux*)
    68         if test x$ac_cv_prog_gcc = xyes; then
    69             CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
    70         fi
    71         ;;
    72 esac
    73 
    74 dnl Add compiler-specific optimization flags
    75 
    76 dnl See if the user wants aggressive optimizations of the code
    77 AC_ARG_ENABLE(debug,
    78 [  --enable-debug          Disable aggressive optimizations [default=yes]],
    79               , enable_debug=yes)
    80 if test x$enable_debug != xyes; then
    81     if test x$ac_cv_prog_gcc = xyes; then
    82         CFLAGS="$CFLAGS -fexpensive-optimizations"
    83         # Ack! This breaks the MMX YV12 conversion on gcc 2.95.2
    84         # CFLAGS="$CFLAGS -fomit-frame-pointer"
    85     fi
    86     case "$target" in
    87         i486-*-*)
    88             if test x$ac_cv_prog_gcc = xyes; then
    89                 CFLAGS="$CFLAGS -march=i486"
    90             fi
    91             ;;
    92         i?86-*-*)
    93             if test x$ac_cv_prog_gcc = xyes; then
    94                 CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro"
    95             fi
    96             ;;
    97         *-*-osf*)
    98             if test x$ac_cv_prog_gcc != xyes; then
    99                 CFLAGS="-g3 -fast -arch host"
   100             fi
   101             ;;
   102     esac
   103 fi
   104 
   105 dnl Add verbose warnings by default, and allow ANSI compliance checking
   106 AC_ARG_ENABLE(strict-ansi,
   107 [  --enable-strict-ansi    Enable strict ANSI compliance build [default=no]],
   108               , enable_strict_ansi=no)
   109 if test x$ac_cv_prog_gcc = xyes; then
   110     CFLAGS="$CFLAGS -Wall"
   111     if test x$enable_strict_ansi = xyes; then
   112         CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
   113     fi
   114 fi
   115 
   116 dnl Initialize the compiler and linker flags for SDL applications
   117 
   118 SDL_CFLAGS=""
   119 SDL_LIBS="-lSDL"
   120 
   121 dnl Add the math library for the new gamma correction support
   122 
   123 case "$target" in
   124     *-*-cygwin* | *-*-mingw32*)
   125         MATHLIB=""
   126         ;;
   127     *-*-beos*)
   128         MATHLIB=""
   129         ;;
   130     *-*-darwin*)
   131         MATHLIB=""
   132         ;;
   133     *)
   134         MATHLIB="-lm"
   135         ;;
   136 esac
   137 SYSTEM_LIBS="$SYSTEM_LIBS $MATHLIB"
   138 
   139 dnl Enable/disable various subsystems of the SDL library
   140 
   141 AC_ARG_ENABLE(audio,
   142 [  --enable-audio          Enable the audio subsystem [default=yes]],
   143               , enable_audio=yes)
   144 if test x$enable_audio = xyes; then
   145     SDL_EXTRADIRS="$SDL_EXTRADIRS audio"
   146     SDL_EXTRALIBS="$SDL_EXTRALIBS audio/libaudio.la"
   147 else
   148     CFLAGS="$CFLAGS -DDISABLE_AUDIO"
   149 fi
   150 AC_ARG_ENABLE(video,
   151 [  --enable-video          Enable the video subsystem [default=yes]],
   152               , enable_video=yes)
   153 if test x$enable_video = xyes; then
   154     SDL_EXTRADIRS="$SDL_EXTRADIRS video"
   155     SDL_EXTRALIBS="$SDL_EXTRALIBS video/libvideo.la"
   156 else
   157     CFLAGS="$CFLAGS -DDISABLE_VIDEO"
   158 fi
   159 AC_ARG_ENABLE(events,
   160 [  --enable-events         Enable the events subsystem [default=yes]],
   161               , enable_events=yes)
   162 if test x$enable_video = xyes -a x$enable_events = xyes; then
   163     SDL_EXTRADIRS="$SDL_EXTRADIRS events"
   164     SDL_EXTRALIBS="$SDL_EXTRALIBS events/libevents.la"
   165 else
   166     CFLAGS="$CFLAGS -DDISABLE_EVENTS"
   167 fi
   168 AC_ARG_ENABLE(joystick,
   169 [  --enable-joystick       Enable the joystick subsystem [default=yes]],
   170               , enable_joystick=yes)
   171 if test x$enable_joystick = xyes; then
   172     SDL_EXTRADIRS="$SDL_EXTRADIRS joystick"
   173     SDL_EXTRALIBS="$SDL_EXTRALIBS joystick/libjoystick.la"
   174 else
   175     CFLAGS="$CFLAGS -DDISABLE_JOYSTICK"
   176 fi
   177 AC_ARG_ENABLE(cdrom,
   178 [  --enable-cdrom          Enable the cdrom subsystem [default=yes]],
   179               , enable_cdrom=yes)
   180 if test x$enable_cdrom = xyes; then
   181     SDL_EXTRADIRS="$SDL_EXTRADIRS cdrom"
   182     SDL_EXTRALIBS="$SDL_EXTRALIBS cdrom/libcdrom.la"
   183 else
   184     CFLAGS="$CFLAGS -DDISABLE_CDROM"
   185 fi
   186 AC_ARG_ENABLE(threads,
   187 [  --enable-threads        Enable the threading subsystem [default=yes]],
   188               , enable_threads=yes)
   189 SDL_EXTRADIRS="$SDL_EXTRADIRS thread"
   190 SDL_EXTRALIBS="$SDL_EXTRALIBS thread/libthread.la"
   191 if test x$enable_threads != xyes; then
   192     CFLAGS="$CFLAGS -DDISABLE_THREADS"
   193     COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
   194     COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
   195     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
   196     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
   197     COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
   198     COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
   199     COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
   200     COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
   201 fi
   202 AC_ARG_ENABLE(timers,
   203 [  --enable-timers         Enable the timer subsystem [default=yes]],
   204               , enable_timers=yes)
   205 if test x$enable_timers = xyes; then
   206     SDL_EXTRADIRS="$SDL_EXTRADIRS timer"
   207     SDL_EXTRALIBS="$SDL_EXTRALIBS timer/libtimer.la"
   208 else
   209     CFLAGS="$CFLAGS -DDISABLE_TIMERS"
   210 fi
   211 AC_ARG_ENABLE(endian,
   212 [  --enable-endian         Enable the endian subsystem [default=yes]],
   213               , enable_endian=yes)
   214 if test x$enable_endian = xyes; then
   215     SDL_EXTRADIRS="$SDL_EXTRADIRS endian"
   216     SDL_EXTRALIBS="$SDL_EXTRALIBS endian/libendian.la"
   217 else
   218     CFLAGS="$CFLAGS -DDISABLE_ENDIAN"
   219 fi
   220 AC_ARG_ENABLE(file,
   221 [  --enable-file           Enable the file subsystem [default=yes]],
   222               , enable_file=yes)
   223 if test x$enable_file = xyes; then
   224     SDL_EXTRADIRS="$SDL_EXTRADIRS file"
   225     SDL_EXTRALIBS="$SDL_EXTRALIBS file/libfile.la"
   226 else
   227     CFLAGS="$CFLAGS -DDISABLE_FILE"
   228 fi
   229 AC_ARG_ENABLE(cpuinfo,
   230 [  --enable-cpuinfo        Enable the cpuinfo subsystem [default=yes]],
   231               , enable_cpuinfo=yes)
   232 if test x$enable_cpuinfo = xyes; then
   233     SDL_EXTRADIRS="$SDL_EXTRADIRS cpuinfo"
   234     SDL_EXTRALIBS="$SDL_EXTRALIBS cpuinfo/libcpuinfo.la"
   235 else
   236     CFLAGS="$CFLAGS -DDISABLE_CPUINFO"
   237 fi
   238 
   239 dnl See if the OSS audio interface is supported
   240 CheckOSS()
   241 {
   242     AC_ARG_ENABLE(oss,
   243 [  --enable-oss            support the OSS audio API [default=yes]],
   244                   , enable_oss=yes)
   245     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
   246         AC_MSG_CHECKING(for OSS audio support)
   247         have_oss=no
   248         if test x$have_oss != xyes; then
   249             AC_TRY_COMPILE([
   250               #include <sys/soundcard.h>
   251             ],[
   252               int arg = SNDCTL_DSP_SETFRAGMENT;
   253             ],[
   254             have_oss=yes
   255             ])
   256         fi
   257         if test x$have_oss != xyes; then
   258             AC_TRY_COMPILE([
   259               #include <soundcard.h>
   260             ],[
   261               int arg = SNDCTL_DSP_SETFRAGMENT;
   262             ],[
   263             have_oss=yes
   264             CFLAGS="$CFLAGS -DOSS_USE_SOUNDCARD_H"
   265             ])
   266         fi
   267         AC_MSG_RESULT($have_oss)
   268         if test x$have_oss = xyes; then
   269             CFLAGS="$CFLAGS -DOSS_SUPPORT"
   270             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
   271             AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
   272             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
   273             AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la"
   274         fi
   275     fi
   276 }
   277 
   278 dnl See if the ALSA audio interface is supported
   279 CheckALSA()
   280 {
   281     AC_ARG_ENABLE(alsa,
   282 [  --enable-alsa           support the ALSA audio API [default=yes]],
   283                   , enable_alsa=yes)
   284     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
   285         AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
   286         # Restore all flags from before the ALSA detection runs
   287         CFLAGS="$alsa_save_CFLAGS"
   288         LDFLAGS="$alsa_save_LDFLAGS"
   289         LIBS="$alsa_save_LIBS"
   290         if test x$have_alsa = xyes; then
   291             AC_ARG_ENABLE(alsa-shared,
   292 [  --enable-alsa-shared     dynamically load ALSA audio support [default=yes]],
   293                           , enable_alsa_shared=yes)
   294             if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
   295                 if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
   296                     ALSA_LIBS="-L/lib $ALSA_LIBS"
   297                 elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
   298                     ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
   299                 elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
   300                     ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
   301                 fi
   302             fi
   303             alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
   304             alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   305             echo "-- $alsa_lib_spec -> $alsa_lib"
   306 
   307             if test x$use_dlopen != xyes && \
   308                test x$enable_alsa_shared = xyes; then
   309                 AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
   310             fi
   311             if test x$use_dlopen = xyes && \
   312                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   313                 CFLAGS="$CFLAGS -DALSA_SUPPORT -DALSA_DYNAMIC=\$(alsa_lib) $ALSA_CFLAGS"
   314                 AC_SUBST(alsa_lib)
   315 
   316                 AC_MSG_CHECKING(for dlvsym)
   317                 use_dlvsym=no
   318                 AC_TRY_COMPILE([
   319                   #include <stdio.h>
   320                   #define __USE_GNU
   321                   #include <dlfcn.h>
   322                 ],[
   323                   dlvsym(NULL,"","");
   324                 ],[
   325                 use_dlvsym=yes
   326                 ])
   327                 AC_MSG_RESULT($use_dlvsym);
   328                 if test x$use_dlvsym = xyes; then
   329                     CFLAGS="$CFLAGS -DUSE_DLVSYM"
   330                 fi
   331             else
   332                 CFLAGS="$CFLAGS -DALSA_SUPPORT $ALSA_CFLAGS"
   333                 SYSTEM_LIBS="$SYSTEM_LIBS $ALSA_LIBS"
   334             fi
   335             AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa"
   336             AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la"
   337         fi
   338     fi
   339 }
   340 
   341 dnl Check whether we want to use IRIX 6.5+ native audio or not
   342 CheckDMEDIA()
   343 {
   344     if test x$enable_audio = xyes; then
   345         AC_MSG_CHECKING(for dmedia audio support)
   346         have_dmedia=no
   347         AC_TRY_COMPILE([
   348           #include <dmedia/audio.h>
   349         ],[
   350           ALport audio_port;
   351         ],[
   352         have_dmedia=yes
   353         ])
   354         AC_MSG_RESULT($have_dmedia)
   355         # Set up files for the audio library
   356         if test x$have_dmedia = xyes; then
   357             CFLAGS="$CFLAGS -DDMEDIA_SUPPORT"
   358             AUDIO_SUBDIRS="$AUDIO_SUBDIRS dmedia"
   359             AUDIO_DRIVERS="$AUDIO_DRIVERS dmedia/libaudio_dmedia.la"
   360             SYSTEM_LIBS="$SYSTEM_LIBS -laudio"
   361         fi
   362     fi
   363 }
   364 
   365 dnl Find the ESD includes and libraries
   366 CheckESD()
   367 {
   368     AC_ARG_ENABLE(esd,
   369 [  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
   370                   , enable_esd=yes)
   371     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   372         AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
   373         if test x$have_esd = xyes; then
   374             AC_ARG_ENABLE(esd-shared,
   375 [  --enable-esd-shared     dynamically load ESD audio support [default=yes]],
   376                           , enable_esd_shared=yes)
   377             esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
   378             esd_lib=`ls $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   379             echo "-- $esd_lib_spec -> $esd_lib"
   380             if test x$use_dlopen != xyes && \
   381                test x$enable_esd_shared = xyes; then
   382                 AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
   383             fi
   384             if test x$use_dlopen = xyes && \
   385                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   386                 CFLAGS="$CFLAGS -DESD_SUPPORT -DESD_DYNAMIC=\$(esd_lib) $ESD_CFLAGS"
   387                 AC_SUBST(esd_lib)
   388             else
   389                 CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
   390                 SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
   391             fi
   392             AUDIO_SUBDIRS="$AUDIO_SUBDIRS esd"
   393             AUDIO_DRIVERS="$AUDIO_DRIVERS esd/libaudio_esd.la"
   394         fi
   395     fi
   396 }
   397 
   398 CheckARTSC()
   399 {
   400     AC_ARG_ENABLE(arts,
   401 [  --enable-arts           support the Analog Real Time Synthesizer [default=yes]],
   402                   , enable_arts=yes)
   403     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   404         AC_PATH_PROG(ARTSCCONFIG, artsc-config)
   405         if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"'; then
   406             : # arts isn't installed
   407         else
   408             ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
   409             ARTSC_LIBS=`$ARTSCCONFIG --libs`
   410             ARTSC_PREFIX=`$ARTSCCONFIG --arts-prefix`
   411             AC_MSG_CHECKING(for aRts development environment)
   412             audio_arts=no
   413             save_CFLAGS="$CFLAGS"
   414             CFLAGS="$CFLAGS $ARTSC_CFLAGS"
   415             AC_TRY_COMPILE([
   416              #include <artsc.h>
   417             ],[
   418              arts_stream_t stream;
   419             ],[
   420             audio_arts=yes
   421             ])
   422             CFLAGS="$save_CFLAGS"
   423             AC_MSG_RESULT($audio_arts)
   424             if test x$audio_arts = xyes; then
   425                 AC_ARG_ENABLE(arts-shared,
   426 [  --enable-arts-shared    dynamically load aRts audio support [default=yes]],
   427                               , enable_arts_shared=yes)
   428                 arts_lib_spec="$ARTSC_PREFIX/lib/libartsc.so.*"
   429                 arts_lib=`ls $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   430                 echo "-- $arts_lib_spec -> $arts_lib"
   431                 if test x$use_dlopen != xyes && \
   432                    test x$enable_arts_shared = xyes; then
   433                     AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
   434                 fi
   435                 if test x$use_dlopen = xyes && \
   436                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   437                     CFLAGS="$CFLAGS -DARTSC_SUPPORT -DARTSC_DYNAMIC=\$(arts_lib) $ARTSC_CFLAGS"
   438                     AC_SUBST(arts_lib)
   439                 else
   440                     CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
   441                     SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
   442                 fi
   443                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS arts"
   444                 AUDIO_DRIVERS="$AUDIO_DRIVERS arts/libaudio_arts.la"
   445             fi
   446         fi
   447     fi
   448 }
   449 
   450 dnl See if the NAS audio interface is supported
   451 CheckNAS()
   452 {
   453     AC_ARG_ENABLE(nas,
   454 [  --enable-nas            support the NAS audio API [default=yes]],
   455                   , enable_nas=yes)
   456     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   457         AC_MSG_CHECKING(for NAS audio support)
   458         have_nas=no
   459         if test -r /usr/X11R6/include/audio/audiolib.h; then
   460             have_nas=yes
   461             CFLAGS="$CFLAGS -DNAS_SUPPORT -I/usr/X11R6/include/"
   462             SYSTEM_LIBS="$SYSTEM_LIBS -laudio -lXt"
   463             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
   464             AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
   465 
   466         dnl On IRIX, the NAS includes are in a different directory,
   467         dnl and libnas must be explicitly linked in
   468 
   469         elif test -r /usr/freeware/include/nas/audiolib.h; then
   470             have_nas=yes
   471             CFLAGS="$CFLAGS -DNAS_SUPPORT"
   472             SYSTEM_LIBS="$SYSTEM_LIBS -lnas -lXt"
   473             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
   474             AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
   475         fi
   476         AC_MSG_RESULT($have_nas)
   477     fi
   478 }
   479 
   480 dnl rcg07142001 See if the user wants the disk writer audio driver...
   481 CheckDiskAudio()
   482 {
   483     AC_ARG_ENABLE(diskaudio,
   484 [  --enable-diskaudio      support the disk writer audio driver [default=yes]],
   485                   , enable_diskaudio=yes)
   486     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
   487         CFLAGS="$CFLAGS -DDISKAUD_SUPPORT"
   488         AUDIO_SUBDIRS="$AUDIO_SUBDIRS disk"
   489         AUDIO_DRIVERS="$AUDIO_DRIVERS disk/libaudio_disk.la"
   490     fi
   491 }
   492 
   493 dnl Set up the Atari Audio driver
   494 CheckAtariAudio()
   495 {
   496     AC_ARG_ENABLE(mintaudio,
   497 [  --enable-mintaudio      support Atari audio driver [default=yes]],
   498                   , enable_mintaudio=yes)
   499     if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
   500         mintaudio=no
   501         AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
   502         if test x$have_mint_falcon_hdr = xyes; then
   503             mintaudio=yes
   504             CFLAGS="$CFLAGS -DMINTAUDIO_SUPPORT"
   505             AUDIO_SUBDIRS="$AUDIO_SUBDIRS mint"
   506             AUDIO_DRIVERS="$AUDIO_DRIVERS mint/libaudio_mintaudio.la"
   507         fi
   508     fi
   509 }
   510 
   511 dnl See if we can use x86 assembly blitters
   512 # NASM is available from: http://nasm.octium.net/
   513 CheckNASM()
   514 {
   515     dnl Make sure we are running on an x86 platform
   516     case $target in
   517         i?86*)
   518             ;;
   519         *)
   520         # Nope, bail early.
   521             return
   522             ;;
   523     esac
   524     dnl Check for NASM (for assembly blit routines)
   525     AC_ARG_ENABLE(nasm,
   526 [  --enable-nasm           use nasm assembly blitters on x86 [default=yes]],
   527                   , enable_nasm=yes)
   528     if test x$enable_video = xyes -a x$enable_nasm = xyes; then
   529         AC_PATH_PROG(NASM, nasm)
   530         if test x$NASM = x -o x$NASM = x'"$NASM"'; then
   531             : # nasm isn't installed
   532         else
   533             CFLAGS="$CFLAGS -DUSE_ASMBLIT -I$srcdir/hermes"
   534             case $ARCH in
   535               win32)
   536                   NASMFLAGS="-f win32"
   537                   ;;
   538               openbsd)
   539                   NASMFLAGS="-f aoutb"
   540                   ;;
   541               *)
   542                   NASMFLAGS="-f elf"
   543                   ;;
   544             esac
   545             AC_SUBST(NASMFLAGS)
   546             CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes"
   547             SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
   548             SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
   549             use_nasm=yes
   550             
   551             case "$target" in
   552                 # this line is needed for QNX, because it's not defined the __ELF__
   553                 *-*-qnx*) CFLAGS="$CFLAGS -D__ELF__"
   554                           ;;
   555 
   556             esac
   557 
   558         fi
   559     fi
   560 }
   561 
   562 dnl Find the nanox include and library directories
   563 CheckNANOX()
   564 {
   565     AC_ARG_ENABLE(video-nanox,
   566         [  --enable-video-nanox use nanox video driver [default=no]],
   567         , enable_video_nanox=no)
   568     AC_ARG_ENABLE(nanox-debug,  
   569         [  --enable-nanox-debug print debug messages [default=no]],
   570         , enable_nanox_debug=no)
   571     AC_ARG_ENABLE(nanox-share-memory,  
   572         [  --enable-nanox-share-memory use share memory [default=no]],
   573         , enable_nanox_share_memory=no)
   574     AC_ARG_ENABLE(nanox_direct_fb, 
   575         [  --enable-nanox-direct-fb use direct framebuffer access [default=no]],
   576         , enable_nanox_direct_fb=no)
   577 
   578     if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
   579         if test x$enable_nanox_debug = xyes; then
   580             CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
   581         fi
   582 
   583         if test x$enable_nanox_share_memory = xyes; then
   584             CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
   585         fi
   586 
   587         if test x$enable_nanox_direct_fb = xyes; then
   588             CFLAGS="$CFLAGS -DENABLE_NANOX_DIRECT_FB"
   589         fi
   590 
   591         CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
   592         SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
   593         VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
   594         VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
   595     fi
   596 }
   597 
   598 dnl Find the X11 include and library directories
   599 CheckX11()
   600 {
   601     AC_ARG_ENABLE(video-x11,
   602 [  --enable-video-x11      use X11 video driver [default=yes]],
   603                   , enable_video_x11=yes)
   604     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
   605         AC_PATH_X
   606         AC_PATH_XTRA
   607         if test x$have_x = xyes; then
   608             CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -DXTHREADS -I$srcdir/include -I$srcdir/src/video"
   609             if test x$ac_cv_func_shmat != xyes; then
   610                 CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
   611             fi
   612             SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
   613             VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
   614             VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"
   615 
   616             AC_ARG_ENABLE(video-x11-vm,
   617 [  --enable-video-x11-vm   use X11 VM extension for fullscreen [default=yes]],
   618                           , enable_video_x11_vm=yes)
   619             if test x$enable_video_x11_vm = xyes; then
   620                 AC_MSG_CHECKING(for XFree86 VidMode 1.0 support)
   621                 video_x11_vm=no
   622                 AC_TRY_COMPILE([
   623                  #include <X11/Xlib.h>
   624                  #include <XFree86/extensions/xf86vmode.h>
   625                 ],[
   626                 ],[
   627                 video_x11_vm=yes
   628                 ])
   629                 AC_MSG_RESULT($video_x11_vm)
   630                 if test x$video_x11_vm = xyes; then
   631                     CFLAGS="$CFLAGS -DXFREE86_VM"
   632                     VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86vm"
   633                     VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86vm/libXFree86_Xxf86vm.la"
   634                     AC_MSG_CHECKING(for XFree86 VidMode gamma support)
   635                     video_x11_vmgamma=no
   636                     AC_TRY_COMPILE([
   637                      #include <X11/Xlib.h>
   638                      #include <XFree86/extensions/xf86vmode.h>
   639                     ],[
   640                      SDL_NAME(XF86VidModeGamma) gamma;
   641                     ],[
   642                     video_x11_vmgamma=yes
   643                     ])
   644                     AC_MSG_RESULT($video_x11_vmgamma)
   645                     if test x$video_x11_vmgamma = xyes; then
   646                         CFLAGS="$CFLAGS -DXFREE86_VMGAMMA"
   647                     fi
   648                 fi
   649             fi
   650             AC_ARG_ENABLE(dga,
   651 [  --enable-dga            allow use of X11 DGA code [default=yes]],
   652                           , enable_dga=yes)
   653             AC_ARG_ENABLE(video-x11-dgamouse,
   654 [  --enable-video-x11-dgamouse  use X11 DGA for mouse events [default=yes]],
   655                           , enable_video_x11_dgamouse=yes)
   656             if test x$enable_dga = xyes; then
   657                 AC_MSG_CHECKING(for XFree86 DGA 1.0 support)
   658                 video_x11_dga=no
   659                 AC_TRY_COMPILE([
   660                  #include <X11/Xlib.h>
   661                  #include <XFree86/extensions/xf86dga.h>
   662                 ],[
   663                 ],[
   664                 video_x11_dga=yes
   665                 ])
   666                 AC_MSG_RESULT($video_x11_dga)
   667                 if test x$video_x11_dga = xyes; then
   668                     CFLAGS="$CFLAGS -DXFREE86_DGAMOUSE"
   669                     if test x$enable_video_x11_dgamouse = xyes; then
   670                         CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE"
   671                     fi
   672                     VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86dga"
   673                     VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86dga/libXFree86_Xxf86dga.la"
   674                 fi
   675             fi
   676             AC_ARG_ENABLE(video-x11-xv,
   677 [  --enable-video-x11-xv   use X11 XvImage extension for video [default=yes]],
   678                           , enable_video_x11_xv=yes)
   679             if test x$enable_video_x11_xv = xyes; then
   680                 AC_MSG_CHECKING(for XFree86 XvImage support)
   681                 video_x11_xv=no
   682                 AC_TRY_COMPILE([
   683                  #include <X11/Xlib.h>
   684                  #include <sys/ipc.h>
   685                  #include <sys/shm.h>
   686                  #include <X11/extensions/XShm.h>
   687                  #include <XFree86/extensions/Xvlib.h>
   688                 ],[
   689                  SDL_NAME(XvImage) *image;
   690                 ],[
   691                 video_x11_xv=yes
   692                 ])
   693                 AC_MSG_RESULT($video_x11_xv)
   694                 if test x$video_x11_xv = xyes; then
   695                     CFLAGS="$CFLAGS -DXFREE86_XV"
   696                     VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xv"
   697                     VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xv/libXFree86_Xv.la"
   698                 fi
   699             fi
   700             AC_ARG_ENABLE(video-x11-xinerama,
   701 [  --enable-video-x11-xinerama   enable X11 Xinerama support [default=yes]],
   702                             , enable_video_x11_xinerama=yes)
   703             if test x$enable_video_x11_xinerama = xyes; then
   704                 AC_MSG_CHECKING(for X11 Xinerama support)
   705                 video_x11_xinerama=no
   706                 AC_TRY_COMPILE([
   707                  #include <X11/Xlib.h>
   708                  #include <XFree86/extensions/Xinerama.h>
   709                 ],[
   710                  SDL_NAME(XineramaScreenInfo) *xinerama;
   711                 ],[
   712                 video_x11_xinerama=yes
   713                 ])
   714                 AC_MSG_RESULT($video_x11_xinerama)
   715                 if test x$video_x11_xinerama = xyes; then
   716                     CFLAGS="$CFLAGS -DHAVE_XINERAMA"
   717                     VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xinerama"
   718                     VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xinerama/libXFree86_Xinerama.la"
   719                 fi
   720             fi
   721             AC_ARG_ENABLE(video-x11-xme,
   722 [  --enable-video-x11-xme  enable Xi Graphics XME for fullscreen [default=yes]],
   723                             , enable_video_x11_xme=yes)
   724             if test x$enable_video_x11_xme = xyes; then
   725                 AC_MSG_CHECKING(for Xi Graphics XiGMiscExtension support)
   726                 video_x11_xme=no
   727                 AC_TRY_COMPILE([
   728                  #include <X11/Xlib.h>
   729                  #include <X11/extensions/xme.h>
   730                 ],[
   731                  XiGMiscResolutionInfo *resolutions;
   732                 ],[
   733                 video_x11_xme=yes
   734                 ])
   735                 AC_MSG_RESULT($video_x11_xme)
   736                 if test x$video_x11_xme = xyes; then
   737                     CFLAGS="$CFLAGS -DHAVE_XIGXME"
   738                     SYSTEM_LIBS="$SYSTEM_LIBS -lxme"
   739                 fi
   740             fi
   741         fi
   742     fi
   743 }
   744 
   745 dnl Find the X11 DGA 2.0 include and library directories
   746 CheckDGA()
   747 {
   748     AC_ARG_ENABLE(video-dga,
   749 [  --enable-video-dga      use DGA 2.0 video driver [default=yes]],
   750                   , enable_video_dga=yes)
   751     if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
   752         save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS -Isrc/video"
   753         AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
   754         video_x11_dga2=no
   755         AC_TRY_COMPILE([
   756          #include <X11/Xlib.h>
   757          #include <XFree86/extensions/xf86dga.h>
   758         ],[
   759          SDL_NAME(XDGAEvent) xevent;
   760         ],[
   761         video_x11_dga2=yes
   762         ])
   763         AC_MSG_RESULT($video_x11_dga2)
   764         if test x$video_x11_dga2 = xyes; then
   765             CFLAGS="$CFLAGS -DENABLE_DGA"
   766             VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
   767             VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
   768         fi
   769     fi
   770 }
   771 
   772 CheckPHOTON()
   773 {
   774     AC_ARG_ENABLE(video-photon,
   775 [  --enable-video-photon   use QNX Photon video driver [default=yes]],
   776                   , enable_video_photon=yes)
   777     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
   778         AC_MSG_CHECKING(for QNX Photon support)
   779         video_photon=no
   780         AC_TRY_COMPILE([
   781           #include <Ph.h>
   782           #include <Pt.h>
   783           #include <photon/Pg.h>
   784           #include <photon/PdDirect.h>
   785         ],[
   786          PgDisplaySettings_t *visual;
   787         ],[
   788         video_photon=yes
   789         ])
   790         AC_MSG_RESULT($video_photon)
   791         if test x$video_photon = xyes; then
   792             CFLAGS="$CFLAGS -DENABLE_PHOTON"
   793             SYSTEM_LIBS="$SYSTEM_LIBS -lph"
   794             VIDEO_SUBDIRS="$VIDEO_SUBDIRS photon"
   795             VIDEO_DRIVERS="$VIDEO_DRIVERS photon/libvideo_photon.la"
   796             CheckOpenGLQNX
   797         fi
   798     fi
   799 }
   800 
   801 dnl Find the framebuffer console includes
   802 CheckFBCON()
   803 {
   804     AC_ARG_ENABLE(video-fbcon,
   805 [  --enable-video-fbcon    use framebuffer console video driver [default=yes]],
   806                   , enable_video_fbcon=yes)
   807     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
   808         AC_MSG_CHECKING(for framebuffer console support)
   809         video_fbcon=no
   810         AC_TRY_COMPILE([
   811          #include <linux/fb.h>
   812          #include <linux/kd.h>
   813          #include <linux/keyboard.h>
   814         ],[
   815         ],[
   816         video_fbcon=yes
   817         ])
   818         AC_MSG_RESULT($video_fbcon)
   819         if test x$video_fbcon = xyes; then
   820             CFLAGS="$CFLAGS -DENABLE_FBCON"
   821             VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon"
   822             VIDEO_DRIVERS="$VIDEO_DRIVERS fbcon/libvideo_fbcon.la"
   823         fi
   824     fi
   825 }
   826 
   827 dnl Find DirectFB
   828 CheckDirectFB()
   829 {
   830     AC_ARG_ENABLE(video-directfb,
   831 [  --enable-video-directfb use DirectFB video driver [default=no]],
   832                   , enable_video_directfb=no)
   833     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
   834         video_directfb=no
   835 
   836         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   837         if test x$PKG_CONFIG = xno ; then
   838             AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
   839         else
   840             AC_MSG_CHECKING(for DirectFB support)
   841 
   842             if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
   843                 AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
   844             fi
   845 
   846             DIRECTFB_REQUIRED_VERSION=0.9.15
   847 
   848             if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
   849                 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
   850                 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
   851                 video_directfb=yes
   852             fi
   853         fi
   854 
   855         AC_MSG_RESULT($video_directfb)
   856         if test x$video_directfb = xyes; then
   857             CFLAGS="$CFLAGS -DENABLE_DIRECTFB"
   858             VIDEO_SUBDIRS="$VIDEO_SUBDIRS directfb"
   859             VIDEO_DRIVERS="$VIDEO_DRIVERS directfb/libvideo_directfb.la"
   860 
   861             AC_SUBST(DIRECTFB_CFLAGS)
   862             AC_SUBST(DIRECTFB_LIBS)
   863         fi
   864     fi
   865 }
   866 
   867 dnl See if we're running on PlayStation 2 hardware
   868 CheckPS2GS()
   869 {
   870     AC_ARG_ENABLE(video-ps2gs,
   871 [  --enable-video-ps2gs    use PlayStation 2 GS video driver [default=yes]],
   872                   , enable_video_ps2gs=yes)
   873     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
   874         AC_MSG_CHECKING(for PlayStation 2 GS support)
   875         video_ps2gs=no
   876         AC_TRY_COMPILE([
   877          #include <linux/ps2/dev.h>
   878          #include <linux/ps2/gs.h>
   879         ],[
   880         ],[
   881         video_ps2gs=yes
   882         ])
   883         AC_MSG_RESULT($video_ps2gs)
   884         if test x$video_ps2gs = xyes; then
   885             CFLAGS="$CFLAGS -DENABLE_PS2GS"
   886             VIDEO_SUBDIRS="$VIDEO_SUBDIRS ps2gs"
   887             VIDEO_DRIVERS="$VIDEO_DRIVERS ps2gs/libvideo_ps2gs.la"
   888         fi
   889     fi
   890 }
   891 
   892 dnl Find the GGI includes
   893 CheckGGI()
   894 {
   895     AC_ARG_ENABLE(video-ggi,
   896 [  --enable-video-ggi      use GGI video driver [default=no]],
   897                   , enable_video_ggi=no)
   898     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
   899         AC_MSG_CHECKING(for GGI support)
   900         video_ggi=no
   901         AC_TRY_COMPILE([
   902          #include <ggi/ggi.h>
   903          #include <ggi/gii.h>
   904         ],[
   905         ],[
   906         video_ggi=yes
   907         ])
   908         AC_MSG_RESULT($video_ggi)
   909         if test x$video_ggi = xyes; then
   910             CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_GGI"
   911             SYSTEM_LIBS="$SYSTEM_LIBS -lggi -lgii -lgg"
   912 
   913             VIDEO_SUBDIRS="$VIDEO_SUBDIRS ggi"
   914             VIDEO_DRIVERS="$VIDEO_DRIVERS ggi/libvideo_ggi.la"
   915         fi
   916     fi
   917 }
   918 
   919 dnl Find the SVGAlib includes and libraries
   920 CheckSVGA()
   921 {
   922     AC_ARG_ENABLE(video-svga,
   923 [  --enable-video-svga     use SVGAlib video driver [default=no]],
   924                   , enable_video_svga=no)
   925     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
   926         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
   927         video_svga=no
   928         AC_TRY_COMPILE([
   929          #include <vga.h>
   930          #include <vgamouse.h>
   931          #include <vgakeyboard.h>
   932         ],[
   933          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
   934              exit(0);
   935          }
   936         ],[
   937         video_svga=yes
   938         ])
   939         AC_MSG_RESULT($video_svga)
   940         if test x$video_svga = xyes; then
   941             CFLAGS="$CFLAGS -DENABLE_SVGALIB"
   942             SYSTEM_LIBS="$SYSTEM_LIBS -lvga"
   943 
   944             VIDEO_SUBDIRS="$VIDEO_SUBDIRS svga"
   945             VIDEO_DRIVERS="$VIDEO_DRIVERS svga/libvideo_svga.la"
   946         fi
   947     fi
   948 }
   949 
   950 dnl Find the VGL includes and libraries
   951 CheckVGL()
   952 {
   953     AC_ARG_ENABLE(video-vgl,
   954 [  --enable-video-vgl      use VGL video driver [default=no]],
   955                   , enable_video_vgl=no)
   956     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
   957         AC_MSG_CHECKING(for libVGL support)
   958         video_vgl=no
   959         AC_TRY_COMPILE([
   960          #include <sys/fbio.h>
   961          #include <sys/consio.h>
   962          #include <sys/kbio.h>
   963          #include <vgl.h>
   964         ],[
   965          VGLBitmap bitmap;
   966          exit(bitmap.Bitmap);
   967         ],[
   968         video_vgl=yes
   969         ])
   970         AC_MSG_RESULT($video_vgl)
   971         if test x$video_vgl = xyes; then
   972             CFLAGS="$CFLAGS -DENABLE_VGL"
   973             SYSTEM_LIBS="$SYSTEM_LIBS -lvgl"
   974 
   975             VIDEO_SUBDIRS="$VIDEO_SUBDIRS vgl"
   976             VIDEO_DRIVERS="$VIDEO_DRIVERS vgl/libvideo_vgl.la"
   977         fi
   978     fi
   979 }
   980 
   981 dnl Find the AAlib includes
   982 CheckAAlib()
   983 {
   984     AC_ARG_ENABLE(video-aalib,
   985 [  --enable-video-aalib    use AAlib video driver [default=no]],
   986                   , enable_video_aalib=no)
   987     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
   988         AC_MSG_CHECKING(for AAlib support)
   989         video_aalib=no
   990         AC_TRY_COMPILE([
   991          #include <aalib.h>
   992         ],[
   993         ],[
   994         video_aalib=yes
   995         ])
   996         AC_MSG_RESULT($video_aalib)
   997         if test x$video_aalib = xyes; then
   998             CFLAGS="$CFLAGS -DENABLE_AALIB"
   999             SYSTEM_LIBS="$SYSTEM_LIBS -laa"
  1000 
  1001             VIDEO_SUBDIRS="$VIDEO_SUBDIRS aalib"
  1002             VIDEO_DRIVERS="$VIDEO_DRIVERS aalib/libvideo_aa.la"
  1003         fi
  1004     fi
  1005 }
  1006 
  1007 dnl Set up the Atari Xbios driver
  1008 CheckAtariXbiosVideo()
  1009 {
  1010     AC_ARG_ENABLE(xbios,
  1011 [  --enable-video-xbios    use Atari Xbios video driver [default=yes]],
  1012                   , enable_video_xbios=yes)
  1013     video_xbios=no
  1014     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1015         video_xbios=yes
  1016         CFLAGS="$CFLAGS -DENABLE_XBIOS"
  1017         VIDEO_SUBDIRS="$VIDEO_SUBDIRS xbios"
  1018         VIDEO_DRIVERS="$VIDEO_DRIVERS xbios/libvideo_xbios.la"
  1019     fi
  1020 }
  1021 
  1022 dnl Set up the Atari Gem driver
  1023 CheckAtariGemVideo()
  1024 {
  1025     AC_ARG_ENABLE(gem,
  1026 [  --enable-video-gem      use Atari Gem video driver [default=yes]],
  1027                   , enable_video_gem=yes)
  1028     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1029         video_gem=no
  1030         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1031         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1032         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1033             video_gem=yes
  1034             CFLAGS="$CFLAGS -DENABLE_GEM"
  1035             SYSTEM_LIBS="$SYSTEM_LIBS -lgem"
  1036             VIDEO_SUBDIRS="$VIDEO_SUBDIRS gem"
  1037             VIDEO_DRIVERS="$VIDEO_DRIVERS gem/libvideo_gem.la"
  1038         fi
  1039     fi
  1040 }
  1041 
  1042 dnl Set up the Atari Bios keyboard driver
  1043 CheckAtariBiosEvent()
  1044 {
  1045     CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/ataricommon"
  1046     VIDEO_SUBDIRS="$VIDEO_SUBDIRS ataricommon"
  1047     VIDEO_DRIVERS="$VIDEO_DRIVERS ataricommon/libvideo_ataricommon.la"
  1048 }
  1049 
  1050 dnl rcg04172001 Set up the Null video driver.
  1051 CheckDummyVideo()
  1052 {
  1053     AC_ARG_ENABLE(video-dummy,
  1054 [  --enable-video-dummy    use dummy video driver [default=yes]],
  1055                   , enable_video_dummy=yes)
  1056     if test x$enable_video_dummy = xyes; then
  1057       CFLAGS="$CFLAGS -DENABLE_DUMMYVIDEO"
  1058       VIDEO_SUBDIRS="$VIDEO_SUBDIRS dummy"
  1059       VIDEO_DRIVERS="$VIDEO_DRIVERS dummy/libvideo_null.la"
  1060     fi
  1061 }
  1062 
  1063 dnl Check to see if OpenGL support is desired
  1064 AC_ARG_ENABLE(video-opengl,
  1065 [  --enable-video-opengl   include OpenGL context creation [default=yes]],
  1066               , enable_video_opengl=yes)
  1067 
  1068 dnl Find OpenGL
  1069 CheckOpenGL()
  1070 {
  1071     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1072         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1073         video_opengl=no
  1074         AC_TRY_COMPILE([
  1075          #include <GL/gl.h>
  1076          #include <GL/glx.h>
  1077          #include <dlfcn.h> /* For loading extensions */
  1078         ],[
  1079         ],[
  1080         video_opengl=yes
  1081         ])
  1082         AC_MSG_RESULT($video_opengl)
  1083         if test x$video_opengl = xyes; then
  1084             CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1085             if test x$use_dlopen != xyes; then
  1086                 AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl")
  1087             fi
  1088         fi
  1089     fi
  1090 }
  1091 
  1092 dnl Find QNX RtP OpenGL
  1093 CheckOpenGLQNX()
  1094 {
  1095     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1096         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1097         video_opengl=no
  1098         AC_TRY_COMPILE([
  1099          #include <GL/gl.h>
  1100         ],[
  1101         ],[
  1102         video_opengl=yes
  1103         ])
  1104         AC_MSG_RESULT($video_opengl)
  1105         if test x$video_opengl = xyes; then
  1106             CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1107             SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
  1108             if test x$use_dlopen != xyes; then
  1109                 AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS", AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl"))
  1110             fi
  1111         fi
  1112     fi
  1113 }
  1114 
  1115 dnl Check for BeOS OpenGL
  1116 CheckBeGL()
  1117 {
  1118     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1119         CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1120         SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
  1121     fi
  1122 }
  1123 
  1124 dnl Check for MacOS OpenGL
  1125 CheckMacGL()
  1126 {
  1127     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1128         CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1129         case "$target" in
  1130             *-*-darwin*)
  1131                 SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL -framework AGL"
  1132         esac
  1133     fi
  1134 }
  1135 
  1136 dnl Check for Mesa offscreen rendering
  1137 CheckAtariOSMesa()
  1138 {
  1139     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1140         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1141         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1142 
  1143         # Static linking to -lOSMesa
  1144         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1145         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1146             # -lOSMesa is really the static library
  1147             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1148     	        CFLAGS="$CFLAGS -DHAVE_OPENGL"
  1149 		    	SYSTEM_LIBS="$SYSTEM_LIBS -lOSMesa"
  1150             fi
  1151         else
  1152             # -lOSMesa is a loader for OSMesa.ldg
  1153             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1154             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1155             CFLAGS="$CFLAGS -DHAVE_OPENGL $OSMESA_CFLAGS"
  1156             SYSTEM_LIBS="$SYSTEM_LIBS $OSMESA_LIBS"
  1157         fi
  1158 
  1159         AC_ARG_ENABLE(osmesa-shared,
  1160 [  --enable-osmesa-shared  dynamically load OSMesa OpenGL support [default=yes]],
  1161                               , enable_osmesa_shared=yes)
  1162         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1163             # Dynamic linking
  1164             if test "x$have_osmesa_hdr" = "xyes"; then
  1165                 CFLAGS="$CFLAGS -DENABLE_OSMESA_SHARED"
  1166             fi
  1167 		fi
  1168     fi
  1169 }
  1170 
  1171 dnl See if we can use the new unified event interface in Linux 2.4
  1172 CheckInputEvents()
  1173 {
  1174     dnl Check for Linux 2.4 unified input event interface support
  1175     AC_ARG_ENABLE(input-events,
  1176 [  --enable-input-events   use Linux 2.4 unified input interface [default=yes]],
  1177                   , enable_input_events=yes)
  1178     if test x$enable_input_events = xyes; then
  1179         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1180         use_input_events=no
  1181         AC_TRY_COMPILE([
  1182           #include <linux/input.h>
  1183         ],[
  1184           #ifndef EVIOCGNAME
  1185           #error EVIOCGNAME() ioctl not available
  1186           #endif
  1187         ],[
  1188         use_input_events=yes
  1189         ])
  1190         AC_MSG_RESULT($use_input_events)
  1191         if test x$use_input_events = xyes; then
  1192             CFLAGS="$CFLAGS -DUSE_INPUT_EVENTS"
  1193         fi
  1194     fi
  1195 }
  1196 
  1197 dnl See if we can use GNU pth library for threads
  1198 CheckPTH()
  1199 {
  1200     dnl Check for pth support
  1201     AC_ARG_ENABLE(pth,
  1202 [  --enable-pth            use GNU pth library for multi-threading [default=yes]],
  1203                   , enable_pth=yes)
  1204     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1205         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1206         if test "$PTH_CONFIG" = "no"; then
  1207             use_pth=no
  1208         else
  1209             PTH_CFLAGS=`$PTH_CONFIG --cflags`
  1210             PTH_LIBS=`$PTH_CONFIG --libs --all`
  1211             SDL_CFLAGS="$SDL_CFLAGS $PTH_CFLAGS"
  1212             SDL_LIBS="$SDL_LIBS $PTH_LIBS"
  1213             CFLAGS="$CFLAGS -DENABLE_PTH"
  1214             use_pth=yes
  1215         fi
  1216         AC_MSG_CHECKING(pth)
  1217         if test "x$use_pth" = xyes; then
  1218             AC_MSG_RESULT(yes)
  1219         else
  1220             AC_MSG_RESULT(no)
  1221         fi
  1222     fi
  1223 }
  1224 
  1225 dnl See what type of thread model to use on Linux and Solaris
  1226 CheckPTHREAD()
  1227 {
  1228     dnl Check for pthread support
  1229     AC_ARG_ENABLE(pthreads,
  1230 [  --enable-pthreads       use POSIX threads for multi-threading [default=yes]],
  1231                   , enable_pthreads=yes)
  1232     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1233     AC_ARG_ENABLE(pthread-sem,
  1234 [  --enable-pthread-sem    use pthread semaphores [default=yes]],
  1235                   , enable_pthread_sem=yes)
  1236     case "$target" in
  1237         *-*-bsdi*)
  1238             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1239             pthread_lib=""
  1240             ;;
  1241         *-*-darwin*)
  1242             pthread_cflags="-D_THREAD_SAFE"
  1243 # causes Carbon.p complaints?
  1244 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1245             ;;
  1246         *-*-freebsd*)
  1247             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1248             pthread_lib="-pthread"
  1249             ;;
  1250         *-*-netbsd*)
  1251             pthread_cflags="-I/usr/pkg/include -D_REENTRANT"
  1252             pthread_lib="-L/usr/pkg/lib -lpthread -lsem"
  1253             ;;
  1254         *-*-openbsd*)
  1255             pthread_cflags="-D_REENTRANT"
  1256             pthread_lib="-pthread"
  1257             ;;
  1258         *-*-solaris*)
  1259             pthread_cflags="-D_REENTRANT"
  1260             pthread_lib="-lpthread -lposix4"
  1261             ;;
  1262         *-*-sysv5*)
  1263             pthread_cflags="-D_REENTRANT -Kthread"
  1264             pthread_lib=""
  1265             ;;
  1266         *-*-irix*)
  1267             pthread_cflags="-D_SGI_MP_SOURCE"
  1268             pthread_lib="-lpthread"
  1269             ;;
  1270         *-*-aix*)
  1271             pthread_cflags="-D_REENTRANT -mthreads"
  1272             pthread_lib="-lpthread"
  1273             ;;
  1274         *-*-hpux11*)
  1275             pthread_cflags="-D_REENTRANT"
  1276             pthread_lib="-L/usr/lib -lpthread"
  1277             ;;
  1278         *-*-qnx*)
  1279             pthread_cflags=""
  1280             pthread_lib=""
  1281             ;;
  1282         *-*-osf*)
  1283             if test x$ac_cv_prog_gcc = xyes; then
  1284                 pthread_cflags="-D_REENTRANT"
  1285                 pthread_lib="-lpthread -lrt"
  1286             else
  1287                 pthread_cflags="-pthread"
  1288                 pthread_lib="-lpthread -lrt"
  1289             fi
  1290             ;;
  1291         *)
  1292             pthread_cflags="-D_REENTRANT"
  1293             pthread_lib="-lpthread"
  1294             ;;
  1295     esac
  1296     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1297         # Save the original compiler flags and libraries
  1298         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1299         # Add the pthread compiler flags and libraries
  1300         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1301         # Check to see if we have pthread support on this system
  1302         AC_MSG_CHECKING(for pthreads)
  1303         use_pthreads=no
  1304         AC_TRY_LINK([
  1305          #include <pthread.h>
  1306         ],[
  1307          pthread_attr_t type;
  1308          pthread_attr_init(&type);
  1309         ],[
  1310         use_pthreads=yes
  1311         ])
  1312         AC_MSG_RESULT($use_pthreads)
  1313         # Restore the compiler flags and libraries
  1314         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1315         # Do futher testing if we have pthread support...
  1316         if test x$use_pthreads = xyes; then
  1317             CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
  1318             LIBS="$LIBS $pthread_lib"
  1319             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1320             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1321 
  1322             # Check to see if recursive mutexes are available
  1323             AC_MSG_CHECKING(for recursive mutexes)
  1324             has_recursive_mutexes=no
  1325             AC_TRY_LINK([
  1326               #include <pthread.h>
  1327             ],[
  1328               pthread_mutexattr_t attr;
  1329               #if defined(linux) && !(defined(__arm__) && defined(QWS))
  1330               pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1331               #else
  1332               pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1333               #endif
  1334             ],[
  1335             has_recursive_mutexes=yes
  1336             ])
  1337             # Some systems have broken recursive mutex implementations
  1338             case "$target" in
  1339                 *-*-darwin*)
  1340                     has_recursive_mutexes=no
  1341                     ;;
  1342                 *-*-solaris*)
  1343                     has_recursive_mutexes=no
  1344                     ;;
  1345             esac
  1346             AC_MSG_RESULT($has_recursive_mutexes)
  1347             if test x$has_recursive_mutexes != xyes; then
  1348                 CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
  1349             fi
  1350 
  1351             # Check to see if pthread semaphore support is missing
  1352             if test x$enable_pthread_sem = xyes; then
  1353                 AC_MSG_CHECKING(for pthread semaphores)
  1354                 have_pthread_sem=no
  1355                 AC_TRY_COMPILE([
  1356                   #include <pthread.h>
  1357                   #include <semaphore.h>
  1358                 ],[
  1359                 ],[
  1360                 have_pthread_sem=yes
  1361                 ])
  1362                 AC_MSG_RESULT($have_pthread_sem)
  1363             fi
  1364 
  1365             # Check to see if this is broken glibc 2.0 pthreads
  1366             case "$target" in
  1367                 *-*-linux*)
  1368                     AC_MSG_CHECKING(for broken glibc 2.0 pthreads)
  1369                     glibc20_pthreads=no
  1370                     AC_TRY_COMPILE([
  1371                       #include <features.h>
  1372                       #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
  1373                       #warning Working around a bug in glibc 2.0 pthreads
  1374                       #else
  1375                       #error pthread implementation okay
  1376                       #endif /* glibc 2.0 */
  1377                     ],[
  1378                     ],[
  1379                     glibc20_pthreads=yes
  1380                     ])
  1381                     AC_MSG_RESULT($glibc20_pthreads)
  1382             esac
  1383         fi
  1384     fi
  1385 
  1386     AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
  1387     have_semun=no
  1388     AC_TRY_COMPILE([
  1389       #include <sys/types.h>
  1390       #include <sys/sem.h>
  1391     ],[
  1392       union semun t;
  1393     ],[
  1394     have_semun=yes
  1395     ])
  1396     AC_MSG_RESULT($have_semun)
  1397     if test x$have_semun = xyes; then
  1398         CFLAGS="$CFLAGS -DHAVE_SEMUN"
  1399     fi
  1400 
  1401     # See if we can use GNU Pth or clone() on Linux directly
  1402     if test x$enable_threads = xyes -a x$use_pthreads != xyes; then
  1403         CheckPTH
  1404         if test x$use_pth != xyes; then
  1405             case "$target" in
  1406                 *-*-linux*)
  1407                     use_clone=yes
  1408                     ;;
  1409             esac
  1410         fi
  1411     fi
  1412 }
  1413 
  1414 # Note that we need to have either semaphores or to have mutexes and
  1415 # condition variables to implement all thread synchronization primitives
  1416 CopyUnixThreadSource()
  1417 {
  1418     if test x$use_pthreads = xyes -o x$use_clone = xyes; then
  1419         # Basic thread creation functions
  1420         COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
  1421         COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
  1422 
  1423         # Semaphores
  1424         # We can fake these with mutexes and condition variables if necessary
  1425         if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
  1426             COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1427         else
  1428             COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  1429         fi
  1430         COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1431 
  1432         # Mutexes
  1433         # We can fake these with semaphores if necessary
  1434         case "$target" in
  1435             *-*-bsdi*)
  1436                 COPY_ARCH_SRC(src/thread, bsdi, SDL_syssem.c)
  1437                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1438                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1439                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1440                 ;;
  1441             *)
  1442                 if test x$glibc20_pthreads = xyes; then
  1443                     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  1444                     COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  1445                 else
  1446                     COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  1447                     COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  1448                 fi
  1449                 ;;
  1450         esac
  1451 
  1452         # Condition variables
  1453         # We can fake these with semaphores and mutexes if necessary
  1454         if test x$glibc20_pthreads = xyes -o x$has_recursive_mutexes != xyes; then
  1455             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  1456         else
  1457             COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
  1458         fi
  1459         COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  1460 
  1461     elif test x$use_pth = xyes; then
  1462         COPY_ARCH_SRC(src/thread, pth, SDL_systhread.c)
  1463         COPY_ARCH_SRC(src/thread, pth, SDL_systhread_c.h)
  1464         COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex.c)
  1465         COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex_c.h)
  1466         COPY_ARCH_SRC(src/thread, pth, SDL_syscond.c)
  1467         COPY_ARCH_SRC(src/thread, pth, SDL_syscond_c.h)
  1468         COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
  1469         COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  1470     else
  1471        AC_MSG_ERROR([
  1472 *** No thread support detected
  1473        ])
  1474     fi
  1475 }
  1476 
  1477 dnl See if we can use sigaction() instead of signal()
  1478 CheckSIGACTION()
  1479 {
  1480     dnl Check for sigaction support
  1481     AC_ARG_ENABLE(sigaction,
  1482 [  --enable-sigaction      use sigaction instead of signal [default=yes]],
  1483                   , enable_sigaction=yes)
  1484     if test x$enable_sigaction = xyes; then
  1485         AC_MSG_CHECKING(sigaction)
  1486         have_sigaction=no
  1487         AC_TRY_COMPILE([
  1488          #include <signal.h>
  1489         ],[
  1490          struct sigaction junk;
  1491          sigaction(0, &junk, &junk);
  1492         ],[
  1493         have_sigaction=yes
  1494         ])
  1495         AC_MSG_RESULT($have_sigaction)
  1496         if test x$have_sigaction = xyes; then
  1497             CFLAGS="$CFLAGS -DHAVE_SIGACTION"
  1498         fi
  1499     fi
  1500 }
  1501 
  1502 dnl Determine whether the compiler can produce Win32 executables
  1503 CheckWIN32()
  1504 {
  1505     AC_MSG_CHECKING(Win32 compiler)
  1506     have_win32_gcc=no
  1507     AC_TRY_COMPILE([
  1508      #include <windows.h>
  1509     ],[
  1510     ],[
  1511     have_win32_gcc=yes
  1512     ])
  1513     AC_MSG_RESULT($have_win32_gcc)
  1514     if test x$have_win32_gcc != xyes; then
  1515        AC_MSG_ERROR([
  1516 *** Your compiler ($CC) does not produce Win32 executables!
  1517        ])
  1518     fi
  1519 
  1520     dnl See if the user wants to redirect standard output to files
  1521     AC_ARG_ENABLE(stdio-redirect,
  1522 [  --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]],
  1523                   , enable_stdio_redirect=yes)
  1524     if test x$enable_stdio_redirect != xyes; then
  1525         CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT"
  1526     fi
  1527 }
  1528 
  1529 dnl Find the DirectX includes and libraries
  1530 CheckDIRECTX()
  1531 {
  1532     AC_ARG_ENABLE(directx,
  1533 [  --enable-directx        use DirectX for Win32 audio/video [default=yes]],
  1534                   , enable_directx=yes)
  1535     if test x$enable_directx = xyes; then
  1536         AC_MSG_CHECKING(for DirectX headers and libraries)
  1537         use_directx=no
  1538         tmp_cflags=$CFLAGS
  1539         CFLAGS="$CFLAGS -I$srcdir"
  1540         AC_TRY_COMPILE([
  1541          #include "src/video/windx5/directx.h"
  1542         ],[
  1543         ],[
  1544         use_directx=yes
  1545         ])
  1546         CFLAGS=$tmp_cflags
  1547         AC_MSG_RESULT($use_directx)
  1548     fi
  1549 
  1550     CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
  1551     SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
  1552     VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
  1553     VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
  1554     # Enable the DIB driver
  1555     CFLAGS="$CFLAGS -DENABLE_WINDIB"
  1556     VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
  1557     VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
  1558     # See if we should enable the DirectX driver
  1559     if test x$use_directx = xyes; then
  1560         CFLAGS="$CFLAGS -DENABLE_DIRECTX"
  1561         SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
  1562         VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
  1563         VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
  1564     fi
  1565 }
  1566 
  1567 dnl Set up the BWindow video driver on BeOS
  1568 CheckBWINDOW()
  1569 {
  1570     CFLAGS="$CFLAGS -DENABLE_BWINDOW"
  1571     VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
  1572     VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
  1573 }
  1574 
  1575 dnl Set up the QTopia video driver if enabled
  1576 CheckQtopia()
  1577 {
  1578     AC_ARG_ENABLE(video-qtopia,
  1579 [  --enable-video-qtopia   use Qtopia video driver [default=no]],
  1580                   , enable_video_qtopia=no)
  1581     if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
  1582         AC_MSG_CHECKING(for Qtopia support)
  1583         video_qtopia=no
  1584         AC_LANG_CPLUSPLUS
  1585         OLD_CXX="$CXXFLAGS"
  1586         CXXFLAGS="-DQT_QWS_EBX -fno-rtti -fno-exceptions -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG"
  1587         AC_TRY_COMPILE([
  1588          #include <qpe/qpeapplication.h>
  1589         ],[
  1590         ],[
  1591         video_qtopia=yes
  1592         ])
  1593         CXXFLAGS="$OLD_CXX"
  1594         AC_MSG_RESULT($video_qtopia)
  1595         if test x$video_qtopia = xyes; then
  1596             CFLAGS="$CFLAGS -DENABLE_QTOPIA -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
  1597             SDL_LIBS="$SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
  1598             SDL_CFLAGS="$SDL_CFLAGS -DQWS"	  
  1599             VIDEO_SUBDIRS="$VIDEO_SUBDIRS qtopia"
  1600             VIDEO_DRIVERS="$VIDEO_DRIVERS qtopia/libvideo_qtopia.la"
  1601         else
  1602 	AC_MSG_ERROR([
  1603 *** Failed to find Qtopia includes. Make sure that the QTDIR and QPEDIR
  1604 *** environment variables are set correctly.])
  1605         fi
  1606         AC_LANG_C
  1607     fi
  1608 }
  1609 
  1610 dnl Set up the PicoGUI video driver if enabled
  1611 CheckPicoGUI()
  1612 {
  1613     AC_ARG_ENABLE(video-picogui,
  1614 [  --enable-video-picogui  use PicoGUI video driver [default=no]],
  1615                   , enable_video_picogui=no)
  1616     if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
  1617         AC_MSG_CHECKING(for PicoGUI support)
  1618         video_picogui=no
  1619         AC_TRY_COMPILE([
  1620          #include <picogui.h>
  1621         ],[
  1622         ],[
  1623         video_picogui=yes
  1624         ])
  1625         AC_MSG_RESULT($video_picogui)
  1626         if test x$video_picogui = xyes; then
  1627 	    SDL_LIBS="$SDL_LIBS -lpgui"
  1628             CFLAGS="$CFLAGS -DENABLE_PICOGUI"
  1629             VIDEO_SUBDIRS="$VIDEO_SUBDIRS picogui"
  1630             VIDEO_DRIVERS="$VIDEO_DRIVERS picogui/libvideo_picogui.la"
  1631         fi
  1632         AC_LANG_C
  1633     fi
  1634 }
  1635 
  1636 dnl Set up the Mac toolbox video driver for Mac OS 7-9
  1637 CheckTOOLBOX()
  1638 {
  1639     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
  1640     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
  1641     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
  1642     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
  1643 }
  1644 
  1645 dnl Set up the Mac toolbox video driver for Mac OS X
  1646 CheckCARBON()
  1647 {
  1648     # "MACOSX" is not an official definition, but it's commonly
  1649     # accepted as a way to differentiate between what runs on X
  1650     # and what runs on older Macs - while in theory "Carbon" defns
  1651     # are consistent between the two, in practice Carbon is still
  1652     # changing. -sts Aug 2000
  1653     mac_autoconf_target_workaround="MAC"
  1654     CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
  1655       -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"
  1656     VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
  1657     VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
  1658     VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
  1659     VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
  1660 }
  1661 
  1662 dnl Set up the Mac toolbox video driver for Mac OS X
  1663 CheckQUARTZ()
  1664 {
  1665     # "MACOSX" is not an official definition, but it's commonly
  1666     # accepted as a way to differentiate between what runs on X
  1667     # and what runs on older Macs - while in theory "Carbon" defns
  1668     # are consistent between the two, in practice Carbon is still
  1669     # changing. -sts Aug 2000
  1670     mac_autoconf_target_workaround="MAC"
  1671     CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
  1672       -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
  1673       -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
  1674     VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
  1675     VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
  1676 }
  1677 
  1678 dnl Check for the dlfcn.h interface for dynamically loading objects
  1679 CheckDLOPEN()
  1680 {
  1681     AC_ARG_ENABLE(sdl-dlopen,
  1682 [  --enable-sdl-dlopen     use dlopen for shared object loading [default=yes]],
  1683                   , enable_sdl_dlopen=yes)
  1684     if test x$enable_sdl_dlopen = xyes; then
  1685         AC_MSG_CHECKING(for dlopen)
  1686         use_dlopen=no
  1687         AC_TRY_COMPILE([
  1688          #include <dlfcn.h>
  1689         ],[
  1690         ],[
  1691         use_dlopen=yes
  1692         ])
  1693         AC_MSG_RESULT($use_dlopen)
  1694 
  1695         if test x$use_dlopen = xyes; then
  1696             CFLAGS="$CFLAGS -DUSE_DLOPEN"
  1697             AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS",
  1698                AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl",
  1699                   AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl")))
  1700         fi
  1701     fi
  1702 }
  1703 
  1704 dnl Set up the Atari LDG (shared object loader)
  1705 CheckAtariLdg()
  1706 {
  1707     AC_ARG_ENABLE(atari-ldg,
  1708 [  --enable-atari-ldg      use Atari LDG for shared object loading [default=yes]],
  1709                   , enable_atari_ldg=yes)
  1710     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1711         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1712         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1713         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1714             CFLAGS="$CFLAGS -DENABLE_LDG"
  1715             SYSTEM_LIBS="$SYSTEM_LIBS -lldg -lgem"
  1716         fi
  1717     fi
  1718 }
  1719 
  1720 dnl Check for the usbhid(3) library on *BSD
  1721 CheckUSBHID()
  1722 {
  1723     if test x$enable_joystick = xyes; then
  1724         have_libusbhid=no
  1725         have_libusb=no
  1726         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1727         AC_CHECK_LIB(usb, hid_init, have_libusb=yes)
  1728         if test x$have_libusbhid = xyes; then
  1729             SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
  1730         fi
  1731         if test x$have_libusb = xyes; then
  1732             SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
  1733         fi
  1734 
  1735         AC_CHECK_HEADER(usb.h, have_usb_h=yes)
  1736         AC_CHECK_HEADER(usbhid.h, have_usbhid_h=yes)
  1737         AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
  1738         AC_CHECK_HEADER(libusbhid.h, have_libusbhid_h=yes)
  1739         if test x$have_usb_h = xyes; then
  1740             CFLAGS="$CFLAGS -DHAVE_USB_H"
  1741         fi
  1742         if test x$have_usbhid_h = xyes; then
  1743             CFLAGS="$CFLAGS -DHAVE_USBHID_H"
  1744         fi
  1745         if test x$have_libusb_h = xyes; then
  1746             CFLAGS="$CFLAGS -DHAVE_LIBUSB_H"
  1747         fi
  1748         if test x$have_libusbhid_h = xyes; then
  1749             CFLAGS="$CFLAGS -DHAVE_LIBUSBHID_H"
  1750         fi
  1751 
  1752         AC_MSG_CHECKING(for usbhid)
  1753         have_usbhid=no
  1754         AC_TRY_COMPILE([
  1755           #include <sys/types.h>
  1756           #if defined(HAVE_USB_H)
  1757           #include <usb.h>
  1758           #endif
  1759           #include <dev/usb/usb.h>
  1760           #include <dev/usb/usbhid.h>
  1761           #if defined(HAVE_USBHID_H)
  1762           #include <usbhid.h>
  1763           #elif defined(HAVE_LIBUSB_H)
  1764           #include <libusb.h>
  1765           #elif defined(HAVE_LIBUSBHID_H)
  1766           #include <libusbhid.h>
  1767           #endif
  1768         ],[
  1769           struct report_desc *repdesc;
  1770           struct usb_ctl_report *repbuf;
  1771           hid_kind_t hidkind;
  1772         ],[
  1773         have_usbhid=yes
  1774         ])
  1775         AC_MSG_RESULT($have_usbhid)
  1776 
  1777         if test x$have_usbhid = xyes; then
  1778             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1779             have_usbhid_ucr_data=no
  1780             AC_TRY_COMPILE([
  1781               #include <sys/types.h>
  1782               #if defined(HAVE_USB_H)
  1783               #include <usb.h>
  1784               #endif
  1785               #include <dev/usb/usb.h>
  1786               #include <dev/usb/usbhid.h>
  1787               #if defined(HAVE_USBHID_H)
  1788               #include <usbhid.h>
  1789               #elif defined(HAVE_LIBUSB_H)
  1790               #include <libusb.h>
  1791               #elif defined(HAVE_LIBUSBHID_H)
  1792               #include <libusbhid.h>
  1793               #endif
  1794             ],[
  1795               struct usb_ctl_report buf;
  1796               if (buf.ucr_data) { }
  1797             ],[
  1798             have_usbhid_ucr_data=yes
  1799             ])
  1800             if test x$have_usbhid_ucr_data = xyes; then
  1801                 CFLAGS="$CFLAGS -DUSBHID_UCR_DATA"
  1802             fi
  1803             AC_MSG_RESULT($have_usbhid_ucr_data)
  1804             
  1805 	    AC_MSG_CHECKING(for new usbhid API)
  1806             have_usbhid_new=no
  1807             AC_TRY_COMPILE([
  1808               #include <sys/types.h>
  1809               #if defined(HAVE_USB_H)
  1810               #include <usb.h>
  1811               #endif
  1812               #include <dev/usb/usb.h>
  1813               #include <dev/usb/usbhid.h>
  1814               #if defined(HAVE_USBHID_H)
  1815               #include <usbhid.h>
  1816               #elif defined(HAVE_LIBUSB_H)
  1817               #include <libusb.h>
  1818               #elif defined(HAVE_LIBUSBHID_H)
  1819               #include <libusbhid.h>
  1820               #endif
  1821             ],[
  1822               report_desc_t d;
  1823 	      hid_start_parse(d, 1, 1);
  1824             ],[
  1825             have_usbhid_new=yes
  1826             ])
  1827             if test x$have_usbhid_new = xyes; then
  1828                 CFLAGS="$CFLAGS -DUSBHID_NEW"
  1829             fi
  1830             AC_MSG_RESULT($have_usbhid_new)
  1831 
  1832             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
  1833             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
  1834         fi
  1835     fi
  1836 }
  1837 
  1838 dnl Check for altivec instruction support using gas syntax
  1839 CheckAltivec()
  1840 {
  1841     AC_MSG_CHECKING(for GCC Altivec instruction support)
  1842     have_gcc_altivec=no
  1843     AC_TRY_COMPILE([
  1844     ],[
  1845         asm volatile ("mtspr 256, %0\n\t"
  1846                       "vand %%v0, %%v0, %%v0"
  1847                       :
  1848                       : "r" (-1));
  1849     ],[
  1850     have_gcc_altivec=yes
  1851     ])
  1852     if test x$have_gcc_altivec = xyes; then
  1853         CFLAGS="$CFLAGS -DGCC_ALTIVEC"
  1854     fi
  1855     AC_MSG_RESULT($have_gcc_altivec)
  1856 }
  1857 
  1858 case "$target" in
  1859     *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu)
  1860         case "$target" in
  1861           *-*-linux*) ARCH=linux ;;
  1862           *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
  1863           *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
  1864           *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
  1865           *-*-gnu*) ARCH=gnu ;; # must be last
  1866         esac
  1867         CheckDummyVideo
  1868         CheckDiskAudio
  1869         CheckDLOPEN
  1870         CheckNASM
  1871         CheckOSS
  1872         CheckALSA
  1873         CheckARTSC
  1874         CheckESD
  1875         CheckNAS
  1876         CheckX11
  1877         CheckNANOX
  1878         CheckDGA
  1879         CheckFBCON
  1880         CheckDirectFB
  1881         CheckPS2GS
  1882         CheckGGI
  1883         CheckSVGA
  1884         CheckAAlib
  1885         CheckQtopia
  1886         CheckPicoGUI
  1887         CheckOpenGL
  1888         CheckInputEvents
  1889         CheckPTHREAD
  1890         CheckSIGACTION
  1891         CheckAltivec
  1892         # Set up files for the main() stub
  1893         if test "x$video_qtopia" = "xyes"; then
  1894           SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  1895           SDL_LIBS="-lSDLmain $SDL_LIBS"
  1896         fi
  1897         # Set up files for the audio library
  1898         # We use the OSS and ALSA API's, not the Sun audio API
  1899         #if test x$enable_audio = xyes; then
  1900         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1901         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1902         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1903         #fi
  1904         # Set up files for the joystick library
  1905         if test x$enable_joystick = xyes; then
  1906 	  case $ARCH in
  1907 	    linux)
  1908               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
  1909               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
  1910 	    ;;
  1911 	    gnu)
  1912               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1913               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1914 	    ;;
  1915 	    k*bsd-gnu)
  1916               JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
  1917               JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
  1918 	    ;;
  1919 	  esac
  1920         fi
  1921         # Set up files for the cdrom library
  1922         if test x$enable_cdrom = xyes; then
  1923 	  case $ARCH in
  1924 	    linux)
  1925               CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
  1926               CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
  1927 	    ;;
  1928 	    gnu)
  1929               CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  1930               CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  1931 	    ;;
  1932 	    kfreebsd-gnu)
  1933               CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
  1934               CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
  1935 	    ;;
  1936 	    knetbsd-gnu|kopenbsd-gnu)
  1937               CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  1938               CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  1939 	    ;;
  1940 	  esac
  1941         fi
  1942         # Set up files for the thread library
  1943         if test x$enable_threads = xyes; then
  1944             CopyUnixThreadSource
  1945         fi
  1946         # Set up files for the timer library
  1947         if test x$enable_timers = xyes; then
  1948             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1949         fi
  1950         ;;
  1951     *-*-bsdi*)
  1952         ARCH=bsdi
  1953         CheckDummyVideo
  1954         CheckDiskAudio
  1955         CheckDLOPEN
  1956         CheckNASM
  1957         CheckOSS
  1958         CheckARTSC
  1959         CheckESD
  1960         CheckNAS
  1961         CheckX11
  1962         CheckDGA
  1963         CheckSVGA
  1964         CheckAAlib
  1965         CheckOpenGL
  1966         CheckPTHREAD
  1967         CheckSIGACTION
  1968         # Set up files for the audio library
  1969         # We use the OSS and ALSA API's, not the Sun audio API
  1970         #if test x$enable_audio = xyes; then
  1971         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  1972         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  1973         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  1974         #fi
  1975         # Set up files for the joystick library
  1976         # (No joystick support yet)
  1977         if test x$enable_joystick = xyes; then
  1978             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  1979             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  1980         fi
  1981         # Set up files for the cdrom library
  1982         if test x$enable_cdrom = xyes; then
  1983             CDROM_SUBDIRS="$CDROM_SUBDIRS bsdi"
  1984             CDROM_DRIVERS="$CDROM_DRIVERS bsdi/libcdrom_bsdi.la"
  1985         fi
  1986         # Set up files for the thread library
  1987         if test x$enable_threads = xyes; then
  1988             CopyUnixThreadSource
  1989         fi
  1990         # Set up files for the timer library
  1991         if test x$enable_timers = xyes; then
  1992             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  1993         fi
  1994         ;;
  1995     *-*-freebsd*)
  1996         ARCH=freebsd
  1997         CheckDummyVideo
  1998         CheckDiskAudio
  1999         CheckDLOPEN
  2000         CheckVGL
  2001         CheckNASM
  2002         CheckOSS
  2003         CheckARTSC
  2004         CheckESD
  2005         CheckNAS
  2006         CheckX11
  2007         CheckDGA
  2008         CheckSVGA
  2009         CheckAAlib
  2010         CheckOpenGL
  2011         CheckPTHREAD
  2012         CheckSIGACTION
  2013         CheckUSBHID
  2014         # Set up files for the audio library
  2015         # We use the OSS and ALSA API's, not the Sun audio API
  2016         #if test x$enable_audio = xyes; then
  2017         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2018         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2019         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2020         #fi
  2021         # Set up files for the cdrom library
  2022         if test x$enable_cdrom = xyes; then
  2023             CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
  2024             CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
  2025         fi
  2026         # Set up files for the thread library
  2027         if test x$enable_threads = xyes; then
  2028             CopyUnixThreadSource
  2029         fi
  2030         # Set up files for the timer library
  2031         if test x$enable_timers = xyes; then
  2032             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2033         fi
  2034         ;;
  2035     *-*-netbsd*)
  2036         ARCH=netbsd
  2037         CheckDummyVideo
  2038         CheckDiskAudio
  2039         CheckDLOPEN
  2040         CheckNASM
  2041         CheckOSS
  2042         CheckARTSC
  2043         CheckESD
  2044         CheckNAS
  2045         CheckX11
  2046         CheckAAlib
  2047         CheckOpenGL
  2048         CheckPTHREAD
  2049         CheckSIGACTION
  2050         CheckUSBHID
  2051         # Set up files for the audio library
  2052         if test x$enable_audio = xyes; then
  2053             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2054             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2055             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2056         fi
  2057         # Set up files for the cdrom library
  2058         if test x$enable_cdrom = xyes; then
  2059             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  2060             CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  2061         fi
  2062         # Set up files for the thread library
  2063         if test x$enable_threads = xyes; then
  2064             if test x$use_pthreads = xyes; then
  2065                 CFLAGS="$CFLAGS -D_POSIX_THREAD_SYSCALL_SOFT=1"
  2066             fi
  2067             CopyUnixThreadSource
  2068         fi
  2069         # Set up files for the timer library
  2070         if test x$enable_timers = xyes; then
  2071             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2072         fi
  2073         # NetBSD does not define "unix"
  2074         CFLAGS="$CFLAGS -Dunix"
  2075         ;;
  2076     *-*-openbsd*)
  2077         ARCH=openbsd
  2078         CheckDummyVideo
  2079         CheckDiskAudio
  2080         CheckDLOPEN
  2081         CheckNASM
  2082         CheckOSS
  2083         CheckARTSC
  2084         CheckESD
  2085         CheckNAS
  2086         CheckX11
  2087         CheckAAlib
  2088         CheckOpenGL
  2089         CheckPTHREAD
  2090         CheckSIGACTION
  2091         CheckUSBHID
  2092         # Set up files for the audio library
  2093         if test x$enable_audio = xyes; then
  2094             CFLAGS="$CFLAGS -DOPENBSD_AUDIO_SUPPORT"
  2095             AUDIO_SUBDIRS="$AUDIO_SUBDIRS openbsd"
  2096             AUDIO_DRIVERS="$AUDIO_DRIVERS openbsd/libaudio_openbsd.la"
  2097         fi
  2098         # OpenBSD needs linking with ossaudio emulation library
  2099         if test x$have_oss = xyes; then
  2100             SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio"
  2101         fi
  2102         # Set up files for the cdrom library
  2103         if test x$enable_cdrom = xyes; then
  2104             CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
  2105             CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
  2106         fi
  2107         # Set up files for the thread library
  2108         if test x$enable_threads = xyes; then
  2109             CopyUnixThreadSource
  2110         fi
  2111         # Set up files for the timer library
  2112         if test x$enable_timers = xyes; then
  2113             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2114         fi
  2115         # OpenBSD does not define "unix"
  2116         CFLAGS="$CFLAGS -Dunix"
  2117         ;;
  2118     *-*-sysv5*)
  2119         ARCH=sysv5
  2120         CheckDummyVideo
  2121         CheckDiskAudio
  2122         CheckDLOPEN
  2123         CheckNASM
  2124         CheckOSS
  2125         CheckARTSC
  2126         CheckESD
  2127         CheckNAS
  2128         CheckX11
  2129         CheckAAlib
  2130         CheckOpenGL
  2131         CheckPTHREAD
  2132         CheckSIGACTION
  2133         # Set up files for the audio library
  2134         if test x$enable_audio = xyes; then
  2135             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2136             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2137             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2138         fi
  2139         # Set up files for the joystick library
  2140         # (No joystick support yet)
  2141         if test x$enable_joystick = xyes; then
  2142             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2143             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2144         fi
  2145         # Set up files for the cdrom library
  2146         if test x$enable_cdrom = xyes; then
  2147             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2148             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2149         fi
  2150         # Set up files for the thread library
  2151         if test x$enable_threads = xyes; then
  2152             CopyUnixThreadSource
  2153         fi
  2154         # Set up files for the timer library
  2155         if test x$enable_timers = xyes; then
  2156             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2157         fi
  2158         ;;
  2159     *-*-solaris*)
  2160         ARCH=solaris
  2161         CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
  2162         CheckDummyVideo
  2163         CheckDiskAudio
  2164         CheckDLOPEN
  2165         CheckNASM
  2166         CheckOSS
  2167         CheckARTSC
  2168         CheckESD
  2169         CheckNAS
  2170         CheckX11
  2171         CheckAAlib
  2172         CheckOpenGL
  2173         CheckPTHREAD
  2174         CheckSIGACTION
  2175         # Set up files for the audio library
  2176         if test x$enable_audio = xyes; then
  2177             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2178             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2179             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2180         fi
  2181         # Set up files for the joystick library
  2182         # (No joystick support yet)
  2183         if test x$enable_joystick = xyes; then
  2184             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2185             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2186         fi
  2187         # Set up files for the cdrom library
  2188         if test x$enable_cdrom = xyes; then
  2189             CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
  2190             CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
  2191         fi
  2192         # Set up files for the thread library
  2193         if test x$enable_threads = xyes; then
  2194             CopyUnixThreadSource
  2195         fi
  2196         # Set up files for the timer library
  2197         if test x$enable_timers = xyes; then
  2198             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2199         fi
  2200         ;;
  2201     *-*-irix*)
  2202         ARCH=irix
  2203         CheckDummyVideo
  2204         CheckDiskAudio
  2205         CheckDLOPEN
  2206         CheckDMEDIA
  2207         CheckESD
  2208         CheckNAS
  2209         CheckX11
  2210         CheckAAlib
  2211         CheckOpenGL
  2212         CheckPTHREAD
  2213         CheckSIGACTION
  2214         # We use the dmedia audio API, not the Sun audio API
  2215         #if test x$enable_audio = xyes; then
  2216         #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2217         #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2218         #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2219         #fi
  2220         # Set up files for the joystick library
  2221         # (No joystick support yet)
  2222         if test x$enable_joystick = xyes; then
  2223             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2224             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2225         fi
  2226         # Set up files for the cdrom library
  2227         # (No CD-ROM support yet)
  2228         if test x$enable_cdrom = xyes; then
  2229             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2230             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2231         fi
  2232         # Set up files for the thread library
  2233         if test x$enable_threads = xyes; then
  2234             if test x$use_pthreads = xyes -o x$use_pth = xyes; then
  2235                 CopyUnixThreadSource
  2236             else
  2237                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
  2238                 COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
  2239                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
  2240                 COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
  2241                 COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
  2242                 COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2243                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2244                 COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2245             fi
  2246         fi
  2247         # Set up files for the timer library
  2248         if test x$enable_timers = xyes; then
  2249             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2250         fi
  2251         ;;
  2252     *-*-hpux*)
  2253         ARCH=hpux
  2254         CheckDummyVideo
  2255         CheckDiskAudio
  2256         CheckDLOPEN
  2257         CheckOSS
  2258         CheckNAS
  2259         CheckX11
  2260         CheckGGI
  2261         CheckAAlib
  2262         CheckOpenGL
  2263         CheckPTHREAD
  2264         CheckSIGACTION
  2265         # Set up files for the audio library
  2266         if test x$enable_audio = xyes; then
  2267             CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2268             AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2269             AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2270         fi
  2271         # Set up files for the joystick library
  2272         # (No joystick support yet)
  2273         if test x$enable_joystick = xyes; then
  2274             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2275             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2276         fi
  2277         # Set up files for the cdrom library
  2278         # (No CD-ROM support yet)
  2279         if test x$enable_cdrom = xyes; then
  2280             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2281             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2282         fi
  2283         # Set up files for the thread library
  2284         if test x$enable_threads = xyes; then
  2285             CopyUnixThreadSource
  2286         fi
  2287         # Set up files for the timer library
  2288         if test x$enable_timers = xyes; then
  2289             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2290         fi
  2291         ;;
  2292     *-*-aix*)
  2293         ARCH=aix
  2294         CheckDummyVideo
  2295         CheckDiskAudio
  2296         CheckDLOPEN
  2297         CheckOSS
  2298         CheckNAS
  2299         CheckX11
  2300         CheckGGI
  2301         CheckAAlib
  2302         CheckOpenGL
  2303         CheckPTHREAD
  2304         CheckSIGACTION
  2305         # Set up files for the audio library
  2306         if test x$enable_audio = xyes; then
  2307             AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
  2308             AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la"
  2309         fi
  2310         # Set up files for the joystick library
  2311         # (No joystick support yet)
  2312         if test x$enable_joystick = xyes; then
  2313             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2314             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2315         fi
  2316         # Set up files for the cdrom library
  2317         if test x$enable_cdrom = xyes; then
  2318             CDROM_SUBDIRS="$CDROM_SUBDIRS aix"
  2319             CDROM_DRIVERS="$CDROM_DRIVERS aix/libcdrom_aix.la"
  2320         fi
  2321         # Set up files for the thread library
  2322         if test x$enable_threads = xyes; then
  2323             CopyUnixThreadSource
  2324         fi
  2325         # Set up files for the timer library
  2326         if test x$enable_timers = xyes; then
  2327             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2328         fi
  2329         ;;
  2330     *-*-osf*)
  2331         ARCH=osf
  2332         CheckDummyVideo
  2333         CheckDiskAudio
  2334         CheckDLOPEN
  2335         CheckNAS
  2336         CheckX11
  2337         CheckGGI
  2338         CheckAAlib
  2339         CheckOpenGL
  2340         CheckPTHREAD
  2341         CheckSIGACTION
  2342         # Set up files for the audio library
  2343         if test x$enable_audio = xyes; then
  2344             CFLAGS="$CFLAGS -I/usr/include/mme -DMMEAUDIO_SUPPORT"
  2345             SYSTEM_LIBS="$SYSTEM_LIBS -lmme"
  2346             AUDIO_SUBDIRS="$AUDIO_SUBDIRS mme"
  2347             AUDIO_DRIVERS="$AUDIO_DRIVERS mme/libaudio_mme.la"
  2348         fi
  2349         # Set up files for the joystick library
  2350         # (No joystick support yet)
  2351         if test x$enable_joystick = xyes; then
  2352             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2353             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2354         fi
  2355         # Set up files for the cdrom library
  2356         # (No cdrom support yet)
  2357         if test x$enable_cdrom = xyes; then
  2358             CDROM_SUBDIRS="$CDROM_SUBDIRS osf"
  2359             CDROM_DRIVERS="$CDROM_DRIVERS osf/libcdrom_osf.la"
  2360         fi
  2361         # Set up files for the thread library
  2362         if test x$enable_threads = xyes; then
  2363             CopyUnixThreadSource
  2364         fi
  2365         # Set up files for the timer library
  2366         if test x$enable_timers = xyes; then
  2367             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2368         fi
  2369         ;;
  2370     *-*-qnx*)
  2371         ARCH=qnx
  2372         CheckDummyVideo
  2373         CheckDiskAudio
  2374         # CheckNASM
  2375         CheckDLOPEN
  2376         CheckNAS
  2377         CheckPHOTON
  2378         CheckX11
  2379         CheckOpenGL
  2380         CheckPTHREAD
  2381         CheckSIGACTION
  2382         # Set up files for the audio library
  2383         if test x$enable_audio = xyes; then
  2384             CFLAGS="$CFLAGS -DQNXNTOAUDIO_SUPPORT"
  2385             SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
  2386             AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto"
  2387             AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la"
  2388         fi
  2389         # Set up files for the joystick library
  2390         if test x$enable_joystick = xyes; then
  2391         # (No joystick support yet)
  2392             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
  2393             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
  2394         fi
  2395         # Set up files for the cdrom library
  2396         if test x$enable_cdrom = xyes; then
  2397             CDROM_SUBDIRS="$CDROM_SUBDIRS qnx"
  2398             CDROM_DRIVERS="$CDROM_DRIVERS qnx/libcdrom_qnx.la"
  2399         fi
  2400         # Set up files for the thread library
  2401         if test x$enable_threads = xyes; then
  2402             CopyUnixThreadSource
  2403         fi
  2404         # Set up files for the timer library
  2405         if test x$enable_timers = xyes; then
  2406             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2407         fi
  2408         ;;
  2409     *-*-cygwin* | *-*-mingw32*)
  2410         ARCH=win32
  2411         if test "$build" != "$target"; then # cross-compiling
  2412             # Default cross-compile location
  2413             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2414         else
  2415             # Look for the location of the tools and install there
  2416             if test "$BUILD_PREFIX" != ""; then
  2417                 ac_default_prefix=$BUILD_PREFIX
  2418             fi
  2419         fi
  2420         CheckDummyVideo
  2421         CheckDiskAudio
  2422         CheckWIN32
  2423         CheckDIRECTX
  2424         CheckNASM
  2425         # Set up files for the audio library
  2426         if test x$enable_audio = xyes; then
  2427             AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
  2428             AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la"
  2429             if test x$use_directx = xyes; then
  2430                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5"
  2431                 AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la"
  2432             fi
  2433         fi
  2434         # Set up files for the joystick library
  2435         if test x$enable_joystick = xyes; then
  2436             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32"
  2437             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la"
  2438         fi
  2439         # Set up files for the cdrom library
  2440         if test x$enable_cdrom = xyes; then
  2441             CDROM_SUBDIRS="$CDROM_SUBDIRS win32"
  2442             CDROM_DRIVERS="$CDROM_DRIVERS win32/libcdrom_win32.la"
  2443         fi
  2444         # Set up files for the thread library
  2445         if test x$enable_threads = xyes; then
  2446             COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
  2447             COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
  2448             COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c)
  2449             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2450             COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c)
  2451             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2452             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2453             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2454         fi
  2455         # Set up files for the timer library
  2456         if test x$enable_timers = xyes; then
  2457             COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c)
  2458         fi
  2459         # The Win32 platform requires special setup
  2460         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2461         case "$target" in
  2462             *-*-cygwin*)
  2463                 CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
  2464                 SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
  2465                 LIBS="$LIBS -mno-cygwin"
  2466                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
  2467                 ;;
  2468             *-*-mingw32*)
  2469                 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2470                 ;;
  2471         esac
  2472         ;;
  2473     *-*-beos*)
  2474         ARCH=beos
  2475         ac_default_prefix=/boot/develop/tools/gnupro
  2476         CheckDummyVideo
  2477         CheckDiskAudio
  2478         CheckNASM
  2479         CheckBWINDOW
  2480         CheckBeGL
  2481         # Set up files for the audio library
  2482         if test x$enable_audio = xyes; then
  2483             AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
  2484             AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la"
  2485         fi
  2486         # Set up files for the joystick library
  2487         if test x$enable_joystick = xyes; then
  2488             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos"
  2489             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la"
  2490         fi
  2491         # Set up files for the cdrom library
  2492         if test x$enable_cdrom = xyes; then
  2493             CDROM_SUBDIRS="$CDROM_SUBDIRS beos"
  2494             CDROM_DRIVERS="$CDROM_DRIVERS beos/libcdrom_beos.la"
  2495         fi
  2496         # Set up files for the thread library
  2497         if test x$enable_threads = xyes; then
  2498             COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
  2499             COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
  2500             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  2501             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2502             COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c)
  2503             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2504             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2505             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2506         fi
  2507         # Set up files for the timer library
  2508         if test x$enable_timers = xyes; then
  2509             COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c)
  2510         fi
  2511         # The BeOS platform requires special libraries
  2512         SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2513         ;;
  2514     *-*-macos*)
  2515         # This would be used if cross-compiling to MacOS 9.  No way to
  2516         # use it at present, but Apple is working on a X-to-9 compiler
  2517         # for which this case would be handy.
  2518         ARCH=macos
  2519         CheckDummyVideo
  2520         CheckDiskAudio
  2521         CheckTOOLBOX
  2522         CheckMacGL
  2523         # Set up files for the audio library
  2524         if test x$enable_audio = xyes; then
  2525             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  2526             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  2527         fi
  2528         # Set up files for the joystick library
  2529         if test x$enable_joystick = xyes; then
  2530             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos"
  2531             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la"
  2532         fi
  2533         # Set up files for the cdrom library
  2534         if test x$enable_cdrom = xyes; then
  2535             CDROM_SUBDIRS="$CDROM_SUBDIRS macos"
  2536             CDROM_DRIVERS="$CDROM_DRIVERS macos/libcdrom_macos.la"
  2537         fi
  2538         # Set up files for the thread library
  2539         if test x$enable_threads = xyes; then
  2540             COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
  2541             COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
  2542             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
  2543             COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
  2544             COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c)
  2545             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2546             COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
  2547             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2548         fi
  2549         # Set up files for the timer library
  2550         if test x$enable_timers = xyes; then
  2551             COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c)
  2552         fi
  2553         # The MacOS platform requires special setup
  2554         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2555         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2556         ;;
  2557     *-*-darwin* )
  2558         # Strictly speaking, we want "Mac OS X", not "Darwin", which is
  2559         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2560         # But config.guess comes back with "darwin", so go with the flow.
  2561         ARCH=macosx
  2562         CheckDummyVideo
  2563         CheckDiskAudio
  2564         CheckQUARTZ
  2565         CheckMacGL
  2566         CheckPTHREAD
  2567         CheckSIGACTION
  2568         # If either the audio or CD driver is used, add the AudioUnit framework
  2569         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2570             SYSTEM_LIBS="$SYSTEM_LIBS -framework AudioToolbox -framework AudioUnit"
  2571         fi
  2572         # Set up files for the audio library
  2573         if test x$enable_audio = xyes; then
  2574             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macosx"
  2575             AUDIO_DRIVERS="$AUDIO_DRIVERS macosx/libaudio_macosx.la"
  2576             AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
  2577             AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
  2578         fi
  2579         # Set up files for the joystick library
  2580         if test x$enable_joystick = xyes; then
  2581             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin"
  2582             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la"
  2583             SYSTEM_LIBS="$SYSTEM_LIBS -framework IOKit"
  2584         fi
  2585         # Set up files for the cdrom library
  2586         if test x$enable_cdrom = xyes; then
  2587             CDROM_SUBDIRS="$CDROM_SUBDIRS macosx"
  2588             CDROM_DRIVERS="$CDROM_DRIVERS macosx/libcdrom_macosx.la"
  2589             SYSTEM_LIBS="$SYSTEM_LIBS -lstdc++"
  2590         fi
  2591         # Set up files for the thread library
  2592         if test x$enable_threads = xyes; then
  2593             CopyUnixThreadSource
  2594         fi
  2595         # Set up files for the timer library
  2596         if test x$enable_timers = xyes; then
  2597             COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2598         fi
  2599         # The MacOS X platform requires special setup.
  2600         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2601         # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2602         SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa -framework Carbon -framework QuickTime"
  2603         ;;
  2604     *-*-mint*)
  2605         ARCH=mint
  2606         CheckDummyVideo
  2607         CheckDiskAudio
  2608         CheckAtariBiosEvent
  2609         CheckAtariXbiosVideo
  2610         CheckAtariGemVideo
  2611         CheckAtariAudio
  2612         CheckAtariLdg
  2613 		CheckAtariOSMesa
  2614         CheckPTH
  2615         # Set up files for the audio library
  2616         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2617             if test x$enable_audio = xyes; then
  2618                 CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
  2619                 AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
  2620                 AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
  2621             fi
  2622         fi
  2623         # Set up files for the joystick library
  2624         if test x$enable_joystick = xyes; then
  2625             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS mint"
  2626             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS mint/libjoystick_mint.la"
  2627         fi
  2628         # Set up files for the cdrom library
  2629         if test x$enable_cdrom = xyes; then
  2630             CDROM_SUBDIRS="$CDROM_SUBDIRS mint"
  2631             CDROM_DRIVERS="$CDROM_DRIVERS mint/libcdrom_mint.la"
  2632         fi
  2633         # Set up files for the thread library
  2634         if test x$enable_threads = xyes; then
  2635             CopyUnixThreadSource
  2636         fi
  2637         # Set up files for the timer library
  2638         if test x$enable_timers = xyes; then
  2639             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2640                 COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
  2641             else
  2642                 COPY_ARCH_SRC(src/timer, mint, SDL_systimer.c)
  2643             fi
  2644         fi
  2645         # MiNT does not define "unix"
  2646         CFLAGS="$CFLAGS -Dunix"
  2647         ;;
  2648     *-*-riscos)
  2649         ARCH=riscos
  2650         # Set up files for the video library
  2651         if test x$enable_video = xyes; then
  2652             VIDEO_SUBDIRS="$VIDEO_SUBDIRS riscos"
  2653             VIDEO_DRIVERS="$VIDEO_DRIVERS riscos/libvideo_riscos.la"
  2654         fi
  2655         # Set up files for the audio library
  2656         if test x$enable_audio = xyes; then
  2657             AUDIO_SUBDIRS="$AUDIO_SUBDIRS riscos"
  2658             AUDIO_DRIVERS="$AUDIO_DRIVERS riscos/libaudio_riscos.la"
  2659         fi
  2660         # Set up files for the joystick library
  2661         if test x$enable_joystick = xyes; then
  2662             JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS riscos"
  2663             JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS riscos/libjoystick_riscos.la"
  2664         fi
  2665         # Set up files for the cdrom library
  2666         if test x$enable_cdrom = xyes; then
  2667             CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
  2668             CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
  2669         fi
  2670         # Set up files for the thread library
  2671         if test x$enable_threads = xyes; then
  2672             COPY_ARCH_SRC(src/thread, riscos, SDL_systhread.c)
  2673             COPY_ARCH_SRC(src/thread, riscos, SDL_systhread_c.h)
  2674             COPY_ARCH_SRC(src/thread, riscos, SDL_sysmutex.c)
  2675             COPY_ARCH_SRC(src/thread, riscos, SDL_sysmutex_c.h)
  2676             COPY_ARCH_SRC(src/thread, riscos, SDL_syssem.c)
  2677             COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
  2678             COPY_ARCH_SRC(src/thread, riscos, SDL_syscond.c)
  2679             COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
  2680         else
  2681             CFLAGS="$CFLAGS -DDISABLE_THREADS"
  2682         fi
  2683         # Set up files for the timer library
  2684         if test x$enable_timers = xyes; then
  2685             COPY_ARCH_SRC(src/timer, riscos, SDL_systimer.c)
  2686         fi
  2687 
  2688         CFLAGS="$CFLAGS -DENABLE_RISCOS -DDRENDERER_SUPPORT"
  2689 
  2690         SYSTEM_LIBS="$SYSTEM_LIBS -ljpeg -ltiff -lpng -lz"
  2691         ;;
  2692     *)
  2693         AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
  2694         ;;
  2695 esac
  2696 AC_SUBST(ARCH)
  2697 
  2698 # Set the conditional variables for this target
  2699 AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
  2700 AM_CONDITIONAL(TARGET_QTOPIA, test "x$video_qtopia" = "xyes")
  2701 AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
  2702 AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
  2703 AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
  2704 AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
  2705 AM_CONDITIONAL(TARGET_NETBSD, test $ARCH = netbsd)
  2706 AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd)
  2707 AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix)
  2708 AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
  2709 AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
  2710 AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
  2711 AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
  2712 AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
  2713 AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)
  2714 
  2715 # More automake conditionals
  2716 AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
  2717 AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
  2718 AM_CONDITIONAL(HAVE_NASM, test x$use_nasm = xyes)
  2719 
  2720 # Set conditional variables for shared and static library selection.
  2721 # These are not used in any Makefile.am but in sdl-config.in.
  2722 AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
  2723 AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes])
  2724 
  2725 # Set runtime shared library paths as needed
  2726 
  2727 if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
  2728   SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2729 fi
  2730 if test $ARCH = solaris; then
  2731   SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2732 fi
  2733 
  2734 case "$ARCH" in
  2735   openbsd | netbsd | bsdi)
  2736     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2737     ;;
  2738   qnx)
  2739     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2740     ;;
  2741   macosx)
  2742     SHARED_SYSTEM_LIBS="-framework Cocoa"
  2743     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2744       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
  2745     fi
  2746     ;;
  2747   *)
  2748     SHARED_SYSTEM_LIBS=""
  2749     ;;
  2750 esac
  2751 
  2752 case "$ARCH" in
  2753   macosx)
  2754     # Evil hack to allow static linking on Mac OS X
  2755     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a"
  2756     ;;
  2757   *)
  2758     SDL_STATIC_LIBS="$SDL_LIBS"
  2759     ;;
  2760 esac
  2761 
  2762 
  2763 STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
  2764 
  2765 dnl Output the video drivers we use
  2766 if test x$enable_video = xtrue; then
  2767     if test "$VIDEO_SUBDIRS" = ""; then
  2768         AC_MSG_ERROR(*** No video drivers are enabled!)
  2769     fi
  2770 fi
  2771 AC_SUBST(AUDIO_SUBDIRS)
  2772 AC_SUBST(AUDIO_DRIVERS)
  2773 AC_SUBST(VIDEO_SUBDIRS)
  2774 AC_SUBST(VIDEO_DRIVERS)
  2775 AC_SUBST(JOYSTICK_SUBDIRS)
  2776 AC_SUBST(JOYSTICK_DRIVERS)
  2777 AC_SUBST(CDROM_SUBDIRS)
  2778 AC_SUBST(CDROM_DRIVERS)
  2779 AC_SUBST(SDL_EXTRADIRS)
  2780 AC_SUBST(SDL_EXTRALIBS)
  2781 
  2782 dnl Expand the cflags and libraries needed by apps using SDL
  2783 AC_SUBST(SDL_CFLAGS)
  2784 AC_SUBST(SDL_LIBS)
  2785 AC_SUBST(SDL_STATIC_LIBS)
  2786 AC_SUBST(SDL_RLD_FLAGS)
  2787 
  2788 dnl Expand the libraries needed for static and dynamic linking
  2789 AC_SUBST(STATIC_SYSTEM_LIBS)
  2790 AC_SUBST(SHARED_SYSTEM_LIBS)
  2791 AC_SUBST(SYSTEM_LIBS)
  2792 
  2793 dnl Expand the include directories for building SDL
  2794 CFLAGS="$CFLAGS -I\$(top_srcdir)/include"
  2795 CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL"
  2796 CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/main/$ARCH"
  2797 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio"
  2798 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video"
  2799 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/XFree86/extensions"
  2800 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events"
  2801 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick"
  2802 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom"
  2803 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread"
  2804 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer"
  2805 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian"
  2806 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file"
  2807 CFLAGS="$CFLAGS -I\$(top_builddir)/src/thread"
  2808 CXXFLAGS="$CFLAGS"
  2809 
  2810 
  2811 # Check for darwin at the very end and set up the Objective C compiler
  2812 # We do this here so that we get the full CFLAGS into OBJCFLAGS
  2813 case "$target" in
  2814     *-*-darwin*)
  2815         dnl AC_PROG_OBJC doesn't seem to exist, this is the SDL workaround
  2816         AC_MSG_CHECKING(for an Objective-C compiler)
  2817         OBJC="$CC"
  2818         AC_SUBST(OBJC)
  2819         OBJCFLAGS="$CFLAGS"
  2820         AC_SUBST(OBJCFLAGS)
  2821         dnl _AM_DEPENDENCIES(OBJC) doesn't work, so hard code OBJCDEPMODE here
  2822         dnl _AM_DEPENDENCIES(OBJC)
  2823         dnl Of course, hard coding doesn't work for some versions of automake
  2824         OBJCDEPMODE="depmode=gcc"
  2825         AC_SUBST(OBJCDEPMODE)
  2826         dnl Trying this to satisfy everybody...
  2827         AC_MSG_RESULT(not implemented yet)
  2828         ;;
  2829 esac
  2830 
  2831 # Finally create all the generated files
  2832 dnl Important: Any directory that you want to be in the distcheck should
  2833 dnl            have a file listed here, so that configure generates the
  2834 dnl            subdirectories on the build target.
  2835 AC_OUTPUT([
  2836 Makefile
  2837 docs/Makefile
  2838 docs/html/Makefile
  2839 docs/man3/Makefile
  2840 include/Makefile
  2841 src/Makefile
  2842 src/main/Makefile
  2843 src/main/macosx/Makefile
  2844 src/main/macosx/Info.plist
  2845 src/audio/Makefile
  2846 src/audio/alsa/Makefile
  2847 src/audio/arts/Makefile
  2848 src/audio/baudio/Makefile
  2849 src/audio/dc/Makefile
  2850 src/audio/disk/Makefile
  2851 src/audio/dma/Makefile
  2852 src/audio/dmedia/Makefile
  2853 src/audio/dsp/Makefile
  2854 src/audio/esd/Makefile
  2855 src/audio/macosx/Makefile
  2856 src/audio/macrom/Makefile
  2857 src/audio/mint/Makefile
  2858 src/audio/mme/Makefile
  2859 src/audio/nas/Makefile
  2860 src/audio/nto/Makefile
  2861 src/audio/openbsd/Makefile
  2862 src/audio/paudio/Makefile
  2863 src/audio/riscos/Makefile
  2864 src/audio/sun/Makefile
  2865 src/audio/ums/Makefile
  2866 src/audio/windib/Makefile
  2867 src/audio/windx5/Makefile
  2868 src/video/Makefile
  2869 src/video/aalib/Makefile
  2870 src/video/ataricommon/Makefile
  2871 src/video/bwindow/Makefile
  2872 src/video/cybergfx/Makefile
  2873 src/video/dc/Makefile
  2874 src/video/dga/Makefile
  2875 src/video/directfb/Makefile
  2876 src/video/dummy/Makefile
  2877 src/video/epoc/Makefile
  2878 src/video/fbcon/Makefile
  2879 src/video/gem/Makefile
  2880 src/video/ggi/Makefile
  2881 src/video/maccommon/Makefile
  2882 src/video/macdsp/Makefile
  2883 src/video/macrom/Makefile
  2884 src/video/nanox/Makefile
  2885 src/video/photon/Makefile
  2886 src/video/picogui/Makefile
  2887 src/video/ps2gs/Makefile
  2888 src/video/qtopia/Makefile
  2889 src/video/quartz/Makefile
  2890 src/video/riscos/Makefile
  2891 src/video/svga/Makefile
  2892 src/video/vgl/Makefile
  2893 src/video/wincommon/Makefile
  2894 src/video/windib/Makefile
  2895 src/video/windx5/Makefile
  2896 src/video/x11/Makefile
  2897 src/video/xbios/Makefile
  2898 src/video/XFree86/Makefile
  2899 src/video/XFree86/extensions/Makefile
  2900 src/video/XFree86/Xinerama/Makefile
  2901 src/video/XFree86/Xv/Makefile
  2902 src/video/XFree86/Xxf86dga/Makefile
  2903 src/video/XFree86/Xxf86vm/Makefile
  2904 src/events/Makefile
  2905 src/joystick/Makefile
  2906 src/joystick/amigaos/Makefile
  2907 src/joystick/beos/Makefile
  2908 src/joystick/bsd/Makefile
  2909 src/joystick/darwin/Makefile
  2910 src/joystick/dc/Makefile
  2911 src/joystick/dummy/Makefile
  2912 src/joystick/linux/Makefile
  2913 src/joystick/macos/Makefile
  2914 src/joystick/mint/Makefile
  2915 src/joystick/riscos/Makefile
  2916 src/joystick/win32/Makefile
  2917 src/cdrom/Makefile
  2918 src/cdrom/aix/Makefile
  2919 src/cdrom/beos/Makefile
  2920 src/cdrom/dc/Makefile
  2921 src/cdrom/dummy/Makefile
  2922 src/cdrom/bsdi/Makefile
  2923 src/cdrom/freebsd/Makefile
  2924 src/cdrom/linux/Makefile
  2925 src/cdrom/macos/Makefile
  2926 src/cdrom/macosx/Makefile
  2927 src/cdrom/mint/Makefile
  2928 src/cdrom/openbsd/Makefile
  2929 src/cdrom/osf/Makefile
  2930 src/cdrom/qnx/Makefile
  2931 src/cdrom/win32/Makefile
  2932 src/thread/Makefile
  2933 src/timer/Makefile
  2934 src/endian/Makefile
  2935 src/file/Makefile
  2936 src/cpuinfo/Makefile
  2937 src/hermes/Makefile
  2938 sdl-config
  2939 SDL.spec
  2940 SDL.qpg
  2941 ], [chmod +x sdl-config])