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