configure.in
author Ryan C. Gordon <icculus@icculus.org>
Sat, 16 Jun 2007 05:51:51 +0000
branchSDL-1.2
changeset 3972 590d6f5da52b
parent 3967 d22892eaa1cf
child 3991 7a649501c089
permissions -rw-r--r--
Fixed assembler command line for older yasm releases and documented nasm
switches.

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