shithub: ft²

Download patch

ref: dc26455fbb6c025c141975da54d4cc66cc2b6541
parent: e9ac0d503d678604c822dd75aa8805fb40aef874
parent: c81dba8b06342e1f81640c5f14c583f5df2d3028
author: Olav Sørensen <olav.sorensen@live.no>
date: Wed Sep 17 16:07:28 EDT 2025

Merge branch 'master' of https://github.com/8bitbubsy/ft2-clone

--- a/src/ft2_unicode.c
+++ b/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>
--