configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 19 Jan 2011 00:07:43 -0800
changeset 5030 6a0803e47c7b
parent 5029 5d7d48157be7
child 5040 ff8873816c30
permissions -rw-r--r--
Greg Jandl to SDL

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