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