build: improve pcap dependency handling
[dpdk.git] / drivers / net / pcap / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2017 Intel Corporation
3
4 pcap_dep = dependency('pcap', required: false)
5 if pcap_dep.found()
6         build = true
7 else
8         # pcap got a pkg-config file only in 1.9.0 and before that meson uses
9         # an internal pcap-config finder, which is not compatible with
10         # cross-compilation, so try to fallback to find_library
11         pcap_dep = cc.find_library('pcap', required: false)
12         if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
13                 build = true
14                 pkgconfig_extra_libs += '-lpcap'
15         else
16                 build = false
17         endif
18 endif
19 sources = files('rte_eth_pcap.c')
20 ext_deps += pcap_dep