This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Dealing with compilers that pretend to be GCC
Write a test that checks for the existence of that machinery. I agree with the earlier comments. Checking version strings or program names is the wrong way, because you're essentially saying "if it is X then I know it can do Y" rather than directly asking the question "can it do Y". The issue with "if it is X then..." is that a rule of that form is fragile. Even if it is correct today -- which is unlikely -- it WILL be wrong tomorrow. What matters for your purposes is "can it do Y" -- does it (1) support the language features you need, and (2) does it support the GCC plugin mechanism. If the answer to both questions is yes, then your code should work, and it doesn't matter one bit whether the compiler calls itself GCC or FOOCC.
paul
-----Original Message-----
From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf Of Ludovic CourtÃs
Sent: Thursday, January 19, 2012 11:52 AM
To: Paul Eggert
Cc: gcc@gcc.gnu.org; bug-autoconf@gnu.org
Subject: Re: Dealing with compilers that pretend to be GCC
Hi Paul,
Paul Eggert <eggert@cs.ucla.edu> skribis:
> A 'configure' script is supposed to check for behavior, not identity.
> If the compiler supports the features needed, then generally speaking
> a 'configure' script shouldn't care whether the compiler is truly GCC.
Right. But how would you write feature tests that would check (1) whether the GNU C language is supported, and (2) whether GCC plug-ins are supported?
Thatâs the problem Iâm trying to solve.
Thanks,
Ludoâ.