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
- From: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- To: Ludovic CourtÃs <ludovic dot courtes at inria dot fr>
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>, gcc at gcc dot gnu dot org, bug-autoconf at gnu dot org
- Date: Fri, 20 Jan 2012 00:15:00 +0000
- Subject: Re: Dealing with compilers that pretend to be GCC
- References: <87hazrzs5r.fsf@inria.fr> <4F183CBE.5070801@cs.ucla.edu> <877h0nws89.fsf@inria.fr>
On 19/01/2012 16:51, Ludovic CourtÃs wrote:
> Right. But how would you write feature tests that would check (1)
> whether the GNU C language is supported,
Try and compile a conftest that uses it. If you wanted a possibly
over-engineered solution, write one conftest for each feature of GNU C that
you might want to use; otherwise maybe just write one conftest that uses as
many different features as you can think of.
> and (2) whether GCC plug-ins are supported?
Write a conftest that actually compiles a minimal basic gcc plugin, attempts
to invoke the compiler with it, and looks for it to output "Hello world" or
whatever. That could be tricky because I guess you won't be able to use
libtool at configure time. Maybe you could just try invoking the compiler
with the right options to load the lto-plugin, check that that works, then
invoke it with a -plugin option pointing to a non-existent file name and make
sure that that fails, just to be sure that the compiler is actually using the
option flag and not just ignoring it.
cheers,
DaveK