[master] 4eb20126a On OS/X we get endianess from <sys/types.h>

Poul-Henning Kamp phk at FreeBSD.org
Mon May 20 06:21:06 UTC 2024


commit 4eb20126a5824cc479abb51ebf60ae4199674c4e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon May 20 06:20:25 2024 +0000

    On OS/X we get endianess from <sys/types.h>

diff --git a/configure.ac b/configure.ac
index dee2d9fbd..21845879d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,7 +213,6 @@ CFLAGS="${save_CFLAGS}"
 # Checks for header files.
 AC_CHECK_HEADERS([sys/filio.h])
 AC_CHECK_HEADERS([sys/personality.h])
-AC_CHECK_HEADERS([endian.h])
 AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
 AC_CHECK_HEADERS([priv.h])
 AC_CHECK_HEADERS([fnmatch.h], [], [AC_MSG_ERROR([fnmatch.h is required])])
diff --git a/lib/libvarnish/vsha256.c b/lib/libvarnish/vsha256.c
index e4405f718..8d92abc8c 100644
--- a/lib/libvarnish/vsha256.c
+++ b/lib/libvarnish/vsha256.c
@@ -31,9 +31,16 @@
 
 #include "config.h"
 
-#include <endian.h>
-#define VBYTE_ORDER	__BYTE_ORDER
-#define VBIG_ENDIAN	__BIG_ENDIAN
+#include <sys/types.h>
+
+#ifndef __DARWIN_BYTE_ORDER
+#  include <endian.h>
+#  define VBYTE_ORDER	__BYTE_ORDER
+#  define VBIG_ENDIAN	__BIG_ENDIAN
+#else
+#  define VBYTE_ORDER	__DARWIN_BYTE_ORDER
+#  define VBIG_ENDIAN	__DARWIN_BIG_ENDIAN
+#endif
 
 #include <stdint.h>
 #include <string.h>


More information about the varnish-commit mailing list