14.3 Choosing Package Options
If a software package has optional compile-time features, the user can
give configure command line options to specify whether to
compile them. The options have one of these forms:
These options allow users to choose which optional features to build and
install. --enable-feature options should never make a
feature behave differently or cause one feature to replace another.
They should only cause parts of the program to be built rather than left
The user can give an argument by following the feature name with
‘=’ and the argument. Giving an argument of ‘no’ requests
that the feature not be made available. A feature with an
argument looks like --enable-debug=stabs. If no argument is
given, it defaults to ‘yes’. --disable-feature is
equivalent to --enable-feature=no.
configure scripts do not complain about
--enable-feature options that they do not support.
This behavior permits configuring a source tree containing multiple
packages with a top-level configure script when the packages
support different options, without spurious error messages about options
that some of the packages support.
An unfortunate side effect is that option spelling errors are not diagnosed.
No better approach to this problem has been suggested so far.
For each optional feature, configure.ac should call
AC_ARG_ENABLE to detect whether the configure user asked
to include it. Whether each feature is included or not by default, and
which arguments are valid, is up to you.
— Macro: AC_ARG_ENABLE
(feature, help-string, [action-if-given], [action-if-not-given]
If the user gave configure the option
--enable-feature or --disable-feature, run
shell commands action-if-given. If neither option was given, run
shell commands action-if-not-given. The name feature
indicates an optional user-level facility. It should consist only of
alphanumeric characters and dashes.
The option's argument is available to the shell commands
action-if-given in the shell variable
enableval, which is
actually just the value of the shell variable
enable_feature, with any - characters changed into
‘_’. You may use that variable instead, if you wish. The
help-string argument is like that of
(see External Software).
You should format your help-string with the macro
AS_HELP_STRING (see Pretty Help Strings).
See the examples suggested with the definition of
(see External Software) to get an idea of possible applications of
— Macro: AC_ENABLE
(feature, action-if-given, [action-if-not-given]
This is an obsolete version of
AC_ARG_ENABLE that does not
support providing a help string.