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