1 |
AC_DEFUN([AX_ARG_WITH_TLS], [ |
2 |
|
3 |
AC_ARG_WITH([tls], [AS_HELP_STRING([--with-tls], [Enables TLS with specified library. Options: 'openssl', 'wolfssl', 'gnutls' or 'none'])], [with_tls=$withval], [with_tls=auto]) |
4 |
|
5 |
if test "$with_tls" = "openssl" || |
6 |
test "$with_tls" = "auto"; then |
7 |
AC_CHECK_HEADER([openssl/opensslv.h], [ |
8 |
AC_RUN_IFELSE([ |
9 |
AC_LANG_PROGRAM([ |
10 |
#include <openssl/opensslv.h> |
11 |
#include <stdlib.h>], [ |
12 |
exit(!(OPENSSL_VERSION_NUMBER >= 0x1010100fL)); ])], [AC_CHECK_LIB([crypto], [RSA_free], [], [], [])], [], [])]) |
13 |
|
14 |
AS_IF([test "$ac_cv_lib_crypto_RSA_free" = "yes"], [AC_CHECK_LIB([ssl], [SSL_connect])], []) |
15 |
|
16 |
AC_MSG_CHECKING([for LibreSSL, or OpenSSL 1.1.1 and above]) |
17 |
AS_IF([test "$ac_cv_lib_ssl_SSL_connect" = "yes"], |
18 |
[AC_MSG_RESULT([found])], [AC_MSG_RESULT([no - LibreSSL/OpenSSL support disabled])]) |
19 |
|
20 |
fi |
21 |
|
22 |
if test "$with_tls" = "gnutls" || |
23 |
test "$with_tls" = "auto"; then |
24 |
if test "$ac_cv_lib_ssl_SSL_connect" != "yes"; then |
25 |
|
26 |
AC_CHECK_HEADER([gnutls/gnutls.h], [ |
27 |
AC_RUN_IFELSE([ |
28 |
AC_LANG_PROGRAM([ |
29 |
#include <gnutls/gnutls.h> |
30 |
#include <stdlib.h>], [ |
31 |
exit(!(GNUTLS_VERSION_NUMBER >= 0x030605)); ])], [AC_CHECK_LIB([gnutls], [gnutls_init], [], [], [])], [], [])]) |
32 |
|
33 |
AC_MSG_CHECKING([for GnuTLS 3.6.5 and above]) |
34 |
AS_IF([test "$ac_cv_lib_gnutls_gnutls_init" = "yes"], |
35 |
[AC_MSG_RESULT([found])], [AC_MSG_RESULT([no - GnuTLS support disabled])]) |
36 |
|
37 |
fi |
38 |
fi |
39 |
|
40 |
if test "$with_tls" = "wolfssl" || |
41 |
test "$with_tls" = "auto"; then |
42 |
if test "$ac_cv_lib_ssl_SSL_connect" != "yes" && |
43 |
test "$ac_cv_lib_gnutls_gnutls_init" != "yes"; then |
44 |
|
45 |
AC_CHECK_HEADER([wolfssl/ssl.h], [ |
46 |
AC_RUN_IFELSE([ |
47 |
AC_LANG_PROGRAM([ |
48 |
#include <wolfssl/version.h> |
49 |
#include <stdlib.h>], [ |
50 |
exit(!(LIBWOLFSSL_VERSION_HEX >= 0x04003000)); ])], [AC_CHECK_LIB([wolfssl], [wolfSSL_X509_digest], [], [], [])], [], [])]) |
51 |
|
52 |
AC_MSG_CHECKING([for wolfSSL 4.3.0 and above built with extended/full OpenSSL compatibility layer]) |
53 |
AS_IF([test "$ac_cv_lib_wolfssl_wolfSSL_X509_digest" = "yes"], |
54 |
[AC_MSG_RESULT([found])], [AC_MSG_RESULT([no - wolfSSL support disabled])]) |
55 |
|
56 |
fi |
57 |
fi |
58 |
|
59 |
]) |