Following a similar pattern to PAM and SELinux checks. Unchanged: if a user has requested the use of a random device and none can be found, the configuration aborts.
Signed-off-by: Gaetan Nadon <mems...@videotron.ca> --- configure.ac | 36 +++++++++++++++--------------------- 1 files changed, 15 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 03e6e53..4d9f198 100644 --- a/configure.ac +++ b/configure.ac @@ -171,28 +171,22 @@ case $host_os in esac AC_SUBST(SU) -# Check for /dev/random or /dev/urandom -AC_ARG_WITH(random-device, - AC_HELP_STRING([--with-random-device\[=<pathname>\]], - [Use <pathname> as a source of randomness]), - RANDOM_DEVICE="$withval", RANDOM_DEVICE="try") - -if test x$RANDOM_DEVICE = xyes -o x$RANDOM_DEVICE = xtry ; then - AC_CHECK_FILE([/dev/urandom], [RANDOM_DEVICE=/dev/urandom], - AC_CHECK_FILE([/dev/random], [RANDOM_DEVICE=/dev/random])) - if test x$RANDOM_DEVICE = xyes ; then - AC_MSG_ERROR([random device support requested, but no random device was found.]) - else - if test x$RANDOM_DEVICE = xtry ; then - RANDOM_DEVICE="no" - fi - fi +# Define a configure option to locate a special file (/dev/random or /dev/urandom) +# that serves as a random or a pseudorandom number generator +AC_ARG_WITH(random-device, AS_HELP_STRING([--with-random-device\[=<pathname>\]], + [Use <pathname> as a source of randomness (default is auto-detected)]), + [USE_DEVICE="$withval"], [USE_DEVICE="auto"]) +if test x$USE_DEVICE != xno ; then + AC_CHECK_FILE([/dev/urandom], [DEV_RANDOM=/dev/urandom], + [AC_CHECK_FILE([/dev/random], [DEV_RANDOM=/dev/random], + [AS_IF([test "x$USE_DEVICE" = "xyes"], + [AC_MSG_ERROR([random device support requested, but no random device was found.])] + )] + )] + ) fi - -if test x$RANDOM_DEVICE != xno ; then - AC_DEFINE_UNQUOTED(DEV_RANDOM,"$RANDOM_DEVICE", - [Define to device that provides random data source]) - DEV_RANDOM=$RANDOM_DEVICE +if test x$DEV_RANDOM != x ; then + AC_DEFINE_UNQUOTED(DEV_RANDOM,"$DEV_RANDOM", [Define to device that provides random data source]) fi AC_SUBST(DEV_RANDOM) -- 1.6.0.4 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel