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