[RFC v2 1/4] config: add support for using flex and bison
Stephen Hemminger
stephen at networkplumber.org
Thu May 7 02:06:48 CEST 2026
For the flow parsing library need flex and bison and
these might be useful in future for other libraries.
Detect and provide generators for building.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
config/meson.build | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/config/meson.build b/config/meson.build
index 9ba7b9a338..8668546eca 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -296,6 +296,29 @@ if (pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep)
dpdk_extra_ldflags += '-l at 0@'.format(pcap_lib)
endif
+# flex and bison are required for libraries using grammars.
+flex = find_program('flex', required: false)
+if flex.found()
+ flex_gen = generator(flex,
+ output: '@BASENAME at .yy.c',
+ arguments: ['--outfile=@OUTPUT@', '@INPUT@'],
+ )
+endif
+
+bison = find_program('bison', required: false)
+if bison.found()
+ # Parser generator. Emits both the .c and a .tab.h
+ bison_gen = generator(bison,
+ output: ['@BASENAME at .tab.c', '@BASENAME at .tab.h'],
+ arguments: [
+ '--defines=@OUTPUT1@',
+ '--output=@OUTPUT0@',
+ '@INPUT@',
+ ],
+ )
+endif
+has_flex_bison = flex.found() and bison.found()
+
# for clang 32-bit compiles we need libatomic for 64-bit atomic ops
if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false
atomic_dep = cc.find_library('atomic', required: true)
--
2.53.0
More information about the dev
mailing list