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