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