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