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