aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorThierry Crozat2016-09-03 23:08:04 +0100
committerGitHub2016-09-03 23:08:04 +0100
commit848c5c3f84ef2526dfc312901b2470a848294f52 (patch)
treef5c39cb70a9c993fbce62d1d0d6e8d1ead71571e /backends/platform/sdl
parenta2a985368cf202bfd8ed16d0defa4c9e4ea2d328 (diff)
parentad8cd2e52d7d55e81b89a1de77b5b838322abf27 (diff)
downloadscummvm-rg350-848c5c3f84ef2526dfc312901b2470a848294f52.tar.gz
scummvm-rg350-848c5c3f84ef2526dfc312901b2470a848294f52.tar.bz2
scummvm-rg350-848c5c3f84ef2526dfc312901b2470a848294f52.zip
Merge pull request #810 from tsoliman/sdl2-macports
SDL: Fix build with MacPorts SDL2
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r--backends/platform/sdl/sdl-sys.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/backends/platform/sdl/sdl-sys.h b/backends/platform/sdl/sdl-sys.h
index 551605a4b4..a00fcb7c6e 100644
--- a/backends/platform/sdl/sdl-sys.h
+++ b/backends/platform/sdl/sdl-sys.h
@@ -67,6 +67,53 @@ typedef struct { int FAKE; } FAKE_FILE;
#define system FAKE_system
#endif
+// Fix compilation with MacPorts SDL 2
+// It needs various (usually forbidden) symbols from time.h
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_asctime)
+#undef asctime
+#define asctime FAKE_asctime
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_clock)
+#undef clock
+#define clock FAKE_clock
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_ctime)
+#undef ctime
+#define ctime FAKE_ctime
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_difftime)
+#undef difftime
+#define difftime FAKE_difftime
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_getdate)
+#undef getdate
+#define getdate FAKE_getdate
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_gmtime)
+#undef gmtime
+#define gmtime FAKE_gmtime
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_localtime)
+#undef localtime
+#define localtime FAKE_localtime
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_mktime)
+#undef mktime
+#define mktime FAKE_mktime
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_time)
+#undef time
+#define time FAKE_time
+#endif
+
// HACK: SDL might include windows.h which defines its own ARRAYSIZE.
// However, we want to use the version from common/util.h. Thus, we make sure
// that we actually have this definition after including the SDL headers.
@@ -176,6 +223,57 @@ typedef struct { int FAKE; } FAKE_FILE;
#define system(a) FORBIDDEN_SYMBOL_REPLACEMENT
#endif
+// re-forbid all those time.h symbols again (if they were forbidden)
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_asctime)
+#undef asctime
+#define asctime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_asctime)
+#undef asctime
+#define asctime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_clock)
+#undef clock
+#define clock() FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_ctime)
+#undef ctime
+#define ctime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_difftime)
+#undef difftime
+#define difftime(a,b) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_getdate)
+#undef getdate
+#define getdate(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_gmtime)
+#undef gmtime
+#define gmtime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_localtime)
+#undef localtime
+#define localtime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_mktime)
+#undef mktime
+#define mktime(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_time)
+#undef time
+#define time(a) FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
// SDL 2 has major API changes. We redefine constants which got renamed to
// ease the transition. This is sometimes dangerous because the values changed
// too!