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:
--enable-feature[=arg] --disable-feature
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 out.
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.
Normally configure scripts complain about --enable-package options that they do not support. See Option Checking, for details, and for how to override the defaults.
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.
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, dashes, plus signs, and dots.
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 namedenable_
feature, with any non-alphanumeric characters in feature changed into ‘_’. You may use that variable instead, if you wish. The help-string argument is like that ofAC_ARG_WITH
(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
AC_ARG_WITH
(see External Software) to get an idea of possible applications ofAC_ARG_ENABLE
.