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