diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2010-12-31 18:13:03 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2010-12-31 18:13:03 +0100 |
commit | 35502a5b07eff6a0893989a1ea7edb603087a7c6 (patch) | |
tree | 6f01531225a755be2349a0c168b1092b3cb8d2c3 | |
parent | 930bb01fffd23a04d744fab62e94ce8a4bd9e04c (diff) | |
download | eurephia-35502a5b07eff6a0893989a1ea7edb603087a7c6.tar.gz eurephia-35502a5b07eff6a0893989a1ea7edb603087a7c6.tar.xz eurephia-35502a5b07eff6a0893989a1ea7edb603087a7c6.zip |
Look for endian.h in include/sys as well.
On FreeBSD the endian.h file is located in sys/endian.h.
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
-rw-r--r-- | CMakeLists.txt | 10 | ||||
-rw-r--r-- | common/passwd.c | 6 |
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> |