dhcpcd-discuss

Re: [PATCH] configure: support builds using ccache

Thomas De Schampheleire

Sun Jun 22 07:24:36 2014

Hi Roy,

On Sat, Jun 21, 2014 at 5:48 PM, Roy Marples <roy@xxxxxxxxxxxx> wrote:
> Hi Thomas
>
>
> On 21/06/2014 16:21, Thomas De Schampheleire wrote:
>>
>> The configure script checks whether CC is executable by means of a check
>> 'type $CC'. However, when using ccache, CC is normally set to "ccache gcc"
>> (using the appropriate paths). Such a compound string is not recognized by
>> type, however, and thus configure bails out.
>>
>> This patch changes the check 'type $CC' with '$CC --version'. This will
>> effectively verify that $CC (the combination ccache + gcc) is executable
>> (assuming the compiler has a --version option, which should be the case
>> for
>> all compilers).
>
>
> All compilers should indeed have a --version flag, but I think a better test
> would be that it creates a working executable.
>
> I've committed this:
> http://roy.marples.name/projects/dhcpcd/ci/5f4bf91142fceac502c478886aeb5079a184bb43?sbs=0
>
> Which should work just as well. I've credited you with it as you sent in the
> initial patch, thanks!

Thanks.
Note that you can simplify that code, you do not need a temporary file for that:

if ! echo 'int main(void) {}' | ${CC} -x c -o /dev/null - 2>/dev/null; then
    ....
else
    ....
fi

Best regards,
Thomas

Follow-Ups:
Re: [PATCH] configure: support builds using ccacheRoy Marples
References:
[PATCH] configure: support builds using ccacheThomas De Schampheleire
Re: [PATCH] configure: support builds using ccacheRoy Marples
Archive administrator: postmaster@marples.name