configure.in
author Ozkan Sezer <sezeroz@gmail.com>
Sat, 24 Mar 2018 22:34:42 +0300
branchSDL-1.2
changeset 11969 55313dbda97e
parent 9426 c238763e1228
child 11975 addd798b16a0
permissions -rw-r--r--
fix alsa configury and cmake checks

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