summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-19 21:20:54 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-23 21:47:29 -0400
commit4984c8be739dffe4cf9ff3ab905eb3b2ee3ca826 (patch)
treef012b178ad06ed140d47674e2f8c25e77e9fcae8
parent38f1ae0f99b84589c1418e30559cd1c2beba20ec (diff)
meson: detect getrandom in sys/random.h, fall back to linux/random.h
This is analogous to commit e84397d95c3da2b9722ff265843ad4a8874643d8.
-rw-r--r--meson.build9
1 files changed, 8 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 52ef13dee7..df08545159 100644
--- a/meson.build
+++ b/meson.build
@@ -381,7 +381,6 @@ foreach ident : [
#include <fcntl.h>'''],
['setns', '''#define _GNU_SOURCE
#include <sched.h>'''],
- ['getrandom', '''#include <sys/random.h>'''],
['renameat2', '''#include <stdio.h>'''],
['kcmp', '''#include <linux/kcmp.h>'''],
['keyctl', '''#include <sys/types.h>
@@ -395,6 +394,14 @@ foreach ident : [
conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
endforeach
+if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
+ conf.set('USE_SYS_RANDOM_H', 1)
+ conf.set10('HAVE_DECL_GETRANDOM', 1)
+else
+ have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
+ conf.set10('HAVE_DECL_GETRANDOM', have)
+endif
+
#####################################################################
sed = find_program('sed')