configure.in
author Sam Lantinga <slouken@libsdl.org>
Fri, 14 Apr 2006 06:03:09 +0000
changeset 1637 9ba366b919c7
parent 1632 89e25c25213c
child 1638 ebd1aedb1292
permissions -rw-r--r--
Date: Fri, 31 Mar 2006 18:28:55 -0500
From: Mike Frysinger
Subject: [SDL] [patch] touchup configure --help output

the current output includes a lot of "default=yes" stuff in it ... except that
it lacks the [] around it

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