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