configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 21 May 2006 17:26:40 +0000
changeset 1855 5ff2c01e475e
parent 1854 2280e314a978
child 1865 d688ac43a76b
permissions -rw-r--r--
Moved DirectInput joystick code to 1.3 branch
     1 dnl Process this file with autoconf to produce a configure script.
     2 AC_INIT(README)
     3 AC_CONFIG_HEADER(include/SDL_config.h)
     4 AC_GNU_SOURCE
     5 
     6 dnl Set various version strings - taken gratefully from the GTk sources
     7 #
     8 # Making releases:
     9 # Edit include/SDL/SDL_version.h and change the version, then:
    10 #   SDL_MICRO_VERSION += 1;
    11 #   SDL_INTERFACE_AGE += 1;
    12 #   SDL_BINARY_AGE += 1;
    13 # if any functions have been added, set SDL_INTERFACE_AGE to 0.
    14 # if backwards compatibility has been broken,
    15 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
    16 #
    17 SDL_MAJOR_VERSION=1
    18 SDL_MINOR_VERSION=2
    19 SDL_MICRO_VERSION=10
    20 SDL_INTERFACE_AGE=3
    21 SDL_BINARY_AGE=10
    22 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
    23 
    24 AC_SUBST(SDL_MAJOR_VERSION)
    25 AC_SUBST(SDL_MINOR_VERSION)
    26 AC_SUBST(SDL_MICRO_VERSION)
    27 AC_SUBST(SDL_INTERFACE_AGE)
    28 AC_SUBST(SDL_BINARY_AGE)
    29 AC_SUBST(SDL_VERSION)
    30 
    31 # libtool versioning
    32 LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
    33 LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
    34 LT_REVISION=$SDL_INTERFACE_AGE
    35 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
    36 
    37 AC_SUBST(LT_RELEASE)
    38 AC_SUBST(LT_CURRENT)
    39 AC_SUBST(LT_REVISION)
    40 AC_SUBST(LT_AGE)
    41 
    42 dnl Detect the canonical 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 Check for Mesa offscreen rendering
  1503 CheckAtariOSMesa()
  1504 {
  1505     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1506         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1507         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1508 
  1509         # Static linking to -lOSMesa
  1510         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1511         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1512             # -lOSMesa is really the static library
  1513             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1514                 OSMESA_LIBS="-lOSMesa"
  1515             fi
  1516         else
  1517             # -lOSMesa is a loader for OSMesa.ldg
  1518             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1519             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1520         fi
  1521         AC_DEFINE(SDL_VIDEO_OPENGL)
  1522         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1523         SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
  1524         SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
  1525 
  1526         AC_ARG_ENABLE(osmesa-shared,
  1527 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]),
  1528                               , enable_osmesa_shared=yes)
  1529         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1530             # Dynamic linking
  1531             if test "x$have_osmesa_hdr" = "xyes"; then
  1532                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1533             fi
  1534         fi
  1535     fi
  1536 }
  1537 
  1538 dnl See if we can use the new unified event interface in Linux 2.4
  1539 CheckInputEvents()
  1540 {
  1541     dnl Check for Linux 2.4 unified input event interface support
  1542     AC_ARG_ENABLE(input-events,
  1543 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1544                   , enable_input_events=yes)
  1545     if test x$enable_input_events = xyes; then
  1546         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1547         use_input_events=no
  1548         AC_TRY_COMPILE([
  1549           #include <linux/input.h>
  1550         ],[
  1551           #ifndef EVIOCGNAME
  1552           #error EVIOCGNAME() ioctl not available
  1553           #endif
  1554         ],[
  1555         use_input_events=yes
  1556         ])
  1557         AC_MSG_RESULT($use_input_events)
  1558         if test x$use_input_events = xyes; then
  1559             AC_DEFINE(SDL_INPUT_LINUXEV)
  1560         fi
  1561     fi
  1562 }
  1563 
  1564 dnl See if we can use the Touchscreen input library
  1565 CheckTslib()
  1566 {
  1567     AC_ARG_ENABLE(input-tslib,
  1568 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1569                   , enable_input_tslib=yes)
  1570     if test x$enable_input_tslib = xyes; then
  1571         AC_MSG_CHECKING(for Touchscreen library support)
  1572         enable_input_tslib=no
  1573         AC_TRY_COMPILE([
  1574           #include "tslib.h"
  1575         ],[
  1576         ],[
  1577         enable_input_tslib=yes
  1578         ])
  1579         AC_MSG_RESULT($enable_input_tslib)
  1580         if test x$enable_input_tslib = xyes; then
  1581             AC_DEFINE(SDL_INPUT_TSLIB)
  1582             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1583         fi
  1584     fi
  1585 }
  1586 
  1587 dnl See if we can use GNU pth library for threads
  1588 CheckPTH()
  1589 {
  1590     dnl Check for pth support
  1591     AC_ARG_ENABLE(pth,
  1592 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
  1593                   , enable_pth=yes)
  1594     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1595         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1596         if test "$PTH_CONFIG" = "no"; then
  1597             use_pth=no
  1598         else
  1599             use_pth=yes
  1600         fi
  1601         AC_MSG_CHECKING(pth)
  1602         AC_MSG_RESULT($use_pth)
  1603         if test "x$use_pth" = xyes; then
  1604             AC_DEFINE(SDL_THREAD_PTH)
  1605             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1606             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1607             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1608             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1609             have_threads=yes
  1610         fi
  1611     fi
  1612 }
  1613 
  1614 dnl See what type of thread model to use on Linux and Solaris
  1615 CheckPTHREAD()
  1616 {
  1617     dnl Check for pthread support
  1618     AC_ARG_ENABLE(pthreads,
  1619 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1620                   , enable_pthreads=yes)
  1621     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1622     AC_ARG_ENABLE(pthread-sem,
  1623 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1624                   , enable_pthread_sem=yes)
  1625     case "$host" in
  1626         *-*-linux*|*-*-uclinux*)
  1627             pthread_cflags="-D_REENTRANT"
  1628             pthread_lib="-lpthread"
  1629             ;;
  1630         *-*-bsdi*)
  1631             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1632             pthread_lib=""
  1633             ;;
  1634         *-*-darwin*)
  1635             pthread_cflags="-D_THREAD_SAFE"
  1636 # causes Carbon.p complaints?
  1637 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1638             ;;
  1639         *-*-freebsd*|*-*-dragonfly*)
  1640             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1641             pthread_lib="-pthread"
  1642             ;;
  1643         *-*-netbsd*)
  1644             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1645             pthread_lib="-L/usr/lib -lpthread"
  1646             ;;
  1647         *-*-openbsd*)
  1648             pthread_cflags="-D_REENTRANT"
  1649             pthread_lib="-pthread"
  1650             ;;
  1651         *-*-solaris*)
  1652             pthread_cflags="-D_REENTRANT"
  1653             pthread_lib="-lpthread -lposix4"
  1654             ;;
  1655         *-*-sysv5*)
  1656             pthread_cflags="-D_REENTRANT -Kthread"
  1657             pthread_lib=""
  1658             ;;
  1659         *-*-irix*)
  1660             pthread_cflags="-D_SGI_MP_SOURCE"
  1661             pthread_lib="-lpthread"
  1662             ;;
  1663         *-*-aix*)
  1664             pthread_cflags="-D_REENTRANT -mthreads"
  1665             pthread_lib="-lpthread"
  1666             ;;
  1667         *-*-hpux11*)
  1668             pthread_cflags="-D_REENTRANT"
  1669             pthread_lib="-L/usr/lib -lpthread"
  1670             ;;
  1671         *-*-qnx*)
  1672             pthread_cflags=""
  1673             pthread_lib=""
  1674             ;;
  1675         *-*-osf*)
  1676             pthread_cflags="-D_REENTRANT"
  1677             if test x$ac_cv_prog_gcc = xyes; then
  1678                 pthread_lib="-lpthread -lrt"
  1679             else
  1680                 pthread_lib="-lpthread -lexc -lrt"
  1681             fi
  1682             ;;
  1683         *)
  1684             pthread_cflags="-D_REENTRANT"
  1685             pthread_lib="-lpthread"
  1686             ;;
  1687     esac
  1688     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1689         # Save the original compiler flags and libraries
  1690         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1691         # Add the pthread compiler flags and libraries
  1692         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1693         # Check to see if we have pthread support on this system
  1694         AC_MSG_CHECKING(for pthreads)
  1695         use_pthreads=no
  1696         AC_TRY_LINK([
  1697          #include <pthread.h>
  1698         ],[
  1699          pthread_attr_t type;
  1700          pthread_attr_init(&type);
  1701         ],[
  1702         use_pthreads=yes
  1703         ])
  1704         AC_MSG_RESULT($use_pthreads)
  1705         # Restore the compiler flags and libraries
  1706         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1707 
  1708         # Do futher testing if we have pthread support...
  1709         if test x$use_pthreads = xyes; then
  1710             AC_DEFINE(SDL_THREAD_PTHREAD)
  1711             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1712             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1713             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1714             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1715 
  1716             # Save the original compiler flags and libraries
  1717             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1718             # Add the pthread compiler flags and libraries
  1719             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1720 
  1721             # Check to see if recursive mutexes are available
  1722             AC_MSG_CHECKING(for recursive mutexes)
  1723             has_recursive_mutexes=no
  1724             if test x$has_recursive_mutexes = xno; then
  1725                 AC_TRY_COMPILE([
  1726                   #include <pthread.h>
  1727                 ],[
  1728                   pthread_mutexattr_t attr;
  1729                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1730                 ],[
  1731                 has_recursive_mutexes=yes
  1732                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1733                 ])
  1734             fi
  1735             if test x$has_recursive_mutexes = xno; then
  1736                 AC_TRY_COMPILE([
  1737                   #include <pthread.h>
  1738                 ],[
  1739                   pthread_mutexattr_t attr;
  1740                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1741                 ],[
  1742                 has_recursive_mutexes=yes
  1743                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1744                 ])
  1745             fi
  1746             AC_MSG_RESULT($has_recursive_mutexes)
  1747 
  1748             # Check to see if pthread semaphore support is missing
  1749             if test x$enable_pthread_sem = xyes; then
  1750                 AC_MSG_CHECKING(for pthread semaphores)
  1751                 have_pthread_sem=no
  1752                 AC_TRY_COMPILE([
  1753                   #include <pthread.h>
  1754                   #include <semaphore.h>
  1755                 ],[
  1756                 ],[
  1757                 have_pthread_sem=yes
  1758                 ])
  1759                 AC_MSG_RESULT($have_pthread_sem)
  1760             fi
  1761 
  1762             # Restore the compiler flags and libraries
  1763             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1764 
  1765             # Basic thread creation functions
  1766             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1767 
  1768             # Semaphores
  1769             # We can fake these with mutexes and condition variables if necessary
  1770             if test x$have_pthread_sem = xyes; then
  1771                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1772             else
  1773                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1774             fi
  1775 
  1776             # Mutexes
  1777             # We can fake these with semaphores if necessary
  1778             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1779 
  1780             # Condition variables
  1781             # We can fake these with semaphores and mutexes if necessary
  1782             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1783 
  1784             have_threads=yes
  1785         else
  1786             CheckPTH
  1787         fi
  1788     fi
  1789 }
  1790 
  1791 dnl Determine whether the compiler can produce Win32 executables
  1792 CheckWIN32()
  1793 {
  1794     AC_MSG_CHECKING(Win32 compiler)
  1795     have_win32_gcc=no
  1796     AC_TRY_COMPILE([
  1797      #include <windows.h>
  1798     ],[
  1799     ],[
  1800     have_win32_gcc=yes
  1801     ])
  1802     AC_MSG_RESULT($have_win32_gcc)
  1803     if test x$have_win32_gcc != xyes; then
  1804        AC_MSG_ERROR([
  1805 *** Your compiler ($CC) does not produce Win32 executables!
  1806        ])
  1807     fi
  1808 
  1809     dnl See if the user wants to redirect standard output to files
  1810     AC_ARG_ENABLE(stdio-redirect,
  1811 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  1812                   , enable_stdio_redirect=yes)
  1813     if test x$enable_stdio_redirect != xyes; then
  1814         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  1815     fi
  1816 
  1817     if test x$enable_video = xyes; then
  1818         AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
  1819         SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
  1820         SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
  1821         have_video=yes
  1822     fi
  1823 }
  1824 
  1825 dnl Find the DirectX includes and libraries
  1826 CheckDIRECTX()
  1827 {
  1828     AC_ARG_ENABLE(directx,
  1829 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  1830                   , enable_directx=yes)
  1831     if test x$enable_directx = xyes; then
  1832         have_directx=no
  1833         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1834         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1835         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1836         if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
  1837             have_directx=yes
  1838         fi
  1839         if test x$enable_video = xyes -a x$have_directx = xyes; then
  1840             AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
  1841             SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
  1842             have_video=yes
  1843         fi
  1844     fi
  1845 }
  1846 
  1847 dnl Check for the dlfcn.h interface for dynamically loading objects
  1848 CheckDLOPEN()
  1849 {
  1850     AC_ARG_ENABLE(sdl-dlopen,
  1851 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1852                   , enable_sdl_dlopen=yes)
  1853     if test x$enable_sdl_dlopen = xyes; then
  1854         AC_MSG_CHECKING(for dlopen)
  1855         have_dlopen=no
  1856         AC_TRY_COMPILE([
  1857          #include <dlfcn.h>
  1858         ],[
  1859          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1860          #error Use dlcompat for Mac OS X 10.2 compatibility
  1861          #endif
  1862         ],[
  1863         have_dlopen=yes
  1864         ])
  1865         AC_MSG_RESULT($have_dlopen)
  1866 
  1867         if test x$have_dlopen = xyes; then
  1868             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1869                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1870                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1871             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1872             if test x$have_dlvsym = xyes; then
  1873                 AC_DEFINE(HAVE_DLVSYM)
  1874             fi
  1875             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1876             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1877             have_loadso=yes
  1878         fi
  1879     fi
  1880 }
  1881 
  1882 dnl Set up the Atari LDG (shared object loader)
  1883 CheckAtariLdg()
  1884 {
  1885     AC_ARG_ENABLE(atari-ldg,
  1886 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]),
  1887                   , enable_atari_ldg=yes)
  1888     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1889         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1890         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1891         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1892             AC_DEFINE(SDL_LOADSO_LDG)
  1893             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1894             SDL_LIBS="$SDL_LIBS -lldg -lgem"
  1895             have_loadso=yes
  1896         fi
  1897     fi
  1898 }
  1899 
  1900 dnl Check for the usbhid(3) library on *BSD
  1901 CheckUSBHID()
  1902 {
  1903     if test x$enable_joystick = xyes; then
  1904         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1905         if test x$have_libusbhid = xyes; then
  1906             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1907             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1908             USB_LIBS="$USB_LIBS -lusbhid"
  1909         else
  1910             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1911             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1912             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1913         fi
  1914             
  1915         save_CFLAGS="$CFLAGS"
  1916         CFLAGS="$CFLAGS $USB_CFLAGS"
  1917 
  1918         AC_MSG_CHECKING(for usbhid)
  1919         have_usbhid=no
  1920         AC_TRY_COMPILE([
  1921           #include <sys/types.h>
  1922           #if defined(HAVE_USB_H)
  1923           #include <usb.h>
  1924           #endif
  1925           #ifdef __DragonFly__
  1926           # include <bus/usb/usb.h>
  1927           # include <bus/usb/usbhid.h>
  1928           #else
  1929           # include <dev/usb/usb.h>
  1930           # include <dev/usb/usbhid.h>
  1931           #endif
  1932           #if defined(HAVE_USBHID_H)
  1933           #include <usbhid.h>
  1934           #elif defined(HAVE_LIBUSB_H)
  1935           #include <libusb.h>
  1936           #elif defined(HAVE_LIBUSBHID_H)
  1937           #include <libusbhid.h>
  1938           #endif
  1939         ],[
  1940           struct report_desc *repdesc;
  1941           struct usb_ctl_report *repbuf;
  1942           hid_kind_t hidkind;
  1943         ],[
  1944         have_usbhid=yes
  1945         ])
  1946         AC_MSG_RESULT($have_usbhid)
  1947 
  1948         if test x$have_usbhid = xyes; then
  1949             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1950             have_usbhid_ucr_data=no
  1951             AC_TRY_COMPILE([
  1952               #include <sys/types.h>
  1953               #if defined(HAVE_USB_H)
  1954               #include <usb.h>
  1955               #endif
  1956               #ifdef __DragonFly__
  1957               # include <bus/usb/usb.h>
  1958               # include <bus/usb/usbhid.h>
  1959               #else
  1960               # include <dev/usb/usb.h>
  1961               # include <dev/usb/usbhid.h>
  1962               #endif
  1963               #if defined(HAVE_USBHID_H)
  1964               #include <usbhid.h>
  1965               #elif defined(HAVE_LIBUSB_H)
  1966               #include <libusb.h>
  1967               #elif defined(HAVE_LIBUSBHID_H)
  1968               #include <libusbhid.h>
  1969               #endif
  1970             ],[
  1971               struct usb_ctl_report buf;
  1972               if (buf.ucr_data) { }
  1973             ],[
  1974             have_usbhid_ucr_data=yes
  1975             ])
  1976             if test x$have_usbhid_ucr_data = xyes; then
  1977                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1978             fi
  1979             AC_MSG_RESULT($have_usbhid_ucr_data)
  1980             
  1981             AC_MSG_CHECKING(for new usbhid API)
  1982             have_usbhid_new=no
  1983             AC_TRY_COMPILE([
  1984               #include <sys/types.h>
  1985               #if defined(HAVE_USB_H)
  1986               #include <usb.h>
  1987               #endif
  1988               #include <dev/usb/usb.h>
  1989               #include <dev/usb/usbhid.h>
  1990               #if defined(HAVE_USBHID_H)
  1991               #include <usbhid.h>
  1992               #elif defined(HAVE_LIBUSB_H)
  1993               #include <libusb.h>
  1994               #elif defined(HAVE_LIBUSBHID_H)
  1995               #include <libusbhid.h>
  1996               #endif
  1997             ],[
  1998               report_desc_t d;
  1999               hid_start_parse(d, 1, 1);
  2000             ],[
  2001             have_usbhid_new=yes
  2002             ])
  2003             if test x$have_usbhid_new = xyes; then
  2004                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2005             fi
  2006             AC_MSG_RESULT($have_usbhid_new)
  2007 
  2008             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2009             have_machine_joystick=no
  2010             AC_TRY_COMPILE([
  2011               #include <machine/joystick.h>
  2012             ],[
  2013               struct joystick t;
  2014             ],[
  2015             have_machine_joystick=yes
  2016             ])
  2017             if test x$have_machine_joystick = xyes; then
  2018                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2019             fi
  2020             AC_MSG_RESULT($have_machine_joystick)
  2021 
  2022             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2023             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2024             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2025             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2026             have_joystick=yes
  2027         fi
  2028         CFLAGS="$save_CFLAGS"
  2029     fi
  2030 }
  2031 
  2032 dnl Check for clock_gettime()
  2033 CheckClockGettime()
  2034 {
  2035     AC_ARG_ENABLE(clock_gettime,
  2036 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2037                   , enable_clock_gettime=no)
  2038     if test x$enable_clock_gettime = xyes; then
  2039         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2040         if test x$have_clock_gettime = xyes; then
  2041             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2042             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2043         fi
  2044     fi
  2045 }
  2046 
  2047 dnl Check for a valid linux/version.h
  2048 CheckLinuxVersion()
  2049 {
  2050     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2051     if test x$have_linux_version_h = xyes; then
  2052         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2053     fi
  2054 }
  2055 
  2056 dnl Check if we want to use RPATH
  2057 CheckRPATH()
  2058 {
  2059     AC_ARG_ENABLE(rpath,
  2060 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2061                   , enable_rpath=yes)
  2062 }
  2063 
  2064 dnl Set up the configuration based on the host platform!
  2065 case "$host" in
  2066     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2067         ARCH=linux
  2068         CheckDummyVideo
  2069         CheckIPod
  2070         # Set up files for the timer library
  2071         if test x$enable_timers = xyes; then
  2072             AC_DEFINE(SDL_TIMER_UNIX)
  2073             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2074             have_timers=yes
  2075         fi
  2076         ;;
  2077     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  2078         case "$host" in
  2079             *-*-linux*)         ARCH=linux ;;
  2080             *-*-uclinux*)       ARCH=linux ;;
  2081             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2082             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2083             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2084             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2085             *-*-bsdi*)          ARCH=bsdi ;;
  2086             *-*-freebsd*)       ARCH=freebsd ;;
  2087             *-*-dragonfly*)     ARCH=freebsd ;;
  2088             *-*-netbsd*)        ARCH=netbsd ;;
  2089             *-*-openbsd*)       ARCH=openbsd ;;
  2090             *-*-sysv5*)         ARCH=sysv5 ;;
  2091             *-*-solaris*)       ARCH=solaris ;;
  2092             *-*-hpux*)          ARCH=hpux ;;
  2093             *-*-irix*)          ARCH=irix ;;
  2094             *-*-aix*)           ARCH=aix ;;
  2095             *-*-osf*)           ARCH=osf ;;
  2096         esac
  2097         CheckVisibilityHidden
  2098         CheckDummyVideo
  2099         CheckDiskAudio
  2100         CheckDummyAudio
  2101         CheckDLOPEN
  2102         CheckNASM
  2103         CheckAltivec
  2104         CheckOSS
  2105         CheckDMEDIA
  2106         CheckMME
  2107         CheckALSA
  2108         CheckARTSC
  2109         CheckESD
  2110         CheckNAS
  2111         CheckX11
  2112         CheckNANOX
  2113         CheckFBCON
  2114         CheckDirectFB
  2115         CheckPS2GS
  2116         CheckGGI
  2117         CheckSVGA
  2118         CheckVGL
  2119         CheckWscons
  2120         CheckAAlib
  2121         CheckQtopia
  2122         CheckPicoGUI
  2123         CheckOpenGLX11
  2124         CheckInputEvents
  2125         CheckTslib
  2126         CheckUSBHID
  2127         CheckPTHREAD
  2128         CheckClockGettime
  2129         CheckLinuxVersion
  2130         CheckRPATH
  2131         # Set up files for the audio library
  2132         if test x$enable_audio = xyes; then
  2133           case $ARCH in
  2134             sysv5|solaris|hpux)
  2135                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2136                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2137                 have_audio=yes
  2138             ;;
  2139             netbsd|openbsd)
  2140                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2141                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2142                 have_audio=yes
  2143             ;;
  2144             aix)
  2145                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
  2146                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2147                 have_audio=yes
  2148             ;;
  2149           esac
  2150         fi
  2151         # Set up files for the joystick library
  2152         if test x$enable_joystick = xyes; then
  2153           case $ARCH in
  2154             linux)
  2155                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2156                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2157                 have_joystick=yes
  2158             ;;
  2159           esac
  2160         fi
  2161         # Set up files for the cdrom library
  2162         if test x$enable_cdrom = xyes; then
  2163           case $ARCH in
  2164             linux|solaris)
  2165                 AC_DEFINE(SDL_CDROM_LINUX)
  2166                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2167                 have_cdrom=yes
  2168             ;;
  2169             *freebsd*)
  2170                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2171                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2172                 have_cdrom=yes
  2173             ;;
  2174             *openbsd*|*netbsd*)
  2175                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2176                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2177                 have_cdrom=yes
  2178             ;;
  2179             bsdi)
  2180                 AC_DEFINE(SDL_CDROM_BSDI)
  2181                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2182                 have_cdrom=yes
  2183             ;;
  2184             aix)
  2185                 AC_DEFINE(SDL_CDROM_AIX)
  2186                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2187                 have_cdrom=yes
  2188             ;;
  2189             osf)
  2190                 AC_DEFINE(SDL_CDROM_OSF)
  2191                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2192                 have_cdrom=yes
  2193             ;;
  2194           esac
  2195         fi
  2196         # Set up files for the thread library
  2197         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2198             AC_DEFINE(SDL_THREAD_SPROC)
  2199             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2200             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2201             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2202             have_threads=yes
  2203         fi
  2204         # Set up files for the timer library
  2205         if test x$enable_timers = xyes; then
  2206             AC_DEFINE(SDL_TIMER_UNIX)
  2207             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2208             have_timers=yes
  2209         fi
  2210         ;;
  2211     *-*-qnx*)
  2212         ARCH=qnx
  2213         CheckDummyVideo
  2214         CheckDiskAudio
  2215         CheckDummyAudio
  2216         # CheckNASM
  2217         CheckDLOPEN
  2218         CheckNAS
  2219         CheckPHOTON
  2220         CheckX11
  2221         CheckOpenGLX11
  2222         CheckPTHREAD
  2223         # Set up files for the audio library
  2224         if test x$enable_audio = xyes; then
  2225             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2226             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2227             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2228             have_audio=yes
  2229         fi
  2230         # Set up files for the cdrom library
  2231         if test x$enable_cdrom = xyes; then
  2232             AC_DEFINE(SDL_CDROM_QNX)
  2233             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2234             have_cdrom=yes
  2235         fi
  2236         # Set up files for the timer library
  2237         if test x$enable_timers = xyes; then
  2238             AC_DEFINE(SDL_TIMER_UNIX)
  2239             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2240             have_timers=yes
  2241         fi
  2242         ;;
  2243     *-*-cygwin* | *-*-mingw32*)
  2244         ARCH=win32
  2245         if test "$build" != "$host"; then # cross-compiling
  2246             # Default cross-compile location
  2247             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2248         else
  2249             # Look for the location of the tools and install there
  2250             if test "$BUILD_PREFIX" != ""; then
  2251                 ac_default_prefix=$BUILD_PREFIX
  2252             fi
  2253         fi
  2254         CheckDummyVideo
  2255         CheckDiskAudio
  2256         CheckDummyAudio
  2257         CheckWIN32
  2258         CheckWIN32GL
  2259         CheckDIRECTX
  2260         CheckNASM
  2261         # Set up files for the audio library
  2262         if test x$enable_audio = xyes; then
  2263             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2264             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2265             if test x$have_directx = xyes; then
  2266                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2267                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2268             fi
  2269             have_audio=yes
  2270         fi
  2271         # Set up files for the joystick library
  2272         if test x$enable_joystick = xyes; then
  2273             AC_DEFINE(SDL_JOYSTICK_WINMM)
  2274             SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
  2275             have_joystick=yes
  2276         fi
  2277         # Set up files for the cdrom library
  2278         if test x$enable_cdrom = xyes; then
  2279             AC_DEFINE(SDL_CDROM_WIN32)
  2280             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2281             have_cdrom=yes
  2282         fi
  2283         # Set up files for the thread library
  2284         if test x$enable_threads = xyes; then
  2285             AC_DEFINE(SDL_THREAD_WIN32)
  2286             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2287             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2288             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2289             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2290             have_threads=yes
  2291         fi
  2292         # Set up files for the timer library
  2293         if test x$enable_timers = xyes; then
  2294             AC_DEFINE(SDL_TIMER_WIN32)
  2295             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2296             have_timers=yes
  2297         fi
  2298         # Set up files for the shared object loading library
  2299         if test x$enable_loadso = xyes; then
  2300             AC_DEFINE(SDL_LOADSO_WIN32)
  2301             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2302             have_loadso=yes
  2303         fi
  2304         # Set up the system libraries we need
  2305         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
  2306         if test x$have_directx = xyes; then
  2307             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
  2308         fi
  2309         # The Win32 platform requires special setup
  2310         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2311         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2312         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2313         ;;
  2314     *-*-beos*)
  2315         ARCH=beos
  2316         ac_default_prefix=/boot/develop/tools/gnupro
  2317         CheckDummyVideo
  2318         CheckDiskAudio
  2319         CheckDummyAudio
  2320         CheckNASM
  2321         CheckBWINDOW
  2322         CheckBeGL
  2323         # Set up files for the audio library
  2324         if test x$enable_audio = xyes; then
  2325             AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
  2326             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2327             have_audio=yes
  2328         fi
  2329         # Set up files for the joystick library
  2330         if test x$enable_joystick = xyes; then
  2331             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2332             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2333             have_joystick=yes
  2334         fi
  2335         # Set up files for the cdrom library
  2336         if test x$enable_cdrom = xyes; then
  2337             AC_DEFINE(SDL_CDROM_BEOS)
  2338             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2339             have_cdrom=yes
  2340         fi
  2341         # Set up files for the thread library
  2342         if test x$enable_threads = xyes; then
  2343             AC_DEFINE(SDL_THREAD_BEOS)
  2344             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2345             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2346             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2347             have_threads=yes
  2348         fi
  2349         # Set up files for the timer library
  2350         if test x$enable_timers = xyes; then
  2351             AC_DEFINE(SDL_TIMER_BEOS)
  2352             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2353             have_timers=yes
  2354         fi
  2355         # Set up files for the shared object loading library
  2356         if test x$enable_loadso = xyes; then
  2357             AC_DEFINE(SDL_LOADSO_BEOS)
  2358             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2359             have_loadso=yes
  2360         fi
  2361         # The BeOS platform requires special setup.
  2362         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2363         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2364         ;;
  2365     *-*-darwin* )
  2366         # This could be either full "Mac OS X", or plain "Darwin" which is
  2367         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2368         # Next line is broken, and a few files below require Mac OS X (full)
  2369         ARCH=macosx
  2370 
  2371         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2372         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2373         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2374 
  2375         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2376         # is -lm which is not needed under Mac OS X. But for some reasons it
  2377         # also tends to contain spurious -L switches, which we don't want to
  2378         # use here or in sdl-config. Hence we reset it.
  2379         EXTRA_LDFLAGS=""
  2380 
  2381         CheckVisibilityHidden
  2382         CheckDummyVideo
  2383         CheckDiskAudio
  2384         CheckDummyAudio
  2385         CheckDLOPEN
  2386 
  2387         # Set up files for the shared object loading library
  2388         # (this needs to be done before the dynamic X11 check)
  2389         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2390             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2391             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2392             have_loadso=yes
  2393         fi
  2394 
  2395         CheckCOCOA
  2396         CheckCARBON
  2397         CheckX11
  2398         CheckMacGL
  2399         CheckOpenGLX11
  2400         CheckPTHREAD
  2401         CheckAltivec
  2402 
  2403         # Need this or things might misbuild on a G3.
  2404         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2405 
  2406         # Set up files for the audio library
  2407         if test x$enable_audio = xyes; then
  2408             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2409             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2410             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2411             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2412             have_audio=yes
  2413         fi
  2414         # Set up files for the joystick library
  2415         if test x$enable_joystick = xyes; then
  2416             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2417             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2418             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2419             have_joystick=yes
  2420         fi
  2421         # Set up files for the cdrom library
  2422         if test x$enable_cdrom = xyes; then
  2423             AC_DEFINE(SDL_CDROM_MACOSX)
  2424             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2425             have_cdrom=yes
  2426         fi
  2427         # Set up files for the timer library
  2428         if test x$enable_timers = xyes; then
  2429             AC_DEFINE(SDL_TIMER_UNIX)
  2430             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2431             have_timers=yes
  2432         fi
  2433         # The Mac OS X platform requires special setup.
  2434         SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
  2435         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2436         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2437         if test x$enable_video_cocoa = xyes; then
  2438             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2439         fi
  2440         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
  2441             # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2442             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices"
  2443             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2444         fi
  2445         # If either the audio or CD driver is used, add the AudioUnit framework
  2446         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2447             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2448         fi
  2449         ;;
  2450     *-*-mint*)
  2451         ARCH=mint
  2452         CheckDummyVideo
  2453         CheckDiskAudio
  2454         CheckDummyAudio
  2455         CheckAtariBiosEvent
  2456         CheckAtariXbiosVideo
  2457         CheckAtariGemVideo
  2458         CheckAtariAudio
  2459         CheckAtariLdg
  2460         CheckAtariOSMesa
  2461         CheckPTH
  2462         # Set up files for the audio library
  2463         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2464             if test x$enable_audio = xyes; then
  2465                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2466                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2467                 have_audio=yes
  2468             fi
  2469         fi
  2470         # Set up files for the joystick library
  2471         if test x$enable_joystick = xyes; then
  2472             AC_DEFINE(SDL_JOYSTICK_MINT)
  2473             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2474             have_joystick=yes
  2475         fi
  2476         # Set up files for the cdrom library
  2477         if test x$enable_cdrom = xyes; then
  2478             AC_DEFINE(SDL_CDROM_MINT)
  2479             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2480             have_cdrom=yes
  2481         fi
  2482         # Set up files for the timer library
  2483         if test x$enable_timers = xyes; then
  2484             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2485                 AC_DEFINE(SDL_TIMER_UNIX)
  2486                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2487             else
  2488                 AC_DEFINE(SDL_TIMER_MINT)
  2489                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2490                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2491             fi
  2492             have_timers=yes
  2493         fi
  2494         ;;
  2495     *-riscos)
  2496         ARCH=riscos
  2497         CheckOSS
  2498         CheckPTHREAD
  2499         # Set up files for the video library
  2500         if test x$enable_video = xyes; then
  2501             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2502             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2503             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2504             have_video=yes
  2505         fi
  2506         # Set up files for the joystick library
  2507         if test x$enable_joystick = xyes; then
  2508             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2509             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2510             have_joystick=yes
  2511         fi
  2512         # Set up files for the timer library
  2513         if test x$enable_timers = xyes; then
  2514             AC_DEFINE(SDL_TIMER_RISCOS)
  2515             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2516             have_timers=yes
  2517         fi
  2518         # The RISC OS platform requires special setup.
  2519         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2520         ;;
  2521     *)
  2522         AC_MSG_ERROR([
  2523 *** Unsupported host:  Please add to configure.in
  2524         ])
  2525         ;;
  2526 esac
  2527 
  2528 # Verify that we have all the platform specific files we need
  2529 if test x$have_joystick != xyes; then
  2530     if test x$enable_joystick = xyes; then
  2531         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2532     fi
  2533     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2534 fi
  2535 if test x$have_cdrom != xyes; then
  2536     if test x$enable_cdrom = xyes; then
  2537         AC_DEFINE(SDL_CDROM_DISABLED)
  2538     fi
  2539     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2540 fi
  2541 if test x$have_threads != xyes; then
  2542     if test x$enable_threads = xyes; then
  2543         AC_DEFINE(SDL_THREADS_DISABLED)
  2544     fi
  2545     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2546 fi
  2547 if test x$have_timers != xyes; then
  2548     if test x$enable_timers = xyes; then
  2549         AC_DEFINE(SDL_TIMERS_DISABLED)
  2550     fi
  2551     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2552 fi
  2553 if test x$have_loadso != xyes; then
  2554     if test x$enable_loadso = xyes; then
  2555         AC_DEFINE(SDL_LOADSO_DISABLED)
  2556     fi
  2557     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2558 fi
  2559 if test x$SDLMAIN_SOURCES = x; then
  2560     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2561 fi
  2562 
  2563 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2564 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2565 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2566 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2567 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2568 
  2569 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2570 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
  2571 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2572 
  2573 # Set runtime shared library paths as needed
  2574 
  2575 if test "x$enable_rpath" = "xyes"; then
  2576   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2577     SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2578   fi
  2579   if test $ARCH = solaris; then
  2580     SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2581   fi
  2582 else
  2583   SDL_RLD_FLAGS=""
  2584 fi
  2585 
  2586 case "$ARCH" in
  2587   macosx)
  2588     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2589       SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa"
  2590     fi
  2591     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  2592       SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon"
  2593     fi
  2594     # Evil hack to allow static linking on Mac OS X
  2595     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a $EXTRA_LDFLAGS"
  2596     ;;
  2597   *)
  2598     SDL_STATIC_LIBS="$SDL_LIBS"
  2599     ;;
  2600 esac
  2601 
  2602 dnl Expand the cflags and libraries needed by apps using SDL
  2603 AC_SUBST(SDL_CFLAGS)
  2604 AC_SUBST(SDL_LIBS)
  2605 AC_SUBST(SDL_STATIC_LIBS)
  2606 AC_SUBST(SDL_RLD_FLAGS)
  2607 if test x$enable_shared = xyes; then
  2608     ENABLE_SHARED_TRUE=
  2609     ENABLE_SHARED_FALSE="#"
  2610 else
  2611     ENABLE_SHARED_TRUE="#"
  2612     ENABLE_SHARED_FALSE=
  2613 fi
  2614 if test x$enable_static = xyes; then
  2615     ENABLE_STATIC_TRUE=
  2616     ENABLE_STATIC_FALSE="#"
  2617 else
  2618     ENABLE_STATIC_TRUE="#"
  2619     ENABLE_STATIC_FALSE=
  2620 fi
  2621 AC_SUBST(ENABLE_SHARED_TRUE)
  2622 AC_SUBST(ENABLE_SHARED_FALSE)
  2623 AC_SUBST(ENABLE_STATIC_TRUE)
  2624 AC_SUBST(ENABLE_STATIC_FALSE)
  2625 
  2626 dnl Expand the sources and objects needed to build the library
  2627 AC_SUBST(ac_aux_dir)
  2628 AC_SUBST(INCLUDE)
  2629 AC_SUBST(SOURCES)
  2630 AC_SUBST(OBJECTS)
  2631 AC_SUBST(SDLMAIN_SOURCES)
  2632 AC_SUBST(SDLMAIN_OBJECTS)
  2633 AC_SUBST(BUILD_CFLAGS)
  2634 AC_SUBST(EXTRA_CFLAGS)
  2635 AC_SUBST(BUILD_LDFLAGS)
  2636 AC_SUBST(EXTRA_LDFLAGS)
  2637 
  2638 AC_OUTPUT([
  2639     Makefile sdl-config SDL.spec SDL.qpg
  2640 ], [
  2641     : >build-deps
  2642     if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
  2643 ])