summaryrefslogtreecommitdiffstats
path: root/aclocal/getrandom.m4
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--aclocal/getrandom.m416
1 files changed, 16 insertions, 0 deletions
diff --git a/aclocal/getrandom.m4 b/aclocal/getrandom.m4
new file mode 100644
index 0000000..bc0fe16
--- /dev/null
+++ b/aclocal/getrandom.m4
@@ -0,0 +1,16 @@
+dnl Checks for getrandom support (glibc 2.25+, musl 1.1.20+)
+dnl
+AC_DEFUN([AC_GETRANDOM], [
+ AC_MSG_CHECKING(for getrandom())
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #include <stdlib.h> /* for NULL */
+ #include <sys/random.h>
+ ]],
+ [[ return getrandom(NULL, 0U, 0U); ]] )],
+ [AC_DEFINE([HAVE_GETRANDOM], [1], [Define to 1 if you have the `getrandom' function.])
+ AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])])
+
+ AC_SUBST(HAVE_GETRANDOM)
+])