Next: Reporting Messages, Previous: Macro Definitions, Up: Writing Autoconf Macros
All of the Autoconf macros have all-uppercase names starting with ‘AC_’ to prevent them from accidentally conflicting with other text. All shell variables that they use for internal purposes have mostly-lowercase names starting with ‘ac_’. To ensure that your macros don't conflict with present or future Autoconf macros, you should prefix your own macro names and any shell variables they use with some other sequence. Possibilities include your initials, or an abbreviation for the name of your organization or software package.
Most of the Autoconf macros' names follow a structured naming convention that indicates the kind of feature check by the name. The macro names consist of several words, separated by underscores, going from most general to most specific. The names of their cache variables use the same convention (see Cache Variable Names, for more information on them).
The first word of the name after ‘AC_’ usually tells the category of the feature being tested. Here are the categories used in Autoconf for specific test macros, the kind of macro that you are more likely to write. They are also used for cache variables, in all-lowercase. Use them where applicable; where they're not, invent your own categories.
C
DECL
FUNC
GROUP
HEADER
LIB
PATH
PROG
MEMBER
SYS
TYPE
VAR
After the category comes the name of the particular feature being
tested. Any further words in the macro name indicate particular aspects
of the feature. For example, AC_FUNC_FNMATCH_GNU
checks whether
the fnmatch
function supports GNU extensions.
An internal macro should have a name that starts with an underscore;
Autoconf internals should therefore start with ‘_AC_’.
Additionally, a macro that is an internal subroutine of another macro
should have a name that starts with an underscore and the name of that
other macro, followed by one or more words saying what the internal
macro does. For example, AC_PATH_X
has internal macros
_AC_PATH_X_XMKMF
and _AC_PATH_X_DIRECT
.