configure.in
author Sam Lantinga <slouken@libsdl.org>
Sat, 05 Sep 2009 09:11:03 +0000
changeset 3243 5db962a9a991
parent 3242 af4a5af3cd2b
child 3257 94fb40a4a9a7
permissions -rw-r--r--
CD-ROM support is so passé :)
     1 dnl Process this file with autoconf to produce a configure script.
     2 AC_INIT(README)
     3 AC_CONFIG_HEADER(include/SDL_config.h)
     4 AC_GNU_SOURCE
     5 AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
     6 
     7 dnl Set various version strings - taken gratefully from the GTk sources
     8 #
     9 # Making releases:
    10 # Edit include/SDL/SDL_version.h and change the version, then:
    11 #   SDL_MICRO_VERSION += 1;
    12 #   SDL_INTERFACE_AGE += 1;
    13 #   SDL_BINARY_AGE += 1;
    14 # if any functions have been added, set SDL_INTERFACE_AGE to 0.
    15 # if backwards compatibility has been broken,
    16 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
    17 #
    18 SDL_MAJOR_VERSION=1
    19 SDL_MINOR_VERSION=3
    20 SDL_MICRO_VERSION=0
    21 SDL_INTERFACE_AGE=0
    22 SDL_BINARY_AGE=0
    23 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
    24 
    25 AC_SUBST(SDL_MAJOR_VERSION)
    26 AC_SUBST(SDL_MINOR_VERSION)
    27 AC_SUBST(SDL_MICRO_VERSION)
    28 AC_SUBST(SDL_INTERFACE_AGE)
    29 AC_SUBST(SDL_BINARY_AGE)
    30 AC_SUBST(SDL_VERSION)
    31 
    32 # libtool versioning
    33 LT_INIT([win32-dll])
    34 
    35 LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
    36 LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
    37 LT_REVISION=$SDL_INTERFACE_AGE
    38 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
    39 
    40 AC_SUBST(LT_RELEASE)
    41 AC_SUBST(LT_CURRENT)
    42 AC_SUBST(LT_REVISION)
    43 AC_SUBST(LT_AGE)
    44 
    45 dnl Detect the canonical build and host environments
    46 AC_CANONICAL_HOST
    47 AC_C_BIGENDIAN
    48 if test x$ac_cv_c_bigendian = xyes; then
    49     AC_DEFINE(SDL_BYTEORDER, 4321)
    50 else
    51     AC_DEFINE(SDL_BYTEORDER, 1234)
    52 fi
    53 
    54 dnl Set up the compiler and linker flags
    55 INCLUDE="-I$srcdir/include"
    56 if test x$srcdir != x.; then
    57     # Remove SDL_config.h from the source directory, since it's the
    58     # default one, and we want to include the one that we generate.
    59     if test -f $srcdir/include/SDL_config.h; then
    60         rm $srcdir/include/SDL_config.h
    61     fi
    62     INCLUDE="-Iinclude $INCLUDE"
    63 fi
    64 case "$host" in
    65     *-*-cygwin*)
    66         # We build SDL on cygwin without the UNIX emulation layer
    67         BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    68         BASE_LDFLAGS="-mno-cygwin"
    69         ;;
    70     *)
    71         BASE_CFLAGS="-D_GNU_SOURCE=1"
    72         BASE_LDFLAGS=""
    73         ;;
    74 esac
    75 BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
    76 EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
    77 BUILD_LDFLAGS="$LDFLAGS"
    78 EXTRA_LDFLAGS="$BASE_LDFLAGS"
    79 ## These are common directories to find software packages
    80 #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
    81 #    if test -d $path/include; then
    82 #        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
    83 #    fi
    84 #    if test -d $path/lib; then
    85 #        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
    86 #    fi
    87 #done
    88 SDL_CFLAGS="$BASE_CFLAGS"
    89 SDL_LIBS="-lSDL $BASE_LDFLAGS"
    90 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
    91 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
    92 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
    93 
    94 dnl Check for tools
    95 AC_PROG_LIBTOOL
    96 AC_PROG_CC
    97 AC_PROG_CXX
    98 AC_PROG_INSTALL
    99 AC_PROG_MAKE_SET
   100 if test -z "$host_alias"; then
   101     hostaliaswindres=
   102 else
   103     hostaliaswindres="$host_alias-windres"
   104 fi
   105 AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
   106 
   107 dnl Check for compiler characteristics
   108 AC_C_CONST
   109 AC_C_INLINE
   110 AC_C_VOLATILE
   111 
   112 dnl See whether we are allowed to use the system C library
   113 AC_ARG_ENABLE(libc,
   114 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
   115               , enable_libc=yes)
   116 if test x$enable_libc = xyes; then
   117     AC_DEFINE(HAVE_LIBC)
   118 
   119     dnl Check for C library headers
   120     AC_HEADER_STDC
   121     AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
   122 
   123     dnl Check for typedefs, structures, etc.
   124     AC_TYPE_SIZE_T
   125     if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
   126         AC_CHECK_TYPE(int64_t)
   127         if test x$ac_cv_type_int64_t = xyes; then
   128             AC_DEFINE(SDL_HAS_64BIT_TYPE)
   129         fi
   130         have_inttypes=yes
   131     fi
   132 
   133     dnl Check for defines
   134     AC_CHECK_DEFINE(M_PI, math.h)
   135 
   136     dnl Checks for library functions.
   137     case "$host" in
   138     *-*-cygwin* | *-*-mingw32*)
   139         ;;
   140     *)
   141         AC_FUNC_ALLOCA
   142         ;;
   143     esac
   144 
   145     AC_FUNC_MEMCMP
   146     if test x$ac_cv_func_memcmp_working = xyes; then
   147         AC_DEFINE(HAVE_MEMCMP)
   148     fi
   149     AC_FUNC_STRTOD
   150     if test x$ac_cv_func_strtod = xyes; then
   151         AC_DEFINE(HAVE_STRTOD)
   152     fi
   153     AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep)
   154 
   155     AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
   156     AC_CHECK_FUNCS(ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
   157 
   158     AC_CHECK_LIB(iconv, libiconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
   159     AC_CHECK_FUNCS(iconv)
   160 fi
   161 
   162 AC_CHECK_SIZEOF(void*)
   163 if test x$have_inttypes != xyes; then
   164     AC_CHECK_SIZEOF(char, 1)
   165     AC_CHECK_SIZEOF(short, 2)
   166     AC_CHECK_SIZEOF(int, 4)
   167     AC_CHECK_SIZEOF(long, 4)
   168     AC_CHECK_SIZEOF(long long, 8)
   169     if test x$ac_cv_sizeof_char = x1; then
   170         AC_DEFINE(int8_t, signed char)
   171         AC_DEFINE(uint8_t, unsigned char)
   172     fi
   173     if test x$ac_cv_sizeof_short = x2; then
   174         AC_DEFINE(int16_t, signed short)
   175         AC_DEFINE(uint16_t, unsigned short)
   176     else
   177         if test x$ac_cv_sizeof_int = x2; then
   178             AC_DEFINE(int16_t, signed int)
   179             AC_DEFINE(uint16_t, unsigned int)
   180         fi
   181     fi
   182     if test x$ac_cv_sizeof_int = x4; then
   183         AC_DEFINE(int32_t, signed int)
   184         AC_DEFINE(uint32_t, unsigned int)
   185     else
   186         if test x$ac_cv_sizeof_long = x4; then
   187             AC_DEFINE(int32_t, signed long)
   188             AC_DEFINE(uint32_t, unsigned long)
   189         fi
   190     fi
   191     if test x$ac_cv_sizeof_long = x8; then
   192         AC_DEFINE(int64_t, signed long)
   193         AC_DEFINE(uint64_t, unsigned long)
   194         AC_DEFINE(SDL_HAS_64BIT_TYPE)
   195     else
   196         if test x$ac_cv_sizeof_long_long = x8; then
   197             AC_DEFINE(int64_t, signed long long)
   198             AC_DEFINE(uint64_t, unsigned long long)
   199             AC_DEFINE(SDL_HAS_64BIT_TYPE)
   200         fi
   201     fi
   202     AC_DEFINE(size_t, unsigned int)
   203     AC_DEFINE(uintptr_t, unsigned long)
   204 fi
   205 
   206 # Standard C sources
   207 SOURCES="$SOURCES $srcdir/src/*.c"
   208 SOURCES="$SOURCES $srcdir/src/audio/*.c"
   209 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
   210 SOURCES="$SOURCES $srcdir/src/events/*.c"
   211 SOURCES="$SOURCES $srcdir/src/file/*.c"
   212 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
   213 SOURCES="$SOURCES $srcdir/src/thread/*.c"
   214 SOURCES="$SOURCES $srcdir/src/timer/*.c"
   215 SOURCES="$SOURCES $srcdir/src/video/*.c"
   216 
   217 dnl Enable/disable various subsystems of the SDL library
   218 
   219 AC_ARG_ENABLE(atomic,
   220 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
   221               , enable_atomic=yes)
   222 if test x$enable_atomic != xyes; then
   223     AC_DEFINE(SDL_ATOMIC_DISABLED)
   224 fi
   225 AC_ARG_ENABLE(audio,
   226 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
   227               , enable_audio=yes)
   228 if test x$enable_audio != xyes; then
   229     AC_DEFINE(SDL_AUDIO_DISABLED)
   230 fi
   231 AC_ARG_ENABLE(video,
   232 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
   233               , enable_video=yes)
   234 if test x$enable_video != xyes; then
   235     AC_DEFINE(SDL_VIDEO_DISABLED)
   236 fi
   237 AC_ARG_ENABLE(events,
   238 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
   239               , enable_events=yes)
   240 if test x$enable_events != xyes; then
   241     AC_DEFINE(SDL_EVENTS_DISABLED)
   242 fi
   243 AC_ARG_ENABLE(joystick,
   244 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
   245               , enable_joystick=yes)
   246 if test x$enable_joystick != xyes; then
   247     AC_DEFINE(SDL_JOYSTICK_DISABLED)
   248 else
   249     SOURCES="$SOURCES $srcdir/src/joystick/*.c"
   250 fi
   251 AC_ARG_ENABLE(haptic,
   252 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
   253               , enable_haptic=yes)
   254 if test x$enable_haptic != xyes; then
   255     AC_DEFINE(SDL_HAPTIC_DISABLED)
   256 else
   257     SOURCES="$SOURCES $srcdir/src/haptic/*.c"
   258 fi
   259 AC_ARG_ENABLE(power,
   260 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
   261               , enable_power=yes)
   262 if test x$enable_power != xyes; then
   263     AC_DEFINE(SDL_POWER_DISABLED)
   264 else
   265     SOURCES="$SOURCES $srcdir/src/power/*.c"
   266 fi
   267 AC_ARG_ENABLE(threads,
   268 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
   269               , enable_threads=yes)
   270 if test x$enable_threads != xyes; then
   271     AC_DEFINE(SDL_THREADS_DISABLED)
   272 fi
   273 AC_ARG_ENABLE(timers,
   274 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
   275               , enable_timers=yes)
   276 if test x$enable_timers != xyes; then
   277     AC_DEFINE(SDL_TIMERS_DISABLED)
   278 fi
   279 AC_ARG_ENABLE(file,
   280 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
   281               , enable_file=yes)
   282 if test x$enable_file != xyes; then
   283     AC_DEFINE(SDL_FILE_DISABLED)
   284 fi
   285 AC_ARG_ENABLE(loadso,
   286 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
   287               , enable_loadso=yes)
   288 if test x$enable_loadso != xyes; then
   289     AC_DEFINE(SDL_LOADSO_DISABLED)
   290 fi
   291 AC_ARG_ENABLE(cpuinfo,
   292 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
   293               , enable_cpuinfo=yes)
   294 if test x$enable_cpuinfo != xyes; then
   295     AC_DEFINE(SDL_CPUINFO_DISABLED)
   296 fi
   297 AC_ARG_ENABLE(assembly,
   298 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
   299               , enable_assembly=yes)
   300 if test x$enable_assembly = xyes; then
   301     AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
   302 
   303     # Make sure that we don't generate floating point code that would
   304     # cause illegal instruction exceptions on older processors
   305     case "$host" in
   306         *-*-darwin*)
   307             # Don't need to worry about Apple hardware, it's all SSE capable
   308             default_ssemath=yes
   309             ;;
   310         *64-*-*)
   311             # x86 64-bit architectures all have SSE instructions
   312             default_ssemath=yes
   313             ;;
   314 	*)
   315             default_ssemath=no
   316             ;;
   317     esac
   318     AC_ARG_ENABLE(ssemath,
   319 AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
   320                   , enable_ssemath=$default_ssemath)
   321     if test x$enable_ssemath = xno; then
   322         if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
   323             EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
   324         fi
   325     fi
   326 
   327     dnl Check for various instruction support
   328     AC_ARG_ENABLE(mmx,
   329 AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
   330                   , enable_mmx=yes)
   331     if test x$enable_mmx = xyes; then
   332         save_CFLAGS="$CFLAGS"
   333         have_gcc_mmx=no
   334         AC_MSG_CHECKING(for GCC -mmmx option)
   335         mmx_CFLAGS="-mmmx"
   336         CFLAGS="$save_CFLAGS $mmx_CFLAGS"
   337 
   338         AC_TRY_COMPILE([
   339         #include <mmintrin.h>
   340         #ifndef __MMX__
   341         #error Assembler CPP flag not enabled
   342         #endif
   343         ],[
   344         ],[
   345         have_gcc_mmx=yes
   346         ])
   347         AC_MSG_RESULT($have_gcc_mmx)
   348         CFLAGS="$save_CFLAGS"
   349 
   350         if test x$have_gcc_mmx = xyes; then
   351             EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
   352         fi
   353     fi
   354 
   355     AC_ARG_ENABLE(3dnow,
   356 AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
   357                   , enable_3dnow=yes)
   358     if test x$enable_3dnow = xyes; then
   359         save_CFLAGS="$CFLAGS"
   360         have_gcc_3dnow=no
   361         AC_MSG_CHECKING(for GCC -m3dnow option)
   362         amd3dnow_CFLAGS="-m3dnow"
   363         CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
   364 
   365         AC_TRY_COMPILE([
   366         #include <mm3dnow.h>
   367         #ifndef __3dNOW__
   368         #error Assembler CPP flag not enabled
   369         #endif
   370         ],[
   371         ],[
   372         have_gcc_3dnow=yes
   373         ])
   374         AC_MSG_RESULT($have_gcc_3dnow)
   375         CFLAGS="$save_CFLAGS"
   376 
   377         if test x$have_gcc_3dnow = xyes; then
   378             EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
   379         fi
   380     fi
   381 
   382     AC_ARG_ENABLE(sse,
   383 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
   384                   , enable_sse=yes)
   385     if test x$enable_sse = xyes; then
   386         save_CFLAGS="$CFLAGS"
   387         have_gcc_sse=no
   388         AC_MSG_CHECKING(for GCC -msse option)
   389         sse_CFLAGS="-msse"
   390         CFLAGS="$save_CFLAGS $sse_CFLAGS"
   391 
   392         AC_TRY_COMPILE([
   393         #include <xmmintrin.h>
   394         #ifndef __SSE__
   395         #error Assembler CPP flag not enabled
   396         #endif
   397         ],[
   398         ],[
   399         have_gcc_sse=yes
   400         ])
   401         AC_MSG_RESULT($have_gcc_sse)
   402         CFLAGS="$save_CFLAGS"
   403 
   404         if test x$have_gcc_sse = xyes; then
   405             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
   406         fi
   407     fi
   408 
   409     AC_ARG_ENABLE(sse2,
   410 AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
   411                   , enable_sse2=$default_ssemath)
   412     if test x$enable_sse2 = xyes; then
   413         save_CFLAGS="$CFLAGS"
   414         have_gcc_sse2=no
   415         AC_MSG_CHECKING(for GCC -msse2 option)
   416         sse2_CFLAGS="-msse2"
   417         CFLAGS="$save_CFLAGS $sse2_CFLAGS"
   418 
   419         AC_TRY_COMPILE([
   420         #include <emmintrin.h>
   421         #ifndef __SSE2__
   422         #error Assembler CPP flag not enabled
   423         #endif
   424         ],[
   425         ],[
   426         have_gcc_sse2=yes
   427         ])
   428         AC_MSG_RESULT($have_gcc_sse2)
   429         CFLAGS="$save_CFLAGS"
   430 
   431         if test x$have_gcc_sse2 = xyes; then
   432             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
   433         fi
   434     fi
   435 
   436     AC_ARG_ENABLE(altivec,
   437 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
   438                   , enable_altivec=yes)
   439     if test x$enable_altivec = xyes; then
   440         have_altivec_h_hdr=no
   441         AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)
   442 
   443         save_CFLAGS="$CFLAGS"
   444         have_gcc_altivec=no
   445         AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
   446         altivec_CFLAGS="-maltivec"
   447         CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   448 
   449         if test x$have_altivec_h_hdr = xyes; then
   450           AC_TRY_COMPILE([
   451           #include <altivec.h>
   452           vector unsigned int vzero() {
   453               return vec_splat_u32(0);
   454           }
   455           ],[
   456           ],[
   457           have_gcc_altivec=yes
   458           ])
   459           AC_MSG_RESULT($have_gcc_altivec)
   460         else
   461           AC_TRY_COMPILE([
   462           vector unsigned int vzero() {
   463               return vec_splat_u32(0);
   464           }
   465           ],[
   466           ],[
   467           have_gcc_altivec=yes
   468           ])
   469           AC_MSG_RESULT($have_gcc_altivec)
   470         fi
   471 
   472         if test x$have_gcc_altivec = xno; then
   473             AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
   474             altivec_CFLAGS="-faltivec"
   475             CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   476             if test x$have_altivec_h_hdr = xyes; then
   477               AC_TRY_COMPILE([
   478               #include <altivec.h>
   479               vector unsigned int vzero() {
   480                   return vec_splat_u32(0);
   481               }
   482               ],[
   483               ],[
   484               have_gcc_altivec=yes
   485               ])
   486               AC_MSG_RESULT($have_gcc_altivec)
   487             else
   488               AC_TRY_COMPILE([
   489               vector unsigned int vzero() {
   490                   return vec_splat_u32(0);
   491               }
   492               ],[
   493               ],[
   494               have_gcc_altivec=yes
   495               ])
   496               AC_MSG_RESULT($have_gcc_altivec)
   497             fi
   498         fi
   499         CFLAGS="$save_CFLAGS"
   500 
   501         if test x$have_gcc_altivec = xyes; then
   502             AC_DEFINE(SDL_ALTIVEC_BLITTERS)
   503             if test x$have_altivec_h_hdr = xyes; then
   504               AC_DEFINE(HAVE_ALTIVEC_H)
   505             fi
   506             EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
   507         fi
   508     fi
   509 fi
   510 
   511 dnl See if the OSS audio interface is supported
   512 CheckOSS()
   513 {
   514     AC_ARG_ENABLE(oss,
   515 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
   516                   , enable_oss=yes)
   517     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
   518         AC_MSG_CHECKING(for OSS audio support)
   519         have_oss=no
   520         if test x$have_oss != xyes; then
   521             AC_TRY_COMPILE([
   522               #include <sys/soundcard.h>
   523             ],[
   524               int arg = SNDCTL_DSP_SETFRAGMENT;
   525             ],[
   526             have_oss=yes
   527             ])
   528         fi
   529         if test x$have_oss != xyes; then
   530             AC_TRY_COMPILE([
   531               #include <soundcard.h>
   532             ],[
   533               int arg = SNDCTL_DSP_SETFRAGMENT;
   534             ],[
   535             have_oss=yes
   536             AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
   537             ])
   538         fi
   539         AC_MSG_RESULT($have_oss)
   540         if test x$have_oss = xyes; then
   541             AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
   542             SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
   543             SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
   544             have_audio=yes
   545 
   546             # We may need to link with ossaudio emulation library
   547             case "$host" in
   548                 *-*-openbsd*|*-*-netbsd*)
   549                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
   550             esac
   551         fi
   552     fi
   553 }
   554 
   555 dnl See if the ALSA audio interface is supported
   556 CheckALSA()
   557 {
   558     AC_ARG_ENABLE(alsa,
   559 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
   560                   , enable_alsa=yes)
   561     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
   562         AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
   563         # Restore all flags from before the ALSA detection runs
   564         CFLAGS="$alsa_save_CFLAGS"
   565         LDFLAGS="$alsa_save_LDFLAGS"
   566         LIBS="$alsa_save_LIBS"
   567         if test x$have_alsa = xyes; then
   568             AC_ARG_ENABLE(alsa-shared,
   569 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
   570                           , enable_alsa_shared=yes)
   571             if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
   572                 if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
   573                     ALSA_LIBS="-L/lib $ALSA_LIBS"
   574                 elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
   575                     ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
   576                 elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
   577                     ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
   578                 fi
   579             fi
   580             alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
   581             alsa_lib=`ls -- $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   582             echo "-- $alsa_lib_spec -> $alsa_lib"
   583 
   584             AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
   585             SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
   586             EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
   587             if test x$have_loadso != xyes && \
   588                test x$enable_alsa_shared = xyes; then
   589                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
   590             fi
   591             if test x$have_loadso = xyes && \
   592                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   593                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
   594             else
   595                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
   596             fi
   597             have_audio=yes
   598         fi
   599     fi
   600 }
   601 
   602 dnl Check whether we want to use IRIX 6.5+ native audio or not
   603 CheckDMEDIA()
   604 {
   605     if test x$enable_audio = xyes; then
   606         AC_MSG_CHECKING(for dmedia audio support)
   607         have_dmedia=no
   608         AC_TRY_COMPILE([
   609           #include <dmedia/audio.h>
   610         ],[
   611           ALport audio_port;
   612         ],[
   613         have_dmedia=yes
   614         ])
   615         AC_MSG_RESULT($have_dmedia)
   616         # Set up files for the audio library
   617         if test x$have_dmedia = xyes; then
   618             AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
   619             SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
   620             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
   621             have_audio=yes
   622         fi
   623     fi
   624 }
   625 
   626 dnl Check whether we want to use Tru64 UNIX native audio or not
   627 CheckMME()
   628 {
   629     dnl Make sure we are running on an Tru64 UNIX
   630     case $ARCH in
   631         osf)
   632             ;;
   633         *)
   634             return
   635             ;;
   636     esac
   637     if test x$enable_audio = xyes; then
   638         AC_MSG_CHECKING(for MME audio support)
   639         MME_CFLAGS="-I/usr/include/mme"
   640         MME_LIBS="-lmme"
   641         have_mme=no
   642         save_CFLAGS="$CFLAGS"
   643         CFLAGS="$CFLAGS $MME_CFLAGS"
   644         AC_TRY_COMPILE([
   645           #include <mme_api.h>
   646         ],[
   647           HWAVEOUT sound;
   648         ],[
   649         have_mme=yes
   650         ])
   651         CFLAGS="$save_CFLAGS"
   652         AC_MSG_RESULT($have_mme)
   653         # Set up files for the audio library
   654         if test x$have_mme = xyes; then
   655             AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
   656             SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
   657             EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS"
   658             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS"
   659             have_audio=yes
   660         fi
   661     fi
   662 }
   663 
   664 dnl Find the ESD includes and libraries
   665 CheckESD()
   666 {
   667     AC_ARG_ENABLE(esd,
   668 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
   669                   , enable_esd=yes)
   670     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   671         AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
   672         if test x$have_esd = xyes; then
   673             AC_ARG_ENABLE(esd-shared,
   674 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
   675                           , enable_esd_shared=yes)
   676             esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
   677             esd_lib=`ls -- $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   678             echo "-- $esd_lib_spec -> $esd_lib"
   679 
   680             AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
   681             SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
   682             EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
   683             if test x$have_loadso != xyes && \
   684                test x$enable_esd_shared = xyes; then
   685                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
   686             fi
   687             if test x$have_loadso = xyes && \
   688                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   689                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
   690             else
   691                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
   692             fi
   693             have_audio=yes
   694         fi
   695     fi
   696 }
   697 
   698 dnl Find PulseAudio
   699 CheckPulseAudio()
   700 {
   701     AC_ARG_ENABLE(pulseaudio,
   702 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
   703                   , enable_pulseaudio=yes)
   704     if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
   705         audio_pulseaudio=no
   706 
   707         PULSEAUDIO_REQUIRED_VERSION=0.9
   708 
   709         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   710         AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
   711         if test x$PKG_CONFIG != xno; then
   712         if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
   713                 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
   714                 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
   715                 audio_pulseaudio=yes
   716         fi
   717         fi
   718         AC_MSG_RESULT($audio_pulseaudio)
   719 
   720         if test x$audio_pulseaudio = xyes; then
   721             AC_ARG_ENABLE(pulseaudio-shared,
   722 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
   723                           , enable_pulseaudio_shared=yes)
   724             if test "x`echo $PULSEAUDIO_LIBS | grep -- -L`" = "x"; then
   725                 if test "x`ls /lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   726                     PULSEAUDIO_LIBS="-L/lib $PULSEAUDIO_LIBS"
   727                 elif test "x`ls /usr/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   728                     PULSEAUDIO_LIBS="-L/usr/lib $PULSEAUDIO_LIBS"
   729                 elif test "x`ls /usr/local/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   730                     PULSEAUDIO_LIBS="-L/usr/local/lib $PULSEAUDIO_LIBS"
   731                 fi
   732             fi
   733             pulseaudio_lib_spec=`echo $PULSEAUDIO_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libpulse-simple.so.*/'`
   734             pulseaudio_lib=`ls -- $pulseaudio_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   735             echo "-- $pulseaudio_lib_spec -> $pulseaudio_lib"
   736 
   737             AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
   738             SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
   739             EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
   740             if test x$have_loadso != xyes && \
   741                test x$enable_pulseaudio_shared = xyes; then
   742                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
   743             fi
   744             if test x$have_loadso = xyes && \
   745                test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
   746                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
   747             else
   748                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
   749             fi
   750             have_audio=yes
   751         fi
   752     fi
   753 }
   754 
   755 CheckARTSC()
   756 {
   757     AC_ARG_ENABLE(arts,
   758 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
   759                   , enable_arts=yes)
   760     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   761         AC_PATH_PROG(ARTSCONFIG, artsc-config)
   762         if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
   763             : # arts isn't installed
   764         else
   765             ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   766             ARTS_LIBS=`$ARTSCONFIG --libs`
   767             ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
   768             AC_MSG_CHECKING(for aRts development environment)
   769             audio_arts=no
   770             save_CFLAGS="$CFLAGS"
   771             CFLAGS="$CFLAGS $ARTS_CFLAGS"
   772             AC_TRY_COMPILE([
   773              #include <artsc.h>
   774             ],[
   775              arts_stream_t stream;
   776             ],[
   777             audio_arts=yes
   778             ])
   779             CFLAGS="$save_CFLAGS"
   780             AC_MSG_RESULT($audio_arts)
   781             if test x$audio_arts = xyes; then
   782                 AC_ARG_ENABLE(arts-shared,
   783 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
   784                               , enable_arts_shared=yes)
   785                 arts_lib_spec="$ARTS_PREFIX/lib/libartsc.so.*"
   786                 arts_lib=`ls -- $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   787                 echo "-- $arts_lib_spec -> $arts_lib"
   788 
   789                 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   790                 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   791                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
   792                 if test x$have_loadso != xyes && \
   793                    test x$enable_arts_shared = xyes; then
   794                     AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
   795                 fi
   796                 if test x$have_loadso = xyes && \
   797                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   798                     AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
   799                 else
   800                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
   801                 fi
   802                 have_audio=yes
   803             fi
   804         fi
   805     fi
   806 }
   807 
   808 dnl See if the NAS audio interface is supported
   809 CheckNAS()
   810 {
   811     AC_ARG_ENABLE(nas,
   812 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
   813                   , enable_nas=yes)
   814     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   815         AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
   816         AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
   817 
   818         AC_MSG_CHECKING(for NAS audio support)
   819         have_nas=no
   820 
   821         if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
   822             have_nas=yes
   823             NAS_LIBS="-laudio"
   824 
   825         elif test -r /usr/X11R6/include/audio/audiolib.h; then
   826             have_nas=yes
   827             NAS_CFLAGS="-I/usr/X11R6/include/"
   828             NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
   829 
   830         dnl On IRIX, the NAS includes are in a different directory,
   831         dnl and libnas must be explicitly linked in
   832 
   833         elif test -r /usr/freeware/include/nas/audiolib.h; then
   834             have_nas=yes
   835             NAS_LIBS="-lnas -lXt"
   836         fi
   837 
   838         AC_MSG_RESULT($have_nas)
   839 
   840         if test x$have_nas = xyes; then
   841             AC_ARG_ENABLE(nas-shared,
   842 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
   843                           , enable_nas_shared=yes)
   844             if test "x`echo $NAS_LIBS | grep -- -L`" = "x"; then
   845                 if test "x`ls /lib/libaudio.so.* 2> /dev/null`" != "x"; then
   846                     NAS_LIBS="-L/lib $NAS_LIBS"
   847                 elif test "x`ls /usr/lib/libaudio.so.* 2> /dev/null`" != "x"; then
   848                     NAS_LIBS="-L/usr/lib $NAS_LIBS"
   849                 elif test "x`ls /usr/local/lib/libaudio.so.* 2> /dev/null`" != "x"; then
   850                     NAS_LIBS="-L/usr/local/lib $NAS_LIBS"
   851                 fi
   852             fi
   853             nas_lib_spec=`echo $NAS_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libaudio.so.*/'`
   854             nas_lib=`ls -- $nas_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   855             echo "-- $nas_lib_spec -> $nas_lib"
   856 
   857             if test x$have_loadso != xyes && \
   858                test x$enable_nas_shared = xyes; then
   859                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
   860             fi
   861             if test x$have_loadso = xyes && \
   862                test x$enable_nas_shared = xyes && test x$nas_lib != x; then
   863                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
   864             else
   865                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
   866             fi
   867 
   868             AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
   869             SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
   870             EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
   871             have_audio=yes
   872         fi
   873     fi
   874 }
   875 
   876 dnl rcg07142001 See if the user wants the disk writer audio driver...
   877 CheckDiskAudio()
   878 {
   879     AC_ARG_ENABLE(diskaudio,
   880 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
   881                   , enable_diskaudio=yes)
   882     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
   883         AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
   884         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
   885     fi
   886 }
   887 
   888 dnl rcg03142006 See if the user wants the dummy audio driver...
   889 CheckDummyAudio()
   890 {
   891     AC_ARG_ENABLE(dummyaudio,
   892 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
   893                   , enable_dummyaudio=yes)
   894     if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
   895         AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
   896         SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
   897     fi
   898 }
   899 
   900 dnl Set up the Atari Audio driver
   901 CheckAtariAudio()
   902 {
   903     AC_ARG_ENABLE(mintaudio,
   904 AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [[default=yes]]]),
   905                   , enable_mintaudio=yes)
   906     if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
   907         mintaudio=no
   908         AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
   909         if test x$have_mint_falcon_hdr = xyes; then
   910             mintaudio=yes
   911             AC_DEFINE(SDL_AUDIO_DRIVER_MINT)
   912             SOURCES="$SOURCES $srcdir/src/audio/mint/*.c"
   913             SOURCES="$SOURCES $srcdir/src/audio/mint/*.S"
   914             have_audio=yes
   915         fi
   916     fi
   917 }
   918 
   919 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
   920 dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
   921 CheckVisibilityHidden()
   922 {
   923     AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
   924     have_gcc_fvisibility=no
   925 
   926     visibility_CFLAGS="-fvisibility=hidden"
   927     save_CFLAGS="$CFLAGS"
   928     CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
   929     AC_TRY_COMPILE([
   930     #if !defined(__GNUC__) || __GNUC__ < 4
   931     #error SDL only uses visibility attributes in GCC 4 or newer
   932     #endif
   933     ],[
   934     ],[
   935     have_gcc_fvisibility=yes
   936     ])
   937     AC_MSG_RESULT($have_gcc_fvisibility)
   938     CFLAGS="$save_CFLAGS"
   939 
   940     if test x$have_gcc_fvisibility = xyes; then
   941         EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
   942     fi
   943 }
   944 
   945 
   946 dnl 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 atomic operations library
  2436         if test x$enable_atomic = xyes; then
  2437           case $ARCH in
  2438             linux)
  2439                 AC_DEFINE(SDL_ATOMIC_LINUX)
  2440                 SOURCES="$SOURCES $srcdir/src/atomic/linux/*.c"
  2441                 have_atomic=yes
  2442             ;;
  2443           esac
  2444         fi
  2445         # Set up files for the joystick library
  2446         if test x$enable_joystick = xyes; then
  2447           case $ARCH in
  2448             linux)
  2449                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2450                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2451                 have_joystick=yes
  2452             ;;
  2453           esac
  2454         fi
  2455         # Set up files for the haptic library
  2456         if test x$enable_haptic = xyes; then
  2457            if test x$use_input_events = xyes; then
  2458              case $ARCH in
  2459                linux)
  2460                    AC_DEFINE(SDL_HAPTIC_LINUX)
  2461                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2462                    have_haptic=yes
  2463                ;;
  2464              esac
  2465            fi
  2466         fi
  2467         # Set up files for the power library
  2468         if test x$enable_power = xyes; then
  2469              case $ARCH in
  2470                linux)
  2471                    AC_DEFINE(SDL_POWER_LINUX)
  2472                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2473                    have_power=yes
  2474                ;;
  2475              esac
  2476         fi
  2477         # Set up files for the thread library
  2478         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2479             AC_DEFINE(SDL_THREAD_SPROC)
  2480             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2481             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2482             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2483             have_threads=yes
  2484         fi
  2485         # Set up files for the timer library
  2486         if test x$enable_timers = xyes; then
  2487             AC_DEFINE(SDL_TIMER_UNIX)
  2488             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2489             have_timers=yes
  2490         fi
  2491         ;;
  2492     *-*-qnx*)
  2493 
  2494         EXTRA_CFLAGS="-I/usr/include $CFLAGS"
  2495         EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
  2496 
  2497         ARCH=qnx
  2498         CheckVisibilityHidden
  2499         CheckDummyVideo
  2500         CheckDiskAudio
  2501         CheckDummyAudio
  2502         CheckDLOPEN
  2503         CheckPulseAudio
  2504         CheckESD
  2505         CheckNAS
  2506         CheckPHOTON
  2507         CheckQNXGF
  2508         CheckX11
  2509         CheckOpenGLX11
  2510         CheckPTHREAD
  2511         CheckClockGettime
  2512 
  2513 
  2514         # Set up files for the audio library
  2515         if test x$enable_audio = xyes; then
  2516             AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
  2517             SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
  2518             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2519             have_audio=yes
  2520         fi
  2521         # Set up files for the timer library
  2522         if test x$enable_timers = xyes; then
  2523             AC_DEFINE(SDL_TIMER_UNIX)
  2524             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2525             have_timers=yes
  2526         fi
  2527         # Setup files for the atomic operations
  2528         if test x$enable_atomic = xyes; then
  2529                 AC_DEFINE(SDL_ATOMIC_QNX)
  2530                 SOURCES="$SOURCES $srcdir/src/atomic/qnx/*.c"
  2531                 have_atomic=yes
  2532         fi
  2533         # Set up dummy files for the joystick for now
  2534         if test x$enable_joystick = xyes; then
  2535             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2536             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2537             have_joystick=yes
  2538         fi
  2539         # Set up dummy files for the haptic for now
  2540         if test x$enable_haptic = xyes; then
  2541             AC_DEFINE(SDL_HAPTIC_DUMMY)
  2542             SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2543             have_haptic=yes
  2544         fi
  2545         ;;
  2546     *-wince* | *-mingw32ce)
  2547         ARCH=win32
  2548         CheckDummyVideo
  2549         CheckDiskAudio
  2550         CheckDummyAudio
  2551         CheckWIN32
  2552         CheckNASM
  2553         #SOURCES="$SOURCES $srcdir/src/video/gapi/*.c"
  2554         #AC_DEFINE(SDL_VIDEO_DRIVER_GAPI)
  2555         if test x$enable_video = xyes; then
  2556             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2557             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2558             have_video=yes
  2559             AC_ARG_ENABLE(render-gdi,
  2560 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2561                                 , enable_render_gdi=yes)
  2562             if test x$enable_render_gdi = xyes; then
  2563                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2564             fi
  2565             AC_ARG_ENABLE(render-gapi,
  2566 AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
  2567                                 , enable_render_gapi=yes)
  2568             if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
  2569                 AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
  2570             fi
  2571             AC_ARG_ENABLE(render-ddraw,
  2572 AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
  2573                                 , enable_render_ddraw=yes)
  2574             if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
  2575                 AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
  2576             fi
  2577             AC_ARG_ENABLE(render-d3d,
  2578 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2579                                 , enable_render_d3d=yes)
  2580             enable_render_d3d=no
  2581             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2582                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2583             fi
  2584         fi
  2585         # Set up files for the audio library
  2586         if test x$enable_audio = xyes; then
  2587             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2588             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2589             if test x$have_dsound = xyes; then
  2590                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2591                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2592             fi
  2593             have_audio=yes
  2594         fi
  2595         # Set up files for the thread library
  2596         if test x$enable_threads = xyes; then
  2597             AC_DEFINE(SDL_THREAD_WIN32)
  2598             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2599             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2600             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2601             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2602             have_threads=yes
  2603         fi
  2604         # Set up files for the timer library
  2605         if test x$enable_timers = xyes; then
  2606             AC_DEFINE(SDL_TIMER_WINCE)
  2607             SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
  2608             have_timers=yes
  2609         fi
  2610         # Set up files for the shared object loading library
  2611         if test x$enable_loadso = xyes; then
  2612             AC_DEFINE(SDL_LOADSO_WIN32)
  2613             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2614             have_loadso=yes
  2615         fi
  2616         # Set up files for the system power library
  2617         if test x$enable_power = xyes; then
  2618             AC_DEFINE(SDL_POWER_WINDOWS)
  2619             SOURCES="$SOURCES $srcdir/src/power/windows/*.c"
  2620             have_power=yes
  2621         fi
  2622         # Set up the system libraries we need
  2623         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
  2624         # The Win32 platform requires special setup
  2625         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2626         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
  2627         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2628         ;;
  2629     *-*-cygwin* | *-*-mingw32*)
  2630         ARCH=win32
  2631         if test "$build" != "$host"; then # cross-compiling
  2632             # Default cross-compile location
  2633             ac_default_prefix=/usr/local/cross-tools/i386-mingw32
  2634         else
  2635             # Look for the location of the tools and install there
  2636             if test "$BUILD_PREFIX" != ""; then
  2637                 ac_default_prefix=$BUILD_PREFIX
  2638             fi
  2639         fi
  2640         CheckDummyVideo
  2641         CheckDiskAudio
  2642         CheckDummyAudio
  2643         CheckWIN32
  2644         CheckWIN32GL
  2645         CheckDIRECTX
  2646         # Set up files for the video library
  2647         if test x$enable_video = xyes; then
  2648             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2649             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2650             have_video=yes
  2651             AC_ARG_ENABLE(render-gdi,
  2652 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2653                                 , enable_render_gdi=yes)
  2654             if test x$enable_render_gdi = xyes; then
  2655                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2656             fi
  2657             AC_ARG_ENABLE(render-d3d,
  2658 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2659                                 , enable_render_d3d=yes)
  2660             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2661                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2662             fi
  2663         fi
  2664         # Set up files for the audio library
  2665         if test x$enable_audio = xyes; then
  2666             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2667             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2668             if test x$have_dsound = xyes; then
  2669                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2670                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2671             fi
  2672             have_audio=yes
  2673         fi
  2674         # Set up files for the joystick library
  2675         if test x$enable_joystick = xyes; then
  2676             if test x$have_dinput = xyes; then
  2677                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2678                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
  2679                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8 -lole32"
  2680             else
  2681                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2682                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
  2683             fi
  2684             have_joystick=yes
  2685         fi
  2686         if test x$enable_haptic = xyes; then
  2687             if test x$have_dinput = xyes; then
  2688                 AC_DEFINE(SDL_HAPTIC_DINPUT)
  2689                 SOURCES="$SOURCES $srcdir/src/haptic/win32/SDL_syshaptic.c"
  2690                 have_haptic=yes
  2691             fi
  2692         fi
  2693         if test x$enable_power = xyes; then
  2694             AC_DEFINE(SDL_POWER_WINDOWS)
  2695             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2696             have_power=yes
  2697         fi
  2698         # Set up files for the thread library
  2699         if test x$enable_threads = xyes; then
  2700             AC_DEFINE(SDL_THREAD_WIN32)
  2701             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2702             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2703             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2704             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2705             have_threads=yes
  2706         fi
  2707         # Set up files for the timer library
  2708         if test x$enable_timers = xyes; then
  2709             AC_DEFINE(SDL_TIMER_WIN32)
  2710             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2711             have_timers=yes
  2712         fi
  2713         # Set up files for the shared object loading library
  2714         if test x$enable_loadso = xyes; then
  2715             AC_DEFINE(SDL_LOADSO_WIN32)
  2716             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2717             have_loadso=yes
  2718         fi
  2719         # Set up the system libraries we need
  2720         # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
  2721         # You can get this here: http://libunicows.sourceforge.net/
  2722         #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
  2723         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm"
  2724         # The Win32 platform requires special setup
  2725         SOURCES="$SOURCES $srcdir/src/main/win32/*.rc"
  2726         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2727         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2728         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2729         ;;
  2730     *-*-beos*)
  2731         ARCH=beos
  2732         ac_default_prefix=/boot/develop/tools/gnupro
  2733         CheckDummyVideo
  2734         CheckDiskAudio
  2735         CheckDummyAudio
  2736         CheckBWINDOW
  2737         CheckBeGL
  2738         # Set up files for the audio library
  2739         if test x$enable_audio = xyes; then
  2740             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
  2741             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2742             have_audio=yes
  2743         fi
  2744         # Set up files for the joystick library
  2745         if test x$enable_joystick = xyes; then
  2746             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2747             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2748             have_joystick=yes
  2749         fi
  2750         # Set up files for the thread library
  2751         if test x$enable_threads = xyes; then
  2752             AC_DEFINE(SDL_THREAD_BEOS)
  2753             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2754             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2755             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2756             have_threads=yes
  2757         fi
  2758         # Set up files for the timer library
  2759         if test x$enable_timers = xyes; then
  2760             AC_DEFINE(SDL_TIMER_BEOS)
  2761             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2762             have_timers=yes
  2763         fi
  2764         # Set up files for the shared object loading library
  2765         if test x$enable_loadso = xyes; then
  2766             AC_DEFINE(SDL_LOADSO_BEOS)
  2767             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2768             have_loadso=yes
  2769         fi
  2770         # Set up files for the system power library
  2771         if test x$enable_power = xyes; then
  2772             AC_DEFINE(SDL_POWER_BEOS)
  2773             SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
  2774             have_power=yes
  2775         fi
  2776         # The BeOS platform requires special setup.
  2777         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2778         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2779         ;;
  2780     *-*-darwin* )
  2781         # This could be either full "Mac OS X", or plain "Darwin" which is
  2782         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2783         # Next line is broken, and a few files below require Mac OS X (full)
  2784         ARCH=macosx
  2785 
  2786         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2787         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2788         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2789 
  2790         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2791         # is -lm which is not needed under Mac OS X. But for some reasons it
  2792         # also tends to contain spurious -L switches, which we don't want to
  2793         # use here or in sdl-config. Hence we reset it.
  2794         EXTRA_LDFLAGS=""
  2795 
  2796         CheckVisibilityHidden
  2797         CheckDummyVideo
  2798         CheckDiskAudio
  2799         CheckDummyAudio
  2800         CheckDLOPEN
  2801 
  2802         # Set up files for the shared object loading library
  2803         # (this needs to be done before the dynamic X11 check)
  2804         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2805             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2806             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2807             have_loadso=yes
  2808         fi
  2809 
  2810         CheckCOCOA
  2811         CheckX11
  2812         CheckMacGL
  2813         CheckOpenGLX11
  2814         CheckPTHREAD
  2815 
  2816         # Good optimization on Mac OS X, yes...
  2817         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2818 
  2819         # Need this or things might misbuild on a G3.
  2820         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2821 
  2822         # Set up files for the audio library
  2823         if test x$enable_audio = xyes; then
  2824             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2825             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2826             have_audio=yes
  2827         fi
  2828         # Set up files for the atomic operations library
  2829         if test x$enable_atomic = xyes; then
  2830             AC_DEFINE(SDL_ATOMIC_MACOSX)
  2831             SOURCES="$SOURCES $srcdir/src/atomic/macosx/*.c"
  2832             have_atomic=yes
  2833         fi
  2834         # Set up files for the joystick library
  2835         if test x$enable_joystick = xyes; then
  2836             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2837             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2838             have_joystick=yes
  2839         fi
  2840         # Set up files for the haptic library
  2841         if test x$enable_haptic = xyes; then
  2842             AC_DEFINE(SDL_HAPTIC_IOKIT)
  2843             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2844             have_haptic=yes
  2845             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2846         fi
  2847         # Set up files for the power library
  2848         if test x$enable_power = xyes; then
  2849             AC_DEFINE(SDL_POWER_MACOSX)
  2850             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2851             have_power=yes
  2852         fi
  2853         # Set up files for the timer library
  2854         if test x$enable_timers = xyes; then
  2855             AC_DEFINE(SDL_TIMER_UNIX)
  2856             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2857             have_timers=yes
  2858         fi
  2859         # The Mac OS X platform requires special setup.
  2860         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2861         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2862         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2863         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2864         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2865         # If either the audio or CD driver is used, add the AudioUnit framework
  2866         if test x$enable_audio = xyes; then
  2867             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2868         fi
  2869         ;;
  2870     *-*-mint*)
  2871         ARCH=mint
  2872         CheckDummyVideo
  2873         CheckDiskAudio
  2874         CheckDummyAudio
  2875         CheckAtariBiosEvent
  2876         CheckAtariXbiosVideo
  2877         CheckAtariGemVideo
  2878         CheckAtariAudio
  2879         CheckAtariLdg
  2880         CheckAtariOSMesa
  2881         CheckPTH
  2882         # Set up files for the audio library
  2883         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2884             if test x$enable_audio = xyes; then
  2885                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2886                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2887                 have_audio=yes
  2888             fi
  2889         fi
  2890         # Set up files for the joystick library
  2891         if test x$enable_joystick = xyes; then
  2892             AC_DEFINE(SDL_JOYSTICK_MINT)
  2893             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2894             have_joystick=yes
  2895         fi
  2896         # Set up files for the timer library
  2897         if test x$enable_timers = xyes; then
  2898             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2899                 AC_DEFINE(SDL_TIMER_UNIX)
  2900                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2901             else
  2902                 AC_DEFINE(SDL_TIMER_MINT)
  2903                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2904                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2905             fi
  2906             have_timers=yes
  2907         fi
  2908         ;;
  2909     *-riscos)
  2910         ARCH=riscos
  2911         CheckOSS
  2912         CheckPTHREAD
  2913         # Set up files for the video library
  2914         if test x$enable_video = xyes; then
  2915             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2916             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2917             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2918             have_video=yes
  2919         fi
  2920         # Set up files for the joystick library
  2921         if test x$enable_joystick = xyes; then
  2922             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2923             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2924             have_joystick=yes
  2925         fi
  2926         # Set up files for the timer library
  2927         if test x$enable_timers = xyes; then
  2928             AC_DEFINE(SDL_TIMER_RISCOS)
  2929             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2930             have_timers=yes
  2931         fi
  2932         # The RISC OS platform requires special setup.
  2933         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2934         ;;
  2935     *)
  2936         AC_MSG_ERROR([
  2937 *** Unsupported host:  Please add to configure.in
  2938         ])
  2939         ;;
  2940 esac
  2941 
  2942 # Verify that we have all the platform specific files we need
  2943 
  2944 if test x$have_joystick != xyes; then
  2945     if test x$enable_joystick = xyes; then
  2946         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2947     fi
  2948     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2949 fi
  2950 if test x$have_haptic != xyes; then
  2951     if test x$enable_haptic = xyes; then
  2952         AC_DEFINE(SDL_HAPTIC_DISABLED)
  2953     fi
  2954     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2955 fi
  2956 if test x$have_threads != xyes; then
  2957     if test x$enable_threads = xyes; then
  2958         AC_DEFINE(SDL_THREADS_DISABLED)
  2959     fi
  2960     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2961 fi
  2962 if test x$have_timers != xyes; then
  2963     if test x$enable_timers = xyes; then
  2964         AC_DEFINE(SDL_TIMERS_DISABLED)
  2965     fi
  2966     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2967 fi
  2968 if test x$have_loadso != xyes; then
  2969     if test x$enable_loadso = xyes; then
  2970         AC_DEFINE(SDL_LOADSO_DISABLED)
  2971     fi
  2972     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2973 fi
  2974 if test x$SDLMAIN_SOURCES = x; then
  2975     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2976 fi
  2977 
  2978 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2979 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2980 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2981 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2982 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2983 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2984 
  2985 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2986 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2987 
  2988 # Set runtime shared library paths as needed
  2989 
  2990 if test "x$enable_rpath" = "xyes"; then
  2991   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2992     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2993   fi
  2994   if test $ARCH = solaris; then
  2995     SDL_RLD_FLAGS="-R\${libdir}"
  2996   fi
  2997 else
  2998   SDL_RLD_FLAGS=""
  2999 fi
  3000 
  3001 case "$ARCH" in
  3002   macosx)
  3003     # Evil hack to allow static linking on Mac OS X
  3004     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  3005     ;;
  3006   *)
  3007     SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  3008     ;;
  3009 esac
  3010 
  3011 dnl Expand the cflags and libraries needed by apps using SDL
  3012 AC_SUBST(SDL_CFLAGS)
  3013 AC_SUBST(SDL_LIBS)
  3014 AC_SUBST(SDL_STATIC_LIBS)
  3015 AC_SUBST(SDL_RLD_FLAGS)
  3016 if test x$enable_shared = xyes; then
  3017     ENABLE_SHARED_TRUE=
  3018     ENABLE_SHARED_FALSE="#"
  3019 else
  3020     ENABLE_SHARED_TRUE="#"
  3021     ENABLE_SHARED_FALSE=
  3022 fi
  3023 if test x$enable_static = xyes; then
  3024     ENABLE_STATIC_TRUE=
  3025     ENABLE_STATIC_FALSE="#"
  3026 else
  3027     ENABLE_STATIC_TRUE="#"
  3028     ENABLE_STATIC_FALSE=
  3029 fi
  3030 AC_SUBST(ENABLE_SHARED_TRUE)
  3031 AC_SUBST(ENABLE_SHARED_FALSE)
  3032 AC_SUBST(ENABLE_STATIC_TRUE)
  3033 AC_SUBST(ENABLE_STATIC_FALSE)
  3034 
  3035 dnl Expand the sources and objects needed to build the library
  3036 AC_SUBST(ac_aux_dir)
  3037 AC_SUBST(INCLUDE)
  3038 AC_SUBST(SOURCES)
  3039 AC_SUBST(OBJECTS)
  3040 AC_SUBST(SDLMAIN_SOURCES)
  3041 AC_SUBST(SDLMAIN_OBJECTS)
  3042 AC_SUBST(BUILD_CFLAGS)
  3043 AC_SUBST(EXTRA_CFLAGS)
  3044 AC_SUBST(BUILD_LDFLAGS)
  3045 AC_SUBST(EXTRA_LDFLAGS)
  3046 AC_SUBST(WINDRES)
  3047 
  3048 AC_OUTPUT([
  3049     Makefile sdl-config SDL.spec sdl.pc
  3050 ], [
  3051     : >build-deps
  3052     if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
  3053 ])