configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 18 Jul 2012 14:14:55 -0700
branchSDL-1.2
changeset 6366 4488c8602961
parent 6361 173deb250f75
child 6405 7b87c1773b3e
permissions -rw-r--r--
Fixed bug 1543 - Fix dynamic loading of X libs on OpenBSD

Brad Smith 2012-07-18 13:43:34 PDT
autoconf patch to fix X dynamic loading of libraries on OpenBSD
     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                 *-*-openbsd*)
  1038                     x11_lib='libX11.so'
  1039                     x11ext_lib='libXext.so'
  1040                     xrender_lib='libXrender.so'
  1041                     xrandr_lib='libXrandr.so'
  1042                     ;;
  1043                 *)
  1044                     x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1045                     x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1046                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1047                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1048                     ;;
  1049             esac
  1050 
  1051             X_CFLAGS="$X_CFLAGS -DXTHREADS"
  1052             if test x$ac_cv_func_shmat != xyes; then
  1053                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1054             fi
  1055             CFLAGS="$CFLAGS $X_CFLAGS"
  1056             LDFLAGS="$LDFLAGS $X_LIBS"
  1057 
  1058             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
  1059             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1060             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1061 
  1062             if test x$enable_x11_shared = xmaybe; then
  1063                 enable_x11_shared=$x11_symbols_private
  1064             fi
  1065             if test x$have_loadso != xyes && \
  1066                test x$enable_x11_shared = xyes; then
  1067                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1068                 enable_x11_shared=no
  1069             fi
  1070             if test x$x11_symbols_private != xyes && \
  1071                test x$enable_x11_shared = xyes; then
  1072                 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
  1073                 enable_x11_shared=no
  1074             fi
  1075 
  1076             if test x$have_loadso = xyes && \
  1077                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1078                 echo "-- dynamic libX11 -> $x11_lib"
  1079                 echo "-- dynamic libX11ext -> $x11ext_lib"
  1080                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
  1081                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
  1082             else
  1083                 enable_x11_shared=no
  1084                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1085             fi
  1086             have_video=yes
  1087 
  1088             AC_ARG_ENABLE(dga,
  1089 AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [[default=yes]]]),
  1090                           , enable_dga=yes)
  1091             if test x$enable_dga = xyes; then
  1092                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c"
  1093             fi
  1094             AC_ARG_ENABLE(video-dga,
  1095 AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [[default=yes]]]),
  1096                   , enable_video_dga=yes)
  1097             if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then
  1098                 AC_DEFINE(SDL_VIDEO_DRIVER_DGA)
  1099                 SOURCES="$SOURCES $srcdir/src/video/dga/*.c"
  1100             fi
  1101             AC_ARG_ENABLE(video-x11-dgamouse,
  1102 AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [[default=yes]]]),
  1103                           , enable_video_x11_dgamouse=yes)
  1104             if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then
  1105                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE)
  1106             fi
  1107             AC_ARG_ENABLE(video-x11-vm,
  1108 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1109                           , enable_video_x11_vm=yes)
  1110             if test x$enable_video_x11_vm = xyes; then
  1111                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
  1112                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
  1113             fi
  1114             AC_ARG_ENABLE(video-x11-xv,
  1115 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
  1116                           , enable_video_x11_xv=yes)
  1117             if test x$enable_video_x11_xv = xyes; then
  1118                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
  1119                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
  1120             fi
  1121             AC_ARG_ENABLE(video-x11-xinerama,
  1122 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1123                             , enable_video_x11_xinerama=yes)
  1124             if test x$enable_video_x11_xinerama = xyes; then
  1125                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
  1126                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
  1127             fi
  1128             AC_ARG_ENABLE(video-x11-xme,
  1129 AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [[default=yes]]]),
  1130                             , enable_video_x11_xme=yes)
  1131             if test x$enable_video_x11_xme = xyes; then
  1132                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
  1133                 SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
  1134             fi
  1135             AC_ARG_ENABLE(video-x11-xrandr,
  1136 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1137                             , enable_video_x11_xrandr=yes)
  1138             if test x$enable_video_x11_xrandr = xyes; then
  1139                 definitely_enable_video_x11_xrandr=no
  1140                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1141                                 have_xrandr_h_hdr=yes,
  1142                                 have_xrandr_h_hdr=no,
  1143                                 [#include <X11/Xlib.h>
  1144                                 ])
  1145                 if test x$have_xrandr_h_hdr = xyes; then
  1146                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1147                         echo "-- dynamic libXrender -> $xrender_lib"
  1148                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1149                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
  1150                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
  1151                         definitely_enable_video_x11_xrandr=yes
  1152                     else
  1153                         AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
  1154                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1155                         if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then
  1156                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender"
  1157                             definitely_enable_video_x11_xrandr=yes
  1158                         fi
  1159                     fi
  1160                 fi
  1161             fi
  1162             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1163                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
  1164             fi
  1165         fi
  1166     fi
  1167 }
  1168 
  1169 dnl Check for QNX photon video driver
  1170 CheckPHOTON()
  1171 {
  1172     AC_ARG_ENABLE(video-photon,
  1173 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
  1174                   , enable_video_photon=yes)
  1175     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
  1176         AC_MSG_CHECKING(for QNX Photon support)
  1177         video_photon=no
  1178         AC_TRY_COMPILE([
  1179           #include <Ph.h>
  1180           #include <Pt.h>
  1181           #include <photon/Pg.h>
  1182           #include <photon/PdDirect.h>
  1183         ],[
  1184          PgDisplaySettings_t *visual;
  1185         ],[
  1186         video_photon=yes
  1187         ])
  1188         AC_MSG_RESULT($video_photon)
  1189         if test x$video_photon = xyes; then
  1190             AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
  1191             SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
  1192             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph"
  1193             have_video=yes
  1194 
  1195             CheckOpenGLQNX
  1196         fi
  1197     fi
  1198 }
  1199 
  1200 dnl Set up the BWindow video driver if enabled
  1201 CheckBWINDOW()
  1202 {
  1203     if test x$enable_video = xyes; then
  1204         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
  1205         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
  1206         have_video=yes
  1207     fi
  1208 }
  1209 
  1210 dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
  1211 CheckCARBON()
  1212 {
  1213     AC_ARG_ENABLE(video-carbon,
  1214 AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [[default=no]]]),
  1215                   , enable_video_carbon=no)
  1216     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  1217         AC_MSG_CHECKING(for Carbon framework)
  1218         have_carbon=no
  1219         AC_TRY_COMPILE([
  1220           #include <Carbon/Carbon.h>
  1221         ],[
  1222         ],[
  1223         have_carbon=yes
  1224         ])
  1225         AC_MSG_RESULT($have_carbon)
  1226         if test x$have_carbon = xyes; then
  1227             AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX)
  1228             SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c"
  1229             SOURCES="$SOURCES $srcdir/src/video/macrom/*.c"
  1230             have_video=yes
  1231         fi
  1232     fi
  1233 }
  1234 
  1235 dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
  1236 CheckCOCOA()
  1237 {
  1238     AC_ARG_ENABLE(video-cocoa,
  1239 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [[default=yes]]]),
  1240                   , enable_video_cocoa=yes)
  1241     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1242         save_CFLAGS="$CFLAGS"
  1243         dnl work around that we don't have Objective-C support in autoconf
  1244         CFLAGS="$CFLAGS -x objective-c"
  1245         AC_MSG_CHECKING(for Cocoa framework)
  1246         have_cocoa=no
  1247         AC_TRY_COMPILE([
  1248           #import <Cocoa/Cocoa.h>
  1249         ],[
  1250         ],[
  1251         have_cocoa=yes
  1252         ])
  1253         AC_MSG_RESULT($have_cocoa)
  1254         CFLAGS="$save_CFLAGS"
  1255         if test x$have_cocoa = xyes; then
  1256             AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ)
  1257             SOURCES="$SOURCES $srcdir/src/video/quartz/*.m"
  1258             have_video=yes
  1259         fi
  1260     fi
  1261 }
  1262 
  1263 dnl Find the framebuffer console includes
  1264 CheckFBCON()
  1265 {
  1266     AC_ARG_ENABLE(video-fbcon,
  1267 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=yes]]]),
  1268                   , enable_video_fbcon=yes)
  1269     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
  1270         AC_MSG_CHECKING(for framebuffer console support)
  1271         video_fbcon=no
  1272         AC_TRY_COMPILE([
  1273          #include <linux/fb.h>
  1274          #include <linux/kd.h>
  1275          #include <linux/keyboard.h>
  1276         ],[
  1277         ],[
  1278         video_fbcon=yes
  1279         ])
  1280         AC_MSG_RESULT($video_fbcon)
  1281         if test x$video_fbcon = xyes; then
  1282             AC_CHECK_FUNCS(getpagesize)
  1283             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
  1284             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
  1285             have_video=yes
  1286         fi
  1287     fi
  1288 }
  1289 
  1290 dnl Find DirectFB
  1291 CheckDirectFB()
  1292 {
  1293     AC_ARG_ENABLE(video-directfb,
  1294 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=yes]]]),
  1295                   , enable_video_directfb=yes)
  1296     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1297         video_directfb=no
  1298 
  1299         DIRECTFB_REQUIRED_VERSION=0.9.15
  1300 
  1301         AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
  1302         if test x$DIRECTFBCONFIG = xno; then
  1303             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1304             if test x$PKG_CONFIG != xno; then
  1305                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1306                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1307                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1308                     video_directfb=yes
  1309                 fi
  1310             fi
  1311         else
  1312             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1313             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1314             set -- `directfb-config --version | sed 's/\./ /g'`
  1315             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1316             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1317                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1318                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1319                 video_directfb=yes
  1320             fi
  1321         fi
  1322         if test x$video_directfb = xyes; then
  1323             # SuSE 11.1 installs directfb-config without directfb-devel
  1324             save_CFLAGS="$CFLAGS"
  1325             CFLAGS="$CFLAGS $DIRECTFB_CFLAGS"
  1326             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1327             CFLAGS="$save_CFLAGS"
  1328             video_directfb=$have_directfb_hdr
  1329         fi
  1330         AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1331         AC_MSG_RESULT($video_directfb)
  1332 
  1333         if test x$video_directfb = xyes; then
  1334             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1335             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1336             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1337             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1338             have_video=yes
  1339         fi
  1340     fi
  1341 }
  1342 
  1343 dnl See if we're running on PlayStation 2 hardware
  1344 CheckPS2GS()
  1345 {
  1346     AC_ARG_ENABLE(video-ps2gs,
  1347 AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=yes]]]),
  1348                   , enable_video_ps2gs=yes)
  1349     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
  1350         AC_MSG_CHECKING(for PlayStation 2 GS support)
  1351         video_ps2gs=no
  1352         AC_TRY_COMPILE([
  1353          #include <linux/ps2/dev.h>
  1354          #include <linux/ps2/gs.h>
  1355         ],[
  1356         ],[
  1357         video_ps2gs=yes
  1358         ])
  1359         AC_MSG_RESULT($video_ps2gs)
  1360         if test x$video_ps2gs = xyes; then
  1361             AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
  1362             SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
  1363             have_video=yes
  1364         fi
  1365     fi
  1366 }
  1367 
  1368 dnl See if we're running on PlayStation 3 Cell hardware
  1369 CheckPS3()
  1370 {
  1371   AC_ARG_ENABLE(video-ps3,
  1372                 AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
  1373                 , enable_video_ps3=yes)
  1374   if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then
  1375     AC_MSG_CHECKING(for PlayStation 3 Cell support)
  1376     video_ps3=no
  1377     AC_TRY_COMPILE([
  1378       #include <linux/fb.h>
  1379       #include <asm/ps3fb.h>
  1380       #include <libspe2.h>
  1381     ],[
  1382     ],[
  1383       video_ps3=yes
  1384     ])
  1385     AC_MSG_RESULT($video_ps3)
  1386     if test x$video_ps3 = xyes; then
  1387       AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
  1388       SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
  1389       EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
  1390       EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lbilin_scaler_spu -lfb_writer_spu -lyuv2rgb_spu -L/opt/cell/sdk/usr/lib -lspe2"
  1391       have_video=yes
  1392     fi
  1393   fi
  1394 }
  1395 
  1396 dnl Find the GGI includes
  1397 CheckGGI()
  1398 {
  1399     AC_ARG_ENABLE(video-ggi,
  1400 AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [[default=no]]]),
  1401                   , enable_video_ggi=no)
  1402     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
  1403         AC_MSG_CHECKING(for GGI support)
  1404         video_ggi=no
  1405         AC_TRY_COMPILE([
  1406          #include <ggi/ggi.h>
  1407          #include <ggi/gii.h>
  1408         ],[
  1409         ],[
  1410         video_ggi=yes
  1411         ])
  1412         AC_MSG_RESULT($video_ggi)
  1413         if test x$video_ggi = xyes; then
  1414             AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
  1415             SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
  1416             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lggi -lgii -lgg"
  1417             have_video=yes
  1418         fi
  1419     fi
  1420 }
  1421 
  1422 dnl Find the SVGAlib includes and libraries
  1423 CheckSVGA()
  1424 {
  1425     AC_ARG_ENABLE(video-svga,
  1426 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=yes]]]),
  1427                   , enable_video_svga=yes)
  1428     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1429         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1430         video_svga=no
  1431         AC_TRY_COMPILE([
  1432          #include <vga.h>
  1433          #include <vgamouse.h>
  1434          #include <vgakeyboard.h>
  1435         ],[
  1436          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1437              exit(0);
  1438          }
  1439         ],[
  1440         video_svga=yes
  1441         ])
  1442         AC_MSG_RESULT($video_svga)
  1443         if test x$video_svga = xyes; then
  1444             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1445             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1446             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
  1447             have_video=yes
  1448         fi
  1449     fi
  1450 }
  1451 
  1452 dnl Find the VGL includes and libraries
  1453 CheckVGL()
  1454 {
  1455     AC_ARG_ENABLE(video-vgl,
  1456 AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [[default=yes]]]),
  1457                   , enable_video_vgl=yes)
  1458     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
  1459         AC_MSG_CHECKING(for libVGL support)
  1460         video_vgl=no
  1461         AC_TRY_COMPILE([
  1462          #include <sys/fbio.h>
  1463          #include <sys/consio.h>
  1464          #include <sys/kbio.h>
  1465          #include <vgl.h>
  1466         ],[
  1467          VGLBitmap bitmap;
  1468          bitmap.Type = VIDBUF32;
  1469          bitmap.PixelBytes = 4;
  1470          exit(bitmap.Bitmap);
  1471         ],[
  1472         video_vgl=yes
  1473         ])
  1474         AC_MSG_RESULT($video_vgl)
  1475         if test x$video_vgl = xyes; then
  1476             AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
  1477             SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
  1478             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl"
  1479             have_video=yes
  1480         fi
  1481     fi
  1482 }
  1483 
  1484 dnl Set up the wscons video driver if enabled
  1485 CheckWscons()
  1486 {
  1487     AC_ARG_ENABLE(video-wscons,
  1488 AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [[default=yes]]]),
  1489                   , enable_video_wscons=yes)
  1490     if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
  1491         AC_MSG_CHECKING(for wscons support)
  1492         video_wscons=no
  1493         AC_TRY_COMPILE([
  1494          #include <sys/time.h>
  1495          #include <dev/wscons/wsconsio.h>
  1496          #include <dev/wscons/wsdisplay_usl_io.h>
  1497         ],[
  1498          int wsmode = WSDISPLAYIO_MODE_DUMBFB;
  1499         ],[
  1500         video_wscons=yes
  1501         ])
  1502         AC_MSG_RESULT($video_wscons)
  1503         if test x$video_wscons = xyes; then
  1504             AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
  1505             SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
  1506             have_video=yes
  1507         fi
  1508     fi
  1509 }
  1510 
  1511 
  1512 dnl Find the AAlib includes
  1513 CheckAAlib()
  1514 {
  1515     AC_ARG_ENABLE(video-aalib,
  1516 AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [[default=no]]]),
  1517                   , enable_video_aalib=no)
  1518     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
  1519         AC_MSG_CHECKING(for AAlib support)
  1520         video_aalib=no
  1521         AC_TRY_COMPILE([
  1522          #include <aalib.h>
  1523         ],[
  1524         ],[
  1525         video_aalib=yes
  1526         ])
  1527         AC_MSG_RESULT($video_aalib)
  1528         if test x$video_aalib = xyes; then
  1529             AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
  1530             SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
  1531             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laa"
  1532             have_video=yes
  1533         fi
  1534     fi
  1535 }
  1536 
  1537 dnl Find the libcaca includes
  1538 CheckCaca()
  1539 {
  1540     AC_ARG_ENABLE(video-caca,
  1541 AC_HELP_STRING([--enable-video-caca], [use libcaca video driver [[default=no]]]),
  1542                   , enable_video_caca=no)
  1543     if test x$enable_video = xyes -a x$enable_video_caca = xyes; then
  1544         video_caca=no
  1545         AC_PATH_PROG(CACACONFIG, caca-config, no)
  1546         if test x$CACACONFIG != xno; then
  1547             AC_MSG_CHECKING(for libcaca support)
  1548             CACA_CFLAGS=`$CACACONFIG --cflags`
  1549             CACA_LDFLAGS=`$CACACONFIG --libs`
  1550             save_CFLAGS="$CFLAGS"
  1551             AC_TRY_COMPILE([
  1552              #include <caca.h>
  1553             ],[
  1554             ],[
  1555              video_caca=yes
  1556             ])
  1557             CFLAGS="$save_CFLAGS"
  1558             AC_MSG_RESULT($video_caca)
  1559             if test x$video_caca = xyes; then
  1560                 AC_DEFINE(SDL_VIDEO_DRIVER_CACA)
  1561                 EXTRA_CFLAGS="$EXTRA_CFLAGS $CACA_CFLAGS"
  1562                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $CACA_LDFLAGS"
  1563                 SOURCES="$SOURCES $srcdir/src/video/caca/*.c"
  1564             fi
  1565         fi
  1566     fi
  1567 }
  1568 
  1569 dnl Set up the QTopia video driver if enabled
  1570 CheckQtopia()
  1571 {
  1572     AC_ARG_ENABLE(video-qtopia,
  1573 AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [[default=no]]]),
  1574                   , enable_video_qtopia=no)
  1575     if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
  1576         AC_MSG_CHECKING(for Qtopia support)
  1577         video_qtopia=no
  1578         QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
  1579         AC_LANG_CPLUSPLUS
  1580         OLD_CXX="$CXXFLAGS"
  1581         CXXFLAGS="$QTOPIA_FLAGS"
  1582         AC_TRY_COMPILE([
  1583          #include <qpe/qpeapplication.h>
  1584         ],[
  1585         ],[
  1586         video_qtopia=yes
  1587         ])
  1588         CXXFLAGS="$OLD_CXX"
  1589         AC_MSG_RESULT($video_qtopia)
  1590         if test x$video_qtopia = xyes; then
  1591             AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
  1592             SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
  1593             SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc"
  1594             SDLMAIN_LDFLAGS="-static"
  1595             EXTRA_CFLAGS="$EXTRA_CFLAGS $QTOPIA_FLAGS"
  1596             SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
  1597             SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
  1598             have_video=yes
  1599         fi
  1600         AC_LANG_C
  1601     fi
  1602 }
  1603 
  1604 dnl Set up the PicoGUI video driver if enabled
  1605 CheckPicoGUI()
  1606 {
  1607     AC_ARG_ENABLE(video-picogui,
  1608 AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [[default=no]]]),
  1609                   , enable_video_picogui=no)
  1610     if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
  1611         AC_MSG_CHECKING(for PicoGUI support)
  1612         video_picogui=no
  1613         AC_TRY_COMPILE([
  1614          #include <picogui.h>
  1615         ],[
  1616         ],[
  1617         video_picogui=yes
  1618         ])
  1619         AC_MSG_RESULT($video_picogui)
  1620         if test x$video_picogui = xyes; then
  1621             AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI)
  1622             SOURCES="$SOURCES $srcdir/src/video/picogui/*.c"
  1623             SDL_LIBS="$SDL_LIBS -lpgui"
  1624             have_video=yes
  1625         fi
  1626     fi
  1627 }
  1628 
  1629 dnl Set up the Atari Bios keyboard driver
  1630 CheckAtariBiosEvent()
  1631 {
  1632     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
  1633     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S"
  1634 }
  1635 
  1636 dnl Set up the Atari Xbios driver
  1637 CheckAtariXbiosVideo()
  1638 {
  1639     AC_ARG_ENABLE(xbios,
  1640 AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [[default=yes]]]),
  1641                   , enable_video_xbios=yes)
  1642     video_xbios=no
  1643     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1644         video_xbios=yes
  1645         AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
  1646         SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
  1647         have_video=yes
  1648     fi
  1649 }
  1650 
  1651 dnl Set up the Atari Gem driver
  1652 CheckAtariGemVideo()
  1653 {
  1654     AC_ARG_ENABLE(gem,
  1655 AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [[default=yes]]]),
  1656                   , enable_video_gem=yes)
  1657     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1658         video_gem=no
  1659         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1660         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1661         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1662             video_gem=yes
  1663             AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
  1664             SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
  1665             SDL_LIBS="$SDL_LIBS -lgem"
  1666             have_video=yes
  1667         fi
  1668     fi
  1669 }
  1670 
  1671 dnl rcg04172001 Set up the Null video driver.
  1672 CheckDummyVideo()
  1673 {
  1674     AC_ARG_ENABLE(video-dummy,
  1675 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1676                   , enable_video_dummy=yes)
  1677     if test x$enable_video_dummy = xyes; then
  1678         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1679         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1680         have_video=yes
  1681     fi
  1682 }
  1683 
  1684 dnl Check to see if OpenGL support is desired
  1685 AC_ARG_ENABLE(video-opengl,
  1686 AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [[default=yes]]]),
  1687               , enable_video_opengl=yes)
  1688 
  1689 dnl Find OpenGL
  1690 CheckOpenGLX11()
  1691 {
  1692     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1693         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1694         video_opengl=no
  1695         AC_TRY_COMPILE([
  1696          #include <GL/gl.h>
  1697          #include <GL/glx.h>
  1698          #include <GL/glu.h>
  1699         ],[
  1700         ],[
  1701         video_opengl=yes
  1702         ])
  1703         AC_MSG_RESULT($video_opengl)
  1704         if test x$video_opengl = xyes; then
  1705             AC_DEFINE(SDL_VIDEO_OPENGL)
  1706             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1707         fi
  1708     fi
  1709 }
  1710 
  1711 dnl Find QNX RtP OpenGL
  1712 CheckOpenGLQNX()
  1713 {
  1714     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1715         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1716         video_opengl=no
  1717         AC_TRY_COMPILE([
  1718          #include <GL/gl.h>
  1719         ],[
  1720         ],[
  1721         video_opengl=yes
  1722         ])
  1723         AC_MSG_RESULT($video_opengl)
  1724         if test x$video_opengl = xyes; then
  1725             AC_DEFINE(SDL_VIDEO_OPENGL)
  1726             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1727         fi
  1728     fi
  1729 }
  1730 
  1731 dnl Check for Win32 OpenGL
  1732 CheckWIN32GL()
  1733 {
  1734     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1735         AC_DEFINE(SDL_VIDEO_OPENGL)
  1736         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1737     fi
  1738 }
  1739 
  1740 dnl Check for BeOS OpenGL
  1741 CheckBeGL()
  1742 {
  1743     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1744         AC_DEFINE(SDL_VIDEO_OPENGL)
  1745         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1746     fi
  1747 }
  1748 
  1749 dnl Check for MacOS OpenGL
  1750 CheckMacGL()
  1751 {
  1752     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1753         AC_DEFINE(SDL_VIDEO_OPENGL)
  1754         case "$host" in
  1755             *-*-darwin*)
  1756                 if test x$enable_video_cocoa = xyes; then
  1757                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1758                 fi
  1759                 if test x$enable_video_carbon = xyes; then
  1760                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AGL"
  1761                 fi
  1762         esac
  1763     fi
  1764 }
  1765 
  1766 dnl Check for Mesa offscreen rendering
  1767 CheckAtariOSMesa()
  1768 {
  1769     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1770         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1771         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1772 
  1773         # Static linking to -lOSMesa
  1774         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1775         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1776             # -lOSMesa is really the static library
  1777             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1778                 OSMESA_LIBS="-lOSMesa"
  1779             fi
  1780         else
  1781             # -lOSMesa is a loader for OSMesa.ldg
  1782             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1783             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1784         fi
  1785         AC_DEFINE(SDL_VIDEO_OPENGL)
  1786         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1787         SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
  1788         SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
  1789 
  1790         AC_ARG_ENABLE(osmesa-shared,
  1791 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]),
  1792                               , enable_osmesa_shared=yes)
  1793         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1794             # Dynamic linking
  1795             if test "x$have_osmesa_hdr" = "xyes"; then
  1796                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1797             fi
  1798         fi
  1799     fi
  1800 }
  1801 
  1802 AC_ARG_ENABLE(screensaver,
  1803 AC_HELP_STRING([--enable-screensaver], [enable screensaver by default while any SDL application is running [[default=no]]]),
  1804               , enable_screensaver=no)
  1805 if test x$enable_screensaver = xno; then
  1806     AC_DEFINE(SDL_VIDEO_DISABLE_SCREENSAVER)
  1807 fi
  1808 
  1809 dnl See if we can use the new unified event interface in Linux 2.4
  1810 CheckInputEvents()
  1811 {
  1812     dnl Check for Linux 2.4 unified input event interface support
  1813     AC_ARG_ENABLE(input-events,
  1814 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1815                   , enable_input_events=yes)
  1816     if test x$enable_input_events = xyes; then
  1817         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1818         use_input_events=no
  1819         AC_TRY_COMPILE([
  1820           #include <linux/input.h>
  1821         ],[
  1822           #ifndef EVIOCGNAME
  1823           #error EVIOCGNAME() ioctl not available
  1824           #endif
  1825         ],[
  1826         use_input_events=yes
  1827         ])
  1828         AC_MSG_RESULT($use_input_events)
  1829         if test x$use_input_events = xyes; then
  1830             AC_DEFINE(SDL_INPUT_LINUXEV)
  1831         fi
  1832     fi
  1833 }
  1834 
  1835 dnl See if we can use the Touchscreen input library
  1836 CheckTslib()
  1837 {
  1838     AC_ARG_ENABLE(input-tslib,
  1839 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1840                   , enable_input_tslib=yes)
  1841     if test x$enable_input_tslib = xyes; then
  1842         AC_MSG_CHECKING(for Touchscreen library support)
  1843         enable_input_tslib=no
  1844         AC_TRY_COMPILE([
  1845           #include "tslib.h"
  1846         ],[
  1847         ],[
  1848         enable_input_tslib=yes
  1849         ])
  1850         AC_MSG_RESULT($enable_input_tslib)
  1851         if test x$enable_input_tslib = xyes; then
  1852             AC_DEFINE(SDL_INPUT_TSLIB)
  1853             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1854         fi
  1855     fi
  1856 }
  1857 
  1858 dnl See if we can use GNU pth library for threads
  1859 CheckPTH()
  1860 {
  1861     dnl Check for pth support
  1862     AC_ARG_ENABLE(pth,
  1863 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
  1864                   , enable_pth=yes)
  1865     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1866         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1867         if test "$PTH_CONFIG" = "no"; then
  1868             use_pth=no
  1869         else
  1870             use_pth=yes
  1871         fi
  1872         AC_MSG_CHECKING(pth)
  1873         AC_MSG_RESULT($use_pth)
  1874         if test "x$use_pth" = xyes; then
  1875             AC_DEFINE(SDL_THREAD_PTH)
  1876             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1877             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1878             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1879             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1880             have_threads=yes
  1881         fi
  1882     fi
  1883 }
  1884 
  1885 dnl See what type of thread model to use on Linux and Solaris
  1886 CheckPTHREAD()
  1887 {
  1888     dnl Check for pthread support
  1889     AC_ARG_ENABLE(pthreads,
  1890 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1891                   , enable_pthreads=yes)
  1892     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1893     AC_ARG_ENABLE(pthread-sem,
  1894 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1895                   , enable_pthread_sem=yes)
  1896     case "$host" in
  1897         *-*-linux*|*-*-uclinux*)
  1898             pthread_cflags="-D_REENTRANT"
  1899             pthread_lib="-lpthread"
  1900             ;;
  1901         *-*-bsdi*)
  1902             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1903             pthread_lib=""
  1904             ;;
  1905         *-*-darwin*)
  1906             pthread_cflags="-D_THREAD_SAFE"
  1907 # causes Carbon.p complaints?
  1908 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1909             ;;
  1910         *-*-freebsd*|*-*-dragonfly*)
  1911             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1912             pthread_lib="-pthread"
  1913             ;;
  1914         *-*-netbsd*)
  1915             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1916             pthread_lib="-lpthread"
  1917             ;;
  1918         *-*-openbsd*)
  1919             pthread_cflags="-D_REENTRANT"
  1920             pthread_lib="-pthread"
  1921             ;;
  1922         *-*-solaris*)
  1923             pthread_cflags="-D_REENTRANT"
  1924             pthread_lib="-lpthread -lposix4"
  1925             ;;
  1926         *-*-sysv5*)
  1927             pthread_cflags="-D_REENTRANT -Kthread"
  1928             pthread_lib=""
  1929             ;;
  1930         *-*-irix*)
  1931             pthread_cflags="-D_SGI_MP_SOURCE"
  1932             pthread_lib="-lpthread"
  1933             ;;
  1934         *-*-aix*)
  1935             pthread_cflags="-D_REENTRANT -mthreads"
  1936             pthread_lib="-lpthread"
  1937             ;;
  1938         *-*-hpux11*)
  1939             pthread_cflags="-D_REENTRANT"
  1940             pthread_lib="-L/usr/lib -lpthread"
  1941             ;;
  1942         *-*-qnx*)
  1943             pthread_cflags=""
  1944             pthread_lib=""
  1945             ;;
  1946         *-*-osf*)
  1947             pthread_cflags="-D_REENTRANT"
  1948             if test x$ac_cv_prog_gcc = xyes; then
  1949                 pthread_lib="-lpthread -lrt"
  1950             else
  1951                 pthread_lib="-lpthread -lexc -lrt"
  1952             fi
  1953             ;;
  1954         *)
  1955             pthread_cflags="-D_REENTRANT"
  1956             pthread_lib="-lpthread"
  1957             ;;
  1958     esac
  1959     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1960         # Save the original compiler flags and libraries
  1961         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1962         # Add the pthread compiler flags and libraries
  1963         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1964         # Check to see if we have pthread support on this system
  1965         AC_MSG_CHECKING(for pthreads)
  1966         use_pthreads=no
  1967         AC_TRY_LINK([
  1968          #include <pthread.h>
  1969         ],[
  1970          pthread_attr_t type;
  1971          pthread_attr_init(&type);
  1972         ],[
  1973         use_pthreads=yes
  1974         ])
  1975         AC_MSG_RESULT($use_pthreads)
  1976         # Restore the compiler flags and libraries
  1977         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1978 
  1979         # Do futher testing if we have pthread support...
  1980         if test x$use_pthreads = xyes; then
  1981             AC_DEFINE(SDL_THREAD_PTHREAD)
  1982             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1983             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1984             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1985             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1986 
  1987             # Save the original compiler flags and libraries
  1988             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1989             # Add the pthread compiler flags and libraries
  1990             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1991 
  1992             # Check to see if recursive mutexes are available
  1993             AC_MSG_CHECKING(for recursive mutexes)
  1994             has_recursive_mutexes=no
  1995             if test x$has_recursive_mutexes = xno; then
  1996                 AC_TRY_COMPILE([
  1997                   #include <pthread.h>
  1998                 ],[
  1999                   pthread_mutexattr_t attr;
  2000                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  2001                 ],[
  2002                 has_recursive_mutexes=yes
  2003                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  2004                 ])
  2005             fi
  2006             if test x$has_recursive_mutexes = xno; then
  2007                 AC_TRY_COMPILE([
  2008                   #include <pthread.h>
  2009                 ],[
  2010                   pthread_mutexattr_t attr;
  2011                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  2012                 ],[
  2013                 has_recursive_mutexes=yes
  2014                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  2015                 ])
  2016             fi
  2017             AC_MSG_RESULT($has_recursive_mutexes)
  2018 
  2019             # Check to see if pthread semaphore support is missing
  2020             if test x$enable_pthread_sem = xyes; then
  2021                 AC_MSG_CHECKING(for pthread semaphores)
  2022                 have_pthread_sem=no
  2023                 AC_TRY_COMPILE([
  2024                   #include <pthread.h>
  2025                   #include <semaphore.h>
  2026                 ],[
  2027                 ],[
  2028                 have_pthread_sem=yes
  2029                 ])
  2030                 AC_MSG_RESULT($have_pthread_sem)
  2031             fi
  2032             if test x$have_pthread_sem = xyes; then
  2033                 AC_MSG_CHECKING(for sem_timedwait)
  2034                 have_sem_timedwait=no
  2035                 AC_TRY_LINK([
  2036                   #include <pthread.h>
  2037                   #include <semaphore.h>
  2038                 ],[
  2039                   sem_timedwait(NULL, NULL);
  2040                 ],[
  2041                 have_sem_timedwait=yes
  2042                 AC_DEFINE(HAVE_SEM_TIMEDWAIT)
  2043                 ])
  2044                 AC_MSG_RESULT($have_sem_timedwait)
  2045             fi
  2046 
  2047             # Restore the compiler flags and libraries
  2048             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2049 
  2050             # Basic thread creation functions
  2051             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  2052 
  2053             # Semaphores
  2054             # We can fake these with mutexes and condition variables if necessary
  2055             if test x$have_pthread_sem = xyes; then
  2056                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  2057             else
  2058                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  2059             fi
  2060 
  2061             # Mutexes
  2062             # We can fake these with semaphores if necessary
  2063             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  2064 
  2065             # Condition variables
  2066             # We can fake these with semaphores and mutexes if necessary
  2067             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  2068 
  2069             have_threads=yes
  2070         else
  2071             CheckPTH
  2072         fi
  2073     fi
  2074 }
  2075 
  2076 dnl Determine whether the compiler can produce Win32 executables
  2077 CheckWIN32()
  2078 {
  2079     AC_MSG_CHECKING(Win32 compiler)
  2080     have_win32_gcc=no
  2081     AC_TRY_COMPILE([
  2082      #include <windows.h>
  2083     ],[
  2084     ],[
  2085     have_win32_gcc=yes
  2086     ])
  2087     AC_MSG_RESULT($have_win32_gcc)
  2088     if test x$have_win32_gcc != xyes; then
  2089        AC_MSG_ERROR([
  2090 *** Your compiler ($CC) does not produce Win32 executables!
  2091        ])
  2092     fi
  2093 
  2094     dnl See if the user wants to redirect standard output to files
  2095     AC_ARG_ENABLE(stdio-redirect,
  2096 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  2097                   , enable_stdio_redirect=yes)
  2098     if test x$enable_stdio_redirect != xyes; then
  2099         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  2100     fi
  2101 
  2102     if test x$enable_video = xyes; then
  2103         AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
  2104         SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
  2105         SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
  2106         have_video=yes
  2107     fi
  2108 }
  2109 
  2110 dnl Find the DirectX includes and libraries
  2111 CheckDIRECTX()
  2112 {
  2113     AC_ARG_ENABLE(directx,
  2114 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  2115                   , enable_directx=yes)
  2116     if test x$enable_directx = xyes; then
  2117         have_directx=no
  2118         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  2119         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  2120         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  2121         if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
  2122             have_directx=yes
  2123         fi
  2124         if test x$enable_video = xyes -a x$have_directx = xyes; then
  2125             AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
  2126             SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
  2127             have_video=yes
  2128         fi
  2129     fi
  2130 }
  2131 
  2132 dnl Check for the dlfcn.h interface for dynamically loading objects
  2133 CheckDLOPEN()
  2134 {
  2135     AC_ARG_ENABLE(sdl-dlopen,
  2136 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  2137                   , enable_sdl_dlopen=yes)
  2138     if test x$enable_sdl_dlopen = xyes; then
  2139         AC_MSG_CHECKING(for dlopen)
  2140         have_dlopen=no
  2141         AC_TRY_COMPILE([
  2142          #include <dlfcn.h>
  2143         ],[
  2144          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  2145          #error Use dlcompat for Mac OS X 10.2 compatibility
  2146          #endif
  2147         ],[
  2148         have_dlopen=yes
  2149         ])
  2150         AC_MSG_RESULT($have_dlopen)
  2151 
  2152         if test x$have_dlopen = xyes; then
  2153             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  2154                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  2155                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  2156             AC_DEFINE(SDL_LOADSO_DLOPEN)
  2157             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  2158             have_loadso=yes
  2159         fi
  2160     fi
  2161 }
  2162 
  2163 dnl Set up the Atari LDG (shared object loader)
  2164 CheckAtariLdg()
  2165 {
  2166     AC_ARG_ENABLE(atari-ldg,
  2167 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]),
  2168                   , enable_atari_ldg=yes)
  2169     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  2170         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  2171         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  2172         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  2173             AC_DEFINE(SDL_LOADSO_LDG)
  2174             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  2175             SDL_LIBS="$SDL_LIBS -lldg -lgem"
  2176             have_loadso=yes
  2177         fi
  2178     fi
  2179 }
  2180 
  2181 dnl Check for the usbhid(3) library on *BSD
  2182 CheckUSBHID()
  2183 {
  2184     if test x$enable_joystick = xyes; then
  2185         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  2186         if test x$have_libusbhid = xyes; then
  2187             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  2188             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  2189             USB_LIBS="$USB_LIBS -lusbhid"
  2190         else
  2191             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  2192             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  2193             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  2194         fi
  2195             
  2196         save_CFLAGS="$CFLAGS"
  2197         CFLAGS="$CFLAGS $USB_CFLAGS"
  2198 
  2199         AC_MSG_CHECKING(for usbhid)
  2200         have_usbhid=no
  2201         AC_TRY_COMPILE([
  2202           #include <sys/types.h>
  2203           #if defined(HAVE_USB_H)
  2204           #include <usb.h>
  2205           #endif
  2206           #ifdef __DragonFly__
  2207           # include <bus/usb/usb.h>
  2208           # include <bus/usb/usbhid.h>
  2209           #else
  2210           # include <dev/usb/usb.h>
  2211           # include <dev/usb/usbhid.h>
  2212           #endif
  2213           #if defined(HAVE_USBHID_H)
  2214           #include <usbhid.h>
  2215           #elif defined(HAVE_LIBUSB_H)
  2216           #include <libusb.h>
  2217           #elif defined(HAVE_LIBUSBHID_H)
  2218           #include <libusbhid.h>
  2219           #endif
  2220         ],[
  2221           struct report_desc *repdesc;
  2222           struct usb_ctl_report *repbuf;
  2223           hid_kind_t hidkind;
  2224         ],[
  2225         have_usbhid=yes
  2226         ])
  2227         AC_MSG_RESULT($have_usbhid)
  2228 
  2229         if test x$have_usbhid = xyes; then
  2230             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2231             have_usbhid_ucr_data=no
  2232             AC_TRY_COMPILE([
  2233               #include <sys/types.h>
  2234               #if defined(HAVE_USB_H)
  2235               #include <usb.h>
  2236               #endif
  2237               #ifdef __DragonFly__
  2238               # include <bus/usb/usb.h>
  2239               # include <bus/usb/usbhid.h>
  2240               #else
  2241               # include <dev/usb/usb.h>
  2242               # include <dev/usb/usbhid.h>
  2243               #endif
  2244               #if defined(HAVE_USBHID_H)
  2245               #include <usbhid.h>
  2246               #elif defined(HAVE_LIBUSB_H)
  2247               #include <libusb.h>
  2248               #elif defined(HAVE_LIBUSBHID_H)
  2249               #include <libusbhid.h>
  2250               #endif
  2251             ],[
  2252               struct usb_ctl_report buf;
  2253               if (buf.ucr_data) { }
  2254             ],[
  2255             have_usbhid_ucr_data=yes
  2256             ])
  2257             if test x$have_usbhid_ucr_data = xyes; then
  2258                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2259             fi
  2260             AC_MSG_RESULT($have_usbhid_ucr_data)
  2261             
  2262             AC_MSG_CHECKING(for new usbhid API)
  2263             have_usbhid_new=no
  2264             AC_TRY_COMPILE([
  2265               #include <sys/types.h>
  2266               #if defined(HAVE_USB_H)
  2267               #include <usb.h>
  2268               #endif
  2269               #ifdef __DragonFly__
  2270               #include <bus/usb/usb.h>
  2271               #include <bus/usb/usbhid.h>
  2272               #else
  2273               #include <dev/usb/usb.h>
  2274               #include <dev/usb/usbhid.h>
  2275               #endif
  2276               #if defined(HAVE_USBHID_H)
  2277               #include <usbhid.h>
  2278               #elif defined(HAVE_LIBUSB_H)
  2279               #include <libusb.h>
  2280               #elif defined(HAVE_LIBUSBHID_H)
  2281               #include <libusbhid.h>
  2282               #endif
  2283             ],[
  2284               report_desc_t d;
  2285               hid_start_parse(d, 1, 1);
  2286             ],[
  2287             have_usbhid_new=yes
  2288             ])
  2289             if test x$have_usbhid_new = xyes; then
  2290                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2291             fi
  2292             AC_MSG_RESULT($have_usbhid_new)
  2293 
  2294             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2295             have_machine_joystick=no
  2296             AC_TRY_COMPILE([
  2297               #include <machine/joystick.h>
  2298             ],[
  2299               struct joystick t;
  2300             ],[
  2301             have_machine_joystick=yes
  2302             ])
  2303             if test x$have_machine_joystick = xyes; then
  2304                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2305             fi
  2306             AC_MSG_RESULT($have_machine_joystick)
  2307 
  2308             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2309             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2310             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2311             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2312             have_joystick=yes
  2313         fi
  2314         CFLAGS="$save_CFLAGS"
  2315     fi
  2316 }
  2317 
  2318 dnl Check for clock_gettime()
  2319 CheckClockGettime()
  2320 {
  2321     AC_ARG_ENABLE(clock_gettime,
  2322 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2323                   , enable_clock_gettime=no)
  2324     if test x$enable_clock_gettime = xyes; then
  2325         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2326         if test x$have_clock_gettime = xyes; then
  2327             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2328             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2329         fi
  2330     fi
  2331 }
  2332 
  2333 dnl Check for a valid linux/version.h
  2334 CheckLinuxVersion()
  2335 {
  2336     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2337     if test x$have_linux_version_h = xyes; then
  2338         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2339     fi
  2340 }
  2341 
  2342 dnl Check if we want to use RPATH
  2343 CheckRPATH()
  2344 {
  2345     AC_ARG_ENABLE(rpath,
  2346 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2347                   , enable_rpath=yes)
  2348 }
  2349 
  2350 dnl Set up the configuration based on the host platform!
  2351 case "$host" in
  2352     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2353         ARCH=linux
  2354         CheckDummyVideo
  2355         CheckIPod
  2356         # Set up files for the timer library
  2357         if test x$enable_timers = xyes; then
  2358             AC_DEFINE(SDL_TIMER_UNIX)
  2359             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2360             have_timers=yes
  2361         fi
  2362         ;;
  2363     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  2364         case "$host" in
  2365             *-*-linux*)         ARCH=linux ;;
  2366             *-*-uclinux*)       ARCH=linux ;;
  2367             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2368             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2369             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2370             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2371             *-*-bsdi*)          ARCH=bsdi ;;
  2372             *-*-freebsd*)       ARCH=freebsd ;;
  2373             *-*-dragonfly*)     ARCH=freebsd ;;
  2374             *-*-netbsd*)        ARCH=netbsd ;;
  2375             *-*-openbsd*)       ARCH=openbsd ;;
  2376             *-*-sysv5*)         ARCH=sysv5 ;;
  2377             *-*-solaris*)       ARCH=solaris ;;
  2378             *-*-hpux*)          ARCH=hpux ;;
  2379             *-*-irix*)          ARCH=irix ;;
  2380             *-*-aix*)           ARCH=aix ;;
  2381             *-*-osf*)           ARCH=osf ;;
  2382         esac
  2383         CheckVisibilityHidden
  2384         CheckDummyVideo
  2385         CheckDiskAudio
  2386         CheckDummyAudio
  2387         CheckDLOPEN
  2388         CheckNASM
  2389         CheckAltivec
  2390         CheckOSS
  2391         CheckDMEDIA
  2392         CheckMME
  2393         CheckALSA
  2394         CheckARTSC
  2395         CheckESD
  2396         CheckSndio
  2397         CheckPulseAudio
  2398         CheckNAS
  2399         CheckX11
  2400         CheckNANOX
  2401         CheckFBCON
  2402         CheckDirectFB
  2403         CheckPS2GS
  2404         CheckPS3
  2405         CheckGGI
  2406         CheckSVGA
  2407         CheckVGL
  2408         CheckWscons
  2409         CheckAAlib
  2410         CheckCaca
  2411         CheckQtopia
  2412         CheckPicoGUI
  2413         CheckOpenGLX11
  2414         CheckInputEvents
  2415         CheckTslib
  2416         CheckUSBHID
  2417         CheckPTHREAD
  2418         CheckClockGettime
  2419         CheckLinuxVersion
  2420         CheckRPATH
  2421         # Set up files for the audio library
  2422         if test x$enable_audio = xyes; then
  2423           case $ARCH in
  2424             sysv5|solaris|hpux)
  2425                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2426                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2427                 have_audio=yes
  2428             ;;
  2429             netbsd)
  2430                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2431                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2432                 have_audio=yes
  2433             ;;
  2434             aix)
  2435                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
  2436                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2437                 have_audio=yes
  2438             ;;
  2439           esac
  2440         fi
  2441         # Set up files for the joystick library
  2442         if test x$enable_joystick = xyes; then
  2443           case $ARCH in
  2444             linux)
  2445                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2446                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2447                 have_joystick=yes
  2448             ;;
  2449           esac
  2450         fi
  2451         # Set up files for the cdrom library
  2452         if test x$enable_cdrom = xyes; then
  2453           case $ARCH in
  2454             linux|solaris)
  2455                 AC_DEFINE(SDL_CDROM_LINUX)
  2456                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2457                 have_cdrom=yes
  2458             ;;
  2459             *freebsd*)
  2460                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2461                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2462                 have_cdrom=yes
  2463             ;;
  2464             *openbsd*|*netbsd*)
  2465                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2466                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2467                 have_cdrom=yes
  2468             ;;
  2469             bsdi)
  2470                 AC_DEFINE(SDL_CDROM_BSDI)
  2471                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2472                 have_cdrom=yes
  2473             ;;
  2474             aix)
  2475                 AC_DEFINE(SDL_CDROM_AIX)
  2476                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2477                 have_cdrom=yes
  2478             ;;
  2479             osf)
  2480                 AC_DEFINE(SDL_CDROM_OSF)
  2481                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2482                 have_cdrom=yes
  2483             ;;
  2484           esac
  2485         fi
  2486         # Set up files for the thread library
  2487         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2488             AC_DEFINE(SDL_THREAD_SPROC)
  2489             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2490             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2491             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2492             have_threads=yes
  2493         fi
  2494         # Set up files for the timer library
  2495         if test x$enable_timers = xyes; then
  2496             AC_DEFINE(SDL_TIMER_UNIX)
  2497             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2498             have_timers=yes
  2499         fi
  2500         ;;
  2501     *-*-qnx*)
  2502         ARCH=qnx
  2503         CheckDummyVideo
  2504         CheckDiskAudio
  2505         CheckDummyAudio
  2506         # CheckNASM
  2507         CheckDLOPEN
  2508         CheckNAS
  2509         CheckPHOTON
  2510         CheckX11
  2511         CheckOpenGLX11
  2512         CheckPTHREAD
  2513         # Set up files for the audio library
  2514         if test x$enable_audio = xyes; then
  2515             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2516             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2517             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2518             have_audio=yes
  2519         fi
  2520         # Set up files for the cdrom library
  2521         if test x$enable_cdrom = xyes; then
  2522             AC_DEFINE(SDL_CDROM_QNX)
  2523             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2524             have_cdrom=yes
  2525         fi
  2526         # Set up files for the timer library
  2527         if test x$enable_timers = xyes; then
  2528             AC_DEFINE(SDL_TIMER_UNIX)
  2529             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2530             have_timers=yes
  2531         fi
  2532         ;;
  2533     *-*-cygwin* | *-*-mingw32*)
  2534         ARCH=win32
  2535         if test "$build" != "$host"; then # cross-compiling
  2536             # Default cross-compile location
  2537             ac_default_prefix=/usr/local/cross-tools/i386-mingw32
  2538         else
  2539             # Look for the location of the tools and install there
  2540             if test "$BUILD_PREFIX" != ""; then
  2541                 ac_default_prefix=$BUILD_PREFIX
  2542             fi
  2543         fi
  2544         CheckDummyVideo
  2545         CheckDiskAudio
  2546         CheckDummyAudio
  2547         CheckWIN32
  2548         CheckWIN32GL
  2549         CheckDIRECTX
  2550         CheckNASM
  2551         # Set up files for the audio library
  2552         if test x$enable_audio = xyes; then
  2553             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2554             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2555             if test x$have_directx = xyes; then
  2556                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2557                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2558             fi
  2559             have_audio=yes
  2560         fi
  2561         # Set up files for the joystick library
  2562         if test x$enable_joystick = xyes; then
  2563             AC_DEFINE(SDL_JOYSTICK_WINMM)
  2564             SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
  2565             have_joystick=yes
  2566         fi
  2567         # Set up files for the cdrom library
  2568         if test x$enable_cdrom = xyes; then
  2569             AC_DEFINE(SDL_CDROM_WIN32)
  2570             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2571             have_cdrom=yes
  2572         fi
  2573         # Set up files for the thread library
  2574         if test x$enable_threads = xyes; then
  2575             AC_DEFINE(SDL_THREAD_WIN32)
  2576             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2577             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2578             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2579             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2580             have_threads=yes
  2581         fi
  2582         # Set up files for the timer library
  2583         if test x$enable_timers = xyes; then
  2584             AC_DEFINE(SDL_TIMER_WIN32)
  2585             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2586             have_timers=yes
  2587         fi
  2588         # Set up files for the shared object loading library
  2589         if test x$enable_loadso = xyes; then
  2590             AC_DEFINE(SDL_LOADSO_WIN32)
  2591             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2592             have_loadso=yes
  2593         fi
  2594         # Set up the system libraries we need
  2595         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
  2596         if test x$have_directx = xyes; then
  2597             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
  2598         fi
  2599         # The Win32 platform requires special setup
  2600         SOURCES="$SOURCES $srcdir/src/main/win32/*.rc"
  2601         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2602         SDLMAIN_LDFLAGS="-static"
  2603         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2604         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2605         ;;
  2606     *-wince*)
  2607         ARCH=win32
  2608         CheckDummyVideo
  2609         CheckDiskAudio
  2610         CheckDummyAudio
  2611         CheckWIN32
  2612         CheckNASM
  2613         SOURCES="$SOURCES $srcdir/src/video/gapi/*.c"
  2614         EXTRA_CFLAGS="$EXTRA_CFLAGS -D_WIN32_WCE=0x420"
  2615         if test x$enable_audio = xyes; then
  2616             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2617             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2618             have_audio=yes
  2619         fi
  2620         # Set up files for the thread library
  2621         if test x$enable_threads = xyes; then
  2622             AC_DEFINE(SDL_THREAD_WIN32)
  2623             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2624             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2625             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2626             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2627             have_threads=yes
  2628         fi
  2629         # Set up files for the timer library
  2630         if test x$enable_timers = xyes; then
  2631             AC_DEFINE(SDL_TIMER_WINCE)
  2632             SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
  2633             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lmmtimer"
  2634             have_timers=yes
  2635         fi
  2636         # Set up files for the shared object loading library
  2637         if test x$enable_loadso = xyes; then
  2638             AC_DEFINE(SDL_LOADSO_WIN32)
  2639             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2640             have_loadso=yes
  2641         fi
  2642         # Set up the system libraries we need
  2643         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl"
  2644         # The Win32 platform requires special setup
  2645         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2646         SDLMAIN_LDFLAGS="-static"
  2647         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
  2648         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2649         ;;
  2650     *-*-beos* | *-*-haiku*)
  2651         ARCH=beos
  2652         ac_default_prefix=/boot/develop/tools/gnupro
  2653         CheckDummyVideo
  2654         CheckDiskAudio
  2655         CheckDummyAudio
  2656         CheckNASM
  2657         CheckBWINDOW
  2658         CheckBeGL
  2659         # Set up files for the audio library
  2660         if test x$enable_audio = xyes; then
  2661             AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
  2662             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2663             have_audio=yes
  2664         fi
  2665         # Set up files for the joystick library
  2666         if test x$enable_joystick = xyes; then
  2667             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2668             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2669             have_joystick=yes
  2670         fi
  2671         # Set up files for the cdrom library
  2672         if test x$enable_cdrom = xyes; then
  2673             AC_DEFINE(SDL_CDROM_BEOS)
  2674             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2675             have_cdrom=yes
  2676         fi
  2677         # Set up files for the thread library
  2678         if test x$enable_threads = xyes; then
  2679             AC_DEFINE(SDL_THREAD_BEOS)
  2680             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2681             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2682             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2683             have_threads=yes
  2684         fi
  2685         # Set up files for the timer library
  2686         if test x$enable_timers = xyes; then
  2687             AC_DEFINE(SDL_TIMER_BEOS)
  2688             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2689             have_timers=yes
  2690         fi
  2691         # Set up files for the shared object loading library
  2692         if test x$enable_loadso = xyes; then
  2693             case "$host" in
  2694                 *-*-beos*)
  2695                     AC_DEFINE(SDL_LOADSO_BEOS)
  2696                     SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2697                 ;;
  2698                 *-*-haiku*)
  2699                     AC_DEFINE(SDL_LOADSO_DLOPEN)
  2700                     SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  2701                 ;;
  2702             esac    
  2703             have_loadso=yes
  2704         fi
  2705         # The BeOS platform requires special setup.
  2706         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2707         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2708         ;;
  2709     *-*-darwin* )
  2710         # This could be either full "Mac OS X", or plain "Darwin" which is
  2711         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2712         # Next line is broken, and a few files below require Mac OS X (full)
  2713         ARCH=macosx
  2714 
  2715         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2716         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2717         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2718 
  2719         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2720         # is -lm which is not needed under Mac OS X. But for some reasons it
  2721         # also tends to contain spurious -L switches, which we don't want to
  2722         # use here or in sdl-config. Hence we reset it.
  2723         EXTRA_LDFLAGS=""
  2724 
  2725         CheckVisibilityHidden
  2726         CheckDummyVideo
  2727         CheckDiskAudio
  2728         CheckDummyAudio
  2729         CheckDLOPEN
  2730         CheckNASM
  2731 
  2732         # Set up files for the shared object loading library
  2733         # (this needs to be done before the dynamic X11 check)
  2734         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2735             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2736             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2737             have_loadso=yes
  2738         fi
  2739 
  2740         CheckCOCOA
  2741         CheckCARBON
  2742         CheckX11
  2743         CheckMacGL
  2744         CheckOpenGLX11
  2745         CheckPTHREAD
  2746         CheckAltivec
  2747 
  2748         # Need this or things might misbuild on a G3.
  2749         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2750 
  2751         # Set up files for the audio library
  2752         if test x$enable_audio = xyes; then
  2753             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2754             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2755             have_audio=yes
  2756         fi
  2757         # Set up files for the joystick library
  2758         if test x$enable_joystick = xyes; then
  2759             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2760             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2761             have_joystick=yes
  2762             need_iokit_framework=yes
  2763         fi
  2764         # Set up files for the cdrom library
  2765         if test x$enable_cdrom = xyes; then
  2766             AC_DEFINE(SDL_CDROM_MACOSX)
  2767             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2768             have_cdrom=yes
  2769         fi
  2770         # Set up files for the timer library
  2771         if test x$enable_timers = xyes; then
  2772             AC_DEFINE(SDL_TIMER_UNIX)
  2773             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2774             have_timers=yes
  2775         fi
  2776         # The Mac OS X platform requires special setup.
  2777         SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
  2778         SDLMAIN_LDFLAGS="-static"
  2779         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2780         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2781         if test x$enable_video_cocoa = xyes; then
  2782             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2783             need_iokit_framework=yes
  2784         fi
  2785         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
  2786             # The Cocoa backend still needs Carbon
  2787             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ApplicationServices"
  2788             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2789         fi
  2790         # If either the audio or CD driver is used, add the AudioUnit framework
  2791         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2792             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2793         fi
  2794         # Some subsystems reference IOKit...
  2795         if test x$need_iokit_framework = xyes; then
  2796             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2797         fi
  2798         ;;
  2799     *-*-mint*)
  2800         ARCH=mint
  2801         CheckDummyVideo
  2802         CheckDiskAudio
  2803         CheckDummyAudio
  2804         CheckAtariBiosEvent
  2805         CheckAtariXbiosVideo
  2806         CheckAtariGemVideo
  2807         CheckAtariAudio
  2808         CheckAtariLdg
  2809         CheckAtariOSMesa
  2810         CheckPTH
  2811         # Set up files for the audio library
  2812         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2813             if test x$enable_audio = xyes; then
  2814                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2815                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2816                 have_audio=yes
  2817             fi
  2818         fi
  2819         # Set up files for the joystick library
  2820         if test x$enable_joystick = xyes; then
  2821             AC_DEFINE(SDL_JOYSTICK_MINT)
  2822             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2823             have_joystick=yes
  2824         fi
  2825         # Set up files for the cdrom library
  2826         if test x$enable_cdrom = xyes; then
  2827             AC_DEFINE(SDL_CDROM_MINT)
  2828             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2829             have_cdrom=yes
  2830         fi
  2831         # Set up files for the timer library
  2832         if test x$enable_timers = xyes; then
  2833             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2834                 AC_DEFINE(SDL_TIMER_UNIX)
  2835                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2836             else
  2837                 AC_DEFINE(SDL_TIMER_MINT)
  2838                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2839                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2840             fi
  2841             have_timers=yes
  2842         fi
  2843         ;;
  2844     *-riscos)
  2845         ARCH=riscos
  2846         CheckOSS
  2847         CheckPTHREAD
  2848         # Set up files for the video library
  2849         if test x$enable_video = xyes; then
  2850             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2851             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2852             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2853             have_video=yes
  2854         fi
  2855         # Set up files for the joystick library
  2856         if test x$enable_joystick = xyes; then
  2857             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2858             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2859             have_joystick=yes
  2860         fi
  2861         # Set up files for the timer library
  2862         if test x$enable_timers = xyes; then
  2863             AC_DEFINE(SDL_TIMER_RISCOS)
  2864             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2865             have_timers=yes
  2866         fi
  2867         # The RISC OS platform requires special setup.
  2868         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2869         ;;
  2870     *)
  2871         AC_MSG_ERROR([
  2872 *** Unsupported host:  Please add to configure.in
  2873         ])
  2874         ;;
  2875 esac
  2876 
  2877 dnl Do this on all platforms, after everything else.
  2878 CheckWarnAll
  2879 
  2880 # Verify that we have all the platform specific files we need
  2881 
  2882 if test x$enable_joystick = xyes; then
  2883   if test x$have_joystick != xyes; then
  2884     # Wants joystick subsystem, but doesn't have a platform-specific backend...
  2885     AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2886     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2887   fi
  2888 fi
  2889 if test x$have_cdrom != xyes; then
  2890     if test x$enable_cdrom = xyes; then
  2891         AC_DEFINE(SDL_CDROM_DISABLED)
  2892     fi
  2893     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2894 fi
  2895 if test x$have_threads != xyes; then
  2896     if test x$enable_threads = xyes; then
  2897         AC_DEFINE(SDL_THREADS_DISABLED)
  2898     fi
  2899     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2900 fi
  2901 if test x$have_timers != xyes; then
  2902     if test x$enable_timers = xyes; then
  2903         AC_DEFINE(SDL_TIMERS_DISABLED)
  2904     fi
  2905     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2906 fi
  2907 if test x$have_loadso != xyes; then
  2908     if test x$enable_loadso = xyes; then
  2909         AC_DEFINE(SDL_LOADSO_DISABLED)
  2910     fi
  2911     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2912 fi
  2913 if test x$SDLMAIN_SOURCES = x; then
  2914     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2915     SDLMAIN_LDFLAGS="-static"
  2916 fi
  2917 
  2918 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2919 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2920 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2921 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2922 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2923 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.lo,g'`
  2924 
  2925 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2926 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2927 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2928 
  2929 # Set runtime shared library paths as needed
  2930 
  2931 if test "x$enable_rpath" = "xyes"; then
  2932   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2933     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2934   fi
  2935   if test $ARCH = solaris; then
  2936     SDL_RLD_FLAGS="-R\${libdir}"
  2937   fi
  2938 else
  2939   SDL_RLD_FLAGS=""
  2940 fi
  2941 
  2942 case "$ARCH" in
  2943   macosx)
  2944     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2945       SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa"
  2946     fi
  2947     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  2948       SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon"
  2949     fi
  2950     # Evil hack to allow static linking on Mac OS X
  2951     SDL_STATIC_LIBS="\${libdir}/libSDLmain.a \${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2952     ;;
  2953   *)
  2954     SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2955     ;;
  2956 esac
  2957 
  2958 dnl Expand the cflags and libraries needed by apps using SDL
  2959 AC_SUBST(SDL_CFLAGS)
  2960 AC_SUBST(SDL_LIBS)
  2961 AC_SUBST(SDL_STATIC_LIBS)
  2962 AC_SUBST(SDL_RLD_FLAGS)
  2963 if test x$enable_shared = xyes; then
  2964     ENABLE_SHARED_TRUE=
  2965     ENABLE_SHARED_FALSE="#"
  2966 else
  2967     ENABLE_SHARED_TRUE="#"
  2968     ENABLE_SHARED_FALSE=
  2969 fi
  2970 if test x$enable_static = xyes; then
  2971     ENABLE_STATIC_TRUE=
  2972     ENABLE_STATIC_FALSE="#"
  2973 else
  2974     ENABLE_STATIC_TRUE="#"
  2975     ENABLE_STATIC_FALSE=
  2976 fi
  2977 AC_SUBST(ENABLE_SHARED_TRUE)
  2978 AC_SUBST(ENABLE_SHARED_FALSE)
  2979 AC_SUBST(ENABLE_STATIC_TRUE)
  2980 AC_SUBST(ENABLE_STATIC_FALSE)
  2981 
  2982 dnl Expand the sources and objects needed to build the library
  2983 AC_SUBST(ac_aux_dir)
  2984 AC_SUBST(INCLUDE)
  2985 AC_SUBST(SOURCES)
  2986 AC_SUBST(OBJECTS)
  2987 AC_SUBST(SDLMAIN_SOURCES)
  2988 AC_SUBST(SDLMAIN_OBJECTS)
  2989 AC_SUBST(SDLMAIN_LDFLAGS)
  2990 AC_SUBST(BUILD_CFLAGS)
  2991 AC_SUBST(EXTRA_CFLAGS)
  2992 AC_SUBST(BUILD_LDFLAGS)
  2993 AC_SUBST(EXTRA_LDFLAGS)
  2994 AC_SUBST(WINDRES)
  2995 
  2996 AC_OUTPUT([
  2997     Makefile sdl-config SDL.spec SDL.qpg sdl.pc
  2998 ], [
  2999     : >build-deps
  3000     if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
  3001 ])