* Christian Rössel wrote on Mon, Apr 27, 2009 at 05:33:33PM CEST: > While looking at config.log I recognized that the XL compilers man page > appears several times in config.log. This is caused by the following > commands: > > configure:2925: checking for C compiler version > configure:2933: bgcc --version >&5 > configure:2944: bgcc -v >&5 > configure:2955: bgcc -V >&5 > > If you pass an unknown option, you get the entire man page. The correct > version option for XL compilers is -qversion: > > -qversion[=verbose] > Displays the official compiler product name and the > compiler version found on the system. > > verbose > Additionally displays information about the > version, release, and level of each compiler > component installed. >
Thanks. This finally gave me enough incentive to do something about this long-standing issue. OK to push this Autoconf patch and add Christian and John to THANKS? Cheers, Ralf Limit stderr logging for C compiler version. * lib/autoconf/general.m4 (_AC_RUN_LOG_LIMIT, _AC_DO_LIMIT): New internal macros, equivalent to _AC_RUN_LOG and _AC_DO, but with an optional additional argument to limit the number of lines of stderr output logged, defaulting to 10. * lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC): Use _AC_DO_LIMIT for capturing compiler version output. Also test -qversion, for the IBM xlc compiler. * lib/autoconf/fortran.m4 (_AC_PROG_FC): Likewise. * THANKS: Update. Report by Christian Rössel and John R. Cary against Libtool. diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 3fa9c04..acdda4a 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -471,9 +471,11 @@ test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) _AS_ECHO_LOG([checking for _AC_LANG compiler version]) set X $ac_compile ac_compiler=$[2] -_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) -_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) -_AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) +# Limit stderr logging to avoid copying full manpages. +_AC_DO_LIMIT([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -qversion >&AS_MESSAGE_LOG_FD]) m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl @@ -706,9 +708,10 @@ fi _AS_ECHO_LOG([checking for _AC_LANG compiler version]) set X $ac_compile ac_compiler=$[2] -_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) -_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) -_AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -qversion >&AS_MESSAGE_LOG_FD]) m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl @@ -876,9 +879,10 @@ AC_CHECK_TOOLS(OBJC, _AS_ECHO_LOG([checking for _AC_LANG compiler version]) set X $ac_compile ac_compiler=$[2] -_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) -_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) -_AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -qversion >&AS_MESSAGE_LOG_FD]) m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index f144c0e..7da74d1 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -354,9 +354,10 @@ AC_CHECK_TOOLS([]_AC_FC[], _AS_ECHO_LOG([checking for _AC_LANG compiler version]) set X $ac_compile ac_compiler=$[2] -_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) -_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) -_AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -v >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -V >&AS_MESSAGE_LOG_FD]) +_AC_DO_LIMIT([$ac_compiler -qversion >&AS_MESSAGE_LOG_FD]) rm -f a.out m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 83254ed..9eaae80 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2311,6 +2311,26 @@ AC_DEFUN([_AC_RUN_LOG_STDERR], _AS_ECHO_LOG([\$? = $ac_status]) test $ac_status = 0; }]) + +# _AC_RUN_LOG_LIMIT(COMMAND, LOG-COMMANDS, [LINES]) +# ------------------------------------------------- +# Like _AC_RUN_LOG, but only log LINES lines from stderr, +# defaulting to 10 lines. +AC_DEFUN([_AC_RUN_LOG_LIMIT], +[{ { $2; } >&AS_MESSAGE_LOG_FD + ($1) 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed 'm4_default([$3], [10])a\ +... rest of stderr output deleted ... + m4_default([$3], [10])q' conftest.err >conftest.er1 + cat conftest.er1 >&AS_MESSAGE_LOG_FD + rm -f conftest.er1 conftest.err + fi + _AS_ECHO_LOG([\$? = $ac_status]) + test $ac_status = 0; }]) + + # _AC_DO_ECHO(COMMAND) # -------------------- # Echo COMMAND. This is designed to be used just before evaluating COMMAND. @@ -2372,6 +2392,15 @@ AC_DEFUN([_AC_DO_TOKENS], _AC_DO([$ac_try]); }]) +# _AC_DO_LIMIT(COMMAND, [LINES]) +# ------------------------------ +# Like _AC_DO, but limit the amount of stderr lines logged to LINES. +# For internal use only. +AC_DEFUN([_AC_DO_LIMIT], +[_AC_RUN_LOG_LIMIT([eval "$1"], + [_AC_DO_ECHO([$1])], [$2])]) + + # _AC_EVAL(COMMAND) # ----------------- # Eval COMMAND, save the exit status in ac_status, and log it.