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