configure.in
author Sam Lantinga <slouken@libsdl.org>
Thu, 02 Mar 2006 03:24:20 +0000
changeset 1459 1e8582152d44
parent 1456 84de7511f79f
child 1467 b69f2b0309a0
permissions -rw-r--r--
Date: Wed, 01 Mar 2006 10:14:31 +0000
From: "alan buckley"
Subject: Re: Updating SDL for RISC OS

I've attached a zip file with three diffs to get SDL to build on RISC OS.

configure.in.diff and makedeps.sh.diff have been modified so that they
can build the assembler file in video/riscos. You may want to double
check these as I don't know a lot about unix shell programming.
(I've tested them cross-compiling on cygwin).

sdlsysthread.diff is the changes required to SDL_systhread.c for RISC
OS. As you suspected with these changes in place you can delete the
RISC OS specific threading code in thread/riscos.

I've also renamed SDL_riscosASM.s to SDL_riscosASM.S, but I'm never
quite sure how to rename files in CVS, so if you could to this it would
be appreciated.
     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_CONFIG_AUX_DIRS($srcdir/build-scripts)
    44 AC_CANONICAL_SYSTEM
    45 AC_C_BIGENDIAN
    46 if test x$ac_cv_c_bigendian = xyes; then
    47     AC_DEFINE(SDL_BYTEORDER, 4321)
    48 else
    49     AC_DEFINE(SDL_BYTEORDER, 1234)
    50 fi
    51 
    52 dnl Set up the compiler and linker flags
    53 INCLUDE="-I$srcdir/include"
    54 if test x$srcdir != x.; then
    55     INCLUDE="-Iinclude $INCLUDE"
    56 fi
    57 case "$target" in
    58     *-*-cygwin*)
    59         # We build SDL on cygwin without the UNIX emulation layer
    60         CFLAGS="$CFLAGS -I/usr/include/mingw -mno-cygwin"
    61         BUILD_CFLAGS="$CFLAGS \$(INCLUDE)"
    62         BUILD_LDFLAGS="$LDFLAGS -mno-cygwin"
    63         SDL_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    64         SDL_LIBS="-lSDL -mno-cygwin"
    65         ;;
    66     *)
    67         CFLAGS="$CFLAGS -D_GNU_SOURCE=1"
    68         BUILD_CFLAGS="$CFLAGS \$(INCLUDE)"
    69         BUILD_LDFLAGS="$LDFLAGS"
    70         SDL_CFLAGS=""
    71         SDL_LIBS="-lSDL"
    72         ;;
    73 esac
    74 
    75 dnl Check for tools
    76 AC_LIBTOOL_WIN32_DLL
    77 AC_PROG_LIBTOOL
    78 AC_PROG_CC
    79 AC_PROG_CXX
    80 AC_PROG_INSTALL
    81 AC_PROG_MAKE_SET
    82 
    83 dnl Check for compiler characteristics
    84 AC_C_CONST
    85 AC_C_INLINE
    86 AC_C_VOLATILE
    87 
    88 dnl See whether we are allowed to use the system C library
    89 AC_ARG_ENABLE(libc,
    90 AC_HELP_STRING([--enable-libc], [Use the system C library [default=yes]]),
    91               , enable_libc=yes)
    92 if test x$enable_libc = xyes; then
    93     AC_DEFINE(HAVE_LIBC)
    94 
    95     dnl Check for C library headers
    96     AC_HEADER_STDC
    97     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 math.h signal.h)
    98 
    99     dnl Check for typedefs, structures, etc.
   100     AC_TYPE_SIZE_T
   101     if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
   102         AC_CHECK_TYPE(int64_t)
   103         if test x$ac_cv_type_int64_t = xyes; then
   104             AC_DEFINE(SDL_HAS_64BIT_TYPE)
   105         fi
   106         have_inttypes=yes
   107     fi
   108 
   109     dnl Checks for library functions.
   110     AC_FUNC_ALLOCA
   111     AC_FUNC_MEMCMP
   112     if test x$ac_cv_func_memcmp_working = xyes; then
   113         AC_DEFINE(HAVE_MEMCMP)
   114     fi
   115     AC_FUNC_STRTOD
   116     if test x$ac_cv_func_strtod = xyes; then
   117         AC_DEFINE(HAVE_STRTOD)
   118     fi
   119     AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep)
   120 
   121     AC_CHECK_LIB(m, pow, [BUILD_LDFLAGS="$BUILD_LDFLAGS -lm"])
   122 fi
   123 
   124 if test x$have_inttypes != xyes; then
   125     AC_CHECK_SIZEOF(char, 1)
   126     AC_CHECK_SIZEOF(short, 2)
   127     AC_CHECK_SIZEOF(int, 4)
   128     AC_CHECK_SIZEOF(long, 4)
   129     AC_CHECK_SIZEOF(long long, 8)
   130     if test x$ac_cv_sizeof_char = x1; then
   131         AC_DEFINE(int8_t, signed char)
   132         AC_DEFINE(uint8_t, unsigned char)
   133     fi
   134     if test x$ac_cv_sizeof_short = x2; then
   135         AC_DEFINE(int16_t, signed short)
   136         AC_DEFINE(uint16_t, unsigned short)
   137     else
   138         if test x$ac_cv_sizeof_int = x2; then
   139             AC_DEFINE(int16_t, signed int)
   140             AC_DEFINE(uint16_t, unsigned int)
   141         fi
   142     fi
   143     if test x$ac_cv_sizeof_int = x4; then
   144         AC_DEFINE(int32_t, signed int)
   145         AC_DEFINE(uint32_t, unsigned int)
   146     else
   147         if test x$ac_cv_sizeof_long = x4; then
   148             AC_DEFINE(int32_t, signed long)
   149             AC_DEFINE(uint32_t, unsigned long)
   150         fi
   151     fi
   152     if test x$ac_cv_sizeof_long = x8; then
   153         AC_DEFINE(int64_t, signed long)
   154         AC_DEFINE(uint64_t, unsigned long)
   155         AC_DEFINE(SDL_HAS_64BIT_TYPE)
   156     else
   157         if test x$ac_cv_sizeof_long_long = x8; then
   158             AC_DEFINE(int64_t, signed long long)
   159             AC_DEFINE(uint64_t, unsigned long long)
   160             AC_DEFINE(SDL_HAS_64BIT_TYPE)
   161         fi
   162     fi
   163     AC_DEFINE(size_t, unsigned int)
   164     AC_DEFINE(uintptr_t, unsigned long)
   165 fi
   166 
   167 # Standard C sources
   168 SOURCES="$SOURCES $srcdir/src/*.c"
   169 SOURCES="$SOURCES $srcdir/src/audio/*.c"
   170 SOURCES="$SOURCES $srcdir/src/cdrom/*.c"
   171 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
   172 SOURCES="$SOURCES $srcdir/src/events/*.c"
   173 SOURCES="$SOURCES $srcdir/src/file/*.c"
   174 SOURCES="$SOURCES $srcdir/src/joystick/*.c"
   175 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
   176 SOURCES="$SOURCES $srcdir/src/thread/*.c"
   177 SOURCES="$SOURCES $srcdir/src/timer/*.c"
   178 SOURCES="$SOURCES $srcdir/src/video/*.c"
   179 
   180 dnl Enable/disable various subsystems of the SDL library
   181 
   182 AC_ARG_ENABLE(audio,
   183 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [default=yes]]),
   184               , enable_audio=yes)
   185 if test x$enable_audio != xyes; then
   186     AC_DEFINE(SDL_AUDIO_DISABLED)
   187 fi
   188 AC_ARG_ENABLE(video,
   189 AC_HELP_STRING([--enable-video], [Enable the video subsystem [default=yes]]),
   190               , enable_video=yes)
   191 if test x$enable_video != xyes; then
   192     AC_DEFINE(SDL_VIDEO_DISABLED)
   193 fi
   194 AC_ARG_ENABLE(events,
   195 AC_HELP_STRING([--enable-events], [Enable the events subsystem [default=yes]]),
   196               , enable_events=yes)
   197 if test x$enable_events != xyes; then
   198     AC_DEFINE(SDL_EVENTS_DISABLED)
   199 fi
   200 AC_ARG_ENABLE(joystick,
   201 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [default=yes]]),
   202               , enable_joystick=yes)
   203 if test x$enable_joystick != xyes; then
   204     AC_DEFINE(SDL_JOYSTICK_DISABLED)
   205 fi
   206 AC_ARG_ENABLE(cdrom,
   207 AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [default=yes]]),
   208               , enable_cdrom=yes)
   209 if test x$enable_cdrom != xyes; then
   210     AC_DEFINE(SDL_CDROM_DISABLED)
   211 fi
   212 AC_ARG_ENABLE(threads,
   213 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]]),
   214               , enable_threads=yes)
   215 if test x$enable_threads != xyes; then
   216     AC_DEFINE(SDL_THREADS_DISABLED)
   217 fi
   218 AC_ARG_ENABLE(timers,
   219 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [default=yes]]),
   220               , enable_timers=yes)
   221 if test x$enable_timers != xyes; then
   222     AC_DEFINE(SDL_TIMERS_DISABLED)
   223 fi
   224 AC_ARG_ENABLE(file,
   225 AC_HELP_STRING([--enable-file], [Enable the file subsystem [default=yes]]),
   226               , enable_file=yes)
   227 if test x$enable_file != xyes; then
   228     AC_DEFINE(SDL_FILE_DISABLED)
   229 fi
   230 AC_ARG_ENABLE(loadso,
   231 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]]),
   232               , enable_loadso=yes)
   233 if test x$enable_loadso != xyes; then
   234     AC_DEFINE(SDL_LOADSO_DISABLED)
   235 fi
   236 AC_ARG_ENABLE(cpuinfo,
   237 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [default=yes]]),
   238               , enable_cpuinfo=yes)
   239 if test x$enable_cpuinfo != xyes; then
   240     AC_DEFINE(SDL_CPUINFO_DISABLED)
   241 fi
   242 AC_ARG_ENABLE(assembly,
   243 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [default=yes]]),
   244               , enable_assembly=yes)
   245 if test x$enable_assembly = xyes; then
   246     AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
   247 fi
   248 
   249 dnl See if the OSS audio interface is supported
   250 CheckOSS()
   251 {
   252     AC_ARG_ENABLE(oss,
   253 AC_HELP_STRING([--enable-oss], [support the OSS audio API [default=yes]]),
   254                   , enable_oss=yes)
   255     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
   256         AC_MSG_CHECKING(for OSS audio support)
   257         have_oss=no
   258         if test x$have_oss != xyes; then
   259             AC_TRY_COMPILE([
   260               #include <sys/soundcard.h>
   261             ],[
   262               int arg = SNDCTL_DSP_SETFRAGMENT;
   263             ],[
   264             have_oss=yes
   265             ])
   266         fi
   267         if test x$have_oss != xyes; then
   268             AC_TRY_COMPILE([
   269               #include <soundcard.h>
   270             ],[
   271               int arg = SNDCTL_DSP_SETFRAGMENT;
   272             ],[
   273             have_oss=yes
   274             AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
   275             ])
   276         fi
   277         AC_MSG_RESULT($have_oss)
   278         if test x$have_oss = xyes; then
   279             AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
   280             SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
   281             SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
   282             have_audio=yes
   283 
   284             # OpenBSD needs linking with ossaudio emulation library
   285             case "$target" in
   286                 *-*-openbsd*|*-*-netbsd*)
   287                     BUILD_LDFLAGS="$BUILD_LDFLAGS -lossaudio";;
   288             esac
   289         fi
   290     fi
   291 }
   292 
   293 dnl See if the ALSA audio interface is supported
   294 CheckALSA()
   295 {
   296     AC_ARG_ENABLE(alsa,
   297 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [default=yes]]),
   298                   , enable_alsa=yes)
   299     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
   300         AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
   301         # Restore all flags from before the ALSA detection runs
   302         CFLAGS="$alsa_save_CFLAGS"
   303         LDFLAGS="$alsa_save_LDFLAGS"
   304         LIBS="$alsa_save_LIBS"
   305         if test x$have_alsa = xyes; then
   306             AC_ARG_ENABLE(alsa-shared,
   307 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [default=yes]]),
   308                           , enable_alsa_shared=yes)
   309             if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
   310                 if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
   311                     ALSA_LIBS="-L/lib $ALSA_LIBS"
   312                 elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
   313                     ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
   314                 elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
   315                     ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
   316                 fi
   317             fi
   318             alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
   319             alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   320             echo "-- $alsa_lib_spec -> $alsa_lib"
   321 
   322             AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
   323             SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
   324             BUILD_CFLAGS="$BUILD_CFLAGS $ALSA_CFLAGS"
   325             if test x$have_loadso != xyes && \
   326                test x$enable_alsa_shared = xyes; then
   327                 AC_MSG_ERROR([You must have SDL_LoadObject() support])
   328             fi
   329             if test x$have_loadso = xyes && \
   330                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   331                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
   332             else
   333                 BUILD_LDFLAGS="$BUILD_LDFLAGS $ALSA_LIBS"
   334             fi
   335             have_audio=yes
   336         fi
   337     fi
   338         if test x$have_alsa = xyes; then
   339             AC_ARG_ENABLE(alsa-shared,
   340 [  --enable-alsa-shared     dynamically load ALSA audio support [default=yes]],
   341                           , enable_alsa_shared=yes)
   342             if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
   343                 if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
   344                     ALSA_LIBS="-L/lib $ALSA_LIBS"
   345                 elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
   346                     ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
   347                 elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
   348                     ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
   349                 fi
   350             fi
   351             alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
   352             alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   353             echo "-- $alsa_lib_spec -> $alsa_lib"
   354 
   355             if test x$have_loadso != xyes && \
   356                test x$enable_alsa_shared = xyes; then
   357                 AC_MSG_ERROR([You must have SDL_LoadObject() support])
   358             fi
   359             if test x$have_loadso = xyes && \
   360                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   361                 CFLAGS="$CFLAGS -DALSA_SUPPORT -DALSA_DYNAMIC=\$(alsa_lib) $ALSA_CFLAGS"
   362                 AC_SUBST(alsa_lib)
   363 
   364                 use_dlvsym=no
   365                 AC_CHECK_LIB(dl, dlvsym, [use_dlvsym=yes])
   366                 if test x$use_dlvsym = xyes; then
   367                     CFLAGS="$CFLAGS -DUSE_DLVSYM"
   368                 fi
   369             else
   370                 CFLAGS="$CFLAGS -DALSA_SUPPORT $ALSA_CFLAGS"
   371                 SYSTEM_LIBS="$SYSTEM_LIBS $ALSA_LIBS"
   372             fi
   373         fi
   374 }
   375 
   376 dnl Check whether we want to use IRIX 6.5+ native audio or not
   377 CheckDMEDIA()
   378 {
   379     if test x$enable_audio = xyes; then
   380         AC_MSG_CHECKING(for dmedia audio support)
   381         have_dmedia=no
   382         AC_TRY_COMPILE([
   383           #include <dmedia/audio.h>
   384         ],[
   385           ALport audio_port;
   386         ],[
   387         have_dmedia=yes
   388         ])
   389         AC_MSG_RESULT($have_dmedia)
   390         # Set up files for the audio library
   391         if test x$have_dmedia = xyes; then
   392             AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
   393             SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
   394             BUILD_LDFLAGS="$BUILD_LDFLAGS -laudio"
   395             have_audio=yes
   396         fi
   397     fi
   398 }
   399 
   400 dnl Check whether we want to use Tru64 UNIX native audio or not
   401 CheckMME()
   402 {
   403     dnl Make sure we are running on an Tru64 UNIX
   404     case $ARCH in
   405         osf)
   406             ;;
   407         *)
   408             return
   409             ;;
   410     esac
   411     if test x$enable_audio = xyes; then
   412         AC_MSG_CHECKING(for MME audio support)
   413         MME_CFLAGS="-I/usr/include/mme"
   414         MME_LIBS="-lmme"
   415         have_mme=no
   416         save_CFLAGS="$CFLAGS"
   417         CFLAGS="$CFLAGS $MME_CFLAGS"
   418         AC_TRY_COMPILE([
   419           #include <mme_api.h>
   420         ],[
   421           HWAVEOUT sound;
   422         ],[
   423         have_mme=yes
   424         ])
   425         CFLAGS="$save_CFLAGS"
   426         AC_MSG_RESULT($have_mme)
   427         # Set up files for the audio library
   428         if test x$have_mme = xyes; then
   429             AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
   430             SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
   431             BUILD_CFLAGS="$BUILD_CFLAGS $MME_CFLAGS"
   432             BUILD_LDFLAGS="$BUILD_LDFLAGS $MME_LIBS"
   433             have_audio=yes
   434         fi
   435     fi
   436 }
   437 
   438 dnl Find the ESD includes and libraries
   439 CheckESD()
   440 {
   441     AC_ARG_ENABLE(esd,
   442 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [default=yes]]),
   443                   , enable_esd=yes)
   444     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   445         AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
   446         if test x$have_esd = xyes; then
   447             AC_ARG_ENABLE(esd-shared,
   448 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [default=yes]]),
   449                           , enable_esd_shared=yes)
   450             esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
   451             esd_lib=`ls $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   452             echo "-- $esd_lib_spec -> $esd_lib"
   453             if test x$have_loadso != xyes && \
   454                test x$enable_esd_shared = xyes; then
   455                 AC_MSG_ERROR([You must have SDL_LoadObject() support])
   456             fi
   457             if test x$have_loadso = xyes && \
   458                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   459                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
   460             fi
   461             AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
   462             SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
   463             BUILD_CFLAGS="$BUILD_CFLAGS $ESD_CFLAGS"
   464             BUILD_LDFLAGS="$BUILD_LDFLAGS $ESD_LIBS"
   465             have_audio=yes
   466         fi
   467     fi
   468 }
   469 
   470 CheckARTSC()
   471 {
   472     AC_ARG_ENABLE(arts,
   473 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [default=yes]]),
   474                   , enable_arts=yes)
   475     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   476         AC_PATH_PROG(ARTSCONFIG, artsc-config)
   477         if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
   478             : # arts isn't installed
   479         else
   480             ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   481             ARTS_LIBS=`$ARTSCONFIG --libs`
   482             ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
   483             AC_MSG_CHECKING(for aRts development environment)
   484             audio_arts=no
   485             save_CFLAGS="$CFLAGS"
   486             CFLAGS="$CFLAGS $ARTS_CFLAGS"
   487             AC_TRY_COMPILE([
   488              #include <artsc.h>
   489             ],[
   490              arts_stream_t stream;
   491             ],[
   492             audio_arts=yes
   493             ])
   494             CFLAGS="$save_CFLAGS"
   495             AC_MSG_RESULT($audio_arts)
   496             if test x$audio_arts = xyes; then
   497                 AC_ARG_ENABLE(arts-shared,
   498 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [default=yes]]),
   499                               , enable_arts_shared=yes)
   500                 arts_lib_spec="$ARTS_PREFIX/lib/libartsc.so.*"
   501                 arts_lib=`ls $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   502                 echo "-- $arts_lib_spec -> $arts_lib"
   503                 if test x$have_loadso != xyes && \
   504                    test x$enable_arts_shared = xyes; then
   505                     AC_MSG_ERROR([You must have SDL_LoadObject() support])
   506                 fi
   507                 if test x$have_loadso = xyes && \
   508                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   509                     AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
   510                 fi
   511                 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   512                 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   513                 BUILD_CFLAGS="$BUILD_CFLAGS $ARTS_CFLAGS"
   514                 BUILD_LDFLAGS="$BUILD_LDFLAGS $ARTS_LIBS"
   515                 have_audio=yes
   516             fi
   517         fi
   518     fi
   519 }
   520 
   521 dnl See if the NAS audio interface is supported
   522 CheckNAS()
   523 {
   524     AC_ARG_ENABLE(nas,
   525 AC_HELP_STRING([--enable-nas], [support the NAS audio API [default=yes]]),
   526                   , enable_nas=yes)
   527     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   528         AC_MSG_CHECKING(for NAS audio support)
   529         have_nas=no
   530         if test -r /usr/X11R6/include/audio/audiolib.h; then
   531             have_nas=yes
   532             NAS_CFLAGS="-I/usr/X11R6/include/"
   533             NAS_LIBS="-laudio -lXt"
   534 
   535         dnl On IRIX, the NAS includes are in a different directory,
   536         dnl and libnas must be explicitly linked in
   537 
   538         elif test -r /usr/freeware/include/nas/audiolib.h; then
   539             have_nas=yes
   540             NAS_LIBS="-lnas -lXt"
   541         fi
   542         AC_MSG_RESULT($have_nas)
   543         if test x$have_nas = xyes; then
   544             AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
   545             SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
   546             BUILD_CFLAGS="$BUILD_CFLAGS $NAS_CFLAGS"
   547             BUILD_LDFLAGS="$BUILD_LDFLAGS $NAS_LIBS"
   548             have_audio=yes
   549         fi
   550     fi
   551 }
   552 
   553 dnl rcg07142001 See if the user wants the disk writer audio driver...
   554 CheckDiskAudio()
   555 {
   556     AC_ARG_ENABLE(diskaudio,
   557 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [default=yes]]),
   558                   , enable_diskaudio=yes)
   559     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
   560         AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
   561         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
   562     fi
   563 }
   564 
   565 dnl Set up the Atari Audio driver
   566 CheckAtariAudio()
   567 {
   568     AC_ARG_ENABLE(mintaudio,
   569 AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [default=yes]]),
   570                   , enable_mintaudio=yes)
   571     if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
   572         mintaudio=no
   573         AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
   574         if test x$have_mint_falcon_hdr = xyes; then
   575             mintaudio=yes
   576             AC_DEFINE(SDL_AUDIO_DRIVER_MINT)
   577             SOURCES="$SOURCES $srcdir/src/audio/mint/*.c"
   578             have_audio=yes
   579         fi
   580     fi
   581 }
   582 
   583 dnl See if we can use x86 assembly blitters
   584 # NASM is available from: http://nasm.sourceforge.net
   585 CheckNASM()
   586 {
   587     dnl Make sure we are running on an x86 platform
   588     case $target in
   589         i?86*)
   590             ;;
   591         *)
   592         # Nope, bail early.
   593             return
   594             ;;
   595     esac
   596     dnl Check for NASM (for assembly blit routines)
   597     AC_ARG_ENABLE(nasm,
   598 AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [default=yes]]),
   599                   , enable_nasm=yes)
   600     if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_nasm = xyes; then
   601         AC_PATH_PROG(NASM, nasm)
   602         if test x$NASM != x -a x$NASM != x'"$NASM"'; then
   603             AC_DEFINE(SDL_HERMES_BLITTERS)
   604             SOURCES="$SOURCES $srcdir/src/hermes/*.asm"
   605             case $ARCH in
   606               win32)
   607                   NASMFLAGS="-f win32"
   608                   ;;
   609               openbsd)
   610                   NASMFLAGS="-f aoutb"
   611                   ;;
   612               *)
   613                   NASMFLAGS="-f elf"
   614                   ;;
   615             esac
   616             AC_SUBST(NASM)
   617             AC_SUBST(NASMFLAGS)
   618 
   619             case "$target" in
   620                 # this line is needed for QNX, because it's not defined the __ELF__
   621                 *-*-qnx*)
   622                      BUILD_CFLAGS="$BUILD_CFLAGS -D__ELF__";;
   623                 *-*-solaris*)
   624                      BUILD_CFLAGS="$BUILD_CFLAGS -D__ELF__";;
   625             esac
   626         fi
   627     fi
   628 }
   629 
   630 dnl Check for altivec instruction support using gas syntax
   631 CheckAltivec()
   632 {
   633     AC_ARG_ENABLE(altivec,
   634 AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [default=yes]]),
   635                   , enable_altivec=yes)
   636     if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then
   637         have_altivec_h_hdr=no
   638         AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)
   639 
   640         save_CFLAGS="$CFLAGS"
   641         have_gcc_altivec=no
   642         AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
   643         altivec_CFLAGS="-maltivec"
   644         CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   645 
   646         if test x$have_altivec_h_hdr = xyes; then
   647           AC_TRY_COMPILE([
   648           #include <altivec.h>
   649           vector unsigned int vzero() {
   650               return vec_splat_u32(0);
   651           }
   652           ],[
   653           ],[
   654           have_gcc_altivec=yes
   655           ])
   656           AC_MSG_RESULT($have_gcc_altivec)
   657         else
   658           AC_TRY_COMPILE([
   659           vector unsigned int vzero() {
   660               return vec_splat_u32(0);
   661           }
   662           ],[
   663           ],[
   664           have_gcc_altivec=yes
   665           ])
   666           AC_MSG_RESULT($have_gcc_altivec)
   667         fi
   668 
   669         if test x$have_gcc_altivec = xno; then
   670             AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
   671             altivec_CFLAGS="-faltivec"
   672             CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   673             if test x$have_altivec_h_hdr = xyes; then
   674               AC_TRY_COMPILE([
   675               #include <altivec.h>
   676               vector unsigned int vzero() {
   677                   return vec_splat_u32(0);
   678               }
   679               ],[
   680               ],[
   681               have_gcc_altivec=yes
   682               ])
   683               AC_MSG_RESULT($have_gcc_altivec)
   684             else
   685               AC_TRY_COMPILE([
   686               vector unsigned int vzero() {
   687                   return vec_splat_u32(0);
   688               }
   689               ],[
   690               ],[
   691               have_gcc_altivec=yes
   692               ])
   693               AC_MSG_RESULT($have_gcc_altivec)
   694             fi
   695         fi
   696         CFLAGS="$save_CFLAGS"
   697 
   698         if test x$have_gcc_altivec = xyes; then
   699             AC_DEFINE(SDL_ALTIVEC_BLITTERS)
   700             if test x$have_altivec_h_hdr = xyes; then
   701               AC_DEFINE(HAVE_ALTIVEC_H)
   702             fi
   703             BUILD_CFLAGS="$BUILD_CFLAGS $altivec_CFLAGS"
   704         fi
   705     fi
   706 }
   707 
   708 dnl Do the iPod thing
   709 CheckIPod()
   710 {
   711     AC_ARG_ENABLE(ipod,
   712 AC_HELP_STRING([--enable-ipod], [configure SDL to work with iPodLinux [default=yes on arm-elf]]),
   713         , enable_ipod=yes)
   714 
   715     if test x$enable_ipod = xyes; then
   716         BUILD_CFLAGS="$BUILD_CFLAGS -DIPOD"
   717         AC_DEFINE(SDL_VIDEO_DRIVER_IPOD)
   718         SOURCES="$SOURCES $srcdir/src/video/ipod/*.c"
   719     fi
   720 }
   721 
   722 dnl Find the nanox include and library directories
   723 CheckNANOX()
   724 {
   725     AC_ARG_ENABLE(video-nanox,
   726         AC_HELP_STRING([--enable-video-nanox], [use nanox video driver [default=no]]),
   727         , enable_video_nanox=no)
   728 
   729     if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
   730         AC_ARG_ENABLE(nanox-debug,  
   731             AC_HELP_STRING([--enable-nanox-debug], [print debug messages [default=no]]),
   732             , enable_nanox_debug=no)
   733         if test x$enable_nanox_debug = xyes; then
   734             BUILD_CFLAGS="$BUILD_CFLAGS -DENABLE_NANOX_DEBUG"
   735         fi
   736 
   737         AC_ARG_ENABLE(nanox-share-memory,  
   738             AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [default=no]]),
   739             , enable_nanox_share_memory=no)
   740         if test x$enable_nanox_share_memory = xyes; then
   741             BUILD_CFLAGS="$BUILD_CFLAGS -DNANOX_SHARE_MEMORY"
   742         fi
   743 
   744         AC_ARG_ENABLE(nanox_direct_fb, 
   745             AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [default=no]]),
   746             , enable_nanox_direct_fb=no)
   747         if test x$enable_nanox_direct_fb = xyes; then
   748             BUILD_CFLAGS="$BUILD_CFLAGS -DENABLE_NANOX_DIRECT_FB"
   749         fi
   750 
   751         AC_DEFINE(SDL_VIDEO_DRIVER_NANOX)
   752         SOURCES="$SOURCES $srcdir/src/video/nanox/*.c"
   753         BUILD_LDFLAGS="$BUILD_LDFLAGS -lnano-X"
   754         have_video=yes
   755     fi
   756 }
   757 
   758 dnl Find the X11 include and library directories
   759 CheckX11()
   760 {
   761     AC_ARG_ENABLE(video-x11,
   762 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [default=yes]]),
   763                   , enable_video_x11=yes)
   764     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
   765         AC_PATH_X
   766         AC_PATH_XTRA
   767         if test x$have_x = xyes; then
   768             AC_ARG_ENABLE(x11-shared,
   769 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=yes]]),
   770                           , enable_x11_shared=yes)
   771 
   772             case "$target" in
   773                 *-*-darwin*)
   774                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
   775                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
   776                     ;;
   777                 *-*-osf*)
   778                     x11_lib='libX11.so'
   779                     x11ext_lib='libXext.so'
   780                     ;;
   781                 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
   782                     x11_lib='libX11.so'
   783                     x11ext_lib='libXext.so'
   784                     ;;
   785                 *)
   786                     if test "x$X_LIBS" = "x"; then X_LIBS="-L/usr/lib"; fi
   787                     x11_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1\/libX11.so.[0-9]/'`]
   788                     x11_lib=`ls $x11_lib_spec 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`
   789                     x11ext_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1\/libXext.so.[0-9]/'`]
   790                     x11ext_lib=`ls $x11ext_lib_spec 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`
   791                     ;;
   792             esac
   793 
   794             X_CFLAGS="$X_CFLAGS -DXTHREADS"
   795             if test x$ac_cv_func_shmat != xyes; then
   796                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
   797             fi
   798             if test x$have_loadso != xyes && \
   799                test x$enable_x11_shared = xyes; then
   800                 AC_MSG_ERROR([You must have SDL_LoadObject() support])
   801             fi
   802 
   803             if test x$have_loadso = xyes && \
   804                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
   805                 echo "-- dynamic libX11 -> $x11_lib"
   806                 echo "-- dynamic libX11ext -> $x11ext_lib"
   807                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
   808                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
   809             else
   810                 X_LIBS="$X_LIBS -lX11 -lXext"
   811             fi
   812 
   813             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
   814             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
   815             BUILD_CFLAGS="$BUILD_CFLAGS $X_CFLAGS"
   816             BUILD_LDFLAGS="$BUILD_LDFLAGS $X_LIBS"
   817             have_video=yes
   818 
   819             AC_ARG_ENABLE(dga,
   820 AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [default=yes]]),
   821                           , enable_dga=yes)
   822             if test x$enable_dga = xyes; then
   823                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c"
   824             fi
   825             AC_ARG_ENABLE(video-dga,
   826 AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [default=yes]]),
   827                   , enable_video_dga=yes)
   828             if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then
   829                 AC_DEFINE(SDL_VIDEO_DRIVER_DGA)
   830                 SOURCES="$SOURCES $srcdir/src/video/dga/*.c"
   831             fi
   832             AC_ARG_ENABLE(video-x11-dgamouse,
   833 AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [default=yes]]),
   834                           , enable_video_x11_dgamouse=yes)
   835             if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then
   836                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE)
   837             fi
   838             AC_ARG_ENABLE(video-x11-vm,
   839 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [default=yes]]),
   840                           , enable_video_x11_vm=yes)
   841             if test x$enable_video_x11_vm = xyes; then
   842                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
   843                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
   844             fi
   845             AC_ARG_ENABLE(video-x11-xv,
   846 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [default=yes]]),
   847                           , enable_video_x11_xv=yes)
   848             if test x$enable_video_x11_xv = xyes; then
   849                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
   850                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
   851             fi
   852             AC_ARG_ENABLE(video-x11-xinerama,
   853 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [default=yes]]),
   854                             , enable_video_x11_xinerama=yes)
   855             if test x$enable_video_x11_xinerama = xyes; then
   856                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
   857                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
   858             fi
   859             AC_ARG_ENABLE(video-x11-xme,
   860 AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [default=yes]]),
   861                             , enable_video_x11_xme=yes)
   862             if test x$enable_video_x11_xme = xyes; then
   863                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
   864                 SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
   865             fi
   866         fi
   867     fi
   868 }
   869 
   870 dnl Check for QNX photon video driver
   871 CheckPHOTON()
   872 {
   873     AC_ARG_ENABLE(video-photon,
   874 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [default=yes]]),
   875                   , enable_video_photon=yes)
   876     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
   877         AC_MSG_CHECKING(for QNX Photon support)
   878         video_photon=no
   879         AC_TRY_COMPILE([
   880           #include <Ph.h>
   881           #include <Pt.h>
   882           #include <photon/Pg.h>
   883           #include <photon/PdDirect.h>
   884         ],[
   885          PgDisplaySettings_t *visual;
   886         ],[
   887         video_photon=yes
   888         ])
   889         AC_MSG_RESULT($video_photon)
   890         if test x$video_photon = xyes; then
   891             AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
   892             SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
   893             BUILD_LDFLAGS="$BUILD_LDFLAGS -lph"
   894             have_video=yes
   895 
   896             CheckOpenGLQNX
   897         fi
   898     fi
   899 }
   900 
   901 dnl Set up the BWindow video driver if enabled
   902 CheckBWINDOW()
   903 {
   904     if test x$enable_video = xyes; then
   905         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
   906         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
   907         have_video=yes
   908     fi
   909 }
   910 
   911 dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
   912 CheckCARBON()
   913 {
   914     AC_ARG_ENABLE(video-carbon,
   915 AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [default=no]]),
   916                   , enable_video_carbon=no)
   917     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
   918         AC_MSG_CHECKING(for Carbon framework)
   919         have_carbon=no
   920         AC_TRY_COMPILE([
   921           #include <Carbon/Carbon.h>
   922         ],[
   923         ],[
   924         have_carbon=yes
   925         ])
   926         AC_MSG_RESULT($have_carbon)
   927         if test x$have_carbon = xyes; then
   928             AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX)
   929             SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c"
   930             SOURCES="$SOURCES $srcdir/src/video/macrom/*.c"
   931             have_video=yes
   932         fi
   933     fi
   934 }
   935 
   936 dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
   937 CheckCOCOA()
   938 {
   939     AC_ARG_ENABLE(video-cocoa,
   940 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [default=yes]]),
   941                   , enable_video_cocoa=yes)
   942     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
   943         save_CFLAGS="$CFLAGS"
   944         dnl work around that we don't have Objective-C support in autoconf
   945         CFLAGS="$CFLAGS -x objective-c"
   946         AC_MSG_CHECKING(for Cocoa framework)
   947         have_cocoa=no
   948         AC_TRY_COMPILE([
   949           #import <Cocoa/Cocoa.h>
   950         ],[
   951         ],[
   952         have_cocoa=yes
   953         ])
   954         AC_MSG_RESULT($have_cocoa)
   955         CFLAGS="$save_CFLAGS"
   956         if test x$have_cocoa = xyes; then
   957             AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ)
   958             SOURCES="$SOURCES $srcdir/src/video/quartz/*.m"
   959             have_video=yes
   960         fi
   961     fi
   962 }
   963 
   964 dnl Find the framebuffer console includes
   965 CheckFBCON()
   966 {
   967     AC_ARG_ENABLE(video-fbcon,
   968 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [default=yes]]),
   969                   , enable_video_fbcon=yes)
   970     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
   971         AC_MSG_CHECKING(for framebuffer console support)
   972         video_fbcon=no
   973         AC_TRY_COMPILE([
   974          #include <linux/fb.h>
   975          #include <linux/kd.h>
   976          #include <linux/keyboard.h>
   977         ],[
   978         ],[
   979         video_fbcon=yes
   980         ])
   981         AC_MSG_RESULT($video_fbcon)
   982         if test x$video_fbcon = xyes; then
   983             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
   984             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
   985             have_video=yes
   986         fi
   987     fi
   988 }
   989 
   990 dnl Find DirectFB
   991 CheckDirectFB()
   992 {
   993     AC_ARG_ENABLE(video-directfb,
   994 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]]),
   995                   , enable_video_directfb=no)
   996     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
   997         video_directfb=no
   998 
   999         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1000         if test x$PKG_CONFIG = xno ; then
  1001             AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
  1002         else
  1003             AC_MSG_CHECKING(for DirectFB support)
  1004 
  1005             if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
  1006                 AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
  1007             fi
  1008 
  1009             DIRECTFB_REQUIRED_VERSION=0.9.15
  1010 
  1011             if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
  1012                 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1013                 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1014                 video_directfb=yes
  1015             fi
  1016         fi
  1017 
  1018         AC_MSG_RESULT($video_directfb)
  1019         if test x$video_directfb = xyes; then
  1020             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1021             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1022             BUILD_CFLAGS="$BUILD_CFLAGS $DIRECTFB_CFLAGS"
  1023             BUILD_LDFLAGS="$BUILD_LDFLAGS $DIRECTFB_LIBS"
  1024             have_video=yes
  1025         fi
  1026     fi
  1027 }
  1028 
  1029 dnl See if we're running on PlayStation 2 hardware
  1030 CheckPS2GS()
  1031 {
  1032     AC_ARG_ENABLE(video-ps2gs,
  1033 AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [default=yes]]),
  1034                   , enable_video_ps2gs=yes)
  1035     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
  1036         AC_MSG_CHECKING(for PlayStation 2 GS support)
  1037         video_ps2gs=no
  1038         AC_TRY_COMPILE([
  1039          #include <linux/ps2/dev.h>
  1040          #include <linux/ps2/gs.h>
  1041         ],[
  1042         ],[
  1043         video_ps2gs=yes
  1044         ])
  1045         AC_MSG_RESULT($video_ps2gs)
  1046         if test x$video_ps2gs = xyes; then
  1047             AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
  1048             SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
  1049             have_video=yes
  1050         fi
  1051     fi
  1052 }
  1053 
  1054 dnl Find the GGI includes
  1055 CheckGGI()
  1056 {
  1057     AC_ARG_ENABLE(video-ggi,
  1058 AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [default=no]]),
  1059                   , enable_video_ggi=no)
  1060     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
  1061         AC_MSG_CHECKING(for GGI support)
  1062         video_ggi=no
  1063         AC_TRY_COMPILE([
  1064          #include <ggi/ggi.h>
  1065          #include <ggi/gii.h>
  1066         ],[
  1067         ],[
  1068         video_ggi=yes
  1069         ])
  1070         AC_MSG_RESULT($video_ggi)
  1071         if test x$video_ggi = xyes; then
  1072             AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
  1073             SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
  1074             BUILD_LDFLAGS="$BUILD_LDFLAGS -lggi -lgii -lgg"
  1075             have_video=yes
  1076         fi
  1077     fi
  1078 }
  1079 
  1080 dnl Find the SVGAlib includes and libraries
  1081 CheckSVGA()
  1082 {
  1083     AC_ARG_ENABLE(video-svga,
  1084 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=no]]),
  1085                   , enable_video_svga=no)
  1086     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1087         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1088         video_svga=no
  1089         AC_TRY_COMPILE([
  1090          #include <vga.h>
  1091          #include <vgamouse.h>
  1092          #include <vgakeyboard.h>
  1093         ],[
  1094          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1095              exit(0);
  1096          }
  1097         ],[
  1098         video_svga=yes
  1099         ])
  1100         AC_MSG_RESULT($video_svga)
  1101         if test x$video_svga = xyes; then
  1102             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1103             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1104             BUILD_LDFLAGS="$BUILD_LDFLAGS -lvga"
  1105             have_video=yes
  1106         fi
  1107     fi
  1108 }
  1109 
  1110 dnl Find the VGL includes and libraries
  1111 CheckVGL()
  1112 {
  1113     AC_ARG_ENABLE(video-vgl,
  1114 AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=no]]),
  1115                   , enable_video_vgl=no)
  1116     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
  1117         AC_MSG_CHECKING(for libVGL support)
  1118         video_vgl=no
  1119         AC_TRY_COMPILE([
  1120          #include <sys/fbio.h>
  1121          #include <sys/consio.h>
  1122          #include <sys/kbio.h>
  1123          #include <vgl.h>
  1124         ],[
  1125          VGLBitmap bitmap;
  1126          exit(bitmap.Bitmap);
  1127         ],[
  1128         video_vgl=yes
  1129         ])
  1130         AC_MSG_RESULT($video_vgl)
  1131         if test x$video_vgl = xyes; then
  1132             AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
  1133             SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
  1134             BUILD_LDFLAGS="$BUILD_LDFLAGS -lvgl"
  1135             have_video=yes
  1136         fi
  1137     fi
  1138 }
  1139 
  1140 dnl Set up the wscons video driver if enabled
  1141 CheckWscons()
  1142 {
  1143     AC_ARG_ENABLE(video-wscons,
  1144 AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [default=yes]]),
  1145                   , enable_video_wscons=yes)
  1146     if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
  1147         AC_MSG_CHECKING(for wscons support)
  1148         video_wscons=no
  1149         AC_TRY_COMPILE([
  1150        #include <sys/time.h>
  1151        #include <dev/wscons/wsconsio.h>
  1152         ],[
  1153         ],[
  1154         video_wscons=yes
  1155         ])
  1156         AC_MSG_RESULT($video_wscons)
  1157         if test x$video_wscons = xyes; then
  1158             AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
  1159             SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
  1160             have_video=yes
  1161         fi
  1162     fi
  1163 }
  1164 
  1165 
  1166 dnl Find the AAlib includes
  1167 CheckAAlib()
  1168 {
  1169     AC_ARG_ENABLE(video-aalib,
  1170 AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [default=no]]),
  1171                   , enable_video_aalib=no)
  1172     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
  1173         AC_MSG_CHECKING(for AAlib support)
  1174         video_aalib=no
  1175         AC_TRY_COMPILE([
  1176          #include <aalib.h>
  1177         ],[
  1178         ],[
  1179         video_aalib=yes
  1180         ])
  1181         AC_MSG_RESULT($video_aalib)
  1182         if test x$video_aalib = xyes; then
  1183             AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
  1184             SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
  1185             BUILD_LDFLAGS="$BUILD_LDFLAGS -laa"
  1186             have_video=yes
  1187         fi
  1188     fi
  1189 }
  1190 
  1191 dnl Set up the QTopia video driver if enabled
  1192 CheckQtopia()
  1193 {
  1194     AC_ARG_ENABLE(video-qtopia,
  1195 AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [default=no]]),
  1196                   , enable_video_qtopia=no)
  1197     if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
  1198         AC_MSG_CHECKING(for Qtopia support)
  1199         video_qtopia=no
  1200         QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
  1201         AC_LANG_CPLUSPLUS
  1202         OLD_CXX="$CXXFLAGS"
  1203         CXXFLAGS="$QTOPIA_FLAGS"
  1204         AC_TRY_COMPILE([
  1205          #include <qpe/qpeapplication.h>
  1206         ],[
  1207         ],[
  1208         video_qtopia=yes
  1209         ])
  1210         CXXFLAGS="$OLD_CXX"
  1211         AC_MSG_RESULT($video_qtopia)
  1212         if test x$video_qtopia = xyes; then
  1213             AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
  1214             SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
  1215             SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc"
  1216             BUILD_CFLAGS="$BUILD_CFLAGS $QTOPIA_FLAGS"
  1217             SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
  1218             SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
  1219             have_video=yes
  1220         fi
  1221         AC_LANG_C
  1222     fi
  1223 }
  1224 
  1225 dnl Set up the PicoGUI video driver if enabled
  1226 CheckPicoGUI()
  1227 {
  1228     AC_ARG_ENABLE(video-picogui,
  1229 AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [default=no]]),
  1230                   , enable_video_picogui=no)
  1231     if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
  1232         AC_MSG_CHECKING(for PicoGUI support)
  1233         video_picogui=no
  1234         AC_TRY_COMPILE([
  1235          #include <picogui.h>
  1236         ],[
  1237         ],[
  1238         video_picogui=yes
  1239         ])
  1240         AC_MSG_RESULT($video_picogui)
  1241         if test x$video_picogui = xyes; then
  1242             AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI)
  1243             SOURCES="$SOURCES $srcdir/src/video/picogui/*.c"
  1244             SDL_LIBS="$SDL_LIBS -lpgui"
  1245             have_video=yes
  1246         fi
  1247     fi
  1248 }
  1249 
  1250 dnl Set up the Atari Bios keyboard driver
  1251 CheckAtariBiosEvent()
  1252 {
  1253     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
  1254 }
  1255 
  1256 dnl Set up the Atari Xbios driver
  1257 CheckAtariXbiosVideo()
  1258 {
  1259     AC_ARG_ENABLE(xbios,
  1260 AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [default=yes]]),
  1261                   , enable_video_xbios=yes)
  1262     video_xbios=no
  1263     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1264         video_xbios=yes
  1265         AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
  1266         SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
  1267         have_video=yes
  1268     fi
  1269 }
  1270 
  1271 dnl Set up the Atari Gem driver
  1272 CheckAtariGemVideo()
  1273 {
  1274     AC_ARG_ENABLE(gem,
  1275 AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [default=yes]]),
  1276                   , enable_video_gem=yes)
  1277     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1278         video_gem=no
  1279         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1280         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1281         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1282             video_gem=yes
  1283             AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
  1284             SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
  1285             BUILD_LDFLAGS="$BUILD_LDFLAGS -lgem"
  1286             have_video=yes
  1287         fi
  1288     fi
  1289 }
  1290 
  1291 dnl rcg04172001 Set up the Null video driver.
  1292 CheckDummyVideo()
  1293 {
  1294     AC_ARG_ENABLE(video-dummy,
  1295 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [default=yes]]),
  1296                   , enable_video_dummy=yes)
  1297     if test x$enable_video_dummy = xyes; then
  1298         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1299         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1300         have_video=yes
  1301     fi
  1302 }
  1303 
  1304 dnl Check to see if OpenGL support is desired
  1305 AC_ARG_ENABLE(video-opengl,
  1306 AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [default=yes]]),
  1307               , enable_video_opengl=yes)
  1308 
  1309 dnl Find OpenGL
  1310 CheckOpenGLX11()
  1311 {
  1312     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1313         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1314         video_opengl=no
  1315         AC_TRY_COMPILE([
  1316          #include <GL/gl.h>
  1317          #include <GL/glx.h>
  1318         ],[
  1319         ],[
  1320         video_opengl=yes
  1321         ])
  1322         AC_MSG_RESULT($video_opengl)
  1323         if test x$video_opengl = xyes; then
  1324             AC_DEFINE(SDL_VIDEO_OPENGL)
  1325             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1326         fi
  1327     fi
  1328 }
  1329 
  1330 dnl Find QNX RtP OpenGL
  1331 CheckOpenGLQNX()
  1332 {
  1333     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1334         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1335         video_opengl=no
  1336         AC_TRY_COMPILE([
  1337          #include <GL/gl.h>
  1338         ],[
  1339         ],[
  1340         video_opengl=yes
  1341         ])
  1342         AC_MSG_RESULT($video_opengl)
  1343         if test x$video_opengl = xyes; then
  1344             AC_DEFINE(SDL_VIDEO_OPENGL)
  1345             BUILD_LDFLAGS="$BUILD_LDFLAGS -lGL"
  1346         fi
  1347     fi
  1348 }
  1349 
  1350 dnl Check for Win32 OpenGL
  1351 CheckWIN32GL()
  1352 {
  1353     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1354         AC_DEFINE(SDL_VIDEO_OPENGL)
  1355         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1356     fi
  1357 }
  1358 
  1359 dnl Check for BeOS OpenGL
  1360 CheckBeGL()
  1361 {
  1362     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1363         AC_DEFINE(SDL_VIDEO_OPENGL)
  1364         BUILD_LDFLAGS="$BUILD_LDFLAGS -lGL"
  1365     fi
  1366 }
  1367 
  1368 dnl Check for MacOS OpenGL
  1369 CheckMacGL()
  1370 {
  1371     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1372         AC_DEFINE(SDL_VIDEO_OPENGL)
  1373         case "$target" in
  1374             *-*-darwin*)
  1375                 BUILD_LDFLAGS="$BUILD_LDFLAGS -framework OpenGL"
  1376                 # The following is probably not available in Darwin:
  1377                 BUILD_LDFLAGS="$BUILD_LDFLAGS -framework AGL"
  1378         esac
  1379     fi
  1380 }
  1381 
  1382 dnl Check for Mesa offscreen rendering
  1383 CheckAtariOSMesa()
  1384 {
  1385     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1386         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1387         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1388 
  1389         # Static linking to -lOSMesa
  1390         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1391         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1392             # -lOSMesa is really the static library
  1393             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1394                 OSMESA_LIBS="-lOSMesa"
  1395             fi
  1396         else
  1397             # -lOSMesa is a loader for OSMesa.ldg
  1398             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1399             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1400         fi
  1401         AC_DEFINE(SDL_VIDEO_OPENGL)
  1402         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1403         BUILD_CFLAGS="$BUILD_CFLAGS $OSMESA_CFLAGS"
  1404         BUILD_LDFLAGS="$BUILD_LDFLAGS $OSMESA_LIBS"
  1405 
  1406         AC_ARG_ENABLE(osmesa-shared,
  1407 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [default=yes]]),
  1408                               , enable_osmesa_shared=yes)
  1409         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1410             # Dynamic linking
  1411             if test "x$have_osmesa_hdr" = "xyes"; then
  1412                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1413             fi
  1414         fi
  1415     fi
  1416 }
  1417 
  1418 dnl See if we can use the new unified event interface in Linux 2.4
  1419 CheckInputEvents()
  1420 {
  1421     dnl Check for Linux 2.4 unified input event interface support
  1422     AC_ARG_ENABLE(input-events,
  1423 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [default=yes]]),
  1424                   , enable_input_events=yes)
  1425     if test x$enable_input_events = xyes; then
  1426         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1427         use_input_events=no
  1428         AC_TRY_COMPILE([
  1429           #include <linux/input.h>
  1430         ],[
  1431           #ifndef EVIOCGNAME
  1432           #error EVIOCGNAME() ioctl not available
  1433           #endif
  1434         ],[
  1435         use_input_events=yes
  1436         ])
  1437         AC_MSG_RESULT($use_input_events)
  1438         if test x$use_input_events = xyes; then
  1439             AC_DEFINE(SDL_INPUT_LINUXEV)
  1440         fi
  1441     fi
  1442 }
  1443 
  1444 dnl See if we can use the Touchscreen input library
  1445 CheckTslib()
  1446 {
  1447     AC_ARG_ENABLE(input-tslib,
  1448 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [default=yes]]),
  1449                   , enable_input_tslib=yes)
  1450     if test x$enable_input_tslib = xyes; then
  1451         AC_MSG_CHECKING(for Touchscreen library support)
  1452         enable_input_tslib=no
  1453         AC_TRY_COMPILE([
  1454           #include "tslib.h"
  1455         ],[
  1456         ],[
  1457         enable_input_tslib=yes
  1458         ])
  1459         AC_MSG_RESULT($enable_input_tslib)
  1460         if test x$enable_input_tslib = xyes; then
  1461             AC_DEFINE(SDL_INPUT_TSLIB)
  1462             BUILD_LDFLAGS="$BUILD_LDFLAGS -lts"
  1463         fi
  1464     fi
  1465 }
  1466 
  1467 dnl See if we can use GNU pth library for threads
  1468 CheckPTH()
  1469 {
  1470     dnl Check for pth support
  1471     AC_ARG_ENABLE(pth,
  1472 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [default=yes]]),
  1473                   , enable_pth=yes)
  1474     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1475         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1476         if test "$PTH_CONFIG" = "no"; then
  1477             use_pth=no
  1478         else
  1479             use_pth=yes
  1480         fi
  1481         AC_MSG_CHECKING(pth)
  1482         AC_MSG_RESULT($use_pth)
  1483         if test "x$use_pth" = xyes; then
  1484             AC_DEFINE(SDL_THREAD_PTH)
  1485             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1486             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1487             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1488             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1489             have_threads=yes
  1490         fi
  1491     fi
  1492 }
  1493 
  1494 dnl See what type of thread model to use on Linux and Solaris
  1495 CheckPTHREAD()
  1496 {
  1497     dnl Check for pthread support
  1498     AC_ARG_ENABLE(pthreads,
  1499 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=yes]]),
  1500                   , enable_pthreads=yes)
  1501     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1502     AC_ARG_ENABLE(pthread-sem,
  1503 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=yes]]),
  1504                   , enable_pthread_sem=yes)
  1505     case "$target" in
  1506         *-*-linux*)
  1507             pthread_cflags="-D_REENTRANT"
  1508             pthread_lib="-lpthread"
  1509             ;;
  1510         *-*-bsdi*)
  1511             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1512             pthread_lib=""
  1513             ;;
  1514         *-*-darwin*)
  1515             pthread_cflags="-D_THREAD_SAFE"
  1516 # causes Carbon.p complaints?
  1517 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1518             ;;
  1519         *-*-freebsd*)
  1520             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1521             pthread_lib="-pthread"
  1522             ;;
  1523         *-*-netbsd*)
  1524             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1525             pthread_lib="-L/usr/lib -lpthread"
  1526             ;;
  1527         *-*-openbsd*)
  1528             pthread_cflags="-D_REENTRANT"
  1529             pthread_lib="-pthread"
  1530             ;;
  1531         *-*-solaris*)
  1532             pthread_cflags="-D_REENTRANT"
  1533             pthread_lib="-lpthread -lposix4"
  1534             ;;
  1535         *-*-sysv5*)
  1536             pthread_cflags="-D_REENTRANT -Kthread"
  1537             pthread_lib=""
  1538             ;;
  1539         *-*-irix*)
  1540             pthread_cflags="-D_SGI_MP_SOURCE"
  1541             pthread_lib="-lpthread"
  1542             ;;
  1543         *-*-aix*)
  1544             pthread_cflags="-D_REENTRANT -mthreads"
  1545             pthread_lib="-lpthread"
  1546             ;;
  1547         *-*-hpux11*)
  1548             pthread_cflags="-D_REENTRANT"
  1549             pthread_lib="-L/usr/lib -lpthread"
  1550             ;;
  1551         *-*-qnx*)
  1552             pthread_cflags=""
  1553             pthread_lib=""
  1554             ;;
  1555         *-*-osf*)
  1556             pthread_cflags="-D_REENTRANT"
  1557             if test x$ac_cv_prog_gcc = xyes; then
  1558                 pthread_lib="-lpthread -lrt"
  1559             else
  1560                 pthread_lib="-lpthread -lexc -lrt"
  1561             fi
  1562             ;;
  1563         *)
  1564             pthread_cflags="-D_REENTRANT"
  1565             pthread_lib="-lpthread"
  1566             ;;
  1567     esac
  1568     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1569         # Save the original compiler flags and libraries
  1570         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1571         # Add the pthread compiler flags and libraries
  1572         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1573         # Check to see if we have pthread support on this system
  1574         AC_MSG_CHECKING(for pthreads)
  1575         use_pthreads=no
  1576         AC_TRY_LINK([
  1577          #include <pthread.h>
  1578         ],[
  1579          pthread_attr_t type;
  1580          pthread_attr_init(&type);
  1581         ],[
  1582         use_pthreads=yes
  1583         ])
  1584         AC_MSG_RESULT($use_pthreads)
  1585         # Restore the compiler flags and libraries
  1586         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1587 
  1588         # Do futher testing if we have pthread support...
  1589         if test x$use_pthreads = xyes; then
  1590             AC_DEFINE(SDL_THREAD_PTHREAD)
  1591             BUILD_CFLAGS="$BUILD_CFLAGS $pthread_cflags"
  1592             BUILD_LDFLAGS="$BUILD_LDFLAGS $pthread_lib"
  1593             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1594             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1595 
  1596             # Save the original compiler flags and libraries
  1597             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1598             # Add the pthread compiler flags and libraries
  1599             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1600 
  1601             # Check to see if recursive mutexes are available
  1602             AC_MSG_CHECKING(for recursive mutexes)
  1603             has_recursive_mutexes=no
  1604             if test x$has_recursive_mutexes = xno; then
  1605                 AC_TRY_COMPILE([
  1606                   #include <pthread.h>
  1607                 ],[
  1608                   pthread_mutexattr_t attr;
  1609                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1610                 ],[
  1611                 has_recursive_mutexes=yes
  1612                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1613                 ])
  1614             fi
  1615             if test x$has_recursive_mutexes = xno; then
  1616                 AC_TRY_COMPILE([
  1617                   #include <pthread.h>
  1618                 ],[
  1619                   pthread_mutexattr_t attr;
  1620                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1621                 ],[
  1622                 has_recursive_mutexes=yes
  1623                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1624                 ])
  1625             fi
  1626             AC_MSG_RESULT($has_recursive_mutexes)
  1627 
  1628             # Check to see if pthread semaphore support is missing
  1629             if test x$enable_pthread_sem = xyes; then
  1630                 AC_MSG_CHECKING(for pthread semaphores)
  1631                 have_pthread_sem=no
  1632                 AC_TRY_COMPILE([
  1633                   #include <pthread.h>
  1634                   #include <semaphore.h>
  1635                 ],[
  1636                 ],[
  1637                 have_pthread_sem=yes
  1638                 ])
  1639                 AC_MSG_RESULT($have_pthread_sem)
  1640             fi
  1641 
  1642             # Restore the compiler flags and libraries
  1643             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1644 
  1645             # Basic thread creation functions
  1646             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1647 
  1648             # Semaphores
  1649             # We can fake these with mutexes and condition variables if necessary
  1650             if test x$have_pthread_sem = xyes; then
  1651                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1652             else
  1653                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1654             fi
  1655 
  1656             # Mutexes
  1657             # We can fake these with semaphores if necessary
  1658             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1659 
  1660             # Condition variables
  1661             # We can fake these with semaphores and mutexes if necessary
  1662             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1663 
  1664             have_threads=yes
  1665         else
  1666             CheckPTH
  1667         fi
  1668     fi
  1669 }
  1670 
  1671 dnl Determine whether the compiler can produce Win32 executables
  1672 CheckWIN32()
  1673 {
  1674     AC_MSG_CHECKING(Win32 compiler)
  1675     have_win32_gcc=no
  1676     AC_TRY_COMPILE([
  1677      #include <windows.h>
  1678     ],[
  1679     ],[
  1680     have_win32_gcc=yes
  1681     ])
  1682     AC_MSG_RESULT($have_win32_gcc)
  1683     if test x$have_win32_gcc != xyes; then
  1684        AC_MSG_ERROR([
  1685 *** Your compiler ($CC) does not produce Win32 executables!
  1686        ])
  1687     fi
  1688 
  1689     dnl See if the user wants to redirect standard output to files
  1690     AC_ARG_ENABLE(stdio-redirect,
  1691 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [default=yes]]),
  1692                   , enable_stdio_redirect=yes)
  1693     if test x$enable_stdio_redirect != xyes; then
  1694         BUILD_CFLAGS="$BUILD_CFLAGS -DNO_STDIO_REDIRECT"
  1695     fi
  1696 
  1697     if test x$enable_video = xyes; then
  1698         AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
  1699         SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
  1700         SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
  1701         have_video=yes
  1702     fi
  1703 }
  1704 
  1705 dnl Find the DirectX includes and libraries
  1706 CheckDIRECTX()
  1707 {
  1708     AC_ARG_ENABLE(directx,
  1709 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [default=yes]]),
  1710                   , enable_directx=yes)
  1711     if test x$enable_directx = xyes; then
  1712         have_directx=no
  1713         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1714         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1715         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1716         if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
  1717             have_directx=yes
  1718         fi
  1719         if test x$enable_video = xyes -a x$have_directx = xyes; then
  1720             AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
  1721             SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
  1722             have_video=yes
  1723         fi
  1724     fi
  1725 }
  1726 
  1727 dnl Check for the dlfcn.h interface for dynamically loading objects
  1728 CheckDLOPEN()
  1729 {
  1730     AC_ARG_ENABLE(sdl-dlopen,
  1731 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [default=yes]]),
  1732                   , enable_sdl_dlopen=yes)
  1733     if test x$enable_sdl_dlopen = xyes; then
  1734         AC_MSG_CHECKING(for dlopen)
  1735         have_dlopen=no
  1736         AC_TRY_COMPILE([
  1737          #include <dlfcn.h>
  1738         ],[
  1739         ],[
  1740         have_dlopen=yes
  1741         ])
  1742         AC_MSG_RESULT($have_dlopen)
  1743 
  1744         if test x$have_dlopen = xyes; then
  1745             AC_CHECK_LIB(c, dlopen, BUILD_LDFLAGS="$BUILD_LDFLAGS",
  1746                AC_CHECK_LIB(dl, dlopen, BUILD_LDFLAGS="$BUILD_LDFLAGS -ldl",
  1747                   AC_CHECK_LIB(ltdl, dlopen, BUILD_LDFLAGS="$BUILD_LDFLAGS -lltdl")))
  1748             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1749             if test x$have_dlvsym = xyes; then
  1750                 AC_DEFINE(HAVE_DLVSYM)
  1751             fi
  1752             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1753             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1754             have_loadso=yes
  1755         fi
  1756     fi
  1757 }
  1758 
  1759 dnl Set up the Atari LDG (shared object loader)
  1760 CheckAtariLdg()
  1761 {
  1762     AC_ARG_ENABLE(atari-ldg,
  1763 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [default=yes]]),
  1764                   , enable_atari_ldg=yes)
  1765     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1766         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1767         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1768         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1769             AC_DEFINE(SDL_LOADSO_LDG)
  1770             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1771             BUILD_LDFLAGS="$BUILD_LDFLAGS -lldg -lgem"
  1772             have_loadso=yes
  1773         fi
  1774     fi
  1775 }
  1776 
  1777 dnl Check for the usbhid(3) library on *BSD
  1778 CheckUSBHID()
  1779 {
  1780     if test x$enable_joystick = xyes; then
  1781         AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1782         AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1783         AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1784         AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1785             
  1786         AC_CHECK_LIB(usbhid, hid_init, [USB_LIBS="$USB_LIBS -lusbhid"])
  1787         AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1788 
  1789         save_CFLAGS="$CFLAGS"
  1790         CFLAGS="$CFLAGS $USB_CFLAGS"
  1791 
  1792         AC_MSG_CHECKING(for usbhid)
  1793         have_usbhid=no
  1794         AC_TRY_COMPILE([
  1795           #include <sys/types.h>
  1796           #if defined(HAVE_USB_H)
  1797           #include <usb.h>
  1798           #endif
  1799           #include <dev/usb/usb.h>
  1800           #include <dev/usb/usbhid.h>
  1801           #if defined(HAVE_USBHID_H)
  1802           #include <usbhid.h>
  1803           #elif defined(HAVE_LIBUSB_H)
  1804           #include <libusb.h>
  1805           #elif defined(HAVE_LIBUSBHID_H)
  1806           #include <libusbhid.h>
  1807           #endif
  1808         ],[
  1809           struct report_desc *repdesc;
  1810           struct usb_ctl_report *repbuf;
  1811           hid_kind_t hidkind;
  1812         ],[
  1813         have_usbhid=yes
  1814         ])
  1815         AC_MSG_RESULT($have_usbhid)
  1816 
  1817         if test x$have_usbhid = xyes; then
  1818             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1819             have_usbhid_ucr_data=no
  1820             AC_TRY_COMPILE([
  1821               #include <sys/types.h>
  1822               #if defined(HAVE_USB_H)
  1823               #include <usb.h>
  1824               #endif
  1825               #include <dev/usb/usb.h>
  1826               #include <dev/usb/usbhid.h>
  1827               #if defined(HAVE_USBHID_H)
  1828               #include <usbhid.h>
  1829               #elif defined(HAVE_LIBUSB_H)
  1830               #include <libusb.h>
  1831               #elif defined(HAVE_LIBUSBHID_H)
  1832               #include <libusbhid.h>
  1833               #endif
  1834             ],[
  1835               struct usb_ctl_report buf;
  1836               if (buf.ucr_data) { }
  1837             ],[
  1838             have_usbhid_ucr_data=yes
  1839             ])
  1840             if test x$have_usbhid_ucr_data = xyes; then
  1841                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1842             fi
  1843             AC_MSG_RESULT($have_usbhid_ucr_data)
  1844             
  1845             AC_MSG_CHECKING(for new usbhid API)
  1846             have_usbhid_new=no
  1847             AC_TRY_COMPILE([
  1848               #include <sys/types.h>
  1849               #if defined(HAVE_USB_H)
  1850               #include <usb.h>
  1851               #endif
  1852               #include <dev/usb/usb.h>
  1853               #include <dev/usb/usbhid.h>
  1854               #if defined(HAVE_USBHID_H)
  1855               #include <usbhid.h>
  1856               #elif defined(HAVE_LIBUSB_H)
  1857               #include <libusb.h>
  1858               #elif defined(HAVE_LIBUSBHID_H)
  1859               #include <libusbhid.h>
  1860               #endif
  1861             ],[
  1862               report_desc_t d;
  1863               hid_start_parse(d, 1, 1);
  1864             ],[
  1865             have_usbhid_new=yes
  1866             ])
  1867             if test x$have_usbhid_new = xyes; then
  1868                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  1869             fi
  1870             AC_MSG_RESULT($have_usbhid_new)
  1871 
  1872             AC_DEFINE(SDL_JOYSTICK_USBHID)
  1873             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  1874             BUILD_CFLAGS="$BUILD_CFLAGS $USB_CFLAGS"
  1875             BUILD_LDFLAGS="$BUILD_LDFLAGS $USB_LIBS"
  1876             have_joystick=yes
  1877         fi
  1878         CFLAGS="$save_CFLAGS"
  1879     fi
  1880 }
  1881 
  1882 dnl Check for clock_gettime()
  1883 CheckClockGettime()
  1884 {
  1885     AC_ARG_ENABLE(clock_gettime,
  1886 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=no]]),
  1887                   , enable_clock_gettime=no)
  1888     if test x$enable_clock_gettime = xyes; then
  1889         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  1890         if test x$have_clock_gettime = xyes; then
  1891             AC_DEFINE(HAVE_CLOCK_GETTIME)
  1892             BUILD_LDFLAGS="$BUILD_LDFLAGS -lrt"
  1893         fi
  1894     fi
  1895 }
  1896 
  1897 dnl Check for a valid linux/version.h
  1898 CheckLinuxVersion()
  1899 {
  1900     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  1901     if test x$have_linux_version_h = xyes; then
  1902         BUILD_CFLAGS="$BUILD_CFLAGS -DHAVE_LINUX_VERSION_H"
  1903     fi
  1904 }
  1905 
  1906 dnl Check if we want to use RPATH
  1907 CheckRPATH()
  1908 {
  1909     AC_ARG_ENABLE(rpath,
  1910 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [default=yes]]),
  1911                   , enable_rpath=yes)
  1912 }
  1913 
  1914 dnl Set up the configuration based on the target platform!
  1915 case "$target" in
  1916     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  1917         ARCH=linux
  1918         CheckDummyVideo
  1919         CheckIPod
  1920         # Set up files for the timer library
  1921         if test x$enable_timers = xyes; then
  1922             AC_DEFINE(SDL_TIMER_UNIX)
  1923             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  1924             have_timers=yes
  1925         fi
  1926         ;;
  1927     *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  1928         case "$target" in
  1929             *-*-linux*)         ARCH=linux ;;
  1930             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  1931             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  1932             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  1933             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  1934             *-*-bsdi*)          ARCH=bsdi ;;
  1935             *-*-freebsd*)       ARCH=freebsd ;;
  1936             *-*-netbsd*)        ARCH=netbsd ;;
  1937             *-*-openbsd*)       ARCH=openbsd ;;
  1938             *-*-sysv5*)         ARCH=sysv5 ;;
  1939             *-*-solaris*)       ARCH=solaris ;;
  1940             *-*-hpux*)          ARCH=hpux ;;
  1941             *-*-irix*)          ARCH=irix ;;
  1942             *-*-aix*)           ARCH=aix ;;
  1943             *-*-osf*)           ARCH=osf ;;
  1944         esac
  1945         CheckDummyVideo
  1946         CheckDiskAudio
  1947         CheckDLOPEN
  1948         CheckNASM
  1949         CheckAltivec
  1950         CheckOSS
  1951         CheckDMEDIA
  1952         CheckMME
  1953         CheckALSA
  1954         CheckARTSC
  1955         CheckESD
  1956         CheckNAS
  1957         CheckX11
  1958         CheckNANOX
  1959         CheckFBCON
  1960         CheckDirectFB
  1961         CheckPS2GS
  1962         CheckGGI
  1963         CheckSVGA
  1964         CheckVGL
  1965         CheckWscons
  1966         CheckAAlib
  1967         CheckQtopia
  1968         CheckPicoGUI
  1969         CheckOpenGLX11
  1970         CheckInputEvents
  1971         CheckTslib
  1972         CheckUSBHID
  1973         CheckPTHREAD
  1974         CheckClockGettime
  1975         CheckLinuxVersion
  1976         CheckRPATH
  1977         # Set up files for the audio library
  1978         if test x$enable_audio = xyes; then
  1979           case $ARCH in
  1980             netbsd|sysv5|solaris|hpux)
  1981                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  1982                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  1983                 have_audio=yes
  1984             ;;
  1985             openbsd)
  1986                 AC_DEFINE(SDL_AUDIO_DRIVER_OPENBSD)
  1987                 SOURCES="$SOURCES $srcdir/src/audio/openbsd/*.c"
  1988                 have_audio=yes
  1989             ;;
  1990             aix)
  1991                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
  1992                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  1993                 have_audio=yes
  1994             ;;
  1995           esac
  1996         fi
  1997         # Set up files for the joystick library
  1998         if test x$enable_joystick = xyes; then
  1999           case $ARCH in
  2000             linux)
  2001                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2002                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2003                 have_joystick=yes
  2004             ;;
  2005           esac
  2006         fi
  2007         # Set up files for the cdrom library
  2008         if test x$enable_cdrom = xyes; then
  2009           case $ARCH in
  2010             linux|solaris)
  2011                 AC_DEFINE(SDL_CDROM_LINUX)
  2012                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2013                 have_cdrom=yes
  2014             ;;
  2015             *freebsd*)
  2016                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2017                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2018                 have_cdrom=yes
  2019             ;;
  2020             *openbsd*|*netbsd*)
  2021                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2022                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2023                 have_cdrom=yes
  2024             ;;
  2025             bsdi)
  2026                 AC_DEFINE(SDL_CDROM_BSDI)
  2027                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2028                 have_cdrom=yes
  2029             ;;
  2030             aix)
  2031                 AC_DEFINE(SDL_CDROM_AIX)
  2032                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2033                 have_cdrom=yes
  2034             ;;
  2035             osf)
  2036                 AC_DEFINE(SDL_CDROM_OSF)
  2037                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2038                 have_cdrom=yes
  2039             ;;
  2040           esac
  2041         fi
  2042         # Set up files for the thread library
  2043         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2044             AC_DEFINE(SDL_THREAD_SPROC)
  2045             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2046             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2047             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2048             have_threads=yes
  2049         fi
  2050         # Set up files for the timer library
  2051         if test x$enable_timers = xyes; then
  2052             AC_DEFINE(SDL_TIMER_UNIX)
  2053             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2054             have_timers=yes
  2055         fi
  2056         ;;
  2057     *-*-qnx*)
  2058         ARCH=qnx
  2059         CheckDummyVideo
  2060         CheckDiskAudio
  2061         # CheckNASM
  2062         CheckDLOPEN
  2063         CheckNAS
  2064         CheckPHOTON
  2065         CheckX11
  2066         CheckOpenGLX11
  2067         CheckPTHREAD
  2068         # Set up files for the audio library
  2069         if test x$enable_audio = xyes; then
  2070             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2071             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2072             BUILD_LDFLAGS="$BUILD_LDFLAGS -lasound"
  2073             have_audio=yes
  2074         fi
  2075         # Set up files for the cdrom library
  2076         if test x$enable_cdrom = xyes; then
  2077             AC_DEFINE(SDL_CDROM_QNX)
  2078             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2079             have_cdrom=yes
  2080         fi
  2081         # Set up files for the timer library
  2082         if test x$enable_timers = xyes; then
  2083             AC_DEFINE(SDL_TIMER_UNIX)
  2084             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2085             have_timers=yes
  2086         fi
  2087         ;;
  2088     *-*-cygwin* | *-*-mingw32*)
  2089         ARCH=win32
  2090         if test "$build" != "$target"; then # cross-compiling
  2091             # Default cross-compile location
  2092             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2093         else
  2094             # Look for the location of the tools and install there
  2095             if test "$BUILD_PREFIX" != ""; then
  2096                 ac_default_prefix=$BUILD_PREFIX
  2097             fi
  2098         fi
  2099         CheckDummyVideo
  2100         CheckDiskAudio
  2101         CheckWIN32
  2102         CheckWIN32GL
  2103         CheckDIRECTX
  2104         CheckNASM
  2105         # Set up files for the audio library
  2106         if test x$enable_audio = xyes; then
  2107             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2108             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2109             if test x$have_directx = xyes; then
  2110                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2111                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2112             fi
  2113             have_audio=yes
  2114         fi
  2115         # Set up files for the joystick library
  2116         if test x$enable_joystick = xyes; then
  2117             AC_DEFINE(SDL_JOYSTICK_WINMM)
  2118             SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
  2119             have_joystick=yes
  2120         fi
  2121         # Set up files for the cdrom library
  2122         if test x$enable_cdrom = xyes; then
  2123             AC_DEFINE(SDL_CDROM_WIN32)
  2124             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2125             have_cdrom=yes
  2126         fi
  2127         # Set up files for the thread library
  2128         if test x$enable_threads = xyes; then
  2129             AC_DEFINE(SDL_THREAD_WIN32)
  2130             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2131             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2132             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2133             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2134             have_threads=yes
  2135         fi
  2136         # Set up files for the timer library
  2137         if test x$enable_timers = xyes; then
  2138             AC_DEFINE(SDL_TIMER_WIN32)
  2139             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2140             have_timers=yes
  2141         fi
  2142         # Set up files for the shared object loading library
  2143         if test x$enable_loadso = xyes; then
  2144             AC_DEFINE(SDL_LOADSO_WIN32)
  2145             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2146             have_loadso=yes
  2147         fi
  2148         # Set up the system libraries we need
  2149         BUILD_LDFLAGS="$BUILD_LDFLAGS -luser32 -lgdi32 -lwinmm"
  2150         if test x$have_directx = xyes; then
  2151             BUILD_LDFLAGS="$BUILD_LDFLAGS -ldxguid"
  2152         fi
  2153         # The Win32 platform requires special setup
  2154         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2155         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2156         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2157         ;;
  2158     *-*-beos*)
  2159         ARCH=beos
  2160         ac_default_prefix=/boot/develop/tools/gnupro
  2161         CheckDummyVideo
  2162         CheckDiskAudio
  2163         CheckNASM
  2164         CheckBWINDOW
  2165         CheckBeGL
  2166         # Set up files for the audio library
  2167         if test x$enable_audio = xyes; then
  2168             AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
  2169             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2170             have_audio=yes
  2171         fi
  2172         # Set up files for the joystick library
  2173         if test x$enable_joystick = xyes; then
  2174             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2175             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2176             have_joystick=yes
  2177         fi
  2178         # Set up files for the cdrom library
  2179         if test x$enable_cdrom = xyes; then
  2180             AC_DEFINE(SDL_CDROM_BEOS)
  2181             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2182             have_cdrom=yes
  2183         fi
  2184         # Set up files for the thread library
  2185         if test x$enable_threads = xyes; then
  2186             AC_DEFINE(SDL_THREAD_BEOS)
  2187             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2188             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2189             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2190             have_threads=yes
  2191         fi
  2192         # Set up files for the timer library
  2193         if test x$enable_timers = xyes; then
  2194             AC_DEFINE(SDL_TIMER_BEOS)
  2195             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2196             have_timers=yes
  2197         fi
  2198         # Set up files for the shared object loading library
  2199         if test x$enable_loadso = xyes; then
  2200             AC_DEFINE(SDL_LOADSO_BEOS)
  2201             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2202             have_loadso=yes
  2203         fi
  2204         # The BeOS platform requires special setup.
  2205         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2206         BUILD_LDFLAGS="$BUILD_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2207         ;;
  2208     *-*-darwin* )
  2209         # This could be either full "Mac OS X", or plain "Darwin" which is
  2210         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2211         # Next line is broken, and a few files below require Mac OS X (full)
  2212         ARCH=macosx
  2213         CheckDummyVideo
  2214         CheckDiskAudio
  2215         CheckDLOPEN
  2216         CheckCOCOA
  2217         CheckCARBON
  2218         CheckX11
  2219         CheckMacGL
  2220         CheckOpenGLX11
  2221         CheckPTHREAD
  2222         CheckAltivec
  2223 
  2224         # Need this or things might misbuild on a G3.
  2225         BUILD_CFLAGS="$BUILD_CFLAGS -force_cpusubtype_ALL"
  2226 
  2227         # Set up files for the audio library
  2228         if test x$enable_audio = xyes; then
  2229             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2230             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2231             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2232             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2233             have_audio=yes
  2234         fi
  2235         # Set up files for the joystick library
  2236         if test x$enable_joystick = xyes; then
  2237             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2238             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2239             BUILD_LDFLAGS="$BUILD_LDFLAGS -framework IOKit"
  2240             have_joystick=yes
  2241         fi
  2242         # Set up files for the cdrom library
  2243         if test x$enable_cdrom = xyes; then
  2244             AC_DEFINE(SDL_CDROM_MACOSX)
  2245             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2246             have_cdrom=yes
  2247         fi
  2248         # Set up files for the timer library
  2249         if test x$enable_timers = xyes; then
  2250             AC_DEFINE(SDL_TIMER_UNIX)
  2251             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2252             have_timers=yes
  2253         fi
  2254         # Set up files for the shared object loading library
  2255         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2256             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2257             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2258             have_loadso=yes
  2259         fi
  2260         # The MacOS X platform requires special setup.
  2261         SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
  2262         BUILD_CFLAGS="$BUILD_CFLAGS -fpascal-strings"
  2263         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2264         if test x$enable_video_cocoa = xyes; then
  2265             BUILD_LDFLAGS="$BUILD_LDFLAGS -framework Cocoa"
  2266         fi
  2267         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
  2268             # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2269             BUILD_LDFLAGS="$BUILD_LDFLAGS -framework QuickTime -framework ApplicationServices"
  2270             BUILD_LDFLAGS="$BUILD_LDFLAGS -framework Carbon"
  2271         fi
  2272         # If either the audio or CD driver is used, add the AudioUnit framework
  2273         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2274             BUILD_LDFLAGS="$BUILD_LDFLAGS -framework AudioToolbox -framework AudioUnit"
  2275         fi
  2276         ;;
  2277     *-*-mint*)
  2278         ARCH=mint
  2279         CheckDummyVideo
  2280         CheckDiskAudio
  2281         CheckAtariBiosEvent
  2282         CheckAtariXbiosVideo
  2283         CheckAtariGemVideo
  2284         CheckAtariAudio
  2285         CheckAtariLdg
  2286         CheckAtariOSMesa
  2287         CheckPTH
  2288         # Set up files for the audio library
  2289         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2290             if test x$enable_audio = xyes; then
  2291                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2292                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2293                 have_audio=yes
  2294             fi
  2295         fi
  2296         # Set up files for the joystick library
  2297         if test x$enable_joystick = xyes; then
  2298             AC_DEFINE(SDL_JOYSTICK_MINT)
  2299             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2300             have_joystick=yes
  2301         fi
  2302         # Set up files for the cdrom library
  2303         if test x$enable_cdrom = xyes; then
  2304             AC_DEFINE(SDL_CDROM_MINT)
  2305             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2306             have_cdrom=yes
  2307         fi
  2308         # Set up files for the timer library
  2309         if test x$enable_timers = xyes; then
  2310             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2311                 AC_DEFINE(SDL_TIMER_UNIX)
  2312                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2313             else
  2314                 AC_DEFINE(SDL_TIMER_MINT)
  2315                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2316             fi
  2317             have_timers=yes
  2318         fi
  2319         ;;
  2320     *-riscos)
  2321         ARCH=riscos
  2322         CheckOSS
  2323         CheckPTHREAD
  2324         # Set up files for the video library
  2325         if test x$enable_video = xyes; then
  2326             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2327             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2328             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2329             have_video=yes
  2330         fi
  2331         # Set up files for the joystick library
  2332         if test x$enable_joystick = xyes; then
  2333             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2334             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2335             have_joystick=yes
  2336         fi
  2337         # Set up files for the timer library
  2338         if test x$enable_timers = xyes; then
  2339             AC_DEFINE(SDL_TIMER_RISCOS)
  2340             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2341             have_timers=yes
  2342         fi
  2343         # The RISC OS platform requires special setup.
  2344         BUILD_LDFLAGS="$BUILD_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2345         ;;
  2346     *)
  2347         AC_MSG_ERROR([
  2348 *** Unsupported target:  Please add to configure.in
  2349         ])
  2350         ;;
  2351 esac
  2352 
  2353 # Verify that we have all the platform specific files we need
  2354 if test x$have_joystick != xyes; then
  2355     if test x$enable_joystick = xyes; then
  2356         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2357     fi
  2358     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2359 fi
  2360 if test x$have_cdrom != xyes; then
  2361     if test x$enable_cdrom = xyes; then
  2362         AC_DEFINE(SDL_CDROM_DISABLED)
  2363     fi
  2364     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2365 fi
  2366 if test x$have_threads != xyes; then
  2367     if test x$enable_threads = xyes; then
  2368         AC_DEFINE(SDL_THREADS_DISABLED)
  2369     fi
  2370     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2371 fi
  2372 if test x$have_timers != xyes; then
  2373     if test x$enable_timers = xyes; then
  2374         AC_DEFINE(SDL_TIMERS_DISABLED)
  2375     fi
  2376     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2377 fi
  2378 if test x$have_loadso != xyes; then
  2379     if test x$enable_loadso = xyes; then
  2380         AC_DEFINE(SDL_LOADSO_DISABLED)
  2381     fi
  2382     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2383 fi
  2384 if test x$SDLMAIN_SOURCES = x; then
  2385     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2386 fi
  2387 
  2388 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2389 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2390 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2391 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2392 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2393 
  2394 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2395 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
  2396 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2397 
  2398 # Set runtime shared library paths as needed
  2399 
  2400 if test "x$enable_rpath" = "xyes"; then
  2401   if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi -o $ARCH = irix; then
  2402     SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2403   fi
  2404   if test $ARCH = solaris; then
  2405     SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2406   fi
  2407 else
  2408   SDL_RLD_FLAGS=""
  2409 fi
  2410 
  2411 case "$ARCH" in
  2412   openbsd | netbsd | bsdi)
  2413     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2414     ;;
  2415   qnx)
  2416     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2417     ;;
  2418   macosx)
  2419     SHARED_SYSTEM_LIBS=""
  2420     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2421       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Cocoa"
  2422     fi
  2423     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  2424       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Carbon"
  2425     fi
  2426     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2427       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
  2428     fi
  2429     ;;
  2430   *)
  2431     SHARED_SYSTEM_LIBS=""
  2432     ;;
  2433 esac
  2434 
  2435 case "$ARCH" in
  2436   macosx)
  2437     # Evil hack to allow static linking on Mac OS X
  2438     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a"
  2439     ;;
  2440   *)
  2441     SDL_STATIC_LIBS="$SDL_LIBS"
  2442     ;;
  2443 esac
  2444 
  2445 STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
  2446 
  2447 dnl Expand the cflags and libraries needed by apps using SDL
  2448 AC_SUBST(SDL_CFLAGS)
  2449 AC_SUBST(SDL_LIBS)
  2450 AC_SUBST(SDL_STATIC_LIBS)
  2451 AC_SUBST(SDL_RLD_FLAGS)
  2452 if test x$enable_shared = xyes; then
  2453     ENABLE_SHARED_TRUE=
  2454     ENABLE_SHARED_FALSE="#"
  2455 else
  2456     ENABLE_SHARED_TRUE="#"
  2457     ENABLE_SHARED_FALSE=
  2458 fi
  2459 if test x$enable_static = xyes; then
  2460     ENABLE_STATIC_TRUE=
  2461     ENABLE_STATIC_FALSE="#"
  2462 else
  2463     ENABLE_STATIC_TRUE="#"
  2464     ENABLE_STATIC_FALSE=
  2465 fi
  2466 AC_SUBST(ENABLE_SHARED_TRUE)
  2467 AC_SUBST(ENABLE_SHARED_FALSE)
  2468 AC_SUBST(ENABLE_STATIC_TRUE)
  2469 AC_SUBST(ENABLE_STATIC_FALSE)
  2470 
  2471 dnl Expand the libraries needed for static and dynamic linking
  2472 AC_SUBST(STATIC_SYSTEM_LIBS)
  2473 AC_SUBST(SHARED_SYSTEM_LIBS)
  2474 AC_SUBST(SYSTEM_LIBS)
  2475 
  2476 dnl Expand the sources and objects needed to build the library
  2477 AC_SUBST(ac_aux_dir)
  2478 AC_SUBST(INCLUDE)
  2479 AC_SUBST(SOURCES)
  2480 AC_SUBST(OBJECTS)
  2481 AC_SUBST(SDLMAIN_SOURCES)
  2482 AC_SUBST(SDLMAIN_OBJECTS)
  2483 AC_SUBST(BUILD_CFLAGS)
  2484 AC_SUBST(BUILD_LDFLAGS)
  2485 
  2486 AC_OUTPUT([
  2487     Makefile sdl-config SDL.spec SDL.qpg
  2488 ], [
  2489     : >build-deps
  2490     make depend
  2491 ])