]>
Commit | Line | Data |
---|---|---|
1 | # -*- autoconf -*- | |
2 | ||
3 | # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019 Nicira, Inc. | |
4 | # | |
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: | |
8 | # | |
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. | |
16 | ||
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 | ||
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 | |
41 | OVS_CFLAGS="$OVS_CFLAGS -Werror" | |
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 | |
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])]) | |
60 | ||
61 | dnl OVS_CHECK_LINUX | |
62 | dnl | |
63 | dnl Configure linux kernel source tree | |
64 | AC_DEFUN([OVS_CHECK_LINUX], [ | |
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 | |
71 | (usually figured out automatically from build | |
72 | directory)])]) | |
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 | |
80 | AC_MSG_WARN([--with-linux is deprecated and kernel support is limited to 5.8 and below]) | |
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]) | |
94 | else | |
95 | KSRC= | |
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 | ||
101 | if test -n "$KBUILD"; then | |
102 | KBUILD=`eval echo "$KBUILD"` | |
103 | case $KBUILD in | |
104 | /*) ;; | |
105 | *) KBUILD=`pwd`/$KBUILD ;; | |
106 | esac | |
107 | ||
108 | # The build directory is what the user provided. | |
109 | # Make sure that it exists. | |
110 | AC_MSG_CHECKING([for Linux build directory]) | |
111 | if test -d "$KBUILD"; then | |
112 | AC_MSG_RESULT([$KBUILD]) | |
113 | AC_SUBST(KBUILD) | |
114 | else | |
115 | AC_MSG_RESULT([no]) | |
116 | AC_ERROR([source dir $KBUILD doesn't exist]) | |
117 | fi | |
118 | ||
119 | # Debian breaks kernel headers into "source" header and "build" headers. | |
120 | # We want the source headers, but $KBUILD gives us the "build" headers. | |
121 | # Use heuristics to find the source headers. | |
122 | AC_MSG_CHECKING([for Linux source directory]) | |
123 | if test -n "$KSRC"; then | |
124 | KSRC=`eval echo "$KSRC"` | |
125 | case $KSRC in | |
126 | /*) ;; | |
127 | *) KSRC=`pwd`/$KSRC ;; | |
128 | esac | |
129 | if test ! -e $KSRC/include/linux/kernel.h; then | |
130 | AC_MSG_ERROR([$KSRC is not a kernel source directory]) | |
131 | fi | |
132 | else | |
133 | KSRC=$KBUILD | |
134 | if test ! -e $KSRC/include/linux/kernel.h; then | |
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 | |
150 | fi | |
151 | if test ! -e "$KSRC"/include/linux/kernel.h; then | |
152 | AC_MSG_ERROR([cannot find source directory (please use --with-linux-source)]) | |
153 | fi | |
154 | fi | |
155 | AC_MSG_RESULT([$KSRC]) | |
156 | ||
157 | AC_MSG_CHECKING([for kernel version]) | |
158 | version=`sed -n 's/^VERSION = //p' "$KSRC/Makefile"` | |
159 | patchlevel=`sed -n 's/^PATCHLEVEL = //p' "$KSRC/Makefile"` | |
160 | sublevel=`sed -n 's/^SUBLEVEL = //p' "$KSRC/Makefile"` | |
161 | if test X"$version" = X || test X"$patchlevel" = X; then | |
162 | AC_ERROR([cannot determine kernel version]) | |
163 | elif test X"$sublevel" = X; then | |
164 | kversion=$version.$patchlevel | |
165 | else | |
166 | kversion=$version.$patchlevel.$sublevel | |
167 | fi | |
168 | AC_MSG_RESULT([$kversion]) | |
169 | ||
170 | if test "$version" -ge 5; then | |
171 | if test "$version" = 5 && test "$patchlevel" -le 8; then | |
172 | : # Linux 5.x | |
173 | else | |
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)]) | |
175 | fi | |
176 | elif test "$version" = 4; then | |
177 | : # Linux 4.x | |
178 | elif test "$version" = 3 && test "$patchlevel" -ge 10; then | |
179 | : # Linux 3.x | |
180 | else | |
181 | AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 3.10 or later is required]) | |
182 | fi | |
183 | if (test ! -e "$KBUILD"/include/linux/version.h && \ | |
184 | test ! -e "$KBUILD"/include/generated/uapi/linux/version.h)|| \ | |
185 | (test ! -e "$KBUILD"/include/linux/autoconf.h && \ | |
186 | test ! -e "$KBUILD"/include/generated/autoconf.h); then | |
187 | AC_MSG_ERROR([Linux kernel source in $KBUILD is not configured]) | |
188 | fi | |
189 | OVS_CHECK_LINUX_COMPAT | |
190 | fi | |
191 | AM_CONDITIONAL(LINUX_ENABLED, test -n "$KBUILD") | |
192 | ]) | |
193 | ||
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 | ||
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>], [ | |
212 | int x = TCA_ACT_FLAGS; | |
213 | ])], | |
214 | [AC_DEFINE([HAVE_TCA_ACT_FLAGS], [1], | |
215 | [Define to 1 if TCA_ACT_FLAGS is available.])]) | |
216 | ||
217 | AC_CHECK_MEMBERS([struct tcf_t.firstuse], [], [], [#include <linux/pkt_cls.h>]) | |
218 | ||
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], | |
224 | [Define to 1 if TCA_VLAN_PUSH_VLAN_PRIORITY is available.])]) | |
225 | ||
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 | ||
233 | AC_COMPILE_IFELSE([ | |
234 | AC_LANG_PROGRAM([#include <linux/tc_act/tc_tunnel_key.h>], [ | |
235 | int x = TCA_TUNNEL_KEY_ENC_TTL; | |
236 | ])], | |
237 | [AC_DEFINE([HAVE_TCA_TUNNEL_KEY_ENC_TTL], [1], | |
238 | [Define to 1 if TCA_TUNNEL_KEY_ENC_TTL is available.])]) | |
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], | |
245 | [Define to 1 if TCA_PEDIT_KEY_EX_HDR_TYPE_UDP is available.])]) | |
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.])]) | |
253 | ]) | |
254 | ||
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 | ||
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 | ||
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 | ||
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 | ||
318 | OVS_FIND_DEPENDENCY([numa_alloc_onnode], [numa], [libnuma]) | |
319 | ||
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]) | |
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>]]) | |
329 | fi | |
330 | AM_CONDITIONAL([HAVE_AF_XDP], test "$AF_XDP_ENABLE" = true) | |
331 | ]) | |
332 | ||
333 | dnl OVS_CHECK_DPDK | |
334 | dnl | |
335 | dnl Configure DPDK source tree | |
336 | AC_DEFUN([OVS_CHECK_DPDK], [ | |
337 | AC_ARG_WITH([dpdk], | |
338 | [AC_HELP_STRING([--with-dpdk=static|shared|yes], | |
339 | [Specify "static" or "shared" depending on the | |
340 | DPDK libraries to use])], | |
341 | [have_dpdk=true]) | |
342 | ||
343 | AC_MSG_CHECKING([whether dpdk is enabled]) | |
344 | if test "$have_dpdk" != true || test "$with_dpdk" = no; then | |
345 | AC_MSG_RESULT([no]) | |
346 | DPDKLIB_FOUND=false | |
347 | else | |
348 | AC_MSG_RESULT([yes]) | |
349 | case "$with_dpdk" in | |
350 | "shared") | |
351 | PKG_CHECK_MODULES([DPDK], [libdpdk], [ | |
352 | DPDK_INCLUDE="$DPDK_CFLAGS" | |
353 | DPDK_LIB="$DPDK_LIBS"]) | |
354 | ;; | |
355 | "static" | "yes") | |
356 | PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ | |
357 | DPDK_INCLUDE="$DPDK_CFLAGS" | |
358 | DPDK_LIB="$DPDK_LIBS"]) | |
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 | |
380 | esac | |
381 | ||
382 | ovs_save_CFLAGS="$CFLAGS" | |
383 | ovs_save_LDFLAGS="$LDFLAGS" | |
384 | CFLAGS="$CFLAGS $DPDK_INCLUDE" | |
385 | ||
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 | ||
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>]]) | |
393 | ||
394 | AC_CHECK_DECL([RTE_LIBRTE_PMD_PCAP], [ | |
395 | OVS_FIND_DEPENDENCY([pcap_dump_close], [pcap], [libpcap]) | |
396 | ], [], [[#include <rte_config.h>]]) | |
397 | ||
398 | AC_CHECK_DECL([RTE_LIBRTE_PMD_AF_XDP], [ | |
399 | LIBBPF_LDADD="-lbpf" | |
400 | ], [], [[#include <rte_config.h>]]) | |
401 | ||
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>]]) | |
405 | ||
406 | AC_CHECK_DECL([RTE_LIBRTE_MLX5_PMD], [dnl found | |
407 | AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found | |
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>]]) | |
412 | ||
413 | AC_CHECK_DECL([RTE_LIBRTE_MLX4_PMD], [dnl found | |
414 | AC_CHECK_DECL([RTE_IBVERBS_LINK_DLOPEN], [], [dnl not found | |
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>]]) | |
419 | ||
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]) | |
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])) | |
437 | ]) | |
438 | ||
439 | CFLAGS="$ovs_save_CFLAGS" | |
440 | LDFLAGS="$ovs_save_LDFLAGS" | |
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') | |
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') | |
451 | OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE" | |
452 | OVS_ENABLE_OPTION([-mssse3]) | |
453 | ||
454 | # DPDK pmd drivers are not linked unless --whole-archive is used. | |
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. | |
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 | ||
468 | AC_SUBST([DPDK_vswitchd_LDFLAGS]) | |
469 | AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.]) | |
470 | fi | |
471 | ||
472 | AM_CONDITIONAL([DPDK_NETDEV], test "$DPDKLIB_FOUND" = true) | |
473 | ]) | |
474 | ||
475 | dnl OVS_GREP_IFELSE(FILE, REGEX, [IF-MATCH], [IF-NO-MATCH]) | |
476 | dnl | |
477 | dnl Greps FILE for REGEX. If it matches, runs IF-MATCH, otherwise IF-NO-MATCH. | |
478 | dnl If IF-MATCH is empty then it defines to OVS_DEFINE(HAVE_<REGEX>), with | |
479 | dnl <REGEX> translated to uppercase. | |
480 | AC_DEFUN([OVS_GREP_IFELSE], [ | |
481 | AC_MSG_CHECKING([whether $2 matches in $1]) | |
482 | if test -f $1; then | |
483 | grep '$2' $1 >/dev/null 2>&1 | |
484 | status=$? | |
485 | case $status in | |
486 | 0) | |
487 | AC_MSG_RESULT([yes]) | |
488 | m4_if([$3], [], [OVS_DEFINE([HAVE_]m4_toupper([$2]))], [$3]) | |
489 | ;; | |
490 | 1) | |
491 | AC_MSG_RESULT([no]) | |
492 | $4 | |
493 | ;; | |
494 | *) | |
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 | |
502 | ]) | |
503 | ||
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 | |
514 | awk '/$2.{/,/^}/' $1 2>/dev/null | grep '$3' >/dev/null | |
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 | ||
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 | ||
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 | ||
599 | dnl OVS_DEFINE(NAME) | |
600 | dnl | |
601 | dnl Defines NAME to 1 in kcompat.h. | |
602 | AC_DEFUN([OVS_DEFINE], [ | |
603 | echo '#define $1 1' >> datapath/linux/kcompat.h.new | |
604 | ]) | |
605 | ||
606 | dnl OVS_CHECK_LINUX_COMPAT | |
607 | dnl | |
608 | dnl Runs various Autoconf checks on the Linux kernel source in | |
609 | dnl the directory in $KBUILD. | |
610 | AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ | |
611 | rm -f datapath/linux/kcompat.h.new | |
612 | mkdir -p datapath/linux | |
613 | : > datapath/linux/kcompat.h.new | |
614 | ||
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 | ||
621 | OVS_GREP_IFELSE([$KSRC/arch/x86/include/asm/checksum_32.h], [src_err,], | |
622 | [OVS_DEFINE([HAVE_CSUM_COPY_DBG])]) | |
623 | ||
624 | OVS_GREP_IFELSE([$KSRC/include/net/ip6_fib.h], [rt6_get_cookie], | |
625 | [OVS_DEFINE([HAVE_RT6_GET_COOKIE])]) | |
626 | ||
627 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub], | |
628 | [dst_entry]) | |
629 | OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup.*net], | |
630 | [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_NET])]) | |
631 | OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow.*net], | |
632 | [OVS_DEFINE([HAVE_IPV6_DST_LOOKUP_FLOW_NET])]) | |
633 | OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_stub]) | |
634 | OVS_GREP_IFELSE([$KSRC/include/net/addrconf.h], [ipv6_dst_lookup_flow]) | |
635 | ||
636 | OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST]) | |
637 | OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [IS_ERR_OR_NULL]) | |
638 | OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [PTR_ERR_OR_ZERO]) | |
639 | ||
640 | OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [static_branch_unlikely(], | |
641 | [OVS_DEFINE([HAVE_UPSTREAM_STATIC_KEY])]) | |
642 | OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], [DEFINE_STATIC_KEY_FALSE], | |
643 | [OVS_DEFINE([HAVE_DEFINE_STATIC_KEY])]) | |
644 | OVS_GREP_IFELSE([$KSRC/include/linux/jump_label.h], | |
645 | [DECLARE_STATIC_KEY_FALSE], | |
646 | [OVS_DEFINE([HAVE_DECLARE_STATIC_KEY])]) | |
647 | ||
648 | OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random]) | |
649 | OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [ether_addr_copy]) | |
650 | ||
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]) | |
654 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_set_encap_proto]) | |
655 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_hwaccel_push_inside]) | |
656 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [__vlan_hwaccel_clear_tag]) | |
657 | ||
658 | OVS_GREP_IFELSE([$KSRC/include/linux/in.h], [ipv4_is_multicast]) | |
659 | OVS_GREP_IFELSE([$KSRC/include/linux/in.h], [proto_ports_offset]) | |
660 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [__ip_select_ident.*dst_entry], | |
661 | [OVS_DEFINE([HAVE_IP_SELECT_IDENT_USING_DST_ENTRY])]) | |
662 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [__ip_select_ident.*net], | |
663 | [OVS_DEFINE([HAVE_IP_SELECT_IDENT_USING_NET])]) | |
664 | ||
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])]) | |
667 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_defrag.*net], | |
668 | [OVS_DEFINE([HAVE_IP_DEFRAG_TAKES_NET])]) | |
669 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip.h], | |
670 | [ip_do_fragment], [net], | |
671 | [OVS_DEFINE([HAVE_IP_DO_FRAGMENT_TAKES_NET])]) | |
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 | ||
676 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [ip_skb_dst_mtu]) | |
677 | ||
678 | OVS_GREP_IFELSE([$KSRC/include/net/ip.h], [IPSKB_FRAG_PMTU], | |
679 | [OVS_DEFINE([HAVE_CORRECT_MRU_HANDLING])]) | |
680 | OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h], [__ip_tunnel_change_mtu]) | |
681 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [hashfn.*const], | |
682 | [OVS_DEFINE([HAVE_INET_FRAGS_CONST])]) | |
683 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [last_in], | |
684 | [OVS_DEFINE([HAVE_INET_FRAGS_LAST_IN])]) | |
685 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_evicting]) | |
686 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_evictor]) | |
687 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags], | |
688 | [frags_work]) | |
689 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags], | |
690 | [rwlock]) | |
691 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_queue], | |
692 | [list_evictor]) | |
693 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_lru_move]) | |
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])]) | |
699 | OVS_GREP_IFELSE([$KSRC/include/net/inetpeer.h], [vif], | |
700 | [OVS_DEFINE([HAVE_INETPEER_VIF_SUPPORT])]) | |
701 | ||
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 | ||
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], | |
712 | [OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache], | |
713 | [OVS_GREP_IFELSE([$KSRC/include/net/erspan.h], [erspan_md2], | |
714 | [OVS_DEFINE([USE_UPSTREAM_TUNNEL])])])])]) | |
715 | ||
716 | OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache], | |
717 | [OVS_DEFINE([USE_BUILTIN_DST_CACHE])]) | |
718 | OVS_GREP_IFELSE([$KSRC/include/net/mpls.h], [mpls_hdr], | |
719 | [OVS_DEFINE([MPLS_HEADER_IS_L3])]) | |
720 | OVS_GREP_IFELSE([$KSRC/include/linux/net.h], [sock_create_kern.*net], | |
721 | [OVS_DEFINE([HAVE_SOCK_CREATE_KERN_NET])]) | |
722 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_fill_metadata_dst]) | |
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]) | |
726 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_recursion_level]) | |
727 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [__skb_gso_segment]) | |
728 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [skb_gso_error_unwind]) | |
729 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [can_checksum_protocol]) | |
730 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_get_iflink]) | |
731 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_features_check], | |
732 | [OVS_DEFINE([USE_UPSTREAM_TUNNEL_GSO])]) | |
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]) | |
735 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_udp_tunnel_add]) | |
736 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_features_t]) | |
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])]) | |
741 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netif_needs_gso.*net_device], | |
742 | [OVS_DEFINE([HAVE_NETIF_NEEDS_GSO_NETDEV])]) | |
743 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [skb_csum_hwoffload_help]) | |
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]) | |
748 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [IFF_PHONY_HEADROOM]) | |
749 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops], | |
750 | [extended]) | |
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])]) | |
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 | ||
758 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device], | |
759 | [max_mtu]) | |
760 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops_extended], | |
761 | [ndo_change_mtu], [OVS_DEFINE([HAVE_RHEL7_MAX_MTU])]) | |
762 | OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h], | |
763 | [dev_change_flags], [extack], | |
764 | [OVS_DEFINE([HAVE_DEV_CHANGE_FLAGS_TAKES_EXTACK])]) | |
765 | ||
766 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state]) | |
767 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state], | |
768 | [struct net ], [OVS_DEFINE([HAVE_NF_HOOK_STATE_NET])]) | |
769 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_register_net_hook]) | |
770 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hookfn.*nf_hook_ops], | |
771 | [OVS_DEFINE([HAVE_NF_HOOKFN_ARG_OPS])]) | |
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])]) | |
776 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [NFPROTO_INET]) | |
777 | OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [CONFIG_NF_NAT_NEEDED]) | |
778 | ||
779 | ||
780 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter_ipv6.h], [nf_ipv6_ops], | |
781 | [fragment.*sock], [OVS_DEFINE([HAVE_NF_IPV6_OPS_FRAGMENT])]) | |
782 | ||
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 | ||
789 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], | |
790 | [nf_ct_tmpl_alloc], [nf_conntrack_zone], | |
791 | [OVS_DEFINE([HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE])]) | |
792 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], | |
793 | [nf_ct_get_tuplepr], [struct.net], | |
794 | [OVS_DEFINE([HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET])]) | |
795 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], | |
796 | [nf_ct_set]) | |
797 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], | |
798 | [nf_ct_is_untracked]) | |
799 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack.h], | |
800 | [nf_ct_invert_tuplepr]) | |
801 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_zones.h], | |
802 | [nf_ct_zone_init]) | |
803 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_l3proto.h], | |
804 | [net_ns_get]) | |
805 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h], | |
806 | [nf_connlabels_get]) | |
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])]) | |
810 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_labels.h], | |
811 | [nf_conn_labels], [words]) | |
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]) | |
814 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_range2]) | |
815 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_nat.h], [nf_nat_packet], | |
816 | [OVS_DEFINE([HAVE_UPSTREAM_NF_NAT])]) | |
817 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_seqadj.h], [nf_ct_seq_adjust]) | |
818 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_count.h], [nf_conncount_gc_list], | |
819 | [OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_count.h], | |
820 | [int nf_conncount_add], | |
821 | [], [OVS_DEFINE([HAVE_UPSTREAM_NF_CONNCOUNT])])]) | |
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])]) | |
828 | ||
829 | OVS_GREP_IFELSE([$KSRC/include/linux/random.h], | |
830 | [prandom_u32[[\(]]], | |
831 | [OVS_DEFINE([HAVE_PRANDOM_U32])]) | |
832 | OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max]) | |
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]) | |
837 | ||
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 | ||
844 | OVS_GREP_IFELSE([$KSRC/include/linux/rcupdate.h], [rcu_read_lock_held], [], | |
845 | [OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], | |
846 | [rcu_read_lock_held])]) | |
847 | OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], [lockdep_rtnl_is_held]) | |
848 | OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], [net_rwsem]) | |
849 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/rtnetlink.h], | |
850 | [rtnl_create_link], [extack], | |
851 | [OVS_DEFINE([HAVE_RTNL_CREATE_LINK_TAKES_EXTACK])]) | |
852 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [nf_reset_ct]) | |
853 | ||
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. | |
859 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [[[^@]]proto_data_valid], | |
860 | [OVS_DEFINE([HAVE_PROTO_DATA_VALID])]) | |
861 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_checksum_start_offset]) | |
862 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [inner_protocol]) | |
863 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [inner_protocol_type]) | |
864 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_inner_transport_offset]) | |
865 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [kfree_skb_list]) | |
866 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [rxhash]) | |
867 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [u16.*rxhash], | |
868 | [OVS_DEFINE([HAVE_U16_RXHASH])]) | |
869 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_dst(], | |
870 | [OVS_DEFINE([HAVE_SKB_DST_ACCESSOR_FUNCS])]) | |
871 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], | |
872 | [skb_copy_from_linear_data_offset]) | |
873 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], | |
874 | [skb_reset_tail_pointer]) | |
875 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_cow_head]) | |
876 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_warn_if_lro], | |
877 | [OVS_DEFINE([HAVE_SKB_WARN_LRO])]) | |
878 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [consume_skb]) | |
879 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_frag_page]) | |
880 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_has_frag_list]) | |
881 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [__skb_fill_page_desc]) | |
882 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_reset_mac_len]) | |
883 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_unclone]) | |
884 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_orphan_frags]) | |
885 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_get_hash(], | |
886 | [OVS_DEFINE([HAVE_SKB_GET_HASH])]) | |
887 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_clear_hash]) | |
888 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [int.skb_zerocopy(], | |
889 | [OVS_DEFINE([HAVE_SKB_ZEROCOPY])]) | |
890 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_ensure_writable]) | |
891 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_vlan_pop]) | |
892 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [__skb_vlan_pop]) | |
893 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_vlan_push]) | |
894 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_clear_hash_if_not_l4]) | |
895 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_postpush_rcsum]) | |
896 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [lco_csum]) | |
897 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_nfct]) | |
898 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_put_zero]) | |
899 | ||
900 | OVS_GREP_IFELSE([$KSRC/include/linux/types.h], [__wsum], | |
901 | [OVS_DEFINE([HAVE_CSUM_TYPES])]) | |
902 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/types.h], [__wsum], | |
903 | [OVS_DEFINE([HAVE_CSUM_TYPES])]) | |
904 | ||
905 | OVS_GREP_IFELSE([$KSRC/include/net/checksum.h], [csum_replace4]) | |
906 | OVS_GREP_IFELSE([$KSRC/include/net/checksum.h], [csum_unfold]) | |
907 | ||
908 | OVS_GREP_IFELSE([$KSRC/include/net/dst.h], [dst_discard_sk]) | |
909 | OVS_GREP_IFELSE([$KSRC/include/net/dst.h], [__skb_dst_copy]) | |
910 | ||
911 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_has_listeners]) | |
912 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [mcgrp_offset]) | |
913 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [parallel_ops]) | |
914 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [netlink_has_listeners(net->genl_sock], | |
915 | [OVS_DEFINE([HAVE_GENL_HAS_LISTENERS_TAKES_NET])]) | |
916 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genlmsg_parse]) | |
917 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_notify.*family], | |
918 | [OVS_DEFINE([HAVE_GENL_NOTIFY_TAKES_FAMILY])]) | |
919 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_validate_flags]) | |
920 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/genetlink.h], | |
921 | [genl_notify], [net], | |
922 | [OVS_DEFINE([HAVE_GENL_NOTIFY_TAKES_NET])]) | |
923 | ||
924 | ||
925 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h], | |
926 | [genl_multicast_group], [id]) | |
927 | OVS_GREP_IFELSE([$KSRC/include/net/geneve.h], [geneve_hdr]) | |
928 | ||
929 | OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_cisco_register]) | |
930 | OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_handle_offloads]) | |
931 | OVS_GREP_IFELSE([$KSRC/include/net/ipv6.h], [IP6_FH_F_SKIP_RH]) | |
932 | OVS_GREP_IFELSE([$KSRC/include/net/ipv6.h], [ip6_local_out_sk]) | |
933 | OVS_GREP_IFELSE([$KSRC/include/net/ipv6.h], [__ipv6_addr_jhash]) | |
934 | OVS_GREP_IFELSE([$KSRC/include/net/ip6_fib.h], [rt6i.*u.dst], | |
935 | [OVS_DEFINE([HAVE_RT6INFO_DST_UNION])]) | |
936 | OVS_GREP_IFELSE([$KSRC/include/net/ip6_route.h], [ip6_frag.*sock], | |
937 | [OVS_DEFINE([HAVE_IP_FRAGMENT_TAKES_SOCK])]) | |
938 | ||
939 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_64bit]) | |
940 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16]) | |
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]) | |
944 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_in_addr]) | |
945 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_find_nested]) | |
946 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_is_last]) | |
947 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_nest_start_noflag]) | |
948 | OVS_GREP_IFELSE([$KSRC/include/linux/netlink.h], [void.*netlink_set_err], | |
949 | [OVS_DEFINE([HAVE_VOID_NETLINK_SET_ERR])]) | |
950 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netlink.h], | |
951 | [nla_parse], [netlink_ext_ack], | |
952 | [OVS_DEFINE([HAVE_NETLINK_EXT_ACK])]) | |
953 | ||
954 | OVS_GREP_IFELSE([$KSRC/include/net/sctp/checksum.h], [sctp_compute_cksum]) | |
955 | ||
956 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_insert_tag_set_proto]) | |
957 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [__vlan_insert_tag]) | |
958 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [vlan_get_protocol]) | |
959 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [skb_vlan_tagged]) | |
960 | OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [eth_type_vlan]) | |
961 | ||
962 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/dst_metadata.h], | |
963 | [metadata_dst_alloc], [metadata_type]) | |
964 | ||
965 | OVS_GREP_IFELSE([$KSRC/include/linux/u64_stats_sync.h], [u64_stats_fetch_begin_irq]) | |
966 | ||
967 | OVS_GREP_IFELSE([$KSRC/include/net/vxlan.h], [struct vxlan_metadata], | |
968 | [OVS_DEFINE([HAVE_VXLAN_METADATA])]) | |
969 | OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_flow_src_port], | |
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]) | |
973 | OVS_GREP_IFELSE([$KSRC/include/net/udp_tunnel.h], [udp_tunnel_gro_complete]) | |
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])]) | |
976 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/udp_tunnel.h], [udp_tunnel_sock_cfg], | |
977 | [gro_receive]) | |
978 | ||
979 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [ignore_df], | |
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])]) | |
983 | ||
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]) | |
986 | OVS_FIND_PARAM_IFELSE([$KSRC/include/net/protocol.h], | |
987 | [udp_add_offload], [net], | |
988 | [OVS_DEFINE([HAVE_UDP_ADD_OFFLOAD_TAKES_NET])]) | |
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])]) | |
992 | OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [family_list], | |
993 | [OVS_DEFINE([HAVE_GENL_FAMILY_LIST])]) | |
994 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device], | |
995 | [needs_free_netdev], | |
996 | [OVS_DEFINE([HAVE_NEEDS_FREE_NETDEV])]) | |
997 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/vxlan.h], [vxlan_dev], [cfg], | |
998 | [OVS_DEFINE([HAVE_VXLAN_DEV_CFG])]) | |
999 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_helper.h], | |
1000 | [nf_conntrack_helper_put], | |
1001 | [OVS_DEFINE(HAVE_NF_CONNTRACK_HELPER_PUT)]) | |
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]) | |
1006 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h],[[[[:space:]]]SKB_GSO_UDP[[[:space:]]]], | |
1007 | [OVS_DEFINE([HAVE_SKB_GSO_UDP])]) | |
1008 | OVS_GREP_IFELSE([$KSRC/include/net/dst.h],[DST_NOCACHE], | |
1009 | [OVS_DEFINE([HAVE_DST_NOCACHE])]) | |
1010 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/rtnetlink.h], [rtnl_link_ops], | |
1011 | [extack], | |
1012 | [OVS_DEFINE([HAVE_EXT_ACK_IN_RTNL_LINKOPS])]) | |
1013 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_ops], | |
1014 | [list], | |
1015 | [OVS_DEFINE([HAVE_LIST_IN_NF_HOOK_OPS])]) | |
1016 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/netfilter/nf_conntrack_common.h], | |
1017 | [IP_CT_UNTRACKED]) | |
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])]) | |
1021 | OVS_GREP_IFELSE([$KSRC/include/linux/compiler_types.h], | |
1022 | [__LINUX_COMPILER_TYPES_H], | |
1023 | [OVS_DEFINE([HAVE_LINUX_COMPILER_TYPES_H])]) | |
1024 | OVS_GREP_IFELSE([$KSRC/include/linux/timekeeping.h], | |
1025 | [ktime_get_ts64], | |
1026 | [OVS_DEFINE([HAVE_KTIME_GET_TS64])]) | |
1027 | OVS_GREP_IFELSE([$KSRC/include/net/net_namespace.h], | |
1028 | [EXPORT_SYMBOL_GPL(peernet2id_alloc)], | |
1029 | [OVS_DEFINE([HAVE_PEERNET2ID_ALLOC])]) | |
1030 | OVS_GREP_IFELSE([$KSRC/include/linux/timekeeping.h], | |
1031 | [ktime_get_ns], | |
1032 | [OVS_DEFINE([HAVE_KTIME_GET_NS])]) | |
1033 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], | |
1034 | frag_percpu_counter_batch[], | |
1035 | [OVS_DEFINE([HAVE_FRAG_PERCPU_COUNTER_BATCH])]) | |
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])]) | |
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])]) | |
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]) | |
1087 | OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h], | |
1088 | [IFLA_IPTUN_FWMARK]) | |
1089 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/skbuff.h], [sk_buff], | |
1090 | [csum_valid], | |
1091 | [OVS_DEFINE([HAVE_SKBUFF_CSUM_VALID])]) | |
1092 | OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/skbuff.h], [sk_buff], | |
1093 | [vlan_present], | |
1094 | [OVS_DEFINE([HAVE_SKBUFF_VLAN_PRESENT])]) | |
1095 | OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], | |
1096 | [skb_checksum_simple_validate]) | |
1097 | OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], | |
1098 | [void.*ndo_get_stats64], | |
1099 | [OVS_DEFINE([HAVE_VOID_NDO_GET_STATS64])]) | |
1100 | OVS_GREP_IFELSE([$KSRC/include/linux/timer.h], [init_timer_deferrable], | |
1101 | [OVS_DEFINE([HAVE_INIT_TIMER_DEFERRABLE])]) | |
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])]) | |
1105 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frags], | |
1106 | [rnd], | |
1107 | [OVS_DEFINE([HAVE_INET_FRAGS_RND])]) | |
1108 | OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [__LINUX_OVERFLOW_H], | |
1109 | [OVS_DEFINE([HAVE_OVERFLOW_H])]) | |
1110 | OVS_GREP_IFELSE([$KSRC/include/linux/overflow.h], [struct_size], | |
1111 | [OVS_DEFINE([HAVE_STRUCT_SIZE])]) | |
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])]) | |
1116 | OVS_GREP_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_l3proto.h], | |
1117 | [nf_conntrack_l3proto], | |
1118 | [OVS_DEFINE([HAVE_NF_CONNTRACK_L3PROATO_H])]) | |
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])]) | |
1122 | OVS_GREP_IFELSE([$KSRC/include/net/ipv6_frag.h], [IP6_DEFRAG_CONNTRACK_IN], | |
1123 | [OVS_DEFINE([HAVE_IPV6_FRAG_H])]) | |
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])]) | |
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])]) | |
1131 | OVS_GREP_IFELSE([$KSRC/include/linux/rbtree.h], [rb_link_node_rcu], | |
1132 | [OVS_DEFINE([HAVE_RBTREE_RB_LINK_NODE_RCU])]) | |
1133 | OVS_GREP_IFELSE([$KSRC/include/net/dst_ops.h], [bool confirm_neigh], | |
1134 | [OVS_DEFINE([HAVE_DST_OPS_CONFIRM_NEIGH])]) | |
1135 | OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [fqdir], | |
1136 | [OVS_DEFINE([HAVE_INET_FRAG_FQDIR])]) | |
1137 | OVS_FIND_FIELD_IFELSE([$KSRC/include/net/genetlink.h], [genl_ops], | |
1138 | [policy], | |
1139 | [OVS_DEFINE([HAVE_GENL_OPS_POLICY])]) | |
1140 | OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], | |
1141 | [nla_parse_deprecated_strict], | |
1142 | [OVS_DEFINE([HAVE_NLA_PARSE_DEPRECATED_STRICT])]) | |
1143 | OVS_FIND_OP_PARAM_IFELSE([$KSRC/include/net/rtnetlink.h], | |
1144 | [validate], [extack], | |
1145 | [OVS_DEFINE([HAVE_RTNLOP_VALIDATE_WITH_EXTACK])]) | |
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]) | |
1150 | ||
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 | |
1154 | else | |
1155 | mv datapath/linux/kcompat.h.new datapath/linux/kcompat.h | |
1156 | fi | |
1157 | ]) | |
1158 | ||
1159 | dnl Checks for net/if_dl.h. | |
1160 | dnl | |
1161 | dnl (We use this as a proxy for checking whether we're building on FreeBSD | |
1162 | dnl or NetBSD.) | |
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.]) | |
1171 | ||
1172 | # On these platforms we use libpcap to access network devices. | |
1173 | AC_SEARCH_LIBS([pcap_open_live], [pcap]) | |
1174 | fi]) | |
1175 | ||
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 | ], | |
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[] = ":::"; | |
1197 | char *save_ptr = (char *) 0xc0ffee; | |
1198 | char *token1, *token2; | |
1199 | token1 = strtok_r(string, ":", &save_ptr); | |
1200 | token2 = strtok_r(NULL, ":", &save_ptr); | |
1201 | freopen ("/dev/null", "w", stdout); | |
1202 | printf ("%s %s\n", token1, token2); | |
1203 | return 0; | |
1204 | #endif | |
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 | ||
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 | ||
1222 | AC_DEFUN([_OVS_CHECK_CC_OPTION], [dnl | |
1223 | m4_define([ovs_cv_name], [ovs_cv_[]m4_translit([$1], [-= ], [__])])dnl | |
1224 | AC_CACHE_CHECK([whether $CC accepts $1], [ovs_cv_name], | |
1225 | [ovs_save_CFLAGS="$CFLAGS" | |
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. | |
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 % | |
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])" | |
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]) | |
1252 | CFLAGS="$ovs_save_CFLAGS"]) | |
1253 | if test $ovs_cv_name = yes; then | |
1254 | m4_if([$2], [], [:], [$2]) | |
1255 | else | |
1256 | m4_if([$3], [], [:], [$3]) | |
1257 | fi | |
1258 | ]) | |
1259 | ||
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 | ||
1275 | dnl OVS_ENABLE_OPTION([OPTION]) | |
1276 | dnl Check whether the given C compiler OPTION is accepted. | |
1277 | dnl If so, add it to WARNING_FLAGS. | |
1278 | dnl Example: OVS_ENABLE_OPTION([-Wdeclaration-after-statement]) | |
1279 | AC_DEFUN([OVS_ENABLE_OPTION], | |
1280 | [OVS_CHECK_CC_OPTION([$1], [WARNING_FLAGS="$WARNING_FLAGS $1"]) | |
1281 | AC_SUBST([WARNING_FLAGS])]) | |
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])]) | |
1292 | dnl ---------------------------------------------------------------------- | |
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]) | |
1319 | ||
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], | |
1333 | [x86], [SPARSEFLAGS= CGCCFLAGS="-target=i86 -target=host_os_specs"], | |
1334 | [x86_64], [SPARSEFLAGS=-m64 CGCCFLAGS="-target=x86_64 -target=host_os_specs"], | |
1335 | [SPARSEFLAGS= CGCCFLAGS=]) | |
1336 | ||
1337 | dnl Get the default defines for vector instructions from compiler to | |
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 | ||
1346 | AC_SUBST([SPARSEFLAGS]) | |
1347 | AC_SUBST([CGCCFLAGS])]) | |
1348 | ||
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 | ||
1358 | dnl OVS_ENABLE_SPARSE | |
1359 | AC_DEFUN([OVS_ENABLE_SPARSE], | |
1360 | [AC_REQUIRE([OVS_CHECK_SPARSE_TARGET]) | |
1361 | AC_REQUIRE([OVS_SPARSE_EXTRA_INCLUDES]) | |
1362 | : ${SPARSE=sparse} | |
1363 | AC_SUBST([SPARSE]) | |
1364 | AC_CONFIG_COMMANDS_PRE( | |
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])]) | |
1372 | ||
1373 | dnl OVS_CTAGS_IDENTIFIERS | |
1374 | dnl | |
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>]. | |
1377 | AC_DEFUN([OVS_CTAGS_IDENTIFIERS], | |
1378 | AC_SUBST([OVS_CTAGS_IDENTIFIERS_LIST], | |
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+"])) | |
1380 | ||
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( | |
1406 | [AC_LANG_PROGRAM([#include <pthread.h> | |
1407 | ], [pthread_setname_np(pthread_self(), "name");])], | |
1408 | [ovs_cv_pthread_setname_np=glibc], | |
1409 | [AC_LINK_IFELSE( | |
1410 | [AC_LANG_PROGRAM([#include <pthread.h> | |
1411 | ], [pthread_setname_np(pthread_self(), "%s", "name");])], | |
1412 | [ovs_cv_pthread_setname_np=netbsd], | |
1413 | [ovs_cv_pthread_setname_np=none])])]) | |
1414 | case $ovs_cv_pthread_setname_np in # ( | |
1415 | glibc) | |
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 | ;; # ( | |
1420 | netbsd) | |
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 | ;; | |
1425 | esac | |
1426 | fi]) | |
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])]) |