Previous: , Up: Programming in M4sh   [Contents][Index]

15.2.4 File Descriptor Macros

The following macros define file descriptors used to output messages (or input values) from configure scripts. For example:

echo "$wombats found" >&AS_MESSAGE_LOG_FD
echo 'Enter desired kangaroo count:' >&AS_MESSAGE_FD
read kangaroos <&AS_ORIGINAL_STDIN_FD`

However doing so is seldom needed, because Autoconf provides higher level macros as described below.

Macro: AS_MESSAGE_FD

The file descriptor for ‘checking for...’ messages and results. By default, AS_INIT sets this to ‘1’ for standalone M4sh clients. However, AC_INIT shuffles things around to another file descriptor, in order to allow the -q option of configure to choose whether messages should go to the script’s standard output or be discarded.

If you want to display some messages, consider using one of the printing macros (see Printing Messages) instead. Copies of messages output via these macros are also recorded in config.log.

Macro: AS_MESSAGE_LOG_FD

This must either be empty, or expand to a file descriptor for log messages. By default, AS_INIT sets this macro to the empty string for standalone M4sh clients, thus disabling logging. However, AC_INIT shuffles things around so that both configure and config.status use config.log for log messages. Macros that run tools, like AC_COMPILE_IFELSE (see Running the Compiler), redirect all output to this descriptor. You may want to do so if you develop such a low-level macro.

Macro: AS_ORIGINAL_STDIN_FD

This must expand to a file descriptor for the original standard input. By default, AS_INIT sets this macro to ‘0’ for standalone M4sh clients. However, AC_INIT shuffles things around for safety.

When configure runs, it may accidentally execute an interactive command that has the same name as the non-interactive meant to be used or checked. If the standard input was the terminal, such interactive programs would cause configure to stop, pending some user input. Therefore configure redirects its standard input from /dev/null during its initialization. This is not normally a problem, since configure normally does not need user input.

In the extreme case where your configure script really needs to obtain some values from the original standard input, you can read them explicitly from AS_ORIGINAL_STDIN_FD.

Previous: , Up: Programming in M4sh   [Contents][Index]