configure.in
author Sam Lantinga
Sun, 25 Jun 2006 18:07:34 +0000
changeset 1886 44635227a939
parent 1879 cb232e63552c
child 1889 5225a9cc25a2
permissions -rw-r--r--
Updated the version to 1.2.11
     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=11
    20 SDL_INTERFACE_AGE=0
    21 SDL_BINARY_AGE=11
    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             # Only allow dynamically loaded X11 if the X11 function pointers
   817             # will not end up in the global namespace, which causes problems
   818             # with other libraries calling X11 functions.
   819             x11_symbols_private=$have_gcc_fvisibility
   820 
   821             AC_ARG_ENABLE(x11-shared,
   822 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
   823                           , enable_x11_shared=maybe)
   824 
   825             case "$host" in
   826                 *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
   827                     x11_symbols_private=yes
   828                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
   829                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
   830                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
   831                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
   832                     ;;
   833                 *-*-osf*)
   834                     x11_lib='libX11.so'
   835                     x11ext_lib='libXext.so'
   836                     ;;
   837                 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
   838                     x11_lib='libX11.so'
   839                     x11ext_lib='libXext.so'
   840                     ;;
   841                 *)
   842                     x11_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`]
   843                     for path in $x11_lib_path /usr/lib /usr/X11/lib /usr/X11R6/lib; do
   844                         if test "x$x11_lib" = "x"; then
   845                             x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   846                             if test "x$x11_lib" = "x"; then
   847                                 x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   848                             fi
   849                         fi
   850                         if test "x$x11ext_lib" = "x"; then
   851                             x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   852                             if test "x$x11ext_lib" = "x"; then
   853                                 x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   854                             fi
   855                         fi
   856                         if test "x$xrender_lib" = "x"; then
   857                             xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   858                             if test "x$xrender_lib" = "x"; then
   859                                 xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   860                             fi
   861                         fi
   862                         if test "x$xrandr_lib" = "x"; then
   863                             xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   864                             if test "x$xrandr_lib" = "x"; then
   865                                 xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   866                             fi
   867                         fi
   868                     done
   869                     ;;
   870             esac
   871 
   872             X_CFLAGS="$X_CFLAGS -DXTHREADS"
   873             if test x$ac_cv_func_shmat != xyes; then
   874                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
   875             fi
   876             CFLAGS="$CFLAGS $X_CFLAGS"
   877             LDFLAGS="$LDFLAGS $X_LIBS"
   878 
   879             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
   880             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
   881             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
   882 
   883             if test x$enable_x11_shared = xmaybe; then
   884                 enable_x11_shared=$x11_symbols_private
   885             fi
   886             if test x$have_loadso != xyes && \
   887                test x$enable_x11_shared = xyes; then
   888                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
   889                 enable_x11_shared=no
   890             fi
   891             if test x$x11_symbols_private != xyes && \
   892                test x$enable_x11_shared = xyes; then
   893                 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
   894                 enable_x11_shared=no
   895             fi
   896 
   897             if test x$have_loadso = xyes && \
   898                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
   899                 echo "-- dynamic libX11 -> $x11_lib"
   900                 echo "-- dynamic libX11ext -> $x11ext_lib"
   901                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
   902                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
   903             else
   904                 enable_x11_shared=no
   905                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
   906             fi
   907             have_video=yes
   908 
   909             AC_ARG_ENABLE(dga,
   910 AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [[default=yes]]]),
   911                           , enable_dga=yes)
   912             if test x$enable_dga = xyes; then
   913                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c"
   914             fi
   915             AC_ARG_ENABLE(video-dga,
   916 AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [[default=yes]]]),
   917                   , enable_video_dga=yes)
   918             if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then
   919                 AC_DEFINE(SDL_VIDEO_DRIVER_DGA)
   920                 SOURCES="$SOURCES $srcdir/src/video/dga/*.c"
   921             fi
   922             AC_ARG_ENABLE(video-x11-dgamouse,
   923 AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [[default=yes]]]),
   924                           , enable_video_x11_dgamouse=yes)
   925             if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then
   926                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE)
   927             fi
   928             AC_ARG_ENABLE(video-x11-vm,
   929 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
   930                           , enable_video_x11_vm=yes)
   931             if test x$enable_video_x11_vm = xyes; then
   932                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
   933                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
   934             fi
   935             AC_ARG_ENABLE(video-x11-xv,
   936 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
   937                           , enable_video_x11_xv=yes)
   938             if test x$enable_video_x11_xv = xyes; then
   939                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
   940                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
   941             fi
   942             AC_ARG_ENABLE(video-x11-xinerama,
   943 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
   944                             , enable_video_x11_xinerama=yes)
   945             if test x$enable_video_x11_xinerama = xyes; then
   946                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
   947                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
   948             fi
   949             AC_ARG_ENABLE(video-x11-xme,
   950 AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [[default=yes]]]),
   951                             , enable_video_x11_xme=yes)
   952             if test x$enable_video_x11_xme = xyes; then
   953                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
   954                 SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
   955             fi
   956             AC_ARG_ENABLE(video-x11-xrandr,
   957 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
   958                             , enable_video_x11_xrandr=yes)
   959             if test x$enable_video_x11_xrandr = xyes; then
   960                 definitely_enable_video_x11_xrandr=no
   961                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
   962                                 have_xrandr_h_hdr=yes,
   963                                 have_xrandr_h_hdr=no,
   964                                 [#include <X11/Xlib.h>
   965                                 ])
   966                 if test x$have_xrandr_h_hdr = xyes; then
   967                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
   968                         echo "-- dynamic libXrender -> $xrender_lib"
   969                         echo "-- dynamic libXrandr -> $xrandr_lib"
   970                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
   971                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
   972                         definitely_enable_video_x11_xrandr=yes
   973                     else
   974                         AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
   975                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
   976                         if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then
   977                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender"
   978                             definitely_enable_video_x11_xrandr=yes
   979                         fi
   980                     fi
   981                 fi
   982             fi
   983             if test x$definitely_enable_video_x11_xrandr = xyes; then
   984                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
   985             fi
   986             AC_ARG_ENABLE(video-x11-dpms,
   987 AC_HELP_STRING([--enable-video-x11-dpms], [enable X11 DPMS extension [[default=yes]]]),
   988                             , enable_video_x11_dpms=yes)
   989             if test x$enable_video_x11_dpms = xyes; then
   990                 AC_CHECK_HEADER(X11/extensions/dpms.h,
   991                                 have_dpms_h_hdr=yes,
   992                                 have_dpms_h_hdr=no,
   993                                 [#include <X11/Xlib.h>
   994                                 ])
   995                 if test x$have_dpms_h_hdr = xyes; then
   996                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_DPMS)
   997                 fi
   998             fi
   999         fi
  1000     fi
  1001 }
  1002 
  1003 dnl Check for QNX photon video driver
  1004 CheckPHOTON()
  1005 {
  1006     AC_ARG_ENABLE(video-photon,
  1007 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
  1008                   , enable_video_photon=yes)
  1009     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
  1010         AC_MSG_CHECKING(for QNX Photon support)
  1011         video_photon=no
  1012         AC_TRY_COMPILE([
  1013           #include <Ph.h>
  1014           #include <Pt.h>
  1015           #include <photon/Pg.h>
  1016           #include <photon/PdDirect.h>
  1017         ],[
  1018          PgDisplaySettings_t *visual;
  1019         ],[
  1020         video_photon=yes
  1021         ])
  1022         AC_MSG_RESULT($video_photon)
  1023         if test x$video_photon = xyes; then
  1024             AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
  1025             SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
  1026             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph"
  1027             have_video=yes
  1028 
  1029             CheckOpenGLQNX
  1030         fi
  1031     fi
  1032 }
  1033 
  1034 dnl Set up the BWindow video driver if enabled
  1035 CheckBWINDOW()
  1036 {
  1037     if test x$enable_video = xyes; then
  1038         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
  1039         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
  1040         have_video=yes
  1041     fi
  1042 }
  1043 
  1044 dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
  1045 CheckCARBON()
  1046 {
  1047     AC_ARG_ENABLE(video-carbon,
  1048 AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [[default=no]]]),
  1049                   , enable_video_carbon=no)
  1050     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  1051         AC_MSG_CHECKING(for Carbon framework)
  1052         have_carbon=no
  1053         AC_TRY_COMPILE([
  1054           #include <Carbon/Carbon.h>
  1055         ],[
  1056         ],[
  1057         have_carbon=yes
  1058         ])
  1059         AC_MSG_RESULT($have_carbon)
  1060         if test x$have_carbon = xyes; then
  1061             AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX)
  1062             SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c"
  1063             SOURCES="$SOURCES $srcdir/src/video/macrom/*.c"
  1064             have_video=yes
  1065         fi
  1066     fi
  1067 }
  1068 
  1069 dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
  1070 CheckCOCOA()
  1071 {
  1072     AC_ARG_ENABLE(video-cocoa,
  1073 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [[default=yes]]]),
  1074                   , enable_video_cocoa=yes)
  1075     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1076         save_CFLAGS="$CFLAGS"
  1077         dnl work around that we don't have Objective-C support in autoconf
  1078         CFLAGS="$CFLAGS -x objective-c"
  1079         AC_MSG_CHECKING(for Cocoa framework)
  1080         have_cocoa=no
  1081         AC_TRY_COMPILE([
  1082           #import <Cocoa/Cocoa.h>
  1083         ],[
  1084         ],[
  1085         have_cocoa=yes
  1086         ])
  1087         AC_MSG_RESULT($have_cocoa)
  1088         CFLAGS="$save_CFLAGS"
  1089         if test x$have_cocoa = xyes; then
  1090             AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ)
  1091             SOURCES="$SOURCES $srcdir/src/video/quartz/*.m"
  1092             have_video=yes
  1093         fi
  1094     fi
  1095 }
  1096 
  1097 dnl Find the framebuffer console includes
  1098 CheckFBCON()
  1099 {
  1100     AC_ARG_ENABLE(video-fbcon,
  1101 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=yes]]]),
  1102                   , enable_video_fbcon=yes)
  1103     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
  1104         AC_MSG_CHECKING(for framebuffer console support)
  1105         video_fbcon=no
  1106         AC_TRY_COMPILE([
  1107          #include <linux/fb.h>
  1108          #include <linux/kd.h>
  1109          #include <linux/keyboard.h>
  1110         ],[
  1111         ],[
  1112         video_fbcon=yes
  1113         ])
  1114         AC_MSG_RESULT($video_fbcon)
  1115         if test x$video_fbcon = xyes; then
  1116             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
  1117             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
  1118             have_video=yes
  1119         fi
  1120     fi
  1121 }
  1122 
  1123 dnl Find DirectFB
  1124 CheckDirectFB()
  1125 {
  1126     AC_ARG_ENABLE(video-directfb,
  1127 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=yes]]]),
  1128                   , enable_video_directfb=yes)
  1129     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1130         video_directfb=no
  1131 
  1132         DIRECTFB_REQUIRED_VERSION=0.9.15
  1133 
  1134         AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
  1135         if test x$DIRECTFBCONFIG = xno; then
  1136             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1137             AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1138             if test x$PKG_CONFIG != xno; then
  1139                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1140                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1141                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1142                     video_directfb=yes
  1143                 fi
  1144             fi
  1145             AC_MSG_RESULT($video_directfb)
  1146         else
  1147             AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1148             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1149             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1150             set -- `directfb-config --version | sed 's/\./ /g'`
  1151             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1152             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1153                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1154                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1155                 video_directfb=yes
  1156             fi
  1157             AC_MSG_RESULT($video_directfb)
  1158         fi
  1159 
  1160         if test x$video_directfb = xyes; then
  1161             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1162             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1163             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1164             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1165             have_video=yes
  1166         fi
  1167     fi
  1168 }
  1169 
  1170 dnl See if we're running on PlayStation 2 hardware
  1171 CheckPS2GS()
  1172 {
  1173     AC_ARG_ENABLE(video-ps2gs,
  1174 AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=yes]]]),
  1175                   , enable_video_ps2gs=yes)
  1176     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
  1177         AC_MSG_CHECKING(for PlayStation 2 GS support)
  1178         video_ps2gs=no
  1179         AC_TRY_COMPILE([
  1180          #include <linux/ps2/dev.h>
  1181          #include <linux/ps2/gs.h>
  1182         ],[
  1183         ],[
  1184         video_ps2gs=yes
  1185         ])
  1186         AC_MSG_RESULT($video_ps2gs)
  1187         if test x$video_ps2gs = xyes; then
  1188             AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
  1189             SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
  1190             have_video=yes
  1191         fi
  1192     fi
  1193 }
  1194 
  1195 dnl Find the GGI includes
  1196 CheckGGI()
  1197 {
  1198     AC_ARG_ENABLE(video-ggi,
  1199 AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [[default=no]]]),
  1200                   , enable_video_ggi=no)
  1201     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
  1202         AC_MSG_CHECKING(for GGI support)
  1203         video_ggi=no
  1204         AC_TRY_COMPILE([
  1205          #include <ggi/ggi.h>
  1206          #include <ggi/gii.h>
  1207         ],[
  1208         ],[
  1209         video_ggi=yes
  1210         ])
  1211         AC_MSG_RESULT($video_ggi)
  1212         if test x$video_ggi = xyes; then
  1213             AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
  1214             SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
  1215             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lggi -lgii -lgg"
  1216             have_video=yes
  1217         fi
  1218     fi
  1219 }
  1220 
  1221 dnl Find the SVGAlib includes and libraries
  1222 CheckSVGA()
  1223 {
  1224     AC_ARG_ENABLE(video-svga,
  1225 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=yes]]]),
  1226                   , enable_video_svga=yes)
  1227     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1228         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1229         video_svga=no
  1230         AC_TRY_COMPILE([
  1231          #include <vga.h>
  1232          #include <vgamouse.h>
  1233          #include <vgakeyboard.h>
  1234         ],[
  1235          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1236              exit(0);
  1237          }
  1238         ],[
  1239         video_svga=yes
  1240         ])
  1241         AC_MSG_RESULT($video_svga)
  1242         if test x$video_svga = xyes; then
  1243             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1244             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1245             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
  1246             have_video=yes
  1247         fi
  1248     fi
  1249 }
  1250 
  1251 dnl Find the VGL includes and libraries
  1252 CheckVGL()
  1253 {
  1254     AC_ARG_ENABLE(video-vgl,
  1255 AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [[default=yes]]]),
  1256                   , enable_video_vgl=yes)
  1257     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
  1258         AC_MSG_CHECKING(for libVGL support)
  1259         video_vgl=no
  1260         AC_TRY_COMPILE([
  1261          #include <sys/fbio.h>
  1262          #include <sys/consio.h>
  1263          #include <sys/kbio.h>
  1264          #include <vgl.h>
  1265         ],[
  1266          VGLBitmap bitmap;
  1267          bitmap.Type = VIDBUF32;
  1268          bitmap.PixelBytes = 4;
  1269          exit(bitmap.Bitmap);
  1270         ],[
  1271         video_vgl=yes
  1272         ])
  1273         AC_MSG_RESULT($video_vgl)
  1274         if test x$video_vgl = xyes; then
  1275             AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
  1276             SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
  1277             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl"
  1278             have_video=yes
  1279         fi
  1280     fi
  1281 }
  1282 
  1283 dnl Set up the wscons video driver if enabled
  1284 CheckWscons()
  1285 {
  1286     AC_ARG_ENABLE(video-wscons,
  1287 AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [[default=yes]]]),
  1288                   , enable_video_wscons=yes)
  1289     if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
  1290         AC_MSG_CHECKING(for wscons support)
  1291         video_wscons=no
  1292         AC_TRY_COMPILE([
  1293          #include <sys/time.h>
  1294          #include <dev/wscons/wsconsio.h>
  1295          #include <dev/wscons/wsdisplay_usl_io.h>
  1296         ],[
  1297          int wsmode = WSDISPLAYIO_MODE_DUMBFB;
  1298         ],[
  1299         video_wscons=yes
  1300         ])
  1301         AC_MSG_RESULT($video_wscons)
  1302         if test x$video_wscons = xyes; then
  1303             AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
  1304             SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
  1305             have_video=yes
  1306         fi
  1307     fi
  1308 }
  1309 
  1310 
  1311 dnl Find the AAlib includes
  1312 CheckAAlib()
  1313 {
  1314     AC_ARG_ENABLE(video-aalib,
  1315 AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [[default=no]]]),
  1316                   , enable_video_aalib=no)
  1317     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
  1318         AC_MSG_CHECKING(for AAlib support)
  1319         video_aalib=no
  1320         AC_TRY_COMPILE([
  1321          #include <aalib.h>
  1322         ],[
  1323         ],[
  1324         video_aalib=yes
  1325         ])
  1326         AC_MSG_RESULT($video_aalib)
  1327         if test x$video_aalib = xyes; then
  1328             AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
  1329             SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
  1330             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laa"
  1331             have_video=yes
  1332         fi
  1333     fi
  1334 }
  1335 
  1336 dnl Set up the QTopia video driver if enabled
  1337 CheckQtopia()
  1338 {
  1339     AC_ARG_ENABLE(video-qtopia,
  1340 AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [[default=no]]]),
  1341                   , enable_video_qtopia=no)
  1342     if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
  1343         AC_MSG_CHECKING(for Qtopia support)
  1344         video_qtopia=no
  1345         QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
  1346         AC_LANG_CPLUSPLUS
  1347         OLD_CXX="$CXXFLAGS"
  1348         CXXFLAGS="$QTOPIA_FLAGS"
  1349         AC_TRY_COMPILE([
  1350          #include <qpe/qpeapplication.h>
  1351         ],[
  1352         ],[
  1353         video_qtopia=yes
  1354         ])
  1355         CXXFLAGS="$OLD_CXX"
  1356         AC_MSG_RESULT($video_qtopia)
  1357         if test x$video_qtopia = xyes; then
  1358             AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
  1359             SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
  1360             SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc"
  1361             EXTRA_CFLAGS="$EXTRA_CFLAGS $QTOPIA_FLAGS"
  1362             SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
  1363             SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
  1364             have_video=yes
  1365         fi
  1366         AC_LANG_C
  1367     fi
  1368 }
  1369 
  1370 dnl Set up the PicoGUI video driver if enabled
  1371 CheckPicoGUI()
  1372 {
  1373     AC_ARG_ENABLE(video-picogui,
  1374 AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [[default=no]]]),
  1375                   , enable_video_picogui=no)
  1376     if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
  1377         AC_MSG_CHECKING(for PicoGUI support)
  1378         video_picogui=no
  1379         AC_TRY_COMPILE([
  1380          #include <picogui.h>
  1381         ],[
  1382         ],[
  1383         video_picogui=yes
  1384         ])
  1385         AC_MSG_RESULT($video_picogui)
  1386         if test x$video_picogui = xyes; then
  1387             AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI)
  1388             SOURCES="$SOURCES $srcdir/src/video/picogui/*.c"
  1389             SDL_LIBS="$SDL_LIBS -lpgui"
  1390             have_video=yes
  1391         fi
  1392     fi
  1393 }
  1394 
  1395 dnl Set up the Atari Bios keyboard driver
  1396 CheckAtariBiosEvent()
  1397 {
  1398     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
  1399     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S"
  1400 }
  1401 
  1402 dnl Set up the Atari Xbios driver
  1403 CheckAtariXbiosVideo()
  1404 {
  1405     AC_ARG_ENABLE(xbios,
  1406 AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [[default=yes]]]),
  1407                   , enable_video_xbios=yes)
  1408     video_xbios=no
  1409     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1410         video_xbios=yes
  1411         AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
  1412         SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
  1413         have_video=yes
  1414     fi
  1415 }
  1416 
  1417 dnl Set up the Atari Gem driver
  1418 CheckAtariGemVideo()
  1419 {
  1420     AC_ARG_ENABLE(gem,
  1421 AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [[default=yes]]]),
  1422                   , enable_video_gem=yes)
  1423     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1424         video_gem=no
  1425         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1426         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1427         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1428             video_gem=yes
  1429             AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
  1430             SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
  1431             SDL_LIBS="$SDL_LIBS -lgem"
  1432             have_video=yes
  1433         fi
  1434     fi
  1435 }
  1436 
  1437 dnl rcg04172001 Set up the Null video driver.
  1438 CheckDummyVideo()
  1439 {
  1440     AC_ARG_ENABLE(video-dummy,
  1441 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1442                   , enable_video_dummy=yes)
  1443     if test x$enable_video_dummy = xyes; then
  1444         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1445         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1446         have_video=yes
  1447     fi
  1448 }
  1449 
  1450 dnl Check to see if OpenGL support is desired
  1451 AC_ARG_ENABLE(video-opengl,
  1452 AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [[default=yes]]]),
  1453               , enable_video_opengl=yes)
  1454 
  1455 dnl Find OpenGL
  1456 CheckOpenGLX11()
  1457 {
  1458     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1459         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1460         video_opengl=no
  1461         AC_TRY_COMPILE([
  1462          #include <GL/gl.h>
  1463          #include <GL/glx.h>
  1464         ],[
  1465         ],[
  1466         video_opengl=yes
  1467         ])
  1468         AC_MSG_RESULT($video_opengl)
  1469         if test x$video_opengl = xyes; then
  1470             AC_DEFINE(SDL_VIDEO_OPENGL)
  1471             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1472         fi
  1473     fi
  1474 }
  1475 
  1476 dnl Find QNX RtP OpenGL
  1477 CheckOpenGLQNX()
  1478 {
  1479     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1480         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1481         video_opengl=no
  1482         AC_TRY_COMPILE([
  1483          #include <GL/gl.h>
  1484         ],[
  1485         ],[
  1486         video_opengl=yes
  1487         ])
  1488         AC_MSG_RESULT($video_opengl)
  1489         if test x$video_opengl = xyes; then
  1490             AC_DEFINE(SDL_VIDEO_OPENGL)
  1491             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1492         fi
  1493     fi
  1494 }
  1495 
  1496 dnl Check for Win32 OpenGL
  1497 CheckWIN32GL()
  1498 {
  1499     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1500         AC_DEFINE(SDL_VIDEO_OPENGL)
  1501         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1502     fi
  1503 }
  1504 
  1505 dnl Check for BeOS OpenGL
  1506 CheckBeGL()
  1507 {
  1508     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1509         AC_DEFINE(SDL_VIDEO_OPENGL)
  1510         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1511     fi
  1512 }
  1513 
  1514 dnl Check for MacOS OpenGL
  1515 CheckMacGL()
  1516 {
  1517     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1518         AC_DEFINE(SDL_VIDEO_OPENGL)
  1519         case "$host" in
  1520             *-*-darwin*)
  1521                 if test x$enable_video_cocoa = xyes; then
  1522                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1523                 fi
  1524                 if test x$enable_video_carbon = xyes; then
  1525                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AGL"
  1526                 fi
  1527         esac
  1528     fi
  1529 }
  1530 
  1531 dnl Check for Mesa offscreen rendering
  1532 CheckAtariOSMesa()
  1533 {
  1534     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1535         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1536         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1537 
  1538         # Static linking to -lOSMesa
  1539         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1540         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1541             # -lOSMesa is really the static library
  1542             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1543                 OSMESA_LIBS="-lOSMesa"
  1544             fi
  1545         else
  1546             # -lOSMesa is a loader for OSMesa.ldg
  1547             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1548             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1549         fi
  1550         AC_DEFINE(SDL_VIDEO_OPENGL)
  1551         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1552         SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
  1553         SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
  1554 
  1555         AC_ARG_ENABLE(osmesa-shared,
  1556 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]),
  1557                               , enable_osmesa_shared=yes)
  1558         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1559             # Dynamic linking
  1560             if test "x$have_osmesa_hdr" = "xyes"; then
  1561                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1562             fi
  1563         fi
  1564     fi
  1565 }
  1566 
  1567 dnl See if we can use the new unified event interface in Linux 2.4
  1568 CheckInputEvents()
  1569 {
  1570     dnl Check for Linux 2.4 unified input event interface support
  1571     AC_ARG_ENABLE(input-events,
  1572 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1573                   , enable_input_events=yes)
  1574     if test x$enable_input_events = xyes; then
  1575         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1576         use_input_events=no
  1577         AC_TRY_COMPILE([
  1578           #include <linux/input.h>
  1579         ],[
  1580           #ifndef EVIOCGNAME
  1581           #error EVIOCGNAME() ioctl not available
  1582           #endif
  1583         ],[
  1584         use_input_events=yes
  1585         ])
  1586         AC_MSG_RESULT($use_input_events)
  1587         if test x$use_input_events = xyes; then
  1588             AC_DEFINE(SDL_INPUT_LINUXEV)
  1589         fi
  1590     fi
  1591 }
  1592 
  1593 dnl See if we can use the Touchscreen input library
  1594 CheckTslib()
  1595 {
  1596     AC_ARG_ENABLE(input-tslib,
  1597 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1598                   , enable_input_tslib=yes)
  1599     if test x$enable_input_tslib = xyes; then
  1600         AC_MSG_CHECKING(for Touchscreen library support)
  1601         enable_input_tslib=no
  1602         AC_TRY_COMPILE([
  1603           #include "tslib.h"
  1604         ],[
  1605         ],[
  1606         enable_input_tslib=yes
  1607         ])
  1608         AC_MSG_RESULT($enable_input_tslib)
  1609         if test x$enable_input_tslib = xyes; then
  1610             AC_DEFINE(SDL_INPUT_TSLIB)
  1611             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1612         fi
  1613     fi
  1614 }
  1615 
  1616 dnl See if we can use GNU pth library for threads
  1617 CheckPTH()
  1618 {
  1619     dnl Check for pth support
  1620     AC_ARG_ENABLE(pth,
  1621 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
  1622                   , enable_pth=yes)
  1623     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1624         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1625         if test "$PTH_CONFIG" = "no"; then
  1626             use_pth=no
  1627         else
  1628             use_pth=yes
  1629         fi
  1630         AC_MSG_CHECKING(pth)
  1631         AC_MSG_RESULT($use_pth)
  1632         if test "x$use_pth" = xyes; then
  1633             AC_DEFINE(SDL_THREAD_PTH)
  1634             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1635             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1636             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1637             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1638             have_threads=yes
  1639         fi
  1640     fi
  1641 }
  1642 
  1643 dnl See what type of thread model to use on Linux and Solaris
  1644 CheckPTHREAD()
  1645 {
  1646     dnl Check for pthread support
  1647     AC_ARG_ENABLE(pthreads,
  1648 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1649                   , enable_pthreads=yes)
  1650     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1651     AC_ARG_ENABLE(pthread-sem,
  1652 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1653                   , enable_pthread_sem=yes)
  1654     case "$host" in
  1655         *-*-linux*|*-*-uclinux*)
  1656             pthread_cflags="-D_REENTRANT"
  1657             pthread_lib="-lpthread"
  1658             ;;
  1659         *-*-bsdi*)
  1660             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1661             pthread_lib=""
  1662             ;;
  1663         *-*-darwin*)
  1664             pthread_cflags="-D_THREAD_SAFE"
  1665 # causes Carbon.p complaints?
  1666 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1667             ;;
  1668         *-*-freebsd*|*-*-dragonfly*)
  1669             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1670             pthread_lib="-pthread"
  1671             ;;
  1672         *-*-netbsd*)
  1673             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1674             pthread_lib="-L/usr/lib -lpthread"
  1675             ;;
  1676         *-*-openbsd*)
  1677             pthread_cflags="-D_REENTRANT"
  1678             pthread_lib="-pthread"
  1679             ;;
  1680         *-*-solaris*)
  1681             pthread_cflags="-D_REENTRANT"
  1682             pthread_lib="-lpthread -lposix4"
  1683             ;;
  1684         *-*-sysv5*)
  1685             pthread_cflags="-D_REENTRANT -Kthread"
  1686             pthread_lib=""
  1687             ;;
  1688         *-*-irix*)
  1689             pthread_cflags="-D_SGI_MP_SOURCE"
  1690             pthread_lib="-lpthread"
  1691             ;;
  1692         *-*-aix*)
  1693             pthread_cflags="-D_REENTRANT -mthreads"
  1694             pthread_lib="-lpthread"
  1695             ;;
  1696         *-*-hpux11*)
  1697             pthread_cflags="-D_REENTRANT"
  1698             pthread_lib="-L/usr/lib -lpthread"
  1699             ;;
  1700         *-*-qnx*)
  1701             pthread_cflags=""
  1702             pthread_lib=""
  1703             ;;
  1704         *-*-osf*)
  1705             pthread_cflags="-D_REENTRANT"
  1706             if test x$ac_cv_prog_gcc = xyes; then
  1707                 pthread_lib="-lpthread -lrt"
  1708             else
  1709                 pthread_lib="-lpthread -lexc -lrt"
  1710             fi
  1711             ;;
  1712         *)
  1713             pthread_cflags="-D_REENTRANT"
  1714             pthread_lib="-lpthread"
  1715             ;;
  1716     esac
  1717     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1718         # Save the original compiler flags and libraries
  1719         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1720         # Add the pthread compiler flags and libraries
  1721         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1722         # Check to see if we have pthread support on this system
  1723         AC_MSG_CHECKING(for pthreads)
  1724         use_pthreads=no
  1725         AC_TRY_LINK([
  1726          #include <pthread.h>
  1727         ],[
  1728          pthread_attr_t type;
  1729          pthread_attr_init(&type);
  1730         ],[
  1731         use_pthreads=yes
  1732         ])
  1733         AC_MSG_RESULT($use_pthreads)
  1734         # Restore the compiler flags and libraries
  1735         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1736 
  1737         # Do futher testing if we have pthread support...
  1738         if test x$use_pthreads = xyes; then
  1739             AC_DEFINE(SDL_THREAD_PTHREAD)
  1740             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1741             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1742             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1743             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1744 
  1745             # Save the original compiler flags and libraries
  1746             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1747             # Add the pthread compiler flags and libraries
  1748             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1749 
  1750             # Check to see if recursive mutexes are available
  1751             AC_MSG_CHECKING(for recursive mutexes)
  1752             has_recursive_mutexes=no
  1753             if test x$has_recursive_mutexes = xno; then
  1754                 AC_TRY_COMPILE([
  1755                   #include <pthread.h>
  1756                 ],[
  1757                   pthread_mutexattr_t attr;
  1758                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1759                 ],[
  1760                 has_recursive_mutexes=yes
  1761                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1762                 ])
  1763             fi
  1764             if test x$has_recursive_mutexes = xno; then
  1765                 AC_TRY_COMPILE([
  1766                   #include <pthread.h>
  1767                 ],[
  1768                   pthread_mutexattr_t attr;
  1769                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1770                 ],[
  1771                 has_recursive_mutexes=yes
  1772                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1773                 ])
  1774             fi
  1775             AC_MSG_RESULT($has_recursive_mutexes)
  1776 
  1777             # Check to see if pthread semaphore support is missing
  1778             if test x$enable_pthread_sem = xyes; then
  1779                 AC_MSG_CHECKING(for pthread semaphores)
  1780                 have_pthread_sem=no
  1781                 AC_TRY_COMPILE([
  1782                   #include <pthread.h>
  1783                   #include <semaphore.h>
  1784                 ],[
  1785                 ],[
  1786                 have_pthread_sem=yes
  1787                 ])
  1788                 AC_MSG_RESULT($have_pthread_sem)
  1789             fi
  1790 
  1791             # Restore the compiler flags and libraries
  1792             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1793 
  1794             # Basic thread creation functions
  1795             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1796 
  1797             # Semaphores
  1798             # We can fake these with mutexes and condition variables if necessary
  1799             if test x$have_pthread_sem = xyes; then
  1800                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1801             else
  1802                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1803             fi
  1804 
  1805             # Mutexes
  1806             # We can fake these with semaphores if necessary
  1807             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1808 
  1809             # Condition variables
  1810             # We can fake these with semaphores and mutexes if necessary
  1811             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1812 
  1813             have_threads=yes
  1814         else
  1815             CheckPTH
  1816         fi
  1817     fi
  1818 }
  1819 
  1820 dnl Determine whether the compiler can produce Win32 executables
  1821 CheckWIN32()
  1822 {
  1823     AC_MSG_CHECKING(Win32 compiler)
  1824     have_win32_gcc=no
  1825     AC_TRY_COMPILE([
  1826      #include <windows.h>
  1827     ],[
  1828     ],[
  1829     have_win32_gcc=yes
  1830     ])
  1831     AC_MSG_RESULT($have_win32_gcc)
  1832     if test x$have_win32_gcc != xyes; then
  1833        AC_MSG_ERROR([
  1834 *** Your compiler ($CC) does not produce Win32 executables!
  1835        ])
  1836     fi
  1837 
  1838     dnl See if the user wants to redirect standard output to files
  1839     AC_ARG_ENABLE(stdio-redirect,
  1840 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  1841                   , enable_stdio_redirect=yes)
  1842     if test x$enable_stdio_redirect != xyes; then
  1843         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  1844     fi
  1845 
  1846     if test x$enable_video = xyes; then
  1847         AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
  1848         SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
  1849         SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
  1850         have_video=yes
  1851     fi
  1852 }
  1853 
  1854 dnl Find the DirectX includes and libraries
  1855 CheckDIRECTX()
  1856 {
  1857     AC_ARG_ENABLE(directx,
  1858 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  1859                   , enable_directx=yes)
  1860     if test x$enable_directx = xyes; then
  1861         have_directx=no
  1862         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1863         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1864         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1865         if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
  1866             have_directx=yes
  1867         fi
  1868         if test x$enable_video = xyes -a x$have_directx = xyes; then
  1869             AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
  1870             SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
  1871             have_video=yes
  1872         fi
  1873     fi
  1874 }
  1875 
  1876 dnl Check for the dlfcn.h interface for dynamically loading objects
  1877 CheckDLOPEN()
  1878 {
  1879     AC_ARG_ENABLE(sdl-dlopen,
  1880 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1881                   , enable_sdl_dlopen=yes)
  1882     if test x$enable_sdl_dlopen = xyes; then
  1883         AC_MSG_CHECKING(for dlopen)
  1884         have_dlopen=no
  1885         AC_TRY_COMPILE([
  1886          #include <dlfcn.h>
  1887         ],[
  1888          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1889          #error Use dlcompat for Mac OS X 10.2 compatibility
  1890          #endif
  1891         ],[
  1892         have_dlopen=yes
  1893         ])
  1894         AC_MSG_RESULT($have_dlopen)
  1895 
  1896         if test x$have_dlopen = xyes; then
  1897             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1898                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1899                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1900             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1901             if test x$have_dlvsym = xyes; then
  1902                 AC_DEFINE(HAVE_DLVSYM)
  1903             fi
  1904             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1905             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1906             have_loadso=yes
  1907         fi
  1908     fi
  1909 }
  1910 
  1911 dnl Set up the Atari LDG (shared object loader)
  1912 CheckAtariLdg()
  1913 {
  1914     AC_ARG_ENABLE(atari-ldg,
  1915 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]),
  1916                   , enable_atari_ldg=yes)
  1917     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1918         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1919         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1920         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1921             AC_DEFINE(SDL_LOADSO_LDG)
  1922             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1923             SDL_LIBS="$SDL_LIBS -lldg -lgem"
  1924             have_loadso=yes
  1925         fi
  1926     fi
  1927 }
  1928 
  1929 dnl Check for the usbhid(3) library on *BSD
  1930 CheckUSBHID()
  1931 {
  1932     if test x$enable_joystick = xyes; then
  1933         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1934         if test x$have_libusbhid = xyes; then
  1935             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1936             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1937             USB_LIBS="$USB_LIBS -lusbhid"
  1938         else
  1939             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1940             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1941             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1942         fi
  1943             
  1944         save_CFLAGS="$CFLAGS"
  1945         CFLAGS="$CFLAGS $USB_CFLAGS"
  1946 
  1947         AC_MSG_CHECKING(for usbhid)
  1948         have_usbhid=no
  1949         AC_TRY_COMPILE([
  1950           #include <sys/types.h>
  1951           #if defined(HAVE_USB_H)
  1952           #include <usb.h>
  1953           #endif
  1954           #ifdef __DragonFly__
  1955           # include <bus/usb/usb.h>
  1956           # include <bus/usb/usbhid.h>
  1957           #else
  1958           # include <dev/usb/usb.h>
  1959           # include <dev/usb/usbhid.h>
  1960           #endif
  1961           #if defined(HAVE_USBHID_H)
  1962           #include <usbhid.h>
  1963           #elif defined(HAVE_LIBUSB_H)
  1964           #include <libusb.h>
  1965           #elif defined(HAVE_LIBUSBHID_H)
  1966           #include <libusbhid.h>
  1967           #endif
  1968         ],[
  1969           struct report_desc *repdesc;
  1970           struct usb_ctl_report *repbuf;
  1971           hid_kind_t hidkind;
  1972         ],[
  1973         have_usbhid=yes
  1974         ])
  1975         AC_MSG_RESULT($have_usbhid)
  1976 
  1977         if test x$have_usbhid = xyes; then
  1978             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1979             have_usbhid_ucr_data=no
  1980             AC_TRY_COMPILE([
  1981               #include <sys/types.h>
  1982               #if defined(HAVE_USB_H)
  1983               #include <usb.h>
  1984               #endif
  1985               #ifdef __DragonFly__
  1986               # include <bus/usb/usb.h>
  1987               # include <bus/usb/usbhid.h>
  1988               #else
  1989               # include <dev/usb/usb.h>
  1990               # include <dev/usb/usbhid.h>
  1991               #endif
  1992               #if defined(HAVE_USBHID_H)
  1993               #include <usbhid.h>
  1994               #elif defined(HAVE_LIBUSB_H)
  1995               #include <libusb.h>
  1996               #elif defined(HAVE_LIBUSBHID_H)
  1997               #include <libusbhid.h>
  1998               #endif
  1999             ],[
  2000               struct usb_ctl_report buf;
  2001               if (buf.ucr_data) { }
  2002             ],[
  2003             have_usbhid_ucr_data=yes
  2004             ])
  2005             if test x$have_usbhid_ucr_data = xyes; then
  2006                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2007             fi
  2008             AC_MSG_RESULT($have_usbhid_ucr_data)
  2009             
  2010             AC_MSG_CHECKING(for new usbhid API)
  2011             have_usbhid_new=no
  2012             AC_TRY_COMPILE([
  2013               #include <sys/types.h>
  2014               #if defined(HAVE_USB_H)
  2015               #include <usb.h>
  2016               #endif
  2017               #include <dev/usb/usb.h>
  2018               #include <dev/usb/usbhid.h>
  2019               #if defined(HAVE_USBHID_H)
  2020               #include <usbhid.h>
  2021               #elif defined(HAVE_LIBUSB_H)
  2022               #include <libusb.h>
  2023               #elif defined(HAVE_LIBUSBHID_H)
  2024               #include <libusbhid.h>
  2025               #endif
  2026             ],[
  2027               report_desc_t d;
  2028               hid_start_parse(d, 1, 1);
  2029             ],[
  2030             have_usbhid_new=yes
  2031             ])
  2032             if test x$have_usbhid_new = xyes; then
  2033                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2034             fi
  2035             AC_MSG_RESULT($have_usbhid_new)
  2036 
  2037             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2038             have_machine_joystick=no
  2039             AC_TRY_COMPILE([
  2040               #include <machine/joystick.h>
  2041             ],[
  2042               struct joystick t;
  2043             ],[
  2044             have_machine_joystick=yes
  2045             ])
  2046             if test x$have_machine_joystick = xyes; then
  2047                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2048             fi
  2049             AC_MSG_RESULT($have_machine_joystick)
  2050 
  2051             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2052             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2053             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2054             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2055             have_joystick=yes
  2056         fi
  2057         CFLAGS="$save_CFLAGS"
  2058     fi
  2059 }
  2060 
  2061 dnl Check for clock_gettime()
  2062 CheckClockGettime()
  2063 {
  2064     AC_ARG_ENABLE(clock_gettime,
  2065 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2066                   , enable_clock_gettime=no)
  2067     if test x$enable_clock_gettime = xyes; then
  2068         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2069         if test x$have_clock_gettime = xyes; then
  2070             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2071             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2072         fi
  2073     fi
  2074 }
  2075 
  2076 dnl Check for a valid linux/version.h
  2077 CheckLinuxVersion()
  2078 {
  2079     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2080     if test x$have_linux_version_h = xyes; then
  2081         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2082     fi
  2083 }
  2084 
  2085 dnl Check if we want to use RPATH
  2086 CheckRPATH()
  2087 {
  2088     AC_ARG_ENABLE(rpath,
  2089 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2090                   , enable_rpath=yes)
  2091 }
  2092 
  2093 dnl Set up the configuration based on the host platform!
  2094 case "$host" in
  2095     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2096         ARCH=linux
  2097         CheckDummyVideo
  2098         CheckIPod
  2099         # Set up files for the timer library
  2100         if test x$enable_timers = xyes; then
  2101             AC_DEFINE(SDL_TIMER_UNIX)
  2102             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2103             have_timers=yes
  2104         fi
  2105         ;;
  2106     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  2107         case "$host" in
  2108             *-*-linux*)         ARCH=linux ;;
  2109             *-*-uclinux*)       ARCH=linux ;;
  2110             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2111             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2112             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2113             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2114             *-*-bsdi*)          ARCH=bsdi ;;
  2115             *-*-freebsd*)       ARCH=freebsd ;;
  2116             *-*-dragonfly*)     ARCH=freebsd ;;
  2117             *-*-netbsd*)        ARCH=netbsd ;;
  2118             *-*-openbsd*)       ARCH=openbsd ;;
  2119             *-*-sysv5*)         ARCH=sysv5 ;;
  2120             *-*-solaris*)       ARCH=solaris ;;
  2121             *-*-hpux*)          ARCH=hpux ;;
  2122             *-*-irix*)          ARCH=irix ;;
  2123             *-*-aix*)           ARCH=aix ;;
  2124             *-*-osf*)           ARCH=osf ;;
  2125         esac
  2126         CheckVisibilityHidden
  2127         CheckDummyVideo
  2128         CheckDiskAudio
  2129         CheckDummyAudio
  2130         CheckDLOPEN
  2131         CheckNASM
  2132         CheckAltivec
  2133         CheckOSS
  2134         CheckDMEDIA
  2135         CheckMME
  2136         CheckALSA
  2137         CheckARTSC
  2138         CheckESD
  2139         CheckNAS
  2140         CheckX11
  2141         CheckNANOX
  2142         CheckFBCON
  2143         CheckDirectFB
  2144         CheckPS2GS
  2145         CheckGGI
  2146         CheckSVGA
  2147         CheckVGL
  2148         CheckWscons
  2149         CheckAAlib
  2150         CheckQtopia
  2151         CheckPicoGUI
  2152         CheckOpenGLX11
  2153         CheckInputEvents
  2154         CheckTslib
  2155         CheckUSBHID
  2156         CheckPTHREAD
  2157         CheckClockGettime
  2158         CheckLinuxVersion
  2159         CheckRPATH
  2160         # Set up files for the audio library
  2161         if test x$enable_audio = xyes; then
  2162           case $ARCH in
  2163             sysv5|solaris|hpux)
  2164                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2165                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2166                 have_audio=yes
  2167             ;;
  2168             netbsd|openbsd)
  2169                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2170                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2171                 have_audio=yes
  2172             ;;
  2173             aix)
  2174                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
  2175                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2176                 have_audio=yes
  2177             ;;
  2178           esac
  2179         fi
  2180         # Set up files for the joystick library
  2181         if test x$enable_joystick = xyes; then
  2182           case $ARCH in
  2183             linux)
  2184                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2185                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2186                 have_joystick=yes
  2187             ;;
  2188           esac
  2189         fi
  2190         # Set up files for the cdrom library
  2191         if test x$enable_cdrom = xyes; then
  2192           case $ARCH in
  2193             linux|solaris)
  2194                 AC_DEFINE(SDL_CDROM_LINUX)
  2195                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2196                 have_cdrom=yes
  2197             ;;
  2198             *freebsd*)
  2199                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2200                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2201                 have_cdrom=yes
  2202             ;;
  2203             *openbsd*|*netbsd*)
  2204                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2205                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2206                 have_cdrom=yes
  2207             ;;
  2208             bsdi)
  2209                 AC_DEFINE(SDL_CDROM_BSDI)
  2210                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2211                 have_cdrom=yes
  2212             ;;
  2213             aix)
  2214                 AC_DEFINE(SDL_CDROM_AIX)
  2215                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2216                 have_cdrom=yes
  2217             ;;
  2218             osf)
  2219                 AC_DEFINE(SDL_CDROM_OSF)
  2220                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2221                 have_cdrom=yes
  2222             ;;
  2223           esac
  2224         fi
  2225         # Set up files for the thread library
  2226         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2227             AC_DEFINE(SDL_THREAD_SPROC)
  2228             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2229             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2230             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2231             have_threads=yes
  2232         fi
  2233         # Set up files for the timer library
  2234         if test x$enable_timers = xyes; then
  2235             AC_DEFINE(SDL_TIMER_UNIX)
  2236             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2237             have_timers=yes
  2238         fi
  2239         ;;
  2240     *-*-qnx*)
  2241         ARCH=qnx
  2242         CheckDummyVideo
  2243         CheckDiskAudio
  2244         CheckDummyAudio
  2245         # CheckNASM
  2246         CheckDLOPEN
  2247         CheckNAS
  2248         CheckPHOTON
  2249         CheckX11
  2250         CheckOpenGLX11
  2251         CheckPTHREAD
  2252         # Set up files for the audio library
  2253         if test x$enable_audio = xyes; then
  2254             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2255             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2256             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2257             have_audio=yes
  2258         fi
  2259         # Set up files for the cdrom library
  2260         if test x$enable_cdrom = xyes; then
  2261             AC_DEFINE(SDL_CDROM_QNX)
  2262             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2263             have_cdrom=yes
  2264         fi
  2265         # Set up files for the timer library
  2266         if test x$enable_timers = xyes; then
  2267             AC_DEFINE(SDL_TIMER_UNIX)
  2268             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2269             have_timers=yes
  2270         fi
  2271         ;;
  2272     *-*-cygwin* | *-*-mingw32*)
  2273         ARCH=win32
  2274         if test "$build" != "$host"; then # cross-compiling
  2275             # Default cross-compile location
  2276             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2277         else
  2278             # Look for the location of the tools and install there
  2279             if test "$BUILD_PREFIX" != ""; then
  2280                 ac_default_prefix=$BUILD_PREFIX
  2281             fi
  2282         fi
  2283         CheckDummyVideo
  2284         CheckDiskAudio
  2285         CheckDummyAudio
  2286         CheckWIN32
  2287         CheckWIN32GL
  2288         CheckDIRECTX
  2289         CheckNASM
  2290         # Set up files for the audio library
  2291         if test x$enable_audio = xyes; then
  2292             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2293             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2294             if test x$have_directx = xyes; then
  2295                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2296                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2297             fi
  2298             have_audio=yes
  2299         fi
  2300         # Set up files for the joystick library
  2301         if test x$enable_joystick = xyes; then
  2302             AC_DEFINE(SDL_JOYSTICK_WINMM)
  2303             SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
  2304             have_joystick=yes
  2305         fi
  2306         # Set up files for the cdrom library
  2307         if test x$enable_cdrom = xyes; then
  2308             AC_DEFINE(SDL_CDROM_WIN32)
  2309             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2310             have_cdrom=yes
  2311         fi
  2312         # Set up files for the thread library
  2313         if test x$enable_threads = xyes; then
  2314             AC_DEFINE(SDL_THREAD_WIN32)
  2315             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2316             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2317             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2318             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2319             have_threads=yes
  2320         fi
  2321         # Set up files for the timer library
  2322         if test x$enable_timers = xyes; then
  2323             AC_DEFINE(SDL_TIMER_WIN32)
  2324             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2325             have_timers=yes
  2326         fi
  2327         # Set up files for the shared object loading library
  2328         if test x$enable_loadso = xyes; then
  2329             AC_DEFINE(SDL_LOADSO_WIN32)
  2330             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2331             have_loadso=yes
  2332         fi
  2333         # Set up the system libraries we need
  2334         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
  2335         if test x$have_directx = xyes; then
  2336             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
  2337         fi
  2338         # The Win32 platform requires special setup
  2339         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2340         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2341         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2342         ;;
  2343     *-*-beos*)
  2344         ARCH=beos
  2345         ac_default_prefix=/boot/develop/tools/gnupro
  2346         CheckDummyVideo
  2347         CheckDiskAudio
  2348         CheckDummyAudio
  2349         CheckNASM
  2350         CheckBWINDOW
  2351         CheckBeGL
  2352         # Set up files for the audio library
  2353         if test x$enable_audio = xyes; then
  2354             AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
  2355             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2356             have_audio=yes
  2357         fi
  2358         # Set up files for the joystick library
  2359         if test x$enable_joystick = xyes; then
  2360             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2361             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2362             have_joystick=yes
  2363         fi
  2364         # Set up files for the cdrom library
  2365         if test x$enable_cdrom = xyes; then
  2366             AC_DEFINE(SDL_CDROM_BEOS)
  2367             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2368             have_cdrom=yes
  2369         fi
  2370         # Set up files for the thread library
  2371         if test x$enable_threads = xyes; then
  2372             AC_DEFINE(SDL_THREAD_BEOS)
  2373             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2374             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2375             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2376             have_threads=yes
  2377         fi
  2378         # Set up files for the timer library
  2379         if test x$enable_timers = xyes; then
  2380             AC_DEFINE(SDL_TIMER_BEOS)
  2381             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2382             have_timers=yes
  2383         fi
  2384         # Set up files for the shared object loading library
  2385         if test x$enable_loadso = xyes; then
  2386             AC_DEFINE(SDL_LOADSO_BEOS)
  2387             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2388             have_loadso=yes
  2389         fi
  2390         # The BeOS platform requires special setup.
  2391         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2392         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2393         ;;
  2394     *-*-darwin* )
  2395         # This could be either full "Mac OS X", or plain "Darwin" which is
  2396         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2397         # Next line is broken, and a few files below require Mac OS X (full)
  2398         ARCH=macosx
  2399 
  2400         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2401         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2402         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2403 
  2404         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2405         # is -lm which is not needed under Mac OS X. But for some reasons it
  2406         # also tends to contain spurious -L switches, which we don't want to
  2407         # use here or in sdl-config. Hence we reset it.
  2408         EXTRA_LDFLAGS=""
  2409 
  2410         CheckVisibilityHidden
  2411         CheckDummyVideo
  2412         CheckDiskAudio
  2413         CheckDummyAudio
  2414         CheckDLOPEN
  2415 
  2416         # Set up files for the shared object loading library
  2417         # (this needs to be done before the dynamic X11 check)
  2418         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2419             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2420             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2421             have_loadso=yes
  2422         fi
  2423 
  2424         CheckCOCOA
  2425         CheckCARBON
  2426         CheckX11
  2427         CheckMacGL
  2428         CheckOpenGLX11
  2429         CheckPTHREAD
  2430         CheckAltivec
  2431 
  2432         # Need this or things might misbuild on a G3.
  2433         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2434 
  2435         # Set up files for the audio library
  2436         if test x$enable_audio = xyes; then
  2437             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2438             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2439             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2440             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2441             have_audio=yes
  2442         fi
  2443         # Set up files for the joystick library
  2444         if test x$enable_joystick = xyes; then
  2445             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2446             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2447             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2448             have_joystick=yes
  2449         fi
  2450         # Set up files for the cdrom library
  2451         if test x$enable_cdrom = xyes; then
  2452             AC_DEFINE(SDL_CDROM_MACOSX)
  2453             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2454             have_cdrom=yes
  2455         fi
  2456         # Set up files for the timer library
  2457         if test x$enable_timers = xyes; then
  2458             AC_DEFINE(SDL_TIMER_UNIX)
  2459             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2460             have_timers=yes
  2461         fi
  2462         # The Mac OS X platform requires special setup.
  2463         SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
  2464         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2465         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2466         if test x$enable_video_cocoa = xyes; then
  2467             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2468         fi
  2469         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
  2470             # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2471             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices"
  2472             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2473         fi
  2474         # If either the audio or CD driver is used, add the AudioUnit framework
  2475         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2476             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2477         fi
  2478         ;;
  2479     *-*-mint*)
  2480         ARCH=mint
  2481         CheckDummyVideo
  2482         CheckDiskAudio
  2483         CheckDummyAudio
  2484         CheckAtariBiosEvent
  2485         CheckAtariXbiosVideo
  2486         CheckAtariGemVideo
  2487         CheckAtariAudio
  2488         CheckAtariLdg
  2489         CheckAtariOSMesa
  2490         CheckPTH
  2491         # Set up files for the audio library
  2492         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2493             if test x$enable_audio = xyes; then
  2494                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2495                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2496                 have_audio=yes
  2497             fi
  2498         fi
  2499         # Set up files for the joystick library
  2500         if test x$enable_joystick = xyes; then
  2501             AC_DEFINE(SDL_JOYSTICK_MINT)
  2502             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2503             have_joystick=yes
  2504         fi
  2505         # Set up files for the cdrom library
  2506         if test x$enable_cdrom = xyes; then
  2507             AC_DEFINE(SDL_CDROM_MINT)
  2508             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2509             have_cdrom=yes
  2510         fi
  2511         # Set up files for the timer library
  2512         if test x$enable_timers = xyes; then
  2513             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2514                 AC_DEFINE(SDL_TIMER_UNIX)
  2515                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2516             else
  2517                 AC_DEFINE(SDL_TIMER_MINT)
  2518                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2519                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2520             fi
  2521             have_timers=yes
  2522         fi
  2523         ;;
  2524     *-riscos)
  2525         ARCH=riscos
  2526         CheckOSS
  2527         CheckPTHREAD
  2528         # Set up files for the video library
  2529         if test x$enable_video = xyes; then
  2530             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2531             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2532             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2533             have_video=yes
  2534         fi
  2535         # Set up files for the joystick library
  2536         if test x$enable_joystick = xyes; then
  2537             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2538             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2539             have_joystick=yes
  2540         fi
  2541         # Set up files for the timer library
  2542         if test x$enable_timers = xyes; then
  2543             AC_DEFINE(SDL_TIMER_RISCOS)
  2544             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2545             have_timers=yes
  2546         fi
  2547         # The RISC OS platform requires special setup.
  2548         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2549         ;;
  2550     *)
  2551         AC_MSG_ERROR([
  2552 *** Unsupported host:  Please add to configure.in
  2553         ])
  2554         ;;
  2555 esac
  2556 
  2557 # Verify that we have all the platform specific files we need
  2558 if test x$have_joystick != xyes; then
  2559     if test x$enable_joystick = xyes; then
  2560         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2561     fi
  2562     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2563 fi
  2564 if test x$have_cdrom != xyes; then
  2565     if test x$enable_cdrom = xyes; then
  2566         AC_DEFINE(SDL_CDROM_DISABLED)
  2567     fi
  2568     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2569 fi
  2570 if test x$have_threads != xyes; then
  2571     if test x$enable_threads = xyes; then
  2572         AC_DEFINE(SDL_THREADS_DISABLED)
  2573     fi
  2574     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2575 fi
  2576 if test x$have_timers != xyes; then
  2577     if test x$enable_timers = xyes; then
  2578         AC_DEFINE(SDL_TIMERS_DISABLED)
  2579     fi
  2580     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2581 fi
  2582 if test x$have_loadso != xyes; then
  2583     if test x$enable_loadso = xyes; then
  2584         AC_DEFINE(SDL_LOADSO_DISABLED)
  2585     fi
  2586     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2587 fi
  2588 if test x$SDLMAIN_SOURCES = x; then
  2589     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2590 fi
  2591 
  2592 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2593 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2594 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2595 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2596 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2597 
  2598 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2599 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
  2600 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2601 
  2602 # Set runtime shared library paths as needed
  2603 
  2604 if test "x$enable_rpath" = "xyes"; then
  2605   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2606     SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2607   fi
  2608   if test $ARCH = solaris; then
  2609     SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2610   fi
  2611 else
  2612   SDL_RLD_FLAGS=""
  2613 fi
  2614 
  2615 case "$ARCH" in
  2616   macosx)
  2617     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2618       SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa"
  2619     fi
  2620     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  2621       SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon"
  2622     fi
  2623     # Evil hack to allow static linking on Mac OS X
  2624     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a $EXTRA_LDFLAGS"
  2625     ;;
  2626   *)
  2627     SDL_STATIC_LIBS="$SDL_LIBS"
  2628     ;;
  2629 esac
  2630 
  2631 dnl Expand the cflags and libraries needed by apps using SDL
  2632 AC_SUBST(SDL_CFLAGS)
  2633 AC_SUBST(SDL_LIBS)
  2634 AC_SUBST(SDL_STATIC_LIBS)
  2635 AC_SUBST(SDL_RLD_FLAGS)
  2636 if test x$enable_shared = xyes; then
  2637     ENABLE_SHARED_TRUE=
  2638     ENABLE_SHARED_FALSE="#"
  2639 else
  2640     ENABLE_SHARED_TRUE="#"
  2641     ENABLE_SHARED_FALSE=
  2642 fi
  2643 if test x$enable_static = xyes; then
  2644     ENABLE_STATIC_TRUE=
  2645     ENABLE_STATIC_FALSE="#"
  2646 else
  2647     ENABLE_STATIC_TRUE="#"
  2648     ENABLE_STATIC_FALSE=
  2649 fi
  2650 AC_SUBST(ENABLE_SHARED_TRUE)
  2651 AC_SUBST(ENABLE_SHARED_FALSE)
  2652 AC_SUBST(ENABLE_STATIC_TRUE)
  2653 AC_SUBST(ENABLE_STATIC_FALSE)
  2654 
  2655 dnl Expand the sources and objects needed to build the library
  2656 AC_SUBST(ac_aux_dir)
  2657 AC_SUBST(INCLUDE)
  2658 AC_SUBST(SOURCES)
  2659 AC_SUBST(OBJECTS)
  2660 AC_SUBST(SDLMAIN_SOURCES)
  2661 AC_SUBST(SDLMAIN_OBJECTS)
  2662 AC_SUBST(BUILD_CFLAGS)
  2663 AC_SUBST(EXTRA_CFLAGS)
  2664 AC_SUBST(BUILD_LDFLAGS)
  2665 AC_SUBST(EXTRA_LDFLAGS)
  2666 
  2667 AC_OUTPUT([
  2668     Makefile sdl-config SDL.spec SDL.qpg sdl.pc
  2669 ], [
  2670     : >build-deps
  2671     if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
  2672 ])