configure.in
author Ryan C. Gordon <icculus@icculus.org>
Sun, 08 Jul 2012 07:20:50 -0400
branchSDL-1.2
changeset 6353 dfcbd0d9209c
parent 6218 f114f1434ff6
child 6361 173deb250f75
permissions -rw-r--r--
Added OpenBSD "sndio" audio target.

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