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