Right now meson_options.txt lists less than a dozen options, but about 40 more could come as configure tests are converted and moved to meson.build. Each option needs code in configure to parse it and pass the option down to Meson as a -D command-line argument; in addition the default must be duplicated between configure and meson_options.txt.
This series tries to remove the code duplication by passing unknown --enable and --disable options to a Python program, and using Meson's introspection support to match those to meson_options.txt The disadvantages are: - because we parse command-line options before meson is available, the introspection output is stored in the source tree. The output is slightly modified using the "jq" tool in order to ensure that it's stable and that modifications to meson_buildoptions.txt do not cause horrible conflicts. This is the main reason for the unattractive diffstat (the number of JSON lines added is higher than the number of configure lines removed, though of course the latter are code that must be maintained manually and the former is not). - we now need Python to generate the full help, so if Python is missing we can only print a partial message and direct the user to specify the interpreter with --python. It would be possible to fix this by rewriting the script in Perl (at least on Fedora, JSON::PP is always installed if Perl is, because it's a dependency for CPAN; I'd have to check Ubuntu and the BSDs), or if we want to write it as a Bourne shell script, to further massage the introspection output into for example TAB-separated values. Opinions are welcome on whether this is worthwhile and how to solve the above doubts. Paolo Paolo Bonzini (3): configure: quote command line arguments in config.status configure: early test for Python configure: automatically parse command line for meson -D options Makefile | 6 ++ configure | 107 ++++++++----------- docs/devel/build-system.rst | 35 +------ meson-buildoptions.json | 130 ++++++++++++++++++++++++ scripts/configure-parse-buildoptions.py | 94 +++++++++++++++++ 5 files changed, 280 insertions(+), 92 deletions(-) create mode 100644 meson-buildoptions.json create mode 100644 scripts/configure-parse-buildoptions.py -- 2.26.2