www.delorie.com/gnu/docs/autoconf/autoconf_83.html   search  
 
Buy the book!


Autoconf

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.2 Setting Output Variables

Another way to record the results of tests is to set output variables, which are shell variables whose values are substituted into files that configure outputs. The two macros below create new output variables. See section 4.7.1 Preset Output Variables, for a list of output variables that are always available.

Macro: AC_SUBST (variable, [value])
Create an output variable from a shell variable. Make AC_OUTPUT substitute the variable variable into output files (typically one or more `Makefile's). This means that AC_OUTPUT will replace instances of `@variable@' in input files with the value that the shell variable variable has when AC_OUTPUT is called. This value of variable should not contain literal newlines.

If value is given, in addition assign it to variable.

Macro: AC_SUBST_FILE (variable)
Another way to create an output variable from a shell variable. Make AC_OUTPUT insert (without substitutions) the contents of the file named by shell variable variable into output files. This means that AC_OUTPUT will replace instances of `@variable@' in output files (such as `Makefile.in') with the contents of the file that the shell variable variable names when AC_OUTPUT is called. Set the variable to `/dev/null' for cases that do not have a file to insert.

This macro is useful for inserting `Makefile' fragments containing special dependencies or other make directives for particular host or target types into `Makefile's. For example, `configure.ac' could contain:

 
AC_SUBST_FILE(host_frag)
host_frag=$srcdir/conf/sun4.mh

and then a `Makefile.in' could contain:

 
@host_frag@

Running configure in varying environments can be extremely dangerous. If for instance the user runs `CC=bizarre-cc ./configure', then the cache, `config.h', and many other output files will depend upon bizarre-cc being the C compiler. If for some reason the user runs ./configure again, or if it is run via `./config.status --recheck', (See section 4.7.4 Automatic Remaking, and see section 14. Recreating a Configuration), then the configuration can be inconsistent, composed of results depending upon two different compilers.

Environment variables that affect this situation, such as `CC' above, are called precious variables, and can be declared as such by AC_ARG_VAR.

Macro: AC_ARG_VAR (variable, description)
Declare variable is a precious variable, and include its description in the variable section of `./configure --help'.

Being precious means that


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003