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