summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-05-31 20:12:04 +0200
committerBruno Haible <bruno@clisp.org>2020-05-31 20:18:25 +0200
commit90b3a5b610c51939aace88f3fd9ebf0d9cc74af3 (patch)
treec98984df87c1f3749a64ba3e1bf85af75525fa39 /m4
parent67306f600fe6a3bcf3fbb6d8bf4b8953b74a8fb7 (diff)
downloadgnulib-90b3a5b610c51939aace88f3fd9ebf0d9cc74af3.tar.gz
getentropy: Work around a macOS and Solaris problem.
* lib/unistd.in.h: Include <sys/random.h>, when needed for the 'getentropy' module. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize UNISTD_H_HAVE_SYS_RANDOM_H. * m4/sys_random_h.m4 (gl_HEADER_SYS_RANDOM): Set UNISTD_H_HAVE_SYS_RANDOM_H. * modules/unistd (Makefile.am): Substitute UNISTD_H_HAVE_SYS_RANDOM_H. * doc/glibc-functions/getentropy.texi: Document the macOS and Solaris problem. List more platforms.
Diffstat (limited to 'm4')
-rw-r--r--m4/sys_random_h.m47
-rw-r--r--m4/unistd_h.m43
2 files changed, 8 insertions, 2 deletions
diff --git a/m4/sys_random_h.m4 b/m4/sys_random_h.m4
index c4505b60d2..a964b15784 100644
--- a/m4/sys_random_h.m4
+++ b/m4/sys_random_h.m4
@@ -1,4 +1,4 @@
-# sys_random_h.m4 serial 3
+# sys_random_h.m4 serial 4
dnl Copyright (C) 2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -16,6 +16,11 @@ AC_DEFUN([gl_HEADER_SYS_RANDOM],
fi
AC_SUBST([HAVE_SYS_RANDOM_H])
+ m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
+ if test $ac_cv_header_sys_random_h = yes; then
+ UNISTD_H_HAVE_SYS_RANDOM_H=1
+ fi
+
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index a3b4633f68..dfa38f85d6 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 79
+# unistd_h.m4 serial 80
dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -200,6 +200,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT])
REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP])
REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
+ UNISTD_H_HAVE_SYS_RANDOM_H=0; AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H])
UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])