You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/08/22 20:53:28 UTC
[8/8] mesos git commit: Moved the libnl3 configure checks into a
macro.
Moved the libnl3 configure checks into a macro.
Since the `network/ports` isolator will depend on libnl3, move those
checks into a separate macro so that we can call it again when we
add a configure option to enable it.
Review: https://reviews.apache.org/r/60902/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/40906e31
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/40906e31
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/40906e31
Branch: refs/heads/master
Commit: 40906e31a44848b826a94fbcde668661fe2028d4
Parents: f7a38d7
Author: James Peach <jp...@apache.org>
Authored: Tue Aug 22 13:37:55 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Aug 22 13:37:55 2017 -0700
----------------------------------------------------------------------
configure.ac | 75 ++++-------------------------------------------
m4/libnl3.m4 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/40906e31/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index a6a5eb6..92bc1aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -381,12 +381,6 @@ AC_ARG_WITH([network-isolator],
enable_port_mapping_isolator=yes],
[])
-AC_ARG_WITH([nl],
- AS_HELP_STRING([--with-nl=@<:@DIR@:>@],
- [specify where to locate the libnl3 library
- (required for network-isolator). [default: /usr]]),
- [], [])
-
AC_ARG_WITH([nvml],
AS_HELP_STRING([--with-nvml@<:@=DIR@:>@],
[excludes building and using the bundled NVML headers
@@ -1362,78 +1356,21 @@ fi
AM_CONDITIONAL([WITH_BUNDLED_LIBPROCESS], [test "x$with_bundled_libprocess" = "xyes"])
-# Perform necessary configuration for network isolator.
+# Perform necessary configuration for port mapping isolator.
if test "x$enable_port_mapping_isolator" = "xyes"; then
- if test -n "`echo $with_nl`"; then
- CPPFLAGS="-isystem ${with_nl}/include/libnl3 $CPPFLAGS"
- LDFLAGS="-L${with_nl}/lib $LDFLAGS"
- else
- CPPFLAGS="-isystem /usr/include/libnl3 $CPPFLAGS"
- fi
# Check for OS support.
AS_IF([test "$OS_NAME" = "linux"],
[],
- [AC_MSG_ERROR([cannot build network isolator
--------------------------------------------------------------------
-Network isolator is only supported on Linux!
--------------------------------------------------------------------
- ])])
-
- # Check for libnl (both headers and libraries).
- AC_CHECK_LIB([nl-3], [nl_has_capability], [],
- [AC_MSG_ERROR([cannot find libnl-3
--------------------------------------------------------------------
-We need libnl-3 for building network isolator!
-
-Please install libnl3 (version 3.2.26 or higher):
-https://github.com/thom311/libnl/releases
--------------------------------------------------------------------
- ])])
-
- AC_CHECK_HEADERS([netlink/netlink.h libnl3/netlink/netlink.h],
- [break]
- [AC_MSG_ERROR([cannot find libnl-3 headers
--------------------------------------------------------------------
-We need libnl-3 headers for building network isolator!
-
-Please install libnl3 (version 3.2.26 or higher):
-https://github.com/thom311/libnl/releases
--------------------------------------------------------------------
- ])])
-
- # Check for libnl-route (both headers and libraries).
- AC_CHECK_LIB([nl-route-3], [rtnl_u32_get_classid], [],
- [AC_MSG_ERROR([cannot find libnl-route-3
--------------------------------------------------------------------
-We need libnl-route-3 for building network isolator!
-
-Please install libnl3 (version 3.2.26 or higher):
-https://github.com/thom311/libnl/releases
--------------------------------------------------------------------
- ])])
-
- AC_CHECK_HEADERS([netlink/route/link/veth.h libnl3/netlink/route/link/veth.h],
- [break]
- [AC_MSG_ERROR([cannot find libnl-route-3 headers
+ [AC_MSG_ERROR([cannot build port mapping isolator
-------------------------------------------------------------------
-We need libnl-route-3 headers for building network isolator!
-
-Please install libnl3 (version 3.2.26 or higher):
-https://github.com/thom311/libnl/releases
+The port mapping isolator is only supported on Linux
-------------------------------------------------------------------
])])
- # Check for libnl-idiag-3 (both headers and libraries).
- AC_CHECK_LIB([nl-idiag-3], [idiagnl_msg_alloc_cache], [],
- [AC_MSG_ERROR([cannot find libnl-idiag-3
--------------------------------------------------------------------
-We need libnl-idiag-3 for building network isolator!
-
-Please install libnl3 (version 3.2.26 or higher):
-https://github.com/thom311/libnl/releases
--------------------------------------------------------------------
- ])])
+ MESOS_HAVE_LIBNL3([], [
+ MESOS_MSG_LIBNL3_ERROR([libnl-3 is required for building the port mapping isolator])
+ ])
AC_DEFINE([ENABLE_PORT_MAPPING_ISOLATOR])
fi
http://git-wip-us.apache.org/repos/asf/mesos/blob/40906e31/m4/libnl3.m4
----------------------------------------------------------------------
diff --git a/m4/libnl3.m4 b/m4/libnl3.m4
new file mode 100644
index 0000000..d3df6e4
--- /dev/null
+++ b/m4/libnl3.m4
@@ -0,0 +1,87 @@
+# 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.
+
+#
+# SYNOPSIS
+#
+# MESOS_MSG_LIBNL3_ERROR(message)
+#
+AC_DEFUN([MESOS_MSG_LIBNL3_ERROR], [
+
+AC_MSG_ERROR([$1
+-------------------------------------------------------------------
+Please install libnl3 (version 3.2.26 or higher):
+https://github.com/thom311/libnl/releases
+-------------------------------------------------------------------
+])
+
+])
+
+#
+# SYNOPSIS
+#
+# MESOS_HAVE_LIBNL3(action-if-true, action-if-false)
+#
+AC_DEFUN([MESOS_HAVE_LIBNL3], [
+
+AC_ARG_WITH([nl],
+ AS_HELP_STRING([--with-nl=@<:@DIR@:>@],
+ [specify where to locate the libnl3 library [default: /usr]]),
+ [], []
+)
+
+# Make sure we only manipulate the compiler flags the first time
+# this macro is used.
+AS_IF([test x$ac_mesos_have_libnl3 = x], [
+ AS_IF([test -n "$with_nl"], [
+ CPPFLAGS="-isystem ${with_nl}/include/libnl3 $CPPFLAGS"
+ LDFLAGS="-L${with_nl}/lib $LDFLAGS"
+ ], [
+ CPPFLAGS="-isystem /usr/include/libnl3 $CPPFLAGS"
+ ])
+])
+
+AC_CHECK_HEADERS(
+ [netlink/netlink.h netlink/route/link/veth.h],
+ [], [ac_mesos_have_libnl3=no]
+)
+
+# Check for libnl (both headers and libraries).
+AC_CHECK_LIB(
+ [nl-3], [nl_has_capability], [],
+ [ac_mesos_have_libnl3=no]
+)
+
+# Check for libnl-route (both headers and libraries).
+AC_CHECK_LIB(
+ [nl-route-3], [rtnl_u32_get_classid], [],
+ [ac_mesos_have_libnl3=no]
+)
+
+# Check for libnl-idiag-3 (both headers and libraries).
+AC_CHECK_LIB(
+ [nl-idiag-3], [idiagnl_msg_alloc_cache], [],
+ [ac_mesos_have_libnl3=no]
+)
+
+AS_IF([test x$ac_mesos_have_libnl3 = xno], [
+ $2
+], [
+ ac_mesos_have_libnl3=yes
+ $1
+])
+
+])