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