summaryrefslogtreecommitdiffstats
path: root/aclocal/getrandom.m4
blob: bc0fe16a5c65d84253c9a13734ee1a3ad0fbac24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)
])