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