From ed0aec25c50b53e63070c2a4a25480724bdf343a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 3 Sep 2014 17:24:00 +0200 Subject: Fix UHASH build on *BSD --- cmake/checks.cmake | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'cmake') 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 + +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 + #include + + 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 nor found") + endif(HAVE_SYS_ENDIAN_H) +endif(HAVE_ENDIAN_H) -- cgit v1.2.3