configure.in
author Ryan C. Gordon <icculus@icculus.org>
Mon, 30 Jan 2006 18:21:44 +0000
changeset 1299 2bf9dda618e5
parent 1251 86d0d01290ea
child 1306 0c105755b110
permissions -rw-r--r--
Corrects dynamic X11 code on Tru64 systems.

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