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