summaryrefslogtreecommitdiff
path: root/infrastructure/m4/ax_random_device.m4
diff options
context:
space:
mode:
authorMartin Ebourne <martin@ebourne.me.uk>2005-12-07 16:34:47 +0000
committerMartin Ebourne <martin@ebourne.me.uk>2005-12-07 16:34:47 +0000
commit81d8eda2419e7a23088a98cdfc52a305c9ceac0d (patch)
tree27143d7b539a8bf2e23cc18e2f598804fa8d784d /infrastructure/m4/ax_random_device.m4
parent065dc6f8cd168e3ee6e71ddfb06f42a92abfabbd (diff)
Merged martin/autoconf at r35 to trunk
Diffstat (limited to 'infrastructure/m4/ax_random_device.m4')
-rw-r--r--infrastructure/m4/ax_random_device.m431
1 files changed, 31 insertions, 0 deletions
diff --git a/infrastructure/m4/ax_random_device.m4 b/infrastructure/m4/ax_random_device.m4
new file mode 100644
index 00000000..ab9b56fd
--- /dev/null
+++ b/infrastructure/m4/ax_random_device.m4
@@ -0,0 +1,31 @@
+dnl @synopsis AX_RANDOM_DEVICE
+dnl
+dnl This macro will check for a random device, allowing the user to explicitly
+dnl set the path. The user uses '--with-random=FILE' as an argument to
+dnl configure.
+dnl
+dnl If A random device is found then HAVE_RANDOM_DEVICE is set to 1 and
+dnl RANDOM_DEVICE contains the path.
+dnl
+dnl @category Miscellaneous
+dnl @author Martin Ebourne
+dnl @version 2005/07/01
+dnl @license AllPermissive
+
+AC_DEFUN([AX_RANDOM_DEVICE], [
+ AC_ARG_WITH([random],
+ [AC_HELP_STRING([--with-random=FILE], [Use FILE as random number seed [auto-detected]])],
+ [RANDOM_DEVICE="$withval"],
+ [AC_CHECK_FILE("/dev/urandom", [RANDOM_DEVICE="/dev/urandom";],
+ [AC_CHECK_FILE("/dev/arandom", [RANDOM_DEVICE="/dev/arandom";],
+ [AC_CHECK_FILE("/dev/random", [RANDOM_DEVICE="/dev/random";])]
+ )])
+ ])
+ if test "x$RANDOM_DEVICE" != "x" ; then
+ AC_DEFINE([HAVE_RANDOM_DEVICE], 1,
+ [Define to 1 (and set RANDOM_DEVICE) if a random device is available])
+ AC_SUBST([RANDOM_DEVICE])
+ AC_DEFINE_UNQUOTED([RANDOM_DEVICE], ["$RANDOM_DEVICE"],
+ [Define to the filename of the random device (and set HAVE_RANDOM_DEVICE)])
+ fi
+ ])dnl