Den 2010-11-02 20:15 skrev Ralf Wildenhues: > Hello Peter, Miles, > > * Miles Bader wrote on Tue, Nov 02, 2010 at 08:18:24AM CET: >> On Tue, Nov 2, 2010 at 4:04 PM, Peter Rosin wrote: >>> Den 2010-11-02 06:46 skrev Ralf Wildenhues: >>>> Except then you may run into MSVC which prints its command-line options >>>> (dunno whether on stdout or stderr) ... >>> >>> To expand on that tangent... >>> >>> MSVC "only" prints the options it ends up feeding to link.exe (or maybe >>> it's link.exe that prints them?) and only if the -nologo option isn't >>> specified. On stdout. Unknown options are reported on stderr (with >>> zero exit status, of course). > > Yes, it becomes more and more clear that -nologo should be added as > early as possible to the compiler flags. Yes, in general it does little good. But it is nice to see the linker options when you are experimenting and want to check if quoting is correct etc... >> [opt_ok=yes >> if test -s conftest.err; then >> for ONE_OPT in $OPT; do >> if grep -e "$ONE_OPT" conftest.err >/dev/null; then > > -e is not portable to Solaris grep. Does MSVC print options at the > beginning of the line? If not, then you could > if grep ".$ONE_OPT" ... Below is a transcript. Notice how the linker warning text is canonicalized, with -bla replaced by /bla. Also notice that *everything* about the linker is on stdout. It certainly looks like someone at MS is not caring about this at all, there's just zero coherency. First a small test file: $ echo 'int main() { return 0; }' > main.c With an unknown compiler option: $ cl -bla main.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line warning D9002 : ignoring unknown option '-bla' main.c Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. /out:main.exe main.obj $ echo $? 0 $ cl -bla main.c > /dev/null Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line warning D9002 : ignoring unknown option '-bla' With an unknown linker option as well: $ cl -bla main.c -link -bla Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line warning D9002 : ignoring unknown option '-bla' main.c Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. /out:main.exe -bla main.obj LINK : warning LNK4044: unrecognized option '/bla'; ignored $ echo $? 0 $ cl -bla main.c -link -bla > /dev/null Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. cl : Command line warning D9002 : ignoring unknown option '-bla' An unknown compiler option and -nologo: $ cl -nologo -bla main.c cl : Command line warning D9002 : ignoring unknown option '-bla' main.c $ echo $? 0 $ cl -nologo -bla main.c > /dev/null cl : Command line warning D9002 : ignoring unknown option '-bla' And adding an unknown linker option to the mix: $ cl -nologo -bla main.c -link -bla cl : Command line warning D9002 : ignoring unknown option '-bla' main.c LINK : warning LNK4044: unrecognized option '/bla'; ignored $ echo $? 0 $ cl -nologo -bla main.c -link -bla > /dev/null cl : Command line warning D9002 : ignoring unknown option '-bla' Cheers, Peter _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf