This is an automated email from the ASF dual-hosted git repository.

tillt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 4df2b62  Made openssl configuration in 'configure.ac' occur earlier.
4df2b62 is described below

commit 4df2b628ec7a0e891ea2d20b7b273a6091125f5f
Author: Benno Evers <[email protected]>
AuthorDate: Fri Jul 19 15:50:02 2019 +0200

    Made openssl configuration in 'configure.ac' occur earlier.
    
    The `AC_CHECK_LIBS()` call has a side effect of adding the
    found libraries to the linker command line by default. In
    addition, our custom configuration code also adds any
    non-default include and library search paths to `LDFLAGS`
    and `CPPFLAGS`.
    
    Since many of our third-party dependencies depend themselves
    on openssl, the configuration check for openssl should be
    early during the configuration so that later libraries can
    be built against the same version of openssl that is used
    for the Mesos build itself.
    
    According to the instructions given at
    
      https://www.gnu.org/software/autoconf/manual/autoconf-2.67
                                                /html_node/Libraries.html
    
    reordering the calls to `AC_CHECK_LIB()` is a preferrable solution
    to passing in `-lssl -lcrypto` as the `other-libraries` argument.
    
    Review: https://reviews.apache.org/r/71123/
---
 configure.ac | 128 ++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 65 insertions(+), 63 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4635bb3..0e3058c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -854,6 +854,71 @@ else
   AC_CHECK_LIB(unwind, backtrace, LIBS="$LIBS -lunwind")
 fi
 
+
+# Check if libssl prefix path was provided, and if so, add it to
+# the CPPFLAGS and LDFLAGS with respective /include and /lib path
+# suffixes.
+if test -z "`echo $with_ssl`" &&
+   test "$OS_NAME" = "darwin" &&
+   test -n "`command -v brew`" &&
+   test -n "`brew list --versions openssl`"; then
+  with_ssl=`brew --prefix openssl`
+fi
+
+if test -n "`echo $with_ssl`"; then
+  SSL_CPPFLAGS="-I${with_ssl}/include"
+  SSL_LINKERFLAGS="-L${with_ssl}/lib"
+
+  CPPFLAGS="$SSL_CPPFLAGS $CPPFLAGS"
+  LDFLAGS="$SSL_LINKERFLAGS $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
+  if test "x$found_ssl" != "xyes"; then
+    AC_MSG_ERROR([cannot find libssl
+-------------------------------------------------------------------
+libssl is required for an SSL-enabled build.
+-------------------------------------------------------------------
+    ])
+  fi
+
+  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
+    if test "x$with_bundled_libevent" != "xyes"; then
+      MESOS_HAVE_LIBEVENT()
+      MESOS_HAVE_LIBEVENT_SSL()
+    fi
+  else
+    AC_MSG_ERROR([SSL is currently only supported with libevent])
+  fi
+  AC_DEFINE([USE_SSL_SOCKET], [1])
+fi
+
+AM_CONDITIONAL([ENABLE_SSL],
+               [test "x$enable_ssl" = "xyes"])
+
+AC_SUBST([SSL_CPPFLAGS])
+AC_SUBST([SSL_LINKERFLAGS])
+
+
 # Check if gflags are present. If so, make sure we link against them
 # when building the Python module.
 AC_CHECK_LIB([gflags],
@@ -2029,69 +2094,6 @@ We need CRAM-MD5 support for SASL authentication.
 -------------------------------------------------------------------])])
 
 
-# Check if libssl prefix path was provided, and if so, add it to
-# the CPPFLAGS and LDFLAGS with respective /include and /lib path
-# suffixes.
-if test -z "`echo $with_ssl`" &&
-   test "$OS_NAME" = "darwin" &&
-   test -n "`command -v brew`" &&
-   test -n "`brew list --versions openssl`"; then
-  with_ssl=`brew --prefix openssl`
-fi
-
-if test -n "`echo $with_ssl`"; then
-  SSL_CPPFLAGS="-I${with_ssl}/include"
-  SSL_LINKERFLAGS="-L${with_ssl}/lib"
-
-  CPPFLAGS="$SSL_CPPFLAGS $CPPFLAGS"
-  LDFLAGS="$SSL_LINKERFLAGS $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
-  if test "x$found_ssl" != "xyes"; then
-    AC_MSG_ERROR([cannot find libssl
--------------------------------------------------------------------
-libssl is required for an SSL-enabled build.
--------------------------------------------------------------------
-    ])
-  fi
-
-  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
-    if test "x$with_bundled_libevent" != "xyes"; then
-      MESOS_HAVE_LIBEVENT_SSL()
-    fi
-  else
-    AC_MSG_ERROR([SSL is currently only supported with libevent])
-  fi
-  AC_DEFINE([USE_SSL_SOCKET], [1])
-fi
-
-AM_CONDITIONAL([ENABLE_SSL],
-               [test "x$enable_ssl" = "xyes"])
-
-AC_SUBST([SSL_CPPFLAGS])
-AC_SUBST([SSL_LINKERFLAGS])
-
-
 # Check if user has asked us to use a preinstalled stout, or if
 # they asked us to ignore all bundled libraries while compiling and
 # linking.

Reply via email to