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