build: factorize jansson availability check

Since two components wants to know if the jansson library is available,
move it to config/.

Signed-off-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
David Marchand 2021-11-08 11:08:08 +01:00 committed by Thomas Monjalon
parent 8451e165b8
commit 19d024003d
3 changed files with 11 additions and 9 deletions

View File

@ -28,6 +28,10 @@ sources = files(
'util.c',
)
if dpdk_conf.has('RTE_HAS_JANSSON')
ext_deps += jansson_dep
endif
deps += ['ethdev', 'gro', 'gso', 'cmdline', 'metrics', 'bus_pci']
if dpdk_conf.has('RTE_CRYPTO_SCHEDULER')
deps += 'crypto_scheduler'
@ -60,8 +64,3 @@ endif
if dpdk_conf.has('RTE_NET_DPAA')
deps += ['bus_dpaa', 'mempool_dpaa', 'net_dpaa']
endif
jansson_dep = dependency('jansson', required: false, method: 'pkg-config')
if jansson_dep.found()
dpdk_conf.set('RTE_HAS_JANSSON', 1)
ext_deps += jansson_dep
endif

View File

@ -218,6 +218,11 @@ if libbsd.found()
dpdk_conf.set('RTE_USE_LIBBSD', 1)
endif
jansson_dep = dependency('jansson', required: false, method: 'pkg-config')
if jansson_dep.found()
dpdk_conf.set('RTE_HAS_JANSSON', 1)
endif
# check for pcap
pcap_dep = dependency('libpcap', required: false, method: 'pkg-config')
pcap_lib = is_windows ? 'wpcap' : 'pcap'

View File

@ -4,10 +4,8 @@
sources = files('rte_metrics.c', 'rte_metrics_telemetry.c')
headers = files('rte_metrics.h', 'rte_metrics_telemetry.h')
jansson = dependency('jansson', required: false, method: 'pkg-config')
if jansson.found()
dpdk_conf.set('RTE_HAS_JANSSON', 1)
ext_deps += jansson
if dpdk_conf.has('RTE_HAS_JANSSON')
ext_deps += jansson_dep
endif
deps += ['ethdev', 'telemetry']