build: Use <endian.h> when <sys/endian.h> is not available
diff --git a/configure.ac b/configure.ac
index 330e8cb..16dcc53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ AC_PROG_CC
# Checks for libraries.
# Checks for header files.
-AC_CHECK_HEADERS([sys/param.h])
+AC_CHECK_HEADERS([sys/param.h sys/endian.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
diff --git a/src/rmd160.c b/src/rmd160.c
index a2e8deb..9bfc348 100644
--- a/src/rmd160.c
+++ b/src/rmd160.c
@@ -28,7 +28,11 @@
*/
#include <string.h>
#include <sys/types.h>
+#ifdef HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
+#else
+#include <endian.h>
+#endif
#include <rmd160.h>
#define PUT_64BIT_LE(cp, value) do { \