configure.in
author Ryan C. Gordon <icculus@icculus.org>
Wed, 04 Apr 2007 10:30:07 +0000
branchSDL-1.2
changeset 3934 f8cc7c7ccf95
parent 3933 3b5c90889156
child 3935 00959c391aa6
permissions -rw-r--r--
Crap, put this patch in the wrong place.

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