Mercurial > gnulib
annotate m4/gc-random.m4 @ 40057:b06060465f09
maint: Run 'make update-copyright'
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 01 Jan 2019 00:25:11 +0100 |
parents | 10eb9086bea0 |
children |
rev | line source |
---|---|
16234
f9b906545e2f
Use ', not `, for quoting output.
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
1 # gc-random.m4 serial 6 |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 dnl Copyright (C) 2005-2019 Free Software Foundation, Inc. |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
3 dnl This file is free software; the Free Software Foundation |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
4 dnl gives unlimited permission to copy and/or distribute it, |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
5 dnl with or without modifications, as long as this notice is preserved. |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
6 |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
7 AC_DEFUN([gl_GC_RANDOM], |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
8 [ |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
9 # Devices with randomness. |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
10 # FIXME: Are these the best defaults? |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
11 |
6693
d9fbbc8f7f1d
* gc-random.m4: Call AC_CANONICAL_HOST and use $host_os instead of
Simon Josefsson <simon@josefsson.org>
parents:
6683
diff
changeset
|
12 AC_REQUIRE([AC_CANONICAL_HOST])dnl |
d9fbbc8f7f1d
* gc-random.m4: Call AC_CANONICAL_HOST and use $host_os instead of
Simon Josefsson <simon@josefsson.org>
parents:
6683
diff
changeset
|
13 |
d9fbbc8f7f1d
* gc-random.m4: Call AC_CANONICAL_HOST and use $host_os instead of
Simon Josefsson <simon@josefsson.org>
parents:
6683
diff
changeset
|
14 case "$host_os" in |
13700
64110b464ca2
mirbsd: add some more support
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
15 *openbsd* | *mirbsd*) |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
16 NAME_OF_RANDOM_DEVICE="/dev/srandom" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
17 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/prandom" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
18 NAME_OF_NONCE_DEVICE="/dev/urandom" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
19 ;; |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
20 |
6693
d9fbbc8f7f1d
* gc-random.m4: Call AC_CANONICAL_HOST and use $host_os instead of
Simon Josefsson <simon@josefsson.org>
parents:
6683
diff
changeset
|
21 *netbsd*) |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
22 NAME_OF_RANDOM_DEVICE="/dev/srandom" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
23 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/urandom" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
24 NAME_OF_NONCE_DEVICE="/dev/urandom" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
25 ;; |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
26 |
6693
d9fbbc8f7f1d
* gc-random.m4: Call AC_CANONICAL_HOST and use $host_os instead of
Simon Josefsson <simon@josefsson.org>
parents:
6683
diff
changeset
|
27 *solaris* | *irix* | *dec-osf* ) |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
28 NAME_OF_RANDOM_DEVICE="/dev/random" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
29 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/random" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
30 NAME_OF_NONCE_DEVICE="/dev/random" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
31 ;; |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
32 |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
33 *) |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
34 NAME_OF_RANDOM_DEVICE="/dev/random" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
35 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/urandom" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
36 NAME_OF_NONCE_DEVICE="/dev/urandom" |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
37 ;; |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
38 esac |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
39 |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
40 AC_MSG_CHECKING([device with (strong) random data...]) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
41 AC_ARG_ENABLE([random-device], |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
42 AS_HELP_STRING([--enable-random-device], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
43 [device with (strong) randomness (for Nettle)]), |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
44 NAME_OF_RANDOM_DEVICE=$enableval) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
45 AC_MSG_RESULT([$NAME_OF_RANDOM_DEVICE]) |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
46 |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
47 AC_MSG_CHECKING([device with pseudo random data...]) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
48 AC_ARG_ENABLE([pseudo-random-device], |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
49 AS_HELP_STRING([--enable-pseudo-random-device], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
50 [device with pseudo randomness (for Nettle)]), |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
51 NAME_OF_PSEUDO_RANDOM_DEVICE=$enableval) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
52 AC_MSG_RESULT([$NAME_OF_PSEUDO_RANDOM_DEVICE]) |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
53 |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
54 AC_MSG_CHECKING([device with unpredictable data for nonces...]) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
55 AC_ARG_ENABLE([nonce-device], |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
56 AS_HELP_STRING([--enable-nonce-device], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
57 [device with unpredictable nonces (for Nettle)]), |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
58 NAME_OF_NONCE_DEVICE=$enableval) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
59 AC_MSG_RESULT([$NAME_OF_NONCE_DEVICE]) |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
60 |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
61 if test "$cross_compiling" != yes; then |
6696
6a7edbad1cdf
Fix gc-random module.
Simon Josefsson <simon@josefsson.org>
parents:
6693
diff
changeset
|
62 if test "$NAME_OF_RANDOM_DEVICE" != "no"; then |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
63 AC_CHECK_FILE([$NAME_OF_RANDOM_DEVICE],, |
16234
f9b906545e2f
Use ', not `, for quoting output.
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
64 AC_MSG_WARN([[Device '$NAME_OF_RANDOM_DEVICE' does not exist, consider to use --enable-random-device]])) |
6696
6a7edbad1cdf
Fix gc-random module.
Simon Josefsson <simon@josefsson.org>
parents:
6693
diff
changeset
|
65 fi |
6a7edbad1cdf
Fix gc-random module.
Simon Josefsson <simon@josefsson.org>
parents:
6693
diff
changeset
|
66 if test "$NAME_OF_PSEUDO_RANDOM_DEVICE" != "no"; then |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
67 AC_CHECK_FILE([$NAME_OF_PSEUDO_RANDOM_DEVICE],, |
16234
f9b906545e2f
Use ', not `, for quoting output.
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
68 AC_MSG_WARN([[Device '$NAME_OF_PSEUDO_RANDOM_DEVICE' does not exist, consider to use --enable-pseudo-random-device]])) |
6696
6a7edbad1cdf
Fix gc-random module.
Simon Josefsson <simon@josefsson.org>
parents:
6693
diff
changeset
|
69 fi |
6697 | 70 if test "$NAME_OF_NONCE_DEVICE" != "no"; then |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
71 AC_CHECK_FILE([$NAME_OF_NONCE_DEVICE],, |
16234
f9b906545e2f
Use ', not `, for quoting output.
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
72 AC_MSG_WARN([[Device '$NAME_OF_NONCE_DEVICE' does not exist, consider to use --enable-nonce-device]])) |
6696
6a7edbad1cdf
Fix gc-random module.
Simon Josefsson <simon@josefsson.org>
parents:
6693
diff
changeset
|
73 fi |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
74 else |
9879
e0ce0891df69
Avoid some more autoconf warnings.
Eric Blake <ebb9@byu.net>
parents:
7796
diff
changeset
|
75 AC_MSG_NOTICE([[Cross compiling, assuming random devices exists on the target host...]]) |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
76 fi |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
77 |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
78 # FIXME?: Open+read 42 bytes+close twice and compare data. Should differ. |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
79 |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
80 AC_DEFINE_UNQUOTED([NAME_OF_RANDOM_DEVICE], ["$NAME_OF_RANDOM_DEVICE"], |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
81 [defined to the name of the (strong) random device]) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
82 AC_DEFINE_UNQUOTED([NAME_OF_PSEUDO_RANDOM_DEVICE], |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
83 "$NAME_OF_PSEUDO_RANDOM_DEVICE", |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
84 [defined to the name of the pseudo random device]) |
11007
f6cba5a556ce
many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents:
9879
diff
changeset
|
85 AC_DEFINE_UNQUOTED([NAME_OF_NONCE_DEVICE], ["$NAME_OF_NONCE_DEVICE"], |
6683
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
86 [defined to the name of the unpredictable nonce device]) |
b834cf4a531f
Split off gc-random from gc, and only warn on missing devices.
Simon Josefsson <simon@josefsson.org>
parents:
diff
changeset
|
87 ]) |