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