>>>>> "Lars" == Lars J Aas <[EMAIL PROTECTED]> writes:
Lars> I'd like to add a few commands to config.status to be executed
Lars> before configu.status creates any files (to run mkdir to
Lars> facilitate some multi- level SUBDIRS directories). There's a
Lars> diversion that would let me do this, but since diversions are
Lars> hidden from users, are there any other ways to do it?
The cleanest way is to fix Autoconf so that it creates this dirs.
The I-don't-want-to-fix-Autoconf-cleanest-way consists in using the
ICMDS:
AC_CONFIG_COMMANDS(dummy, [], [mkdir a; mkdir a/b; mkdir a/b/c])
Akim
Taking Configuration Actions
============================
While everything is made so that you imagine `configure' does
everything by itself, there is actually a hidden slave:
`config.status'. `configure' is in charge of examining your system,
but it is `config.status' that actually takes the proper actions based
on the results of `configure'. The most typical task of
`config.status' is to _instantiate_ files.
This section describes the common behavior of the four standard
instantiating macros: `AC_CONFIG_FILES', `AC_CONFIG_HEADERS', macro
`AC_CONFIG_COMMANDS', and `AC_CONFIG_LINKS'. They all have this
prototype:
AC_CONFIG_FOOS(TAG..., [COMMANDS], [INIT-CMDS])
where the arguments are:
TAG...
A whitespace-separated list of tags, which are typically the names
of the files to instantiate.
CMDS
They are output into `config.status' as are. These commands are
always associated to a tag which the user can use to tell
`config.status' what are the commands she wants to run. These
commands are run each time a TAG request is given to
`config.status', i.e., typically each time the file `TAG' is
created.
INIT-CMDS
They are output via an _unquoted_ here-doc. As a consequence
`$var' will be output as the value of VAR. This is typically used
by `configure' to give `config,.status' some variables it needs to
run the CMDS. At the difference of CMDS, the INIT-CMDS are always
run.
All these macros can be called multiple times, with different TAGs,
of course!
Next: Configuration Links, Prev: Configuration Headers, Up: Setup
Running Arbitrary Configuration Commands
========================================
You may have to execute arbitrary commands either before, when and
after `config.status' is run. The three following macros accumulate the
commands to run when they are called multiple times.
- Macro: AC_CONFIG_COMMANDS (TAG..., [CMDS], [INIT-CMDS])
Specify additional shell commands to run at the end of
`config.status', and shell commands to initialize any variables
from `configure'. Associate the commands to the TAG. Since
typically the CMDS create a file, TAG should naturally be the name
of that file.
Here is an unrealistic example:
fubar=42
AC_CONFIG_COMMANDS(fubar,
[echo this is extra $fubar, and so on.],
[fubar=$fubar])
Here is a better one:
AC_CONFIG_COMMANDS(time-stamp, [date >time-stamp])
- Macro: AC_CONFIG_COMMANDS_PRE(CMDS)
Execute the CMDS right before creating `config.status'. A typical
use is computing values derived from variables built during the
execution of `configure':
AC_CONFIG_COMMANDS_PRE(
[LTLIBOBJS=`echo $LIBOBJS | sed 's/\.o/\.lo/g'`
AC_SUBST(LTLIBOBJS)])
- Macro: AC_CONFIG_COMMANDS_POST(CMDS)
Execute the CMDS right after creating `config.status'.
The former interface to execute arbitrary commands is described
below.
- 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. It is
obsolete, replaced by `AC_CONFIG_COMMANDS'.
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])
Aside from the fact that `AC_CONFIG_COMMANDS' requires an additional
key, an important difference is that `AC_OUTPUT_COMMANDS' is quoting
its arguments twice, while `AC_CONFIG_COMMANDS'. This means that
`AC_CONFIG_COMMANDS' can safely be given macro calls as arguments:
AC_CONFIG_COMMANDS(foo, [my_FOO()])
conversely, where one level of quoting was enough for literal strings
with `AC_OUTPUT_COMMANDS', you need two with `AC_CONFIG_COMMANDS'. The
following lines are equivalent:
AC_OUTPUT_COMMANDS([echo "Square brackets: []"])
AC_CONFIG_COMMANDS(default, [[echo "Square brackets: []"]])