Some OSes have sys/endian.h instead of glibc's endian.h.
---
configure.ac | 1 +
daemon/journal.c | 5 +++++
src/inspect-apps.c | 3 +++
src/inspect-fs-windows.c | 3 +++
src/journal.c | 3 +++
5 files changed, 15 insertions(+)
diff --git a/configure.ac b/configure.ac
index 6c33444..8cd29d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -288,6 +288,7 @@ AC_CHECK_HEADERS([\
attr/xattr.h \
byteswap.h \
endian.h \
+ sys/endian.h \
errno.h \
linux/fs.h \
linux/raid/md_u.h \
diff --git a/daemon/journal.c b/daemon/journal.c
index 3fd2135..a2a1c73 100644
--- a/daemon/journal.c
+++ b/daemon/journal.c
@@ -22,7 +22,12 @@
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
+#ifdef HAVE_ENDIAN_H
#include <endian.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
#include "guestfs_protocol.h"
#include "daemon.h"
diff --git a/src/inspect-apps.c b/src/inspect-apps.c
index a77e9ce..b62b432 100644
--- a/src/inspect-apps.c
+++ b/src/inspect-apps.c
@@ -31,6 +31,9 @@
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
/* be32toh is usually a macro definend in <endian.h>, but it might be
* a function in some system so check both, and if neither is defined
diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c
index 20e4d7f..6d430d1 100644
--- a/src/inspect-fs-windows.c
+++ b/src/inspect-fs-windows.c
@@ -32,6 +32,9 @@
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
#include <pcre.h>
diff --git a/src/journal.c b/src/journal.c
index 61ab352..1070067 100644
--- a/src/journal.c
+++ b/src/journal.c
@@ -31,6 +31,9 @@
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
#include "full-read.h"
--
1.9.3