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