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