diff options
| -rw-r--r-- | configure.ac | 8 | ||||
| -rw-r--r-- | src/basic/random-util.c | 8 | 
2 files changed, 14 insertions, 2 deletions
| diff --git a/configure.ac b/configure.ac index 3436a9d8a6..13e758331e 100644 --- a/configure.ac +++ b/configure.ac @@ -328,7 +328,6 @@ AC_CHECK_DECLS([          pivot_root,          name_to_handle_at,          setns, -        getrandom,          renameat2,          kcmp,          keyctl, @@ -343,6 +342,13 @@ AC_CHECK_DECLS([  #include <sched.h>  #include <string.h>  #include <linux/loop.h> +]]) + +AC_CHECK_DECLS([getrandom], +               [AC_DEFINE([USE_SYS_RANDOM_H], [], [sys/random.h is usable])], +               [AC_CHECK_DECLS([getrandom], [], [], [[ +#include <sys/random.h> +]])], [[  #include <linux/random.h>  ]]) diff --git a/src/basic/random-util.c b/src/basic/random-util.c index ad7b3eedf2..b216be579d 100644 --- a/src/basic/random-util.c +++ b/src/basic/random-util.c @@ -27,7 +27,13 @@  #include <stdint.h>  #ifdef HAVE_SYS_AUXV_H -#include <sys/auxv.h> +#  include <sys/auxv.h> +#endif + +#ifdef USE_SYS_RANDOM_H +#  include <sys/random.h> +#else +#  include <linux/random.h>  #endif  #include "fd-util.h" | 
