configure.in
author Ryan C. Gordon <icculus@icculus.org>
Mon, 21 Sep 2009 06:08:23 +0000
branchSDL-1.2
changeset 4204 976bc19f8f6b
parent 4192 2f5e884f0a9d
child 4208 453587d6dc87
permissions -rw-r--r--
1.2 Quartz video: Ripped out QuickDraw and QuickTime.

Now we use the software path for YUV, and CoreGraphics for 2D stuff.

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