automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiling different files with different C compilers


From: Miles Bader
Subject: Re: compiling different files with different C compilers
Date: Fri, 08 Jun 2012 13:22:05 +0900

NightStrike <address@hidden> writes:
>> suppose that my program is composed of 2 files f1.c and f2.c. f1.c is
>> written in C89 and f2.c in C99. I would like that f1.c is compiled
>> with a C89 compiler  and f2.c is compiled with a C99 compiler.
>>
>> How can I achieve that in Makefile.am ?
>>
>> Also, in configure.ac, which macro should I use ?  AC_PROG_CC ?
>> AC_PROG_CC_C99 ?
>
> Can you just pass different CFLAGS, -std=c89, -std=c99?

Of course, that sort of just shifts the focus; one still needs to
figure out:

(1) How to ensure the compiler accepts those particular flags; writing
    an autoconf macro to test whether the compiler _accepts_ the
    options, is easy enough, but what does one do when it doesn't...?
    Give up and tell the user to figure it out himself?

(2) How to specify file-specific compiler flags -- something which
    automake is not so good at... the easiest way is to put files
    needing special treatment in their own library, but of course
    that's a bit clumsy (and even then, there are slightly annoying
    artifacts, like the "library-" object-file prefix automake adds
    when using library-specific flags).

-miles

-- 
Suburbia: where they tear out the trees and then name streets after them.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]