You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ts...@apache.org on 2014/08/06 23:26:27 UTC

git commit: MESOS-1170 Unbundle glog

Repository: mesos
Updated Branches:
  refs/heads/master b4bd08693 -> 53401fdfa


MESOS-1170 Unbundle glog

Enable mesos to build against the system installed version of glog.

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


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

Branch: refs/heads/master
Commit: 53401fdfa4b1adf3e447b3338ff1b9e604e0aea2
Parents: b4bd086
Author: Timothy St. Clair <ts...@redhat.com>
Authored: Wed Aug 6 16:22:34 2014 -0500
Committer: Timothy St. Clair <ts...@redhat.com>
Committed: Wed Aug 6 16:26:16 2014 -0500

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/Makefile.am | 18 +++++++++---
 3rdparty/libprocess/Makefile.am          | 12 ++++++--
 3rdparty/libprocess/configure.ac         | 41 +++++++++++++++++++++++++++
 configure.ac                             | 41 +++++++++++++++++++++++++++
 src/Makefile.am                          | 10 ++++++-
 src/python/native/ext_modules.py.in      |  9 ++++--
 6 files changed, 121 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/53401fdf/3rdparty/libprocess/3rdparty/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/Makefile.am b/3rdparty/libprocess/3rdparty/Makefile.am
index 705d19c..497d038 100644
--- a/3rdparty/libprocess/3rdparty/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/Makefile.am
@@ -95,7 +95,7 @@ BUILT_SOURCES += $(nodist_libgmock_la_SOURCES)
 $(GMOCK)/src/gmock-all.cc: $(GMOCK)-stamp
 $(GTEST)/src/gtest-all.cc: $(GMOCK)-stamp
 
-
+if WITH_BUNDLED_GLOG
 # NOTE: We explicitely set GTEST_CONFIG=no so that we don't attempt to
 # build glog against a system installed gtest (there's no reason to
 # "test" glog and it's highly likely it will cause a compilation bug
@@ -103,6 +103,7 @@ $(GTEST)/src/gtest-all.cc: $(GMOCK)-stamp
 $(GLOG)/libglog.la: $(GLOG)-stamp
 	cd $(GLOG) && ./configure GTEST_CONFIG=no $(CONFIGURE_ARGS) && \
           $(MAKE) $(AM_MAKEFLAGS)
+endif
 
 if HAS_GPERFTOOLS
 $(GPERFTOOLS)/libprofiler.la: $(GPERFTOOLS)-build-stamp
@@ -169,7 +170,6 @@ endif
 
 stout_tests_CPPFLAGS =				\
   -I$(srcdir)/$(STOUT)/include			\
-  -I$(GLOG)/src					\
   -I$(GTEST)/include				\
   -I$(GMOCK)/include				\
   -I$(PROTOBUF)/src				\
@@ -183,10 +183,17 @@ if WITH_BUNDLED_PICOJSON
   stout_tests_CPPFLAGS += -I$(PICOJSON)
 endif
 
+if WITH_BUNDLED_GLOG
+  stout_tests_CPPFLAGS += -I$(GLOG)/src
+  LIBGLOG = $(GLOG)/libglog.la
+else
+  LIBGLOG = -lglog
+endif
+
 stout_tests_LDADD =			\
   libgmock.la				\
-  $(GLOG)/libglog.la			\
   $(PROTOBUF)/src/libprotobuf.la	\
+  $(LIBGLOG)				\
   -ldl
 
 # We use a check-local target for now to avoid the parallel test
@@ -199,7 +206,6 @@ check-local: stout-tests
 # Dependencies for all-local.
 ALL_LOCAL =				\
   $(STOUT)/Makefile			\
-  $(GLOG)/libglog.la			\
   $(PROTOBUF)/src/libprotobuf.la	\
   $(PROTOBUF)/src/protoc
 
@@ -215,6 +221,10 @@ if WITH_BUNDLED_PICOJSON
   ALL_LOCAL += $(PICOJSON)-stamp
 endif
 
+if WITH_BUNDLED_GLOG
+  ALL_LOCAL += $(LIBGLOG)
+endif
+
 if HAS_GPERFTOOLS
  ALL_LOCAL += $(GPERFTOOLS)/libprofiler.la
 endif

http://git-wip-us.apache.org/repos/asf/mesos/blob/53401fdf/3rdparty/libprocess/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/Makefile.am b/3rdparty/libprocess/Makefile.am
index 583f6ef..edbe54b 100644
--- a/3rdparty/libprocess/Makefile.am
+++ b/3rdparty/libprocess/Makefile.am
@@ -48,11 +48,17 @@ libprocess_la_CPPFLAGS =		\
   -I$(srcdir)/include			\
   -I$(srcdir)/$(STOUT)/include		\
   -I$(BOOST)				\
-  -I$(GLOG)/src				\
   -I$(LIBEV)				\
   -I$(PICOJSON)				\
   $(AM_CPPFLAGS)
 
+if WITH_BUNDLED_GLOG
+  libprocess_la_CPPFLAGS += -I$(GLOG)/src
+  LIBGLOG = $(GLOG)/libglog.la
+else
+  LIBGLOG = -lglog
+endif
+
 if WITH_BUNDLED_HTTP_PARSER
   RY_HTTP_PARSER = 3rdparty/ry-http-parser-$(RY_HTTP_PARSER_VERSION)
   libprocess_la_CPPFLAGS += -I$(RY_HTTP_PARSER)
@@ -69,7 +75,7 @@ else
 endif
 
 libprocess_la_LIBADD =			\
-  $(GLOG)/libglog.la			\
+  $(LIBGLOG)				\
   $(HTTP_PARSER_LIB)			\
   $(LIBEV_LIB)
 
@@ -110,7 +116,7 @@ tests_CPPFLAGS =			\
 tests_LDADD =				\
   3rdparty/libgmock.la			\
   libprocess.la				\
-  $(GLOG)/libglog.la			\
+  $(LIBGLOG)				\
   $(HTTP_PARSER_LIB)			\
   $(LIBEV_LIB)
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/53401fdf/3rdparty/libprocess/configure.ac
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/configure.ac b/3rdparty/libprocess/configure.ac
index 3a38b04..7b39e63 100644
--- a/3rdparty/libprocess/configure.ac
+++ b/3rdparty/libprocess/configure.ac
@@ -92,6 +92,13 @@ AC_ARG_WITH([libev],
                            location prefixed by the given path]),
             [without_bundled_libev=yes], [])
 
+AC_ARG_WITH([glog],
+        AS_HELP_STRING([--with-glog@<:@=DIR@:>@],
+                   [excludes building and using the bundled glog
+                   package in lieu of an installed version at a
+                   location prefixed by the given path]),
+        [without_bundled_glog=yes], [])
+
 AC_ARG_WITH([http-parser],
             AS_HELP_STRING([--with-http-parser@<:@=DIR@:>@],
                            [excludes building and using the bundled http-parser
@@ -142,6 +149,11 @@ if test -n "`echo $with_picojson`"; then
   CPPFLAGS="$CPPFLAGS -I${with_picojson}/include"
 fi
 
+if test -n "`echo $with_glog`"; then
+  CPPFLAGS="$CPPFLAGS -I${with_glog}/src"
+  LDFLAGS="$LDFLAGS -L${with_glog}/lib"
+fi
+
 if test -n "`echo $with_http-parser`"; then
   CPPFLAGS="$CPPFLAGS -I${with_http-parser}/include"
 fi
@@ -229,6 +241,35 @@ fi
 AM_CONDITIONAL([WITH_BUNDLED_PICOJSON], [test "x$with_bundled_picojson" = "xyes"])
 
 
+# Check if user has asked us to use a preinstalled glog, or if they asked
+# us to ignore all bundled libraries while compiling and linking.
+if test "x$without_bundled_glog" = "xyes" || \
+   test "x$enable_bundled" != "xyes"; then
+  # Check if headers and library were located.
+  AC_CHECK_HEADERS([glog/logging.h],
+                   [AC_CHECK_LIB([glog],
+                                 [_init],
+                                 [found_glog=yes])])
+  if test "x$found_glog" = "xyes"; then
+    with_bundled_glog=no
+  else
+    AC_MSG_ERROR([cannot find glog
+-------------------------------------------------------------------
+You have requested the use of a non-bundled glog but no suitable
+glog could be found.
+
+You may want specify the location of glog by providing a prefix
+path via --with-glog=DIR, or check that the path you provided is
+correct if you're already doing this.
+-------------------------------------------------------------------
+])
+  fi
+else
+  with_bundled_glog=yes
+fi
+
+AM_CONDITIONAL([WITH_BUNDLED_GLOG], [test "x$with_bundled_glog" = "xyes"])
+
 # Check if user has asked us to use a preinstalled http-parser, or if they asked
 # us to ignore all bundled libraries while compiling and linking.
 if test "x$without_bundled_http_parse" = "xyes" || \

http://git-wip-us.apache.org/repos/asf/mesos/blob/53401fdf/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index a9cc6df..8fb0a3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,6 +158,13 @@ AC_ARG_WITH([leveldb],
 			   location prefixed by the given path]),
 	    [without_bundled_leveldb=yes], [])
 
+AC_ARG_WITH([glog],
+        AS_HELP_STRING([--with-glog@<:@=DIR@:>@],
+                   [excludes building and using the bundled glog
+                   package in lieu of an installed version at a
+                   location prefixed by the given path]),
+        [without_bundled_glog=yes], [])
+
 AC_ARG_WITH([cxx11],
 	    AS_HELP_STRING([--without-cxx11],
                            [builds Mesos without C++11 support (deprecated)]),
@@ -240,6 +247,11 @@ elif test "x$enable_bundled" = "xno"; then
   CPPFLAGS="$CPPFLAGS -I/usr/include/zookeeper"
 fi
 
+if test -n "`echo $with_glog`"; then
+  CPPFLAGS="$CPPFLAGS -I${with_glog}/src"
+  LDFLAGS="$LDFLAGS -L${with_glog}/lib"
+fi
+
 # Check if user has asked us to use a preinstalled LevelDB, or if they asked
 # us to ignore all bundled libraries while compiling and linking.
 if test "x$without_bundled_leveldb" = "xyes" || \
@@ -267,6 +279,35 @@ else
   with_bundled_leveldb=yes
 fi
 
+# Check if user has asked us to use a preinstalled glog, or if they asked
+# us to ignore all bundled libraries while compiling and linking.
+if test "x$without_bundled_glog" = "xyes" || \
+   test "x$enable_bundled" != "xyes"; then
+  # Check if headers and library were located.
+  AC_CHECK_HEADERS([glog/logging.h],
+                   [AC_CHECK_LIB([glog],
+                                 [_init],
+                                 [found_glog=yes])])
+  if test "x$found_glog" = "xyes"; then
+    with_bundled_glog=no
+  else
+    AC_MSG_ERROR([cannot find glog
+-------------------------------------------------------------------
+You have requested the use of a non-bundled glog but no suitable
+glog could be found.
+
+You may want specify the location of glog by providing a prefix
+path via --with-glog=DIR, or check that the path you provided is
+correct if you're already doing this.
+-------------------------------------------------------------------
+])
+  fi
+else
+  with_bundled_glog=yes
+fi
+
+AM_CONDITIONAL([WITH_BUNDLED_GLOG], [test "x$with_bundled_glog" = "xyes"])
+
 AM_CONDITIONAL([WITH_BUNDLED_LEVELDB],
 	       [test "x$with_bundled_leveldb" = "xyes"])
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/53401fdf/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 405d5dd..39af036 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -92,6 +92,9 @@ MESOS_CPPFLAGS += -I../$(PICOJSON)
 MESOS_CPPFLAGS += -I../$(PROTOBUF)/src
 MESOS_CPPFLAGS += -I../$(GLOG)/src
 
+if WITH_BUNDLED_GLOG
+  MESOS_CPPFLAGS += -I../$(GLOG)/src
+endif
 
 if WITH_BUNDLED_LEVELDB
   MESOS_CPPFLAGS += -I../$(LEVELDB)/include
@@ -552,7 +555,12 @@ libmesos_la_LIBADD = libmesos_no_3rdparty.la
 # library each time. (Currently, we don't support platforms where this is not
 # possible.)
 libmesos_la_LIBADD += ../$(PROTOBUF)/src/libprotobuf.la
-libmesos_la_LIBADD += ../$(GLOG)/libglog.la
+
+if WITH_BUNDLED_GLOG
+  libmesos_la_LIBADD += ../$(GLOG)/libglog.la
+else
+  libmesos_la_LIBADD += -lglog
+endif
 
 if WITH_BUNDLED_LEVELDB
 # We need to directly include the leveldb library in order to avoid

http://git-wip-us.apache.org/repos/asf/mesos/blob/53401fdf/src/python/native/ext_modules.py.in
----------------------------------------------------------------------
diff --git a/src/python/native/ext_modules.py.in b/src/python/native/ext_modules.py.in
index a0f74b2..477e63d 100644
--- a/src/python/native/ext_modules.py.in
+++ b/src/python/native/ext_modules.py.in
@@ -65,13 +65,13 @@ LIBRARY_DIRS = []
 EXTRA_OBJECTS = [
     os.path.join(abs_top_builddir, 'src', '.libs', 'libmesos_no_3rdparty.a'),
     os.path.join(abs_top_builddir, protobuf, 'src', '.libs', 'libprotobuf.a'),
-    os.path.join(abs_top_builddir, libprocess, '.libs', 'libprocess.a'),
-    os.path.join(abs_top_builddir, glog, '.libs', 'libglog.a')
+    os.path.join(abs_top_builddir, libprocess, '.libs', 'libprocess.a')
 ]
 
 # For leveldb, we need to check for the presence of libleveldb.a, since
 # it is possible to disable leveldb inside mesos.
 libev = os.path.join(abs_top_builddir, libev, '.libs', 'libev.a')
+libglog = os.path.join(abs_top_builddir, glog, '.libs', 'libglog.a')
 libleveldb = os.path.join(abs_top_builddir, leveldb, 'libleveldb.a')
 libzookeeper = os.path.join(
     abs_top_builddir, zookeeper, '.libs', 'libzookeeper_mt.a')
@@ -91,6 +91,11 @@ if os.path.exists(libev):
 else:
     EXTRA_OBJECTS.append('-lev')
 
+if os.path.exists(libglog):
+    EXTRA_OBJECTS.append(libglog)
+else:
+    EXTRA_OBJECTS.append('-lglog')
+
 # For gperftools, we need to check for the presence of libprofiler.a, since
 # it is possible to disable perftools inside libprocess.
 libprofiler = os.path.join(