Hi!
When configure checks if the compiler groks -g, it runs first
with -g and then without. MSVC (aka cl) only warns (on stderr)
about this unknown -g option, and does not return a non-zero
exit status. The -g test is rigged for this scenario, but there
is a quirk that the test does not cater for; MSVC always outputs
its boilerplate logo on stderr. This foils the test, as it does
not compare the stderr output from the two runs.
But instead of changing the test to actually compare the output
from the two runs, this patch carefully cuts out anything that
matches the logo closely enough.
The logo of my version of MSVC is:
----8<----
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
----8<----
Which I match with (in some quasi-regexp notation)
----8<----
Microsoft.*Optimizing Compiler.*
Copyright.*Microsoft Corporation.*
.\{0,1\}
----8<----
(but only if it matches the first three lines in stderr)
I don't know why I have to have the ".\{0,1\}" part of the regexp,
but I suspect that it has something to do with newline conversion
in MSYS. The 3rd line is empty, so that part should be empty
(which is why I wrote ".\{0,1\}" instead of "." in order to cope
in the event of the presumed bug eventually being fixed).
Note, you can work around this problem with the current test with
CC="cl -NOLOGO", but why require that?
Cheers,
Peter
>From be12e08a6267cba8309f0d66c14d835407b54551 Mon Sep 17 00:00:00 2001
From: Peter Rosin <[email protected]>
Date: Mon, 16 Aug 2010 19:48:40 +0200
Subject: [PATCH] Ignore boilerplate logo from MSVC on stderr.
* lib/autoconf/general.m4 (_AC_RUN_LOG_STDERR): Unless you pass
the -NOLOGO option to MSVC, it will always output a boilerplate
logo on stderr. This foils the -g check, since it sees stderr
output both with and without -g and assumes -g is not the cause.
So, carefully cut out the boilerplate logo from stderr.
Signed-off-by: Peter Rosin <[email protected]>
---
ChangeLog | 9 +++++++++
lib/autoconf/general.m4 | 5 ++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 356d78f..11187ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-16 Peter Rosin <[email protected]>
+
+ Ignore boilerplate logo from MSVC on stderr.
+ * lib/autoconf/general.m4 (_AC_RUN_LOG_STDERR): Unless you pass
+ the -NOLOGO option to MSVC, it will always output a boilerplate
+ logo on stderr. This foils the -g check, since it sees stderr
+ output both with and without -g and assumes -g is not the cause.
+ So, carefully cut out the boilerplate logo from stderr.
+
2010-08-14 Eric Blake <[email protected]>
AC_INIT: allow bugreport to contain '?'
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 99cc326..d4a42ba 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2305,7 +2305,10 @@ AC_DEFUN([_AC_RUN_LOG_STDERR],
($1) 2>conftest.err
ac_status=$?
if test -s conftest.err; then
- grep -v '^ *+' conftest.err >conftest.er1
+ sed -e '/^ *+/d
+ 1N;2N
+ /Microsoft.*Optimizing Compiler.*\nCopyright.*Microsoft
Corporation.*\n.\{0,1\}$/d' \
+ conftest.err >conftest.er1
cat conftest.er1 >&AS_MESSAGE_LOG_FD
mv -f conftest.er1 conftest.err
fi
--
1.6.4.2