[Macro Index Page] [Download M4 Source]

peti_silent_mode

Synopsis

PETI_SILENT_MODE(on)
PETI_SILENT_MODE(off)

Description

Some macros provided by Autoconf do automatically write to the console, like AC_CHECK_LIB for example. This may be undesirable when these routines are called within a complex macro, which consists of several consecutive tests.

To remedy this, PETI_SILENT_MODE provides a mechanism to turn Autoconf's console output off temporarily. All console output within configure scripts is written to file descriptor 6, which is a copy of the standard output channel. By setting this file descriptor to /dev/null (or back to standard output), silent mode can be enabled or disabled.

PETI_SILENT_MODE(on)    dnl be silent
AC_PROG_CXX
PETI_SILENT_MODE(off)   dnl talk to me again
AC_PROG_RANLIB

This macro was proposed and inspired by Paolo Bonzini.

Version

1.8 (last modified: 2003-01-15)

Author

Peter Simons

M4 Source Code

AC_DEFUN([PETI_SILENT_MODE],
    [
    case "$1" in
      on)
        exec 6>/dev/null
        ;;
      off)
        exec 6>&1
        ;;
      *)
        AC_MSG_ERROR(Silent mode can only be switched "on" or "off".)
        ;;
    esac
    ])

Copyright

GNU General Public License with this special exception.