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