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