]>
Commit | Line | Data |
---|---|---|
064af421 BP |
1 | # -*- autoconf -*- |
2 | ||
0cdd5b13 | 3 | # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019 Nicira, Inc. |
064af421 | 4 | # |
a14bc59f BP |
5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
6 | # you may not use this file except in compliance with the License. | |
7 | # You may obtain a copy of the License at: | |
064af421 | 8 | # |
a14bc59f BP |
9 | # http://www.apache.org/licenses/LICENSE-2.0 |
10 | # | |
11 | # Unless required by applicable law or agreed to in writing, software | |
12 | # distributed under the License is distributed on an "AS IS" BASIS, | |
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | # See the License for the specific language governing permissions and | |
15 | # limitations under the License. | |
064af421 | 16 | |
e90e115a HH |
17 | dnl Set OVS DPCLS Autovalidator as default subtable search at compile time? |
18 | dnl This enables automatically running all unit tests with all DPCLS | |
19 | dnl implementations. | |
20 | AC_DEFUN([OVS_CHECK_DPCLS_AUTOVALIDATOR], [ | |
21 | AC_ARG_ENABLE([autovalidator], | |
22 | [AC_HELP_STRING([--enable-autovalidator], [Enable DPCLS autovalidator as default subtable search implementation.])], | |
23 | [autovalidator=yes],[autovalidator=no]) | |
24 | AC_MSG_CHECKING([whether DPCLS Autovalidator is default implementation]) | |
25 | if test "$autovalidator" != yes; then | |
26 | AC_MSG_RESULT([no]) | |
27 | else | |
28 | OVS_CFLAGS="$OVS_CFLAGS -DDPCLS_AUTOVALIDATOR_DEFAULT" | |
29 | AC_MSG_RESULT([yes]) | |
30 | fi | |
31 | ]) | |
32 | ||
a64e37a1 BP |
33 | dnl OVS_ENABLE_WERROR |
34 | AC_DEFUN([OVS_ENABLE_WERROR], | |
35 | [AC_ARG_ENABLE( | |
36 | [Werror], | |
37 | [AC_HELP_STRING([--enable-Werror], [Add -Werror to CFLAGS])], | |
38 | [], [enable_Werror=no]) | |
39 | AC_CONFIG_COMMANDS_PRE( | |
40 | [if test "X$enable_Werror" = Xyes; then | |
95626395 | 41 | OVS_CFLAGS="$OVS_CFLAGS -Werror" |
308bf988 BP |
42 | fi]) |
43 | ||
44 | # Unless --enable-Werror is specified, report but do not fail the build | |
45 | # for errors reported by flake8. | |
46 | if test "X$enable_Werror" = Xyes; then | |
47 | FLAKE8_WERROR= | |
48 | else | |
49 | FLAKE8_WERROR=- | |
50 | fi | |
df265086 BP |
51 | AC_SUBST([FLAKE8_WERROR]) |
52 | ||
53 | # If --enable-Werror is specified, fail the build on sparse warnings. | |
54 | if test "X$enable_Werror" = Xyes; then | |
55 | SPARSE_WERROR=-Wsparse-error | |
56 | else | |
57 | SPARSE_WERROR= | |
58 | fi | |
59 | AC_SUBST([SPARSE_WERROR])]) | |
a64e37a1 | 60 | |
e3438006 | 61 | dnl OVS_CHECK_LINUX |
064af421 | 62 | dnl |
997d327d | 63 | dnl Configure linux kernel source tree |
e3438006 | 64 | AC_DEFUN([OVS_CHECK_LINUX], [ |
8a2d6596 BP |
65 | AC_ARG_WITH([linux], |
66 | [AC_HELP_STRING([--with-linux=/path/to/linux], | |
67 | [Specify the Linux kernel build directory])]) | |
68 | AC_ARG_WITH([linux-source], | |
69 | [AC_HELP_STRING([--with-linux-source=/path/to/linux-source], | |
70 | [Specify the Linux kernel source directory | |
a0903134 YT |
71 | (usually figured out automatically from build |
72 | directory)])]) | |
8a2d6596 BP |
73 | |
74 | # Deprecated equivalents to --with-linux, --with-linux-source. | |
75 | AC_ARG_WITH([l26]) | |
76 | AC_ARG_WITH([l26-source]) | |
77 | ||
78 | if test X"$with_linux" != X; then | |
79 | KBUILD=$with_linux | |
24ce0afe | 80 | AC_MSG_WARN([--with-linux is deprecated and kernel support is limited to 5.8 and below]) |
8a2d6596 BP |
81 | elif test X"$with_l26" != X; then |
82 | KBUILD=$with_l26 | |
83 | AC_MSG_WARN([--with-l26 is deprecated, please use --with-linux instead]) | |
84 | else | |
85 | KBUILD= | |
86 | fi | |
87 | ||
88 | if test X"$KBUILD" != X; then | |
89 | if test X"$with_linux_source" != X; then | |
90 | KSRC=$with_linux_source | |
91 | elif test X"$with_l26_source" != X; then | |
92 | KSRC=$with_l26_source | |
93 | AC_MSG_WARN([--with-l26-source is deprecated, please use --with-linux-source instead]) | |
0a89c170 BP |
94 | else |
95 | KSRC= | |
8a2d6596 BP |
96 | fi |
97 | elif test X"$with_linux_source" != X || test X"$with_l26_source" != X; then | |
98 | AC_MSG_ERROR([Linux source directory may not be specified without Linux build directory]) | |
99 | fi | |
100 | ||
e3438006 BP |
101 | if test -n "$KBUILD"; then |
102 | KBUILD=`eval echo "$KBUILD"` | |
103 | case $KBUILD in | |
0b6d72fc | 104 | /*) ;; |
e3438006 | 105 | *) KBUILD=`pwd`/$KBUILD ;; |
0b6d72fc | 106 | esac |
064af421 | 107 | |
7c9e113b BP |
108 | # The build directory is what the user provided. |
109 | # Make sure that it exists. | |
8a2d6596 | 110 | AC_MSG_CHECKING([for Linux build directory]) |
e3438006 | 111 | if test -d "$KBUILD"; then |
a0903134 YT |
112 | AC_MSG_RESULT([$KBUILD]) |
113 | AC_SUBST(KBUILD) | |
064af421 | 114 | else |
a0903134 YT |
115 | AC_MSG_RESULT([no]) |
116 | AC_ERROR([source dir $KBUILD doesn't exist]) | |
064af421 BP |
117 | fi |
118 | ||
7c9e113b | 119 | # Debian breaks kernel headers into "source" header and "build" headers. |
e3438006 | 120 | # We want the source headers, but $KBUILD gives us the "build" headers. |
7c9e113b | 121 | # Use heuristics to find the source headers. |
8a2d6596 | 122 | AC_MSG_CHECKING([for Linux source directory]) |
e3438006 BP |
123 | if test -n "$KSRC"; then |
124 | KSRC=`eval echo "$KSRC"` | |
125 | case $KSRC in | |
f5fb5de6 | 126 | /*) ;; |
e3438006 | 127 | *) KSRC=`pwd`/$KSRC ;; |
b57f675c | 128 | esac |
e3438006 | 129 | if test ! -e $KSRC/include/linux/kernel.h; then |
53319f95 | 130 | AC_MSG_ERROR([$KSRC is not a kernel source directory]) |
f5fb5de6 BP |
131 | fi |
132 | else | |
e3438006 BP |
133 | KSRC=$KBUILD |
134 | if test ! -e $KSRC/include/linux/kernel.h; then | |
fe0731b1 BP |
135 | # Debian kernel build Makefiles tend to include a line of the form: |
136 | # MAKEARGS := -C /usr/src/linux-headers-3.2.0-1-common O=/usr/src/linux-headers-3.2.0-1-486 | |
137 | # First try to extract the source directory from this line. | |
138 | KSRC=`sed -n 's/.*-C \([[^ ]]*\).*/\1/p' "$KBUILD"/Makefile` | |
139 | if test ! -e "$KSRC"/include/linux/kernel.h; then | |
140 | # Didn't work. Fall back to name-based heuristics that used to work. | |
141 | case `echo "$KBUILD" | sed 's,/*$,,'` in # ( | |
142 | */build) | |
143 | KSRC=`echo "$KBUILD" | sed 's,/build/*$,/source,'` | |
144 | ;; # ( | |
145 | *) | |
146 | KSRC=`(cd $KBUILD && pwd -P) | sed 's,-[[^-]]*$,-common,'` | |
147 | ;; | |
148 | esac | |
149 | fi | |
f5fb5de6 | 150 | fi |
fe0731b1 | 151 | if test ! -e "$KSRC"/include/linux/kernel.h; then |
8a2d6596 | 152 | AC_MSG_ERROR([cannot find source directory (please use --with-linux-source)]) |
7c9e113b BP |
153 | fi |
154 | fi | |
e3438006 | 155 | AC_MSG_RESULT([$KSRC]) |
7c9e113b BP |
156 | |
157 | AC_MSG_CHECKING([for kernel version]) | |
71fe9970 | 158 | version=`sed -n 's/^VERSION = //p' "$KSRC/Makefile"` |
e3438006 BP |
159 | patchlevel=`sed -n 's/^PATCHLEVEL = //p' "$KSRC/Makefile"` |
160 | sublevel=`sed -n 's/^SUBLEVEL = //p' "$KSRC/Makefile"` | |
71fe9970 | 161 | if test X"$version" = X || test X"$patchlevel" = X; then |
7c9e113b | 162 | AC_ERROR([cannot determine kernel version]) |
71fe9970 BP |
163 | elif test X"$sublevel" = X; then |
164 | kversion=$version.$patchlevel | |
165 | else | |
166 | kversion=$version.$patchlevel.$sublevel | |
7c9e113b | 167 | fi |
71fe9970 BP |
168 | AC_MSG_RESULT([$kversion]) |
169 | ||
2adada0e | 170 | if test "$version" -ge 5; then |
44722d58 | 171 | if test "$version" = 5 && test "$patchlevel" -le 8; then |
2adada0e | 172 | : # Linux 5.x |
d76aabea | 173 | else |
44722d58 | 174 | AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 5.8.x is not supported (please refer to the FAQ for advice)]) |
d76aabea | 175 | fi |
2adada0e YS |
176 | elif test "$version" = 4; then |
177 | : # Linux 4.x | |
8063e095 | 178 | elif test "$version" = 3 && test "$patchlevel" -ge 10; then |
3afcde43 | 179 | : # Linux 3.x |
71fe9970 | 180 | else |
8063e095 | 181 | AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 3.10 or later is required]) |
064af421 | 182 | fi |
2520f452 IY |
183 | if (test ! -e "$KBUILD"/include/linux/version.h && \ |
184 | test ! -e "$KBUILD"/include/generated/uapi/linux/version.h)|| \ | |
e3438006 BP |
185 | (test ! -e "$KBUILD"/include/linux/autoconf.h && \ |
186 | test ! -e "$KBUILD"/include/generated/autoconf.h); then | |
a0903134 | 187 | AC_MSG_ERROR([Linux kernel source in $KBUILD is not configured]) |
064af421 | 188 | fi |
e3438006 | 189 | OVS_CHECK_LINUX_COMPAT |
064af421 | 190 | fi |
e3438006 | 191 | AM_CONDITIONAL(LINUX_ENABLED, test -n "$KBUILD") |
064af421 BP |
192 | ]) |
193 | ||
292d5bd9 VB |
194 | dnl OVS_CHECK_LINUX_NETLINK |
195 | dnl | |
196 | dnl Configure Linux netlink compat. | |
197 | AC_DEFUN([OVS_CHECK_LINUX_NETLINK], [ | |
198 | AC_COMPILE_IFELSE([ | |
199 | AC_LANG_PROGRAM([#include <linux/netlink.h>], [ | |
200 | struct nla_bitfield32 x = { 0 }; | |
201 | ])], | |
202 | [AC_DEFINE([HAVE_NLA_BITFIELD32], [1], | |
203 | [Define to 1 if struct nla_bitfield32 is available.])]) | |
204 | ]) | |
205 | ||
1dc0da67 PB |
206 | dnl OVS_CHECK_LINUX_TC |
207 | dnl | |
208 | dnl Configure Linux tc compat. | |
209 | AC_DEFUN([OVS_CHECK_LINUX_TC], [ | |
210 | AC_COMPILE_IFELSE([ | |
211 | AC_LANG_PROGRAM([#include <linux/pkt_cls.h>], [ | |
292d5bd9 | 212 | int x = TCA_ACT_FLAGS; |
1dc0da67 | 213 | ])], |
292d5bd9 VB |
214 | [AC_DEFINE([HAVE_TCA_ACT_FLAGS], [1], |
215 | [Define to 1 if TCA_ACT_FLAGS is available.])]) | |
1dc0da67 | 216 | |
c0a1df2e RD |
217 | AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include <linux/pkt_cls.h>]) |
218 | ||
1dc0da67 PB |
219 | AC_COMPILE_IFELSE([ |
220 | AC_LANG_PROGRAM([#include <linux/tc_act/tc_vlan.h>], [ | |
221 | int x = TCA_VLAN_PUSH_VLAN_PRIORITY; | |
222 | ])], | |
223 | [AC_DEFINE([HAVE_TCA_VLAN_PUSH_VLAN_PRIORITY], [1], | |
dd83253e | 224 | [Define to 1 if TCA_VLAN_PUSH_VLAN_PRIORITY is available.])]) |
1dc0da67 | 225 | |
abef7959 JH |
226 | AC_COMPILE_IFELSE([ |
227 | AC_LANG_PROGRAM([#include <linux/tc_act/tc_mpls.h>], [ | |
228 | int x = TCA_MPLS_TTL; | |
229 | ])], | |
230 | [AC_DEFINE([HAVE_TCA_MPLS_TTL], [1], | |
231 | [Define to 1 if HAVE_TCA_MPLS_TTL is available.])]) | |
232 | ||
1dc0da67 PB |
233 | AC_COMPILE_IFELSE([ |
234 | AC_LANG_PROGRAM([#include <linux/tc_act/tc_tunnel_key.h>], [ | |
4b12e454 | 235 | int x = TCA_TUNNEL_KEY_ENC_TTL; |
1dc0da67 | 236 | ])], |
4b12e454 OG |
237 | [AC_DEFINE([HAVE_TCA_TUNNEL_KEY_ENC_TTL], [1], |
238 | [Define to 1 if TCA_TUNNEL_KEY_ENC_TTL is available.])]) | |
e5b1657e PB |
239 | |
240 | AC_COMPILE_IFELSE([ | |
241 | AC_LANG_PROGRAM([#include <linux/tc_act/tc_pedit.h>], [ | |
242 | int x = TCA_PEDIT_KEY_EX_HDR_TYPE_UDP; | |
243 | ])], | |
244 | [AC_DEFINE([HAVE_TCA_PEDIT_KEY_EX_HDR_TYPE_UDP], [1], | |
dd83253e | 245 | [Define to 1 if TCA_PEDIT_KEY_EX_HDR_TYPE_UDP is available.])]) |
7808b2b9 JH |
246 | |
247 | AC_COMPILE_IFELSE([ | |
248 | AC_LANG_PROGRAM([#include <linux/tc_act/tc_skbedit.h>], [ | |
249 | int x = TCA_SKBEDIT_FLAGS; | |
250 | ])], | |
251 | [AC_DEFINE([HAVE_TCA_SKBEDIT_FLAGS], [1], | |
252 | [Define to 1 if TCA_SKBEDIT_FLAGS is available.])]) | |
1dc0da67 PB |
253 | ]) |
254 | ||
8c7130da AC |
255 | dnl OVS_CHECK_LINUX_SCTP_CT |
256 | dnl | |
257 | dnl Checks for kernels which need additional SCTP state | |
258 | AC_DEFUN([OVS_CHECK_LINUX_SCTP_CT], [ | |
259 | AC_COMPILE_IFELSE([ | |
260 | AC_LANG_PROGRAM([#include <linux/netfilter/nfnetlink.h> | |
261 | #include <linux/netfilter/nfnetlink_conntrack.h> | |
262 | #include <linux/netfilter/nf_conntrack_common.h> | |
263 | #include <linux/netfilter/nf_conntrack_sctp.h>], [ | |
264 | int x = SCTP_CONNTRACK_HEARTBEAT_SENT; | |
265 | ])], | |
266 | [AC_DEFINE([HAVE_SCTP_CONNTRACK_HEARTBEATS], [1], | |
267 | [Define to 1 if SCTP_CONNTRACK_HEARTBEAT_SENT is available.])]) | |
268 | ]) | |
269 | ||
fd4d4777 YHW |
270 | dnl OVS_CHECK_LINUX_VIRTIO_TYPES |
271 | dnl | |
272 | dnl Checks for kernels that need virtio_types definition. | |
273 | AC_DEFUN([OVS_CHECK_LINUX_VIRTIO_TYPES], [ | |
274 | AC_COMPILE_IFELSE([ | |
275 | AC_LANG_PROGRAM([#include <linux/virtio_types.h>], [ | |
276 | __virtio16 x = 0; | |
277 | ])], | |
278 | [AC_DEFINE([HAVE_VIRTIO_TYPES], [1], | |
279 | [Define to 1 if __virtio16 is available.])]) | |
280 | ]) | |
281 | ||
f0d1ead8 IM |
282 | dnl OVS_FIND_DEPENDENCY(FUNCTION, SEARCH_LIBS, NAME_TO_PRINT) |
283 | dnl | |
284 | dnl Check for a function in a library list. | |
285 | AC_DEFUN([OVS_FIND_DEPENDENCY], [ | |
286 | AC_SEARCH_LIBS([$1], [$2], [], [ | |
287 | AC_MSG_ERROR([unable to find $3, install the dependency package]) | |
288 | ]) | |
289 | ]) | |
290 | ||
0de1b425 WT |
291 | dnl OVS_CHECK_LINUX_AF_XDP |
292 | dnl | |
293 | dnl Check both Linux kernel AF_XDP and libbpf support | |
294 | AC_DEFUN([OVS_CHECK_LINUX_AF_XDP], [ | |
295 | AC_ARG_ENABLE([afxdp], | |
296 | [AC_HELP_STRING([--enable-afxdp], [Enable AF-XDP support])], | |
297 | [], [enable_afxdp=no]) | |
298 | AC_MSG_CHECKING([whether AF_XDP is enabled]) | |
299 | if test "$enable_afxdp" != yes; then | |
300 | AC_MSG_RESULT([no]) | |
301 | AF_XDP_ENABLE=false | |
302 | else | |
303 | AC_MSG_RESULT([yes]) | |
304 | AF_XDP_ENABLE=true | |
305 | ||
306 | AC_CHECK_HEADER([bpf/libbpf.h], [], | |
307 | [AC_MSG_ERROR([unable to find bpf/libbpf.h for AF_XDP support])]) | |
308 | ||
309 | AC_CHECK_HEADER([linux/if_xdp.h], [], | |
310 | [AC_MSG_ERROR([unable to find linux/if_xdp.h for AF_XDP support])]) | |
311 | ||
312 | AC_CHECK_HEADER([bpf/xsk.h], [], | |
313 | [AC_MSG_ERROR([unable to find bpf/xsk.h for AF_XDP support])]) | |
314 | ||
315 | AC_CHECK_FUNCS([pthread_spin_lock], [], | |
316 | [AC_MSG_ERROR([unable to find pthread_spin_lock for AF_XDP support])]) | |
317 | ||
e8568993 YHW |
318 | OVS_FIND_DEPENDENCY([numa_alloc_onnode], [numa], [libnuma]) |
319 | ||
0de1b425 WT |
320 | AC_DEFINE([HAVE_AF_XDP], [1], |
321 | [Define to 1 if AF_XDP support is available and enabled.]) | |
322 | LIBBPF_LDADD=" -lbpf -lelf" | |
323 | AC_SUBST([LIBBPF_LDADD]) | |
e50547b5 WT |
324 | |
325 | AC_CHECK_DECL([xsk_ring_prod__needs_wakeup], [ | |
326 | AC_DEFINE([HAVE_XDP_NEED_WAKEUP], [1], | |
327 | [XDP need wakeup support detected in xsk.h.]) | |
328 | ], [], [[#include <bpf/xsk.h>]]) | |
0de1b425 WT |
329 | fi |
330 | AM_CONDITIONAL([HAVE_AF_XDP], test "$AF_XDP_ENABLE" = true) | |
331 | ]) | |
332 | ||
8a9562d2 PS |
333 | dnl OVS_CHECK_DPDK |
334 | dnl | |
335 | dnl Configure DPDK source tree | |
336 | AC_DEFUN([OVS_CHECK_DPDK], [ | |
337 | AC_ARG_WITH([dpdk], | |
252e1e57 IS |
338 | [AC_HELP_STRING([--with-dpdk=static|shared|yes], |
339 | [Specify "static" or "shared" depending on the | |
340 | DPDK libraries to use])], | |
4c16ee48 | 341 | [have_dpdk=true]) |
8a9562d2 | 342 | |
49df3c0f | 343 | AC_MSG_CHECKING([whether dpdk is enabled]) |
4c16ee48 | 344 | if test "$have_dpdk" != true || test "$with_dpdk" = no; then |
40b5ea86 BB |
345 | AC_MSG_RESULT([no]) |
346 | DPDKLIB_FOUND=false | |
347 | else | |
348 | AC_MSG_RESULT([yes]) | |
349 | case "$with_dpdk" in | |
252e1e57 IS |
350 | "shared") |
351 | PKG_CHECK_MODULES([DPDK], [libdpdk], [ | |
352 | DPDK_INCLUDE="$DPDK_CFLAGS" | |
d2749464 | 353 | DPDK_LIB="$DPDK_LIBS"]) |
252e1e57 IS |
354 | ;; |
355 | "static" | "yes") | |
356 | PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ | |
357 | DPDK_INCLUDE="$DPDK_CFLAGS" | |
d2749464 | 358 | DPDK_LIB="$DPDK_LIBS"]) |
252e1e57 IS |
359 | |
360 | dnl Statically linked private DPDK objects of form | |
361 | dnl -l:file.a must be positioned between | |
362 | dnl --whole-archive ... --no-whole-archive linker parameters. | |
363 | dnl Old pkg-config versions misplace --no-whole-archive parameter | |
364 | dnl and put it next to --whole-archive. | |
365 | AC_MSG_CHECKING([for faulty pkg-config version]) | |
366 | echo "$DPDK_LIB" | grep -q 'whole-archive.*l:lib.*no-whole-archive' | |
367 | status=$? | |
368 | case $status in | |
369 | 0) | |
370 | AC_MSG_RESULT([no]) | |
371 | ;; | |
372 | 1) | |
373 | AC_MSG_RESULT([yes]) | |
374 | AC_MSG_ERROR([Please upgrade pkg-config]) | |
375 | ;; | |
376 | *) | |
377 | AC_MSG_ERROR([grep exited with status $status]) | |
378 | ;; | |
379 | esac | |
40b5ea86 | 380 | esac |
8a9562d2 | 381 | |
95626395 TG |
382 | ovs_save_CFLAGS="$CFLAGS" |
383 | ovs_save_LDFLAGS="$LDFLAGS" | |
96195c09 | 384 | CFLAGS="$CFLAGS $DPDK_INCLUDE" |
40b5ea86 | 385 | |
865cee2b IM |
386 | AC_CHECK_HEADERS([rte_config.h], [], [ |
387 | AC_MSG_ERROR([unable to find rte_config.h in $with_dpdk]) | |
388 | ], [AC_INCLUDES_DEFAULT]) | |
389 | ||
f0d1ead8 IM |
390 | AC_CHECK_DECLS([RTE_LIBRTE_VHOST_NUMA, RTE_EAL_NUMA_AWARE_HUGEPAGES], [ |
391 | OVS_FIND_DEPENDENCY([get_mempolicy], [numa], [libnuma]) | |
392 | ], [], [[#include <rte_config.h>]]) | |
4b88d678 | 393 | |
976c452a CL |
394 | AC_CHECK_DECL([RTE_LIBRTE_PMD_PCAP], [ |
395 | OVS_FIND_DEPENDENCY([pcap_dump_close], [pcap], [libpcap]) | |
396 | ], [], [[#include <rte_config.h>]]) | |
397 | ||
5bb068a7 CL |
398 | AC_CHECK_DECL([RTE_LIBRTE_PMD_AF_XDP], [ |
399 | LIBBPF_LDADD="-lbpf" | |
400 | ], [], [[#include <rte_config.h>]]) | |
401 | ||
f0d1ead8 IM |
402 | AC_CHECK_DECL([RTE_LIBRTE_VHOST_NUMA], [ |
403 | AC_DEFINE([VHOST_NUMA], [1], [NUMA Aware vHost support detected in DPDK.]) | |
404 | ], [], [[#include <rte_config.h>]]) | |
fc3b425f | 405 | |
f0d1ead8 | 406 | AC_CHECK_DECL([RTE_LIBRTE_MLX5_PMD], [dnl found |
b926f577 | 407 | AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found |
f0d1ead8 IM |
408 | OVS_FIND_DEPENDENCY([mlx5dv_create_wq], [mlx5], [libmlx5]) |
409 | OVS_FIND_DEPENDENCY([verbs_init_cq], [ibverbs], [libibverbs]) | |
410 | ], [[#include <rte_config.h>]]) | |
411 | ], [], [[#include <rte_config.h>]]) | |
84844e3f | 412 | |
f0d1ead8 | 413 | AC_CHECK_DECL([RTE_LIBRTE_MLX4_PMD], [dnl found |
b926f577 | 414 | AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found |
f0d1ead8 IM |
415 | OVS_FIND_DEPENDENCY([mlx4dv_init_obj], [mlx4], [libmlx4]) |
416 | OVS_FIND_DEPENDENCY([verbs_init_cq], [ibverbs], [libibverbs]) | |
417 | ], [[#include <rte_config.h>]]) | |
418 | ], [], [[#include <rte_config.h>]]) | |
939bad9a | 419 | |
e2f37511 IM |
420 | # DPDK uses dlopen to load plugins. |
421 | OVS_FIND_DEPENDENCY([dlopen], [dl], [libdl]) | |
422 | ||
423 | AC_MSG_CHECKING([whether linking with dpdk works]) | |
424 | LIBS="$DPDK_LIB $LIBS" | |
425 | AC_LINK_IFELSE( | |
426 | [AC_LANG_PROGRAM([#include <rte_config.h> | |
427 | #include <rte_eal.h>], | |
428 | [int rte_argc; char ** rte_argv; | |
429 | rte_eal_init(rte_argc, rte_argv);])], | |
430 | [AC_MSG_RESULT([yes]) | |
431 | DPDKLIB_FOUND=true], | |
432 | [AC_MSG_RESULT([no]) | |
252e1e57 IS |
433 | AC_MSG_ERROR(m4_normalize([ |
434 | Could not find DPDK library in default search path, update | |
435 | PKG_CONFIG_PATH for pkg-config to find the .pc file in | |
436 | non-standard location])) | |
e2f37511 | 437 | ]) |
c1223b11 | 438 | |
95626395 TG |
439 | CFLAGS="$ovs_save_CFLAGS" |
440 | LDFLAGS="$ovs_save_LDFLAGS" | |
252e1e57 IS |
441 | # Stripping out possible instruction set specific configuration that DPDK |
442 | # forces in pkg-config since this could override user-specified options. | |
443 | # It's enough to have -mssse3 to build with DPDK headers. | |
444 | DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-march=[[^ ]]*//g') | |
32c8c10d IM |
445 | # Also stripping out '-mno-avx512f'. Support for AVX512 will be disabled |
446 | # if OVS will detect that it's broken. OVS could be built with a | |
447 | # completely different toolchain that correctly supports AVX512, flags | |
448 | # forced by DPDK only breaks our feature detection mechanism and leads to | |
449 | # build failures: https://github.com/openvswitch/ovs-issues/issues/201 | |
450 | DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-mno-avx512f//g') | |
96195c09 | 451 | OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE" |
ab2a3154 | 452 | OVS_ENABLE_OPTION([-mssse3]) |
8a9562d2 | 453 | |
3c94676c | 454 | # DPDK pmd drivers are not linked unless --whole-archive is used. |
d7310583 DDP |
455 | # |
456 | # This happens because the rest of the DPDK code doesn't use any symbol in | |
457 | # the pmd driver objects, and the drivers register themselves using an | |
458 | # __attribute__((constructor)) function. | |
252e1e57 IS |
459 | # Wrap the DPDK libraries inside a single -Wl directive |
460 | # after comma separation to prevent autotools from reordering them. | |
461 | DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_LIB"| tr -s ' ' ',' | sed 's/-Wl,//g') | |
462 | # Replace -pthread with -lpthread for LD and remove the last extra comma. | |
463 | DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_vswitchd_LDFLAGS"| sed 's/,$//' | \ | |
464 | sed 's/-pthread/-lpthread/g') | |
465 | # Prepend "-Wl,". | |
466 | DPDK_vswitchd_LDFLAGS="-Wl,$DPDK_vswitchd_LDFLAGS" | |
467 | ||
9475dfeb | 468 | AC_SUBST([DPDK_vswitchd_LDFLAGS]) |
8a9562d2 | 469 | AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.]) |
8a9562d2 PS |
470 | fi |
471 | ||
40b5ea86 | 472 | AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true) |
8a9562d2 PS |
473 | ]) |
474 | ||
8828e5c7 | 475 | dnl OVS_GREP_IFELSE(FILE, REGEX, [IF-MATCH], [IF-NO-MATCH]) |
064af421 BP |
476 | dnl |
477 | dnl Greps FILE for REGEX. If it matches, runs IF-MATCH, otherwise IF-NO-MATCH. | |
8828e5c7 BP |
478 | dnl If IF-MATCH is empty then it defines to OVS_DEFINE(HAVE_<REGEX>), with |
479 | dnl <REGEX> translated to uppercase. | |
064af421 BP |
480 | AC_DEFUN([OVS_GREP_IFELSE], [ |
481 | AC_MSG_CHECKING([whether $2 matches in $1]) | |
7507ec48 JG |
482 | if test -f $1; then |
483 | grep '$2' $1 >/dev/null 2>&1 | |
484 | status=$? | |
485 | case $status in | |
997d327d | 486 | 0) |
7507ec48 | 487 | AC_MSG_RESULT([yes]) |
8828e5c7 | 488 | m4_if([$3], [], [OVS_DEFINE([HAVE_]m4_toupper([$2]))], [$3]) |
7507ec48 | 489 | ;; |
997d327d | 490 | 1) |
7507ec48 JG |
491 | AC_MSG_RESULT([no]) |
492 | $4 | |
493 | ;; | |
997d327d | 494 | *) |
7507ec48 JG |
495 | AC_MSG_ERROR([grep exited with status $status]) |
496 | ;; | |
497 | esac | |
498 | else | |
499 | AC_MSG_RESULT([file not found]) | |
500 | $4 | |
501 | fi | |
064af421 BP |
502 | ]) |
503 | ||
13dd4a97 JS |
504 | dnl OVS_FIND_FIELD_IFELSE(FILE, STRUCTURE, REGEX, [IF-MATCH], [IF-NO-MATCH]) |
505 | dnl | |
506 | dnl Looks for STRUCTURE in FILE. If it is found, greps for REGEX within the | |
507 | dnl structure definition. If this is successful, runs IF-MATCH, otherwise | |
508 | dnl IF_NO_MATCH. If IF-MATCH is empty then it defines to | |
509 | dnl OVS_DEFINE(HAVE_<STRUCTURE>_WITH_<REGEX>), with <STRUCTURE> and <REGEX> | |
510 | dnl translated to uppercase. | |
511 | AC_DEFUN([OVS_FIND_FIELD_IFELSE], [ | |
512 | AC_MSG_CHECKING([whether $2 has member $3 in $1]) | |
513 | if test -f $1; then | |
83a27884 | 514 | awk '/$2.{/,/^}/' $1 2>/dev/null | grep '$3' >/dev/null |
13dd4a97 JS |
515 | status=$? |
516 | case $status in | |
517 | 0) | |
518 | AC_MSG_RESULT([yes]) | |
519 | m4_if([$4], [], [OVS_DEFINE([HAVE_]m4_toupper([$2])[_WITH_]m4_toupper([$3]))], [$4]) | |
520 | ;; | |
521 | 1) | |
522 | AC_MSG_RESULT([no]) | |
523 | $5 | |
524 | ;; | |
525 | *) | |
526 | AC_MSG_ERROR([grep exited with status $status]) | |
527 | ;; | |
528 | esac | |
529 | else | |
530 | AC_MSG_RESULT([file not found]) | |
531 | $5 | |
532 | fi | |
533 | ]) | |
534 | ||
71ce9edd JR |
535 | dnl OVS_FIND_PARAM_IFELSE(FILE, FUNCTION, REGEX, [IF-MATCH], [IF-NO-MATCH]) |
536 | dnl | |
537 | dnl Looks for FUNCTION in FILE. If it is found, greps for REGEX within | |
538 | dnl the function signature starting from the line matching FUNCTION | |
539 | dnl and ending with the line containing the closing parenthesis. If | |
540 | dnl this is successful, runs IF-MATCH, otherwise IF_NO_MATCH. If | |
541 | dnl IF-MATCH is empty then it defines to | |
542 | dnl OVS_DEFINE(HAVE_<FUNCTION>_WITH_<REGEX>), with <FUNCTION> and | |
543 | dnl <REGEX> translated to uppercase. | |
544 | AC_DEFUN([OVS_FIND_PARAM_IFELSE], [ | |
545 | AC_MSG_CHECKING([whether $2 has parameter $3 in $1]) | |
546 | if test -f $1; then | |
547 | awk '/$2[[ \t\n]]*\(/,/\)/' $1 2>/dev/null | grep '$3' >/dev/null | |
548 | status=$? | |
549 | case $status in | |
550 | 0) | |
551 | AC_MSG_RESULT([yes]) | |
552 | m4_if([$4], [], [OVS_DEFINE([HAVE_]m4_toupper([$2])[_WITH_]m4_toupper([$3]))], [$4]) | |
553 | ;; | |
554 | 1) | |
555 | AC_MSG_RESULT([no]) | |
556 | $5 | |
557 | ;; | |
558 | *) | |
559 | AC_MSG_ERROR([grep exited with status $status]) | |
560 | ;; | |
561 | esac | |
562 | else | |
563 | AC_MSG_RESULT([file not found]) | |
564 | $5 | |
565 | fi | |
566 | ]) | |
567 | ||
82b7e6d1 GR |
568 | dnl OVS_FIND_OP_PARAM_IFELSE(FILE, OP, REGEX, [IF-MATCH], [IF-NO-MATCH]) |
569 | dnl | |
570 | dnl Looks for OP in FILE. If it is found, greps for REGEX within the | |
571 | dnl OP definition. If this is successful, runs IF-MATCH, otherwise | |
572 | dnl IF_NO_MATCH. If IF-MATCH is empty then it defines to | |
573 | dnl OVS_DEFINE(HAVE_<OP>_WITH_<REGEX>), with <OP> and <REGEX> | |
574 | dnl translated to uppercase. | |
575 | AC_DEFUN([OVS_FIND_OP_PARAM_IFELSE], [ | |
576 | AC_MSG_CHECKING([whether $2 has member $3 in $1]) | |
577 | if test -f $1; then | |
578 | awk '/$2[[ \t\n]]*\)\(/,/;/' $1 2>/dev/null | grep '$3' >/dev/null | |
579 | status=$? | |
580 | case $status in | |
581 | 0) | |
582 | AC_MSG_RESULT([yes]) | |
583 | m4_if([$4], [], [OVS_DEFINE([HAVE_]m4_toupper([$2])[_WITH_]m4_toupper([$3]))], [$4]) | |
584 | ;; | |
585 | 1) | |
586 | AC_MSG_RESULT([no]) | |
587 | $5 | |
588 | ;; | |
589 | *) | |
590 | AC_MSG_ERROR([grep exited with status $status]) | |
591 | ;; | |
592 | esac | |
593 | else | |
594 | AC_MSG_RESULT([file not found]) | |
595 | $5 | |
596 | fi | |
597 | ]) | |
598 | ||
064af421 BP |
599 | dnl OVS_DEFINE(NAME) |
600 | dnl | |
601 | dnl Defines NAME to 1 in kcompat.h. | |
602 | AC_DEFUN([OVS_DEFINE], [ | |
22bcc0e7 | 603 | echo '#define $1 1' >> datapath/linux/kcompat.h.new |
064af421 BP |
604 | ]) |
605 | ||
e3438006 | 606 | dnl OVS_CHECK_LINUX_COMPAT |
064af421 | 607 | dnl |
8063e095 | 608 | dnl Runs various Autoconf checks on the Linux kernel source in |
e3438006 BP |
609 | dnl the directory in $KBUILD. |
610 | AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ | |
22bcc0e7 JG |
611 | rm -f datapath/linux/kcompat.h.new |
612 | mkdir -p datapath/linux | |
613 | : > datapath/linux/kcompat.h.new | |
4aa13c0c | 614 | |
e23775f2 PS |
615 | echo '#include <linux/version.h> |
616 | #ifndef RHEL_RELEASE_CODE | |
617 | #define RHEL_RELEASE_CODE 0 | |
618 | #define RHEL_RELEASE_VERSION(a, b) 0 | |
619 | #endif' >> datapath/linux/kcompat.h.new | |
620 | ||
e3438006 | 621 | OVS_GREP_IFELSE([$KSRC/arch/x86/include/asm/checksum_32.h], [src_err,], |
25fb3596 JG |
622 | [OVS_DEFINE([HAVE_CSUM_COPY_DBG])]) |
623 | ||
db1dcb23 DB |
624 | OVS_GREP_IFELSE([$KSRC/include/net/ip6_fib.h], [rt6_get_cookie], |
625 | [OVS_DEFINE([HAVE_RT6_GET_COOKIE])]) | |
626 | ||
33f9c873 GR |
627 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub], |
628 | [dst_entry]) | |
e23775f2 PS |
629 | OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup.*net], |
630 | [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_NET])]) | |
5519e384 YHW |
631 | OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow.*net], |
632 | [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_FLOW_NET])]) | |
e23775f2 | 633 | OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub]) |
5519e384 | 634 | OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow]) |
e23775f2 | 635 | |
e3438006 | 636 | OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST]) |
4303ec34 | 637 | OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [IS_ERR_OR_NULL]) |
54125dd0 | 638 | OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [PTR_ERR_OR_ZERO]) |
4aa13c0c | 639 | |
8aef057b | 640 | OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [static_branch_unlikely(], |
6660a959 | 641 | [OVS_DEFINE([HAVE_UPSTREAM_STATIC_KEY])]) |
8aef057b YHW |
642 | OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [DEFINE_STATIC_KEY_FALSE], |
643 | [OVS_DEFINE([HAVE_DEFINE_STATIC_KEY])]) | |
dca96842 PB |
644 | OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], |
645 | [DECLARE_STATIC_KEY_FALSE], | |
646 | [OVS_DEFINE([HAVE_DECLARE_STATIC_KEY])]) | |
6660a959 | 647 | |
d923a695 | 648 | OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random]) |
e2f3178f | 649 | OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [ether_addr_copy]) |
d923a695 | 650 | |
e23775f2 PS |
651 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_link.h], [IFLA_GENEVE_TOS]) |
652 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_link.h], [rtnl_link_stats64]) | |
653 | OVS_GREP_IFELSE([$KSRC/include/linux/if_link.h], [rtnl_link_stats64]) | |
d923a695 | 654 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_set_encap_proto]) |
ec96e663 | 655 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_hwaccel_push_inside]) |
9feb5bda | 656 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [__vlan_hwaccel_clear_tag]) |
d923a695 | 657 | |
e3438006 | 658 | OVS_GREP_IFELSE([$KSRC/include/linux/in.h], [ipv4_is_multicast]) |
46d69d18 | 659 | OVS_GREP_IFELSE([$KSRC/include/linux/in.h], [proto_ports_offset]) |
2ea82414 PS |
660 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [__ip_select_ident.*dst_entry], |
661 | [OVS_DEFINE([HAVE_IP_SELECT_IDENT_USING_DST_ENTRY])]) | |
e23775f2 PS |
662 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [__ip_select_ident.*net], |
663 | [OVS_DEFINE([HAVE_IP_SELECT_IDENT_USING_NET])]) | |
664 | ||
13dd4a97 JS |
665 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [inet_get_local_port_range.*net], |
666 | [OVS_DEFINE([HAVE_INET_GET_LOCAL_PORT_RANGE_USING_NET])]) | |
39c0ff22 JS |
667 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_defrag.*net], |
668 | [OVS_DEFINE([HAVE_IP_DEFRAG_TAKES_NET])]) | |
0374bcbe EB |
669 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip.h], |
670 | [ip_do_fragment], [net], | |
671 | [OVS_DEFINE([HAVE_IP_DO_FRAGMENT_TAKES_NET])]) | |
0643a78b PS |
672 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip.h], |
673 | [ip_local_out], [net], | |
674 | [OVS_DEFINE([HAVE_IP_LOCAL_OUT_TAKES_NET])]) | |
675 | ||
cfda4537 | 676 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_skb_dst_mtu]) |
0f09d6e3 JS |
677 | |
678 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [IPSKB_FRAG_PMTU], | |
679 | [OVS_DEFINE([HAVE_CORRECT_MRU_HANDLING])]) | |
06f1a61a | 680 | OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h], [__ip_tunnel_change_mtu]) |
595e069a JS |
681 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [hashfn.*const], |
682 | [OVS_DEFINE([HAVE_INET_FRAGS_CONST])]) | |
8f00ece9 JS |
683 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [last_in], |
684 | [OVS_DEFINE([HAVE_INET_FRAGS_LAST_IN])]) | |
e0d45da3 | 685 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_evicting]) |
ccd0a13b | 686 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_evictor]) |
91408ae0 JS |
687 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags], |
688 | [frags_work]) | |
d1c390e6 JS |
689 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags], |
690 | [rwlock]) | |
e0d45da3 JS |
691 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_queue], |
692 | [list_evictor]) | |
38f45380 | 693 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_lru_move]) |
6ccf21ca YHW |
694 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/inet_frag.h], |
695 | [sub_frag_mem_limit], [struct.netns_frags], | |
696 | [OVS_DEFINE([HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS])]) | |
697 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [void.*inet_frags_init], | |
698 | [OVS_DEFINE([HAVE_VOID_INET_FRAGS_INIT])]) | |
401da7b9 JS |
699 | OVS_GREP_IFELSE([$KSRC/include/net/inetpeer.h], [vif], |
700 | [OVS_DEFINE([HAVE_INETPEER_VIF_SUPPORT])]) | |
8f00ece9 | 701 | |
f2252c61 PS |
702 | dnl Check for dst_cache and ipv6 lable to use backported tunnel infrastructure. |
703 | dnl OVS does not really need ipv6 label field, but its presence signifies that | |
704 | dnl the stack has all required ipv6 support. | |
705 | dnl OVS also does not need dst_cache But this dependency allows us to write | |
706 | dnl much cleaner code. | |
707 | ||
3259c4ff PS |
708 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/ip_tunnels.h], [ip_tunnel_key], |
709 | [label], | |
710 | [OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h], | |
711 | [iptunnel_pull_offloads], | |
997d327d | 712 | [OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache], |
e1ededf4 GR |
713 | [OVS_GREP_IFELSE([$KSRC/include/net/erspan.h], [erspan_md2], |
714 | [OVS_DEFINE([USE_UPSTREAM_TUNNEL])])])])]) | |
4aa13c0c | 715 | |
138df3e5 GR |
716 | OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache], |
717 | [OVS_DEFINE([USE_BUILTIN_DST_CACHE])]) | |
65590144 YHW |
718 | OVS_GREP_IFELSE([$KSRC/include/net/mpls.h], [mpls_hdr], |
719 | [OVS_DEFINE([MPLS_HEADER_IS_L3])]) | |
fdce83a3 PS |
720 | OVS_GREP_IFELSE([$KSRC/include/linux/net.h], [sock_create_kern.*net], |
721 | [OVS_DEFINE([HAVE_SOCK_CREATE_KERN_NET])]) | |
aad7cb91 | 722 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_fill_metadata_dst]) |
e3438006 BP |
723 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_disable_lro]) |
724 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_get_stats]) | |
725 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_get_by_index_rcu]) | |
3f506f07 | 726 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_recursion_level]) |
42d5dd95 | 727 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [__skb_gso_segment]) |
96b82f6d | 728 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [skb_gso_error_unwind]) |
42d5dd95 | 729 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [can_checksum_protocol]) |
e23775f2 | 730 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_get_iflink]) |
0a0d9095 PS |
731 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_features_check], |
732 | [OVS_DEFINE([USE_UPSTREAM_TUNNEL_GSO])]) | |
f2252c61 PS |
733 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_add_vxlan_port]) |
734 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_add_geneve_port]) | |
e2e11c89 | 735 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_udp_tunnel_add]) |
d1890de5 | 736 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_features_t]) |
8063e095 PS |
737 | dnl Ubuntu kernel 3.13 has defined this struct but not used for netdev->tstats. |
738 | dnl So check type of tstats. | |
739 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [pcpu_sw_netstats.*tstats], | |
740 | [OVS_DEFINE([HAVE_PCPU_SW_NETSTATS])]) | |
e23775f2 PS |
741 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netif_needs_gso.*net_device], |
742 | [OVS_DEFINE([HAVE_NETIF_NEEDS_GSO_NETDEV])]) | |
a0c9fedc | 743 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [skb_csum_hwoffload_help]) |
e23775f2 PS |
744 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [udp_offload]) |
745 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [udp_offload.*uoff], | |
746 | [OVS_DEFINE([HAVE_UDP_OFFLOAD_ARG_UOFF])]) | |
747 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [gro_remcsum]) | |
8ce37339 | 748 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [IFF_PHONY_HEADROOM]) |
6ccf21ca YHW |
749 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops], |
750 | [extended]) | |
7efb1e09 PS |
751 | OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h], |
752 | [netdev_master_upper_dev_link], [upper_priv], | |
753 | [OVS_DEFINE([HAVE_NETDEV_MASTER_UPPER_DEV_LINK_PRIV])]) | |
b7ab7316 YHW |
754 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], |
755 | [netdev_master_upper_dev_link_rh], | |
756 | [OVS_DEFINE([HAVE_NETDEV_MASTER_UPPER_DEV_LINK_RH])]) | |
757 | ||
6c0bf091 JW |
758 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device], |
759 | [max_mtu]) | |
39ca3383 YHW |
760 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops_extended], |
761 | [ndo_change_mtu], [OVS_DEFINE([HAVE_RHEL7_MAX_MTU])]) | |
140c8971 PM |
762 | OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h], |
763 | [dev_change_flags], [extack], | |
764 | [OVS_DEFINE([HAVE_DEV_CHANGE_FLAGS_TAKES_EXTACK])]) | |
e23775f2 PS |
765 | |
766 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state]) | |
4fdec898 FW |
767 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state], |
768 | [struct net ], [OVS_DEFINE([HAVE_NF_HOOK_STATE_NET])]) | |
e23775f2 | 769 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_register_net_hook]) |
cd7330d0 PS |
770 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hookfn.*nf_hook_ops], |
771 | [OVS_DEFINE([HAVE_NF_HOOKFN_ARG_OPS])]) | |
0643a78b PS |
772 | OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hookfn], [priv], |
773 | [OVS_DEFINE([HAVE_NF_HOOKFN_ARG_PRIV])]) | |
774 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_ops], | |
775 | [owner], [OVS_DEFINE([HAVE_NF_HOOKS_OPS_OWNER])]) | |
179fccce | 776 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [NFPROTO_INET]) |
d42fb06d | 777 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [CONFIG_NF_NAT_NEEDED]) |
179fccce | 778 | |
0643a78b | 779 | |
e4e04c3b | 780 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter_ipv6.h], [nf_ipv6_ops], |
2b64e8fc | 781 | [fragment.*sock], [OVS_DEFINE([HAVE_NF_IPV6_OPS_FRAGMENT])]) |
e2f3178f | 782 | |
6d9b6937 JR |
783 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], |
784 | [nf_conn], [struct timer_list[[ \t]]*timeout], | |
785 | [OVS_DEFINE([HAVE_NF_CONN_TIMER])]) | |
786 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], | |
787 | [nf_ct_delete(], [OVS_DEFINE([HAVE_NF_CT_DELETE])]) | |
788 | ||
71ce9edd JR |
789 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], |
790 | [nf_ct_tmpl_alloc], [nf_conntrack_zone], | |
057772cf | 791 | [OVS_DEFINE([HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE])]) |
71ce9edd JR |
792 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], |
793 | [nf_ct_get_tuplepr], [struct.net], | |
fa67f8e0 | 794 | [OVS_DEFINE([HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET])]) |
dfa791b2 FW |
795 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], |
796 | [nf_ct_set]) | |
56ec5593 JS |
797 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], |
798 | [nf_ct_is_untracked]) | |
c1d728db YHW |
799 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], |
800 | [nf_ct_invert_tuplepr]) | |
ac9cd0d2 JS |
801 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_zones.h], |
802 | [nf_ct_zone_init]) | |
eca4cde0 YS |
803 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_l3proto.h], |
804 | [net_ns_get]) | |
459064e7 JS |
805 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h], |
806 | [nf_connlabels_get]) | |
7f2ab8cd JR |
807 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h], |
808 | [nf_connlabels_get], [int bit], | |
809 | [OVS_DEFINE([HAVE_NF_CONNLABELS_GET_TAKES_BIT])]) | |
9f04eabe JR |
810 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h], |
811 | [nf_conn_labels], [words]) | |
0d330e42 JR |
812 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_ct_nat_ext_add]) |
813 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_alloc_null_binding]) | |
fdec3c17 | 814 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_range2]) |
9ea96dce YHW |
815 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_packet], |
816 | [OVS_DEFINE([HAVE_UPSTREAM_NF_NAT])]) | |
0d330e42 | 817 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_seqadj.h], [nf_ct_seq_adjust]) |
74496432 | 818 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_count.h], [nf_conncount_gc_list], |
4bfdefea YS |
819 | [OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_count.h], |
820 | [int nf_conncount_add], | |
821 | [], [OVS_DEFINE([HAVE_UPSTREAM_NF_CONNCOUNT])])]) | |
2fc8309b YHW |
822 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_timeout.h], [nf_ct_set_timeout]) |
823 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_timeout.h], [struct nf_ct_timeout], | |
824 | [OVS_DEFINE([HAVE_NF_CT_TIMEOUT])]) | |
825 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_timeout.h], | |
826 | [\(*nf_ct_timeout_find_get_hook\)], [net], | |
827 | [OVS_DEFINE([HAVE_NF_CT_TIMEOUT_FIND_GET_HOOK_NET])]) | |
057772cf | 828 | |
9048ab60 GR |
829 | OVS_GREP_IFELSE([$KSRC/include/linux/random.h], |
830 | [prandom_u32[[\(]]], | |
831 | [OVS_DEFINE([HAVE_PRANDOM_U32])]) | |
f000c879 | 832 | OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max]) |
b8d42f87 IM |
833 | OVS_GREP_IFELSE([$KSRC/include/linux/prandom.h], |
834 | [prandom_u32[[\(]]], | |
835 | [OVS_DEFINE([HAVE_PRANDOM_U32])]) | |
836 | OVS_GREP_IFELSE([$KSRC/include/linux/prandom.h], [prandom_u32_max]) | |
4aa13c0c | 837 | |
e23775f2 PS |
838 | OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [get_link_net]) |
839 | OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [name_assign_type]) | |
840 | OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [rtnl_create_link.*src_net], | |
841 | [OVS_DEFINE([HAVE_RTNL_CREATE_LINK_SRC_NET])]) | |
842 | OVS_GREP_IFELSE([$KSRC/include/net/net_namespace.h], [possible_net_t]) | |
843 | ||
e3438006 BP |
844 | OVS_GREP_IFELSE([$KSRC/include/linux/rcupdate.h], [rcu_read_lock_held], [], |
845 | [OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], | |
cf6cb3a2 | 846 | [rcu_read_lock_held])]) |
8fa52250 | 847 | OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], [lockdep_rtnl_is_held]) |
3d10a0c8 | 848 | OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], [net_rwsem]) |
8b7cc752 YS |
849 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/rtnetlink.h], |
850 | [rtnl_create_link], [extack], | |
851 | [OVS_DEFINE([HAVE_RTNL_CREATE_LINK_TAKES_EXTACK])]) | |
efcae7df | 852 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [nf_reset_ct]) |
997d327d | 853 | |
6a33828d BP |
854 | # Check for the proto_data_valid member in struct sk_buff. The [^@] |
855 | # is necessary because some versions of this header remove the | |
856 | # member but retain the kerneldoc comment that describes it (which | |
857 | # starts with @). The brackets must be doubled because of m4 | |
858 | # quoting rules. | |
e3438006 | 859 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [[[^@]]proto_data_valid], |
6a33828d | 860 | [OVS_DEFINE([HAVE_PROTO_DATA_VALID])]) |
ccb75a28 | 861 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_checksum_start_offset]) |
e23775f2 | 862 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [inner_protocol]) |
f2252c61 | 863 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [inner_protocol_type]) |
c1eb2500 | 864 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_inner_transport_offset]) |
d23239a2 | 865 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [kfree_skb_list]) |
60c4904f | 866 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [rxhash]) |
5640cbd8 JG |
867 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [u16.*rxhash], |
868 | [OVS_DEFINE([HAVE_U16_RXHASH])]) | |
e3438006 | 869 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_dst(], |
85444c3f | 870 | [OVS_DEFINE([HAVE_SKB_DST_ACCESSOR_FUNCS])]) |
997d327d | 871 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], |
8828e5c7 | 872 | [skb_copy_from_linear_data_offset]) |
b9c15df9 PS |
873 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], |
874 | [skb_reset_tail_pointer]) | |
e3438006 | 875 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_cow_head]) |
e3438006 | 876 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_warn_if_lro], |
4aa13c0c | 877 | [OVS_DEFINE([HAVE_SKB_WARN_LRO])]) |
e3438006 | 878 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [consume_skb]) |
6c4ea27c | 879 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_frag_page]) |
da4bbeb7 | 880 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_has_frag_list]) |
0aa6fda7 | 881 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [__skb_fill_page_desc]) |
d923a695 | 882 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_reset_mac_len]) |
dc0d542d | 883 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_unclone]) |
1edc458d | 884 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_orphan_frags]) |
c253c2e3 MC |
885 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_get_hash(], |
886 | [OVS_DEFINE([HAVE_SKB_GET_HASH])]) | |
e2f3178f | 887 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_clear_hash]) |
705e9260 PS |
888 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [int.skb_zerocopy(], |
889 | [OVS_DEFINE([HAVE_SKB_ZEROCOPY])]) | |
5cce04b6 | 890 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_ensure_writable]) |
97894370 | 891 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_vlan_pop]) |
a27c454e | 892 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [__skb_vlan_pop]) |
97894370 | 893 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_vlan_push]) |
c6e13fcc | 894 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_clear_hash_if_not_l4]) |
ea3acd7a | 895 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_postpush_rcsum]) |
73daf51a | 896 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [lco_csum]) |
d3c313c1 | 897 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_nfct]) |
0ace0a26 | 898 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_put_zero]) |
4aa13c0c | 899 | |
e3438006 | 900 | OVS_GREP_IFELSE([$KSRC/include/linux/types.h], [__wsum], |
e215ebca | 901 | [OVS_DEFINE([HAVE_CSUM_TYPES])]) |
8dbe1f9f PS |
902 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/types.h], [__wsum], |
903 | [OVS_DEFINE([HAVE_CSUM_TYPES])]) | |
4aa13c0c | 904 | |
e3438006 BP |
905 | OVS_GREP_IFELSE([$KSRC/include/net/checksum.h], [csum_replace4]) |
906 | OVS_GREP_IFELSE([$KSRC/include/net/checksum.h], [csum_unfold]) | |
4aa13c0c | 907 | |
0d03e51c | 908 | OVS_GREP_IFELSE([$KSRC/include/net/dst.h], [dst_discard_sk]) |
1dba1690 | 909 | OVS_GREP_IFELSE([$KSRC/include/net/dst.h], [__skb_dst_copy]) |
0d03e51c | 910 | |
114fce23 SG |
911 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_has_listeners]) |
912 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [mcgrp_offset]) | |
14002a59 | 913 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [parallel_ops]) |
6233a1bd TG |
914 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [netlink_has_listeners(net->genl_sock], |
915 | [OVS_DEFINE([HAVE_GENL_HAS_LISTENERS_TAKES_NET])]) | |
c623ba49 | 916 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genlmsg_parse]) |
13dd4a97 JS |
917 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_notify.*family], |
918 | [OVS_DEFINE([HAVE_GENL_NOTIFY_TAKES_FAMILY])]) | |
f1e9590e | 919 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_validate_flags]) |
0643a78b PS |
920 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/genetlink.h], |
921 | [genl_notify], [net], | |
922 | [OVS_DEFINE([HAVE_GENL_NOTIFY_TAKES_NET])]) | |
923 | ||
13dd4a97 JS |
924 | |
925 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h], | |
926 | [genl_multicast_group], [id]) | |
fdce83a3 | 927 | OVS_GREP_IFELSE([$KSRC/include/net/geneve.h], [geneve_hdr]) |
13dd4a97 | 928 | |
cc1d0dea | 929 | OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_cisco_register]) |
e23775f2 | 930 | OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_handle_offloads]) |
8abaa53c | 931 | OVS_GREP_IFELSE([$KSRC/include/net/ipv6.h], [IP6_FH_F_SKIP_RH]) |
e23775f2 | 932 | OVS_GREP_IFELSE([$KSRC/include/net/ipv6.h], [ip6_local_out_sk]) |
2d3ef70b | 933 | OVS_GREP_IFELSE([$KSRC/include/net/ipv6.h], [__ipv6_addr_jhash]) |
a94ebc39 JS |
934 | OVS_GREP_IFELSE([$KSRC/include/net/ip6_fib.h], [rt6i.*u.dst], |
935 | [OVS_DEFINE([HAVE_RT6INFO_DST_UNION])]) | |
213e1f54 JS |
936 | OVS_GREP_IFELSE([$KSRC/include/net/ip6_route.h], [ip6_frag.*sock], |
937 | [OVS_DEFINE([HAVE_IP_FRAGMENT_TAKES_SOCK])]) | |
938 | ||
91b37647 | 939 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_64bit]) |
e3438006 | 940 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16]) |
42d5dd95 TG |
941 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be16]) |
942 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be32]) | |
943 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be64]) | |
dd693f9b | 944 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_in_addr]) |
e3438006 | 945 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_find_nested]) |
0fcc086d | 946 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_is_last]) |
09c33996 | 947 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_nest_start_noflag]) |
6dbd98e6 SH |
948 | OVS_GREP_IFELSE([$KSRC/include/linux/netlink.h], [void.*netlink_set_err], |
949 | [OVS_DEFINE([HAVE_VOID_NETLINK_SET_ERR])]) | |
15702dc9 JB |
950 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netlink.h], |
951 | [nla_parse], [netlink_ext_ack], | |
952 | [OVS_DEFINE([HAVE_NETLINK_EXT_ACK])]) | |
4aa13c0c | 953 | |
c4e976db JG |
954 | OVS_GREP_IFELSE([$KSRC/include/net/sctp/checksum.h], [sctp_compute_cksum]) |
955 | ||
1f649f1c | 956 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_insert_tag_set_proto]) |
17e3889f | 957 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [__vlan_insert_tag]) |
e23775f2 | 958 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_get_protocol]) |
5c3f23fe | 959 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [skb_vlan_tagged]) |
ca6da1b1 | 960 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [eth_type_vlan]) |
431488e6 | 961 | |
aadd6ae9 JS |
962 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/dst_metadata.h], |
963 | [metadata_dst_alloc], [metadata_type]) | |
964 | ||
09f27436 JG |
965 | OVS_GREP_IFELSE([$KSRC/include/linux/u64_stats_sync.h], [u64_stats_fetch_begin_irq]) |
966 | ||
3174a818 TG |
967 | OVS_GREP_IFELSE([$KSRC/include/net/vxlan.h], [struct vxlan_metadata], |
968 | [OVS_DEFINE([HAVE_VXLAN_METADATA])]) | |
f6a0c895 | 969 | OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_flow_src_port], |
13dd4a97 JS |
970 | [OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [inet_get_local_port_range(net], |
971 | [OVS_DEFINE([HAVE_UDP_FLOW_SRC_PORT])])]) | |
972 | OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_v4_check]) | |
e23775f2 | 973 | OVS_GREP_IFELSE([$KSRC/include/net/udp_tunnel.h], [udp_tunnel_gro_complete]) |
06aeda48 PS |
974 | OVS_GREP_IFELSE([$KSRC/include/net/udp_tunnel.h], [sk_buff.*udp_tunnel_handle_offloads], |
975 | [OVS_DEFINE([HAVE_UDP_TUNNEL_HANDLE_OFFLOAD_RET_SKB])]) | |
d7e58913 PS |
976 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/udp_tunnel.h], [udp_tunnel_sock_cfg], |
977 | [gro_receive]) | |
e23775f2 PS |
978 | |
979 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [ignore_df], | |
f6a0c895 TG |
980 | [OVS_DEFINE([HAVE_IGNORE_DF_RENAME])]) |
981 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/netdevice.h], [NET_NAME_UNKNOWN], | |
982 | [OVS_DEFINE([HAVE_NET_NAME_UNKNOWN])]) | |
f285d3e7 | 983 | |
b7ebebcd PS |
984 | OVS_GREP_IFELSE([$KSRC/include/net/sock.h], [sk_no_check_tx]) |
985 | OVS_GREP_IFELSE([$KSRC/include/linux/udp.h], [no_check6_tx]) | |
c970aa4e PS |
986 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/protocol.h], |
987 | [udp_add_offload], [net], | |
988 | [OVS_DEFINE([HAVE_UDP_ADD_OFFLOAD_TAKES_NET])]) | |
802d12b6 GR |
989 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/ipv6/nf_defrag_ipv6.h], |
990 | [nf_defrag_ipv6_enable], [net], | |
991 | [OVS_DEFINE([HAVE_DEFRAG_ENABLE_TAKES_NET])]) | |
bef862bc GR |
992 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [family_list], |
993 | [OVS_DEFINE([HAVE_GENL_FAMILY_LIST])]) | |
7f15e8dd GR |
994 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device], |
995 | [needs_free_netdev], | |
996 | [OVS_DEFINE([HAVE_NEEDS_FREE_NETDEV])]) | |
14365643 GR |
997 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/vxlan.h], [vxlan_dev], [cfg], |
998 | [OVS_DEFINE([HAVE_VXLAN_DEV_CFG])]) | |
ac8e3c6d | 999 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_helper.h], |
35fc0638 GR |
1000 | [nf_conntrack_helper_put], |
1001 | [OVS_DEFINE(HAVE_NF_CONNTRACK_HELPER_PUT)]) | |
4c941202 YHW |
1002 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_helper.h], |
1003 | [nf_nat_helper_try_module_get]) | |
1004 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_helper.h], | |
1005 | [nf_nat_helper_put]) | |
f90e29c9 | 1006 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h],[[[[:space:]]]SKB_GSO_UDP[[[:space:]]]], |
ad283644 | 1007 | [OVS_DEFINE([HAVE_SKB_GSO_UDP])]) |
db1dcb23 DB |
1008 | OVS_GREP_IFELSE([$KSRC/include/net/dst.h],[DST_NOCACHE], |
1009 | [OVS_DEFINE([HAVE_DST_NOCACHE])]) | |
6b51641a GR |
1010 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/rtnetlink.h], [rtnl_link_ops], |
1011 | [extack], | |
1012 | [OVS_DEFINE([HAVE_EXT_ACK_IN_RTNL_LINKOPS])]) | |
a5220693 GR |
1013 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_ops], |
1014 | [list], | |
1015 | [OVS_DEFINE([HAVE_LIST_IN_NF_HOOK_OPS])]) | |
c0802634 EG |
1016 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/netfilter/nf_conntrack_common.h], |
1017 | [IP_CT_UNTRACKED]) | |
36d3520b GR |
1018 | OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h], |
1019 | [netdev_master_upper_dev_link], [extack], | |
1020 | [OVS_DEFINE([HAVE_UPPER_DEV_LINK_EXTACK])]) | |
a61fbfa4 GR |
1021 | OVS_GREP_IFELSE([$KSRC/include/linux/compiler_types.h], |
1022 | [__LINUX_COMPILER_TYPES_H], | |
1023 | [OVS_DEFINE([HAVE_LINUX_COMPILER_TYPES_H])]) | |
6deeb55a AB |
1024 | OVS_GREP_IFELSE([$KSRC/include/linux/timekeeping.h], |
1025 | [ktime_get_ts64], | |
1026 | [OVS_DEFINE([HAVE_KTIME_GET_TS64])]) | |
b147f2e9 JB |
1027 | OVS_GREP_IFELSE([$KSRC/include/net/net_namespace.h], |
1028 | [EXPORT_SYMBOL_GPL(peernet2id_alloc)], | |
1029 | [OVS_DEFINE([HAVE_PEERNET2ID_ALLOC])]) | |
1cb57039 AZ |
1030 | OVS_GREP_IFELSE([$KSRC/include/linux/timekeeping.h], |
1031 | [ktime_get_ns], | |
1032 | [OVS_DEFINE([HAVE_KTIME_GET_NS])]) | |
b3e647ca GR |
1033 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], |
1034 | frag_percpu_counter_batch[], | |
1035 | [OVS_DEFINE([HAVE_FRAG_PERCPU_COUNTER_BATCH])]) | |
8e53509c WT |
1036 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], |
1037 | [null_compute_pseudo], | |
1038 | [OVS_DEFINE([HAVE_NULL_COMPUTE_PSEUDO])]) | |
1039 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], | |
1040 | [__skb_checksum_convert], | |
1041 | [OVS_DEFINE([HAVE_SKB_CHECKSUM_CONVERT])]) | |
1042 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device], | |
1043 | [max_mtu], | |
1044 | [OVS_DEFINE([HAVE_NET_DEVICE_MAX_MTU])]) | |
8e53509c WT |
1045 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/ip6_tunnel.h], [__ip6_tnl_parm], |
1046 | [erspan_ver], | |
1047 | [OVS_DEFINE([HAVE_IP6_TNL_PARM_ERSPAN_VER])]) | |
1048 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], | |
1049 | [SKB_GSO_IPXIP6], | |
1050 | [OVS_DEFINE([HAVE_SKB_GSO_IPXIP6])]) | |
1051 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ipv6.h], | |
1052 | [ip6_make_flowlabel], [fl6], | |
1053 | [OVS_DEFINE([HAVE_IP6_MAKE_FLOWLABEL_FL6])]) | |
1054 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/ipv6.h], [netns_sysctl_ipv6], | |
1055 | [auto_flowlabels], | |
1056 | [OVS_DEFINE([HAVE_NETNS_SYSCTL_IPV6_AUTO_FLOWLABELS])]) | |
1057 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], | |
1058 | [netif_keep_dst], | |
1059 | [OVS_DEFINE([HAVE_NETIF_KEEP_DST])]) | |
1060 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops], | |
1061 | [ndo_get_iflink], | |
1062 | [OVS_DEFINE([HAVE_NDO_GET_IFLINK])]) | |
1063 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], | |
1064 | [skb_set_inner_ipproto], | |
1065 | [OVS_DEFINE([HAVE_SKB_SET_INNER_IPPROTO])]) | |
1066 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1067 | [tunnel_encap_types], | |
1068 | [OVS_DEFINE([HAVE_TUNNEL_ENCAP_TYPES])]) | |
1069 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1070 | [IFLA_IPTUN_ENCAP_TYPE], | |
1071 | [OVS_DEFINE([HAVE_IFLA_IPTUN_ENCAP_TYPE])]) | |
1072 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1073 | [IFLA_IPTUN_COLLECT_METADATA], | |
1074 | [OVS_DEFINE([HAVE_IFLA_IPTUN_COLLECT_METADATA])]) | |
e1ededf4 GR |
1075 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], |
1076 | [IFLA_GRE_ENCAP_DPORT]) | |
1077 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1078 | [IFLA_GRE_COLLECT_METADATA]) | |
1079 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1080 | [IFLA_GRE_IGNORE_DF]) | |
1081 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1082 | [IFLA_GRE_FWMARK]) | |
1083 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1084 | [IFLA_GRE_ERSPAN_INDEX]) | |
1085 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1086 | [IFLA_GRE_ERSPAN_HWID]) | |
436d36db GR |
1087 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], |
1088 | [IFLA_IPTUN_FWMARK]) | |
10f24236 GR |
1089 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/skbuff.h], [sk_buff], |
1090 | [csum_valid], | |
1091 | [OVS_DEFINE([HAVE_SKBUFF_CSUM_VALID])]) | |
9feb5bda MM |
1092 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/skbuff.h], [sk_buff], |
1093 | [vlan_present], | |
1094 | [OVS_DEFINE([HAVE_SKBUFF_VLAN_PRESENT])]) | |
10f24236 GR |
1095 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], |
1096 | [skb_checksum_simple_validate]) | |
44a629b5 GR |
1097 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], |
1098 | [void.*ndo_get_stats64], | |
1099 | [OVS_DEFINE([HAVE_VOID_NDO_GET_STATS64])]) | |
7f63d830 YS |
1100 | OVS_GREP_IFELSE([$KSRC/include/linux/timer.h], [init_timer_deferrable], |
1101 | [OVS_DEFINE([HAVE_INIT_TIMER_DEFERRABLE])]) | |
3f3b76f9 GR |
1102 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip_tunnels.h], |
1103 | [ip_tunnel_info_opts_set], [flags], | |
1104 | [OVS_DEFINE([HAVE_IP_TUNNEL_INFO_OPTS_SET_FLAGS])]) | |
4a90b277 GR |
1105 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags], |
1106 | [rnd], | |
1107 | [OVS_DEFINE([HAVE_INET_FRAGS_RND])]) | |
f7246940 GS |
1108 | OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [__LINUX_OVERFLOW_H], |
1109 | [OVS_DEFINE([HAVE_OVERFLOW_H])]) | |
8f6d230f YS |
1110 | OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [struct_size], |
1111 | [OVS_DEFINE([HAVE_STRUCT_SIZE])]) | |
f7246940 GS |
1112 | OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_array], |
1113 | [OVS_DEFINE([HAVE_KVMALLOC_ARRAY])]) | |
1114 | OVS_GREP_IFELSE([$KSRC/include/linux/mm.h], [kvmalloc_node], | |
1115 | [OVS_DEFINE([HAVE_KVMALLOC_NODE])]) | |
945d6d1c YS |
1116 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_l3proto.h], |
1117 | [nf_conntrack_l3proto], | |
1118 | [OVS_DEFINE([HAVE_NF_CONNTRACK_L3PROATO_H])]) | |
4fdec898 FW |
1119 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_core.h], |
1120 | [nf_conntrack_in], [nf_hook_state], | |
1121 | [OVS_DEFINE([HAVE_NF_CONNTRACK_IN_TAKES_NF_HOOK_STATE])]) | |
7857a9b4 FW |
1122 | OVS_GREP_IFELSE([$KSRC/include/net/ipv6_frag.h], [IP6_DEFRAG_CONNTRACK_IN], |
1123 | [OVS_DEFINE([HAVE_IPV6_FRAG_H])]) | |
7685ce31 GF |
1124 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_helper.h], |
1125 | [nf_ct_helper_ext_add], [nf_conntrack_helper], | |
1126 | [OVS_DEFINE([HAVE_NF_CT_HELPER_EXT_ADD_TAKES_HELPER])]) | |
6d97adee GR |
1127 | OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_calc_hlen], |
1128 | [OVS_DEFINE([HAVE_GRE_CALC_HLEN])]) | |
1129 | OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [ip_gre_calc_hlen], | |
1130 | [OVS_DEFINE([HAVE_IP_GRE_CALC_HLEN])]) | |
4bfdefea YS |
1131 | OVS_GREP_IFELSE([$KSRC/include/linux/rbtree.h], [rb_link_node_rcu], |
1132 | [OVS_DEFINE([HAVE_RBTREE_RB_LINK_NODE_RCU])]) | |
6634cc8a GR |
1133 | OVS_GREP_IFELSE([$KSRC/include/net/dst_ops.h], [bool confirm_neigh], |
1134 | [OVS_DEFINE([HAVE_DST_OPS_CONFIRM_NEIGH])]) | |
f77d85b1 GR |
1135 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [fqdir], |
1136 | [OVS_DEFINE([HAVE_INET_FRAG_FQDIR])]) | |
2ef0f1c2 JB |
1137 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h], [genl_ops], |
1138 | [policy], | |
1139 | [OVS_DEFINE([HAVE_GENL_OPS_POLICY])]) | |
6db0f72d JB |
1140 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], |
1141 | [nla_parse_deprecated_strict], | |
1142 | [OVS_DEFINE([HAVE_NLA_PARSE_DEPRECATED_STRICT])]) | |
82b7e6d1 GR |
1143 | OVS_FIND_OP_PARAM_IFELSE([$KSRC/include/net/rtnetlink.h], |
1144 | [validate], [extack], | |
1145 | [OVS_DEFINE([HAVE_RTNLOP_VALIDATE_WITH_EXTACK])]) | |
9ba57fc7 HZ |
1146 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], |
1147 | [__skb_set_hash]) | |
1148 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [sw_hash]) | |
1149 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_get_hash_raw]) | |
21a719d6 | 1150 | |
22bcc0e7 JG |
1151 | if cmp -s datapath/linux/kcompat.h.new \ |
1152 | datapath/linux/kcompat.h >/dev/null 2>&1; then | |
1153 | rm datapath/linux/kcompat.h.new | |
064af421 | 1154 | else |
22bcc0e7 | 1155 | mv datapath/linux/kcompat.h.new datapath/linux/kcompat.h |
064af421 BP |
1156 | fi |
1157 | ]) | |
1158 | ||
f6eb6b20 | 1159 | dnl Checks for net/if_dl.h. |
d30e714c | 1160 | dnl |
d23fa2ed YT |
1161 | dnl (We use this as a proxy for checking whether we're building on FreeBSD |
1162 | dnl or NetBSD.) | |
9360d9b7 EM |
1163 | AC_DEFUN([OVS_CHECK_IF_DL], |
1164 | [AC_CHECK_HEADER([net/if_dl.h], | |
1165 | [HAVE_IF_DL=yes], | |
1166 | [HAVE_IF_DL=no]) | |
1167 | AM_CONDITIONAL([HAVE_IF_DL], [test "$HAVE_IF_DL" = yes]) | |
1168 | if test "$HAVE_IF_DL" = yes; then | |
1169 | AC_DEFINE([HAVE_IF_DL], [1], | |
1170 | [Define to 1 if net/if_dl.h is available.]) | |
d30e714c | 1171 | |
d23fa2ed | 1172 | # On these platforms we use libpcap to access network devices. |
d30e714c | 1173 | AC_SEARCH_LIBS([pcap_open_live], [pcap]) |
9360d9b7 EM |
1174 | fi]) |
1175 | ||
e50097d2 BP |
1176 | dnl Checks for buggy strtok_r. |
1177 | dnl | |
1178 | dnl Some versions of glibc 2.7 has a bug in strtok_r when compiling | |
1179 | dnl with optimization that can cause segfaults: | |
1180 | dnl | |
1181 | dnl http://sources.redhat.com/bugzilla/show_bug.cgi?id=5614. | |
1182 | AC_DEFUN([OVS_CHECK_STRTOK_R], | |
1183 | [AC_CACHE_CHECK( | |
1184 | [whether strtok_r macro segfaults on some inputs], | |
1185 | [ovs_cv_strtok_r_bug], | |
1186 | [AC_RUN_IFELSE( | |
1187 | [AC_LANG_PROGRAM([#include <stdio.h> | |
1188 | #include <string.h> | |
1189 | ], | |
416e7132 BP |
1190 | [[#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 |
1191 | /* Assume bug is present, because relatively minor | |
1192 | changes in compiler settings (e.g. optimization | |
1193 | level) can make it crop up. */ | |
1194 | return 1; | |
1195 | #else | |
1196 | char string[] = ":::"; | |
e50097d2 BP |
1197 | char *save_ptr = (char *) 0xc0ffee; |
1198 | char *token1, *token2; | |
1199 | token1 = strtok_r(string, ":", &save_ptr); | |
1200 | token2 = strtok_r(NULL, ":", &save_ptr); | |
5819a7cd | 1201 | freopen ("/dev/null", "w", stdout); |
e50097d2 BP |
1202 | printf ("%s %s\n", token1, token2); |
1203 | return 0; | |
416e7132 | 1204 | #endif |
e50097d2 BP |
1205 | ]])], |
1206 | [ovs_cv_strtok_r_bug=no], | |
1207 | [ovs_cv_strtok_r_bug=yes], | |
1208 | [ovs_cv_strtok_r_bug=yes])]) | |
1209 | if test $ovs_cv_strtok_r_bug = yes; then | |
1210 | AC_DEFINE([HAVE_STRTOK_R_BUG], [1], | |
1211 | [Define if strtok_r macro segfaults on some inputs]) | |
1212 | fi | |
1213 | ]) | |
1214 | ||
064af421 BP |
1215 | dnl ---------------------------------------------------------------------- |
1216 | dnl These macros are from GNU PSPP, with the following original license: | |
1217 | dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. | |
1218 | dnl This file is free software; the Free Software Foundation | |
1219 | dnl gives unlimited permission to copy and/or distribute it, | |
1220 | dnl with or without modifications, as long as this notice is preserved. | |
1221 | ||
50194820 | 1222 | AC_DEFUN([_OVS_CHECK_CC_OPTION], [dnl |
726af752 | 1223 | m4_define([ovs_cv_name], [ovs_cv_[]m4_translit([$1], [-= ], [__])])dnl |
064af421 BP |
1224 | AC_CACHE_CHECK([whether $CC accepts $1], [ovs_cv_name], |
1225 | [ovs_save_CFLAGS="$CFLAGS" | |
50194820 BP |
1226 | dnl Include -Werror in the compiler options, because without -Werror |
1227 | dnl clang's GCC-compatible compiler driver does not return a failure | |
1228 | dnl exit status even though it complains about options it does not | |
1229 | dnl understand. | |
c2deac54 YT |
1230 | dnl |
1231 | dnl Also, check stderr as gcc exits with status 0 for options | |
1232 | dnl rejected at getopt level. | |
1233 | dnl % touch /tmp/a.c | |
1234 | dnl % gcc -g -c -Werror -Qunused-arguments /tmp/a.c; echo $? | |
1235 | dnl gcc: unrecognized option '-Qunused-arguments' | |
1236 | dnl 0 | |
1237 | dnl % | |
4c1e8cb9 BP |
1238 | dnl |
1239 | dnl In addition, GCC does not complain about a -Wno-<foo> option that | |
1240 | dnl it does not understand, unless it has another error to report, so | |
1241 | dnl instead of testing for -Wno-<foo>, test for the positive version. | |
1242 | CFLAGS="$CFLAGS $WERROR m4_bpatsubst([$1], [-Wno-], [-W])" | |
37f4615e BP |
1243 | AC_COMPILE_IFELSE( |
1244 | [AC_LANG_SOURCE([int x;])], | |
1245 | [if test -s conftest.err && grep "unrecognized option" conftest.err | |
1246 | then | |
1247 | ovs_cv_name[]=no | |
1248 | else | |
1249 | ovs_cv_name[]=yes | |
1250 | fi], | |
1251 | [ovs_cv_name[]=no]) | |
064af421 BP |
1252 | CFLAGS="$ovs_save_CFLAGS"]) |
1253 | if test $ovs_cv_name = yes; then | |
83f6c050 | 1254 | m4_if([$2], [], [:], [$2]) |
064af421 BP |
1255 | else |
1256 | m4_if([$3], [], [:], [$3]) | |
1257 | fi | |
1258 | ]) | |
1259 | ||
50194820 BP |
1260 | dnl OVS_CHECK_WERROR |
1261 | dnl | |
1262 | dnl Check whether the C compiler accepts -Werror. | |
1263 | dnl Sets $WERROR to "-Werror", if so, and otherwise to the empty string. | |
1264 | AC_DEFUN([OVS_CHECK_WERROR], | |
1265 | [WERROR= | |
1266 | _OVS_CHECK_CC_OPTION([-Werror], [WERROR=-Werror])]) | |
1267 | ||
1268 | dnl OVS_CHECK_CC_OPTION([OPTION], [ACTION-IF-ACCEPTED], [ACTION-IF-REJECTED]) | |
1269 | dnl Check whether the given C compiler OPTION is accepted. | |
1270 | dnl If so, execute ACTION-IF-ACCEPTED, otherwise ACTION-IF-REJECTED. | |
1271 | AC_DEFUN([OVS_CHECK_CC_OPTION], | |
1272 | [AC_REQUIRE([OVS_CHECK_WERROR]) | |
1273 | _OVS_CHECK_CC_OPTION([$1], [$2], [$3])]) | |
1274 | ||
064af421 BP |
1275 | dnl OVS_ENABLE_OPTION([OPTION]) |
1276 | dnl Check whether the given C compiler OPTION is accepted. | |
d161c099 | 1277 | dnl If so, add it to WARNING_FLAGS. |
064af421 BP |
1278 | dnl Example: OVS_ENABLE_OPTION([-Wdeclaration-after-statement]) |
1279 | AC_DEFUN([OVS_ENABLE_OPTION], | |
d161c099 BP |
1280 | [OVS_CHECK_CC_OPTION([$1], [WARNING_FLAGS="$WARNING_FLAGS $1"]) |
1281 | AC_SUBST([WARNING_FLAGS])]) | |
c72e245a BP |
1282 | |
1283 | dnl OVS_CONDITIONAL_CC_OPTION([OPTION], [CONDITIONAL]) | |
1284 | dnl Check whether the given C compiler OPTION is accepted. | |
1285 | dnl If so, enable the given Automake CONDITIONAL. | |
1286 | ||
1287 | dnl Example: OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED]) | |
1288 | AC_DEFUN([OVS_CONDITIONAL_CC_OPTION], | |
1289 | [OVS_CHECK_CC_OPTION( | |
1290 | [$1], [ovs_have_cc_option=yes], [ovs_have_cc_option=no]) | |
1291 | AM_CONDITIONAL([$2], [test $ovs_have_cc_option = yes])]) | |
064af421 | 1292 | dnl ---------------------------------------------------------------------- |
ed2d4f6a BP |
1293 | |
1294 | dnl Check for too-old XenServer. | |
1295 | AC_DEFUN([OVS_CHECK_XENSERVER_VERSION], | |
1296 | [AC_CACHE_CHECK([XenServer release], [ovs_cv_xsversion], | |
1297 | [if test -e /etc/redhat-release; then | |
1298 | ovs_cv_xsversion=`sed -n 's/^XenServer DDK release \([[^-]]*\)-.*/\1/p' /etc/redhat-release` | |
1299 | fi | |
1300 | if test -z "$ovs_cv_xsversion"; then | |
1301 | ovs_cv_xsversion=none | |
1302 | fi]) | |
1303 | case $ovs_cv_xsversion in | |
1304 | none) | |
1305 | ;; | |
1306 | ||
1307 | [[1-9]][[0-9]]* | dnl XenServer 10 or later | |
1308 | [[6-9]]* | dnl XenServer 6 or later | |
1309 | 5.[[7-9]]* | dnl XenServer 5.7 or later | |
1310 | 5.6.[[1-9]][[0-9]][[0-9]][[0-9]]* | dnl XenServer 5.6.1000 or later | |
1311 | 5.6.[[2-9]][[0-9]][[0-9]]* | dnl XenServer 5.6.200 or later | |
1312 | 5.6.1[[0-9]][[0-9]]) dnl Xenserver 5.6.100 or later | |
1313 | ;; | |
1314 | ||
1315 | *) | |
1316 | AC_MSG_ERROR([This appears to be XenServer $ovs_cv_xsversion, but only XenServer 5.6.100 or later is supported. (If you are really using a supported version of XenServer, you may override this error message by specifying 'ovs_cv_xsversion=5.6.100' on the "configure" command line.)]) | |
1317 | ;; | |
1318 | esac]) | |
29d935d6 | 1319 | |
643c0c34 BP |
1320 | dnl OVS_CHECK_SPARSE_TARGET |
1321 | dnl | |
1322 | dnl The "cgcc" script from "sparse" isn't very good at detecting the | |
1323 | dnl target for which the code is being built. This helps it out. | |
1324 | AC_DEFUN([OVS_CHECK_SPARSE_TARGET], | |
1325 | [AC_CACHE_CHECK( | |
1326 | [target hint for cgcc], | |
1327 | [ac_cv_sparse_target], | |
1328 | [AS_CASE([`$CC -dumpmachine 2>/dev/null`], | |
1329 | [i?86-* | athlon-*], [ac_cv_sparse_target=x86], | |
1330 | [x86_64-*], [ac_cv_sparse_target=x86_64], | |
1331 | [ac_cv_sparse_target=other])]) | |
1332 | AS_CASE([$ac_cv_sparse_target], | |
0cdd5b13 BP |
1333 | [x86], [SPARSEFLAGS= CGCCFLAGS="-target=i86 -target=host_os_specs"], |
1334 | [x86_64], [SPARSEFLAGS=-m64 CGCCFLAGS="-target=x86_64 -target=host_os_specs"], | |
643c0c34 | 1335 | [SPARSEFLAGS= CGCCFLAGS=]) |
346c6538 | 1336 | |
e5273084 | 1337 | dnl Get the default defines for vector instructions from compiler to |
346c6538 IM |
1338 | dnl allow "sparse" correctly check the same code that will be built. |
1339 | dnl Required for checking DPDK headers. | |
1340 | AC_MSG_CHECKING([vector options for cgcc]) | |
1341 | VECTOR=$($CC -dM -E - < /dev/null | grep -E "MMX|SSE|AVX" | \ | |
1342 | cut -c 9- | sed 's/ /=/' | sed 's/^/-D/' | tr '\n' ' ') | |
1343 | AC_MSG_RESULT([$VECTOR]) | |
1344 | CGCCFLAGS="$CGCCFLAGS $VECTOR" | |
1345 | ||
643c0c34 BP |
1346 | AC_SUBST([SPARSEFLAGS]) |
1347 | AC_SUBST([CGCCFLAGS])]) | |
1348 | ||
32e96ab7 AZ |
1349 | dnl OVS_SPARSE_EXTRA_INCLUDES |
1350 | dnl | |
1351 | dnl The cgcc script from "sparse" does not search gcc's default | |
1352 | dnl search path. Get the default search path from GCC and pass | |
1353 | dnl them to sparse. | |
1354 | AC_DEFUN([OVS_SPARSE_EXTRA_INCLUDES], | |
1355 | AC_SUBST([SPARSE_EXTRA_INCLUDES], | |
1356 | [`$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 ' ' `] )) | |
1357 | ||
29d935d6 BP |
1358 | dnl OVS_ENABLE_SPARSE |
1359 | AC_DEFUN([OVS_ENABLE_SPARSE], | |
643c0c34 | 1360 | [AC_REQUIRE([OVS_CHECK_SPARSE_TARGET]) |
32e96ab7 | 1361 | AC_REQUIRE([OVS_SPARSE_EXTRA_INCLUDES]) |
372d58a4 BP |
1362 | : ${SPARSE=sparse} |
1363 | AC_SUBST([SPARSE]) | |
1364 | AC_CONFIG_COMMANDS_PRE( | |
d4042a70 BP |
1365 | [CC='$(if $(C:0=),env REAL_CC="'"$CC"'" CHECK="$(SPARSE) $(SPARSE_WERROR) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')']) |
1366 | ||
1367 | AC_ARG_ENABLE( | |
1368 | [sparse], | |
1369 | [AC_HELP_STRING([--enable-sparse], [Run "sparse" by default])], | |
1370 | [], [enable_sparse=no]) | |
1371 | AM_CONDITIONAL([ENABLE_SPARSE_BY_DEFAULT], [test $enable_sparse = yes])]) | |
8a8cd0ac | 1372 | |
0eaaacac FL |
1373 | dnl OVS_CTAGS_IDENTIFIERS |
1374 | dnl | |
9ed9df77 FL |
1375 | dnl ctags ignores symbols with extras identifiers. This is a list of |
1376 | dnl specially handled identifiers to be ignored. [ctags(1) -I <list>]. | |
0eaaacac FL |
1377 | AC_DEFUN([OVS_CTAGS_IDENTIFIERS], |
1378 | AC_SUBST([OVS_CTAGS_IDENTIFIERS_LIST], | |
9ed9df77 | 1379 | ["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+"])) |
0eaaacac | 1380 | |
8a8cd0ac BP |
1381 | dnl OVS_PTHREAD_SET_NAME |
1382 | dnl | |
1383 | dnl This checks for three known variants of pthreads functions for setting | |
1384 | dnl the name of the current thread: | |
1385 | dnl | |
1386 | dnl glibc: int pthread_setname_np(pthread_t, const char *name); | |
1387 | dnl NetBSD: int pthread_setname_np(pthread_t, const char *format, void *arg); | |
1388 | dnl FreeBSD: int pthread_set_name_np(pthread_t, const char *name); | |
1389 | dnl | |
1390 | dnl For glibc and FreeBSD, the arguments are just a thread and its name. For | |
1391 | dnl NetBSD, 'format' is a printf() format string and 'arg' is an argument to | |
1392 | dnl provide to it. | |
1393 | dnl | |
1394 | dnl This macro defines: | |
1395 | dnl | |
1396 | dnl glibc: HAVE_GLIBC_PTHREAD_SETNAME_NP | |
1397 | dnl NetBSD: HAVE_NETBSD_PTHREAD_SETNAME_NP | |
1398 | dnl FreeBSD: HAVE_PTHREAD_SET_NAME_NP | |
1399 | AC_DEFUN([OVS_CHECK_PTHREAD_SET_NAME], | |
1400 | [AC_CHECK_FUNCS([pthread_set_name_np]) | |
1401 | if test $ac_cv_func_pthread_set_name_np != yes; then | |
1402 | AC_CACHE_CHECK( | |
1403 | [for pthread_setname_np() variant], | |
1404 | [ovs_cv_pthread_setname_np], | |
1405 | [AC_LINK_IFELSE( | |
a0903134 | 1406 | [AC_LANG_PROGRAM([#include <pthread.h> |
8a8cd0ac | 1407 | ], [pthread_setname_np(pthread_self(), "name");])], |
a0903134 | 1408 | [ovs_cv_pthread_setname_np=glibc], |
8a8cd0ac | 1409 | [AC_LINK_IFELSE( |
a0903134 | 1410 | [AC_LANG_PROGRAM([#include <pthread.h> |
8a8cd0ac BP |
1411 | ], [pthread_setname_np(pthread_self(), "%s", "name");])], |
1412 | [ovs_cv_pthread_setname_np=netbsd], | |
a0903134 | 1413 | [ovs_cv_pthread_setname_np=none])])]) |
8a8cd0ac BP |
1414 | case $ovs_cv_pthread_setname_np in # ( |
1415 | glibc) | |
a0903134 YT |
1416 | AC_DEFINE( |
1417 | [HAVE_GLIBC_PTHREAD_SETNAME_NP], [1], | |
1418 | [Define to 1 if pthread_setname_np() is available and takes 2 parameters (like glibc).]) | |
1419 | ;; # ( | |
8a8cd0ac | 1420 | netbsd) |
a0903134 YT |
1421 | AC_DEFINE( |
1422 | [HAVE_NETBSD_PTHREAD_SETNAME_NP], [1], | |
1423 | [Define to 1 if pthread_setname_np() is available and takes 3 parameters (like NetBSD).]) | |
1424 | ;; | |
8a8cd0ac BP |
1425 | esac |
1426 | fi]) | |
5020f5f0 BP |
1427 | |
1428 | dnl OVS_CHECK_LINUX_HOST. | |
1429 | dnl | |
1430 | dnl Checks whether we're building for a Linux host, based on the presence of | |
1431 | dnl the __linux__ preprocessor symbol, and sets up an Automake conditional | |
1432 | dnl LINUX based on the result. | |
1433 | AC_DEFUN([OVS_CHECK_LINUX_HOST], | |
1434 | [AC_CACHE_CHECK( | |
1435 | [whether __linux__ is defined], | |
1436 | [ovs_cv_linux], | |
1437 | [AC_COMPILE_IFELSE( | |
1438 | [AC_LANG_PROGRAM([enum { LINUX = __linux__};], [])], | |
1439 | [ovs_cv_linux=true], | |
1440 | [ovs_cv_linux=false])]) | |
1441 | AM_CONDITIONAL([LINUX], [$ovs_cv_linux])]) |