Skip to content

Commit

Permalink
port: fix pcap support with meson
Browse files Browse the repository at this point in the history
[ upstream commit 268fa58]

The meson build was missing the define to enable pcap port support if
libpcap (development) package was found on the build platform. Rather than
duplicating the checks for libpcap found in the pcap net PMD build file, we
can move the checks to the top-level config directory and reference the
RTE_PCAP_PORT setting elsewhere in the build.

Bugzilla ID: 351
Fixes: 5b9656b ("lib: build with meson")

Reported-by: Cristian Bidea <cristian.bidea@keysight.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Cristian Bidea <cristian.bidea@keysight.com>
  • Loading branch information
bruce-richardson authored and kevintraynor committed Dec 10, 2019
1 parent 19e6ac5 commit 5e8a1c2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
13 changes: 13 additions & 0 deletions config/meson.build
Expand Up @@ -89,6 +89,19 @@ if host_machine.system() == 'linux' and cc.find_library('bsd',
dpdk_extra_ldflags += '-lbsd'
endif

# check for pcap
pcap_dep = dependency('pcap', required: false)
if pcap_dep.found()
# pcap got a pkg-config file only in 1.9.0 and before that meson uses
# an internal pcap-config finder, which is not compatible with
# cross-compilation, so try to fallback to find_library
pcap_dep = cc.find_library('pcap', required: false)
endif
if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
dpdk_conf.set('RTE_PORT_PCAP', 1)
dpdk_extra_ldflags += '-lpcap'
endif

# add -include rte_config to cflags
add_project_arguments('-include', 'rte_config.h', language: 'c')

Expand Down
6 changes: 2 additions & 4 deletions drivers/net/pcap/meson.build
@@ -1,11 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation

pcap_dep = cc.find_library('pcap', required: false)
if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
build = true
else
if not dpdk_conf.has('RTE_PORT_PCAP')
build = false
reason = 'missing dependency, "libpcap"'
endif
sources = files('rte_eth_pcap.c')
ext_deps += pcap_dep
Expand Down
4 changes: 4 additions & 0 deletions lib/librte_port/meson.build
Expand Up @@ -23,6 +23,10 @@ headers = files(
'rte_port_sym_crypto.h')
deps += ['ethdev', 'sched', 'ip_frag', 'cryptodev']

if dpdk_conf.has('RTE_PORT_PCAP')
ext_deps += pcap_dep # dependency provided in config/meson.build
endif

if dpdk_conf.has('RTE_LIBRTE_KNI')
sources += files('rte_port_kni.c')
headers += files('rte_port_kni.h')
Expand Down

0 comments on commit 5e8a1c2

Please sign in to comment.