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