waf's CPP detection and samba use

Matthieu Patou mat at samba.org
Tue Jan 25 03:05:04 MST 2011


On 25/01/2011 12:30, Stefan (metze) Metzmacher wrote:
> Am 24.01.2011 21:52, schrieb Matthieu Patou:
>> Hello,
>>
>> A week ago or so I was talking with samjam and he was facing problems
>> with CPP as waf detected CPP to be /usr/bin/gcc on his linux computer
>> rather than /usr/bin/cpp.
>>
>> One solution to fix this is the patch I attached to this email, the very
>> good one would be to fix waf so that it returns either nothing for CPP
>> or something like CC -E but I'm not sure how we can fix the problem with
>> the version of waf that is shipped in our tree.
>>
>> Please comment.
>> diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
>> index f40066e..64d4825 100644
>> --- a/buildtools/wafsamba/samba_pidl.py
>> +++ b/buildtools/wafsamba/samba_pidl.py
>> @@ -60,7 +60,11 @@ def SAMBA_PIDL(bld, pname, source,
>>      # the cd .. is needed because pidl currently is sensitive to the directory it is run in
>>      cpp = ""
>>      cc = ""
>> -    if bld.CONFIG_SET("CPP"):
>> +    if bld.CONFIG_SET("CPP") and bld.CONFIG_SET("CPP") != bld.CONFIG_SET("CC"):
>> +        # If CC = CPP then most probably it won't work as expected so
>> +        # we won't set CPP env var to let pidl use the best solution
>> +        # most probably calling $CC -E
>> +
> I think that's wrong.
>
>>          if isinstance(bld.CONFIG_GET("CPP"), list):
>>              cpp = 'CPP="%s"' % bld.CONFIG_GET("CPP")[0]
> here's the problem, we explicitly use only the first element,
> but we should join them with whitespaces.
>
> I guess bld.CONFIG_GET("CPP")[1] would contain '-E'.
No it didn't it's just the path to gcc without -E. So as you pointed it 
of course we should take more arguments and do something like
" ".join(bld.CONFIG_GET("CPP") but so far I've never seen  waf able to 
figure out how it can replace CPP if the cpp binary is not here.
Matthieu

-- 
Matthieu Patou
Samba Team        http://samba.org
Private repo      http://git.samba.org/?p=mat/samba.git;a=summary




More information about the samba-technical mailing list