Fixed SDL building with the minimal configuration
authorSam Lantinga <slouken@libsdl.org>
Thu, 13 Jun 2013 22:10:10 -0700
changeset 7307 5d6b7b9432d3
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
--- a/configure	Tue Jun 11 08:37:03 2013 -0700
+++ b/configure	Thu Jun 13 22:10:10 2013 -0700
@@ -16936,7 +16936,10 @@
 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
 SOURCES="$SOURCES $srcdir/src/events/*.c"
 SOURCES="$SOURCES $srcdir/src/file/*.c"
+SOURCES="$SOURCES $srcdir/src/haptic/*.c"
+SOURCES="$SOURCES $srcdir/src/joystick/*.c"
 SOURCES="$SOURCES $srcdir/src/libm/*.c"
+SOURCES="$SOURCES $srcdir/src/power/*.c"
 SOURCES="$SOURCES $srcdir/src/render/*.c"
 SOURCES="$SOURCES $srcdir/src/render/*/*.c"
 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
@@ -17016,8 +17019,6 @@
 
 $as_echo "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h
 
-else
-    SOURCES="$SOURCES $srcdir/src/joystick/*.c"
 fi
 # Check whether --enable-haptic was given.
 if test "${enable_haptic+set}" = set; then :
@@ -17030,8 +17031,6 @@
 
 $as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h
 
-else
-    SOURCES="$SOURCES $srcdir/src/haptic/*.c"
 fi
 # Check whether --enable-power was given.
 if test "${enable_power+set}" = set; then :
@@ -17044,8 +17043,6 @@
 
 $as_echo "#define SDL_POWER_DISABLED 1" >>confdefs.h
 
-else
-    SOURCES="$SOURCES $srcdir/src/power/*.c"
 fi
 # Check whether --enable-threads was given.
 if test "${enable_threads+set}" = set; then :
--- a/configure.in	Tue Jun 11 08:37:03 2013 -0700
+++ b/configure.in	Thu Jun 13 22:10:10 2013 -0700
@@ -297,7 +297,10 @@
 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
 SOURCES="$SOURCES $srcdir/src/events/*.c"
 SOURCES="$SOURCES $srcdir/src/file/*.c"
+SOURCES="$SOURCES $srcdir/src/haptic/*.c"
+SOURCES="$SOURCES $srcdir/src/joystick/*.c"
 SOURCES="$SOURCES $srcdir/src/libm/*.c"
+SOURCES="$SOURCES $srcdir/src/power/*.c"
 SOURCES="$SOURCES $srcdir/src/render/*.c"
 SOURCES="$SOURCES $srcdir/src/render/*/*.c"
 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
@@ -342,24 +345,18 @@
               , enable_joystick=yes)
 if test x$enable_joystick != xyes; then
     AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
-else
-    SOURCES="$SOURCES $srcdir/src/joystick/*.c"
 fi
 AC_ARG_ENABLE(haptic,
 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
               , enable_haptic=yes)
 if test x$enable_haptic != xyes; then
     AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
-else
-    SOURCES="$SOURCES $srcdir/src/haptic/*.c"
 fi
 AC_ARG_ENABLE(power,
 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
               , enable_power=yes)
 if test x$enable_power != xyes; then
     AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
-else
-    SOURCES="$SOURCES $srcdir/src/power/*.c"
 fi
 AC_ARG_ENABLE(threads,
 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
--- a/include/SDL_config.h.in	Tue Jun 11 08:37:03 2013 -0700
+++ b/include/SDL_config.h.in	Thu Jun 13 22:10:10 2013 -0700
@@ -158,8 +158,9 @@
 #undef HAVE_SEM_TIMEDWAIT
 
 #else
-/* We may need some replacement for stdarg.h here */
-#include <stdarg.h>
+#define HAVE_STDARG_H   1
+#define HAVE_STDDEF_H   1
+#define HAVE_STDINT_H   1
 #endif /* HAVE_LIBC */
 
 /* SDL internal assertion support */
--- a/include/SDL_config_minimal.h	Tue Jun 11 08:37:03 2013 -0700
+++ b/include/SDL_config_minimal.h	Thu Jun 13 22:10:10 2013 -0700
@@ -30,10 +30,12 @@
  *  This is the minimal configuration that can be used to build SDL.
  */
 
-#include <stddef.h>
-#include <stdarg.h>
+#define HAVE_STDARG_H   1
+#define HAVE_STDDEF_H   1
 
-#if !defined(_STDINT_H_) && !defined(_STDINT_H) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
+/* Here are some reasonable defaults */
 typedef unsigned int size_t;
 typedef signed char int8_t;
 typedef unsigned char uint8_t;
@@ -44,7 +46,9 @@
 typedef signed long long int64_t;
 typedef unsigned long long uint64_t;
 typedef unsigned long uintptr_t;
-#endif /* if (stdint.h isn't available) */
+#else
+#define HAVE_STDINT_H 1
+#endif /* Visual Studio 2008 */
 
 #ifdef __GNUC__
 #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
--- a/include/SDL_stdinc.h	Tue Jun 11 08:37:03 2013 -0700
+++ b/include/SDL_stdinc.h	Thu Jun 13 22:10:10 2013 -0700
@@ -359,7 +359,7 @@
 
 
 extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
-#if defined(__MACOSX__)
+#if defined(__MACOSX__) && defined(HAVE_MEMCPY)
 SDL_FORCE_INLINE void *SDL_memcpy_inline(void *dst, const void *src, size_t len)
 {
     /* We can count on memcpy existing on Mac OS X and being well-tuned. */
--- a/src/SDL_log.c	Tue Jun 11 08:37:03 2013 -0700
+++ b/src/SDL_log.c	Thu Jun 13 22:10:10 2013 -0700
@@ -369,7 +369,9 @@
         SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
         __android_log_write(SDL_android_priority[priority], tag, message);
     }
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
+    /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now.
+    */
     extern void SDL_NSLog(const char *text);
     {
         char *text;
--- a/src/joystick/SDL_joystick.c	Tue Jun 11 08:37:03 2013 -0700
+++ b/src/joystick/SDL_joystick.c	Thu Jun 13 22:10:10 2013 -0700
@@ -611,7 +611,7 @@
 
     /* We ignore events if we don't have keyboard focus, except for button
      * release. */
-    if (event.type == SDL_JOYBUTTONDOWN && SDL_PrivateJoystickShouldIgnoreEvent()) {
+    if (state == SDL_PRESSED && SDL_PrivateJoystickShouldIgnoreEvent()) {
         return 0;
     }
 
--- a/src/thread/generic/SDL_syssem.c	Tue Jun 11 08:37:03 2013 -0700
+++ b/src/thread/generic/SDL_syssem.c	Thu Jun 13 22:10:10 2013 -0700
@@ -32,7 +32,7 @@
 SDL_sem *
 SDL_CreateSemaphore(Uint32 initial_value)
 {
-    SDL_SetError("SDL not configured with thread support");
+    SDL_SetError("SDL not built with thread support");
     return (SDL_sem *) 0;
 }
 
@@ -44,19 +44,19 @@
 int
 SDL_SemTryWait(SDL_sem * sem)
 {
-    return SDL_SetError("SDL not configured with thread support");
+    return SDL_SetError("SDL not built with thread support");
 }
 
 int
 SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
 {
-    return SDL_SetError("SDL not configured with thread support");
+    return SDL_SetError("SDL not built with thread support");
 }
 
 int
 SDL_SemWait(SDL_sem * sem)
 {
-    return SDL_SetError("SDL not configured with thread support");
+    return SDL_SetError("SDL not built with thread support");
 }
 
 Uint32
@@ -68,7 +68,7 @@
 int
 SDL_SemPost(SDL_sem * sem)
 {
-    return SDL_SetError("SDL not configured with thread support");
+    return SDL_SetError("SDL not built with thread support");
 }
 
 #else
--- a/test/testpower.c	Tue Jun 11 08:37:03 2013 -0700
+++ b/test/testpower.c	Thu Jun 13 22:10:10 2013 -0700
@@ -63,7 +63,7 @@
 int
 main(int argc, char *argv[])
 {
-    if (SDL_Init(SDL_INIT_VIDEO) == -1) {
+    if (SDL_Init(0) == -1) {
         fprintf(stderr, "SDL_Init() failed: %s\n", SDL_GetError());
         return 1;
     }