$NetBSD: patch-ae,v 1.5 2014/06/09 12:21:07 ryoon Exp $

--- include/local.h.orig	2013-07-08 12:31:36.000000000 +0000
+++ include/local.h
@@ -28,11 +28,26 @@
 #include <string.h>
 #include <fcntl.h>
 #include <assert.h>
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+#include <sys/endian.h>
+#elif defined(__sun)
+#include <sys/byteorder.h>
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+#ifdef _BIG_ENDIAN
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+#else
 #include <endian.h>
+#endif
 #include <stdarg.h>
 #include <sys/poll.h>
 #include <errno.h>
+#if defined(__linux__)
 #include <linux/ioctl.h>
+#endif
 
 #include "config.h"
 #ifdef SUPPORT_RESMGR
@@ -228,7 +245,9 @@ extern snd_lib_error_handler_t snd_err_m
 
 /*
  */
+#ifndef __sun
 #define HAVE_GNU_LD
+#endif
 #define HAVE_ELF
 #define HAVE_ASM_PREVIOUS_DIRECTIVE
 
