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/10/24 23:37:38 UTC

git commit: Add --enable-debug and --enable-optimize flag for controlling building debug and optimized verisons of mesos

Repository: mesos
Updated Branches:
  refs/heads/master 122fc2e1f -> ec74a1e3e


Add --enable-debug and --enable-optimize flag for controlling building debug and optimized verisons of mesos

Reworks buiding mesos in a "debug" vs. a "release" configuration. By default, mesos is built in a developer-centric setup (No optimizations, minimal debug info), in order to maximize developer productivity

None: '-O0 -g1'
--enable-optimize == '-O2'
--enable-debug == '-g'
--enable-optimize --enable-debug == '-O2 -g'

If a user / developer passes CXXFLAGS or CFLAGS manually, then they are not changed / touched at all. This is important so that Mesos is a good citizen when being built for various distributions (As well as making it so specialized one-off groupings of flags are feasible to use).

Adds two defines for accessing what mode things are being built in: 'DEBUG' and 'OPTIMIZE' which can be hooked into later to enable extra logging and the like. For release builds we may want to set 'NDEBUG' which removes assert()'s, but that is a seperate discussion.

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


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

Branch: refs/heads/master
Commit: ec74a1e3e3556615e68a8403cc4f62aa43f5153f
Parents: 122fc2e
Author: Cody Maloney <co...@mesosphere.io>
Authored: Fri Oct 24 16:32:47 2014 -0500
Committer: Timothy St. Clair <ts...@redhat.com>
Committed: Fri Oct 24 16:32:47 2014 -0500

----------------------------------------------------------------------
 configure.ac | 46 ++++++++++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ec74a1e3/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index bb4fee4..c8c1f94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,14 +44,6 @@ LT_INIT
 LT_LANG([C++])
 LT_OUTPUT
 
-# The default CFLAGS/CXXFLAGS from autoconf when using gcc usually
-# includes "-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="-g"])
-AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"], [CXXFLAGS="-g"])
-
 # Save the configure arguments so we can pass them to any third-party
 # libraries that we might run configure on (see 3rdparty/Makefile.am).
 # One downside of our strategy for shipping and building third-party
@@ -133,10 +125,17 @@ AC_ARG_ENABLE([python],
                              [don't build Python bindings]),
               [], [enable_python=yes])
 
+AC_ARG_ENABLE([debug],
+              AS_HELP_STRING([--enable-debug],
+                             [enable debugging. If CFLAGS/CXXFLAGS are set, this
+                              option won't change them default: no]),
+              [enable_debug=yes], [])
+
 AC_ARG_ENABLE([optimize],
-              AS_HELP_STRING([--disable-optimize],
-                             [don't try to compile with optimizations]),
-              [], [enable_optimize=yes])
+              AS_HELP_STRING([--enable-optimize],
+                             [enable optimizations. If CFLAGS/CXXFLAGS are set,
+                              this option won't change them default: no]),
+              [enable_optimize=yes], [])
 
 AC_ARG_ENABLE([bundled],
               AS_HELP_STRING([--disable-bundled],
@@ -266,15 +265,30 @@ AM_CONDITIONAL([OS_LINUX], [test "x$OS_NAME" = "xlinux"])
 AC_PROG_CXX([g++])
 AC_PROG_CC([gcc])
 
+# Check if we should enable debugging, optimization. Note we only
+# update CFLAGS and CXXFLAGS if none are provided.
+AM_CONDITIONAL([DEBUG], [test x"$enable_debug" = "xyes"])
+AM_CONDITIONAL([OPTIMIZE], [test x"$enable_optimize" = "xyes"])
+
+
+debug_flags="-g1"
+if test "x$enable_debug" = "xyes"; then
+  debug_flags="-g"
+elif test "x$enable_optimize" = "xyes"; then
+  debug_flags=""
+fi
 
-# Check if we should try and enable optimizations.
 if test "x$enable_optimize" = "xyes"; then
-  # For now, we only turn on optimizations for gcc.
-  if test "x$GCC" = "xyes"; then
-    CXXFLAGS="$CXXFLAGS -g2 -O2"
-  fi
+  optimize_flags="-O2"
+else
+  optimize_flags="-O0"
 fi
 
+AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
+      [CFLAGS="$debug_flags $optimize_flags"])
+AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
+      [CXXFLAGS="$debug_flags $optimize_flags"])
+
 
 # Attempt to use preinstalled dependencies instead of the bundled
 # versions in cases where the user specified their location