configure.in
author Ozkan Sezer <sezeroz@gmail.com>
Sun, 25 Mar 2018 01:21:10 +0300
branchSDL-1.2
changeset 11978 2dfa07d52047
parent 11975 addd798b16a0
child 12301 d782ee1f09aa
permissions -rw-r--r--
OS/2 SDL_Delay(): add missing else :

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