Previous: , Up: Results of Tests   [Contents][Index]


7.5 Printing Messages

configure scripts need to give users running them several kinds of information. The following macros print messages in ways appropriate for each kind. The arguments to all of them get enclosed in shell double quotes, so the shell performs variable and back-quote substitution on them.

These macros are all wrappers around the echo shell command. They direct output to the appropriate file descriptor (see File Descriptor Macros). configure scripts should rarely need to run echo directly to print messages for the user. Using these macros makes it easy to change how and when each kind of message is printed; such changes need only be made to the macro definitions and all the callers change automatically.

To diagnose static issues, i.e., when autoconf is run, see Diagnostic messages from M4sugar.

Macro: AC_MSG_CHECKING (feature-description)

Notify the user that configure is checking for a particular feature. This macro prints a message that starts with ‘checking ’ and ends with ‘...’ and no newline. It must be followed by a call to AC_MSG_RESULT to print the result of the check and the newline. The feature-description should be something like ‘whether the Fortran compiler accepts C++ comments’ or ‘for _Alignof’.

This macro prints nothing if configure is run with the --quiet or --silent option.

Macro: AC_MSG_RESULT (result-description)

Notify the user of the results of a check. result-description is almost always the value of the cache variable for the check, typically ‘yes’, ‘no’, or a file name. This macro should follow a call to AC_MSG_CHECKING, and the result-description should be the completion of the message printed by the call to AC_MSG_CHECKING.

This macro prints nothing if configure is run with the --quiet or --silent option.

Macro: AC_MSG_NOTICE (message)

Deliver the message to the user. It is useful mainly to print a general description of the overall purpose of a group of feature checks, e.g.,

AC_MSG_NOTICE([checking if stack overflow is detectable])

This macro prints nothing if configure is run with the --quiet or --silent option.

Macro: AC_MSG_ERROR (error-description, [exit-status = ‘$?/1])

Notify the user of an error that prevents configure from completing. This macro prints an error message to the standard error output and exits configure with exit-status (‘$?’ by default, except that ‘0’ is converted to ‘1’). error-description should be something like ‘invalid value $HOME for \$HOME’.

The error-description should start with a lower-case letter, and “cannot” is preferred to “can’t”.

Macro: AC_MSG_FAILURE (error-description, [exit-status])

This AC_MSG_ERROR wrapper notifies the user of an error that prevents configure from completing and that additional details are provided in config.log. This is typically used when abnormal results are found during a compilation.

Macro: AC_MSG_WARN (problem-description)

Notify the configure user of a possible problem. This macro prints the message to the standard error output; configure continues running afterward, so macros that call AC_MSG_WARN should provide a default (back-up) behavior for the situations they warn about. problem-description should be something like ‘ln -s seems to make hard links’.


Previous: Caching Results, Up: Results of Tests   [Contents][Index]