Fix gen-manpages.py to check build options
Fixes #17506
Problem
The gen-manpages.py script generates UNIX manual pages based on the --help output from binaries. The options documented vary based on build system settings, but the manual pages checked into the repository should document as many options as possible.
Solution
This PR adds comprehensive build option detection to ensure all available options are documented in the generated manpages.
Changes Made
- 
Added build option detection for all required components: - HAVE_SYSTEM- for- -alertnotifyand other notifications
- ENABLE_WALLET- for wallet specific arguments
- USE_UPNP- for UPnP arguments
- ENABLE_ZMQ- for ZMQ arguments
- Additional important build options (ENABLE_CLI,ENABLE_BITCOIN_UTIL, etc.)
 
- 
Added --skip-build-options-checkflag to bypass validation when needed
- 
Improved error handling with clear messages when components are missing 
- 
Fixed grammar in error messages (“Aborting generation of…” instead of “Aborting generating…”) 
Technical Details
- Checks HAVE_SYSTEMfrombuilddir/src/bitcoin-build-config.h
- Checks other options from builddir/test/config.ini
- Provides clear error messages listing missing components
- Users can rebuild with ./configure --enable-wallet --enable-zmq --with-upnp --enable-external-signerto enable all options
Testing
- Script now prevents generation of incomplete man pages
- Clear error messages guide users to enable missing components
- --skip-build-options-checkallows bypassing validation when needed
Acknowledgments
This work builds upon the initial implementation by @BrandonOdiwuor in PR #33085, with additional improvements and fixes. Thanks to @maflcko for the feedback and suggestions.
Related PRs
- PR #33085 by @BrandonOdiwuor (initial implementation)