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