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