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