linamh/sys-libs/glibc/files/2.3.5/glibc-2.3.5-frandom-detect.patch

103 lines
3.0 KiB
Diff
Raw Normal View History

--- config.h.in
+++ config.h.in
@@ -215,4 +215,7 @@
#undef HAVE_LIBIDN
+/* Defined if economical random device is available. */
+#undef HAVE_DEV_ERANDOM
+
/* Define if inlined system calls are available. */
#undef HAVE_INLINED_SYSCALLS
--- configure.in
+++ configure.in
@@ -264,4 +264,11 @@
AC_SUBST(all_warnings)
+dnl See whether the user wants to disable checking for /dev/erandom
+AC_ARG_ENABLE([dev-erandom],
+ AC_HELP_STRING([--disable-dev-erandom],
+ [disable testing for /dev/erandom]),
+ [try_dev_erandom=$enableval],
+ [try_dev_erandom=yes])
+
AC_CANONICAL_HOST
@@ -1974,4 +1981,19 @@
AC_SUBST(sizeof_long_double)
+dnl check whether we have an economical random device
+if test "$try_dev_erandom" = yes ; then
+ AC_CACHE_CHECK(for economical random device, ac_cv_have_dev_random,
+ [if test -r "/dev/erandom" ; then
+ ac_cv_have_dev_erandom=yes; else ac_cv_have_dev_erandom=no; fi])
+ if test "$ac_cv_have_dev_erandom" = yes; then
+ AC_DEFINE(HAVE_DEV_ERANDOM,1,
+ [defined if the system supports an economical random device])
+ fi
+else
+ AC_MSG_CHECKING(for economical random device)
+ ac_cv_have_dev_erandom=no
+ AC_MSG_RESULT(has been disabled)
+fi
+
### End of automated tests.
### Now run sysdeps configure fragments.
--- configure
+++ configure
@@ -884,6 +884,7 @@
--enable-kernel=VERSION compile for compatibility with kernel not older than
VERSION
--enable-all-warnings enable all useful warnings gcc can issue
+ --disable-dev-erandom disable testing for /dev/erandom
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1697,6 +1698,14 @@
fi;
+# Check whether --enable-dev-erandom or --disable-dev-erandom was given.
+if test "${enable_dev_erandom+set}" = set; then
+ enableval="$enable_dev_erandom"
+ try_dev_erandom=$enableval
+else
+ try_dev_erandom=yes
+fi;
+
# Make sure we can run config.sub.
$ac_config_sub sun4 >/dev/null 2>&1 ||
{ { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
@@ -7449,6 +7458,32 @@
sizeof_long_double=$ac_cv_sizeof_long_double
+if test "$try_dev_erandom" = yes ; then
+ echo "$as_me:$LINENO: checking for economical random device" >&5
+echo $ECHO_N "checking for economical random device... $ECHO_C" >&6
+if test "${ac_cv_have_dev_random+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -r "/dev/erandom" ; then
+ ac_cv_have_dev_erandom=yes; else ac_cv_have_dev_erandom=no; fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_dev_random" >&5
+echo "${ECHO_T}$ac_cv_have_dev_random" >&6
+ if test "$ac_cv_have_dev_erandom" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DEV_ERANDOM 1
+_ACEOF
+
+ fi
+else
+ echo "$as_me:$LINENO: checking for economical random device" >&5
+echo $ECHO_N "checking for economical random device... $ECHO_C" >&6
+ ac_cv_have_dev_erandom=no
+ echo "$as_me:$LINENO: result: has been disabled" >&5
+echo "${ECHO_T}has been disabled" >&6
+fi
+
### End of automated tests.
### Now run sysdeps configure fragments.