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