$NetBSD: patch-ad,v 1.3 2009/01/04 23:10:06 dbj Exp $

--- util.h.orig	2007-12-26 16:51:05.000000000 -0800
+++ util.h	2008-12-28 17:47:48.000000000 -0800
@@ -19,7 +19,7 @@
 #  include <config.h>
 #endif
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
 #include <sys/endian.h>
 
 #define __BYTE_ORDER            _BYTE_ORDER
@@ -29,6 +29,17 @@
 #define bswap_16                bswap16
 #define bswap_32                bswap32
 #define bswap_64                bswap64
+#elif defined(__APPLE__)
+#include <machine/endian.h>
+#include <libkern/OSByteOrder.h>
+
+#define __BYTE_ORDER            BYTE_ORDER
+#define __LITTLE_ENDIAN         LITTLE_ENDIAN
+#define __BIG_ENDIAN            BIG_ENDIAN
+
+#define bswap_16                OSSwapInt16
+#define bswap_32                OSSwapInt32
+#define bswap_64                OSSwapInt64
 #else
 #include <endian.h>
 #include <byteswap.h>
