Removed `--disable-zlib` and fixed `--with-zlib` for libprocess. Added `--with-zlib` for specifying a custom zlib path. 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/61509 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7a385a46 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7a385a46 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7a385a46 Branch: refs/heads/master Commit: 7a385a464fe1b76bbd7b3009d8f043fbe0eff6f9 Parents: 30914ea Author: Chun-Hung Hsiao <[email protected]> Authored: Tue Aug 8 13:44:11 2017 -0700 Committer: Jie Yu <[email protected]> Committed: Thu Aug 10 16:53:15 2017 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/3rdparty/Makefile.am | 15 +++++++-- 3rdparty/libprocess/configure.ac | 44 ++++++++++++++++++--------- 2 files changed, 42 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/7a385a46/3rdparty/libprocess/3rdparty/Makefile.am ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/Makefile.am b/3rdparty/libprocess/3rdparty/Makefile.am index d05b6e6..103a7cf 100644 --- a/3rdparty/libprocess/3rdparty/Makefile.am +++ b/3rdparty/libprocess/3rdparty/Makefile.am @@ -24,6 +24,10 @@ BUILT_SOURCES = # Initialized to enable using +=. # '--srcdir=...' when configuring. CONFIGURE_ARGS = @CONFIGURE_ARGS@ --enable-shared=no --with-pic --srcdir=. +# Set up building flags for non-bundled libraries. +ZLIB_INCLUDE_FLAGS = @ZLIB_CPPFLAGS@ +ZLIB_LINKER_FLAGS = @ZLIB_LINKERFLAGS@ + # Directory which holds bundled dependencies BUNDLED_DIR = $(top_srcdir)/.. @@ -168,9 +172,16 @@ endif if WITH_BUNDLED_PROTOBUF $(PROTOBUF)/src/protoc $(PROTOBUF)/src/libprotobuf.la: $(PROTOBUF)-build-stamp +# NOTE: The `--with-zlib` flag works differently between libprocess 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/7a385a46/3rdparty/libprocess/configure.ac ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/configure.ac b/3rdparty/libprocess/configure.ac index 29b69b9..db45de0 100644 --- a/3rdparty/libprocess/configure.ac +++ b/3rdparty/libprocess/configure.ac @@ -138,12 +138,6 @@ AC_ARG_ENABLE([static-unimplemented], functions default: no]), [], [enable_static_unimplemented=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]) - ############################################################################### # Optional packages. @@ -242,6 +236,11 @@ AC_ARG_WITH([svn], [specify where to locate the svn-1 library]), [], []) +AC_ARG_WITH([zlib], + AS_HELP_STRING([--with-zlib=@<:@=DIR@:>@], + [specify where to locate the zlib library]), + [], []) + ############################################################################### # Miscellaneous flags/library/tool checks. @@ -1075,17 +1074,32 @@ libsubversion-1 is required for libprocess to build. ])]) -# 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 +# Check if zlib prefix path was provided, and if so, add it to +# the CPPFLAGS and LDFLAGS with respective /include and /lib path +# suffixes. +if test -n "`echo $with_zlib`" ; then + ZLIB_CPPFLAGS="-isystem ${with_zlib}/include" + ZLIB_LINKERFLAGS="-L${with_zlib}/lib" + + CPPFLAGS="$ZLIB_CPPFLAGS $CPPFLAGS" + LDFLAGS="$ZLIB_LINKERFLAGS $LDFLAGS" +fi + +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 libprocess to build. ------------------------------------------------------------------- - ])]) -fi + ])])], + [AC_MSG_ERROR([cannot find libz headers +------------------------------------------------------------------- +libz headers are required for libprocess to build. +------------------------------------------------------------------- + ])]) + +AC_SUBST([ZLIB_CPPFLAGS]) +AC_SUBST([ZLIB_LINKERFLAGS]) # Once all CXXFLAGS are completely assembled, make sure the we are not
