From 66af2efb2e659ac6d9afe6550681b082a1ab1e28 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sat, 13 Aug 2022 22:58:06 +0200
Subject: [PATCH] Fix Hurd build

It is using glibc like Linux.
---
 contrib/endian-shim.h | 2 +-
 meson.build           | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/endian-shim.h b/contrib/endian-shim.h
index 80c1becd..372bf190 100755
--- a/contrib/endian-shim.h
+++ b/contrib/endian-shim.h
@@ -45,7 +45,7 @@
 #define be64toh(x) OSSwapBigToHostInt64(x)
 #define le64toh(x) OSSwapLittleToHostInt64(x)
 
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__GNU__)
 # include <endian.h>
 # if !defined(htobe64)
 #  if __BYTE_ORDER == __LITTLE_ENDIAN
diff --git a/meson.build b/meson.build
index 0ed82015..1fc7e555 100755
--- a/meson.build
+++ b/meson.build
@@ -96,6 +96,9 @@ else
 	elif host_machine.system() == 'darwin'
 		test_args += '-D_DARWIN_C_SOURCE'
 		add_project_arguments('-D_DARWIN_C_SOURCE', language: 'c')
+	elif host_machine.system() == 'gnu'
+		test_args += '-D_GNU_SOURCE'
+		add_project_arguments('-D_GNU_SOURCE', language: 'c')
 	endif
 	librist_soversion = librist_soversion
 	have_clock_gettime = cc.has_function('clock_gettime', prefix : '#include <time.h>', args : test_args)
-- 
GitLab