From: Luca Boccassi Date: Tue, 26 Feb 2019 17:46:37 +0000 (+0000) Subject: build: improve pcap dependency handling X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3ce6474b22473860081aa76477b75c302c78afc7;p=dpdk.git build: improve pcap dependency handling pcap has historically shipped a custom pcap-config binary tool which does the job of pkg-config. It was never compatible with cross compilation. Meson uses it when using dependency(), which then means cross compilation fails. Set pcap-config to empty in the meson cross compilation files so that Meson will not use it, and add a fallback in case dependency() fails. libpcap 1.9.0 finally ships a pkg-config file so everything will work out of the box in the future. Signed-off-by: Luca Boccassi --- diff --git a/config/arm/arm64_armv8_linuxapp_gcc b/config/arm/arm64_armv8_linuxapp_gcc index 987c02fbb0..5137609177 100644 --- a/config/arm/arm64_armv8_linuxapp_gcc +++ b/config/arm/arm64_armv8_linuxapp_gcc @@ -3,6 +3,7 @@ c = 'aarch64-linux-gnu-gcc' cpp = 'aarch64-linux-gnu-cpp' ar = 'aarch64-linux-gnu-gcc-ar' strip = 'aarch64-linux-gnu-strip' +pcap-config = '' [host_machine] system = 'linux' diff --git a/config/arm/arm64_dpaa2_linuxapp_gcc b/config/arm/arm64_dpaa2_linuxapp_gcc index 7ec74ec4be..0df8c8f7d0 100644 --- a/config/arm/arm64_dpaa2_linuxapp_gcc +++ b/config/arm/arm64_dpaa2_linuxapp_gcc @@ -4,6 +4,7 @@ cpp = 'aarch64-linux-gnu-cpp' ar = 'aarch64-linux-gnu-ar' as = 'aarch64-linux-gnu-as' strip = 'aarch64-linux-gnu-strip' +pcap-config = '' [host_machine] system = 'linux' diff --git a/config/arm/arm64_dpaa_linuxapp_gcc b/config/arm/arm64_dpaa_linuxapp_gcc index 73a8f0b81c..f4b85a84b9 100644 --- a/config/arm/arm64_dpaa_linuxapp_gcc +++ b/config/arm/arm64_dpaa_linuxapp_gcc @@ -4,6 +4,7 @@ cpp = 'aarch64-linux-gnu-cpp' ar = 'aarch64-linux-gnu-ar' as = 'aarch64-linux-gnu-as' strip = 'aarch64-linux-gnu-strip' +pcap-config = '' [host_machine] system = 'linux' diff --git a/config/arm/arm64_thunderx_linuxapp_gcc b/config/arm/arm64_thunderx_linuxapp_gcc index 967d9d46d9..14b8019989 100644 --- a/config/arm/arm64_thunderx_linuxapp_gcc +++ b/config/arm/arm64_thunderx_linuxapp_gcc @@ -3,6 +3,7 @@ c = 'aarch64-linux-gnu-gcc' cpp = 'aarch64-linux-gnu-cpp' ar = 'aarch64-linux-gnu-gcc-ar' strip = 'aarch64-linux-gnu-strip' +pcap-config = '' [host_machine] system = 'linux' diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build index 0c4e0201a0..2c2fd11e44 100644 --- a/drivers/net/pcap/meson.build +++ b/drivers/net/pcap/meson.build @@ -1,12 +1,20 @@ # 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) +pcap_dep = dependency('pcap', required: false) +if pcap_dep.found() build = true else - build = false + # 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) + if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) + build = true + pkgconfig_extra_libs += '-lpcap' + else + build = false + endif endif sources = files('rte_eth_pcap.c') ext_deps += pcap_dep -pkgconfig_extra_libs += '-lpcap'