configure.in
author Ryan C. Gordon
Thu, 15 Feb 2007 23:57:07 +0000
changeset 2093 cdaeb26ed66a
parent 2085 962aa10fa95b
child 2103 4a010418f3b9
permissions -rw-r--r--
Merged r2981:2982 from branches/SDL-1.2: fbcon getpagesize() compile fix.
     1 dnl Process this file with autoconf to produce a configure script.
     2 AC_INIT(README)
     3 AC_CONFIG_HEADER(include/SDL_config.h)
     4 AC_GNU_SOURCE
     5 
     6 dnl Set various version strings - taken gratefully from the GTk sources
     7 #
     8 # Making releases:
     9 # Edit include/SDL/SDL_version.h and change the version, then:
    10 #   SDL_MICRO_VERSION += 1;
    11 #   SDL_INTERFACE_AGE += 1;
    12 #   SDL_BINARY_AGE += 1;
    13 # if any functions have been added, set SDL_INTERFACE_AGE to 0.
    14 # if backwards compatibility has been broken,
    15 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
    16 #
    17 SDL_MAJOR_VERSION=1
    18 SDL_MINOR_VERSION=3
    19 SDL_MICRO_VERSION=0
    20 SDL_INTERFACE_AGE=0
    21 SDL_BINARY_AGE=0
    22 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
    23 
    24 AC_SUBST(SDL_MAJOR_VERSION)
    25 AC_SUBST(SDL_MINOR_VERSION)
    26 AC_SUBST(SDL_MICRO_VERSION)
    27 AC_SUBST(SDL_INTERFACE_AGE)
    28 AC_SUBST(SDL_BINARY_AGE)
    29 AC_SUBST(SDL_VERSION)
    30 
    31 # libtool versioning
    32 LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
    33 LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
    34 LT_REVISION=$SDL_INTERFACE_AGE
    35 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
    36 
    37 AC_SUBST(LT_RELEASE)
    38 AC_SUBST(LT_CURRENT)
    39 AC_SUBST(LT_REVISION)
    40 AC_SUBST(LT_AGE)
    41 
    42 dnl Detect the canonical build and host environments
    43 AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
    44 AC_CANONICAL_HOST
    45 AC_C_BIGENDIAN
    46 if test x$ac_cv_c_bigendian = xyes; then
    47     AC_DEFINE(SDL_BYTEORDER, 4321)
    48 else
    49     AC_DEFINE(SDL_BYTEORDER, 1234)
    50 fi
    51 
    52 dnl Set up the compiler and linker flags
    53 INCLUDE="-I$srcdir/include"
    54 if test x$srcdir != x.; then
    55     # Remove SDL_config.h from the source directory, since it's the
    56     # default one, and we want to include the one that we generate.
    57     if test -f $srcdir/include/SDL_config.h; then
    58         rm $srcdir/include/SDL_config.h
    59     fi
    60     INCLUDE="-Iinclude $INCLUDE"
    61 fi
    62 case "$host" in
    63     *-*-cygwin*)
    64         # We build SDL on cygwin without the UNIX emulation layer
    65         BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    66         BASE_LDFLAGS="-mno-cygwin"
    67         ;;
    68     *)
    69         BASE_CFLAGS="-D_GNU_SOURCE=1"
    70         BASE_LDFLAGS=""
    71         ;;
    72 esac
    73 BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
    74 EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
    75 BUILD_LDFLAGS="$LDFLAGS"
    76 EXTRA_LDFLAGS="$BASE_LDFLAGS"
    77 # I can't remember why I added this.  I'm sure it'll come to me...
    78 #for path in /usr/local; do
    79 #    if test -d $path/include; then
    80 #        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
    81 #    fi
    82 #    if test -d $path/lib; then
    83 #        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
    84 #    fi
    85 #done
    86 SDL_CFLAGS="$BASE_CFLAGS"
    87 SDL_LIBS="-lSDL $BASE_LDFLAGS"
    88 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
    89 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
    90 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
    91 
    92 dnl Check for tools
    93 AC_LIBTOOL_WIN32_DLL
    94 AC_PROG_LIBTOOL
    95 AC_PROG_CC
    96 AC_PROG_CXX
    97 AC_PROG_INSTALL
    98 AC_PROG_MAKE_SET
    99 
   100 dnl Check for compiler characteristics
   101 AC_C_CONST
   102 AC_C_INLINE
   103 AC_C_VOLATILE
   104 
   105 dnl See whether we are allowed to use the system C library
   106 AC_ARG_ENABLE(libc,
   107 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
   108               , enable_libc=yes)
   109 if test x$enable_libc = xyes; then
   110     AC_DEFINE(HAVE_LIBC)
   111 
   112     dnl Check for C library headers
   113     AC_HEADER_STDC
   114     AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
   115 
   116     dnl Check for typedefs, structures, etc.
   117     AC_TYPE_SIZE_T
   118     if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
   119         AC_CHECK_TYPE(int64_t)
   120         if test x$ac_cv_type_int64_t = xyes; then
   121             AC_DEFINE(SDL_HAS_64BIT_TYPE)
   122         fi
   123         have_inttypes=yes
   124     fi
   125 
   126     dnl Checks for library functions.
   127     case "$host" in
   128     *-*-cygwin* | *-*-mingw32*)
   129         ;;
   130     *)
   131         AC_FUNC_ALLOCA
   132         ;;
   133     esac
   134 
   135     AC_FUNC_MEMCMP
   136     if test x$ac_cv_func_memcmp_working = xyes; then
   137         AC_DEFINE(HAVE_MEMCMP)
   138     fi
   139     AC_FUNC_STRTOD
   140     if test x$ac_cv_func_strtod = xyes; then
   141         AC_DEFINE(HAVE_STRTOD)
   142     fi
   143     AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf iconv sigaction setjmp nanosleep)
   144 
   145     AC_CHECK_LIB(iconv, libiconv_open, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
   146     AC_CHECK_LIB(m, pow, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
   147 fi
   148 
   149 if test x$have_inttypes != xyes; then
   150     AC_CHECK_SIZEOF(char, 1)
   151     AC_CHECK_SIZEOF(short, 2)
   152     AC_CHECK_SIZEOF(int, 4)
   153     AC_CHECK_SIZEOF(long, 4)
   154     AC_CHECK_SIZEOF(long long, 8)
   155     if test x$ac_cv_sizeof_char = x1; then
   156         AC_DEFINE(int8_t, signed char)
   157         AC_DEFINE(uint8_t, unsigned char)
   158     fi
   159     if test x$ac_cv_sizeof_short = x2; then
   160         AC_DEFINE(int16_t, signed short)
   161         AC_DEFINE(uint16_t, unsigned short)
   162     else
   163         if test x$ac_cv_sizeof_int = x2; then
   164             AC_DEFINE(int16_t, signed int)
   165             AC_DEFINE(uint16_t, unsigned int)
   166         fi
   167     fi
   168     if test x$ac_cv_sizeof_int = x4; then
   169         AC_DEFINE(int32_t, signed int)
   170         AC_DEFINE(uint32_t, unsigned int)
   171     else
   172         if test x$ac_cv_sizeof_long = x4; then
   173             AC_DEFINE(int32_t, signed long)
   174             AC_DEFINE(uint32_t, unsigned long)
   175         fi
   176     fi
   177     if test x$ac_cv_sizeof_long = x8; then
   178         AC_DEFINE(int64_t, signed long)
   179         AC_DEFINE(uint64_t, unsigned long)
   180         AC_DEFINE(SDL_HAS_64BIT_TYPE)
   181     else
   182         if test x$ac_cv_sizeof_long_long = x8; then
   183             AC_DEFINE(int64_t, signed long long)
   184             AC_DEFINE(uint64_t, unsigned long long)
   185             AC_DEFINE(SDL_HAS_64BIT_TYPE)
   186         fi
   187     fi
   188     AC_DEFINE(size_t, unsigned int)
   189     AC_DEFINE(uintptr_t, unsigned long)
   190 fi
   191 
   192 # Standard C sources
   193 SOURCES="$SOURCES $srcdir/src/*.c"
   194 SOURCES="$SOURCES $srcdir/src/audio/*.c"
   195 SOURCES="$SOURCES $srcdir/src/cdrom/*.c"
   196 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
   197 SOURCES="$SOURCES $srcdir/src/events/*.c"
   198 SOURCES="$SOURCES $srcdir/src/file/*.c"
   199 SOURCES="$SOURCES $srcdir/src/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_CHECK_FUNCS(getpagesize)
  1121             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
  1122             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
  1123             have_video=yes
  1124         fi
  1125     fi
  1126 }
  1127 
  1128 dnl Find DirectFB
  1129 CheckDirectFB()
  1130 {
  1131     AC_ARG_ENABLE(video-directfb,
  1132 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=yes]]]),
  1133                   , enable_video_directfb=yes)
  1134     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1135         video_directfb=no
  1136 
  1137         DIRECTFB_REQUIRED_VERSION=0.9.15
  1138 
  1139         AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
  1140         if test x$DIRECTFBCONFIG = xno; then
  1141             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1142             AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1143             if test x$PKG_CONFIG != xno; then
  1144                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1145                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1146                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1147                     video_directfb=yes
  1148                 fi
  1149             fi
  1150             AC_MSG_RESULT($video_directfb)
  1151         else
  1152             AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1153             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1154             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1155             set -- `directfb-config --version | sed 's/\./ /g'`
  1156             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1157             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1158                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1159                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1160                 video_directfb=yes
  1161             fi
  1162             AC_MSG_RESULT($video_directfb)
  1163         fi
  1164 
  1165         if test x$video_directfb = xyes; then
  1166             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1167             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1168             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1169             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1170             have_video=yes
  1171         fi
  1172     fi
  1173 }
  1174 
  1175 dnl See if we're running on PlayStation 2 hardware
  1176 CheckPS2GS()
  1177 {
  1178     AC_ARG_ENABLE(video-ps2gs,
  1179 AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=yes]]]),
  1180                   , enable_video_ps2gs=yes)
  1181     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
  1182         AC_MSG_CHECKING(for PlayStation 2 GS support)
  1183         video_ps2gs=no
  1184         AC_TRY_COMPILE([
  1185          #include <linux/ps2/dev.h>
  1186          #include <linux/ps2/gs.h>
  1187         ],[
  1188         ],[
  1189         video_ps2gs=yes
  1190         ])
  1191         AC_MSG_RESULT($video_ps2gs)
  1192         if test x$video_ps2gs = xyes; then
  1193             AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
  1194             SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
  1195             have_video=yes
  1196         fi
  1197     fi
  1198 }
  1199 
  1200 dnl Find the SVGAlib includes and libraries
  1201 CheckSVGA()
  1202 {
  1203     AC_ARG_ENABLE(video-svga,
  1204 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=yes]]]),
  1205                   , enable_video_svga=yes)
  1206     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1207         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1208         video_svga=no
  1209         AC_TRY_COMPILE([
  1210          #include <vga.h>
  1211          #include <vgamouse.h>
  1212          #include <vgakeyboard.h>
  1213         ],[
  1214          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1215              exit(0);
  1216          }
  1217         ],[
  1218         video_svga=yes
  1219         ])
  1220         AC_MSG_RESULT($video_svga)
  1221         if test x$video_svga = xyes; then
  1222             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1223             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1224             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
  1225             have_video=yes
  1226         fi
  1227     fi
  1228 }
  1229 
  1230 dnl Find the VGL includes and libraries
  1231 CheckVGL()
  1232 {
  1233     AC_ARG_ENABLE(video-vgl,
  1234 AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [[default=yes]]]),
  1235                   , enable_video_vgl=yes)
  1236     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
  1237         AC_MSG_CHECKING(for libVGL support)
  1238         video_vgl=no
  1239         AC_TRY_COMPILE([
  1240          #include <sys/fbio.h>
  1241          #include <sys/consio.h>
  1242          #include <sys/kbio.h>
  1243          #include <vgl.h>
  1244         ],[
  1245          VGLBitmap bitmap;
  1246          bitmap.Type = VIDBUF32;
  1247          bitmap.PixelBytes = 4;
  1248          exit(bitmap.Bitmap);
  1249         ],[
  1250         video_vgl=yes
  1251         ])
  1252         AC_MSG_RESULT($video_vgl)
  1253         if test x$video_vgl = xyes; then
  1254             AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
  1255             SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
  1256             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl"
  1257             have_video=yes
  1258         fi
  1259     fi
  1260 }
  1261 
  1262 dnl Set up the wscons video driver if enabled
  1263 CheckWscons()
  1264 {
  1265     AC_ARG_ENABLE(video-wscons,
  1266 AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [[default=yes]]]),
  1267                   , enable_video_wscons=yes)
  1268     if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
  1269         AC_MSG_CHECKING(for wscons support)
  1270         video_wscons=no
  1271         AC_TRY_COMPILE([
  1272          #include <sys/time.h>
  1273          #include <dev/wscons/wsconsio.h>
  1274          #include <dev/wscons/wsdisplay_usl_io.h>
  1275         ],[
  1276          int wsmode = WSDISPLAYIO_MODE_DUMBFB;
  1277         ],[
  1278         video_wscons=yes
  1279         ])
  1280         AC_MSG_RESULT($video_wscons)
  1281         if test x$video_wscons = xyes; then
  1282             AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
  1283             SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
  1284             have_video=yes
  1285         fi
  1286     fi
  1287 }
  1288 
  1289 dnl Set up the Atari Bios keyboard driver
  1290 CheckAtariBiosEvent()
  1291 {
  1292     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
  1293     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S"
  1294 }
  1295 
  1296 dnl Set up the Atari Xbios driver
  1297 CheckAtariXbiosVideo()
  1298 {
  1299     AC_ARG_ENABLE(video-xbios,
  1300 AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [[default=yes]]]),
  1301                   , enable_video_xbios=yes)
  1302     video_xbios=no
  1303     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1304         video_xbios=yes
  1305         AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
  1306         SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
  1307         have_video=yes
  1308     fi
  1309 }
  1310 
  1311 dnl Set up the Atari Gem driver
  1312 CheckAtariGemVideo()
  1313 {
  1314     AC_ARG_ENABLE(video-gem,
  1315 AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [[default=yes]]]),
  1316                   , enable_video_gem=yes)
  1317     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1318         video_gem=no
  1319         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1320         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1321         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1322             video_gem=yes
  1323             AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
  1324             SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
  1325             SDL_LIBS="$SDL_LIBS -lgem"
  1326             have_video=yes
  1327         fi
  1328     fi
  1329 }
  1330 
  1331 dnl rcg04172001 Set up the Null video driver.
  1332 CheckDummyVideo()
  1333 {
  1334     AC_ARG_ENABLE(video-dummy,
  1335 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1336                   , enable_video_dummy=yes)
  1337     if test x$enable_video_dummy = xyes; then
  1338         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1339         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1340         have_video=yes
  1341     fi
  1342 }
  1343 
  1344 dnl Check to see if OpenGL support is desired
  1345 AC_ARG_ENABLE(video-opengl,
  1346 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1347               , enable_video_opengl=yes)
  1348 
  1349 dnl Find OpenGL
  1350 CheckOpenGLX11()
  1351 {
  1352     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1353         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1354         video_opengl=no
  1355         AC_TRY_COMPILE([
  1356          #include <GL/gl.h>
  1357          #include <GL/glx.h>
  1358         ],[
  1359         ],[
  1360         video_opengl=yes
  1361         ])
  1362         AC_MSG_RESULT($video_opengl)
  1363         if test x$video_opengl = xyes; then
  1364             AC_DEFINE(SDL_VIDEO_OPENGL)
  1365             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1366             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1367         fi
  1368     fi
  1369 }
  1370 
  1371 dnl Find QNX RtP OpenGL
  1372 CheckOpenGLQNX()
  1373 {
  1374     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1375         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1376         video_opengl=no
  1377         AC_TRY_COMPILE([
  1378          #include <GL/gl.h>
  1379         ],[
  1380         ],[
  1381         video_opengl=yes
  1382         ])
  1383         AC_MSG_RESULT($video_opengl)
  1384         if test x$video_opengl = xyes; then
  1385             AC_DEFINE(SDL_VIDEO_OPENGL)
  1386             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1387             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1388         fi
  1389     fi
  1390 }
  1391 
  1392 dnl Check for Win32 OpenGL
  1393 CheckWIN32GL()
  1394 {
  1395     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1396         AC_DEFINE(SDL_VIDEO_OPENGL)
  1397         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1398         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1399     fi
  1400 }
  1401 
  1402 dnl Check for BeOS OpenGL
  1403 CheckBeGL()
  1404 {
  1405     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1406         AC_DEFINE(SDL_VIDEO_OPENGL)
  1407         AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
  1408         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1409         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1410     fi
  1411 }
  1412 
  1413 dnl Check for MacOS OpenGL
  1414 CheckMacGL()
  1415 {
  1416     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1417         AC_DEFINE(SDL_VIDEO_OPENGL)
  1418         AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
  1419         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1420         case "$host" in
  1421             *-*-darwin*)
  1422                 if test x$enable_video_cocoa = xyes; then
  1423                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1424                 fi
  1425         esac
  1426     fi
  1427 }
  1428 
  1429 dnl Check for Mesa offscreen rendering
  1430 CheckAtariOSMesa()
  1431 {
  1432     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1433         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1434         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1435 
  1436         # Static linking to -lOSMesa
  1437         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1438         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1439             # -lOSMesa is really the static library
  1440             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1441                 OSMESA_LIBS="-lOSMesa"
  1442             fi
  1443         else
  1444             # -lOSMesa is a loader for OSMesa.ldg
  1445             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1446             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1447         fi
  1448         AC_DEFINE(SDL_VIDEO_OPENGL)
  1449         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1450         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1451         SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
  1452         SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
  1453 
  1454         AC_ARG_ENABLE(osmesa-shared,
  1455 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]),
  1456                               , enable_osmesa_shared=yes)
  1457         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1458             # Dynamic linking
  1459             if test "x$have_osmesa_hdr" = "xyes"; then
  1460                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1461             fi
  1462         fi
  1463     fi
  1464 }
  1465 
  1466 dnl See if we can use the new unified event interface in Linux 2.4
  1467 CheckInputEvents()
  1468 {
  1469     dnl Check for Linux 2.4 unified input event interface support
  1470     AC_ARG_ENABLE(input-events,
  1471 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1472                   , enable_input_events=yes)
  1473     if test x$enable_input_events = xyes; then
  1474         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1475         use_input_events=no
  1476         AC_TRY_COMPILE([
  1477           #include <linux/input.h>
  1478         ],[
  1479           #ifndef EVIOCGNAME
  1480           #error EVIOCGNAME() ioctl not available
  1481           #endif
  1482         ],[
  1483         use_input_events=yes
  1484         ])
  1485         AC_MSG_RESULT($use_input_events)
  1486         if test x$use_input_events = xyes; then
  1487             AC_DEFINE(SDL_INPUT_LINUXEV)
  1488         fi
  1489     fi
  1490 }
  1491 
  1492 dnl See if we can use the Touchscreen input library
  1493 CheckTslib()
  1494 {
  1495     AC_ARG_ENABLE(input-tslib,
  1496 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1497                   , enable_input_tslib=yes)
  1498     if test x$enable_input_tslib = xyes; then
  1499         AC_MSG_CHECKING(for Touchscreen library support)
  1500         enable_input_tslib=no
  1501         AC_TRY_COMPILE([
  1502           #include "tslib.h"
  1503         ],[
  1504         ],[
  1505         enable_input_tslib=yes
  1506         ])
  1507         AC_MSG_RESULT($enable_input_tslib)
  1508         if test x$enable_input_tslib = xyes; then
  1509             AC_DEFINE(SDL_INPUT_TSLIB)
  1510             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1511         fi
  1512     fi
  1513 }
  1514 
  1515 dnl See if we can use GNU pth library for threads
  1516 CheckPTH()
  1517 {
  1518     dnl Check for pth support
  1519     AC_ARG_ENABLE(pth,
  1520 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
  1521                   , enable_pth=yes)
  1522     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1523         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1524         if test "$PTH_CONFIG" = "no"; then
  1525             use_pth=no
  1526         else
  1527             use_pth=yes
  1528         fi
  1529         AC_MSG_CHECKING(pth)
  1530         AC_MSG_RESULT($use_pth)
  1531         if test "x$use_pth" = xyes; then
  1532             AC_DEFINE(SDL_THREAD_PTH)
  1533             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1534             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1535             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1536             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1537             have_threads=yes
  1538         fi
  1539     fi
  1540 }
  1541 
  1542 dnl See what type of thread model to use on Linux and Solaris
  1543 CheckPTHREAD()
  1544 {
  1545     dnl Check for pthread support
  1546     AC_ARG_ENABLE(pthreads,
  1547 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1548                   , enable_pthreads=yes)
  1549     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1550     AC_ARG_ENABLE(pthread-sem,
  1551 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1552                   , enable_pthread_sem=yes)
  1553     case "$host" in
  1554         *-*-linux*|*-*-uclinux*)
  1555             pthread_cflags="-D_REENTRANT"
  1556             pthread_lib="-lpthread"
  1557             ;;
  1558         *-*-bsdi*)
  1559             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1560             pthread_lib=""
  1561             ;;
  1562         *-*-darwin*)
  1563             pthread_cflags="-D_THREAD_SAFE"
  1564 # causes Carbon.p complaints?
  1565 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1566             ;;
  1567         *-*-freebsd*|*-*-dragonfly*)
  1568             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1569             pthread_lib="-pthread"
  1570             ;;
  1571         *-*-netbsd*)
  1572             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1573             pthread_lib="-L/usr/lib -lpthread"
  1574             ;;
  1575         *-*-openbsd*)
  1576             pthread_cflags="-D_REENTRANT"
  1577             pthread_lib="-pthread"
  1578             ;;
  1579         *-*-solaris*)
  1580             pthread_cflags="-D_REENTRANT"
  1581             pthread_lib="-lpthread -lposix4"
  1582             ;;
  1583         *-*-sysv5*)
  1584             pthread_cflags="-D_REENTRANT -Kthread"
  1585             pthread_lib=""
  1586             ;;
  1587         *-*-irix*)
  1588             pthread_cflags="-D_SGI_MP_SOURCE"
  1589             pthread_lib="-lpthread"
  1590             ;;
  1591         *-*-aix*)
  1592             pthread_cflags="-D_REENTRANT -mthreads"
  1593             pthread_lib="-lpthread"
  1594             ;;
  1595         *-*-hpux11*)
  1596             pthread_cflags="-D_REENTRANT"
  1597             pthread_lib="-L/usr/lib -lpthread"
  1598             ;;
  1599         *-*-qnx*)
  1600             pthread_cflags=""
  1601             pthread_lib=""
  1602             ;;
  1603         *-*-osf*)
  1604             pthread_cflags="-D_REENTRANT"
  1605             if test x$ac_cv_prog_gcc = xyes; then
  1606                 pthread_lib="-lpthread -lrt"
  1607             else
  1608                 pthread_lib="-lpthread -lexc -lrt"
  1609             fi
  1610             ;;
  1611         *)
  1612             pthread_cflags="-D_REENTRANT"
  1613             pthread_lib="-lpthread"
  1614             ;;
  1615     esac
  1616     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1617         # Save the original compiler flags and libraries
  1618         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1619         # Add the pthread compiler flags and libraries
  1620         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1621         # Check to see if we have pthread support on this system
  1622         AC_MSG_CHECKING(for pthreads)
  1623         use_pthreads=no
  1624         AC_TRY_LINK([
  1625          #include <pthread.h>
  1626         ],[
  1627          pthread_attr_t type;
  1628          pthread_attr_init(&type);
  1629         ],[
  1630         use_pthreads=yes
  1631         ])
  1632         AC_MSG_RESULT($use_pthreads)
  1633         # Restore the compiler flags and libraries
  1634         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1635 
  1636         # Do futher testing if we have pthread support...
  1637         if test x$use_pthreads = xyes; then
  1638             AC_DEFINE(SDL_THREAD_PTHREAD)
  1639             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1640             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1641             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1642             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1643 
  1644             # Save the original compiler flags and libraries
  1645             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1646             # Add the pthread compiler flags and libraries
  1647             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1648 
  1649             # Check to see if recursive mutexes are available
  1650             AC_MSG_CHECKING(for recursive mutexes)
  1651             has_recursive_mutexes=no
  1652             if test x$has_recursive_mutexes = xno; then
  1653                 AC_TRY_COMPILE([
  1654                   #include <pthread.h>
  1655                 ],[
  1656                   pthread_mutexattr_t attr;
  1657                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1658                 ],[
  1659                 has_recursive_mutexes=yes
  1660                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1661                 ])
  1662             fi
  1663             if test x$has_recursive_mutexes = xno; then
  1664                 AC_TRY_COMPILE([
  1665                   #include <pthread.h>
  1666                 ],[
  1667                   pthread_mutexattr_t attr;
  1668                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1669                 ],[
  1670                 has_recursive_mutexes=yes
  1671                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1672                 ])
  1673             fi
  1674             AC_MSG_RESULT($has_recursive_mutexes)
  1675 
  1676             # Check to see if pthread semaphore support is missing
  1677             if test x$enable_pthread_sem = xyes; then
  1678                 AC_MSG_CHECKING(for pthread semaphores)
  1679                 have_pthread_sem=no
  1680                 AC_TRY_COMPILE([
  1681                   #include <pthread.h>
  1682                   #include <semaphore.h>
  1683                 ],[
  1684                 ],[
  1685                 have_pthread_sem=yes
  1686                 ])
  1687                 AC_MSG_RESULT($have_pthread_sem)
  1688             fi
  1689 
  1690             # Restore the compiler flags and libraries
  1691             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1692 
  1693             # Basic thread creation functions
  1694             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1695 
  1696             # Semaphores
  1697             # We can fake these with mutexes and condition variables if necessary
  1698             if test x$have_pthread_sem = xyes; then
  1699                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1700             else
  1701                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1702             fi
  1703 
  1704             # Mutexes
  1705             # We can fake these with semaphores if necessary
  1706             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1707 
  1708             # Condition variables
  1709             # We can fake these with semaphores and mutexes if necessary
  1710             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1711 
  1712             have_threads=yes
  1713         else
  1714             CheckPTH
  1715         fi
  1716     fi
  1717 }
  1718 
  1719 dnl Determine whether the compiler can produce Win32 executables
  1720 CheckWIN32()
  1721 {
  1722     AC_MSG_CHECKING(Win32 compiler)
  1723     have_win32_gcc=no
  1724     AC_TRY_COMPILE([
  1725      #include <windows.h>
  1726     ],[
  1727     ],[
  1728     have_win32_gcc=yes
  1729     ])
  1730     AC_MSG_RESULT($have_win32_gcc)
  1731     if test x$have_win32_gcc != xyes; then
  1732        AC_MSG_ERROR([
  1733 *** Your compiler ($CC) does not produce Win32 executables!
  1734        ])
  1735     fi
  1736 
  1737     dnl See if the user wants to redirect standard output to files
  1738     AC_ARG_ENABLE(stdio-redirect,
  1739 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  1740                   , enable_stdio_redirect=yes)
  1741     if test x$enable_stdio_redirect != xyes; then
  1742         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  1743     fi
  1744 }
  1745 
  1746 dnl Find the DirectX includes and libraries
  1747 CheckDIRECTX()
  1748 {
  1749     AC_ARG_ENABLE(directx,
  1750 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  1751                   , enable_directx=yes)
  1752     if test x$enable_directx = xyes; then
  1753         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  1754         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1755         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1756     fi
  1757 }
  1758 
  1759 dnl Check for the dlfcn.h interface for dynamically loading objects
  1760 CheckDLOPEN()
  1761 {
  1762     AC_ARG_ENABLE(sdl-dlopen,
  1763 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1764                   , enable_sdl_dlopen=yes)
  1765     if test x$enable_sdl_dlopen = xyes; then
  1766         AC_MSG_CHECKING(for dlopen)
  1767         have_dlopen=no
  1768         AC_TRY_COMPILE([
  1769          #include <dlfcn.h>
  1770         ],[
  1771          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1772          #error Use dlcompat for Mac OS X 10.2 compatibility
  1773          #endif
  1774         ],[
  1775         have_dlopen=yes
  1776         ])
  1777         AC_MSG_RESULT($have_dlopen)
  1778 
  1779         if test x$have_dlopen = xyes; then
  1780             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1781                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1782                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1783             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1784             if test x$have_dlvsym = xyes; then
  1785                 AC_DEFINE(HAVE_DLVSYM)
  1786             fi
  1787             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1788             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1789             have_loadso=yes
  1790         fi
  1791     fi
  1792 }
  1793 
  1794 dnl Set up the Atari LDG (shared object loader)
  1795 CheckAtariLdg()
  1796 {
  1797     AC_ARG_ENABLE(atari-ldg,
  1798 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]),
  1799                   , enable_atari_ldg=yes)
  1800     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1801         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1802         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1803         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1804             AC_DEFINE(SDL_LOADSO_LDG)
  1805             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1806             SDL_LIBS="$SDL_LIBS -lldg -lgem"
  1807             have_loadso=yes
  1808         fi
  1809     fi
  1810 }
  1811 
  1812 dnl Check for the usbhid(3) library on *BSD
  1813 CheckUSBHID()
  1814 {
  1815     if test x$enable_joystick = xyes; then
  1816         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1817         if test x$have_libusbhid = xyes; then
  1818             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1819             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1820             USB_LIBS="$USB_LIBS -lusbhid"
  1821         else
  1822             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1823             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1824             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1825         fi
  1826             
  1827         save_CFLAGS="$CFLAGS"
  1828         CFLAGS="$CFLAGS $USB_CFLAGS"
  1829 
  1830         AC_MSG_CHECKING(for usbhid)
  1831         have_usbhid=no
  1832         AC_TRY_COMPILE([
  1833           #include <sys/types.h>
  1834           #if defined(HAVE_USB_H)
  1835           #include <usb.h>
  1836           #endif
  1837           #ifdef __DragonFly__
  1838           # include <bus/usb/usb.h>
  1839           # include <bus/usb/usbhid.h>
  1840           #else
  1841           # include <dev/usb/usb.h>
  1842           # include <dev/usb/usbhid.h>
  1843           #endif
  1844           #if defined(HAVE_USBHID_H)
  1845           #include <usbhid.h>
  1846           #elif defined(HAVE_LIBUSB_H)
  1847           #include <libusb.h>
  1848           #elif defined(HAVE_LIBUSBHID_H)
  1849           #include <libusbhid.h>
  1850           #endif
  1851         ],[
  1852           struct report_desc *repdesc;
  1853           struct usb_ctl_report *repbuf;
  1854           hid_kind_t hidkind;
  1855         ],[
  1856         have_usbhid=yes
  1857         ])
  1858         AC_MSG_RESULT($have_usbhid)
  1859 
  1860         if test x$have_usbhid = xyes; then
  1861             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1862             have_usbhid_ucr_data=no
  1863             AC_TRY_COMPILE([
  1864               #include <sys/types.h>
  1865               #if defined(HAVE_USB_H)
  1866               #include <usb.h>
  1867               #endif
  1868               #ifdef __DragonFly__
  1869               # include <bus/usb/usb.h>
  1870               # include <bus/usb/usbhid.h>
  1871               #else
  1872               # include <dev/usb/usb.h>
  1873               # include <dev/usb/usbhid.h>
  1874               #endif
  1875               #if defined(HAVE_USBHID_H)
  1876               #include <usbhid.h>
  1877               #elif defined(HAVE_LIBUSB_H)
  1878               #include <libusb.h>
  1879               #elif defined(HAVE_LIBUSBHID_H)
  1880               #include <libusbhid.h>
  1881               #endif
  1882             ],[
  1883               struct usb_ctl_report buf;
  1884               if (buf.ucr_data) { }
  1885             ],[
  1886             have_usbhid_ucr_data=yes
  1887             ])
  1888             if test x$have_usbhid_ucr_data = xyes; then
  1889                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1890             fi
  1891             AC_MSG_RESULT($have_usbhid_ucr_data)
  1892             
  1893             AC_MSG_CHECKING(for new usbhid API)
  1894             have_usbhid_new=no
  1895             AC_TRY_COMPILE([
  1896               #include <sys/types.h>
  1897               #if defined(HAVE_USB_H)
  1898               #include <usb.h>
  1899               #endif
  1900               #include <dev/usb/usb.h>
  1901               #include <dev/usb/usbhid.h>
  1902               #if defined(HAVE_USBHID_H)
  1903               #include <usbhid.h>
  1904               #elif defined(HAVE_LIBUSB_H)
  1905               #include <libusb.h>
  1906               #elif defined(HAVE_LIBUSBHID_H)
  1907               #include <libusbhid.h>
  1908               #endif
  1909             ],[
  1910               report_desc_t d;
  1911               hid_start_parse(d, 1, 1);
  1912             ],[
  1913             have_usbhid_new=yes
  1914             ])
  1915             if test x$have_usbhid_new = xyes; then
  1916                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  1917             fi
  1918             AC_MSG_RESULT($have_usbhid_new)
  1919 
  1920             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  1921             have_machine_joystick=no
  1922             AC_TRY_COMPILE([
  1923               #include <machine/joystick.h>
  1924             ],[
  1925               struct joystick t;
  1926             ],[
  1927             have_machine_joystick=yes
  1928             ])
  1929             if test x$have_machine_joystick = xyes; then
  1930                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  1931             fi
  1932             AC_MSG_RESULT($have_machine_joystick)
  1933 
  1934             AC_DEFINE(SDL_JOYSTICK_USBHID)
  1935             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  1936             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  1937             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  1938             have_joystick=yes
  1939         fi
  1940         CFLAGS="$save_CFLAGS"
  1941     fi
  1942 }
  1943 
  1944 dnl Check for clock_gettime()
  1945 CheckClockGettime()
  1946 {
  1947     AC_ARG_ENABLE(clock_gettime,
  1948 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  1949                   , enable_clock_gettime=no)
  1950     if test x$enable_clock_gettime = xyes; then
  1951         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  1952         if test x$have_clock_gettime = xyes; then
  1953             AC_DEFINE(HAVE_CLOCK_GETTIME)
  1954             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  1955         fi
  1956     fi
  1957 }
  1958 
  1959 dnl Check for a valid linux/version.h
  1960 CheckLinuxVersion()
  1961 {
  1962     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  1963     if test x$have_linux_version_h = xyes; then
  1964         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  1965     fi
  1966 }
  1967 
  1968 dnl Check if we want to use RPATH
  1969 CheckRPATH()
  1970 {
  1971     AC_ARG_ENABLE(rpath,
  1972 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  1973                   , enable_rpath=yes)
  1974 }
  1975 
  1976 dnl Set up the configuration based on the host platform!
  1977 case "$host" in
  1978     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  1979         ARCH=linux
  1980         CheckDummyVideo
  1981         CheckIPod
  1982         # Set up files for the timer library
  1983         if test x$enable_timers = xyes; then
  1984             AC_DEFINE(SDL_TIMER_UNIX)
  1985             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  1986             have_timers=yes
  1987         fi
  1988         ;;
  1989     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  1990         case "$host" in
  1991             *-*-linux*)         ARCH=linux ;;
  1992             *-*-uclinux*)       ARCH=linux ;;
  1993             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  1994             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  1995             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  1996             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  1997             *-*-bsdi*)          ARCH=bsdi ;;
  1998             *-*-freebsd*)       ARCH=freebsd ;;
  1999             *-*-dragonfly*)     ARCH=freebsd ;;
  2000             *-*-netbsd*)        ARCH=netbsd ;;
  2001             *-*-openbsd*)       ARCH=openbsd ;;
  2002             *-*-sysv5*)         ARCH=sysv5 ;;
  2003             *-*-solaris*)       ARCH=solaris ;;
  2004             *-*-hpux*)          ARCH=hpux ;;
  2005             *-*-irix*)          ARCH=irix ;;
  2006             *-*-aix*)           ARCH=aix ;;
  2007             *-*-osf*)           ARCH=osf ;;
  2008         esac
  2009         CheckVisibilityHidden
  2010         CheckDummyVideo
  2011         CheckDiskAudio
  2012         CheckDummyAudio
  2013         CheckDLOPEN
  2014         CheckNASM
  2015         CheckAltivec
  2016         CheckOSS
  2017         CheckDMEDIA
  2018         CheckMME
  2019         CheckALSA
  2020         CheckARTSC
  2021         CheckESD
  2022         CheckNAS
  2023         CheckX11
  2024         CheckNANOX
  2025         CheckFBCON
  2026         CheckDirectFB
  2027         CheckPS2GS
  2028         CheckSVGA
  2029         CheckVGL
  2030         CheckWscons
  2031         CheckOpenGLX11
  2032         CheckInputEvents
  2033         CheckTslib
  2034         CheckUSBHID
  2035         CheckPTHREAD
  2036         CheckClockGettime
  2037         CheckLinuxVersion
  2038         CheckRPATH
  2039         # Set up files for the audio library
  2040         if test x$enable_audio = xyes; then
  2041           case $ARCH in
  2042             sysv5|solaris|hpux)
  2043                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2044                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2045                 have_audio=yes
  2046             ;;
  2047             netbsd|openbsd)
  2048                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2049                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2050                 have_audio=yes
  2051             ;;
  2052             aix)
  2053                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
  2054                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2055                 have_audio=yes
  2056             ;;
  2057           esac
  2058         fi
  2059         # Set up files for the joystick library
  2060         if test x$enable_joystick = xyes; then
  2061           case $ARCH in
  2062             linux)
  2063                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2064                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2065                 have_joystick=yes
  2066             ;;
  2067           esac
  2068         fi
  2069         # Set up files for the cdrom library
  2070         if test x$enable_cdrom = xyes; then
  2071           case $ARCH in
  2072             linux|solaris)
  2073                 AC_DEFINE(SDL_CDROM_LINUX)
  2074                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2075                 have_cdrom=yes
  2076             ;;
  2077             *freebsd*)
  2078                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2079                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2080                 have_cdrom=yes
  2081             ;;
  2082             *openbsd*|*netbsd*)
  2083                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2084                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2085                 have_cdrom=yes
  2086             ;;
  2087             bsdi)
  2088                 AC_DEFINE(SDL_CDROM_BSDI)
  2089                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2090                 have_cdrom=yes
  2091             ;;
  2092             aix)
  2093                 AC_DEFINE(SDL_CDROM_AIX)
  2094                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2095                 have_cdrom=yes
  2096             ;;
  2097             osf)
  2098                 AC_DEFINE(SDL_CDROM_OSF)
  2099                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2100                 have_cdrom=yes
  2101             ;;
  2102           esac
  2103         fi
  2104         # Set up files for the thread library
  2105         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2106             AC_DEFINE(SDL_THREAD_SPROC)
  2107             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2108             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2109             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2110             have_threads=yes
  2111         fi
  2112         # Set up files for the timer library
  2113         if test x$enable_timers = xyes; then
  2114             AC_DEFINE(SDL_TIMER_UNIX)
  2115             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2116             have_timers=yes
  2117         fi
  2118         ;;
  2119     *-*-qnx*)
  2120         ARCH=qnx
  2121         CheckDummyVideo
  2122         CheckDiskAudio
  2123         CheckDummyAudio
  2124         # CheckNASM
  2125         CheckDLOPEN
  2126         CheckNAS
  2127         CheckPHOTON
  2128         CheckX11
  2129         CheckOpenGLX11
  2130         CheckPTHREAD
  2131         # Set up files for the audio library
  2132         if test x$enable_audio = xyes; then
  2133             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2134             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2135             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2136             have_audio=yes
  2137         fi
  2138         # Set up files for the cdrom library
  2139         if test x$enable_cdrom = xyes; then
  2140             AC_DEFINE(SDL_CDROM_QNX)
  2141             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2142             have_cdrom=yes
  2143         fi
  2144         # Set up files for the timer library
  2145         if test x$enable_timers = xyes; then
  2146             AC_DEFINE(SDL_TIMER_UNIX)
  2147             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2148             have_timers=yes
  2149         fi
  2150         ;;
  2151     *-*-cygwin* | *-*-mingw32*)
  2152         ARCH=win32
  2153         if test "$build" != "$host"; then # cross-compiling
  2154             # Default cross-compile location
  2155             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2156         else
  2157             # Look for the location of the tools and install there
  2158             if test "$BUILD_PREFIX" != ""; then
  2159                 ac_default_prefix=$BUILD_PREFIX
  2160             fi
  2161         fi
  2162         CheckDummyVideo
  2163         CheckDiskAudio
  2164         CheckDummyAudio
  2165         CheckWIN32
  2166         CheckWIN32GL
  2167         CheckDIRECTX
  2168         CheckNASM
  2169         # Set up files for the video library
  2170         if test x$enable_video = xyes; then
  2171             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2172             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2173             have_video=yes
  2174             AC_ARG_ENABLE(render-gdi,
  2175 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2176                                 , enable_render_gdi=yes)
  2177             if test x$enable_render_gdi = xyes; then
  2178                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2179             fi
  2180             AC_ARG_ENABLE(render-d3d,
  2181 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2182                                 , enable_render_d3d=yes)
  2183             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2184                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2185             fi
  2186         fi
  2187         # Set up files for the audio library
  2188         if test x$enable_audio = xyes; then
  2189             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2190             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2191             if test x$have_dsound = xyes; then
  2192                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2193                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2194             fi
  2195             have_audio=yes
  2196         fi
  2197         # Set up files for the joystick library
  2198         if test x$enable_joystick = xyes; then
  2199             if test x$have_dinput = xyes; then
  2200                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2201                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
  2202             else
  2203                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2204                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
  2205             fi
  2206             have_joystick=yes
  2207         fi
  2208         # Set up files for the cdrom library
  2209         if test x$enable_cdrom = xyes; then
  2210             AC_DEFINE(SDL_CDROM_WIN32)
  2211             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2212             have_cdrom=yes
  2213         fi
  2214         # Set up files for the thread library
  2215         if test x$enable_threads = xyes; then
  2216             AC_DEFINE(SDL_THREAD_WIN32)
  2217             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2218             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2219             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2220             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2221             have_threads=yes
  2222         fi
  2223         # Set up files for the timer library
  2224         if test x$enable_timers = xyes; then
  2225             AC_DEFINE(SDL_TIMER_WIN32)
  2226             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2227             have_timers=yes
  2228         fi
  2229         # Set up files for the shared object loading library
  2230         if test x$enable_loadso = xyes; then
  2231             AC_DEFINE(SDL_LOADSO_WIN32)
  2232             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2233             have_loadso=yes
  2234         fi
  2235         # Set up the system libraries we need
  2236         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm"
  2237         # The Win32 platform requires special setup
  2238         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2239         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2240         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2241         ;;
  2242     *-*-beos*)
  2243         ARCH=beos
  2244         ac_default_prefix=/boot/develop/tools/gnupro
  2245         CheckDummyVideo
  2246         CheckDiskAudio
  2247         CheckDummyAudio
  2248         CheckNASM
  2249         CheckBWINDOW
  2250         CheckBeGL
  2251         # Set up files for the audio library
  2252         if test x$enable_audio = xyes; then
  2253             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
  2254             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2255             have_audio=yes
  2256         fi
  2257         # Set up files for the joystick library
  2258         if test x$enable_joystick = xyes; then
  2259             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2260             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2261             have_joystick=yes
  2262         fi
  2263         # Set up files for the cdrom library
  2264         if test x$enable_cdrom = xyes; then
  2265             AC_DEFINE(SDL_CDROM_BEOS)
  2266             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2267             have_cdrom=yes
  2268         fi
  2269         # Set up files for the thread library
  2270         if test x$enable_threads = xyes; then
  2271             AC_DEFINE(SDL_THREAD_BEOS)
  2272             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2273             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2274             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2275             have_threads=yes
  2276         fi
  2277         # Set up files for the timer library
  2278         if test x$enable_timers = xyes; then
  2279             AC_DEFINE(SDL_TIMER_BEOS)
  2280             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2281             have_timers=yes
  2282         fi
  2283         # Set up files for the shared object loading library
  2284         if test x$enable_loadso = xyes; then
  2285             AC_DEFINE(SDL_LOADSO_BEOS)
  2286             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2287             have_loadso=yes
  2288         fi
  2289         # The BeOS platform requires special setup.
  2290         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2291         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2292         ;;
  2293     *-*-darwin* )
  2294         # This could be either full "Mac OS X", or plain "Darwin" which is
  2295         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2296         # Next line is broken, and a few files below require Mac OS X (full)
  2297         ARCH=macosx
  2298 
  2299         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2300         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2301         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2302 
  2303         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2304         # is -lm which is not needed under Mac OS X. But for some reasons it
  2305         # also tends to contain spurious -L switches, which we don't want to
  2306         # use here or in sdl-config. Hence we reset it.
  2307         EXTRA_LDFLAGS=""
  2308 
  2309         CheckVisibilityHidden
  2310         CheckDummyVideo
  2311         CheckDiskAudio
  2312         CheckDummyAudio
  2313         CheckDLOPEN
  2314 
  2315         # Temporarily disabled:
  2316         # ld: mmxp2_32.o has external relocation entries in non-writable section (__TEXT,__text) for symbols: _mmxreturn
  2317         #CheckNASM
  2318 
  2319         # Set up files for the shared object loading library
  2320         # (this needs to be done before the dynamic X11 check)
  2321         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2322             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2323             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2324             have_loadso=yes
  2325         fi
  2326 
  2327         CheckCOCOA
  2328         CheckX11
  2329         CheckMacGL
  2330         CheckOpenGLX11
  2331         CheckPTHREAD
  2332         CheckAltivec
  2333 
  2334         # Need this or things might misbuild on a G3.
  2335         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2336 
  2337         # Set up files for the audio library
  2338         if test x$enable_audio = xyes; then
  2339             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2340             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2341             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2342             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2343             have_audio=yes
  2344         fi
  2345         # Set up files for the joystick library
  2346         if test x$enable_joystick = xyes; then
  2347             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2348             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2349             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2350             have_joystick=yes
  2351         fi
  2352         # Set up files for the cdrom library
  2353         if test x$enable_cdrom = xyes; then
  2354             AC_DEFINE(SDL_CDROM_MACOSX)
  2355             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2356             have_cdrom=yes
  2357         fi
  2358         # Set up files for the timer library
  2359         if test x$enable_timers = xyes; then
  2360             AC_DEFINE(SDL_TIMER_UNIX)
  2361             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2362             have_timers=yes
  2363         fi
  2364         # The Mac OS X platform requires special setup.
  2365         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2366         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2367         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2368         # If either the audio or CD driver is used, add the AudioUnit framework
  2369         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2370             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -framework,AudioToolbox -Wl,-framework,AudioUnit"
  2371         fi
  2372         ;;
  2373     *-*-mint*)
  2374         ARCH=mint
  2375         CheckDummyVideo
  2376         CheckDiskAudio
  2377         CheckDummyAudio
  2378         CheckAtariBiosEvent
  2379         CheckAtariXbiosVideo
  2380         CheckAtariGemVideo
  2381         CheckAtariAudio
  2382         CheckAtariLdg
  2383         CheckAtariOSMesa
  2384         CheckPTH
  2385         # Set up files for the audio library
  2386         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2387             if test x$enable_audio = xyes; then
  2388                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2389                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2390                 have_audio=yes
  2391             fi
  2392         fi
  2393         # Set up files for the joystick library
  2394         if test x$enable_joystick = xyes; then
  2395             AC_DEFINE(SDL_JOYSTICK_MINT)
  2396             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2397             have_joystick=yes
  2398         fi
  2399         # Set up files for the cdrom library
  2400         if test x$enable_cdrom = xyes; then
  2401             AC_DEFINE(SDL_CDROM_MINT)
  2402             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2403             have_cdrom=yes
  2404         fi
  2405         # Set up files for the timer library
  2406         if test x$enable_timers = xyes; then
  2407             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2408                 AC_DEFINE(SDL_TIMER_UNIX)
  2409                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2410             else
  2411                 AC_DEFINE(SDL_TIMER_MINT)
  2412                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2413                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2414             fi
  2415             have_timers=yes
  2416         fi
  2417         ;;
  2418     *-riscos)
  2419         ARCH=riscos
  2420         CheckOSS
  2421         CheckPTHREAD
  2422         # Set up files for the video library
  2423         if test x$enable_video = xyes; then
  2424             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2425             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2426             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2427             have_video=yes
  2428         fi
  2429         # Set up files for the joystick library
  2430         if test x$enable_joystick = xyes; then
  2431             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2432             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2433             have_joystick=yes
  2434         fi
  2435         # Set up files for the timer library
  2436         if test x$enable_timers = xyes; then
  2437             AC_DEFINE(SDL_TIMER_RISCOS)
  2438             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2439             have_timers=yes
  2440         fi
  2441         # The RISC OS platform requires special setup.
  2442         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2443         ;;
  2444     *)
  2445         AC_MSG_ERROR([
  2446 *** Unsupported host:  Please add to configure.in
  2447         ])
  2448         ;;
  2449 esac
  2450 
  2451 # Verify that we have all the platform specific files we need
  2452 
  2453 if test x$enable_joystick = xyes; then
  2454   if test x$have_joystick != xyes; then
  2455     # Wants joystick subsystem, but doesn't have a platform-specific backend...
  2456     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2457   fi
  2458 fi
  2459 if test x$have_cdrom != xyes; then
  2460     if test x$enable_cdrom = xyes; then
  2461         AC_DEFINE(SDL_CDROM_DISABLED)
  2462     fi
  2463     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2464 fi
  2465 if test x$have_threads != xyes; then
  2466     if test x$enable_threads = xyes; then
  2467         AC_DEFINE(SDL_THREADS_DISABLED)
  2468     fi
  2469     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2470 fi
  2471 if test x$have_timers != xyes; then
  2472     if test x$enable_timers = xyes; then
  2473         AC_DEFINE(SDL_TIMERS_DISABLED)
  2474     fi
  2475     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2476 fi
  2477 if test x$have_loadso != xyes; then
  2478     if test x$enable_loadso = xyes; then
  2479         AC_DEFINE(SDL_LOADSO_DISABLED)
  2480     fi
  2481     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2482 fi
  2483 if test x$SDLMAIN_SOURCES = x; then
  2484     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2485 fi
  2486 
  2487 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2488 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2489 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2490 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2491 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2492 
  2493 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2494 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2495 
  2496 # Set runtime shared library paths as needed
  2497 
  2498 if test "x$enable_rpath" = "xyes"; then
  2499   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2500     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2501   fi
  2502   if test $ARCH = solaris; then
  2503     SDL_RLD_FLAGS="-R\${libdir}"
  2504   fi
  2505 else
  2506   SDL_RLD_FLAGS=""
  2507 fi
  2508 
  2509 case "$ARCH" in
  2510   macosx)
  2511     # Evil hack to allow static linking on Mac OS X
  2512     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2513     ;;
  2514   *)
  2515     SDL_STATIC_LIBS="$SDL_LIBS"
  2516     ;;
  2517 esac
  2518 
  2519 dnl Expand the cflags and libraries needed by apps using SDL
  2520 AC_SUBST(SDL_CFLAGS)
  2521 AC_SUBST(SDL_LIBS)
  2522 AC_SUBST(SDL_STATIC_LIBS)
  2523 AC_SUBST(SDL_RLD_FLAGS)
  2524 if test x$enable_shared = xyes; then
  2525     ENABLE_SHARED_TRUE=
  2526     ENABLE_SHARED_FALSE="#"
  2527 else
  2528     ENABLE_SHARED_TRUE="#"
  2529     ENABLE_SHARED_FALSE=
  2530 fi
  2531 if test x$enable_static = xyes; then
  2532     ENABLE_STATIC_TRUE=
  2533     ENABLE_STATIC_FALSE="#"
  2534 else
  2535     ENABLE_STATIC_TRUE="#"
  2536     ENABLE_STATIC_FALSE=
  2537 fi
  2538 AC_SUBST(ENABLE_SHARED_TRUE)
  2539 AC_SUBST(ENABLE_SHARED_FALSE)
  2540 AC_SUBST(ENABLE_STATIC_TRUE)
  2541 AC_SUBST(ENABLE_STATIC_FALSE)
  2542 
  2543 dnl Expand the sources and objects needed to build the library
  2544 AC_SUBST(ac_aux_dir)
  2545 AC_SUBST(INCLUDE)
  2546 AC_SUBST(SOURCES)
  2547 AC_SUBST(OBJECTS)
  2548 AC_SUBST(SDLMAIN_SOURCES)
  2549 AC_SUBST(SDLMAIN_OBJECTS)
  2550 AC_SUBST(BUILD_CFLAGS)
  2551 AC_SUBST(EXTRA_CFLAGS)
  2552 AC_SUBST(BUILD_LDFLAGS)
  2553 AC_SUBST(EXTRA_LDFLAGS)
  2554 
  2555 AC_OUTPUT([
  2556     Makefile sdl-config SDL.spec SDL.qpg sdl.pc
  2557 ], [
  2558     : >build-deps
  2559     if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
  2560 ])