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