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


Creating Output Files

Every Autoconf-generated configure script must finish by calling AC_OUTPUT. It is the macro that creates the `Makefile's and optional other files resulting from configuration. The only other required macro is AC_INIT (see section Finding configure Input).

Macro: AC_OUTPUT ([file... [, extra-cmds [, init-cmds]]])
Create output files. Call this macro once, at the end of `configure.in'. The file... argument is a whitespace-separated list of output files; it may be empty. This macro creates each file `file' by copying an input file (by default named `file.in'), substituting the output variable values. See section Substitutions in Makefiles, for more information on using output variables. See section Setting Output Variables, for more information on creating them. This macro creates the directory that the file is in if it doesn't exist (but not the parents of that directory). Usually, `Makefile's are created this way, but other files, such as `.gdbinit', can be specified as well.

If AC_CONFIG_HEADER, AC_LINK_FILES, or AC_CONFIG_SUBDIRS has been called, this macro also creates the files named as their arguments.

A typical call to AC_OUTPUT looks like this:

AC_OUTPUT(Makefile src/Makefile man/Makefile X/Imakefile)

You can override an input file name by appending to file a colon-separated list of input files. Examples:

AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk)
AC_OUTPUT(Makefile:templates/vars.mk:Makefile.in:templates/rules.mk)

Doing this allows you to keep your file names acceptable to MS-DOS, or to prepend and/or append boilerplate to the file.

If you pass extra-cmds, those commands will be inserted into `config.status' to be run after all its other processing. If init-cmds are given, they are inserted just before extra-cmds, with shell variable, command, and backslash substitutions performed on them in configure. You can use init-cmds to pass variables from configure to the extra-cmds. If AC_OUTPUT_COMMANDS has been called, the commands given to it are run just before the commands passed to this macro.

Macro: AC_OUTPUT_COMMANDS (extra-cmds [, init-cmds])
Specify additional shell commands to run at the end of `config.status', and shell commands to initialize any variables from configure. This macro may be called multiple times. Here is an unrealistic example:

fubar=27
AC_OUTPUT_COMMANDS([echo this is extra $fubar, and so on.], fubar=$fubar)
AC_OUTPUT_COMMANDS([echo this is another, extra, bit], [echo init bit])

If you run make on subdirectories, you should run it using the make variable MAKE. Most versions of make set MAKE to the name of the make program plus any options it was given. (But many do not include in it the values of any variables set on the command line, so those are not passed on automatically.) Some old versions of make do not set this variable. The following macro allows you to use it even with those versions.

Macro: AC_PROG_MAKE_SET
If make predefines the variable MAKE, define output variable SET_MAKE to be empty. Otherwise, define SET_MAKE to contain `MAKE=make'. Calls AC_SUBST for SET_MAKE.

To use this macro, place a line like this in each `Makefile.in' that runs MAKE on other directories:

@SET_MAKE@


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