configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 07 Jun 2009 02:44:46 +0000
changeset 3168 6338b7f2d024
parent 3113 df2bb5735822
child 3170 b7a48f533966
permissions -rw-r--r--
Hi,

I have prepared a set of patches to readd WindowsCE support to SDL 1.3.
I've created a new GAPI/Rawframebuffer and a DirectDraw renderer.
Both renderers are work in progress and there are several unimplemented
cases. (Notably
RenderLine/RenderPoint/RenderFill/QueryTexturePixels/UpdateTexture and
texture blending )
Nevertheless I am successfully using these renderers together with the
SDL software renderer. (On most devices the SDL software renderer will
be much faster as there are only badly optimized vendor drivers available)

I send these patches now in this unpolished state because there seems to
be some interest in win ce and someone has to start supporting SDL 1.3

Now on to the patches:
wince_events_window_fixes.patch
fixes some wince incompatibilities and adds fullscreen support via
SHFullScreen. NOTE: This patch shouldn't have any side effects on
Windows, but I have NOT tested it on Windows, so please double-check.
This patch doesn't dependent on the following ones.

wince_renderers_system.patch
This patch does all necessary modifications to the SDL system.
- it adds the renderers to the configure system
- it adds the renderers to win32video

SDL_ceddrawrender.c
SDL_ceddrawrender.h
SDL_gapirender_c.h
SDL_gapirender.c
SDL_gapirender.h
these files add the new render drivers and should be placed in
src/video/win32

Some notes to people who want to test this:
- I have only compiled sdl with ming32ce, so the VisualC files are not
up to date
- As mingw32ce has no ddraw.h this file must be taken from the MS SDK
and modified to work with gcc
- I had to modify line 2611 in configure.in to
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer
-Wl,--image-base -Wl,0x10000"
otherwise GetCPinfo wouldn't link. If someone knows whats causing this
I'd be happy to hear about it.

It would be great if these patches could make their way into SVN as this
would make collaboration much much easier.

I'm out of office for the next week and therefore will be unavailable
via email.

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