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