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