aboutsummaryrefslogtreecommitdiff
path: root/config/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'config/CMakeLists.txt')
-rw-r--r--config/CMakeLists.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index e9a872d9be..9334691e2a 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -2,6 +2,7 @@ include(CheckTypeSize)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckIncludeFiles)
+include(CheckCSourceRuns)
check_type_size("int" SIZEOF_INT)
check_type_size("long" SIZEOF_LONG)
@@ -71,6 +72,35 @@ if(HAVE_LANGINFO_H)
check_symbol_exists(CODESET "langinfo.h" HAVE_NL_LANGINFO_CODESET)
endif()
+set(SI "#include <stdint.h>\n")
+set(MS "int main(int argc,char**argv)\n{\n uint64_t i=0x0102030405060708ULL;")
+set(ME "}")
+check_c_source_runs("
+ ${SI}
+ ${MS}
+ char *s = (char *) &i;
+ return (
+ s[0] == 0x01
+ && s[1] == 0x02
+ && s[2] == 0x03
+ && s[3] == 0x04
+ && s[4] == 0x05
+ && s[5] == 0x06
+ && s[6] == 0x07
+ && s[7] == 0x08) ? 0 : 1;
+ ${ME}"
+ ORDER_BIG_ENDIAN)
+check_c_source_runs("
+ #define _BSD_SOURCE 1
+ #define _DEFAULT_SOURCE 1
+ ${SI}
+ #include <endian.h>
+ ${MS}
+ uint64_t j = be64toh(i);
+ return (j == 0); // Must not be zero
+ ${ME}"
+ HAVE_BE64TOH)
+
# generate configuration header and update include directories
configure_file (
"${PROJECT_SOURCE_DIR}/config/config.h.in"