diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-19 21:21:49 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-19 21:21:49 (GMT) |
commit | 9eb57c5fa50ed2f57d9320bb575371868316b5f2 (patch) | |
tree | 8b3efac8aade853f1d94105eced8313e4bb11e23 /configure.ac | |
parent | 79d68f929d8def878766965f513b628023f809b5 (diff) | |
download | cpython-9eb57c5fa50ed2f57d9320bb575371868316b5f2.zip cpython-9eb57c5fa50ed2f57d9320bb575371868316b5f2.tar.gz cpython-9eb57c5fa50ed2f57d9320bb575371868316b5f2.tar.bz2 |
Issue #22181: The availability of the getrandom() is now checked in configure,
and stored in pyconfig.h as the new HAVE_GETRANDOM_SYSCALL define.
Fix os.urandom() tests using file descriptors if os.urandom() uses getrandom().
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index c9bb90b..a6eaadc 100644 --- a/configure.ac +++ b/configure.ac @@ -4972,6 +4972,30 @@ if test "$have_dirent_d_type" = yes; then [Define to 1 if the dirent structure has a d_type field]) fi +# check if the Linux getrandom() syscall is available +AC_MSG_CHECKING(for the Linux getrandom() syscall) +AC_LINK_IFELSE( +[ + AC_LANG_SOURCE([[ + #include <sys/syscall.h> + + int main() { + const int flags = 0; + char buffer[1]; + int n; + /* ignore the result, Python checks for ENOSYS at runtime */ + (void)syscall(SYS_getrandom, buffer, sizeof(buffer), flags); + return 0; + } + ]]) +],[have_getrandom_syscall=yes],[have_getrandom_syscall=no]) +AC_MSG_RESULT($have_getrandom_syscall) + +if test "$have_getrandom_syscall" = yes; then + AC_DEFINE(HAVE_GETRANDOM_SYSCALL, 1, + [Define to 1 if the Linux getrandom() syscall is available]) +fi + # generate output files AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh) AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix]) |