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