configure.in
author Ryan C. Gordon <icculus@icculus.org>
Sun, 21 Aug 2011 02:52:15 -0400
branchSDL-1.2
changeset 5616 cf80941225f5
parent 5565 4225f09eb8cb
child 5890 9c9e8744e887
permissions -rw-r--r--
Don't force nasm to use a.out on OpenBSD. They've been on ELF for a long time.

Fixes Bugzilla #538.

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