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