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