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