Akim wrote:
>I'm tempted to say he is right. Why don't we just check for the exit
>status? I couldn't find good information in the ChangeLog.
I think the problem is that many compilers (including gcc) often don't give
an error if you pass them bogus flags...they just print a warning message
of some sort. So, if you just check the exit status, (1) you will get a
bogus result for the test and (2) subsequent compilations will produce
zillions of annoying error messages.
It's really a pain, because there's no good way to check whether a compiler
supports a given flag. This makes it hard e.g. to check for other flags
like advanced optimization options. (I came up against this in another
project.) The best way seems to be to check for compiler output.
Maybe you could just check for stderr output, instead of checking both
stdout and stderr? But I don't know if compilers reliably send warning
messages of this sort to stderr, as they should. (Sigh...)
>But even if we don't change the logic, the technology is dead wrong.
>It should be
> if ${CC-cc} -g ... 2&>1 | grep . >/dev/null; then
I don't understand why this is better; could you explain? I can
understanding changing it to
if test "x`${CC-cc} -g ... 2&>1`" = "x"; then
to guard against test getting confused by cc output beginning with "-".
Steven