FYI, if you look at the generated configure
script you'll see that the help text is all pre-formatted into one blob of text in a quoted "here document" (sent to stdout by cat
), i.e. there's no opportunity whatsoever for any form of substitution to happen at the time the script runs (i.e. when you run it as ./configure --help
). One could no doubt argue this is a bug, but on the other hand since the processing done by autoconf
to pretty-print the help text is done without any knowledge of how the final script will execute, and thus without any idea what variables might be set and what range of values they might take on, autoconf
has no way to know how much space to allocate in its formatting of the help text for whatever value(s) any variable might have at run-time.
For cases were only binary options are desired (i.e. where the [=ARG]
feature is not used/needed), then it should be possible to write a smart wrapper macro which would generate appropriate help text based on the default setting, if that default is itself first defined as an M4 macro in a way similar to what was suggested in the accepted answer.