Hello,

Attached patch fixes build on OS X 10.4.
Defining _POSIX_C_SOURCE has the undesired effect there, causing issues with missing type definitions to completely unrelated components (including more headers is not the correct solution).

Sevan
From d5b35116fb7b58dab97d12f4d32ff9d45b1fb508 Mon Sep 17 00:00:00 2001
From: Sevan Janiyan <ventur...@geeklan.co.uk>
Date: Tue, 7 Nov 2023 20:19:56 +0000
Subject: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

200809L support was added in macOS Lion 10.7.
sprintf and vsprintf were deprecated in macOS Sierra 10.12.
On OS X Tiger 10.4, defining _POSIX_C_SOURCE has the undesired effect, resulting
in build failure. Use AvailabilityMacros.h & guard off the definition to when
building on macOS 10.12 or newer.
---
 lib/stdio.in.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 118874d877..0165fbb15c 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -38,8 +38,11 @@
 
 /* Suppress macOS deprecation warnings for sprintf and vsprintf.  */
 #if (defined __APPLE__ && defined __MACH__) && !defined _POSIX_C_SOURCE
+# include <AvailabilityMacros.h>
+# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED 
>= 101200
 # define _POSIX_C_SOURCE 200809L
 # define _GL_DEFINED__POSIX_C_SOURCE
+# endif
 #endif
 
 #define _GL_ALREADY_INCLUDING_STDIO_H
-- 
2.41.0

Reply via email to