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.
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.
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 :)
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.
-Alexandre.