astlpc: Conditionally include endian.h

endian.h isn't standardised and isn't provided by some target
environments. Conditionally include it to avoid compilation errors,
however the target environment must provide its own implementation,
possibly via config.h.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ic60079204cffe7730f552f2c3c34e88bfce4f515
diff --git a/astlpc.c b/astlpc.c
index 65305ea..f8cf42e 100644
--- a/astlpc.c
+++ b/astlpc.c
@@ -1,7 +1,14 @@
 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
 
-#include <assert.h>
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if HAVE_ENDIAN_H
 #include <endian.h>
+#endif
+
+#include <assert.h>
 #include <err.h>
 #include <inttypes.h>
 #include <stdbool.h>
@@ -10,10 +17,6 @@
 
 #define pr_fmt(x) "astlpc: " x
 
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include "libmctp.h"
 #include "libmctp-alloc.h"
 #include "libmctp-log.h"