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