+find_libnuma = true
+if meson.is_cross_build() and not meson.get_cross_property('numa', true)
+ # don't look for libnuma if explicitly disabled in cross build
+ find_libnuma = false
+endif
+if find_libnuma
+ numa_dep = cc.find_library('numa', required: false)
+ if numa_dep.found() and cc.has_header('numaif.h')
+ dpdk_conf.set10('RTE_HAS_LIBNUMA', true)
+ has_libnuma = 1
+ add_project_link_arguments('-lnuma', language: 'c')
+ dpdk_extra_ldflags += '-lnuma'
+ endif
+endif
+
+has_libfdt = 0
+fdt_dep = cc.find_library('libfdt', required: false)
+if fdt_dep.found() and cc.has_header('fdt.h')
+ dpdk_conf.set10('RTE_HAS_LIBFDT', true)
+ has_libfdt = 1
+ add_project_link_arguments('-lfdt', language: 'c')
+ dpdk_extra_ldflags += '-lfdt'
+endif
+
+libexecinfo = cc.find_library('libexecinfo', required: false)
+if libexecinfo.found() and cc.has_header('execinfo.h')
+ add_project_link_arguments('-lexecinfo', language: 'c')
+ dpdk_extra_ldflags += '-lexecinfo'
+endif
+
+libarchive = dependency('libarchive', required: false, method: 'pkg-config')
+if libarchive.found()
+ dpdk_conf.set('RTE_HAS_LIBARCHIVE', 1)
+ # Push libarchive link dependency at the project level to support
+ # statically linking dpdk apps. Details at:
+ # https://inbox.dpdk.org/dev/20210605004024.660267a1@sovereign/
+ add_project_link_arguments('-larchive', language: 'c')
+ dpdk_extra_ldflags += '-larchive'
+endif
+
+# check for libbsd
+libbsd = dependency('libbsd', required: false, method: 'pkg-config')
+if libbsd.found()
+ dpdk_conf.set('RTE_USE_LIBBSD', 1)
+endif
+
+# check for pcap
+pcap_dep = dependency('libpcap', required: false, method: 'pkg-config')
+pcap_lib = is_windows ? 'wpcap' : 'pcap'
+if not pcap_dep.found()
+ # pcap got a pkg-config file only in 1.9.0
+ pcap_dep = cc.find_library(pcap_lib, 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 += '-l@0@'.format(pcap_lib)