configure.in
author Ryan C. Gordon <icculus@icculus.org>
Thu, 15 Feb 2007 23:50:45 +0000
branchSDL-1.2
changeset 3917 8a3a0f1179f3
parent 3901 3a7248359cdd
child 3933 3b5c90889156
permissions -rw-r--r--
Patched fbcon to compile on newer Linux kernels that don't #define PAGE_SIZE,
since a memory page's size may vary on various architectures and kernel
configurations.

Will use getpagesize() if it exists, the PAGE_SIZE #define from older kernels
if that doesn't, and #error out if that's not there either...but it's
probably 4096 in that case. We may revisit this.

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