[RFC,1/3] net/af_xdp: simplify libbpf version checking in meson
Checks
Commit Message
Test if the libbpf version is >= v0.7.0 at the beginning of the meson
build. Later when we want to check if the version is <= v0.6.0 just use
the inverse of the first check ie. ! >= v0.7.0.
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
drivers/net/af_xdp/meson.build | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
@@ -9,10 +9,14 @@ endif
sources = files('rte_eth_af_xdp.c')
+bpf_ver_dep = false
+
xdp_dep = dependency('libxdp', version : '>=1.2.2', required: false, method: 'pkg-config')
bpf_dep = dependency('libbpf', required: false, method: 'pkg-config')
if not bpf_dep.found()
bpf_dep = cc.find_library('bpf', required: false)
+else
+ bpf_ver_dep = dependency('libbpf', version : '>=0.7.0', required: false, method: 'pkg-config')
endif
if cc.has_header('linux/if_xdp.h')
@@ -22,8 +26,6 @@ if cc.has_header('linux/if_xdp.h')
cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
ext_deps += xdp_dep
ext_deps += bpf_dep
- bpf_ver_dep = dependency('libbpf', version : '>=0.7.0',
- required: false, method: 'pkg-config')
if bpf_ver_dep.found()
cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN']
endif
@@ -33,10 +35,8 @@ if cc.has_header('linux/if_xdp.h')
endif
elif bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('bpf/bpf.h')
# libxdp not found. Rely solely on libbpf for xsk functionality
- # which is only available in versions <= v0.6.0.
- bpf_ver_dep = dependency('libbpf', version : '<=0.6.0',
- required: false, method: 'pkg-config')
- if bpf_ver_dep.found()
+ # which is only available in versions < v0.7.0.
+ if not bpf_ver_dep.found()
ext_deps += bpf_dep
bpf_shumem_ver_dep = dependency('libbpf', version : '>=0.2.0',
required: false, method: 'pkg-config')