mirror of https://gitee.com/bigwinds/arangodb
144 lines
4.4 KiB
Plaintext
144 lines
4.4 KiB
Plaintext
dnl -*- mode: Autoconf; -*-
|
|
|
|
dnl -----------------------------------------------------------------------------------------
|
|
dnl option for SSL support
|
|
dnl -----------------------------------------------------------------------------------------
|
|
|
|
AC_ARG_ENABLE(ssl,
|
|
AC_HELP_STRING([--enable-ssl], [enable ssl support (default: yes)]),
|
|
|
|
if test "$enableval" = "yes"; then
|
|
tr_OPENSSL="yes";
|
|
else
|
|
tr_OPENSSL="no";
|
|
fi,
|
|
tr_OPENSSL="yes"
|
|
)
|
|
|
|
AC_ARG_WITH(openssl-inc,
|
|
AS_HELP_STRING([--with-openssl-inc=DIR], [where the OpenSSL header files are located]),
|
|
OPENSSL_CPPFLAGS="-I$withval"
|
|
)
|
|
|
|
AC_ARG_WITH(openssl-lib,
|
|
AS_HELP_STRING([--with-openssl-lib=DIR], [where the OpenSSL library files are located]),
|
|
OPENSSL_LDFLAGS="-L$withval"
|
|
)
|
|
|
|
TR_STATIC_ENABLE([ssl])
|
|
|
|
dnl -----------------------------------------------------------------------------------------
|
|
dnl save flags
|
|
dnl -----------------------------------------------------------------------------------------
|
|
|
|
SAVE_CPPFLAGS="$CPPFLAGS"
|
|
CPPFLAGS="$CPPFLAGS $OPENSSL_CPPFLAGS"
|
|
|
|
SAVE_LDFLAGS="$LDFLAGS"
|
|
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
|
|
|
|
SAVE_LIBS="$LIBS"
|
|
|
|
dnl -----------------------------------------------------------------------------------------
|
|
dnl check for OpenSSL
|
|
dnl -----------------------------------------------------------------------------------------
|
|
|
|
if test "$tr_OPENSSL" = "yes"; then
|
|
AC_CHECK_HEADERS([openssl/ssl.h])
|
|
|
|
AC_CHECK_LIB([crypto], [CRYPTO_get_ex_data],
|
|
OPENSSL_LIBS="-lcrypto $OPENSSL_LIBS",
|
|
AC_MSG_ERROR([please install the OpenSSL library]))
|
|
|
|
LIBS="$LIBS $OPENSSL_LIBS"
|
|
|
|
AC_CHECK_LIB([ssl], [SSL_get_error],
|
|
OPENSSL_LIBS="-lssl $OPENSSL_LIBS",
|
|
AC_MSG_ERROR([Please install the OpenSSL library]))
|
|
|
|
# LIBS contains -ldl, so it must come after OPENSSL_LIBS
|
|
LIBS="$OPENSSL_LIBS $LIBS"
|
|
|
|
dnl check if SSLv23_method returns a const method
|
|
AC_MSG_CHECKING([return type of SSLv23_method])
|
|
AC_TRY_COMPILE([#include <openssl/ssl.h>],
|
|
[SSL_METHOD* meth = SSLv23_method();],
|
|
tr_OPENSSL_NEEDS_CONST=no,
|
|
tr_OPENSSL_NEEDS_CONST=yes)
|
|
|
|
if test "x$tr_OPENSSL_NEEDS_CONST" = "xyes"; then
|
|
AC_MSG_RESULT([SSL_METHOD const*])
|
|
AC_DEFINE_UNQUOTED(OPENSSL_NEEDS_CONST, 1, [true if SSLv23_method return SSL_METHOD const*])
|
|
else
|
|
AC_MSG_RESULT([SSL_METHOD*])
|
|
fi
|
|
|
|
dnl check if openssl was compiled using zlib
|
|
if test "x$tr_STATIC_PROGRAMS" = xyes; then
|
|
LDFLAGS="$LDFLAGS $lt_prog_compiler_static"
|
|
|
|
AC_MSG_CHECKING([if OpenSSL requires static zlib])
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM(
|
|
[[
|
|
#include <openssl/ssl.h>
|
|
]],
|
|
[[
|
|
SSL_library_init();
|
|
]])],
|
|
[tr_OPENSSL_NEEDS_ZLIB=no],
|
|
[tr_OPENSSL_NEEDS_ZLIB=yes])
|
|
|
|
AC_MSG_RESULT($tr_OPENSSL_NEEDS_ZLIB)
|
|
|
|
if test "x$tr_OPENSSL_NEEDS_ZLIB" = "xyes"; then
|
|
AC_CHECK_LIB([z], [zError],
|
|
OPENSSL_LIBS="$OPENSSL_LIBS -lz",
|
|
AC_MSG_ERROR([please install the static zlib library]))
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if test "x$tr_OPENSSL" = xyes; then
|
|
TR_ABSOLUTE_LIBRARIES([ssl], [OPENSSL_LIBS])
|
|
|
|
if test "x$tr_libraries_found" != xyes; then
|
|
AC_MSG_ERROR([Please install the OpenSSL library])
|
|
fi
|
|
fi
|
|
|
|
dnl -----------------------------------------------------------------------------------------
|
|
dnl fix include and static libraries
|
|
dnl -----------------------------------------------------------------------------------------
|
|
|
|
TR_INCLUDE([OPENSSL_CPPFLAGS])
|
|
TR_STATIC_LIBRARY([ssl], [OPENSSL_LIBS])
|
|
|
|
dnl -----------------------------------------------------------------------------------------
|
|
dnl add substitutions
|
|
dnl -----------------------------------------------------------------------------------------
|
|
|
|
AM_CONDITIONAL(ENABLE_OPENSSL, test "x$tr_OPENSSL" = "xyes")
|
|
|
|
AC_SUBST(OPENSSL_CPPFLAGS)
|
|
AC_SUBST(OPENSSL_LDFLAGS)
|
|
AC_SUBST(OPENSSL_LIBS)
|
|
|
|
dnl -----------------------------------------------------------------------------------------
|
|
dnl restore flags
|
|
dnl -----------------------------------------------------------------------------------------
|
|
|
|
LDFLAGS="$SAVE_LDFLAGS"
|
|
CPPFLAGS="$SAVE_CPPFLAGS"
|
|
LIBS="$SAVE_LIBS"
|
|
|
|
dnl -----------------------------------------------------------------------------------------
|
|
dnl informational output
|
|
dnl -----------------------------------------------------------------------------------------
|
|
|
|
if test "x$tr_OPENSSL" = xyes; then
|
|
FLAG_INFO="$FLAG_INFO|OPENSSL_CPPFLAGS: ${OPENSSL_CPPFLAGS}"
|
|
FLAG_INFO="$FLAG_INFO|OPENSSL_LDFLAGS: ${OPENSSL_LDFLAGS}"
|
|
FLAG_INFO="$FLAG_INFO|OPENSSL_LIBS: ${OPENSSL_LIBS}"
|
|
fi
|