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