summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
-rw-r--r--common/passwd.c6
2 files changed, 15 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08110c3..fa9348b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,6 +105,16 @@ ENDIF(PLUGIN)
# Check for some standard glibc functions which we need
#
+# Check that we have enidan.h
+CHECK_INCLUDE_FILE(endian.h HAVE_ENDIAN_H)
+IF(NOT HAVE_ENDIAN_H)
+ CHECK_INCLUDE_FILE(sys/endian.h HAVE_SYS_ENDIAN_H)
+ ADD_DEFINITIONS(-DHAVE_SYS_ENDIAN_H)
+ENDIF(NOT HAVE_ENDIAN_H)
+IF(NOT HAVE_ENDIAN_H AND NOT HAVE_SYS_ENDIAN_H)
+ message(FATAL_ERROR "Missing endian.h")
+ENDIF(NOT HAVE_ENDIAN_H AND NOT HAVE_SYS_ENDIAN_H)
+
# Check that we have dynamic loader available
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
diff --git a/common/passwd.c b/common/passwd.c
index 217fa0c..91af77e 100644
--- a/common/passwd.c
+++ b/common/passwd.c
@@ -45,7 +45,11 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
-#include <endian.h>
+#ifdef HAVE_SYS_ENDIAN_H
+# include <sys/endian.h>
+#else
+# include <endian.h>
+#endif /* HAVE_SYS_ENDIAN_H */
#include <errno.h>
#include <limits.h>
#include <stdbool.h>