configure.in
author Sam Lantinga <slouken@libsdl.org>
Sat, 05 Feb 2011 16:07:10 -0800
changeset 5199 164f20ba08eb
parent 5183 227d81a4b66c
child 5225 5d01d426f2ea
permissions -rw-r--r--
Updated the DirectFB support, from Couriersud

attached is a working directfb driver diff which works with the current
changes. There are a number of changes around it as well, e.g.
configure.in.

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