summaryrefslogtreecommitdiff
path: root/expat/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorRolf Eike Beer <eb@emlix.com>2017-08-02 14:09:19 +0200
committerRolf Eike Beer <eike@sf-mail.de>2017-08-05 22:23:59 +0200
commitdc9c4d454a5106437c58fc4ba1addadfe2aef05c (patch)
tree8230129522921c76ec13fa1d7c6bdd0cc1f1cf7b /expat/ConfigureChecks.cmake
parent45a9b99af9683facdaa576690f1e2d2e04999281 (diff)
downloadlibexpat-git-dc9c4d454a5106437c58fc4ba1addadfe2aef05c.tar.gz
CMake: detect the presence of entropy functions
Diffstat (limited to 'expat/ConfigureChecks.cmake')
-rw-r--r--expat/ConfigureChecks.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/expat/ConfigureChecks.cmake b/expat/ConfigureChecks.cmake
index 6e440ca0..7d44ec1a 100644
--- a/expat/ConfigureChecks.cmake
+++ b/expat/ConfigureChecks.cmake
@@ -1,4 +1,5 @@
include(CheckCCompilerFlag)
+include(CheckCSourceCompiles)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckFunctionExists)
@@ -21,6 +22,16 @@ check_function_exists("getpagesize" HAVE_GETPAGESIZE)
check_function_exists("bcopy" HAVE_BCOPY)
check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE)
check_function_exists("mmap" HAVE_MMAP)
+check_function_exists("getrandom" HAVE_GETRANDOM)
+
+if(USE_libbsd)
+ set(CMAKE_REQUIRED_LIBRARIES "bsd")
+endif()
+check_function_exists("arc4random_buf" HAVE_ARC4RANDOM_BUF)
+if(NOT HAVE_ARC4RANDOM_BUF)
+ check_function_exists("arc4random" HAVE_ARC4RANDOM)
+endif()
+set(CMAKE_REQUIRED_LIBRARIES)
#/* Define to 1 if you have the ANSI C header files. */
check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
@@ -41,6 +52,16 @@ else(HAVE_SYS_TYPES_H)
set(SIZE_T "unsigned")
endif(HAVE_SYS_TYPES_H)
+check_c_source_compiles("
+ #include <stdlib.h> /* for NULL */
+ #include <unistd.h> /* for syscall */
+ #include <sys/syscall.h> /* for SYS_getrandom */
+ int main() {
+ syscall(SYS_getrandom, NULL, 0, 0);
+ return 0;
+ }"
+ HAVE_SYSCALL_GETRANDOM)
+
configure_file(expat_config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/expat_config.h")
add_definitions(-DHAVE_EXPAT_CONFIG_H)