1 dnl Check to find the LibreSSL/OpenSSL headers/libraries
3 AC_DEFUN([tinc_OPENSSL],
11 [AC_CHECK_LIB(dl, dlopen,
13 [AC_MSG_ERROR([LibreSSL/OpenSSL depends on libdl.]); break]
20 AS_HELP_STRING([--with-openssl=DIR], [LibreSSL/OpenSSL base directory, or:]),
22 CPPFLAGS="$CPPFLAGS -I$withval/include"
23 LDFLAGS="$LDFLAGS -L$withval/lib"]
26 AC_ARG_WITH(openssl-include,
27 AS_HELP_STRING([--with-openssl-include=DIR], [LibreSSL/OpenSSL headers directory (without trailing /openssl)]),
28 [openssl_include="$withval"
29 CPPFLAGS="$CPPFLAGS -I$withval"]
32 AC_ARG_WITH(openssl-lib,
33 AS_HELP_STRING([--with-openssl-lib=DIR], [LibreSSL/OpenSSL library directory]),
34 [openssl_lib="$withval"
35 LDFLAGS="$LDFLAGS -L$withval"]
38 AC_CHECK_HEADERS([openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h openssl/engine.h],
40 [AC_MSG_ERROR([LibreSSL/OpenSSL header files not found.]); break]
43 AC_CHECK_LIB(crypto, EVP_EncryptInit_ex,
44 [LIBS="-lcrypto $LIBS"],
45 [AC_MSG_ERROR([LibreSSL/OpenSSL libraries not found.])]
48 AC_CHECK_FUNCS([RAND_bytes EVP_EncryptInit_ex EVP_CIPHER_CTX_new], ,
49 [AC_MSG_ERROR([Missing LibreSSL/OpenSSL functionality, make sure you have installed the latest version.]); break],
52 AC_CHECK_DECLS([OpenSSL_add_all_algorithms EVP_aes_256_cfb], ,
53 [AC_MSG_ERROR([Missing LibreSSL/OpenSSL functionality, make sure you have installed the latest version.]); break],
54 [#include <openssl/evp.h>]
57 AC_CHECK_FUNCS([BN_GENCB_new ERR_remove_state RSA_set0_key], , , [#include <openssl/rsa.h>])