[PATCH] winebuild: Use $CCAS to assemble if found

Charles Davis cdavis5x at gmail.com
Thu Feb 7 16:55:53 CST 2013


On Feb 3, 2013, at 9:36 PM, Alexandre Rostovtsev wrote:

> On Sun, 2013-02-03 at 20:27 -0700, Charles Davis wrote:
>> If the user doesn't set CCAS--which she doesn't the majority of the time--configure will pick up the first of {clang, gas, as} in the PATH. Are you sure that's what you want?
> 
> I had attempted to preserve the behavior that exists in wine-1.5.23 by
> default because I assumed there was some good reason for it (even though
> I could not see it). But if you agree that behavior was undesirable,
> then of course it would be better to change the order depending on the
> platform, and check for {clang, gas, as} on OSX, and {gas, as, clang} on
> other platforms.
I considered doing that, but I figured it would make the code more complicated.
> 
>> Perhaps we should just not define CCAS if the user didn't specify it. Then below, you can wrap the block you added in an #ifdef.
> 
> My patch skips the CCAS block if strlen( CCAS ) == 0, which is basically
> equivalent to what you propose.
I don't think you understand exactly what AC_CHECK_TOOLS() does. If one of {clang, gas, as} exists in the path at *configure* time (prefixed with a CHOST triple or otherwise), strlen( CCAS ) *won't* be 0, because AC_CHECK_TOOLS() will pick one up. In fact, it will *never* be zero in this instance, because even if it doesn't find one of them, it'll just use the C compiler like you told it to.

And so I ask you again, are you sure you actually want to do this? Because I think you really don't. Otherwise, I wouldn't be asking :).

I'm sorry if I wasn't perfectly clear before.
> 
>> You may recall that one of the earlier versions (later than the one that detected Clang in configure) used strstr(3) to detect Clang; I was then told not to use it. I suspect this is because some systems' strstr(3) exhibits quadratic-time behavior. I don't know if you can avoid that in this case, though. Maybe you can just grab the basename and strip off the CTARGET prefix; then you should just be able to do a strcmp(3). Or am I missing something?
> 
> Even if strstr(x,y) is quadratic in strlen(x) and strlen(y), here it is
> being called on two *constant* strings: CCAS and "clang". So the runtime
> penalty is in fact constant :)
Only if the compiler knows how to optimize strstr(3) :).
> 
> But it's probably better to avoid this penalty altogether. For example,
> by checking in configure whether CCAS is Clang or GAS, and defining an
> appropriate flag.
Go for it. Can't speak for AJ though; he has the final word on anything that goes in.

Chip

> 
> -Alexandre.
> 




More information about the wine-devel mailing list