configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 08 May 2006 06:38:13 +0000
changeset 1783 c546353b1ad4
parent 1745 741dc4e89f3a
child 1799 50e9cca3fe7b
permissions -rw-r--r--
Fixed bug #203

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