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