1 # SYNOPSIS -*- Autoconf -*-
13 # This file is Copyright (c) 2014 Network Time Foundation
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.
20 AC_DEFUN([NTP_CRYPTO_RAND], [
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
27 AC_MSG_CHECKING([if we want to use OpenSSL's crypto random (if available)])
31 [--enable-openssl-random],
32 [Use OpenSSL's crypto random number functions, if available (default is yes)]
34 [ntp_use_openssl_random=$enableval],
35 [ntp_use_openssl_random=yes]
37 AC_MSG_RESULT([$ntp_use_openssl_random])
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
47 AC_DEFINE([USE_OPENSSL_CRYPTO_RAND], [1], [Use OpenSSL's crypto random functions])
49 *) ntp_use_openssl_random=no ;;
52 ]) dnl NTP_CRYPTO_RAND