1 dnl Check to find the OpenSSL headers/libraries
3 AC_DEFUN([tinc_OPENSSL],
11 [AC_CHECK_LIB(dl, dlopen,
13 [AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
20 AS_HELP_STRING([--with-openssl=DIR], [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], [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], [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 openssl/ecdh.h openssl/ec.h],
40 [AC_MSG_ERROR([OpenSSL header files not found.]); break]
43 AC_CHECK_LIB(crypto, EVP_EncryptInit_ex,
44 [LIBS="-lcrypto $LIBS"],
45 [AC_MSG_ERROR([OpenSSL libraries not found.])]
48 AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex ECDH_compute_key ECDSA_verify], ,
49 [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
52 AC_CHECK_DECL([OpenSSL_add_all_algorithms], ,
53 [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
54 [#include <openssl/evp.h>]