2 dnl Copyright (C) 2005 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
9 AC_LIBSOURCES([gc.h, gc-gnulib.c, gc-libgcrypt.c])
10 AC_ARG_WITH(libgcrypt,
11 AS_HELP_STRING([--with-libgcrypt], [use libgcrypt for low-level crypto]),
12 libgcrypt=$withval, libgcrypt=no)
13 if test "$libgcrypt" != no; then
14 AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>])
16 if test "$ac_cv_libgcrypt" = yes; then
17 AC_LIBOBJ([gc-libgcrypt])
19 AC_LIBOBJ([gc-gnulib])
21 # Devices with randomness.
22 # FIXME: Are these the best defaults?
26 NAME_OF_RANDOM_DEVICE="/dev/srandom"
27 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/prandom"
28 NAME_OF_NONCE_DEVICE="/dev/urandom"
32 NAME_OF_RANDOM_DEVICE="/dev/srandom"
33 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/urandom"
34 NAME_OF_NONCE_DEVICE="/dev/urandom"
37 *-solaris* | *-irix* | *-dec-osf* )
38 NAME_OF_RANDOM_DEVICE="/dev/random"
39 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/random"
40 NAME_OF_NONCE_DEVICE="/dev/random"
44 NAME_OF_RANDOM_DEVICE="/dev/random"
45 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/urandom"
46 NAME_OF_NONCE_DEVICE="/dev/urandom"
50 AC_MSG_CHECKING([device with (strong) random data...])
51 AC_ARG_ENABLE(random-device,
52 AC_HELP_STRING([--enable-random-device],
53 [device with (strong) randomness (for Nettle)]),
54 test "$enableval" != "no" && NAME_OF_RANDOM_DEVICE=$enableval)
55 AC_MSG_RESULT($NAME_OF_RANDOM_DEVICE)
57 AC_MSG_CHECKING([device with pseudo random data...])
58 AC_ARG_ENABLE(pseudo-random-device,
59 AC_HELP_STRING([--enable-pseudo-random-device],
60 [device with pseudo randomness (for Nettle)]),
61 test "$enableval" != "no" && NAME_OF_PSEUDO_RANDOM_DEVICE=$enableval)
62 AC_MSG_RESULT($NAME_OF_PSEUDO_RANDOM_DEVICE)
64 AC_MSG_CHECKING([device with unpredictable data for nonces...])
65 AC_ARG_ENABLE(nonce-device,
66 AC_HELP_STRING([--enable-nonce-device],
67 [device with unpredictable nonces (for Nettle)]),
68 test "$enableval" != "no" && NAME_OF_NONCE_DEVICE=$enableval)
69 AC_MSG_RESULT($NAME_OF_NONCE_DEVICE)
71 if test "$cross_compiling" != yes; then
72 AC_CHECK_FILE($NAME_OF_RANDOM_DEVICE,,
73 AC_MSG_ERROR([[device for (strong) random data `$NAME_OF_RANDOM_DEVICE' does not exist]]))
74 AC_CHECK_FILE($NAME_OF_PSEUDO_RANDOM_DEVICE,,
75 AC_MSG_ERROR([[device for pseudo-random data `$NAME_OF_PSEUDO_RANDOM_DEVICE' does not exist]]))
76 AC_CHECK_FILE($NAME_OF_NONCE_DEVICE,,
77 AC_MSG_ERROR([[device for unpredictable nonces `$NAME_OF_NONCE_DEVICE' does not exist]]))
79 AC_MSG_NOTICE([[Cross compiling, assuming random devices exists...]])
82 # FIXME: Open+read 42 bytes+close twice and compare data. Should differ.
84 AC_DEFINE_UNQUOTED(NAME_OF_RANDOM_DEVICE, "$NAME_OF_RANDOM_DEVICE",
85 [defined to the name of the (strong) random device])
86 AC_DEFINE_UNQUOTED(NAME_OF_PSEUDO_RANDOM_DEVICE,
87 "$NAME_OF_PSEUDO_RANDOM_DEVICE",
88 [defined to the name of the pseudo random device])
89 AC_DEFINE_UNQUOTED(NAME_OF_NONCE_DEVICE, "$NAME_OF_NONCE_DEVICE",
90 [defined to the name of the unpredictable nonce device])
94 # Prerequisites of lib/gc.h
95 AC_DEFUN([gl_PREREQ_GC], [:])