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