configure.in
author Sam Lantinga <slouken@libsdl.org>
Fri, 11 Dec 2009 15:14:13 +0000
branchSDL-1.2
changeset 4390 725e506f6243
parent 4351 3ae3624c3cbc
child 4538 74b5387da0c4
permissions -rw-r--r--
Fixed bug #895

Markus Rothe 2009-12-07 09:32:46 PST

Check if libspe2 is available

Building on PowerPC64 results in:

[...]
In file included from ./src/video/ps3/SDL_ps3events_c.h:33,
from ./src/video/ps3/SDL_ps3video.c:32:
./src/video/ps3/SDL_ps3video.h:34:21: error: libspe2.h: No such file or
directory
In file included from ./src/video/ps3/SDL_ps3events_c.h:33,
from ./src/video/ps3/SDL_ps3video.c:32:
./src/video/ps3/SDL_ps3video.h:75: error: expected specifier-qualifier-list
before 'spe_context_ptr_t'
./src/video/ps3/SDL_ps3video.c:78: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'fb_writer_spu'
./src/video/ps3/SDL_ps3video.c: In function 'PS3_VideoInit':
./src/video/ps3/SDL_ps3video.c:167: error: 'spu_data_t' has no member named
'program'
./src/video/ps3/SDL_ps3video.c:167: error: 'fb_writer_spu' undeclared (first
use in this function)
[...]

The problem is that the ps3 video driver is being build regardless if libspe2
is installed or not. The attached patch fixes this problem.

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