QRandomGenerator: find getentropy() on macOS

It's in <sys/random.h>. The header exists on Linux and on FreeBSD and
declares getrandom(), which we don't use, so it's harmless.

Pick-to: 6.3
Change-Id: Ibf4acec0f166495998f7fffd16d69005ab59df3b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Thiago Macieira 2022-02-23 16:04:27 -08:00
parent d581778251
commit 96a025c28b
2 changed files with 6 additions and 1 deletions

View File

@ -243,6 +243,9 @@ qt_config_compile_test(getentropy
LABEL "getentropy()"
CODE
"#include <unistd.h>
#if __has_include(<sys/random.h>)
# include <sys/random.h>
#endif
int main(void)
{

View File

@ -53,7 +53,9 @@
# include <sys/auxv.h>
#endif
#if !QT_CONFIG(getentropy) && (!defined(Q_OS_BSD4) || defined(__GLIBC__)) && !defined(Q_OS_WIN)
#if QT_CONFIG(getentropy) && __has_include(<sys/random.h>)
# include <sys/random.h>
#elif !QT_CONFIG(getentropy) && (!defined(Q_OS_BSD4) || defined(__GLIBC__)) && !defined(Q_OS_WIN)
# include "qdeadlinetimer.h"
# include "qhashfunctions.h"
#endif // !QT_CONFIG(getentropy)