summaryrefslogtreecommitdiff
path: root/audio/ft2-clone/files/patch-src_ft2__unicode.c
blob: 94d1f1823e84d8f16b2c59954bb17af22b6ab415 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- src/ft2_unicode.c.orig	2025-09-09 06:08:58 UTC
+++ src/ft2_unicode.c
@@ -4,20 +4,21 @@
 #endif
 
 // for detecting if musl or glibc is used
-#if !defined _WIN32 && !defined __APPLE__
-	#ifndef _GNU_SOURCE
-		#define _GNU_SOURCE
-	  #include <features.h>
-	  #ifndef __USE_GNU
-	      #define __MUSL__
-	  #endif
-	  #undef _GNU_SOURCE /* don't contaminate other includes unnecessarily */
-	#else
-	  #include <features.h>
-	  #ifndef __USE_GNU
-	      #define __MUSL__
-	  #endif
-	#endif
+#if defined(__linux__)
+  /* Only Linux has glibc's <features.h>. On BSDs (including FreeBSD) and others,
+     skip this block to avoid a missing-header error. */
+  #ifdef __has_include
+    #if __has_include(<features.h>)
+      #include <features.h>
+    #endif
+  #else
+    /* If the compiler doesn't support __has_include, assume features.h exists on glibc. */
+    #include <features.h>
+  #endif
+  /* If <features.h> didn't define glibc's GNU extensions, assume musl. */
+  #ifndef __USE_GNU
+    #define __MUSL__
+  #endif
 #endif
 
 #include <stdlib.h>