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