[m-rev.] for review: add --c-compiler-type option

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jan 22 13:26:02 AEDT 2008


On Tue, 22 Jan 2008, Peter Wang wrote:

> On 2008-01-21, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>
>>  Estimated hours taken: 0.5
>>  Branches: main
>>
>>  Add a new internal option, `--c-compiler-type', that allows the type of the
>>  C
>>  compiler to be specified, e.g. gcc, lcc etc.  This information will be set
>>  by
>>  the configuration script and can be used for enabling or disabling C
>>  compiler
>>  specific optimisation flags with mmc --make.  (We have such a facility with
>>  mmake, via the mgnuc script, but not with mmc --make.)
>
> Does it?  It looks like it just guesses from the value of $CC, which
> could be done with mmc --make --cc $CC as well.

The current approach is fairly brittle with mgnuc (and pretty much
unimplemented for mmc --make - the type compiler_type/0 is defined
in compiler/compile_target_code.m but it isn't used anyway.)

Looking at $CC is not very robust, one fairly reasonable way of breaking it
is if a I symlink gcc to cc and then configure Mercury with --with-cc=cc.
(In fact doing so breaks the configuration script anyway.)

The approach I am taking here is to have the configuration script carry
out some more robust tests on what C compiler it is using and then put the
information in a more accessible place.

The other problem with just looking at the value of $CC is that we may
need to enable different flags for different versions of a compiler,
e.g. it would be useful for compiler_type/0 being extended to something like

 	:- type compiler_type
 		--->	gcc3
 		;	gcc4
 		...

Testing for the version being used is easier to do at configuration time
rather than in mgnuc.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list