ntp_crypto_rand.m4 revision 285612
1258945Sroberto# SYNOPSIS						-*- Autoconf -*-
2258945Sroberto#
3258945Sroberto#  NTP_CRYPTO_RAND
4258945Sroberto#
5258945Sroberto# DESCRIPTION
6258945Sroberto#
7258945Sroberto# AUTHOR
8258945Sroberto#
9258945Sroberto#  Harlan Stenn
10258945Sroberto#
11258945Sroberto# LICENSE
12258945Sroberto#
13258945Sroberto#  This file is Copyright (c) 2014 Network Time Foundation
14258945Sroberto# 
15258945Sroberto#  Copying and distribution of this file, with or without modification, are
16258945Sroberto#  permitted in any medium without royalty provided the copyright notice,
17258945Sroberto#  author attribution and this notice are preserved.  This file is offered
18258945Sroberto#  as-is, without any warranty.
19258945Sroberto
20258945SrobertoAC_DEFUN([NTP_CRYPTO_RAND], [
21258945Sroberto
22258945Srobertodnl check for --disable-openssl-random
23258945Srobertodnl if that's not specified:
24258945Srobertodnl - Look for RAND_poll and RAND_bytes
25258945Srobertodnl - if they exist, define USE_OPENSSL_CRYPTO_RAND
26258945Sroberto
27258945SrobertoAC_MSG_CHECKING([if we want to use OpenSSL's crypto random (if available)])
28258945SrobertoAC_ARG_ENABLE(
29258945Sroberto    [openssl-random],
30258945Sroberto    [AS_HELP_STRING(
31258945Sroberto    	[--enable-openssl-random],
32258945Sroberto	[Use OpenSSL's crypto random number functions, if available (default is yes)]
33258945Sroberto    )],
34258945Sroberto    [ntp_use_openssl_random=$enableval],
35258945Sroberto    [ntp_use_openssl_random=yes]
36258945Sroberto)
37258945SrobertoAC_MSG_RESULT([$ntp_use_openssl_random])
38258945Sroberto
39258945Sroberto# The following might need extra libraries
40258945SrobertoNTPO_SAVED_LIBS="$LIBS"
41LIBS="$NTPO_SAVED_LIBS $LDADD_NTP"
42dnl AC_MSG_NOTICE([LIBS is <$LIBS>])
43AC_CHECK_FUNCS([RAND_bytes RAND_poll])
44LIBS="$NTPO_SAVED_LIBS"
45case "$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 ;;
50esac
51
52]) dnl NTP_CRYPTO_RAND
53
54