1 dnl Check to find the OpenSSL headers/libraries
3 AC_DEFUN([tinc_OPENSSL],
6 AS_HELP_STRING([--with-openssl=DIR], [OpenSSL base directory, or:]),
8 CPPFLAGS="$CPPFLAGS -I$withval/include"
9 LDFLAGS="$LDFLAGS -L$withval/lib"]
12 AC_ARG_WITH(openssl-include,
13 AS_HELP_STRING([--with-openssl-include=DIR], [OpenSSL headers directory (without trailing /openssl)]),
14 [openssl_include="$withval"
15 CPPFLAGS="$CPPFLAGS -I$withval"]
18 AC_ARG_WITH(openssl-lib,
19 AS_HELP_STRING([--with-openssl-lib=DIR], [OpenSSL library directory]),
20 [openssl_lib="$withval"
21 LDFLAGS="$LDFLAGS -L$withval"]
24 AC_CHECK_HEADERS(openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h openssl/engine.h,
26 [AC_MSG_ERROR([OpenSSL header files not found.]); break]
31 AC_CHECK_LIB(crypto, SHA1_version,
32 [LIBS="$LIBS -lcrypto -lgdi32"],
33 [AC_MSG_ERROR([OpenSSL libraries not found.])]
37 AC_CHECK_LIB(crypto, SHA1_version,
38 [LIBS="$LIBS -lcrypto"],
39 [AC_MSG_ERROR([OpenSSL libraries not found.])]
44 [AC_CHECK_LIB(dl, dlopen,
46 [AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
52 AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex], ,
53 [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
56 AC_CHECK_DECL([OpenSSL_add_all_algorithms], ,
57 [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
58 [#include <openssl/evp.h>]