Merge pull request #410 from Logan007/optOpenSsl

made openssl & zstd support optional (in configuration)
This commit is contained in:
Luca Deri 2020-09-10 20:12:41 +02:00 committed by GitHub
commit 1424d66b4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,35 +16,46 @@ fi
N2N_LIBS= N2N_LIBS=
AC_PROG_CC AC_PROG_CC
AC_CHECK_LIB([zstd], [ZSTD_compress])
if test "x$ac_cv_lib_zstd_ZSTD_compress" != xyes; then AC_ARG_WITH([zstd],
AC_MSG_RESULT(Building n2n without ZSTD support) [AS_HELP_STRING([--with-zstd],
else [enable support for zstd])],
AC_DEFINE([N2N_HAVE_ZSTD], [], [Have ZSTD support]) [],
N2N_LIBS="-lzstd ${N2N_LIBS}" [with_zstd=no])
if test "x$with_zstd" != xno; then
AC_CHECK_LIB([zstd], [ZSTD_compress])
if test "x$ac_cv_lib_zstd_ZSTD_compress" != xyes; then
AC_MSG_RESULT(Building n2n without ZSTD support)
else
AC_DEFINE([N2N_HAVE_ZSTD], [], [Have ZSTD support])
N2N_LIBS="-lzstd ${N2N_LIBS}"
fi
fi fi
AC_CHECK_LIB([crypto], [AES_cbc_encrypt]) AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl],
if test "x$ac_cv_lib_crypto_AES_cbc_encrypt" != xyes; then [enable support for OpenSSL])],
AC_MSG_RESULT(OpenSSL not present) [],
else [with_openssl=no])
AC_DEFINE([HAVE_OPENSSL_1_0], [], [OpenSSL 1.0 is present]) if test "x$with_openssl" != xno; then
N2N_LIBS="-lcrypto ${N2N_LIBS}" AC_CHECK_LIB([crypto], [AES_cbc_encrypt])
fi if test "x$ac_cv_lib_crypto_AES_cbc_encrypt" != xyes; then
AC_MSG_RESULT(OpenSSL not present)
OLD_CFLAGS="${CFLAGS}" else
OLD_LDFLAGS="${LDFLAGS}" AC_DEFINE([HAVE_OPENSSL_1_0], [], [OpenSSL 1.0 is present])
N2N_LIBS="-lcrypto ${N2N_LIBS}"
CFLAGS="${CFLAGS} -I/usr/local/opt/openssl@1.1/include" fi
LDFLAGS="${LDFLAGS} -L/usr/local/opt/openssl@1.1/lib/" OLD_CFLAGS="${CFLAGS}"
AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset]) OLD_LDFLAGS="${LDFLAGS}"
if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_reset" != xyes; then CFLAGS="${CFLAGS} -I/usr/local/opt/openssl@1.1/include"
CFLAGS="${OLD_CFLAGS}" LDFLAGS="${LDFLAGS} -L/usr/local/opt/openssl@1.1/lib/"
LDFLAGS="${OLD_LDFLAGS}" AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset])
else if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_reset" != xyes; then
AC_DEFINE([HAVE_OPENSSL_1_1], [], [OpenSSL 1.1 is present]) CFLAGS="${OLD_CFLAGS}"
LDFLAGS="${OLD_LDFLAGS}"
else
AC_DEFINE([HAVE_OPENSSL_1_1], [], [OpenSSL 1.1 is present])
fi
fi fi
AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true) AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true)