Fixed SDL building with the minimal configuration
authorSam Lantinga <slouken@libsdl.org>
Thu, 13 Jun 2013 22:10:10 -0700
changeset 73075d6b7b9432d3
parent 7306 1516fe08e6ec
child 7308 728e5f22a82f
Fixed SDL building with the minimal configuration
configure
configure.in
include/SDL_config.h.in
include/SDL_config_minimal.h
include/SDL_stdinc.h
src/SDL_log.c
src/joystick/SDL_joystick.c
src/thread/generic/SDL_syssem.c
test/testpower.c
     1.1 --- a/configure	Tue Jun 11 08:37:03 2013 -0700
     1.2 +++ b/configure	Thu Jun 13 22:10:10 2013 -0700
     1.3 @@ -16936,7 +16936,10 @@
     1.4  SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
     1.5  SOURCES="$SOURCES $srcdir/src/events/*.c"
     1.6  SOURCES="$SOURCES $srcdir/src/file/*.c"
     1.7 +SOURCES="$SOURCES $srcdir/src/haptic/*.c"
     1.8 +SOURCES="$SOURCES $srcdir/src/joystick/*.c"
     1.9  SOURCES="$SOURCES $srcdir/src/libm/*.c"
    1.10 +SOURCES="$SOURCES $srcdir/src/power/*.c"
    1.11  SOURCES="$SOURCES $srcdir/src/render/*.c"
    1.12  SOURCES="$SOURCES $srcdir/src/render/*/*.c"
    1.13  SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
    1.14 @@ -17016,8 +17019,6 @@
    1.15  
    1.16  $as_echo "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h
    1.17  
    1.18 -else
    1.19 -    SOURCES="$SOURCES $srcdir/src/joystick/*.c"
    1.20  fi
    1.21  # Check whether --enable-haptic was given.
    1.22  if test "${enable_haptic+set}" = set; then :
    1.23 @@ -17030,8 +17031,6 @@
    1.24  
    1.25  $as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h
    1.26  
    1.27 -else
    1.28 -    SOURCES="$SOURCES $srcdir/src/haptic/*.c"
    1.29  fi
    1.30  # Check whether --enable-power was given.
    1.31  if test "${enable_power+set}" = set; then :
    1.32 @@ -17044,8 +17043,6 @@
    1.33  
    1.34  $as_echo "#define SDL_POWER_DISABLED 1" >>confdefs.h
    1.35  
    1.36 -else
    1.37 -    SOURCES="$SOURCES $srcdir/src/power/*.c"
    1.38  fi
    1.39  # Check whether --enable-threads was given.
    1.40  if test "${enable_threads+set}" = set; then :
     2.1 --- a/configure.in	Tue Jun 11 08:37:03 2013 -0700
     2.2 +++ b/configure.in	Thu Jun 13 22:10:10 2013 -0700
     2.3 @@ -297,7 +297,10 @@
     2.4  SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
     2.5  SOURCES="$SOURCES $srcdir/src/events/*.c"
     2.6  SOURCES="$SOURCES $srcdir/src/file/*.c"
     2.7 +SOURCES="$SOURCES $srcdir/src/haptic/*.c"
     2.8 +SOURCES="$SOURCES $srcdir/src/joystick/*.c"
     2.9  SOURCES="$SOURCES $srcdir/src/libm/*.c"
    2.10 +SOURCES="$SOURCES $srcdir/src/power/*.c"
    2.11  SOURCES="$SOURCES $srcdir/src/render/*.c"
    2.12  SOURCES="$SOURCES $srcdir/src/render/*/*.c"
    2.13  SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
    2.14 @@ -342,24 +345,18 @@
    2.15                , enable_joystick=yes)
    2.16  if test x$enable_joystick != xyes; then
    2.17      AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
    2.18 -else
    2.19 -    SOURCES="$SOURCES $srcdir/src/joystick/*.c"
    2.20  fi
    2.21  AC_ARG_ENABLE(haptic,
    2.22  AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
    2.23                , enable_haptic=yes)
    2.24  if test x$enable_haptic != xyes; then
    2.25      AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
    2.26 -else
    2.27 -    SOURCES="$SOURCES $srcdir/src/haptic/*.c"
    2.28  fi
    2.29  AC_ARG_ENABLE(power,
    2.30  AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
    2.31                , enable_power=yes)
    2.32  if test x$enable_power != xyes; then
    2.33      AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
    2.34 -else
    2.35 -    SOURCES="$SOURCES $srcdir/src/power/*.c"
    2.36  fi
    2.37  AC_ARG_ENABLE(threads,
    2.38  AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
     3.1 --- a/include/SDL_config.h.in	Tue Jun 11 08:37:03 2013 -0700
     3.2 +++ b/include/SDL_config.h.in	Thu Jun 13 22:10:10 2013 -0700
     3.3 @@ -158,8 +158,9 @@
     3.4  #undef HAVE_SEM_TIMEDWAIT
     3.5  
     3.6  #else
     3.7 -/* We may need some replacement for stdarg.h here */
     3.8 -#include <stdarg.h>
     3.9 +#define HAVE_STDARG_H   1
    3.10 +#define HAVE_STDDEF_H   1
    3.11 +#define HAVE_STDINT_H   1
    3.12  #endif /* HAVE_LIBC */
    3.13  
    3.14  /* SDL internal assertion support */
     4.1 --- a/include/SDL_config_minimal.h	Tue Jun 11 08:37:03 2013 -0700
     4.2 +++ b/include/SDL_config_minimal.h	Thu Jun 13 22:10:10 2013 -0700
     4.3 @@ -30,10 +30,12 @@
     4.4   *  This is the minimal configuration that can be used to build SDL.
     4.5   */
     4.6  
     4.7 -#include <stddef.h>
     4.8 -#include <stdarg.h>
     4.9 +#define HAVE_STDARG_H   1
    4.10 +#define HAVE_STDDEF_H   1
    4.11  
    4.12 -#if !defined(_STDINT_H_) && !defined(_STDINT_H) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
    4.13 +/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
    4.14 +#if defined(_MSC_VER) && (_MSC_VER < 1600)
    4.15 +/* Here are some reasonable defaults */
    4.16  typedef unsigned int size_t;
    4.17  typedef signed char int8_t;
    4.18  typedef unsigned char uint8_t;
    4.19 @@ -44,7 +46,9 @@
    4.20  typedef signed long long int64_t;
    4.21  typedef unsigned long long uint64_t;
    4.22  typedef unsigned long uintptr_t;
    4.23 -#endif /* if (stdint.h isn't available) */
    4.24 +#else
    4.25 +#define HAVE_STDINT_H 1
    4.26 +#endif /* Visual Studio 2008 */
    4.27  
    4.28  #ifdef __GNUC__
    4.29  #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
     5.1 --- a/include/SDL_stdinc.h	Tue Jun 11 08:37:03 2013 -0700
     5.2 +++ b/include/SDL_stdinc.h	Thu Jun 13 22:10:10 2013 -0700
     5.3 @@ -359,7 +359,7 @@
     5.4  
     5.5  
     5.6  extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
     5.7 -#if defined(__MACOSX__)
     5.8 +#if defined(__MACOSX__) && defined(HAVE_MEMCPY)
     5.9  SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
    5.10  {
    5.11      /* We can count on memcpy existing on Mac OS X and being well-tuned. */
     6.1 --- a/src/SDL_log.c	Tue Jun 11 08:37:03 2013 -0700
     6.2 +++ b/src/SDL_log.c	Thu Jun 13 22:10:10 2013 -0700
     6.3 @@ -369,7 +369,9 @@
     6.4          SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
     6.5          __android_log_write(SDL_android_priority[priority], tag, message);
     6.6      }
     6.7 -#elif defined(__APPLE__)
     6.8 +#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
     6.9 +    /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now.
    6.10 +    */
    6.11      extern void SDL_NSLog(const char *text);
    6.12      {
    6.13          char *text;
     7.1 --- a/src/joystick/SDL_joystick.c	Tue Jun 11 08:37:03 2013 -0700
     7.2 +++ b/src/joystick/SDL_joystick.c	Thu Jun 13 22:10:10 2013 -0700
     7.3 @@ -611,7 +611,7 @@
     7.4  
     7.5      /* We ignore events if we don't have keyboard focus, except for button
     7.6       * release. */
     7.7 -    if (event.type == SDL_JOYBUTTONDOWN && SDL_PrivateJoystickShouldIgnoreEvent()) {
     7.8 +    if (state == SDL_PRESSED && SDL_PrivateJoystickShouldIgnoreEvent()) {
     7.9          return 0;
    7.10      }
    7.11  
     8.1 --- a/src/thread/generic/SDL_syssem.c	Tue Jun 11 08:37:03 2013 -0700
     8.2 +++ b/src/thread/generic/SDL_syssem.c	Thu Jun 13 22:10:10 2013 -0700
     8.3 @@ -32,7 +32,7 @@
     8.4  SDL_sem *
     8.5  SDL_CreateSemaphore(Uint32 initial_value)
     8.6  {
     8.7 -    SDL_SetError("SDL not configured with thread support");
     8.8 +    SDL_SetError("SDL not built with thread support");
     8.9      return (SDL_sem *) 0;
    8.10  }
    8.11  
    8.12 @@ -44,19 +44,19 @@
    8.13  int
    8.14  SDL_SemTryWait(SDL_sem * sem)
    8.15  {
    8.16 -    return SDL_SetError("SDL not configured with thread support");
    8.17 +    return SDL_SetError("SDL not built with thread support");
    8.18  }
    8.19  
    8.20  int
    8.21  SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
    8.22  {
    8.23 -    return SDL_SetError("SDL not configured with thread support");
    8.24 +    return SDL_SetError("SDL not built with thread support");
    8.25  }
    8.26  
    8.27  int
    8.28  SDL_SemWait(SDL_sem * sem)
    8.29  {
    8.30 -    return SDL_SetError("SDL not configured with thread support");
    8.31 +    return SDL_SetError("SDL not built with thread support");
    8.32  }
    8.33  
    8.34  Uint32
    8.35 @@ -68,7 +68,7 @@
    8.36  int
    8.37  SDL_SemPost(SDL_sem * sem)
    8.38  {
    8.39 -    return SDL_SetError("SDL not configured with thread support");
    8.40 +    return SDL_SetError("SDL not built with thread support");
    8.41  }
    8.42  
    8.43  #else
     9.1 --- a/test/testpower.c	Tue Jun 11 08:37:03 2013 -0700
     9.2 +++ b/test/testpower.c	Thu Jun 13 22:10:10 2013 -0700
     9.3 @@ -63,7 +63,7 @@
     9.4  int
     9.5  main(int argc, char *argv[])
     9.6  {
     9.7 -    if (SDL_Init(SDL_INIT_VIDEO) == -1) {
     9.8 +    if (SDL_Init(0) == -1) {
     9.9          fprintf(stderr, "SDL_Init() failed: %s\n", SDL_GetError());
    9.10          return 1;
    9.11      }