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