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