You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/01/19 22:34:05 UTC

svn commit: r1233580 [1/3] - in /incubator/mesos/trunk: ./ bin/ include/mesos/ m4/ src/ src/common/ src/config/ src/detector/ src/examples/ src/examples/java/ src/examples/python/ src/exec/ src/java/ src/java/src/org/apache/mesos/ src/jvm/ src/launcher...

Author: benh
Date: Thu Jan 19 21:34:02 2012
New Revision: 1233580

URL: http://svn.apache.org/viewvc?rev=1233580&view=rev
Log:
Revised build system to use autotools (MESOS-58).

Added:
    incubator/mesos/trunk/Makefile.am
    incubator/mesos/trunk/bin/
    incubator/mesos/trunk/bin/gdb-mesos-local.sh.in
    incubator/mesos/trunk/bin/gdb-mesos-master.sh.in
    incubator/mesos/trunk/bin/gdb-mesos-slave.sh.in
    incubator/mesos/trunk/bin/mesos-build-env.sh.in
    incubator/mesos/trunk/bin/mesos-local.sh.in
    incubator/mesos/trunk/bin/mesos-master.sh.in
    incubator/mesos/trunk/bin/mesos-slave.sh.in
    incubator/mesos/trunk/bootstrap   (with props)
    incubator/mesos/trunk/include/mesos/mesos.hpp
    incubator/mesos/trunk/m4/
    incubator/mesos/trunk/m4/acx_pthread.m4
    incubator/mesos/trunk/src/Makefile.am
    incubator/mesos/trunk/src/common/thread.hpp
    incubator/mesos/trunk/src/common/webui_utils.cpp
    incubator/mesos/trunk/src/common/webui_utils.hpp
    incubator/mesos/trunk/src/examples/java/test-exception-framework.in
    incubator/mesos/trunk/src/examples/java/test-executor.in
    incubator/mesos/trunk/src/examples/java/test-framework.in
    incubator/mesos/trunk/src/examples/java/test-multiple-executors-framework.in
    incubator/mesos/trunk/src/examples/python/test-executor.in
    incubator/mesos/trunk/src/examples/python/test-framework.in
    incubator/mesos/trunk/src/examples/test_executor.cpp
      - copied, changed from r1230293, incubator/mesos/trunk/src/examples/cpp_test_executor.cpp
    incubator/mesos/trunk/src/examples/test_framework.cpp
      - copied, changed from r1230293, incubator/mesos/trunk/src/examples/cpp_test_framework.cpp
    incubator/mesos/trunk/src/java/mesos.pom.in
      - copied, changed from r1230293, incubator/mesos/trunk/src/java/mesos.pom
    incubator/mesos/trunk/src/jvm/
    incubator/mesos/trunk/src/jvm/jvm.cpp
    incubator/mesos/trunk/src/jvm/jvm.hpp
    incubator/mesos/trunk/support/
    incubator/mesos/trunk/support/colors.sh
    incubator/mesos/trunk/third_party/protobuf-2.3.0/examples/Makefile
    incubator/mesos/trunk/third_party/protobuf-2.3.0/gtest/make/
    incubator/mesos/trunk/third_party/protobuf-2.3.0/gtest/make/Makefile
    incubator/mesos/trunk/third_party/protobuf-2.3.0/gtest/scripts/test/
    incubator/mesos/trunk/third_party/protobuf-2.3.0/gtest/scripts/test/Makefile
    incubator/mesos/trunk/third_party/protobuf-2.3.0/src/solaris/
    incubator/mesos/trunk/third_party/protobuf-2.3.0/src/solaris/libstdc++.la
Removed:
    incubator/mesos/trunk/Makefile.in
    incubator/mesos/trunk/config.guess
    incubator/mesos/trunk/config.sub
    incubator/mesos/trunk/configure
    incubator/mesos/trunk/install-sh
    incubator/mesos/trunk/src/Makefile.in
    incubator/mesos/trunk/src/examples/Makefile.in
    incubator/mesos/trunk/src/examples/cpp_test_executor.cpp
    incubator/mesos/trunk/src/examples/cpp_test_framework.cpp
    incubator/mesos/trunk/src/examples/java/Makefile.in
    incubator/mesos/trunk/src/examples/java/test_exception_framework
    incubator/mesos/trunk/src/examples/java/test_executor
    incubator/mesos/trunk/src/examples/java/test_framework
    incubator/mesos/trunk/src/examples/java/test_multiple_executors_framework
    incubator/mesos/trunk/src/examples/python/test_executor
    incubator/mesos/trunk/src/examples/python/test_framework
    incubator/mesos/trunk/src/java/mesos.pom
    incubator/mesos/trunk/src/tests/external/SampleFrameworks/CFrameworkCmdlineParsing.sh
    incubator/mesos/trunk/src/tests/external/SampleFrameworks/CFrameworkInvalidCmdline.sh
    incubator/mesos/trunk/src/tests/external/SampleFrameworks/CFrameworkInvalidEnv.sh
Modified:
    incubator/mesos/trunk/configure.ac
    incubator/mesos/trunk/src/common/process_utils.hpp
    incubator/mesos/trunk/src/config/config.hpp.in
    incubator/mesos/trunk/src/detector/detector.cpp
    incubator/mesos/trunk/src/examples/java/TestExceptionFramework.java
    incubator/mesos/trunk/src/examples/java/TestFramework.java
    incubator/mesos/trunk/src/examples/java/TestMultipleExecutorsFramework.java
    incubator/mesos/trunk/src/examples/python/test_framework.py
    incubator/mesos/trunk/src/exec/exec.cpp
    incubator/mesos/trunk/src/java/src/org/apache/mesos/MesosSchedulerDriver.java
    incubator/mesos/trunk/src/launcher/main.cpp
    incubator/mesos/trunk/src/local/main.cpp
    incubator/mesos/trunk/src/log/log.hpp
    incubator/mesos/trunk/src/log/network.hpp
    incubator/mesos/trunk/src/master/main.cpp
    incubator/mesos/trunk/src/master/slaves_manager.cpp
    incubator/mesos/trunk/src/master/webui.cpp
    incubator/mesos/trunk/src/mesos/main.cpp
    incubator/mesos/trunk/src/python/setup.py.in
    incubator/mesos/trunk/src/sched/sched.cpp
    incubator/mesos/trunk/src/slave/lxc_isolation_module.cpp
    incubator/mesos/trunk/src/slave/main.cpp
    incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp
    incubator/mesos/trunk/src/slave/webui.cpp
    incubator/mesos/trunk/src/tests/base_zookeeper_test.cpp
    incubator/mesos/trunk/src/tests/base_zookeeper_test.hpp
    incubator/mesos/trunk/src/tests/external/LxcIsolation/HoldMoreMemThanRequested.sh
    incubator/mesos/trunk/src/tests/external/LxcIsolation/ScaleUpAndDown.sh
    incubator/mesos/trunk/src/tests/external/LxcIsolation/TwoSeparateTasks.sh
    incubator/mesos/trunk/src/tests/external/LxcIsolation/run_scheduled_memhog_test.sh
    incubator/mesos/trunk/src/tests/external/SampleFrameworks/CppFramework.sh
    incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaExceptionFramework.sh
    incubator/mesos/trunk/src/tests/external/SampleFrameworks/JavaFramework.sh
    incubator/mesos/trunk/src/tests/external/SampleFrameworks/PythonFramework.sh
    incubator/mesos/trunk/src/tests/external_tests.cpp
    incubator/mesos/trunk/src/tests/main.cpp
    incubator/mesos/trunk/src/tests/sample_frameworks_tests.cpp
    incubator/mesos/trunk/src/tests/utils.cpp
    incubator/mesos/trunk/src/tests/utils.hpp
    incubator/mesos/trunk/src/tests/zookeeper_server.cpp
    incubator/mesos/trunk/src/tests/zookeeper_server.hpp
    incubator/mesos/trunk/src/webui/master/webui.py
    incubator/mesos/trunk/src/webui/slave/webui.py
    incubator/mesos/trunk/third_party/libprocess/include/process/protobuf.hpp
    incubator/mesos/trunk/third_party/protobuf-2.3.0/Makefile.in
    incubator/mesos/trunk/third_party/protobuf-2.3.0/aclocal.m4
    incubator/mesos/trunk/third_party/protobuf-2.3.0/src/Makefile.in

Added: incubator/mesos/trunk/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/Makefile.am?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/Makefile.am (added)
+++ incubator/mesos/trunk/Makefile.am Thu Jan 19 21:34:02 2012
@@ -0,0 +1,93 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+ACLOCAL_AMFLAGS = -I m4
+
+AUTOMAKE_OPTIONS = foreign
+
+# If we try and include third_party libraries as subdirs then they
+# will also try to get installed, which we don't want. Instead, we
+# build . first so that the all-local and clean-local hooks in this
+# file get run before we build anything else. This ensures third_party
+# libraries get built (and cleaned) first without worrying about them
+# getting installed.
+SUBDIRS = . src
+
+# While we don't want to install third_party, make sure we include it
+# in distributions.
+DIST_SUBDIRS = $(subdirs) src
+
+PROTOBUF = third_party/protobuf-2.3.0
+GLOG = third_party/glog-0.3.1
+GMOCK = third_party/gmock-1.6.0
+GTEST = $(GMOCK)/gtest
+ZOOKEEPER = third_party/zookeeper-3.3.1/src/c
+LIBPROCESS = third_party/libprocess
+LEVELDB = third_party/leveldb
+SETUPTOOLS = third_party/distribute-0.6.19
+
+# Build the gmock library for tests (check target).
+check_LTLIBRARIES = libgmock.la
+libgmock_la_SOURCES = $(top_srcdir)/$(GMOCK)/src/gmock-all.cc	\
+                      $(top_srcdir)/$(GTEST)/src/gtest-all.cc
+libgmock_la_CPPFLAGS = -I$(top_srcdir)/$(GTEST)/include         \
+                       -I$(top_srcdir)/$(GMOCK)/include         \
+                       -I$(top_srcdir)/$(GTEST)                 \
+                       -I$(top_srcdir)/$(GMOCK)
+
+# Since we generate several files in src/ with config.status, make
+# sure they're regenerated before we recurse into the src directory.
+all-recursive: src/config/config.hpp src/python/setup.py src/java/mesos.pom
+
+# Most of our third party libraries support VPATH builds so we can
+# simply invoke make on them provided they have been configured
+# properly in our configure.ac. Unfortunately, this is not the case
+# with leveldb, so we copy the entire directory before trying to build
+# it (ugh). Likewise, we need to copy the Python setuptools egg that
+# we ship as well.
+
+all-local:
+	@echo "Building third-party libraries"
+	@cd $(PROTOBUF) && $(MAKE) $(AM_MAKEFLAGS) all
+	@cd $(GLOG) && $(MAKE) $(AM_MAKEFLAGS) all
+if WITH_INCLUDED_ZOOKEEPER
+	@cd $(ZOOKEEPER) && $(MAKE) $(AM_MAKEFLAGS) all
+endif
+	@cd $(LIBPROCESS) && $(MAKE) $(AM_MAKEFLAGS) all
+	@test $(top_srcdir) = $(top_builddir) ||                \
+          test -d $(LEVELDB) ||                                 \
+          cp -r $(top_srcdir)/$(LEVELDB) $(LEVELDB)
+	@cd $(LEVELDB) && $(MAKE) $(AM_MAKEFLAGS) all
+	@test $(top_srcdir) = $(top_builddir) ||                \
+          test -d $(SETUPTOOLS) ||                              \
+	  cp -r $(top_srcdir)/$(SETUPTOOLS) $(SETUPTOOLS)
+
+clean-local:
+	@echo "Cleaning third-party libraries"
+	@cd $(PROTOBUF) && $(MAKE) $(AM_MAKEFLAGS) clean
+	@cd $(GLOG) && $(MAKE) $(AM_MAKEFLAGS) clean
+if WITH_INCLUDED_ZOOKEEPER
+	@cd $(ZOOKEEPER) && $(MAKE) $(AM_MAKEFLAGS) clean
+endif
+	@cd $(LIBPROCESS) && $(MAKE) $(AM_MAKEFLAGS) clean
+	@cd $(LEVELDB) && $(MAKE) $(AM_MAKEFLAGS) clean
+
+if HAS_JAVA
+maven-install:
+	@cd src && $(MAKE) $(AM_MAKEFLAGS) maven-install
+
+.PHONY: maven-install
+endif

Added: incubator/mesos/trunk/bin/gdb-mesos-local.sh.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bin/gdb-mesos-local.sh.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/bin/gdb-mesos-local.sh.in (added)
+++ incubator/mesos/trunk/bin/gdb-mesos-local.sh.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This is a wrapper for running gdb on the mesos-master before it is
+# installed that first sets up environment variables as appropriate.
+
+# Use colors for errors.
+source @abs_top_srcdir@/support/colors.sh
+
+OS=`uname`
+
+if test "${OS}" == "Darwin"; then
+    LIBTOOL=glibtool
+else
+    LIBTOOL=libtool
+fi
+
+# Confirm libtool has "gdb" support.
+${LIBTOOL} --mode=execute gdb -batch >/dev/null 2>&1
+
+if test $? != 0; then
+  echo "${RED}Failed to find a valid libtool that supports gdb${NORMAL}"
+  test "${OS}" == "Darwin" && \
+    echo "This appears to be OS X, try installing Xcode to get 'glibtool'"
+  exit 1
+fi
+
+source @abs_top_builddir@/bin/mesos-build-env.sh
+
+exec ${LIBTOOL} --mode=execute gdb --args \
+  @abs_top_builddir@/src/mesos-local "${@}"

Added: incubator/mesos/trunk/bin/gdb-mesos-master.sh.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bin/gdb-mesos-master.sh.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/bin/gdb-mesos-master.sh.in (added)
+++ incubator/mesos/trunk/bin/gdb-mesos-master.sh.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This is a wrapper for running gdb on the mesos-master before it is
+# installed that first sets up environment variables as appropriate.
+
+# Use colors for errors.
+source @abs_top_srcdir@/support/colors.sh
+
+OS=`uname`
+
+if test "${OS}" == "Darwin"; then
+    LIBTOOL=glibtool
+else
+    LIBTOOL=libtool
+fi
+
+# Confirm libtool has "gdb" support.
+${LIBTOOL} --mode=execute gdb -batch >/dev/null 2>&1
+
+if test $? != 0; then
+  echo "${RED}Failed to find a valid libtool that supports gdb${NORMAL}"
+  test "${OS}" == "Darwin" && \
+    echo "This appears to be OS X, try installing Xcode to get 'glibtool'"
+  exit 1
+fi
+
+source @abs_top_builddir@/bin/mesos-build-env.sh
+
+exec ${LIBTOOL} --mode=execute gdb --args \
+  @abs_top_builddir@/src/mesos-master "${@}"

Added: incubator/mesos/trunk/bin/gdb-mesos-slave.sh.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bin/gdb-mesos-slave.sh.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/bin/gdb-mesos-slave.sh.in (added)
+++ incubator/mesos/trunk/bin/gdb-mesos-slave.sh.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This is a wrapper for running gdb on the mesos-master before it is
+# installed that first sets up environment variables as appropriate.
+
+# Use colors for errors.
+source @abs_top_srcdir@/support/colors.sh
+
+OS=`uname`
+
+if test "${OS}" == "Darwin"; then
+    LIBTOOL=glibtool
+else
+    LIBTOOL=libtool
+fi
+
+# Confirm libtool has "gdb" support.
+${LIBTOOL} --mode=execute gdb -batch >/dev/null 2>&1
+
+if test $? != 0; then
+  echo "${RED}Failed to find a valid libtool that supports gdb${NORMAL}"
+  test "${OS}" == "Darwin" && \
+    echo "This appears to be OS X, try installing Xcode to get 'glibtool'"
+  exit 1
+fi
+
+source @abs_top_builddir@/bin/mesos-build-env.sh
+
+exec ${LIBTOOL} --mode=execute gdb --args \
+  @abs_top_builddir@/src/mesos-slave "${@}"

Added: incubator/mesos/trunk/bin/mesos-build-env.sh.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bin/mesos-build-env.sh.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/bin/mesos-build-env.sh.in (added)
+++ incubator/mesos/trunk/bin/mesos-build-env.sh.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,31 @@
+# This file is meant to be sourced.
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# It sets environment variables so Mesos will search for uninstalled
+# dependencies (such as the WebUI) rather than looking in installed locations.
+
+MESOS_WEBUI_DIR=@abs_top_srcdir@/src/webui
+MESOS_LAUNCHER_DIR=@abs_top_builddir@/src
+MESOS_LOG_DIR=${MESOS_LOG_DIR:-/var/tmp/mesos-dev-logs}
+MESOS_WORK_DIR=${MESOS_WORK_DIR:-/var/tmp/mesos-dev-work}
+MESOS_KILLTREE=@abs_top_srcdir@/src/scripts/killtree.sh
+
+export MESOS_WEBUI_DIR
+export MESOS_LAUNCHER_DIR
+export MESOS_LOG_DIR
+export MESOS_WORK_DIR

Added: incubator/mesos/trunk/bin/mesos-local.sh.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bin/mesos-local.sh.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/bin/mesos-local.sh.in (added)
+++ incubator/mesos/trunk/bin/mesos-local.sh.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This is a wrapper for running mesos-local before it is installed
+# that first sets up environment variables as appropriate.
+
+source @abs_top_builddir@/bin/mesos-build-env.sh
+
+@abs_top_builddir@/src/mesos-local "${@}"

Added: incubator/mesos/trunk/bin/mesos-master.sh.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bin/mesos-master.sh.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/bin/mesos-master.sh.in (added)
+++ incubator/mesos/trunk/bin/mesos-master.sh.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This is a wrapper for running mesos-master before it is installed
+# that first sets up environment variables as appropriate.
+
+source @abs_top_builddir@/bin/mesos-build-env.sh
+
+exec @abs_top_builddir@/src/mesos-master "${@}"

Added: incubator/mesos/trunk/bin/mesos-slave.sh.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bin/mesos-slave.sh.in?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/bin/mesos-slave.sh.in (added)
+++ incubator/mesos/trunk/bin/mesos-slave.sh.in Thu Jan 19 21:34:02 2012
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This is a wrapper for running mesos-slave before it is installed
+# that first sets up environment variables as appropriate.
+
+source @abs_top_builddir@/bin/mesos-build-env.sh
+
+@abs_top_builddir@/src/mesos-slave "${@}"

Added: incubator/mesos/trunk/bootstrap
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/bootstrap?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/bootstrap (added)
+++ incubator/mesos/trunk/bootstrap Thu Jan 19 21:34:02 2012
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+autoreconf --install -Wall --verbose --no-recursive "${@}"

Propchange: incubator/mesos/trunk/bootstrap
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/mesos/trunk/configure.ac
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/configure.ac?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/configure.ac (original)
+++ incubator/mesos/trunk/configure.ac Thu Jan 19 21:34:02 2012
@@ -5,9 +5,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,50 +18,105 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT
+AC_INIT([mesos], [0.0.1])
 
-if test -z "$PYTHON"; then
-  PYTHON=python2.6
-fi
-AC_SUBST(PYTHON)
-if test -z "$PYTHON_CONFIG"; then
-  PYTHON_CONFIG=python2.6-config
-fi
-SETUPTOOLS=third_party/distribute-0.6.19/distribute-0.6.19-py2.6.egg
-AC_SUBST(SETUPTOOLS)
+# Have autoconf setup some variables related to the system.
+AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
+AC_CANONICAL_TARGET
+
+# Initialize automake.
+AM_INIT_AUTOMAKE([-Wall -Werror silent-rules foreign])
+
+# Allow less verbose output when building.
+AM_SILENT_RULES
+
+# Initialize libtool.
+LT_PREREQ([2.2])
+LT_INIT
+LT_LANG([C++])
+
+AC_LANG(C++)
+
+AC_CONFIG_MACRO_DIR([m4])
+
+# The default CFLAGS/CXXFLAGS from autoconf when using gcd is usually
+# "-g -O2". These really slow down compiling our tests, so we turn
+# them off and enable them (where desired) directly in the
+# Makefile. Note that this should not have an impact on users setting
+# CFLAGS/CXXFLAGS directly at configure time, or when running make.
+AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
+      [CFLAGS=""])
+AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
+      [CXXFLAGS=""])
+
+# Force all third_party libraries to only build static libraries so
+# that we can produce a final shared library which includes everything
+# necessary.
+ac_configure_args_pre="$ac_configure_args"
+ac_configure_args_post="$ac_configure_args --enable-shared=no --with-pic"
+ac_configure_args="$ac_configure_args_post"
+
+# Make sure config.status doesn't get the changed configure arguments,
+# so it can rerun configure in the root directory correctly. This is
+# necessary for Makefile rules which would regenerate files (e.g.,
+# 'Makefile') after configure.ac was updated.
+AC_CONFIG_COMMANDS_PRE([ac_configure_args="$ac_configure_args_pre"])
+AC_CONFIG_COMMANDS_POST([ac_configure_args="$ac_configure_args_post"])
 
-# Update CFLAGS and CXXFLAGS with environment args.
-CFLAGS="-O2 -fno-strict-aliasing -fPIC ${CFLAGS}"
-CXXFLAGS="-O2 -fno-strict-aliasing -fPIC ${CXXFLAGS}"
-
-export CFLAGS
-export CXXFLAGS
-
-# Update CFLAGS and CXXFLAGS in configure args.
-# TODO(benh): Don't send args just for us (e.g., --with-webui).
-ac_configure_args=`echo $ac_configure_args | \
-                   sed -e "s/CFLAGS=/CFLAGS=-O2 -fno-strict-aliasing /"`
-ac_configure_args=`echo $ac_configure_args | \
-                   sed -e "s/CXXFLAGS=/CXXFLAGS=-O2 -fno-strict-aliasing /"`
-ac_configure_args="$ac_configure_args --enable-shared=no --with-pic"
-
-AC_CONFIG_FILES([Makefile
-                 src/Makefile
-                 src/examples/Makefile
-                 src/examples/java/Makefile
-                 src/examples/python/Makefile
-                 src/tests/Makefile
-                 src/config/config.hpp
-                 src/python/setup.py])
 AC_CONFIG_SUBDIRS([third_party/libprocess])
 AC_CONFIG_SUBDIRS([third_party/protobuf-2.3.0])
 AC_CONFIG_SUBDIRS([third_party/glog-0.3.1])
-AC_CONFIG_SUBDIRS([third_party/zookeeper-3.3.1/src/c])
 
-AC_CANONICAL_SYSTEM
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([src/Makefile])
+AC_CONFIG_FILES([src/config/config.hpp])
+AC_CONFIG_FILES([bin/mesos-build-env.sh])
+AC_CONFIG_FILES([bin/mesos-master.sh], [chmod +x bin/mesos-master.sh])
+AC_CONFIG_FILES([bin/mesos-slave.sh], [chmod +x bin/mesos-slave.sh])
+AC_CONFIG_FILES([bin/mesos-local.sh], [chmod +x bin/mesos-local.sh])
+AC_CONFIG_FILES([bin/gdb-mesos-master.sh], [chmod +x bin/gdb-mesos-master.sh])
+AC_CONFIG_FILES([bin/gdb-mesos-slave.sh], [chmod +x bin/gdb-mesos-slave.sh])
+AC_CONFIG_FILES([bin/gdb-mesos-local.sh], [chmod +x bin/gdb-mesos-local.sh])
+
+AC_ARG_ENABLE([java],
+              AS_HELP_STRING([--disable-java],
+                             [don't build Java bindings]),
+              [], [enable_java=yes])
+
+AC_ARG_ENABLE([python],
+              AS_HELP_STRING([--disable-python],
+                             [don't build Python bindings]),
+              [], [enable_python=yes])
+
+AC_ARG_ENABLE([webui],
+              AS_HELP_STRING([--disable-webui],
+                             [don't build webui (requires Python 2.6)]),
+              [], [enable_webui=yes])
+
+AC_ARG_WITH([included-zookeeper],
+            AS_HELP_STRING([--without-included-zookeeper],
+                           [excludes building and using the included ZooKeeper
+                           package in lieu of a system installed version (note,
+                           however, that no attempt is made to find the package
+                           and explicitly setting CPPFLAGS and LDFLAGS as
+                           appropriate may be necessary)]),
+             [], [with_included_zookeeper=yes])
+
+# TODO(benh): Support --without-included-protobuf,
+# --without-included-glog, etc. Doing this for protobuf is
+# considerably more tricky because we need to make sure that 'protoc'
+# exists, that a protobuf JAR exists or we can make one, that a
+# protobuf egg exists or we can make one, etc.
+
+AC_ARG_VAR([JAVA_HOME], [location of Java Development Kit (JDK)])
+
+AC_ARG_VAR([JAVA_CPPFLAGS], [preprocessor flags for JNI])
 
-UNSUPPORTED_OS="Mesos is currently unsupported on your platform."
+AC_ARG_VAR([JAVA_LDFLAGS], [linker flags for JNI])
 
+
+# Determine the current OS (TODO(benh): Does autotools do this for us?).
 case "${target_os}" in
   linux*)
     echo ===========================================================
@@ -75,154 +130,226 @@ case "${target_os}" in
     echo Setting up build environment for ${target_cpu} ${target_os}
     echo ===========================================================
     OS_NAME=darwin
-    CFLAGS="${CFLAGS} -D_XOPEN_SOURCE"
-    CXXFLAGS="${CXXFLAGS} -D_XOPEN_SOURCE"
+    CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
+    CXXFLAGS="$CXXFLAGS -D_XOPEN_SOURCE"
     ;;
   solaris*)
     echo ===========================================================
     echo Setting up build environment for ${target_cpu} ${target_os}
     echo ===========================================================
+    OS_NAME=solaris
     CC=gcc-4.3.2
     CXX=g++-4.3.2
-    export CC
-    export CXX
-    CFLAGS="${CFLAGS} -pthreads -march=i586"
-    CXXFLAGS="${CXXFLAGS} -pthreads -march=i586"
+    CFLAGS="$CFLAGS -pthreads -march=i586"
+    CXXFLAGS="$CXXFLAGS -pthreads -march=i586"
     LIBS="-lsocket -lnsl -lproject -lproc"
-    OS_NAME=solaris
     ;;
   *)
-    AC_MSG_ERROR($UNSUPPORTED_OS)
+    AC_MSG_ERROR("Mesos is currently unsupported on your platform.")
   esac
 
-# Export OS name to Makefiles
-AC_SUBST(OS_NAME)
+# Useful for conditionally including source files.
+AM_CONDITIONAL([OS_LINUX], [test "x$OS_NAME" = "xlinux"])
 
-JAVA_HEADERS=""
-AC_ARG_WITH([java-headers],
-  AC_HELP_STRING([--with-java-headers=DIR],
-                 [find Java headers in DIR (if different from JAVA_HOME/include)]),
-	         [case "$with_java_headers" in
-		    yes) 
-                      AC_MSG_ERROR([
-*** --with-java-headers requires an argument]) ;;
-		    *)
-                      JAVA_HEADERS="$withval"
-                      ;;
-	          esac],
-	         [])
-AC_SUBST(JAVA_HEADERS)
-
-JAVA_HOME=""
-HAS_JAVA="0"
-AC_ARG_WITH([java-home],
-  AC_HELP_STRING([--with-java-home=DIR],
-                 [find Java Development Kit in DIR]),
-	         [case "$with_java_home" in
-		    yes) 
-                      AC_MSG_ERROR([
-*** --with-java-home requires an argument]) ;;
-		    *)
-                      JAVA_HOME="$withval"
-                      HAS_JAVA="1"
-                      if test -z "$JAVA_HEADERS"; then
-                        JAVA_HEADERS="$JAVA_HOME/include/$OS_NAME"
-                      fi
-                      ;;
-	          esac],
-	         [])
-AC_SUBST(JAVA_HOME)
-AC_SUBST(HAS_JAVA)
-
-PYTHON_HEADERS=""
-PYTHON_LDFLAGS=""
-HAS_PYTHON="0"
-AC_ARG_WITH([python-headers],
-  AC_HELP_STRING([--with-python-headers=DIR],
-                 [find Python headers in DIR]),
-	         [case "$with_python_headers" in
-		    yes)
-                      AC_MSG_ERROR([
-*** --with-python-headers requires an argument]) ;;
-		    *)
-                      PYTHON_HEADERS="$withval"
-                      if test -x `which $PYTHON_CONFIG`; then
-                        echo running $PYTHON_CONFIG to find compiler flags for creating the Mesos Python library...
-                        PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
-                      else
-                        echo running $PYTHON to find compiler flags for creating the Mesos Python library...
-                        PYTHON_LDFLAGS=`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_config_var("LINKFORSHARED") + " -lpython" + sysconfig.get_config_var("VERSION")'`
-                      fi
-                      HAS_PYTHON="1"
-                      ;;
-	          esac],
-	         [])
-AC_SUBST(PYTHON_HEADERS)
-AC_SUBST(PYTHON_LDFLAGS)
-AC_SUBST(HAS_PYTHON)
-
-WITH_WEBUI="0"
-WEBUI_CFLAGS=""
-WEBUI_CXXFLAGS=""
-WEBUI_LDFLAGS=""
-AC_ARG_WITH([webui],
-  AC_HELP_STRING([--with-webui],
-                 [enable web UI (requires Python)]),
-	         [case "$with_webui" in
-		    yes) WITH_WEBUI="1"
-                         if test -x `which $PYTHON_CONFIG`; then
-                           WEBUI_CFLAGS=`$PYTHON_CONFIG --includes`
-                           WEBUI_LDFLAGS=`$PYTHON_CONFIG --ldflags`
-                         else
-                           echo running $PYTHON to find compiler flags for embedding it...
-                           WEBUI_CFLAGS=`$PYTHON -c 'from distutils import sysconfig; print "-I" + sysconfig.get_config_var("INCLUDEPY")'`
-                           WEBUI_LDFLAGS=`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_config_var("LINKFORSHARED") + " -lpython" + sysconfig.get_config_var("VERSION")'`
-                         fi
-                         WEBUI_CXXFLAGS=$WEBUI_CFLAGS
-                         if [[ "$?" -ne "0" ]]; then
-                           AC_MSG_ERROR([
-*** Failed to determine compiler flags for embedding Python, needed by web UI.
-*** Check that you have Python 2.6 development packages installed.])
-                         fi ;;
-                    no) WITH_WEBUI="0" ;;
-		    *) AC_MSG_ERROR([
-*** --with-webui does not take arguments]) ;;
-	          esac],
-	         [])
-AC_SUBST(WITH_WEBUI)
-AC_SUBST(WEBUI_CFLAGS)
-AC_SUBST(WEBUI_CXXFLAGS)
-AC_SUBST(WEBUI_LDFLAGS)
-
-WITH_ZOOKEEPER="0"
-AC_ARG_WITH([zookeeper],
-  AC_HELP_STRING([--with-zookeeper],
-                 [use ZooKeeper support]),
-	         [case "$with_zookeeper" in
-		    yes) WITH_ZOOKEEPER="1" ;;
-                    no) WITH_ZOOKEEPER="0" ;;
-		    *) AC_MSG_ERROR([
-*** --with-zookeeper does not take arguments]) ;;
-	          esac],
-	         [])
-AC_SUBST(WITH_ZOOKEEPER)
+# TODO(benh): Consider using AS_IF instead of just shell 'if'
+# statements for better autoconf style (the AS_IF macros also make
+# sure variable dependencies are handled appropriately).
+
+# Perform necessary configuration for building with Java.
+if test "x$enable_java" = "xyes"; then
+  # First let's try and determine JAVA_HOME if it hasn't been set. We
+  # do this by checking to see if the directory found at the
+  # 'java.home' system property for the java found on the path
+  # includes javac. If so, then we'll guess that this is a JDK
+  # installation rather than a JRE installation.
+  if test -z "$JAVA_HOME"; then
+    AC_PATH_PROG([JAVAC], [javac], [$JAVAC])
+    AC_PATH_PROG([JAVA], [java], [$JAVA])
+
+    if test "x$JAVA" = "x" || test "x$JAVAC" = "x"; then
+      AC_MSG_ERROR([can not guess JAVA_HOME (no 'java' or 'javac' found)])
+    fi
+
+    AC_MSG_CHECKING([value of Java system property 'java.home'])
+    cat <<__EOF__ >conftest.java [
+public class conftest {
+  public static void main(String[] args) {
+    System.out.print(System.getProperty("java.home"));
+  }
+}]
+__EOF__
+
+    # Now build and run the code.
+    $JAVAC conftest.java && JAVA_DOT_HOME="`$JAVA -cp . conftest`"
+
+    if test $? = 0 && test ! -z "$JAVA_DOT_HOME"; then
+      AC_MSG_RESULT($JAVA_DOT_HOME)
+    else
+      JAVA_DOT_HOME=""
+      AC_MSG_RESULT([not found])
+    fi
+
+    # Clean up after ourselves.
+    rm -f conftest.java conftest.class
+
+    # Check if 'java.home' looks like a JDK installation, or if
+    # 'java.home'/.. looks like a JDK installation (e.g., Linux).
+    if test -f $JAVA_DOT_HOME/bin/javac; then
+      JAVA_HOME=$JAVA_DOT_HOME
+    elif test -f `dirname $JAVA_DOT_HOME`/bin/javac; then
+      JAVA_HOME=`dirname $JAVA_DOT_HOME`
+    fi
+
+    if test -z "$JAVA_HOME"; then
+      AC_MSG_ERROR([could not guess JAVA_HOME])
+    else
+      AC_MSG_NOTICE([using JAVA_HOME=$JAVA_HOME])
+    fi
+  fi
+
+  # Determine preprocessor flags for Java if not set.
+  if test -z "$JAVA_CPPFLAGS"; then
+    JAVA_CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/$OS_NAME"
+  fi
+
+  # Determine linker flags for Java if not set.
+  if test -z "$JAVA_LDFLAGS"; then
+    if test "$OS_NAME" = "darwin"; then
+      JAVA_LDFLAGS="-framework JavaVM"
+    elif test "$OS_NAME" = "linux"; then
+      JAVA_LDFLAGS=""
+      for arch in amd64 i386; do
+        if test -e "$JAVA_HOME/jre/lib/$arch"; then
+          JAVA_LDFLAGS="-L$JAVA_HOME/jre/lib/$arch/server -ljvm"
+          break;
+          fi
+      done
+    fi
+  fi
+
+  if test -z "$JAVA_LDFLAGS"; then
+    AC_MSG_ERROR([failed to determine linker flags for using Java (bad JAVA_HOME or missing support for your architecture?)])
+  fi
+
+    AC_MSG_CHECKING([whether or not we can build using the JDK])
+    cat <<__EOF__ >conftest.cpp [
+#include <jni.h>
+int main(int argc, char** argv)
+{
+  JNIEnv* env;
+  JavaVM* jvm;
+  JavaVMInitArgs vmArgs;
+  return JNI_CreateJavaVM(&jvm, (void**) &env, &vmArgs);
+}]
+__EOF__
+
+  # Compile and link.
+  $CXX $JAVA_CPPFLAGS $JAVA_LDFLAGS -o conftest conftest.cpp >&5
+
+  if test $? != 0; then
+    AC_MSG_ERROR([failed to build against JDK])
+  else
+    AC_MSG_RESULT([yes])
+  fi
+
+  # Cleanup after ourselves.
+  rm -f conftest
+
+  AC_CONFIG_FILES([src/examples/java/test-exception-framework],
+                  [chmod +x src/examples/java/test-exception-framework])
+  AC_CONFIG_FILES([src/examples/java/test-executor],
+                  [chmod +x src/examples/java/test-executor])
+  AC_CONFIG_FILES([src/examples/java/test-framework],
+                  [chmod +x src/examples/java/test-framework])
+  AC_CONFIG_FILES([src/examples/java/test-multiple-executors-framework],
+                  [chmod +x src/examples/java/test-multiple-executors-framework])
+  AC_CONFIG_FILES([src/java/mesos.pom])
+
+  AC_SUBST([JAVA_LDFLAGS])
+  AC_SUBST([HAS_JAVA], [1]) # Used to decide whether to run Java tests.
+  has_java=yes
+fi
+
+AM_CONDITIONAL([HAS_JAVA], [test "x$has_java" = "xyes"])
+
+
+# Perform necessary configuration for building with Python.
+if test "x$enable_python" = "xyes"; then
+  AM_PATH_PYTHON() # A fatal error will occur if no interpreter found.
+
+  # Determine how the generated Python egg's will get named, used in
+  # the Makefile to keep the targets from being rerun.
+  PYTHON_EGG_POSTFIX=`$PYTHON -c \
+    'import sys; \
+     from distutils.util import get_platform; \
+     print "-py" + sys.version[[0:3]] + "-" + get_platform()'`
+
+  PYTHON_EGG_PUREPY_POSTFIX=`$PYTHON -c \
+    'import sys; \
+     from distutils.util import get_platform; \
+     print "-py" + sys.version[[0:3]]'`
+
+  AC_CONFIG_FILES([src/examples/python/test-executor],
+                  [chmod +x src/examples/python/test-executor])
+  AC_CONFIG_FILES([src/examples/python/test-framework],
+                  [chmod +x src/examples/python/test-framework])
+  AC_CONFIG_FILES([src/python/setup.py])
+
+  AC_SUBST([PYTHON_EGG_POSTFIX])
+  AC_SUBST([PYTHON_EGG_PUREPY_POSTFIX])
+  AC_SUBST([PYTHON]) # Used by the example shell scripts.
+  AC_SUBST([HAS_PYTHON], [1]) # Used to decide whether to run Python tests.
+  has_python=yes
+fi
+
+AM_CONDITIONAL([HAS_PYTHON], [test "x$has_python" = "xyes"])
+
+
+# Configure webui as necessary if enabled (must be done *after* we
+# configure Python).
+if test "x$enable_webui" = "xyes"; then
+  # Make sure we have Python.
+  test "x$has_python" = "xyes" || \
+    AC_MSG_ERROR([webui requires --enable-python])
+
+  # The webui requires at least Python 2.6.
+  AM_PYTHON_CHECK_VERSION([$PYTHON], [2.6], [],
+                          [AC_MSG_ERROR([webui requires Python >= 2.6])])
+
+  # Determine the flags necessary for embedding Python.
+  WEBUI_CPPFLAGS=`$PYTHON -c \
+    'from distutils import sysconfig; \
+     print "-I" + sysconfig.get_config_var("INCLUDEPY")'`
+
+  WEBUI_LDFLAGS=`$PYTHON -c \
+    'from distutils import sysconfig; \
+     print sysconfig.get_config_var("LINKFORSHARED") + \
+     " -lpython" + sysconfig.get_config_var("VERSION")'`
+
+  AC_SUBST([WEBUI_CPPFLAGS])
+  AC_SUBST([WEBUI_LDFLAGS])
+  AC_SUBST([WEBUI], [1]) # Used to conditionally include code.
+  webui=yes
+fi
+
+AM_CONDITIONAL([WEBUI], [test "x$webui" = "xyes"])
+
+
+# Configure the included ZooKeeper if necessary, if not consider
+# checking the installed ZooKeeper version.
+if test "x$with_included_zookeeper" = "xyes"; then
+  AC_CONFIG_SUBDIRS([third_party/zookeeper-3.3.1/src/c])
+fi
+
+AM_CONDITIONAL([WITH_INCLUDED_ZOOKEEPER],
+               [test "x$with_included_zookeeper" = "xyes"])
 
-WITH_INCLUDED_ZOOKEEPER="0"
-AC_ARG_WITH([included-zookeeper],
-  AC_HELP_STRING([--with-included-zookeeper],
-                 [build with included ZooKeeper]),
-	         [case "$with_included_zookeeper" in
-		    yes) WITH_ZOOKEEPER="1"
-                         WITH_INCLUDED_ZOOKEEPER="1" ;;
-                    no) WITH_INCLUDED_ZOOKEEPER="0" ;;
-		    *) AC_MSG_ERROR([
-*** --with-included-zookeeper does not take arguments]) ;;
-	          esac],
-	         [])
-AC_SUBST(WITH_INCLUDED_ZOOKEEPER)
 
 # Checks for programs.
 AC_PROG_CXX([g++])
 AC_PROG_CC([gcc])
 
+# Check for pthreads (uses m4/acx_pthread.m4).
+ACX_PTHREAD([], [AC_MSG_ERROR([failed to find pthreads])])
+
 AC_OUTPUT

Added: incubator/mesos/trunk/include/mesos/mesos.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/include/mesos/mesos.hpp?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/include/mesos/mesos.hpp (added)
+++ incubator/mesos/trunk/include/mesos/mesos.hpp Thu Jan 19 21:34:02 2012
@@ -0,0 +1 @@
+#include <mesos.pb.h> // ONLY USEFUL AFTER RUNNING PROTOC.

Added: incubator/mesos/trunk/m4/acx_pthread.m4
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/m4/acx_pthread.m4?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/m4/acx_pthread.m4 (added)
+++ incubator/mesos/trunk/m4/acx_pthread.m4 Thu Jan 19 21:34:02 2012
@@ -0,0 +1,363 @@
+# This was retrieved from
+#    http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?revision=1277&root=avahi
+# See also (perhaps for new versions?)
+#    http://svn.0pointer.de/viewvc/trunk/common/acx_pthread.m4?root=avahi
+#
+# We've rewritten the inconsistency check code (from avahi), to work
+# more broadly.  In particular, it no longer assumes ld accepts -zdefs.
+# This caused a restructing of the code, but the functionality has only
+# changed a little.
+
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl @summary figure out how to build C programs using POSIX threads
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl        LIBS="$PTHREAD_LIBS $LIBS"
+dnl        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl        CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <st...@alum.mit.edu>
+dnl @version 2006-05-29
+dnl @license GPLWithACException
+dnl 
+dnl Checks for GCC shared/pthread inconsistency based on work by
+dnl Marcin Owsiany <ma...@owsiany.pl>
+
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+#      ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+		pthread-config)
+		AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+		if test x"$acx_pthread_config" = xno; then continue; fi
+		PTHREAD_CFLAGS="`pthread-config --cflags`"
+		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+		;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [acx_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+	AC_MSG_CHECKING([for joinable pthread attribute])
+	attr_name=unknown
+	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+	    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+                        [attr_name=$attr; break])
+	done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+        # More AIX lossage: must compile with xlc_r or cc_r
+	if test x"$GCC" != xyes; then
+          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+        else
+          PTHREAD_CC=$CC
+	fi
+
+	# The next part tries to detect GCC inconsistency with -shared on some
+	# architectures and systems. The problem is that in certain
+	# configurations, when -shared is specified, GCC "forgets" to
+	# internally use various flags which are still necessary.
+	
+	#
+	# Prepare the flags
+	#
+	save_CFLAGS="$CFLAGS"
+	save_LIBS="$LIBS"
+	save_CC="$CC"
+	
+	# Try with the flags determined by the earlier checks.
+	#
+	# -Wl,-z,defs forces link-time symbol resolution, so that the
+	# linking checks with -shared actually have any value
+	#
+	# FIXME: -fPIC is required for -shared on many architectures,
+	# so we specify it here, but the right way would probably be to
+	# properly detect whether it is actually required.
+	CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS"
+	LIBS="$PTHREAD_LIBS $LIBS"
+	CC="$PTHREAD_CC"
+	
+	# In order not to create several levels of indentation, we test
+	# the value of "$done" until we find the cure or run out of ideas.
+	done="no"
+	
+	# First, make sure the CFLAGS we added are actually accepted by our
+	# compiler.  If not (and OS X's ld, for instance, does not accept -z),
+	# then we can't do this test.
+	if test x"$done" = xno; then
+	   AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
+	   AC_TRY_LINK(,, , [done=yes])
+	
+	   if test "x$done" = xyes ; then
+	      AC_MSG_RESULT([no])
+	   else
+	      AC_MSG_RESULT([yes])
+	   fi
+	fi
+	
+	if test x"$done" = xno; then
+	   AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
+	   AC_TRY_LINK([#include <pthread.h>],
+	      [pthread_t th; pthread_join(th, 0);
+	      pthread_attr_init(0); pthread_cleanup_push(0, 0);
+	      pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+	      [done=yes])
+	   
+	   if test "x$done" = xyes; then
+	      AC_MSG_RESULT([yes])
+	   else
+	      AC_MSG_RESULT([no])
+	   fi
+	fi
+	
+	#
+	# Linux gcc on some architectures such as mips/mipsel forgets
+	# about -lpthread
+	#
+	if test x"$done" = xno; then
+	   AC_MSG_CHECKING([whether -lpthread fixes that])
+	   LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
+	   AC_TRY_LINK([#include <pthread.h>],
+	      [pthread_t th; pthread_join(th, 0);
+	      pthread_attr_init(0); pthread_cleanup_push(0, 0);
+	      pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+	      [done=yes])
+	
+	   if test "x$done" = xyes; then
+	      AC_MSG_RESULT([yes])
+	      PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
+	   else
+	      AC_MSG_RESULT([no])
+	   fi
+	fi
+	#
+	# FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
+	#
+	if test x"$done" = xno; then
+	   AC_MSG_CHECKING([whether -lc_r fixes that])
+	   LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
+	   AC_TRY_LINK([#include <pthread.h>],
+	       [pthread_t th; pthread_join(th, 0);
+	        pthread_attr_init(0); pthread_cleanup_push(0, 0);
+	        pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+	       [done=yes])
+	
+	   if test "x$done" = xyes; then
+	      AC_MSG_RESULT([yes])
+	      PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
+	   else
+	      AC_MSG_RESULT([no])
+	   fi
+	fi
+	if test x"$done" = xno; then
+	   # OK, we have run out of ideas
+	   AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
+	
+	   # so it's not safe to assume that we may use pthreads
+	   acx_pthread_ok=no
+	fi
+	
+	CFLAGS="$save_CFLAGS"
+	LIBS="$save_LIBS"
+	CC="$save_CC"
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD

Added: incubator/mesos/trunk/src/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/Makefile.am?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/Makefile.am (added)
+++ incubator/mesos/trunk/src/Makefile.am Thu Jan 19 21:34:02 2012
@@ -0,0 +1,629 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+
+# Add 'subdir-objects' to build objects in respective subdirectories
+# which is necessary for dealing with naming conflicts, i.e,,
+# master/http.cpp and slave/http.cpp.
+AUTOMAKE_OPTIONS = subdir-objects
+
+BOOST = third_party/boost-1.37.0
+PROTOBUF = third_party/protobuf-2.3.0
+GLOG = third_party/glog-0.3.1
+GMOCK = third_party/gmock-1.6.0
+GTEST = $(GMOCK)/gtest
+LEVELDB = third_party/leveldb
+ZOOKEEPER = third_party/zookeeper-3.3.1/src/c
+LIBPROCESS = third_party/libprocess
+LIBEV = $(LIBPROCESS)/third_party/libev-3.8
+
+# These next definitions may not seem like, much, but they are very
+# important! They inform where things that have the webui_, pythonegg_
+# and javalib_ prefix get installed! Also note that pkg*dir contains
+# the package name in the path (in our case 'mesos') which is valuable
+# because we'd prefer /path/to/mesos/webui versus something like
+# /path/to/webui.
+webuidir = $(pkgdatadir)
+pythoneggdir = $(pythondir)
+javalibdir = $(libdir)/java
+
+# Used for building Python eggs.
+SETUPTOOLS = third_party/distribute-0.6.19/distribute-0.6.19-py2.6.egg
+
+# Protocol buffer compiler.
+PROTOC = ../$(PROTOBUF)/src/protoc
+PROTOCFLAGS = -I$(top_srcdir)/include/mesos -I$(srcdir)
+
+# Initialize variables here so we can use += operator everywhere else.
+lib_LTLIBRARIES =
+noinst_LTLIBRARIES =
+sbin_PROGRAMS =
+bin_PROGRAMS =
+pkglibexec_PROGRAMS =
+dist_pkglibexec_SCRIPTS = 
+webui_SCRIPTS =
+nobase_dist_webui_SCRIPTS =
+check_PROGRAMS =
+dist_check_SCRIPTS = 
+BUILT_SOURCES =
+TESTS =
+CLEANFILES =
+EXTRA_DIST =
+PHONY_TARGETS = 
+
+# Add compiler and linker flags for pthreads.
+AM_CXXFLAGS = $(PTHREAD_CFLAGS)
+AM_LIBS = $(PTHREAD_LIBS)
+
+# Setup CPPFLAGS and CXXFLAGS that are used for most source files.
+MESOS_CPPFLAGS = $(AM_CPPFLAGS)
+MESOS_CPPFLAGS += -DMESOS_WEBUI_DIR=\"$(webuidir)\"
+MESOS_CPPFLAGS += -DMESOS_LIBEXECDIR=\"$(pkglibexecdir)\"
+MESOS_CPPFLAGS += -I$(top_srcdir)/include
+MESOS_CPPFLAGS += -I$(top_srcdir)/$(BOOST)
+MESOS_CPPFLAGS += -I$(top_srcdir)/$(PROTOBUF)/src
+MESOS_CPPFLAGS += -I$(top_srcdir)/$(GLOG)/src
+MESOS_CPPFLAGS += -I$(top_builddir)/$(GLOG)/src
+MESOS_CPPFLAGS += -I$(top_srcdir)/$(LIBPROCESS)/include
+
+if WITH_INCLUDED_ZOOKEEPER
+  MESOS_CPPFLAGS += -I$(top_srcdir)/$(ZOOKEEPER)/include
+  MESOS_CPPFLAGS += -I$(top_srcdir)/$(ZOOKEEPER)/generated
+endif
+
+MESOS_CXXFLAGS = -g2 -O2 $(AM_CXXFLAGS)
+
+
+# README: we build the Mesos library out of a collection of
+# convenience libraries (that is, libraries that do not get installed
+# but we can use as building blocks to vary compile flags as necessary
+# and then aggregate into final archives): libmesos_no_third_party.la
+# libbuild.la, liblog.la, libwebui.la, libjava.la.
+
+# First, let's define necessary protocol buffer files.
+
+MESOS_PROTO = $(top_srcdir)/include/mesos/mesos.proto
+
+CXX_PROTOS = mesos.pb.cc mesos.pb.h
+JAVA_PROTOS = java/generated/org/apache/mesos/Protos.java
+PYTHON_PROTOS = python/mesos_pb2.py
+
+BUILT_SOURCES += $(CXX_PROTOS) $(JAVA_PROTOS) $(PYTHON_PROTOS)
+CLEANFILES += $(CXX_PROTOS) $(JAVA_PROTOS) $(PYTHON_PROTOS)
+
+MESSAGES_PROTOS = messages/messages.pb.cc messages/messages.pb.h
+
+BUILT_SOURCES += $(MESSAGES_PROTOS)
+CLEANFILES += $(MESSAGES_PROTOS)
+
+LOG_PROTOS = messages/log.pb.cc messages/log.pb.h
+
+BUILT_SOURCES += $(LOG_PROTOS)
+CLEANFILES += $(LOG_PROTOS)
+
+
+# Targets for generating protocol buffer code.
+%.pb.cc %.pb.h: $(top_srcdir)/include/mesos/%.proto
+	@$(MKDIR_P) $(@D)
+	@$(PROTOC) $(PROTOCFLAGS) --cpp_out=. $^
+
+%.pb.cc %.pb.h: %.proto
+	@$(MKDIR_P) $(@D)
+	@$(PROTOC) $(PROTOCFLAGS) --cpp_out=. $^
+
+$(JAVA_PROTOS): $(MESOS_PROTO)
+	@$(MKDIR_P)  $(@D)
+	@$(PROTOC) $(PROTOCFLAGS) --java_out=java/generated $^
+
+$(PYTHON_PROTOS): $(MESOS_PROTO)
+	@$(MKDIR_P) $(@D)
+	@$(PROTOC) $(PROTOCFLAGS) --python_out=python $^
+
+# We even use a convenience library for most of Mesos so that we can
+# exclude third party libraries so setuptools/distribute can build a
+# self-contained Python library and statically link in the third party
+# libraries themselves.
+noinst_LTLIBRARIES += libmesos_no_third_party.la
+
+nodist_libmesos_no_third_party_la_SOURCES = $(CXX_PROTOS) $(MESSAGES_PROTOS)
+
+libmesos_no_third_party_la_SOURCES = sched/sched.cpp local/local.cpp	\
+	master/master.cpp master/http.cpp master/slaves_manager.cpp	\
+	master/frameworks_manager.cpp master/allocator_factory.cpp	\
+	master/simple_allocator.cpp slave/slave.cpp slave/http.cpp	\
+	slave/isolation_module.cpp					\
+	slave/process_based_isolation_module.cpp slave/reaper.cpp	\
+	launcher/launcher.cpp exec/exec.cpp common/fatal.cpp		\
+	common/lock.cpp detector/detector.cpp				\
+	detector/url_processor.cpp configurator/configurator.cpp	\
+	common/logging.cpp common/utils.cpp common/date_utils.cpp	\
+	common/resources.cpp common/attributes.cpp common/values.cpp	\
+	zookeeper/zookeeper.cpp zookeeper/authentication.cpp		\
+	zookeeper/group.cpp
+
+if OS_LINUX
+  libmesos_no_third_party_la_SOURCES += slave/lxc_isolation_module.cpp
+else
+  EXTRA_DIST += slave/lxc_isolation_module.cpp
+endif
+
+EXTRA_DIST += slave/solaris_project_isolation_module.cpp
+
+libmesos_no_third_party_la_SOURCES += common/build.hpp			\
+	common/date_utils.hpp common/factory.hpp common/fatal.hpp	\
+	common/foreach.hpp common/hashmap.hpp common/hashset.hpp	\
+	common/json.hpp common/lock.hpp common/logging.hpp		\
+	common/lambda.hpp common/option.hpp common/resources.hpp	\
+	common/result.hpp common/multihashmap.hpp			\
+	common/process_utils.hpp common/seconds.hpp common/try.hpp	\
+	common/type_utils.hpp common/units.hpp common/uuid.hpp		\
+	common/strings.hpp common/values.hpp common/attributes.hpp	\
+	configurator/configuration.hpp configurator/configurator.hpp	\
+	configurator/option.hpp detector/detector.hpp			\
+	detector/url_processor.hpp launcher/launcher.hpp		\
+	local/local.hpp log/cache.hpp log/coordinator.hpp		\
+	log/replica.hpp log/log.hpp log/network.hpp			\
+	master/allocator.hpp master/allocator_factory.hpp		\
+	master/constants.hpp master/frameworks_manager.hpp		\
+	master/http.hpp master/master.hpp master/simple_allocator.hpp	\
+	master/slaves_manager.hpp master/webui.hpp messages/log.hpp	\
+	messages/messages.hpp slave/constants.hpp slave/http.hpp	\
+	slave/isolation_module.hpp slave/isolation_module_factory.hpp	\
+	slave/lxc_isolation_module.hpp					\
+	slave/process_based_isolation_module.hpp slave/reaper.hpp	\
+	slave/slave.hpp slave/solaris_project_isolation_module.hpp	\
+	slave/webui.hpp tests/external_test.hpp				\
+	tests/base_zookeeper_test.hpp tests/jvm.hpp tests/utils.hpp	\
+	tests/zookeeper_server.hpp zookeeper/authentication.hpp		\
+	zookeeper/group.hpp zookeeper/watcher.hpp			\
+	zookeeper/zookeeper.hpp jvm/jvm.hpp
+
+libmesos_no_third_party_la_CPPFLAGS = $(MESOS_CPPFLAGS)
+
+libmesos_no_third_party_la_CXXFLAGS = $(MESOS_CXXFLAGS)
+
+libmesos_no_third_party_la_LIBADD = # Initialized to allow += below.
+
+# Convenience library that *always* gets rebuilt to ensure accurate info.
+noinst_LTLIBRARIES += libbuild.la
+libbuild_la_SOURCES = common/build.cpp
+libbuild_la_CPPFLAGS = $(AM_CPPFLAGS)
+libbuild_la_CPPFLAGS += -DBUILD_DATE="\"$$(date '+%Y-%m-%d %H:%M:%S')\""
+libbuild_la_CPPFLAGS += -DBUILD_USER="\"$$USER\""
+
+# We need to escape the build flags properly.
+BUILD_FLAGS=$(echo $(MESOS_CPPFLAGS) | sed 's/\"/\\\"/g') $(MESOS_CXXFLAGS)
+
+libbuild_la_CPPFLAGS += -DBUILD_FLAGS="\"$$BUILD_FLAGS\""
+
+# Using the FORCE target is how we make sure it always get's built!
+libbuild_la_DEPENDENCIES = FORCE
+
+libmesos_no_third_party_la_LIBADD += libbuild.la
+
+
+# Convenience library for the log to include leveldb headers.
+noinst_LTLIBRARIES += liblog.la
+liblog_la_SOURCES = log/coordinator.cpp log/replica.cpp	\
+nodist_liblog_la_SOURCES = $(LOG_PROTOS)
+liblog_la_CPPFLAGS = -I../$(LEVELDB)/include $(MESOS_CPPFLAGS)
+liblog_la_CXXFLAGS = $(MESOS_CXXFLAGS)
+liblog_la_LDFLAGS = -L../$(LEVELDB)
+liblog_la_LIBADD = -lleveldb
+
+libmesos_no_third_party_la_LIBADD += liblog.la
+
+
+# Convenience library for the webui to include Python specific flags.
+if WEBUI
+noinst_LTLIBRARIES += libwebui.la
+libwebui_la_SOURCES = master/webui.cpp slave/webui.cpp common/webui_utils.cpp
+libwebui_la_SOURCES += master/webui.hpp slave/webui.hpp common/webui_utils.hpp
+libwebui_la_CPPFLAGS = $(MESOS_CPPFLAGS) $(WEBUI_CPPFLAGS)
+libwebui_la_CXXFLAGS = $(MESOS_CXXFLAGS)
+
+libmesos_no_third_party_la_LIBADD += libwebui.la
+endif
+
+
+# The final result!
+lib_LTLIBRARIES += libmesos.la
+
+libmesos_la_SOURCES = $(MESOS_PROTO) # Part of the distribution.
+
+libmesos_la_LDFLAGS = -version-info 0:0 -shared
+
+# Since we just include the convenience library, we need to tell
+# libtool to build this as a C++ library.
+libmesos_la_LIBTOOLFLAGS = --tag=CXX
+
+# Add the convenience library.
+libmesos_la_LIBADD = libmesos_no_third_party.la
+
+# For non-convenience libraries we need to link them in to make the shared
+# library each time. (Currently, we don't support platforms where this is not
+# possible.)
+libmesos_la_LIBADD += $(top_builddir)/$(PROTOBUF)/src/.libs/libprotobufl.a
+libmesos_la_LIBADD += $(top_builddir)/$(GLOG)/.libs/libglog.la
+libmesos_la_LIBADD += $(top_builddir)/$(LIBPROCESS)/libprocess.a
+libmesos_la_LIBADD += $(top_builddir)/$(LIBEV)/.libs/libev.la
+
+if WITH_INCLUDED_ZOOKEEPER
+  libmesos_la_LIBADD += $(top_builddir)/$(ZOOKEEPER)/.libs/libzookeeper_mt.a
+endif
+
+
+# Binaries.
+sbin_PROGRAMS += mesos-master
+mesos_master_SOURCES = master/main.cpp
+mesos_master_CPPFLAGS = $(MESOS_CPPFLAGS)
+mesos_master_CXXFLAGS = $(MESOS_CXXFLAGS)
+mesos_master_LDFLAGS = $(WEBUI_LDFLAGS) $(AM_LDFLAGS)
+mesos_master_LDADD = libwebui.la libmesos.la
+
+sbin_PROGRAMS += mesos-slave
+mesos_slave_SOURCES = slave/main.cpp
+mesos_slave_CPPFLAGS = $(MESOS_CPPFLAGS)
+mesos_slave_CXXFLAGS = $(MESOS_CXXFLAGS)
+mesos_slave_LDFLAGS = $(WEBUI_LDFLAGS) $(AM_LDFLAGS)
+mesos_slave_LDADD = libwebui.la libmesos.la
+
+bin_PROGRAMS += mesos-local
+mesos_local_SOURCES = local/main.cpp
+mesos_local_CPPFLAGS = $(MESOS_CPPFLAGS)
+mesos_local_CXXFLAGS = $(MESOS_CXXFLAGS)
+mesos_local_LDADD = libmesos.la
+
+pkglibexec_PROGRAMS += mesos-launcher
+mesos_launcher_SOURCES = launcher/main.cpp launcher/launcher.cpp
+mesos_launcher_CPPFLAGS = $(MESOS_CPPFLAGS)
+mesos_launcher_CXXFLAGS = $(MESOS_CXXFLAGS)
+mesos_launcher_LDADD = libmesos.la
+
+bin_PROGRAMS += mesos-log
+mesos_log_SOURCES = log/main.cpp
+mesos_log_CPPFLAGS = $(MESOS_CPPFLAGS)
+mesos_log_CXXFLAGS = $(MESOS_CXXFLAGS)
+mesos_log_LDADD = libmesos.la
+
+# TODO(benh): Support Solaris.
+# bin_PROGRAMS += mesos-projd
+# mesos_projd_SOURCES = slave/projd.cpp
+# mesos_projd_CPPFLAGS = $(MESOS_CPPFLAGS)
+# mesos_projd_CXXFLAGS = $(MESOS_CXXFLAGS)
+# mesos_projd_LDADD = libmesos.la
+
+bin_PROGRAMS += mesos-mesos
+mesos_mesos_SOURCES = mesos/main.cpp
+mesos_mesos_CPPFLAGS = $(MESOS_CPPFLAGS)
+mesos_mesos_CXXFLAGS = $(MESOS_CXXFLAGS)
+mesos_mesos_LDADD = libmesos.la
+
+
+# We need to include the webui scripts so they get installed.
+WEBUISCRIPTS = webui/bottle-0.8.3/bottle.py		\
+               webui/common/webui_lib.py		\
+               webui/master/framework.tpl		\
+               webui/master/index.tpl			\
+               webui/master/webui.py			\
+               webui/slave/framework.tpl		\
+               webui/slave/executor.tpl			\
+               webui/slave/index.tpl			\
+               webui/slave/webui.py			\
+               webui/static/stylesheet.css
+
+nobase_dist_webui_SCRIPTS += $(WEBUISCRIPTS)
+
+
+# We also need to include the killtree script.
+dist_pkglibexec_SCRIPTS += scripts/killtree.sh
+
+
+if HAS_JAVA
+# Protocol buffers JAR.
+PROTOBUF_JAR = ../protobuf.jar
+
+$(PROTOBUF_JAR): # TODO(charles): Specify dependencies for the jar.
+	@echo "Building protobuf.jar ..."
+	@$(MKDIR_P) ../$(PROTOBUF)/java/src/main/java
+	@$(PROTOC) --java_out=$(top_builddir)/$(PROTOBUF)/java/src/main/java \
+          -I$(top_srcdir)/$(PROTOBUF)/src \
+          $(top_srcdir)/$(PROTOBUF)/src/google/protobuf/descriptor.proto
+	@$(JAVA_HOME)/bin/javac \
+          -d ../$(PROTOBUF)/java/src/main/java \
+          $(top_srcdir)/$(PROTOBUF)/java/src/main/java/com/google/protobuf/*.java \
+          ../$(PROTOBUF)/java/src/main/java/com/google/protobuf/*.java
+	@$(JAVA_HOME)/bin/jar cf $@ -C ../$(PROTOBUF)/java/src/main/java com
+
+CLEANFILES += $(PROTOBUF_JAR)
+
+
+# Mesos JAR.
+MESOS_JAR = mesos.jar
+MESOS_JAR_SRCROOT = $(srcdir)/java/src
+MESOS_JAR_SRCDIR = $(srcdir)/java/src/org/apache/mesos
+MESOS_JAR_SRC = $(MESOS_JAR_SRCDIR)/*.java
+
+EXTRA_DIST += $(MESOS_JAR_SRC)
+
+$(MESOS_JAR): $(MESOS_JAR_SRC) $(JAVA_PROTOS) $(PROTOBUF_JAR)
+	@echo "Building mesos.jar ..."
+	@rm -f java/classes/org/apache/mesos/*
+	@$(MKDIR_P) java/classes/org/apache/mesos
+	@$(JAVA_HOME)/bin/javac \
+          -cp $(PROTOBUF_JAR) -sourcepath java/generated \
+          -d java/classes $(MESOS_JAR_SRC) $(JAVA_PROTOS)
+	@$(JAVA_HOME)/bin/jar cf $@ -C java/classes org
+
+javalib_DATA = $(MESOS_JAR)
+
+
+MESOS_SOURCES_JAR = ../src/mesos-sources.jar
+
+$(MESOS_SOURCES_JAR): $(MESOS_JAR_SRC)
+	@rm -f $(MESOS_SOURCES_JAR)
+	@$(JAVA_HOME)/bin/jar cf $@ -C $(MESOS_JAR_SRCROOT) org
+	@$(JAVA_HOME)/bin/jar uf $@ -C java/generated org
+
+CLEANFILES += java/classes $(MESOS_JAR) $(MESOS_SOURCES_JAR)
+
+
+# Convenience library for JNI bindings.
+# TODO(Charles Reiss): We really should be building the Java library
+# with -module, which means it should be a different library than the
+# main libmesos.so.
+noinst_LTLIBRARIES += libjava.la
+
+libjava_la_SOURCES = java/jni/convert.cpp java/jni/construct.cpp	\
+	java/jni/org_apache_mesos_MesosSchedulerDriver.cpp		\
+	java/jni/org_apache_mesos_MesosExecutorDriver.cpp		\
+	java/jni/org_apache_mesos_Log.cpp jvm/jvm.cpp
+
+libjava_la_SOURCES += java/jni/convert.hpp java/jni/construct.hpp jvm/jvm.hpp
+
+libjava_la_CPPFLAGS = $(MESOS_CPPFLAGS)
+libjava_la_CPPFLAGS += $(JAVA_CPPFLAGS)
+libjava_la_CPPFLAGS += -I$(srcdir)/java/jni -Ijava/jni
+
+libjava_la_CXXFLAGS = $(MESOS_CXXFLAGS)
+
+libjava_la_DEPENDENCIES = $(MESOS_PROTO)
+
+libjava_la_LIBADD = $(JAVA_LDFLAGS)
+
+libmesos_no_third_party_la_LIBADD += libjava.la
+
+# We need to generate the JNI header files before we build the sources
+# and the easiest way to do that with autotools is with the
+# BUILT_SOURCES mechanism. The downside of this is that a user cannot
+# run 'make libjava.la' (or any target that uses BUILT_SOURCES) but
+# that should not matter as libjava.la is just a convenience library
+# and should not get exposed.
+
+nodist_libjava_la_SOURCES =					\
+	java/jni/org_apache_mesos_MesosSchedulerDriver.h	\
+	java/jni/org_apache_mesos_MesosExecutorDriver.h		\
+	java/jni/org_apache_mesos_Log.h
+
+BUILT_SOURCES += java/jni/org_apache_mesos_MesosSchedulerDriver.h	\
+	java/jni/org_apache_mesos_MesosExecutorDriver.h			\
+	java/jni/org_apache_mesos_Log.h
+
+
+java/jni/org_apache_mesos_MesosSchedulerDriver.h: $(MESOS_JAR)
+	@$(JAVA_HOME)/bin/javah -d java/jni -classpath	\
+          $(PROTOBUF_JAR):java/classes			\
+          org.apache.mesos.MesosSchedulerDriver
+
+java/jni/org_apache_mesos_MesosExecutorDriver.h: $(MESOS_JAR)
+	@$(JAVA_HOME)/bin/javah -d java/jni -classpath	\
+          $(PROTOBUF_JAR):java/classes			\
+          org.apache.mesos.MesosExecutorDriver
+
+java/jni/org_apache_mesos_Log.h: $(MESOS_JAR)
+	@$(JAVA_HOME)/bin/javah -d java/jni -classpath		\
+          $(PROTOBUF_JAR):java/classes org.apache.mesos.Log
+
+# We build all the Java examples into their own JAR.
+EXAMPLES_JAR = examples.jar
+JAVA_EXAMPLES_SRC = $(srcdir)/examples/TestExceptionFramework.java	\
+	$(srcdir)/examples/TestExecutor.java				\
+	$(srcdir)/examples/TestFramework.java				\
+	$(srcidr)/examples/TestMultipleExecutorsFramework.java
+
+EXTRA_DIST += $(JAVA_EXAMPLES_SOURCES)
+
+$(EXAMPLES_JAR): $(JAVA_EXAMPLES_SOURCES)
+	@echo "Building examples.jar ..."
+	@$(MKDIR_P) examples/java
+	@$(JAVA_HOME)/bin/javac -cp					\
+          $(PROTOBUF_JAR):$(MESOS_JAR):$(srcdir)/examples/java		\
+          -sourcepath $(srcdir)/examples/java -d examples/java	        \
+          $(srcdir)/examples/java/*.java
+	@$(JAVA_HOME)/bin/jar cf $@ -C examples/java .
+
+maven-install: $(MESOS_JAR) $(MESOS_SOURCES_JAR) java/mesos.pom
+	mvn install:install-file -Dfile=$(MESOS_JAR)	\
+          -Dsources=$(MESOS_SOURCES_JAR) -DpomFile=java/mesos.pom
+
+PHONY_TARGETS += maven-install
+endif # HAS_JAVA
+
+
+if HAS_PYTHON
+# TODO(Charles Reiss): Figure out how to do a proper out-of-source
+# build of these Python eggs. Right now we copy the entire source
+# directories into the build directory.
+
+# This builds a Python egg against libmesos_no_third_party.a that is
+# self-contained. It currently depends on the libraries in third_party
+# being built as .a's. (If this is changed, the setup.py will need to
+# be edited).
+#
+# TODO(Charles Reiss): Additionally support building and installing
+# Python libraries that link against the system libmesos.so. This
+# should be the default mode if we eventually are able to rely on
+# system versions of our dependencies (since we won't be able to
+# create a standalone egg anyways).
+
+# We need to be able to "name" the egg that gets generated via
+# setup.py so that we don't attempt to rebuild it each time, hence the
+# need for PYTHON_EGG_POSTFIX.
+MESOS_EGG = python/dist/mesos-$(PACKAGE_VERSION)$(PYTHON_EGG_POSTFIX).egg
+
+$(MESOS_EGG): python/setup.py $(srcdir)/python/src/mesos.py	\
+	       $(PYTHON_PROTOS) libmesos_no_third_party.la	\
+	       $(PROTOBUF_EGG)
+	@echo "Building Mesos Python egg ..."
+	@$(MKDIR_P) python/src
+	@cp -pf $(srcdir)/python/src/mesos.py python/src
+	@cp -pf $(PYTHON_PROTOS) python/src
+	@PYTHONPATH=../$(SETUPTOOLS) $(PYTHON) python/setup.py bdist_egg
+
+CLEANFILES += $(MESOS_EGG)
+
+# TODO(Charles Reiss): Don't hard code this verison number.
+PROTOBUF_EGG =								\
+  ../$(PROTOBUF)/python/dist/protobuf-2.3.0$(PYTHON_EGG_PUREPY_POSTFIX).egg
+
+$(PROTOBUF_EGG):
+	@echo "Building protobuf Python egg ..."
+	@if test "$(top_srcdir)" != "$(top_builddir)"; then \
+	  cp -rf $(top_srcdir)/$(PROTOBUF)/python ../$(PROTOBUF); \
+	  $(MKDIR_P) ../$(PROTOBUF)/src/google/protobuf; \
+	  cp -pf $(top_srcdir)/$(PROTOBUF)/src/google/protobuf/descriptor.proto \
+	    ../$(PROTOBUF)/src/google/protobuf; \
+	fi
+	@cd ../$(PROTOBUF)/python && \
+	  PYTHONPATH=../$(SETUPTOOLS) $(PYTHON) setup.py bdist_egg
+
+CLEANFILES += $(PROTOBUF_EGG)
+
+all-local: $(MESOS_EGG)
+
+pythonegg_DATA = $(MESOS_EGG)
+endif # HAS_PYTHON
+
+
+# Test (make check) binaries.
+check_PROGRAMS += test-framework
+test_framework_SOURCES = examples/test_framework.cpp
+test_framework_CPPFLAGS = $(MESOS_CPPFLAGS)
+test_framework_LDADD = libmesos.la
+
+check_PROGRAMS += test-executor
+test_executor_SOURCES = examples/test_executor.cpp
+test_executor_CPPFLAGS = $(MESOS_CPPFLAGS)
+test_executor_LDADD = libmesos.la
+
+check_PROGRAMS += long-lived-framework
+long_lived_framework_SOURCES = examples/long_lived_framework.cpp
+long_lived_framework_CPPFLAGS = $(MESOS_CPPFLAGS)
+long_lived_framework_LDADD = libmesos.la
+
+check_PROGRAMS += long-lived-executor
+long_lived_executor_SOURCES = examples/long_lived_executor.cpp
+long_lived_executor_CPPFLAGS = $(MESOS_CPPFLAGS)
+long_lived_executor_LDADD = libmesos.la
+
+check_PROGRAMS += memhog
+memhog_SOURCES = examples/memhog.cpp
+memhog_CPPFLAGS = $(MESOS_CPPFLAGS)
+memhog_LDADD = libmesos.la
+
+check_PROGRAMS += scheduled-memhog
+scheduled_memhog_SOURCES = examples/scheduled_memhog.cpp
+scheduled_memhog_CPPFLAGS = $(MESOS_CPPFLAGS)
+scheduled_memhog_LDADD = libmesos.la
+
+check_PROGRAMS += memhog-executor
+memhog_executor_SOURCES = examples/memhog_executor.cpp
+memhog_executor_CPPFLAGS = $(MESOS_CPPFLAGS)
+memhog_executor_LDADD = libmesos.la
+
+check_PROGRAMS += mesos-tests
+
+mesos_tests_SOURCES = tests/main.cpp tests/utils.cpp			\
+	              tests/master_tests.cpp				\
+	              tests/resource_offers_tests.cpp			\
+	              tests/fault_tolerance_tests.cpp			\
+	              tests/log_tests.cpp tests/resources_tests.cpp	\
+	              tests/uuid_tests.cpp tests/external_tests.cpp	\
+	              tests/sample_frameworks_tests.cpp			\
+	              tests/configurator_tests.cpp			\
+	              tests/strings_tests.cpp				\
+	              tests/multihashmap_tests.cpp			\
+	              tests/protobuf_io_tests.cpp			\
+	              tests/lxc_isolation_tests.cpp			\
+	              tests/utils_tests.cpp				\
+	              tests/url_processor_tests.cpp			\
+	              tests/killtree_tests.cpp				\
+	              tests/exception_tests.cpp
+
+mesos_tests_CPPFLAGS = $(MESOS_CPPFLAGS)
+mesos_tests_CPPFLAGS += -DSOURCE_DIR=\"$(abs_top_srcdir)\"
+mesos_tests_CPPFLAGS += -DBUILD_DIR=\"$(abs_top_builddir)\"
+mesos_tests_CPPFLAGS += -I$(top_srcdir)/$(GTEST)/include
+mesos_tests_CPPFLAGS += -I$(top_srcdir)/$(GMOCK)/include
+
+mesos_tests_CXXFLAGS = -g2 -O0 $(AM_CXXFLAGS)
+
+mesos_tests_LDADD = ../.libs/libgmock.la libmesos.la
+
+mesos_tests_DEPENDENCIES = # Initialized to allow += below.
+
+if HAS_JAVA
+  mesos_tests_SOURCES += tests/zookeeper_server.cpp		\
+                         tests/base_zookeeper_test.cpp		\
+                         tests/zookeeper_server_tests.cpp	\
+                         tests/zookeeper_tests.cpp
+  mesos_tests_CPPFLAGS += $(JAVA_CPPFLAGS)
+  mesos_tests_LDFLAGS = $(JAVA_LDFLAGS) $(AM_LDFLAGS)
+  mesos_tests_DEPENDENCIES += $(EXAMPLES_JAR)
+endif
+
+if HAS_PYTHON
+  mesos_tests_DEPENDENCIES += $(MESOS_EGG)
+endif
+
+EXAMPLESSCRIPTS = examples/java/test-framework				\
+                  examples/java/test-executor				\
+                  examples/java/test-exception-framework		\
+                  examples/java/test-multiple-executors-framework	\
+                  examples/python/test_framework.py			\
+                  examples/python/test-framework			\
+                  examples/python/test_executor.py			\
+                  examples/python/test-executor
+
+dist_check_SCRIPTS += $(EXAMPLESSCRIPTS)
+
+EXTERNALSCRIPTS =						\
+  tests/external/LxcIsolation/HoldMoreMemThanRequested.sh	\
+  tests/external/LxcIsolation/ScaleUpAndDown.sh			\
+  tests/external/LxcIsolation/TwoSeparateTasks.sh		\
+  tests/external/LxcIsolation/run_scheduled_memhog_test.sh	\
+  tests/external/SampleFrameworks/CppFramework.sh		\
+  tests/external/SampleFrameworks/JavaExceptionFramework.sh	\
+  tests/external/SampleFrameworks/JavaFramework.sh		\
+  tests/external/SampleFrameworks/PythonFramework.sh		\
+  tests/external/KillTree/KillTreeTest.sh
+
+dist_check_SCRIPTS += $(EXTERNALSCRIPTS)
+
+TESTS += mesos-tests
+
+FORCE:
+
+.PHONY: $(PHONY_TARGETS)

Modified: incubator/mesos/trunk/src/common/process_utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/process_utils.hpp?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/common/process_utils.hpp (original)
+++ incubator/mesos/trunk/src/common/process_utils.hpp Thu Jan 19 21:34:02 2012
@@ -36,12 +36,18 @@ inline Try<int> killtree(
     bool killgroups,
     bool killsess)
 {
-  if (utils::os::hasenv("MESOS_HOME")) {
-    return Try<int>::error("Expecting MESOS_HOME to be set");
+  std::string cmdline;
+  // TODO(Charles Reiss): Use a configuration option.
+  if (utils::os::hasenv("MESOS_KILLTREE")) {
+    // Set by mesos-build-env.sh.
+    cmdline = utils::os::getenv("MESOS_KILLTREE");
+  } else if (utils::os::hasenv("MESOS_SOURCE_DIR")) {
+    // Set by test harness for external tests.
+    cmdline = utils::os::getenv("MESOS_SOURCE_DIR") +
+        "/src/scripts/killtree.sh";
+  } else {
+    cmdline = MESOS_LIBEXECDIR "/killtree.sh";
   }
-
-  std::string cmdline = utils::os::getenv("MESOS_HOME");
-  cmdline += "/killtree.sh";
   cmdline += " -p " + pid;
   cmdline += " -s " + signal;
   if (killgroups) cmdline += " -g";

Added: incubator/mesos/trunk/src/common/thread.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/thread.hpp?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/thread.hpp (added)
+++ incubator/mesos/trunk/src/common/thread.hpp Thu Jan 19 21:34:02 2012
@@ -0,0 +1,45 @@
+#ifndef __THREAD_HPP__
+#define __THREAD_HPP__
+
+#include <pthread.h>
+
+#include <tr1/functional>
+
+// Provides a simple threading facility for starting a thread to run
+// an arbitrary function. No mechanism for returning a value from the
+// function is currently provided (and in the future would probably be
+// provided by libprocess anyway).
+
+namespace thread {
+
+void* __run(void* arg)
+{
+  std::tr1::function<void(void)>* function =
+    reinterpret_cast<std::tr1::function<void(void)>*>(arg);
+  (*function)();
+  delete function;
+}
+
+
+bool start(const std::tr1::function<void(void)>& f, bool detach = false)
+{
+  std::tr1::function<void(void)>* __f = new std::tr1::function<void(void)>(f);
+
+  pthread_t t;
+  if (pthread_create(&t, NULL, __run, __f) != 0) {
+    return false;
+  }
+
+  if (detach && pthread_detach(t) != 0) {
+    return false;
+  }
+
+  return true;
+}
+
+// TODO(benh): Provide a version of 'run' that returns a type T (the
+// value being a copy or preferablly via move semantics).
+
+} // namespace thread {
+
+#endif // __THREAD_HPP__

Added: incubator/mesos/trunk/src/common/webui_utils.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/webui_utils.cpp?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/webui_utils.cpp (added)
+++ incubator/mesos/trunk/src/common/webui_utils.cpp Thu Jan 19 21:34:02 2012
@@ -0,0 +1,99 @@
+#include <tr1/functional>
+
+#include "config/config.hpp"
+
+#include "common/strings.hpp"
+#include "common/thread.hpp"
+#include "common/utils.hpp"
+#include "common/webui_utils.hpp"
+
+#ifdef MESOS_WEBUI // Must be checked after including config/config.hpp.
+
+#include <Python.h> // Only attempt to include if building the webui.
+
+namespace mesos {
+namespace internal {
+namespace utils {
+namespace webui {
+
+static void run(const std::string& directory,
+                const std::string& script,
+                const std::vector<std::string>& args)
+{
+  // Setup the Python interpreter and load the script.
+  std::string path = directory + "/" + script;
+
+  Py_Initialize();
+
+  // Setup argv for Python interpreter.
+  char** argv = new char*[args.size() + 1];
+
+  argv[0] = const_cast<char*>(path.c_str());
+
+  for (int i = 0; i < args.size(); i++) {
+    argv[i + 1] = const_cast<char*>(args[i].c_str());
+  }
+
+  PySys_SetArgv(args.size() + 1, argv);
+
+  // Run some code to setup PATH and add webui_dir as a variable.
+  std::string code =
+    "import sys\n"
+    "sys.path.append('" + directory + "/common')\n"
+    "sys.path.append('" + directory + "/bottle-0.8.3')\n";
+
+  PyRun_SimpleString(code.c_str());
+
+  LOG(INFO) << "Loading webui script at '" << path << "'";
+
+  FILE* file = fopen(path.c_str(), "r");
+  PyRun_SimpleFile(file, path.c_str());
+  fclose(file);
+
+  Py_Finalize();
+
+  delete[] argv;
+}
+
+
+void start(const Configuration& conf,
+           const std::string& script,
+           const std::vector<std::string>& args)
+{
+  // Use either a directory specified via configuration options (which
+  // is necessary for running out of the build directory before 'make
+  // install') or the directory determined at build time via the
+  // preprocessor macro '-DMESOS_WEBUI_DIR' set in the Makefile.
+  std::string directory = conf.get("webui_dir", MESOS_WEBUI_DIR);
+
+  // Remove any trailing '/' in directory.
+  directory = strings::remove(directory, "/", strings::SUFFIX);
+
+  // Make sure script is a relative path.
+  CHECK(script[0] != '/')
+    << "Expecting relative path for webui script (relative to 'webui_dir')";
+
+  // Make sure directory/script exists.
+  std::string path = directory + "/" + script;
+
+  CHECK(utils::os::exists(path))
+    << "Failed to find webui script at '" << path << "'";
+
+  // TODO(benh): Consider actually forking a process for the webui
+  // rather than just creating a thread. This will let us more easily
+  // run multiple webui's simultaneously (e.g., the master and
+  // slave). This might also give us better isolation from Python
+  // interpreter errors (and maybe even remove the need for two C-c to
+  // exit the process).
+
+  if (!thread::start(std::tr1::bind(&run, directory, script, args), true)) {
+    LOG(FATAL) << "Failed to start webui thread";
+  }
+}
+
+} // namespace webui {
+} // namespace utils {
+} // namespace internal {
+} // namespace mesos {
+
+#endif // MESOS_WEBUI

Added: incubator/mesos/trunk/src/common/webui_utils.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/common/webui_utils.hpp?rev=1233580&view=auto
==============================================================================
--- incubator/mesos/trunk/src/common/webui_utils.hpp (added)
+++ incubator/mesos/trunk/src/common/webui_utils.hpp Thu Jan 19 21:34:02 2012
@@ -0,0 +1,31 @@
+#ifndef __COMMON_WEBUI_UTILS_HPP__
+#define __COMMON_WEBUI_UTILS_HPP__
+
+#include <string>
+#include <vector>
+
+#include "configurator/configuration.hpp"
+
+#ifdef MESOS_WEBUI
+
+namespace mesos {
+namespace internal {
+namespace utils {
+namespace webui {
+
+// Starts the Python based webui using the webui directory found via
+// any configuration options and the specified webui script (relative
+// path from webui directory), and args (accessible in the webui
+// script via 'sys.argv' offset by +1).
+void start(const Configuration& conf,
+           const std::string& script,
+           const std::vector<std::string>& args);
+
+} // namespace webui {
+} // namespace utils {
+} // namespace internal {
+} // namespace mesos {
+
+#endif // MESOS_WEBUI
+
+#endif // __COMMON_WEBUI_UTILS_HPP__

Modified: incubator/mesos/trunk/src/config/config.hpp.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/config/config.hpp.in?rev=1233580&r1=1233579&r2=1233580&view=diff
==============================================================================
--- incubator/mesos/trunk/src/config/config.hpp.in (original)
+++ incubator/mesos/trunk/src/config/config.hpp.in Thu Jan 19 21:34:02 2012
@@ -21,11 +21,7 @@
 
 /* This header gets completed by configure. */
 
-#if @WITH_ZOOKEEPER@
-  #define WITH_ZOOKEEPER
-#endif
-
-#if @WITH_WEBUI@
+#if @WEBUI@
   #define MESOS_WEBUI
 #endif