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, OPENSSL_init_crypto,
44 [LIBS="-lcrypto $LIBS"],
45 [AC_MSG_ERROR([LibreSSL/OpenSSL libraries not found.])]
48 AC_DEFINE(HAVE_OPENSSL, 1, [enable OpenSSL support])