Go to the first, previous, next, last section, table of contents.


Using autoheader to Create `config.h.in'

The @command{autoheader} program can create a template file of C `#define' statements for configure to use. If `configure.ac' invokes AC_CONFIG_HEADERS(file), @command{autoheader} creates `file.in'; if multiple file arguments are given, the first one is used. Otherwise, @command{autoheader} creates `config.h.in'.

In order to do its job, @command{autoheader} needs you to document all of the symbols that you might use; i.e., there must be at least one AC_DEFINE or one AC_DEFINE_UNQUOTED using its third argument for each symbol (see section Defining C Preprocessor Symbols). An additional constraint is that the first argument of AC_DEFINE must be a literal. Note that all symbols defined by Autoconf's built-in tests are already documented properly; you only need to document those that you define yourself.

You might wonder why @command{autoheader} is needed: after all, why would @command{configure} need to "patch" a `config.h.in' to produce a `config.h' instead of just creating `config.h' from scratch? Well, when everything rocks, the answer is just that we are wasting our time maintaining @command{autoheader}: generating `config.h' directly is all that is needed. When things go wrong, however, you'll be thankful for the existence of @command{autoheader}.

The fact that the symbols are documented is important in order to check that `config.h' makes sense. The fact that there is a well defined list of symbols that should be #define'd (or not) is also important for people who are porting packages to environments where @command{configure} cannot be run: they just have to @emph{fill in the blanks}.

But let's come back to the point: @command{autoheader}'s invocation...

If you give @command{autoheader} an argument, it uses that file instead of `configure.ac' and writes the header file to the standard output instead of to `config.h.in'. If you give @command{autoheader} an argument of @option{-}, it reads the standard input instead of `configure.ac' and writes the header file to the standard output.

autoheader accepts the following options:

@option{--help}
@option{-h}
Print a summary of the command line options and exit.
@option{--version}
@option{-V}
Print the version number of Autoconf and exit.
@option{--debug}
@option{-d}
Don't remove the temporary files.
@option{--verbose}
@option{-v}
Report processing steps.
@option{--autoconf-dir=dir}
@option{-A dir}
Override the location where the installed Autoconf data files are looked for. You can also set the AC_MACRODIR environment variable to a directory; this option overrides the environment variable. This option is rarely needed and dangerous; it is only used when one plays with different versions of Autoconf simultaneously.
@option{--localdir=dir}
@option{-l dir}
Look for the package files `aclocal.m4' and `acconfig.h' (but not `file.top' and `file.bot') in directory dir instead of in the current directory.
@option{--warnings=category}
@option{-W category}
Report the warnings related to category (which can actually be a comma separated list). Current categories include:
`obsolete'
report the uses of obsolete constructs
`all'
report all the warnings
`none'
report none
`error'
treats warnings as errors
`no-category'
disable warnings falling into category


Go to the first, previous, next, last section, table of contents.