]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/sntp/m4/ntp_crypto_rand.m4
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / sntp / m4 / ntp_crypto_rand.m4
1 # SYNOPSIS                                              -*- Autoconf -*-
2 #
3 #  NTP_CRYPTO_RAND
4 #
5 # DESCRIPTION
6 #
7 # AUTHOR
8 #
9 #  Harlan Stenn
10 #
11 # LICENSE
12 #
13 #  This file is Copyright (c) 2014 Network Time Foundation
14
15 #  Copying and distribution of this file, with or without modification, are
16 #  permitted in any medium without royalty provided the copyright notice,
17 #  author attribution and this notice are preserved.  This file is offered
18 #  as-is, without any warranty.
19
20 AC_DEFUN([NTP_CRYPTO_RAND], [
21
22 dnl check for --disable-openssl-random
23 dnl if that's not specified:
24 dnl - Look for RAND_poll and RAND_bytes
25 dnl - if they exist, define USE_OPENSSL_CRYPTO_RAND
26
27 AC_MSG_CHECKING([if we want to use OpenSSL's crypto random (if available)])
28 AC_ARG_ENABLE(
29     [openssl-random],
30     [AS_HELP_STRING(
31         [--enable-openssl-random],
32         [Use OpenSSL's crypto random number functions, if available (default is yes)]
33     )],
34     [ntp_use_openssl_random=$enableval],
35     [ntp_use_openssl_random=yes]
36 )
37 AC_MSG_RESULT([$ntp_use_openssl_random])
38
39 # The following might need extra libraries
40 NTPO_SAVED_LIBS="$LIBS"
41 LIBS="$NTPO_SAVED_LIBS $LDADD_NTP"
42 dnl AC_MSG_NOTICE([LIBS is <$LIBS>])
43 AC_CHECK_FUNCS([RAND_bytes RAND_poll])
44 LIBS="$NTPO_SAVED_LIBS"
45 case "$ntp_use_openssl_random$ac_cv_func_RAND_bytes$ac_cv_func_RAND_poll" in
46  yesyesyes)
47      AC_DEFINE([USE_OPENSSL_CRYPTO_RAND], [1], [Use OpenSSL's crypto random functions])
48      ;;
49  *) ntp_use_openssl_random=no ;;
50 esac
51
52 ]) dnl NTP_CRYPTO_RAND
53