Removed `--disable-zlib` and fixed `--with-zlib` for Mesos.

For third-party libraries that does not support `--with-zlib=DIR`, we
introduce new variables `ZLIB_CPPFLAGS` and `ZLIB_LINKERFLAGS` so that
they can be used to set up `CPPFLAGS` and `LDFLAGS` when building those
libraries.

Review: https://reviews.apache.org/r/61508


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/30914ea9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/30914ea9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/30914ea9

Branch: refs/heads/master
Commit: 30914ea9445e2ec3eb48e2daad814accca8f404c
Parents: b9e27f2
Author: Chun-Hung Hsiao <chhs...@mesosphere.io>
Authored: Tue Aug 8 13:39:33 2017 -0700
Committer: Jie Yu <yujie....@gmail.com>
Committed: Thu Aug 10 16:53:15 2017 -0700

----------------------------------------------------------------------
 3rdparty/Makefile.am | 15 +++++++++++++--
 configure.ac         | 42 ++++++++++++++++++------------------------
 2 files changed, 31 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/30914ea9/3rdparty/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/Makefile.am b/3rdparty/Makefile.am
index ce32885..742b8bf 100644
--- a/3rdparty/Makefile.am
+++ b/3rdparty/Makefile.am
@@ -37,6 +37,10 @@ CONFIGURE_ARGS = @CONFIGURE_ARGS@ --enable-shared=no 
--with-pic --srcdir=.
 #   `make install DESTDIR=${MESOS-PREFIX}/lib/mesos/3rdparty install`
 CONFIGURE_ARGS += --prefix=/
 
+# Set up building flags for non-bundled libraries.
+ZLIB_INCLUDE_FLAGS = @ZLIB_CPPFLAGS@
+ZLIB_LINKER_FLAGS = @ZLIB_LINKERFLAGS@
+
 # Directory where bundled 3rdparty module dependencies are installed.
 pkg3rdpartydir = $(pkglibdir)/3rdparty
 
@@ -263,9 +267,16 @@ endif
 if WITH_BUNDLED_PROTOBUF
 $(PROTOBUF)/src/protoc $(PROTOBUF)/src/libprotobuf.la: $(PROTOBUF)-build-stamp
 
+# NOTE: The `--with-zlib` flag works differently between Mesos and
+# Protobuf. Protobuf uses `--with-zlib` as an on/off switch for data
+# compression instead of a path specifier for ZLib, so we need to set up
+# the `CPPFLAGS` and `LDFLAGS` if `--with-zlib=DIR` is given.
 $(PROTOBUF)-build-stamp: $(PROTOBUF)-stamp
-       cd $(PROTOBUF) && ./configure $(CONFIGURE_ARGS) && \
-        $(MAKE) $(AM_MAKEFLAGS)
+       cd $(PROTOBUF) &&                               \
+         ./configure $(CONFIGURE_ARGS)                 \
+                     CPPFLAGS="$(ZLIB_INCLUDE_FLAGS)"  \
+                     LDFLAGS="$(ZLIB_LINKER_FLAGS)" && \
+         $(MAKE) $(AM_MAKEFLAGS)
        touch $@
 ALL_LOCAL += $(PROTOBUF)/src/libprotobuf.la
 ALL_LOCAL += $(PROTOBUF)/src/protoc

http://git-wip-us.apache.org/repos/asf/mesos/blob/30914ea9/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 307f0ae..08f4339 100644
--- a/configure.ac
+++ b/configure.ac
@@ -273,12 +273,6 @@ AC_ARG_ENABLE([xfs-disk-isolator],
                              [builds the XFS disk isolator]),
               [], [enable_xfs_disk_isolator=no])
 
-AC_ARG_ENABLE([zlib],
-            AS_HELP_STRING([--disable-zlib],
-                           [disables zlib compression, which means the webui
-                           will be far less responsive; not recommended]),
-            [], [enable_zlib=yes])
-
 AC_ARG_ENABLE([parallel_test_execution],
               AS_HELP_STRING([--enable-parallel-test-execution],
                              [execute tests in parallel where possible]))
@@ -705,13 +699,6 @@ else
   GFLAGS_LIBS=""
 fi
 
-AC_CHECK_LIB([z], [gzread], [],
-             [AC_MSG_ERROR([cannot find libz
--------------------------------------------------------------------
-libz is required for mesos to build.
--------------------------------------------------------------------
-])])
-
 AC_CHECK_TOOL([PATCHCOMMAND_TEST], [patch], [], [$PATH])
 if test -z "`echo $PATCHCOMMAND_TEST`"; then
     AC_MSG_ERROR([patch command not found in PATH])
@@ -1913,21 +1900,28 @@ AM_CONDITIONAL([ENABLE_XFS_DISK_ISOLATOR], [test 
"x$enable_xfs_disk_isolator" =
 # the CPPFLAGS and LDFLAGS with respective /include and /lib path
 # suffixes.
 if test -n "`echo $with_zlib`" ; then
-    CPPFLAGS="-isystem ${with_zlib}/include $CPPFLAGS"
-    LDFLAGS="-L${with_zlib}/lib $LDFLAGS"
+  ZLIB_CPPFLAGS="-isystem ${with_zlib}/include"
+  ZLIB_LINKERFLAGS="-L${with_zlib}/lib"
+
+  CPPFLAGS="$ZLIB_CPPFLAGS $CPPFLAGS"
+  LDFLAGS="$ZLIB_LINKERFLAGS $LDFLAGS"
 fi
 
-# Check if we should/can build with libz.
-if test "x$enable_zlib" = "xyes"; then
-  AC_CHECK_LIB([z], [deflate, gzread, gzwrite, inflate], [],
-               [AC_MSG_ERROR([cannot find libz
+AC_CHECK_HEADERS([zlib.h],
+                 [AC_CHECK_LIB([z], [deflate, gzread, gzwrite, inflate], [],
+                               [AC_MSG_ERROR([cannot find libz
 -------------------------------------------------------------------
-This means HTTP responses will be slower because we cannot use
-compression; you probably want to download and install zlib, but
-you can get away without it by doing --disable-zlib.
+libz is required for Mesos to build.
 -------------------------------------------------------------------
-  ])])
-fi
+                               ])])],
+                 [AC_MSG_ERROR([cannot find libz headers
+-------------------------------------------------------------------
+libz headers are required for Mesos to build.
+-------------------------------------------------------------------
+                 ])])
+
+AC_SUBST([ZLIB_CPPFLAGS])
+AC_SUBST([ZLIB_LINKERFLAGS])
 
 
 # Check if ZooKeeper prefix path was supplied and if so, add it to

Reply via email to