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