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