source: box/trunk/infrastructure/m4/ax_random_device.m4 @ 217

Revision 217, 1.2 KB checked in by martin, 6 years ago (diff)

Set svn:eol-style as appropriate for all files

  • Property svn:eol-style set to native
Line 
1dnl @synopsis AX_RANDOM_DEVICE
2dnl
3dnl This macro will check for a random device, allowing the user to explicitly
4dnl set the path. The user uses '--with-random=FILE' as an argument to
5dnl configure.
6dnl
7dnl If A random device is found then HAVE_RANDOM_DEVICE is set to 1 and
8dnl RANDOM_DEVICE contains the path.
9dnl
10dnl @category Miscellaneous
11dnl @author Martin Ebourne
12dnl @version 2005/07/01
13dnl @license AllPermissive
14
15AC_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
Note: See TracBrowser for help on using the repository browser.