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