sdl12-compat: SDL_config: Define HAVE_MALLOC_H on glibc-based platforms

From be0b7f937fdf3b4c05d0e875fa2669977a12a436 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Tue, 27 Jun 2023 18:36:43 +0100
Subject: [PATCH] SDL_config: Define HAVE_MALLOC_H on glibc-based platforms

Version 3.7.4 of the Freespace 2 Source Code Project is known to rely
on SDL having checked for this, and won't see a declaration of
malloc_usable_size() if we don't.

This is a workaround for source compatibility with classic SDL 1.2:
if a game wants to use functions from a particular system header file,
it should be that game's responsibility to check for the header file

Signed-off-by: Simon McVittie <>
 include/SDL/SDL_config.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/SDL/SDL_config.h b/include/SDL/SDL_config.h
index f62c17019..96a960379 100644
--- a/include/SDL/SDL_config.h
+++ b/include/SDL/SDL_config.h
@@ -129,9 +129,13 @@ stage, though. Send patches if your platform lacks something. */
+#if defined(__GLIBC__)
+/* glibc certainly includes this, send patches if your OS does too */
+#define HAVE_MALLOC_H 1
 /* things that aren't necessarily in Linux, some are MSVC C runtime, some are BSD. Send patches. */
 #if 0
-#define HAVE_MALLOC_H 1
 #define HAVE_BCOPY 1
 #define HAVE_ATOI 1
 #define HAVE_ATOF 1