summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-03 17:24:00 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-03 17:41:11 +0200
commited0aec25c50b53e63070c2a4a25480724bdf343a (patch)
tree17a706b4dbbd4780d53a0dabbbd41f62c7fc5d83 /cmake
parentedbfeca6cedb55872f8a92b790e1a989a3cf47e5 (diff)
downloadfastd-ed0aec25c50b53e63070c2a4a25480724bdf343a.tar
fastd-ed0aec25c50b53e63070c2a4a25480724bdf343a.zip
Fix UHASH build on *BSD
Diffstat (limited to 'cmake')
-rw-r--r--cmake/checks.cmake32
1 files changed, 32 insertions, 0 deletions
diff --git a/cmake/checks.cmake b/cmake/checks.cmake
index 64dae58..d42f336 100644
--- a/cmake/checks.cmake
+++ b/cmake/checks.cmake
@@ -57,3 +57,35 @@ endif(NOT DARWIN)
set(CMAKE_EXTRA_INCLUDE_FILES "netinet/if_ether.h")
check_type_size("struct ethhdr" SIZEOF_ETHHDR)
string(COMPARE NOTEQUAL "${SIZEOF_ETHHDR}" "" HAVE_ETHHDR)
+
+
+set(CMAKE_REQUIRED_INCLUDES "sys/types.h")
+
+check_c_source_compiles("
+#include <endian.h>
+
+int main() {
+ return 0;
+}
+" HAVE_ENDIAN_H)
+
+if(HAVE_ENDIAN_H)
+ check_symbol_exists("be32toh" "endian.h" HAVE_LINUX_ENDIAN)
+
+else(HAVE_ENDIAN_H)
+ check_c_source_compiles("
+ #include <sys/types.h>
+ #include <sys/endian.h>
+
+ int main() {
+ return 0;
+ }
+ " HAVE_SYS_ENDIAN_H)
+
+ if(HAVE_SYS_ENDIAN_H)
+ check_symbol_exists("be32toh" "sys/types.h;sys/endian.h" HAVE_LINUX_ENDIAN)
+
+ else(HAVE_SYS_ENDIAN_H)
+ message(FATAL_ERROR "Neither <endian.h> nor <sys/endian.h> found")
+ endif(HAVE_SYS_ENDIAN_H)
+endif(HAVE_ENDIAN_H)