[m-dev.] proposal: runtime detection of C compiler flags
Julien Fischer
jfischer at opturion.com
Sat Oct 12 09:48:49 AEDT 2013
On Fri, 11 Oct 2013, Paul Bone wrote:
> On Fri, Oct 11, 2013 at 06:05:44PM +1100, Julien Fischer wrote:
>
>> The reason the above does not necessarily work is because we currently
>> determine nearly all (but in fact, not all) of the properties of the target C
>> compiler at configuration time and write them out into the Mercury.config file.
>> I propose that for mmc --make (and also just mmc invoked directly) C compiler
>> flags should be determined at runtime based on the values of --c-compiler-type
>> and (where necessary) --fullarch options. In particular, I am referring to the
>> values of the following options:
>>
>> --cflags-for-warnings
>> --cflags-for-optimization
>> --cflags-for-ansi
>> --cflags-for-regs
>> --cflags-for-gotos
>> --cflags-for-threads
>> --cflags-for-debug
>> --cflags-for-pic
>>
>> As a transitional measure we would only do runtime setting of these flags if
>> the values in Mercury.config were empty. Note that the double maintenance
>> problem this seems entail already exists, this change would just shift it around
>> (Actually, the existing situation is worse since we already do some runtime setting
>> of C compiler flags in compiler/compile_target_code.m as well.)
>
> How can you tell what these options are from the compiler name, type and
> fullarch? Or will this simply look up a table?
The latter.
>> Nothing I am proposing here will affect mmake or the C compiler flags used by
>> the mgnuc script (i.e. building Mercury itself won't change).
>
> When using mmc --make, is mgnuc used or is gcc called directly?
When using mmc --make, the C compiler is called directly.
...
>> Comments?
>
> This seems okay in general. Whether it is okay in practice depends on
> implementation details.
Of course, I was just seeking feedback on the overall proposal at this
stage.
Cheers,
Julien.
More information about the developers
mailing list