Add the Forwarding option.
[tinc] / m4 / openssl.m4
1 dnl Check to find the OpenSSL headers/libraries
2
3 AC_DEFUN([tinc_OPENSSL],
4 [
5   AC_ARG_WITH(openssl,
6     AS_HELP_STRING([--with-openssl=DIR], [OpenSSL base directory, or:]),
7     [openssl="$withval"
8      CPPFLAGS="$CPPFLAGS -I$withval/include"
9      LDFLAGS="$LDFLAGS -L$withval/lib"]
10   )
11
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"]
16   )
17
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"]
22   )
23
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,
25     [],
26     [AC_MSG_ERROR([OpenSSL header files not found.]); break]
27   )
28
29 case $host_os in
30   *mingw*)
31     AC_CHECK_LIB(crypto, SHA1_version,
32       [LIBS="$LIBS -lcrypto -lgdi32"],
33       [AC_MSG_ERROR([OpenSSL libraries not found.])]
34     )
35   ;;
36   *)
37     AC_CHECK_LIB(crypto, SHA1_version,
38       [LIBS="$LIBS -lcrypto"],
39       [AC_MSG_ERROR([OpenSSL libraries not found.])]
40     )
41
42     AC_CHECK_FUNC(dlopen,
43       [],
44       [AC_CHECK_LIB(dl, dlopen,
45         [LIBS="$LIBS -ldl"],
46         [AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
47       )]
48     )
49   ;;
50 esac
51
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],
54   )
55
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>]
59   )
60 ])