summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiclas Zeising <zeising@daemonic.se>2013-08-10 16:11:40 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-08-12 09:03:36 +0200
commit37f1e431279998966caabebae3daf7e44d901768 (patch)
tree7cf43805a301f0c187413344ebd3577023ee6745
parent73ea12734b8ecf520938620eedba1e87416a7132 (diff)
Fix build on FreeBSD (and possibly other BSDs)
FreeBSD have the le32toh macro in <sys/endian.h>, and this file is not indirectly included by any other header in util-cursor. Add a configure check that checks for <endian.h> (Linux) and <sys/endian.h> (FreeBSD), and include the right file based on this check. Signed-off-by: Niclas Zeising <zeising@daemonic.se>
-rw-r--r--configure.ac2
-rw-r--r--cursor/parse_cursor_file.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 55317fc..61ff046 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,8 @@ XCB_UTIL_COMMON([1.4], [1.6])
AM_MISSING_PROG([GPERF], [gperf])
+AC_CHECK_HEADERS([endian.h sys/endian.h], [break])
+
PKG_CHECK_MODULES(XCB_RENDER, xcb-render)
PKG_CHECK_MODULES(XCB_RENDERUTIL, xcb-renderutil)
PKG_CHECK_MODULES(XCB_IMAGE, xcb-image)
diff --git a/cursor/parse_cursor_file.c b/cursor/parse_cursor_file.c
index e8a47bc..8c52cfe 100644
--- a/cursor/parse_cursor_file.c
+++ b/cursor/parse_cursor_file.c
@@ -36,6 +36,13 @@
#include <fcntl.h>
#include <unistd.h>
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
+
#include <xcb/xcb.h>
#include "cursor.h"