commit - 8f7253b29f275cfc3fd6111a54ce1cdd6622d1ee
commit + 315668d47de15aca3c4f52136a3e55cd2adc04dd
blob - 26d79ad516c9ee5727086af7af2c6661fca3a0c8
blob + 0b4bec6afcb8406227560256b9f6cb773814b829
--- compat.h
+++ compat.h
#define INFTIM -1
#endif
+#if HAVE_ENDIAN_H
+# include <endian.h>
+#elif HAVE_SYS_ENDIAN_H
+# include <sys/endian.h>
+#elif HAVE_LIBKERN_OSBYTEORDER_H
+# include <machine/endian.h>
+# include <libkern/OSByteOrder.h>
+
+# define htobe16(x) OSSwapHostToBigInt16(x)
+# define htole16(x) OSSwapHostToLittleInt16(x)
+# define be16toh(x) OSSwapBigToHostInt16(x)
+# define le16toh(x) OSSwapLittleToHostInt16(x)
+
+# define htobe32(x) OSSwapHostToBigInt32(x)
+# define htole32(x) OSSwapHostToLittleInt32(x)
+# define be32toh(x) OSSwapBigToHostInt32(x)
+# define le32toh(x) OSSwapLittleToHostInt32(x)
+
+# define htobe64(x) OSSwapHostToBigInt64(x)
+# define htole64(x) OSSwapHostToLittleInt64(x)
+# define be64toh(x) OSSwapBigToHostInt64(x)
+# define le64toh(x) OSSwapLittleToHostInt64(x)
+#else
+# error no compatible endian.h header found
+#endif
+
#if HAVE_EVENT2
# include <event2/event.h>
# include <event2/event_compat.h>
blob - 50e5021fb6f3a284d445dacc80f7529fa2f751f6
blob + 7af397708be791c1bf048eecfb0b81616cb88804
--- configure.ac
+++ configure.ac
AC_CHECK_HEADERS([sys/tree.h])
+AC_CHECK_HEADER([endian.h], [AC_DEFINE(HAVE_ENDIAN_H, 1, [have endian.h])], [
+ AC_CHECK_HEADER([sys/endian.h],
+ [AC_DEFINE(HAVE_SYS_ENDIAN_H, 1, [have sys/endian.h])], [
+ AC_CHECK_HEADERS([libkern/OSByteOrder.h],
+ [AC_DEFINE(HAVE_LIBKERN_OSBYTEORDER_H, 1, [have OSByteOrder.h])],
+ [AC_MSG_ERROR([can't find compatible endian.h header])],
+ [#include <machine/endian.h>])
+ ])
+])
+
AC_CHECK_DECL(PR_SET_NAME, AC_DEFINE([HAVE_PR_SET_NAME], 1, [pr_set_name]), [],
[[#include <sys/prctl.h>]])
blob - 97a65550f4fc74e4a6f74b7798fdb8248a286fba
blob + 687d6e1debfeca4a820cb2fa964da8a6e8df461f
--- kamid/client.c
+++ kamid/client.c
#include <sys/uio.h>
#include <dirent.h>
-#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
blob - ffd7232afc4db743d7ceb0cb1820e0f45f92ebd5
blob + c39121b7d39cfe1597bec86c8a04f58b6bc444bb
--- kamid/listener.c
+++ kamid/listener.c
#include <sys/types.h>
#include <sys/uio.h>
-#include <endian.h>
#include <errno.h>
#include <inttypes.h>
#include <pwd.h>
blob - 5987ab99df0988208113fe0c81111a7fdb3e158c
blob + e9334f3b50fee42da027133e648408c3e0058b7f
--- kamirepl/kamirepl.c
+++ kamirepl/kamirepl.c
#include <netdb.h>
#include <assert.h>
-#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
blob - 8da3a5aeb11a7e6157b9db09f97d12241104beaa
blob + 4c4ec15d53cf8632461d7368537eaf348c421ed9
--- lib/9pclib.c
+++ lib/9pclib.c
#include "compat.h"
-#include <endian.h>
#include <inttypes.h>
#include <string.h>
blob - a3d72730dafabee34099bc34acf0b9f8c7a82c8d
blob + 569e637aacc65c32daf94209033a67046923aa25
--- ninepscript/script.c
+++ ninepscript/script.c
#include <sys/wait.h>
#include <assert.h>
-#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>