configure.in
author Sam Lantinga <slouken@libsdl.org>
Thu, 02 Apr 2009 04:06:55 +0000
branchSDL-1.2
changeset 4165 3b8ac3d311a2
parent 4164 7a4c511c980a
child 4167 a6f635e5eaa6
permissions -rw-r--r--
Hello.

This patch provides basic support for video on the Sony PS3
Linux framebuffer. Scaling, format-conversion, and drawing is
done from the SPEs, so there is little performance impact to
PPE applications. This is by no means production quality code,
but it is a very good start and a good example of how to use the
PS3's hardware capabilities to accelerate video playback on
the box.

The driver has been verified to work with ffplay, mplayer and xine.
This piece of software has been developed at the IBM R&D Lab
in Boeblingen, Germany and is now returned to the community.

Enjoy !

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