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