Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed SDL building with the minimal configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jun 14, 2013
1 parent a8f0158 commit 1f43cfd
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 27 deletions.
9 changes: 3 additions & 6 deletions configure
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16936,7 +16936,10 @@ SOURCES="$SOURCES $srcdir/src/audio/*.c"
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c" SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
SOURCES="$SOURCES $srcdir/src/events/*.c" SOURCES="$SOURCES $srcdir/src/events/*.c"
SOURCES="$SOURCES $srcdir/src/file/*.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/libm/*.c"
SOURCES="$SOURCES $srcdir/src/power/*.c"
SOURCES="$SOURCES $srcdir/src/render/*.c" SOURCES="$SOURCES $srcdir/src/render/*.c"
SOURCES="$SOURCES $srcdir/src/render/*/*.c" SOURCES="$SOURCES $srcdir/src/render/*/*.c"
SOURCES="$SOURCES $srcdir/src/stdlib/*.c" SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
Expand Down Expand Up @@ -17016,8 +17019,6 @@ if test x$enable_joystick != xyes; then


$as_echo "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_DISABLED 1" >>confdefs.h


else
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
fi fi
# Check whether --enable-haptic was given. # Check whether --enable-haptic was given.
if test "${enable_haptic+set}" = set; then : if test "${enable_haptic+set}" = set; then :
Expand All @@ -17030,8 +17031,6 @@ if test x$enable_haptic != xyes; then


$as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h $as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h


else
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
fi fi
# Check whether --enable-power was given. # Check whether --enable-power was given.
if test "${enable_power+set}" = set; then : if test "${enable_power+set}" = set; then :
Expand All @@ -17044,8 +17043,6 @@ if test x$enable_power != xyes; then


$as_echo "#define SDL_POWER_DISABLED 1" >>confdefs.h $as_echo "#define SDL_POWER_DISABLED 1" >>confdefs.h


else
SOURCES="$SOURCES $srcdir/src/power/*.c"
fi fi
# Check whether --enable-threads was given. # Check whether --enable-threads was given.
if test "${enable_threads+set}" = set; then : if test "${enable_threads+set}" = set; then :
Expand Down
9 changes: 3 additions & 6 deletions configure.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ SOURCES="$SOURCES $srcdir/src/audio/*.c"
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c" SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
SOURCES="$SOURCES $srcdir/src/events/*.c" SOURCES="$SOURCES $srcdir/src/events/*.c"
SOURCES="$SOURCES $srcdir/src/file/*.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/libm/*.c"
SOURCES="$SOURCES $srcdir/src/power/*.c"
SOURCES="$SOURCES $srcdir/src/render/*.c" SOURCES="$SOURCES $srcdir/src/render/*.c"
SOURCES="$SOURCES $srcdir/src/render/*/*.c" SOURCES="$SOURCES $srcdir/src/render/*/*.c"
SOURCES="$SOURCES $srcdir/src/stdlib/*.c" SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
Expand Down Expand Up @@ -342,24 +345,18 @@ AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes
, enable_joystick=yes) , enable_joystick=yes)
if test x$enable_joystick != xyes; then if test x$enable_joystick != xyes; then
AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ]) AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
else
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
fi fi
AC_ARG_ENABLE(haptic, AC_ARG_ENABLE(haptic,
AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]), AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
, enable_haptic=yes) , enable_haptic=yes)
if test x$enable_haptic != xyes; then if test x$enable_haptic != xyes; then
AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ]) AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
else
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
fi fi
AC_ARG_ENABLE(power, AC_ARG_ENABLE(power,
AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]), AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
, enable_power=yes) , enable_power=yes)
if test x$enable_power != xyes; then if test x$enable_power != xyes; then
AC_DEFINE(SDL_POWER_DISABLED, 1, [ ]) AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
else
SOURCES="$SOURCES $srcdir/src/power/*.c"
fi fi
AC_ARG_ENABLE(threads, AC_ARG_ENABLE(threads,
AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]), AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
Expand Down
5 changes: 3 additions & 2 deletions include/SDL_config.h.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@
#undef HAVE_SEM_TIMEDWAIT #undef HAVE_SEM_TIMEDWAIT


#else #else
/* We may need some replacement for stdarg.h here */ #define HAVE_STDARG_H 1
#include <stdarg.h> #define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#endif /* HAVE_LIBC */ #endif /* HAVE_LIBC */


/* SDL internal assertion support */ /* SDL internal assertion support */
Expand Down
12 changes: 8 additions & 4 deletions include/SDL_config_minimal.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
* This is the minimal configuration that can be used to build SDL. * This is the minimal configuration that can be used to build SDL.
*/ */


#include <stddef.h> #define HAVE_STDARG_H 1
#include <stdarg.h> #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 unsigned int size_t;
typedef signed char int8_t; typedef signed char int8_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
Expand All @@ -44,7 +46,9 @@ typedef unsigned int uint32_t;
typedef signed long long int64_t; typedef signed long long int64_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
typedef unsigned long uintptr_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__ #ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 #define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_stdinc.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, int val, size_t len)




extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); 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) 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. */ /* We can count on memcpy existing on Mac OS X and being well-tuned. */
Expand Down
4 changes: 3 additions & 1 deletion src/SDL_log.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category)); SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
__android_log_write(SDL_android_priority[priority], tag, message); __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); extern void SDL_NSLog(const char *text);
{ {
char *text; char *text;
Expand Down
2 changes: 1 addition & 1 deletion src/joystick/SDL_joystick.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state)


/* We ignore events if we don't have keyboard focus, except for button /* We ignore events if we don't have keyboard focus, except for button
* release. */ * release. */
if (event.type == SDL_JOYBUTTONDOWN && SDL_PrivateJoystickShouldIgnoreEvent()) { if (state == SDL_PRESSED && SDL_PrivateJoystickShouldIgnoreEvent()) {
return 0; return 0;
} }


Expand Down
10 changes: 5 additions & 5 deletions src/thread/generic/SDL_syssem.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
SDL_sem * SDL_sem *
SDL_CreateSemaphore(Uint32 initial_value) 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; return (SDL_sem *) 0;
} }


Expand All @@ -44,19 +44,19 @@ SDL_DestroySemaphore(SDL_sem * sem)
int int
SDL_SemTryWait(SDL_sem * sem) SDL_SemTryWait(SDL_sem * sem)
{ {
return SDL_SetError("SDL not configured with thread support"); return SDL_SetError("SDL not built with thread support");
} }


int int
SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) 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 int
SDL_SemWait(SDL_sem * sem) SDL_SemWait(SDL_sem * sem)
{ {
return SDL_SetError("SDL not configured with thread support"); return SDL_SetError("SDL not built with thread support");
} }


Uint32 Uint32
Expand All @@ -68,7 +68,7 @@ SDL_SemValue(SDL_sem * sem)
int int
SDL_SemPost(SDL_sem * sem) SDL_SemPost(SDL_sem * sem)
{ {
return SDL_SetError("SDL not configured with thread support"); return SDL_SetError("SDL not built with thread support");
} }


#else #else
Expand Down
2 changes: 1 addition & 1 deletion test/testpower.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ report_power(void)
int int
main(int argc, char *argv[]) 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()); fprintf(stderr, "SDL_Init() failed: %s\n", SDL_GetError());
return 1; return 1;
} }
Expand Down

0 comments on commit 1f43cfd

Please sign in to comment.