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