Previous: Programming in M4sh, Up: Programming in M4

8.5 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.


The file descriptor for ‘checking for...’ messages and results. Normally this directs messages to the standard output, however when configure is run with the -q option, messages sent to AS_MESSAGE_FD are 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.


The file descriptor for messages logged to config.log. 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.


The file descriptor for the original standard input.

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.