You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/08/10 23:55:37 UTC
[08/11] mesos git commit: Refactored OpenSSL library checks in
libprocess.
Refactored OpenSSL library checks in libprocess.
Since gRPC requires OpenSSL, we checks if libssl and libcrypto exist no
matter if the `--enable-ssl` flag is on. This enables us to have a
non-SSL-enabled libprocess build with gRPC support. Also fixed an error
that a bad linker might link a configure test with libssl unnecessarily,
which would cause a runtime failure if libssl is not in the runtime
library search path.
Review: https://reviews.apache.org/r/61517
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fa0494e3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fa0494e3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fa0494e3
Branch: refs/heads/master
Commit: fa0494e3ebadb40637c27a5581fd961060a20f93
Parents: fa8b311
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Tue Aug 8 19:17:39 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 10 16:55:06 2017 -0700
----------------------------------------------------------------------
3rdparty/libprocess/configure.ac | 37 +++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/fa0494e3/3rdparty/libprocess/configure.ac
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/configure.ac b/3rdparty/libprocess/configure.ac
index db45de0..31556f7 100644
--- a/3rdparty/libprocess/configure.ac
+++ b/3rdparty/libprocess/configure.ac
@@ -952,27 +952,33 @@ if test -n "`echo $with_ssl`"; then
LDFLAGS="-L${with_ssl}/lib $LDFLAGS"
fi
+AC_CHECK_LIB([crypto], [RAND_poll], [found_crypto=yes])
+
+AC_CHECK_HEADERS([openssl/ssl.h],
+ [AC_CHECK_LIB([ssl],
+ [SSL_CTX_new],
+ [found_ssl=yes],
+ [],
+ [-lcrypto])])
+
if test "x$enable_ssl" = "xyes"; then
- AC_CHECK_HEADERS([openssl/ssl.h],
- [AC_CHECK_LIB([ssl],
- [SSL_CTX_new],
- [],
- [AC_MSG_ERROR([cannot find libssl
--------------------------------------------------------------------
-libssl is required for an SSL-enabled build.
--------------------------------------------------------------------
- ])])],
- [AC_MSG_ERROR([cannot find libssl headers
+ if test "x$found_ssl" != "xyes"; then
+ AC_MSG_ERROR([cannot find libssl
-------------------------------------------------------------------
libssl is required for an SSL-enabled build.
-------------------------------------------------------------------
- ])])
+ ])
+ fi
- AC_CHECK_LIB([crypto], [RAND_poll], [], [AC_MSG_ERROR([cannot find libcrypto
+ if test "x$found_crypto" != "xyes"; then
+ AC_MSG_ERROR([cannot find libcrypto
-------------------------------------------------------------------
libcrypto is required for an SSL-enabled build.
-------------------------------------------------------------------
- ])])
+ ])
+ fi
+
+ LIBS="-lssl -lcrypto $LIBS"
if test "x$enable_libevent" = "xyes"; then
AC_CHECK_HEADERS([event2/bufferevent_ssl.h],
@@ -1106,6 +1112,10 @@ AC_SUBST([ZLIB_LINKERFLAGS])
# affected by libcxx undefined behavior,
# https://llvm.org/bugs/show_bug.cgi?id=28469.
AC_MSG_CHECKING([C++ standard library for undefined behaviour with selected optimization level])
+# NOTE: We clear `LIBS` here to prevent linking in libraries unrelated
+# to the test. These libraries might not be in the linker lookup paths.
+saved_LIBS="$LIBS"
+LIBS=""
AC_LANG_PUSH([C++])
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
@@ -1131,6 +1141,7 @@ AC_RUN_IFELSE([
]
)
AC_LANG_POP([C++])
+LIBS="$saved_LIBS"
# Also pass the flags to 3rdparty libraries.