| 1 |
AC_DEFUN([AX_ARG_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, [AC_CHECK_LIB(ssl, SSL_connect)], [], [])], [], [])]) |
| 13 |
|
| 14 |
AC_MSG_CHECKING([for LibreSSL, or OpenSSL 1.1.1 and above]) |
| 15 |
AS_IF([test "$ac_cv_lib_ssl_SSL_connect" = "yes"], |
| 16 |
[AC_MSG_RESULT(found)], [AC_MSG_RESULT(no - LibreSSL/OpenSSL support disabled)]) |
| 17 |
|
| 18 |
fi |
| 19 |
|
| 20 |
if test "$with_tls" = "gnutls" || |
| 21 |
test "$with_tls" = "auto"; then |
| 22 |
if test "$ac_cv_lib_ssl_SSL_connect" != "yes"; then |
| 23 |
|
| 24 |
AC_CHECK_HEADER(gnutls/gnutls.h, [ |
| 25 |
AC_RUN_IFELSE([ |
| 26 |
AC_LANG_PROGRAM([ |
| 27 |
#include <gnutls/gnutls.h> |
| 28 |
#include <stdlib.h>], [ |
| 29 |
exit(!(GNUTLS_VERSION_NUMBER >= 0x030605)); ])], [AC_CHECK_LIB(gnutls, gnutls_init, [], [], [])], [], [])]) |
| 30 |
|
| 31 |
AC_MSG_CHECKING([for GnuTLS 3.6.5 and above]) |
| 32 |
AS_IF([test "$ac_cv_lib_gnutls_gnutls_init" = "yes"], |
| 33 |
[AC_MSG_RESULT(found)], [AC_MSG_RESULT(no - GnuTLS support disabled)]) |
| 34 |
|
| 35 |
fi |
| 36 |
fi |
| 37 |
|
| 38 |
if test "$with_tls" = "wolfssl" || |
| 39 |
test "$with_tls" = "auto"; then |
| 40 |
if test "$ac_cv_lib_ssl_SSL_connect" != "yes" && |
| 41 |
test "$ac_cv_lib_gnutls_gnutls_init" != "yes"; then |
| 42 |
|
| 43 |
AC_CHECK_HEADER(wolfssl/ssl.h, [ |
| 44 |
AC_RUN_IFELSE([ |
| 45 |
AC_LANG_PROGRAM([ |
| 46 |
#include <wolfssl/version.h> |
| 47 |
#include <stdlib.h>], [ |
| 48 |
exit(!(LIBWOLFSSL_VERSION_HEX >= 0x04003000)); ])], [ AC_CHECK_LIB(wolfssl, wolfSSL_X509_digest, [], [], [])], [], [])]) |
| 49 |
|
| 50 |
AC_MSG_CHECKING([for wolfSSL 4.3.0 and above built with extended/full OpenSSL compatibility layer]) |
| 51 |
AS_IF([test "$ac_cv_lib_wolfssl_wolfSSL_X509_digest" = "yes"], |
| 52 |
[AC_MSG_RESULT(found)], [AC_MSG_RESULT(no - wolfSSL support disabled)]) |
| 53 |
|
| 54 |
fi |
| 55 |
fi |
| 56 |
|
| 57 |
]) |