2009-07-08 13:19:16 -07:00
|
|
|
# -*- autoconf -*-
|
|
|
|
|
sparse: Configure target operating system and fix fallout.
cgcc, the "sparse" wrapper that OVS uses, can be told the host architecture
or the host OS or both. Until now, OVS has told it the host architecture
because it is fairly common that it doesn't guess it automatically. Until
now, OS has not told it the host OS, assuming that it would get it right.
However, it doesn't--if you tell it the host OS or the host architecture,
it doesn't really have a default for the other. This means that on Linux
(presumably the only OS where sparse works properly for OVS), it was not
defining __linux__, which caused some weird behavior.
This commit adds a flag to the cgcc invocation to make it define __linux__
on Linux, and it fixes some errors that this would otherwise cause.
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-04-23 16:42:32 -07:00
|
|
|
# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019 Nicira, Inc.
|
2009-07-08 13:19:16 -07:00
|
|
|
#
|
2009-06-15 15:11:30 -07:00
|
|
|
# Licensed 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:
|
2009-07-08 13:19:16 -07:00
|
|
|
#
|
2009-06-15 15:11:30 -07:00
|
|
|
# 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.
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2022-07-15 10:16:18 +00:00
|
|
|
dnl Set OVS Actions Autovalidator as the default action implementation
|
|
|
|
dnl at compile time. This enables automatically running all unit tests
|
|
|
|
dnl with all actions implementations.
|
|
|
|
AC_DEFUN([OVS_CHECK_ACTIONS_AUTOVALIDATOR], [
|
|
|
|
AC_ARG_ENABLE([actions-default-autovalidator],
|
2022-07-27 14:42:08 +02:00
|
|
|
[AS_HELP_STRING([--enable-actions-default-autovalidator],
|
2022-07-15 10:16:18 +00:00
|
|
|
[Enable actions autovalidator as default
|
|
|
|
ovs actions implementation.])],
|
|
|
|
[autovalidator=yes],[autovalidator=no])
|
|
|
|
AC_MSG_CHECKING([whether actions Autovalidator is default implementation])
|
|
|
|
if test "$autovalidator" != yes; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
else
|
|
|
|
AC_DEFINE([ACTIONS_AUTOVALIDATOR_DEFAULT], [1],
|
|
|
|
[Autovalidator for actions is a default implementation.])
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2021-07-15 21:36:11 +05:30
|
|
|
dnl Set OVS MFEX Autovalidator as default miniflow extract at compile time?
|
|
|
|
dnl This enables automatically running all unit tests with all MFEX
|
|
|
|
dnl implementations.
|
|
|
|
AC_DEFUN([OVS_CHECK_MFEX_AUTOVALIDATOR], [
|
|
|
|
AC_ARG_ENABLE([mfex-default-autovalidator],
|
2022-07-27 14:42:08 +02:00
|
|
|
[AS_HELP_STRING([--enable-mfex-default-autovalidator],
|
2021-08-03 19:36:39 +02:00
|
|
|
[Enable MFEX autovalidator as default
|
|
|
|
miniflow_extract implementation.])],
|
2021-07-15 21:36:11 +05:30
|
|
|
[autovalidator=yes],[autovalidator=no])
|
|
|
|
AC_MSG_CHECKING([whether MFEX Autovalidator is default implementation])
|
|
|
|
if test "$autovalidator" != yes; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
else
|
2021-08-03 19:36:39 +02:00
|
|
|
AC_DEFINE([MFEX_AUTOVALIDATOR_DEFAULT], [1],
|
|
|
|
[Autovalidator for miniflow_extract is a default implementation.])
|
2021-07-15 21:36:11 +05:30
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2020-07-13 13:42:10 +01:00
|
|
|
dnl Set OVS DPCLS Autovalidator as default subtable search at compile time?
|
|
|
|
dnl This enables automatically running all unit tests with all DPCLS
|
|
|
|
dnl implementations.
|
|
|
|
AC_DEFUN([OVS_CHECK_DPCLS_AUTOVALIDATOR], [
|
|
|
|
AC_ARG_ENABLE([autovalidator],
|
2022-07-27 14:42:08 +02:00
|
|
|
[AS_HELP_STRING([--enable-autovalidator],
|
2021-08-03 19:36:39 +02:00
|
|
|
[Enable DPCLS autovalidator as default subtable
|
|
|
|
search implementation.])],
|
2020-07-13 13:42:10 +01:00
|
|
|
[autovalidator=yes],[autovalidator=no])
|
|
|
|
AC_MSG_CHECKING([whether DPCLS Autovalidator is default implementation])
|
|
|
|
if test "$autovalidator" != yes; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
else
|
2021-08-03 19:36:39 +02:00
|
|
|
AC_DEFINE([DPCLS_AUTOVALIDATOR_DEFAULT], [1],
|
|
|
|
[Autovalidator for the userspace datapath classifier is a
|
|
|
|
default implementation.])
|
2020-07-13 13:42:10 +01:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2021-07-09 15:58:18 +00:00
|
|
|
dnl Set OVS DPIF default implementation at configure time for running the unit
|
|
|
|
dnl tests on the whole codebase without modifying tests per DPIF impl
|
|
|
|
AC_DEFUN([OVS_CHECK_DPIF_AVX512_DEFAULT], [
|
|
|
|
AC_ARG_ENABLE([dpif-default-avx512],
|
2022-07-27 14:42:08 +02:00
|
|
|
[AS_HELP_STRING([--enable-dpif-default-avx512],
|
2021-08-03 19:36:39 +02:00
|
|
|
[Enable DPIF AVX512 implementation as default.])],
|
2021-07-09 15:58:18 +00:00
|
|
|
[dpifavx512=yes],[dpifavx512=no])
|
|
|
|
AC_MSG_CHECKING([whether DPIF AVX512 is default implementation])
|
|
|
|
if test "$dpifavx512" != yes; then
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
else
|
2021-08-03 19:36:39 +02:00
|
|
|
AC_DEFINE([DPIF_AVX512_DEFAULT], [1],
|
|
|
|
[DPIF AVX512 is a default implementation of the userspace
|
|
|
|
datapath interface.])
|
2021-07-09 15:58:18 +00:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2021-08-03 19:36:39 +02:00
|
|
|
dnl OVS_CHECK_AVX512
|
|
|
|
dnl
|
2022-05-17 10:08:18 +00:00
|
|
|
dnl Checks if compiler and binutils supports various AVX512 ISA.
|
2021-08-03 19:36:39 +02:00
|
|
|
AC_DEFUN([OVS_CHECK_AVX512], [
|
|
|
|
OVS_CHECK_BINUTILS_AVX512
|
2022-07-15 10:16:19 +00:00
|
|
|
OVS_CHECK_GCC_AVX512VL
|
2022-05-17 10:08:18 +00:00
|
|
|
OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512f], [HAVE_AVX512F])
|
|
|
|
OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512bw], [HAVE_AVX512BW])
|
2022-07-01 17:58:37 +05:30
|
|
|
OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512vl], [HAVE_AVX512VL])
|
2022-05-17 10:08:18 +00:00
|
|
|
OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512vbmi], [HAVE_AVX512VBMI])
|
2022-08-11 10:36:38 +00:00
|
|
|
OVS_CHECK_AVX512VPOPCNTDQ
|
2021-08-03 19:36:39 +02:00
|
|
|
])
|
|
|
|
|
2011-04-12 11:43:11 -07:00
|
|
|
dnl OVS_ENABLE_WERROR
|
|
|
|
AC_DEFUN([OVS_ENABLE_WERROR],
|
|
|
|
[AC_ARG_ENABLE(
|
|
|
|
[Werror],
|
2022-07-27 14:42:08 +02:00
|
|
|
[AS_HELP_STRING([--enable-Werror], [Add -Werror to CFLAGS])],
|
2011-04-12 11:43:11 -07:00
|
|
|
[], [enable_Werror=no])
|
|
|
|
AC_CONFIG_COMMANDS_PRE(
|
|
|
|
[if test "X$enable_Werror" = Xyes; then
|
2014-09-11 21:34:21 +02:00
|
|
|
OVS_CFLAGS="$OVS_CFLAGS -Werror"
|
2017-07-06 15:12:00 -07:00
|
|
|
fi])
|
|
|
|
|
|
|
|
# Unless --enable-Werror is specified, report but do not fail the build
|
|
|
|
# for errors reported by flake8.
|
|
|
|
if test "X$enable_Werror" = Xyes; then
|
|
|
|
FLAKE8_WERROR=
|
|
|
|
else
|
|
|
|
FLAKE8_WERROR=-
|
|
|
|
fi
|
2018-01-11 13:59:04 -08:00
|
|
|
AC_SUBST([FLAKE8_WERROR])
|
|
|
|
|
|
|
|
# If --enable-Werror is specified, fail the build on sparse warnings.
|
|
|
|
if test "X$enable_Werror" = Xyes; then
|
|
|
|
SPARSE_WERROR=-Wsparse-error
|
|
|
|
else
|
|
|
|
SPARSE_WERROR=
|
|
|
|
fi
|
|
|
|
AC_SUBST([SPARSE_WERROR])])
|
2011-04-12 11:43:11 -07:00
|
|
|
|
2022-07-08 15:34:01 +02:00
|
|
|
dnl Version for a top level invocation, since AC_REQUIRE can not be used
|
|
|
|
dnl outside of AC_DEFUN, but needed to protect against double expansion.
|
|
|
|
AC_DEFUN([OVS_ENABLE_WERROR_TOP], [AC_REQUIRE([OVS_ENABLE_WERROR])])
|
|
|
|
|
2011-06-22 09:26:31 -07:00
|
|
|
dnl OVS_CHECK_LINUX
|
2009-07-08 13:19:16 -07:00
|
|
|
dnl
|
2016-10-18 21:03:45 +01:00
|
|
|
dnl Configure linux kernel source tree
|
2011-06-22 09:26:31 -07:00
|
|
|
AC_DEFUN([OVS_CHECK_LINUX], [
|
2011-06-22 11:07:33 -07:00
|
|
|
if test X"$with_linux" != X; then
|
2022-07-14 14:23:30 -07:00
|
|
|
AC_MSG_WARN([--with-linux is no longer supported])
|
2009-07-08 13:19:16 -07:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2019-11-04 18:34:49 +02:00
|
|
|
dnl OVS_CHECK_LINUX_NETLINK
|
|
|
|
dnl
|
|
|
|
dnl Configure Linux netlink compat.
|
|
|
|
AC_DEFUN([OVS_CHECK_LINUX_NETLINK], [
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/netlink.h>], [
|
|
|
|
struct nla_bitfield32 x = { 0 };
|
|
|
|
])],
|
|
|
|
[AC_DEFINE([HAVE_NLA_BITFIELD32], [1],
|
|
|
|
[Define to 1 if struct nla_bitfield32 is available.])])
|
|
|
|
])
|
|
|
|
|
2017-05-28 14:59:45 +03:00
|
|
|
dnl OVS_CHECK_LINUX_TC
|
|
|
|
dnl
|
|
|
|
dnl Configure Linux tc compat.
|
|
|
|
AC_DEFUN([OVS_CHECK_LINUX_TC], [
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/pkt_cls.h>], [
|
2022-09-30 14:07:56 +08:00
|
|
|
int x = TCA_ACT_FLAGS_SKIP_HW;
|
2017-05-28 14:59:45 +03:00
|
|
|
])],
|
2022-09-30 14:07:56 +08:00
|
|
|
[AC_DEFINE([HAVE_TCA_ACT_FLAGS_SKIP_HW], [1],
|
|
|
|
[Define to 1 if TCA_ACT_FLAGS_SKIP_HW is available.])])
|
2017-05-28 14:59:45 +03:00
|
|
|
|
2019-11-06 09:34:46 +02:00
|
|
|
AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include <linux/pkt_cls.h>])
|
|
|
|
|
2017-05-28 14:59:45 +03:00
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/tc_act/tc_vlan.h>], [
|
|
|
|
int x = TCA_VLAN_PUSH_VLAN_PRIORITY;
|
|
|
|
])],
|
|
|
|
[AC_DEFINE([HAVE_TCA_VLAN_PUSH_VLAN_PRIORITY], [1],
|
2018-07-31 13:40:39 +03:00
|
|
|
[Define to 1 if TCA_VLAN_PUSH_VLAN_PRIORITY is available.])])
|
2017-05-28 14:59:45 +03:00
|
|
|
|
2019-07-30 12:05:14 +01:00
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/tc_act/tc_mpls.h>], [
|
|
|
|
int x = TCA_MPLS_TTL;
|
|
|
|
])],
|
|
|
|
[AC_DEFINE([HAVE_TCA_MPLS_TTL], [1],
|
|
|
|
[Define to 1 if HAVE_TCA_MPLS_TTL is available.])])
|
|
|
|
|
2017-05-28 14:59:45 +03:00
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/tc_act/tc_tunnel_key.h>], [
|
2018-07-31 13:40:38 +03:00
|
|
|
int x = TCA_TUNNEL_KEY_ENC_TTL;
|
2017-05-28 14:59:45 +03:00
|
|
|
])],
|
2018-07-31 13:40:38 +03:00
|
|
|
[AC_DEFINE([HAVE_TCA_TUNNEL_KEY_ENC_TTL], [1],
|
|
|
|
[Define to 1 if TCA_TUNNEL_KEY_ENC_TTL is available.])])
|
2017-09-18 07:16:01 +03:00
|
|
|
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/tc_act/tc_pedit.h>], [
|
|
|
|
int x = TCA_PEDIT_KEY_EX_HDR_TYPE_UDP;
|
|
|
|
])],
|
|
|
|
[AC_DEFINE([HAVE_TCA_PEDIT_KEY_EX_HDR_TYPE_UDP], [1],
|
2018-07-31 13:40:39 +03:00
|
|
|
[Define to 1 if TCA_PEDIT_KEY_EX_HDR_TYPE_UDP is available.])])
|
2019-04-09 15:36:11 +01:00
|
|
|
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/tc_act/tc_skbedit.h>], [
|
|
|
|
int x = TCA_SKBEDIT_FLAGS;
|
|
|
|
])],
|
|
|
|
[AC_DEFINE([HAVE_TCA_SKBEDIT_FLAGS], [1],
|
|
|
|
[Define to 1 if TCA_SKBEDIT_FLAGS is available.])])
|
2021-11-07 14:12:34 +02:00
|
|
|
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/gen_stats.h>], [
|
|
|
|
int x = TCA_STATS_PKT64;
|
|
|
|
])],
|
|
|
|
[AC_DEFINE([HAVE_TCA_STATS_PKT64], [1],
|
|
|
|
[Define to 1 if TCA_STATS_PKT64 is available.])])
|
2017-05-28 14:59:45 +03:00
|
|
|
])
|
|
|
|
|
2019-05-21 14:16:30 -04:00
|
|
|
dnl OVS_CHECK_LINUX_SCTP_CT
|
|
|
|
dnl
|
|
|
|
dnl Checks for kernels which need additional SCTP state
|
|
|
|
AC_DEFUN([OVS_CHECK_LINUX_SCTP_CT], [
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/netfilter/nfnetlink.h>
|
|
|
|
#include <linux/netfilter/nfnetlink_conntrack.h>
|
|
|
|
#include <linux/netfilter/nf_conntrack_common.h>
|
|
|
|
#include <linux/netfilter/nf_conntrack_sctp.h>], [
|
|
|
|
int x = SCTP_CONNTRACK_HEARTBEAT_SENT;
|
|
|
|
])],
|
|
|
|
[AC_DEFINE([HAVE_SCTP_CONNTRACK_HEARTBEATS], [1],
|
|
|
|
[Define to 1 if SCTP_CONNTRACK_HEARTBEAT_SENT is available.])])
|
|
|
|
])
|
|
|
|
|
2020-07-07 15:59:49 -07:00
|
|
|
dnl OVS_CHECK_LINUX_VIRTIO_TYPES
|
|
|
|
dnl
|
|
|
|
dnl Checks for kernels that need virtio_types definition.
|
|
|
|
AC_DEFUN([OVS_CHECK_LINUX_VIRTIO_TYPES], [
|
|
|
|
AC_COMPILE_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([#include <linux/virtio_types.h>], [
|
|
|
|
__virtio16 x = 0;
|
|
|
|
])],
|
|
|
|
[AC_DEFINE([HAVE_VIRTIO_TYPES], [1],
|
|
|
|
[Define to 1 if __virtio16 is available.])])
|
|
|
|
])
|
|
|
|
|
2019-04-11 10:29:42 +03:00
|
|
|
dnl OVS_FIND_DEPENDENCY(FUNCTION, SEARCH_LIBS, NAME_TO_PRINT)
|
|
|
|
dnl
|
|
|
|
dnl Check for a function in a library list.
|
|
|
|
AC_DEFUN([OVS_FIND_DEPENDENCY], [
|
|
|
|
AC_SEARCH_LIBS([$1], [$2], [], [
|
|
|
|
AC_MSG_ERROR([unable to find $3, install the dependency package])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
|
2019-07-18 13:11:14 -07:00
|
|
|
dnl OVS_CHECK_LINUX_AF_XDP
|
|
|
|
dnl
|
2022-12-22 01:06:20 +01:00
|
|
|
dnl Check both Linux kernel AF_XDP and libbpf/libxdp support
|
2019-07-18 13:11:14 -07:00
|
|
|
AC_DEFUN([OVS_CHECK_LINUX_AF_XDP], [
|
2022-12-22 01:06:24 +01:00
|
|
|
AC_ARG_ENABLE(
|
|
|
|
[afxdp],
|
|
|
|
[AS_HELP_STRING([--disable-afxdp], [Disable AF-XDP support])],
|
|
|
|
[case "${enableval}" in
|
|
|
|
(yes | no | auto) ;;
|
|
|
|
(*) AC_MSG_ERROR([bad value ${enableval} for --enable-afxdp]) ;;
|
|
|
|
esac],
|
|
|
|
[enable_afxdp=auto])
|
|
|
|
|
2019-07-18 13:11:14 -07:00
|
|
|
AC_MSG_CHECKING([whether AF_XDP is enabled])
|
2022-12-22 01:06:24 +01:00
|
|
|
if test "$enable_afxdp" == no; then
|
2019-07-18 13:11:14 -07:00
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
AF_XDP_ENABLE=false
|
|
|
|
else
|
2022-12-22 01:06:24 +01:00
|
|
|
AC_MSG_RESULT([$enable_afxdp])
|
2019-07-18 13:11:14 -07:00
|
|
|
AF_XDP_ENABLE=true
|
2022-12-22 01:06:24 +01:00
|
|
|
failed_dep=none
|
|
|
|
dnl Saving libs to restore in case we will end up not building with AF_XDP.
|
|
|
|
save_LIBS=$LIBS
|
2019-07-18 13:11:14 -07:00
|
|
|
|
2022-12-22 01:06:24 +01:00
|
|
|
AC_CHECK_HEADER([bpf/libbpf.h], [], [failed_dep="bpf/libbpf.h"])
|
2019-07-18 13:11:14 -07:00
|
|
|
|
2022-12-22 01:06:24 +01:00
|
|
|
if test "$failed_dep" = none; then
|
|
|
|
AC_CHECK_HEADER([linux/if_xdp.h], [], [failed_dep="linux/if_xdp.h"])
|
|
|
|
fi
|
2019-07-18 13:11:14 -07:00
|
|
|
|
2022-12-22 01:06:24 +01:00
|
|
|
if test "$failed_dep" = none; then
|
|
|
|
AC_SEARCH_LIBS([libbpf_strerror], [bpf], [], [failed_dep="libbpf"])
|
|
|
|
AC_CHECK_FUNCS([bpf_xdp_query_id bpf_xdp_detach])
|
|
|
|
fi
|
2022-12-22 01:06:20 +01:00
|
|
|
|
2022-12-22 01:06:24 +01:00
|
|
|
if test "$failed_dep" = none -a "x$ac_cv_func_bpf_xdp_detach" = xyes; then
|
2022-12-22 01:06:20 +01:00
|
|
|
dnl We have libbpf >= 0.7. Look for libxdp as xsk functions
|
|
|
|
dnl were moved into this library.
|
2022-12-22 01:06:24 +01:00
|
|
|
AC_SEARCH_LIBS([libxdp_strerror], [xdp],
|
|
|
|
AC_CHECK_HEADER([xdp/xsk.h],
|
|
|
|
AC_DEFINE([HAVE_LIBXDP], [1], [xsk.h is supplied with libxdp]),
|
|
|
|
[failed_dep="xdp/xsk.h"]),
|
|
|
|
[failed_dep="libxdp"])
|
|
|
|
elif test "$failed_dep" = none; then
|
2022-12-22 01:06:20 +01:00
|
|
|
dnl libbpf < 0.7 contains all the necessary functionality.
|
2022-12-22 01:06:24 +01:00
|
|
|
AC_CHECK_HEADER([bpf/xsk.h], [], [failed_dep="bpf/xsk.h"])
|
2022-12-22 01:06:20 +01:00
|
|
|
fi
|
2019-07-18 13:11:14 -07:00
|
|
|
|
2022-12-22 01:06:24 +01:00
|
|
|
if test "$failed_dep" = none; then
|
|
|
|
AC_CHECK_FUNCS([pthread_spin_lock], [], [failed_dep="pthread_spin_lock"])
|
|
|
|
fi
|
2019-07-18 13:11:14 -07:00
|
|
|
|
2022-12-22 01:06:24 +01:00
|
|
|
if test "$failed_dep" = none; then
|
|
|
|
AC_SEARCH_LIBS([numa_alloc_onnode], [numa], [], [failed_dep="libnuma"])
|
|
|
|
fi
|
2020-01-03 17:13:26 -08:00
|
|
|
|
2022-12-22 01:06:24 +01:00
|
|
|
if test "$failed_dep" = none; then
|
|
|
|
AC_DEFINE([HAVE_AF_XDP], [1],
|
|
|
|
[Define to 1 if AF_XDP support is available and enabled.])
|
|
|
|
elif test "$enable_afxdp" = yes; then
|
|
|
|
AC_MSG_ERROR([Missing $failed_dep dependency for AF_XDP support])
|
|
|
|
else
|
|
|
|
AC_MSG_WARN(m4_normalize(
|
|
|
|
[Cannot find $failed_dep, netdev-afxdp will not be supported
|
|
|
|
(use --disable-afxdp to suppress this warning).]))
|
|
|
|
AF_XDP_ENABLE=false
|
|
|
|
LIBS=$save_LIBS
|
|
|
|
fi
|
2019-07-18 13:11:14 -07:00
|
|
|
fi
|
|
|
|
AM_CONDITIONAL([HAVE_AF_XDP], test "$AF_XDP_ENABLE" = true)
|
|
|
|
])
|
|
|
|
|
2014-03-24 19:23:08 -07:00
|
|
|
dnl OVS_CHECK_DPDK
|
|
|
|
dnl
|
|
|
|
dnl Configure DPDK source tree
|
|
|
|
AC_DEFUN([OVS_CHECK_DPDK], [
|
|
|
|
AC_ARG_WITH([dpdk],
|
2022-07-27 14:42:08 +02:00
|
|
|
[AS_HELP_STRING([--with-dpdk=static|shared|yes],
|
2020-12-15 16:41:28 +00:00
|
|
|
[Specify "static" or "shared" depending on the
|
|
|
|
DPDK libraries to use])],
|
2016-06-01 18:48:07 +02:00
|
|
|
[have_dpdk=true])
|
2014-03-24 19:23:08 -07:00
|
|
|
|
2019-10-23 10:19:39 -07:00
|
|
|
AC_MSG_CHECKING([whether dpdk is enabled])
|
2016-06-01 18:48:07 +02:00
|
|
|
if test "$have_dpdk" != true || test "$with_dpdk" = no; then
|
2016-04-12 11:44:15 +01:00
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
DPDKLIB_FOUND=false
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
case "$with_dpdk" in
|
2020-12-15 16:41:28 +00:00
|
|
|
"shared")
|
|
|
|
PKG_CHECK_MODULES([DPDK], [libdpdk], [
|
|
|
|
DPDK_INCLUDE="$DPDK_CFLAGS"
|
2021-01-28 10:32:24 +00:00
|
|
|
DPDK_LIB="$DPDK_LIBS"])
|
2020-12-15 16:41:28 +00:00
|
|
|
;;
|
|
|
|
"static" | "yes")
|
|
|
|
PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [
|
|
|
|
DPDK_INCLUDE="$DPDK_CFLAGS"
|
2021-01-28 10:32:24 +00:00
|
|
|
DPDK_LIB="$DPDK_LIBS"])
|
2020-12-15 16:41:28 +00:00
|
|
|
|
|
|
|
dnl Statically linked private DPDK objects of form
|
|
|
|
dnl -l:file.a must be positioned between
|
|
|
|
dnl --whole-archive ... --no-whole-archive linker parameters.
|
|
|
|
dnl Old pkg-config versions misplace --no-whole-archive parameter
|
|
|
|
dnl and put it next to --whole-archive.
|
|
|
|
AC_MSG_CHECKING([for faulty pkg-config version])
|
|
|
|
echo "$DPDK_LIB" | grep -q 'whole-archive.*l:lib.*no-whole-archive'
|
|
|
|
status=$?
|
|
|
|
case $status in
|
|
|
|
0)
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
;;
|
|
|
|
1)
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
AC_MSG_ERROR([Please upgrade pkg-config])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_ERROR([grep exited with status $status])
|
|
|
|
;;
|
|
|
|
esac
|
2016-04-12 11:44:15 +01:00
|
|
|
esac
|
2014-03-24 19:23:08 -07:00
|
|
|
|
2014-09-11 21:34:21 +02:00
|
|
|
ovs_save_CFLAGS="$CFLAGS"
|
|
|
|
ovs_save_LDFLAGS="$LDFLAGS"
|
2017-07-14 08:36:39 +02:00
|
|
|
CFLAGS="$CFLAGS $DPDK_INCLUDE"
|
2016-04-12 11:44:15 +01:00
|
|
|
|
2019-02-12 16:19:31 +03:00
|
|
|
AC_CHECK_HEADERS([rte_config.h], [], [
|
|
|
|
AC_MSG_ERROR([unable to find rte_config.h in $with_dpdk])
|
|
|
|
], [AC_INCLUDES_DEFAULT])
|
|
|
|
|
2019-04-11 10:29:42 +03:00
|
|
|
AC_CHECK_DECLS([RTE_LIBRTE_VHOST_NUMA, RTE_EAL_NUMA_AWARE_HUGEPAGES], [
|
|
|
|
OVS_FIND_DEPENDENCY([get_mempolicy], [numa], [libnuma])
|
|
|
|
], [], [[#include <rte_config.h>]])
|
2016-08-10 15:28:27 +01:00
|
|
|
|
2021-09-16 06:11:06 +00:00
|
|
|
AC_CHECK_DECL([RTE_NET_PCAP], [
|
2020-02-10 13:48:53 +00:00
|
|
|
OVS_FIND_DEPENDENCY([pcap_dump_close], [pcap], [libpcap])
|
|
|
|
], [], [[#include <rte_config.h>]])
|
|
|
|
|
2021-09-16 06:11:06 +00:00
|
|
|
AC_CHECK_DECL([RTE_NET_AF_XDP], [
|
2022-12-22 01:06:20 +01:00
|
|
|
OVS_FIND_DEPENDENCY([libbpf_strerror], [bpf], [libbpf])
|
2020-02-10 13:48:54 +00:00
|
|
|
], [], [[#include <rte_config.h>]])
|
|
|
|
|
2019-04-11 10:29:42 +03:00
|
|
|
AC_CHECK_DECL([RTE_LIBRTE_VHOST_NUMA], [
|
|
|
|
AC_DEFINE([VHOST_NUMA], [1], [NUMA Aware vHost support detected in DPDK.])
|
|
|
|
], [], [[#include <rte_config.h>]])
|
2018-12-14 11:45:20 +01:00
|
|
|
|
2021-09-16 06:11:06 +00:00
|
|
|
AC_CHECK_DECL([RTE_NET_MLX5], [dnl found
|
2020-01-08 13:42:14 +01:00
|
|
|
AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found
|
2019-04-11 10:29:42 +03:00
|
|
|
OVS_FIND_DEPENDENCY([mlx5dv_create_wq], [mlx5], [libmlx5])
|
|
|
|
OVS_FIND_DEPENDENCY([verbs_init_cq], [ibverbs], [libibverbs])
|
|
|
|
], [[#include <rte_config.h>]])
|
|
|
|
], [], [[#include <rte_config.h>]])
|
2019-02-11 13:32:34 +02:00
|
|
|
|
2021-09-16 06:11:06 +00:00
|
|
|
AC_CHECK_DECL([RTE_NET_MLX4], [dnl found
|
2020-01-08 13:42:14 +01:00
|
|
|
AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found
|
2019-04-11 10:29:42 +03:00
|
|
|
OVS_FIND_DEPENDENCY([mlx4dv_init_obj], [mlx4], [libmlx4])
|
|
|
|
OVS_FIND_DEPENDENCY([verbs_init_cq], [ibverbs], [libibverbs])
|
|
|
|
], [[#include <rte_config.h>]])
|
|
|
|
], [], [[#include <rte_config.h>]])
|
2019-02-11 13:32:33 +02:00
|
|
|
|
2021-08-06 08:44:32 -04:00
|
|
|
AC_CHECK_DECL([MAP_HUGE_SHIFT], [
|
|
|
|
AC_DEFINE([DPDK_IN_MEMORY_SUPPORTED], [1], [If MAP_HUGE_SHIFT is
|
|
|
|
defined, anonymous memory mapping is supported by the
|
|
|
|
kernel, and --in-memory can be used.])
|
|
|
|
], [], [[#include <sys/mman.h>]])
|
|
|
|
|
2019-04-11 10:29:43 +03:00
|
|
|
# DPDK uses dlopen to load plugins.
|
|
|
|
OVS_FIND_DEPENDENCY([dlopen], [dl], [libdl])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether linking with dpdk works])
|
|
|
|
LIBS="$DPDK_LIB $LIBS"
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([#include <rte_config.h>
|
|
|
|
#include <rte_eal.h>],
|
|
|
|
[int rte_argc; char ** rte_argv;
|
|
|
|
rte_eal_init(rte_argc, rte_argv);])],
|
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
DPDKLIB_FOUND=true],
|
|
|
|
[AC_MSG_RESULT([no])
|
2020-12-15 16:41:28 +00:00
|
|
|
AC_MSG_ERROR(m4_normalize([
|
2022-01-09 02:05:46 -07:00
|
|
|
Failed to link with DPDK, check the config.log for more details.
|
|
|
|
If a working DPDK library was not found in the default search path,
|
|
|
|
update PKG_CONFIG_PATH for pkg-config to find the .pc file in a
|
|
|
|
non-standard location.]))
|
2019-04-11 10:29:43 +03:00
|
|
|
])
|
2014-06-03 11:29:53 -07:00
|
|
|
|
2014-09-11 21:34:21 +02:00
|
|
|
CFLAGS="$ovs_save_CFLAGS"
|
|
|
|
LDFLAGS="$ovs_save_LDFLAGS"
|
2020-12-15 16:41:28 +00:00
|
|
|
# Stripping out possible instruction set specific configuration that DPDK
|
|
|
|
# forces in pkg-config since this could override user-specified options.
|
|
|
|
# It's enough to have -mssse3 to build with DPDK headers.
|
|
|
|
DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-march=[[^ ]]*//g')
|
acinclude: Strip out -mno-avx512f provided by DPDK.
DPDK forces '-mno-avx512f' flag for the application if the toolchain
used to build DPDK had broken AVX512 support. But OVS could be built
with a completely different or fixed toolchain with correct avx512
support. In this case OVS will detect that toolchain is good and will
try to build AVX512-optimized classifier. However, '-mno-avx512f'
flag will be passed from the DPDK side breaking the build:
In file included from /gcc/x86_64-linux-gnu/8/include/immintrin.h:55,
from /gcc/x86_64-linux-gnu/8/include/x86intrin.h:48,
from /dpdk/../x86_64-linux-gnu/dpdk/rte_vect.h:28,
from /dpdk/../x86_64-linux-gnu/dpdk/rte_memcpy.h:17,
from /dpdk/rte_mempool.h:51,
from /dpdk/rte_mbuf.h:38,
from ../lib/dp-packet.h:25,
from ../lib/dpif.h:380,
from ../lib/dpif-netdev.h:23,
from ../lib/dpif-netdev-lookup-avx512-gather.c:22:
/usr/lib/gcc/x86_64-linux-gnu/8/include/avx512bwintrin.h:413:1: error:
inlining failed in call to always_inline '_mm512_sad_epu8':
target specific option mismatch
_mm512_sad_epu8 (__m512i __A, __m512i __B)
Fix that by stripping out `-mno-avx512f` as we already do for '-march'.
This will allow the OVS to decide if the AVX512 can be used.
Reordering of CFLAGS (i.e. adding DPDK flags before OVS ones) is not an
option since autotools might reorder them back later and it's very
unpredictable.
Reported-at: https://github.com/openvswitch/ovs-issues/issues/201
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
2021-01-08 12:46:56 +01:00
|
|
|
# Also stripping out '-mno-avx512f'. Support for AVX512 will be disabled
|
|
|
|
# if OVS will detect that it's broken. OVS could be built with a
|
|
|
|
# completely different toolchain that correctly supports AVX512, flags
|
|
|
|
# forced by DPDK only breaks our feature detection mechanism and leads to
|
|
|
|
# build failures: https://github.com/openvswitch/ovs-issues/issues/201
|
|
|
|
DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-mno-avx512f//g')
|
2017-07-14 08:36:39 +02:00
|
|
|
OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE"
|
2016-01-12 14:15:39 +03:00
|
|
|
OVS_ENABLE_OPTION([-mssse3])
|
2014-03-24 19:23:08 -07:00
|
|
|
|
2015-03-20 06:02:13 -07:00
|
|
|
# DPDK pmd drivers are not linked unless --whole-archive is used.
|
2014-08-12 10:43:35 -07:00
|
|
|
#
|
|
|
|
# This happens because the rest of the DPDK code doesn't use any symbol in
|
|
|
|
# the pmd driver objects, and the drivers register themselves using an
|
|
|
|
# __attribute__((constructor)) function.
|
2020-12-15 16:41:28 +00:00
|
|
|
# Wrap the DPDK libraries inside a single -Wl directive
|
|
|
|
# after comma separation to prevent autotools from reordering them.
|
|
|
|
DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_LIB"| tr -s ' ' ',' | sed 's/-Wl,//g')
|
|
|
|
# Replace -pthread with -lpthread for LD and remove the last extra comma.
|
|
|
|
DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_vswitchd_LDFLAGS"| sed 's/,$//' | \
|
|
|
|
sed 's/-pthread/-lpthread/g')
|
|
|
|
# Prepend "-Wl,".
|
|
|
|
DPDK_vswitchd_LDFLAGS="-Wl,$DPDK_vswitchd_LDFLAGS"
|
|
|
|
|
2014-08-19 01:23:55 +00:00
|
|
|
AC_SUBST([DPDK_vswitchd_LDFLAGS])
|
2014-03-24 19:23:08 -07:00
|
|
|
AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.])
|
|
|
|
fi
|
|
|
|
|
2016-04-12 11:44:15 +01:00
|
|
|
AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true)
|
2014-03-24 19:23:08 -07:00
|
|
|
])
|
|
|
|
|
2012-07-25 22:51:05 +02:00
|
|
|
dnl Checks for net/if_dl.h.
|
2013-03-14 15:20:55 -07:00
|
|
|
dnl
|
2013-05-21 17:50:02 +09:00
|
|
|
dnl (We use this as a proxy for checking whether we're building on FreeBSD
|
|
|
|
dnl or NetBSD.)
|
2012-06-29 21:11:24 +00:00
|
|
|
AC_DEFUN([OVS_CHECK_IF_DL],
|
|
|
|
[AC_CHECK_HEADER([net/if_dl.h],
|
|
|
|
[HAVE_IF_DL=yes],
|
|
|
|
[HAVE_IF_DL=no])
|
|
|
|
AM_CONDITIONAL([HAVE_IF_DL], [test "$HAVE_IF_DL" = yes])
|
|
|
|
if test "$HAVE_IF_DL" = yes; then
|
|
|
|
AC_DEFINE([HAVE_IF_DL], [1],
|
|
|
|
[Define to 1 if net/if_dl.h is available.])
|
2013-03-14 15:20:55 -07:00
|
|
|
|
2013-05-21 17:50:02 +09:00
|
|
|
# On these platforms we use libpcap to access network devices.
|
2013-03-14 15:20:55 -07:00
|
|
|
AC_SEARCH_LIBS([pcap_open_live], [pcap])
|
2012-06-29 21:11:24 +00:00
|
|
|
fi])
|
|
|
|
|
2009-06-10 14:16:40 -07:00
|
|
|
dnl Checks for buggy strtok_r.
|
|
|
|
dnl
|
|
|
|
dnl Some versions of glibc 2.7 has a bug in strtok_r when compiling
|
|
|
|
dnl with optimization that can cause segfaults:
|
|
|
|
dnl
|
|
|
|
dnl http://sources.redhat.com/bugzilla/show_bug.cgi?id=5614.
|
|
|
|
AC_DEFUN([OVS_CHECK_STRTOK_R],
|
|
|
|
[AC_CACHE_CHECK(
|
|
|
|
[whether strtok_r macro segfaults on some inputs],
|
|
|
|
[ovs_cv_strtok_r_bug],
|
|
|
|
[AC_RUN_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
],
|
2015-04-03 15:10:57 -07:00
|
|
|
[[#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
|
|
|
|
/* Assume bug is present, because relatively minor
|
|
|
|
changes in compiler settings (e.g. optimization
|
|
|
|
level) can make it crop up. */
|
|
|
|
return 1;
|
|
|
|
#else
|
|
|
|
char string[] = ":::";
|
2009-06-10 14:16:40 -07:00
|
|
|
char *save_ptr = (char *) 0xc0ffee;
|
|
|
|
char *token1, *token2;
|
|
|
|
token1 = strtok_r(string, ":", &save_ptr);
|
|
|
|
token2 = strtok_r(NULL, ":", &save_ptr);
|
2010-01-25 10:32:39 -08:00
|
|
|
freopen ("/dev/null", "w", stdout);
|
2009-06-10 14:16:40 -07:00
|
|
|
printf ("%s %s\n", token1, token2);
|
|
|
|
return 0;
|
2015-04-03 15:10:57 -07:00
|
|
|
#endif
|
2009-06-10 14:16:40 -07:00
|
|
|
]])],
|
|
|
|
[ovs_cv_strtok_r_bug=no],
|
|
|
|
[ovs_cv_strtok_r_bug=yes],
|
|
|
|
[ovs_cv_strtok_r_bug=yes])])
|
|
|
|
if test $ovs_cv_strtok_r_bug = yes; then
|
|
|
|
AC_DEFINE([HAVE_STRTOK_R_BUG], [1],
|
|
|
|
[Define if strtok_r macro segfaults on some inputs])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2009-07-08 13:19:16 -07:00
|
|
|
dnl ----------------------------------------------------------------------
|
|
|
|
dnl These macros are from GNU PSPP, with the following original license:
|
|
|
|
dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
|
|
|
dnl This file is free software; the Free Software Foundation
|
|
|
|
dnl gives unlimited permission to copy and/or distribute it,
|
|
|
|
dnl with or without modifications, as long as this notice is preserved.
|
|
|
|
|
2013-06-24 12:25:48 -07:00
|
|
|
AC_DEFUN([_OVS_CHECK_CC_OPTION], [dnl
|
2016-12-05 14:28:59 -08:00
|
|
|
m4_define([ovs_cv_name], [ovs_cv_[]m4_translit([$1], [-= ], [__])])dnl
|
2009-07-08 13:19:16 -07:00
|
|
|
AC_CACHE_CHECK([whether $CC accepts $1], [ovs_cv_name],
|
|
|
|
[ovs_save_CFLAGS="$CFLAGS"
|
2013-06-24 12:25:48 -07:00
|
|
|
dnl Include -Werror in the compiler options, because without -Werror
|
|
|
|
dnl clang's GCC-compatible compiler driver does not return a failure
|
|
|
|
dnl exit status even though it complains about options it does not
|
|
|
|
dnl understand.
|
2015-04-17 17:14:38 +09:00
|
|
|
dnl
|
|
|
|
dnl Also, check stderr as gcc exits with status 0 for options
|
|
|
|
dnl rejected at getopt level.
|
|
|
|
dnl % touch /tmp/a.c
|
|
|
|
dnl % gcc -g -c -Werror -Qunused-arguments /tmp/a.c; echo $?
|
|
|
|
dnl gcc: unrecognized option '-Qunused-arguments'
|
|
|
|
dnl 0
|
|
|
|
dnl %
|
2018-09-18 02:11:20 -07:00
|
|
|
dnl
|
|
|
|
dnl In addition, GCC does not complain about a -Wno-<foo> option that
|
|
|
|
dnl it does not understand, unless it has another error to report, so
|
|
|
|
dnl instead of testing for -Wno-<foo>, test for the positive version.
|
|
|
|
CFLAGS="$CFLAGS $WERROR m4_bpatsubst([$1], [-Wno-], [-W])"
|
2016-12-05 14:29:35 -08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_SOURCE([int x;])],
|
|
|
|
[if test -s conftest.err && grep "unrecognized option" conftest.err
|
|
|
|
then
|
|
|
|
ovs_cv_name[]=no
|
|
|
|
else
|
|
|
|
ovs_cv_name[]=yes
|
|
|
|
fi],
|
|
|
|
[ovs_cv_name[]=no])
|
2009-07-08 13:19:16 -07:00
|
|
|
CFLAGS="$ovs_save_CFLAGS"])
|
|
|
|
if test $ovs_cv_name = yes; then
|
2009-11-18 16:27:55 -08:00
|
|
|
m4_if([$2], [], [:], [$2])
|
2009-07-08 13:19:16 -07:00
|
|
|
else
|
|
|
|
m4_if([$3], [], [:], [$3])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2013-06-24 12:25:48 -07:00
|
|
|
dnl OVS_CHECK_WERROR
|
|
|
|
dnl
|
|
|
|
dnl Check whether the C compiler accepts -Werror.
|
|
|
|
dnl Sets $WERROR to "-Werror", if so, and otherwise to the empty string.
|
|
|
|
AC_DEFUN([OVS_CHECK_WERROR],
|
|
|
|
[WERROR=
|
|
|
|
_OVS_CHECK_CC_OPTION([-Werror], [WERROR=-Werror])])
|
|
|
|
|
|
|
|
dnl OVS_CHECK_CC_OPTION([OPTION], [ACTION-IF-ACCEPTED], [ACTION-IF-REJECTED])
|
|
|
|
dnl Check whether the given C compiler OPTION is accepted.
|
|
|
|
dnl If so, execute ACTION-IF-ACCEPTED, otherwise ACTION-IF-REJECTED.
|
|
|
|
AC_DEFUN([OVS_CHECK_CC_OPTION],
|
|
|
|
[AC_REQUIRE([OVS_CHECK_WERROR])
|
|
|
|
_OVS_CHECK_CC_OPTION([$1], [$2], [$3])])
|
|
|
|
|
2009-07-08 13:19:16 -07:00
|
|
|
dnl OVS_ENABLE_OPTION([OPTION])
|
|
|
|
dnl Check whether the given C compiler OPTION is accepted.
|
2009-11-19 13:25:42 -08:00
|
|
|
dnl If so, add it to WARNING_FLAGS.
|
2009-07-08 13:19:16 -07:00
|
|
|
dnl Example: OVS_ENABLE_OPTION([-Wdeclaration-after-statement])
|
|
|
|
AC_DEFUN([OVS_ENABLE_OPTION],
|
2009-11-19 13:25:42 -08:00
|
|
|
[OVS_CHECK_CC_OPTION([$1], [WARNING_FLAGS="$WARNING_FLAGS $1"])
|
|
|
|
AC_SUBST([WARNING_FLAGS])])
|
2009-11-20 09:45:26 -08:00
|
|
|
|
|
|
|
dnl OVS_CONDITIONAL_CC_OPTION([OPTION], [CONDITIONAL])
|
|
|
|
dnl Check whether the given C compiler OPTION is accepted.
|
|
|
|
dnl If so, enable the given Automake CONDITIONAL.
|
|
|
|
|
|
|
|
dnl Example: OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED])
|
|
|
|
AC_DEFUN([OVS_CONDITIONAL_CC_OPTION],
|
|
|
|
[OVS_CHECK_CC_OPTION(
|
|
|
|
[$1], [ovs_have_cc_option=yes], [ovs_have_cc_option=no])
|
|
|
|
AM_CONDITIONAL([$2], [test $ovs_have_cc_option = yes])])
|
2009-07-08 13:19:16 -07:00
|
|
|
dnl ----------------------------------------------------------------------
|
2011-02-22 14:47:19 -08:00
|
|
|
|
2022-05-17 10:08:18 +00:00
|
|
|
dnl OVS_CONDITIONAL_CC_OPTION_DEFINE([OPTION], [CONDITIONAL])
|
|
|
|
dnl Check whether the given C compiler OPTION is accepted.
|
|
|
|
dnl If so, enable the given Automake CONDITIONAL and define it.
|
|
|
|
dnl Example: OVS_CONDITIONAL_CC_OPTION_DEFINE([-mavx512f], [HAVE_AVX512F])
|
|
|
|
AC_DEFUN([OVS_CONDITIONAL_CC_OPTION_DEFINE],
|
|
|
|
[OVS_CHECK_CC_OPTION(
|
|
|
|
[$1], [ovs_have_cc_option=yes], [ovs_have_cc_option=no])
|
|
|
|
AM_CONDITIONAL([$2], [test $ovs_have_cc_option = yes])
|
|
|
|
if test "$ovs_have_cc_option" = yes; then
|
|
|
|
AC_DEFINE([$2], [1],
|
|
|
|
[Define to 1 if compiler supports the '$1' option.])
|
|
|
|
fi])
|
2011-05-06 13:00:49 -07:00
|
|
|
|
2011-07-11 13:57:58 -07:00
|
|
|
dnl OVS_CHECK_SPARSE_TARGET
|
|
|
|
dnl
|
|
|
|
dnl The "cgcc" script from "sparse" isn't very good at detecting the
|
|
|
|
dnl target for which the code is being built. This helps it out.
|
|
|
|
AC_DEFUN([OVS_CHECK_SPARSE_TARGET],
|
|
|
|
[AC_CACHE_CHECK(
|
|
|
|
[target hint for cgcc],
|
|
|
|
[ac_cv_sparse_target],
|
|
|
|
[AS_CASE([`$CC -dumpmachine 2>/dev/null`],
|
|
|
|
[i?86-* | athlon-*], [ac_cv_sparse_target=x86],
|
|
|
|
[x86_64-*], [ac_cv_sparse_target=x86_64],
|
|
|
|
[ac_cv_sparse_target=other])])
|
|
|
|
AS_CASE([$ac_cv_sparse_target],
|
sparse: Configure target operating system and fix fallout.
cgcc, the "sparse" wrapper that OVS uses, can be told the host architecture
or the host OS or both. Until now, OVS has told it the host architecture
because it is fairly common that it doesn't guess it automatically. Until
now, OS has not told it the host OS, assuming that it would get it right.
However, it doesn't--if you tell it the host OS or the host architecture,
it doesn't really have a default for the other. This means that on Linux
(presumably the only OS where sparse works properly for OVS), it was not
defining __linux__, which caused some weird behavior.
This commit adds a flag to the cgcc invocation to make it define __linux__
on Linux, and it fixes some errors that this would otherwise cause.
Acked-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-04-23 16:42:32 -07:00
|
|
|
[x86], [SPARSEFLAGS= CGCCFLAGS="-target=i86 -target=host_os_specs"],
|
|
|
|
[x86_64], [SPARSEFLAGS=-m64 CGCCFLAGS="-target=x86_64 -target=host_os_specs"],
|
2011-07-11 13:57:58 -07:00
|
|
|
[SPARSEFLAGS= CGCCFLAGS=])
|
2019-05-28 15:34:14 +03:00
|
|
|
|
2019-10-09 14:30:48 -07:00
|
|
|
dnl Get the default defines for vector instructions from compiler to
|
2019-05-28 15:34:14 +03:00
|
|
|
dnl allow "sparse" correctly check the same code that will be built.
|
|
|
|
dnl Required for checking DPDK headers.
|
|
|
|
AC_MSG_CHECKING([vector options for cgcc])
|
|
|
|
VECTOR=$($CC -dM -E - < /dev/null | grep -E "MMX|SSE|AVX" | \
|
|
|
|
cut -c 9- | sed 's/ /=/' | sed 's/^/-D/' | tr '\n' ' ')
|
|
|
|
AC_MSG_RESULT([$VECTOR])
|
|
|
|
CGCCFLAGS="$CGCCFLAGS $VECTOR"
|
|
|
|
|
2011-07-11 13:57:58 -07:00
|
|
|
AC_SUBST([SPARSEFLAGS])
|
|
|
|
AC_SUBST([CGCCFLAGS])])
|
|
|
|
|
2013-04-05 16:56:52 -07:00
|
|
|
dnl OVS_SPARSE_EXTRA_INCLUDES
|
|
|
|
dnl
|
|
|
|
dnl The cgcc script from "sparse" does not search gcc's default
|
|
|
|
dnl search path. Get the default search path from GCC and pass
|
|
|
|
dnl them to sparse.
|
|
|
|
AC_DEFUN([OVS_SPARSE_EXTRA_INCLUDES],
|
|
|
|
AC_SUBST([SPARSE_EXTRA_INCLUDES],
|
|
|
|
[`$CC -v -E - </dev/null 2>&1 >/dev/null | sed -n -e '/^#include.*search.*starts.*here:/,/^End.*of.*search.*list\./s/^ \(.*\)/-I \1/p' |grep -v /usr/lib | grep -x -v '\-I /usr/include' | tr \\\n ' ' `] ))
|
|
|
|
|
2011-05-06 13:00:49 -07:00
|
|
|
dnl OVS_ENABLE_SPARSE
|
|
|
|
AC_DEFUN([OVS_ENABLE_SPARSE],
|
2011-07-11 13:57:58 -07:00
|
|
|
[AC_REQUIRE([OVS_CHECK_SPARSE_TARGET])
|
2013-04-05 16:56:52 -07:00
|
|
|
AC_REQUIRE([OVS_SPARSE_EXTRA_INCLUDES])
|
2012-07-25 10:28:38 -07:00
|
|
|
: ${SPARSE=sparse}
|
|
|
|
AC_SUBST([SPARSE])
|
|
|
|
AC_CONFIG_COMMANDS_PRE(
|
2022-03-23 12:56:23 +01:00
|
|
|
[CC='$(if $(C:0=),env REAL_CC="'"$CC"'" CHECK="$(SPARSE) $(SPARSE_WERROR) -I $(top_srcdir)/include/sparse -I $(top_srcdir)/include $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')'])
|
2018-01-11 15:49:24 -08:00
|
|
|
|
|
|
|
AC_ARG_ENABLE(
|
|
|
|
[sparse],
|
2022-07-27 14:42:08 +02:00
|
|
|
[AS_HELP_STRING([--enable-sparse], [Run "sparse" by default])],
|
2018-01-11 15:49:24 -08:00
|
|
|
[], [enable_sparse=no])
|
|
|
|
AM_CONDITIONAL([ENABLE_SPARSE_BY_DEFAULT], [test $enable_sparse = yes])])
|
2013-08-01 09:35:56 -07:00
|
|
|
|
2017-06-26 21:55:50 -03:00
|
|
|
dnl OVS_CTAGS_IDENTIFIERS
|
|
|
|
dnl
|
2020-06-10 16:49:45 -03:00
|
|
|
dnl ctags ignores symbols with extras identifiers. This is a list of
|
|
|
|
dnl specially handled identifiers to be ignored. [ctags(1) -I <list>].
|
2017-06-26 21:55:50 -03:00
|
|
|
AC_DEFUN([OVS_CTAGS_IDENTIFIERS],
|
|
|
|
AC_SUBST([OVS_CTAGS_IDENTIFIERS_LIST],
|
2020-06-10 16:49:45 -03:00
|
|
|
["OVS_LOCKABLE OVS_NO_THREAD_SAFETY_ANALYSIS OVS_REQ_RDLOCK+ OVS_ACQ_RDLOCK+ OVS_REQ_WRLOCK+ OVS_ACQ_WRLOCK+ OVS_REQUIRES+ OVS_ACQUIRES+ OVS_TRY_WRLOCK+ OVS_TRY_RDLOCK+ OVS_TRY_LOCK+ OVS_GUARDED_BY+ OVS_EXCLUDED+ OVS_RELEASES+ OVS_ACQ_BEFORE+ OVS_ACQ_AFTER+"]))
|
2017-06-26 21:55:50 -03:00
|
|
|
|
2013-08-01 09:35:56 -07:00
|
|
|
dnl OVS_PTHREAD_SET_NAME
|
|
|
|
dnl
|
|
|
|
dnl This checks for three known variants of pthreads functions for setting
|
|
|
|
dnl the name of the current thread:
|
|
|
|
dnl
|
|
|
|
dnl glibc: int pthread_setname_np(pthread_t, const char *name);
|
|
|
|
dnl NetBSD: int pthread_setname_np(pthread_t, const char *format, void *arg);
|
|
|
|
dnl FreeBSD: int pthread_set_name_np(pthread_t, const char *name);
|
|
|
|
dnl
|
|
|
|
dnl For glibc and FreeBSD, the arguments are just a thread and its name. For
|
|
|
|
dnl NetBSD, 'format' is a printf() format string and 'arg' is an argument to
|
|
|
|
dnl provide to it.
|
|
|
|
dnl
|
|
|
|
dnl This macro defines:
|
|
|
|
dnl
|
|
|
|
dnl glibc: HAVE_GLIBC_PTHREAD_SETNAME_NP
|
|
|
|
dnl NetBSD: HAVE_NETBSD_PTHREAD_SETNAME_NP
|
|
|
|
dnl FreeBSD: HAVE_PTHREAD_SET_NAME_NP
|
|
|
|
AC_DEFUN([OVS_CHECK_PTHREAD_SET_NAME],
|
|
|
|
[AC_CHECK_FUNCS([pthread_set_name_np])
|
|
|
|
if test $ac_cv_func_pthread_set_name_np != yes; then
|
|
|
|
AC_CACHE_CHECK(
|
|
|
|
[for pthread_setname_np() variant],
|
|
|
|
[ovs_cv_pthread_setname_np],
|
|
|
|
[AC_LINK_IFELSE(
|
2014-05-09 13:28:49 +09:00
|
|
|
[AC_LANG_PROGRAM([#include <pthread.h>
|
2013-08-01 09:35:56 -07:00
|
|
|
], [pthread_setname_np(pthread_self(), "name");])],
|
2014-05-09 13:28:49 +09:00
|
|
|
[ovs_cv_pthread_setname_np=glibc],
|
2013-08-01 09:35:56 -07:00
|
|
|
[AC_LINK_IFELSE(
|
2014-05-09 13:28:49 +09:00
|
|
|
[AC_LANG_PROGRAM([#include <pthread.h>
|
2013-08-01 09:35:56 -07:00
|
|
|
], [pthread_setname_np(pthread_self(), "%s", "name");])],
|
|
|
|
[ovs_cv_pthread_setname_np=netbsd],
|
2014-05-09 13:28:49 +09:00
|
|
|
[ovs_cv_pthread_setname_np=none])])])
|
2013-08-01 09:35:56 -07:00
|
|
|
case $ovs_cv_pthread_setname_np in # (
|
|
|
|
glibc)
|
2014-05-09 13:28:49 +09:00
|
|
|
AC_DEFINE(
|
|
|
|
[HAVE_GLIBC_PTHREAD_SETNAME_NP], [1],
|
|
|
|
[Define to 1 if pthread_setname_np() is available and takes 2 parameters (like glibc).])
|
|
|
|
;; # (
|
2013-08-01 09:35:56 -07:00
|
|
|
netbsd)
|
2014-05-09 13:28:49 +09:00
|
|
|
AC_DEFINE(
|
|
|
|
[HAVE_NETBSD_PTHREAD_SETNAME_NP], [1],
|
|
|
|
[Define to 1 if pthread_setname_np() is available and takes 3 parameters (like NetBSD).])
|
|
|
|
;;
|
2013-08-01 09:35:56 -07:00
|
|
|
esac
|
|
|
|
fi])
|
2014-01-23 15:35:22 -08:00
|
|
|
|
|
|
|
dnl OVS_CHECK_LINUX_HOST.
|
|
|
|
dnl
|
|
|
|
dnl Checks whether we're building for a Linux host, based on the presence of
|
|
|
|
dnl the __linux__ preprocessor symbol, and sets up an Automake conditional
|
|
|
|
dnl LINUX based on the result.
|
|
|
|
AC_DEFUN([OVS_CHECK_LINUX_HOST],
|
|
|
|
[AC_CACHE_CHECK(
|
|
|
|
[whether __linux__ is defined],
|
|
|
|
[ovs_cv_linux],
|
|
|
|
[AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([enum { LINUX = __linux__};], [])],
|
|
|
|
[ovs_cv_linux=true],
|
|
|
|
[ovs_cv_linux=false])])
|
|
|
|
AM_CONDITIONAL([LINUX], [$ovs_cv_linux])])
|