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