| 1 | dnl @synopsis AX_RANDOM_DEVICE |
|---|
| 2 | dnl |
|---|
| 3 | dnl This macro will check for a random device, allowing the user to explicitly |
|---|
| 4 | dnl set the path. The user uses '--with-random=FILE' as an argument to |
|---|
| 5 | dnl configure. |
|---|
| 6 | dnl |
|---|
| 7 | dnl If A random device is found then HAVE_RANDOM_DEVICE is set to 1 and |
|---|
| 8 | dnl RANDOM_DEVICE contains the path. |
|---|
| 9 | dnl |
|---|
| 10 | dnl @category Miscellaneous |
|---|
| 11 | dnl @author Martin Ebourne |
|---|
| 12 | dnl @version 2005/07/01 |
|---|
| 13 | dnl @license AllPermissive |
|---|
| 14 | |
|---|
| 15 | AC_DEFUN([AX_RANDOM_DEVICE], [ |
|---|
| 16 | AC_ARG_WITH([random], |
|---|
| 17 | [AC_HELP_STRING([--with-random=FILE], [Use FILE as random number seed [auto-detected]])], |
|---|
| 18 | [RANDOM_DEVICE="$withval"], |
|---|
| 19 | [AC_CHECK_FILE("/dev/urandom", [RANDOM_DEVICE="/dev/urandom";], |
|---|
| 20 | [AC_CHECK_FILE("/dev/arandom", [RANDOM_DEVICE="/dev/arandom";], |
|---|
| 21 | [AC_CHECK_FILE("/dev/random", [RANDOM_DEVICE="/dev/random";])] |
|---|
| 22 | )]) |
|---|
| 23 | ]) |
|---|
| 24 | if test "x$RANDOM_DEVICE" != "x" ; then |
|---|
| 25 | AC_DEFINE([HAVE_RANDOM_DEVICE], 1, |
|---|
| 26 | [Define to 1 (and set RANDOM_DEVICE) if a random device is available]) |
|---|
| 27 | AC_SUBST([RANDOM_DEVICE]) |
|---|
| 28 | AC_DEFINE_UNQUOTED([RANDOM_DEVICE], ["$RANDOM_DEVICE"], |
|---|
| 29 | [Define to the filename of the random device (and set HAVE_RANDOM_DEVICE)]) |
|---|
| 30 | fi |
|---|
| 31 | ])dnl |
|---|