./configure ‑‑help : ‑‑enable-feature or ‑‑disable-feature?

./configure ‑‑help : ‑‑enable-feature or ‑‑disable-feature?

By default a feature can be enabled, disabled, when ./configure is run, or its value may depend on the environment. Should ./configure ‑‑help print for it ‑‑enable-feature or ‑‑disable-feature?

Software applications have mechanisms to show how to change their default behaviour. Sometimes it is just a matter of calling ‑‑help to see what options are available. When preparing software for building, providing ‑‑help is often the way to see what options are available, e.g. as in ./configure ‑‑help. As the output of ‑‑help is concise, it should provide to the user this information:

  • what is the default, if a particular option is not passed, and
  • how to deviate from that default.

There is no added value to hint the user how to enforce the default behaviour, which will happen anyway if it is not enforced.

A command-line option can have these values:

  • ON, OFF
  • checks/depends/auto - when the actual value is determined during program execution, based on the environment
  • whatever the user provides explicitly

As a person, who has compiled a lot of software packages on Linux from Scratch systems, I recommend:

When ‑‑help emits

‑‑disable-brum Disable brum mode

(without printing ‑‑enable-brum) this implies, that by default the brum feature is enabled. On the other side, if ‑‑help prints

‑‑enable-truf Enable truf handling (default=auto)

this implies that by default at run time it will be checked if truf handling can be enabled. If the user wants to be sure that truf is enabled, then passing ‑‑enable-truf should abort, if truf cannot be enabled.

An antipattern is to show only how to enforce the default. Imagine mode kwat is enabled by default. If ‑‑help prints

‑‑enable-kwat Enable kwat behaviour

the user will be misled to conclude that when no action is taken, the kwat mode will disabled.

To recap: if ‑‑help prints only ‑‑enable-Z or ‑‑disable-Z this implies that by default the option z is disabled/enabled and by passing the command line argument, this default can be altered. This frees from reading further the documentation. It is misleading to announce an option, turned on by default, by printing in ‑‑help: ‑‑enable-Z.