meson: detect getrandom in sys/random.h, fall back to linux/random.h

This is analogous to commit e84397d95c3da2b9722ff265843ad4a8874643d8.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-04-19 21:20:54 -04:00
parent 38f1ae0f99
commit 4984c8be73
1 changed files with 8 additions and 1 deletions

View File

@ -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')