sdl2-compat: SDL_config_unix.h: Assume a few widely-implemented non-standard functions

From 60872a87b640273b415263016449b28ae4b72a0c Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Wed, 5 Feb 2025 14:15:29 +0000
Subject: [PATCH] SDL_config_unix.h: Assume a few widely-implemented
 non-standard functions

bcopy(), index() and rindex() are no longer specified by POSIX, but they
were in older POSIX standards, so any platform with a stable ABI cannot
actually remove them.

alloca() is widely-implemented, and we already assumed that `<alloca.h>`
exists.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 include/SDL2/SDL_config_unix.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/SDL2/SDL_config_unix.h b/include/SDL2/SDL_config_unix.h
index 2a5d2c7..b47fbe8 100644
--- a/include/SDL2/SDL_config_unix.h
+++ b/include/SDL2/SDL_config_unix.h
@@ -164,11 +164,19 @@
 /* Specified by POSIX */
 #define HAVE_O_CLOEXEC 1
 
-/* Non-standardized, but we assume they exist anyway */
+/* Non-standardized headers, but we assume they exist anyway
+ * (please report a bug if your Unix platform doesn't have these) */
 #define HAVE_ALLOCA_H 1
 #define HAVE_MALLOC_H 1
 #define HAVE_MEMORY_H 1
 
+/* Non-standardized functions, but we assume they exist anyway
+ * (please report a bug if your Unix platform doesn't have these) */
+#define HAVE_ALLOCA 1
+#define HAVE_BCOPY 1    /* required by POSIX until 2008 */
+#define HAVE_INDEX 1    /* required by POSIX until 2008 */
+#define HAVE_RINDEX 1   /* required by POSIX until 2008 */
+
 #define SDL_VIDEO_DRIVER_X11 1
 
 #if defined(__LINUX__)