[OpenAFS-devel] configure not honoring 'CC' environment variable

Jeffrey Hutzelman jhutz@cmu.edu
Thu, 17 Mar 2005 18:18:10 -0500


On Thursday, March 17, 2005 10:47:49 PM +0100 Harald Barth 
<haba@pdc.kth.se> wrote:

>
>> - It is impossible for the Makefiles, or even most of the configure
>> tests, to tell the difference between a value of CC that was set on the
>>   command line and one that was set by AC_PROG_CC
>
> I thought that my solaris-cc.m4 actually checked if the CC did things
> "right" and if not it let the user override it anyway. Thus the
> save_CC in the beginnig and the CC=$save_CC at the end.
>
>> - It is a bad idea to assume that a user who sets CC on the command line
>>   "knows what they are doing" and expects to use that compiler to build
>>   the kernel module, because they probably don't know what they're doing
>>   wrt the kernel compiler issue, and if they do, they probably don't want
>>   to use that compiler for the kernel module.
>
> But to assume that /opt/SUNWspro/bin/cc is _the_ solution is not better.

It's not great, but it's better than blindly using the CC that comes out of 
configure.  I've said this twice already; I guess I need to say it again. 
You CANNOT TELL if the CC that came out of configure is one the user 
provided, or one that was selected by AC_PROG_CC.  And AC_PROG_CC defaults 
to using gcc if it is on the user's path.  So it is actually quite useless 
to use $(CC) for compiling the kernel module, ever.  It would be better to 
have a KERNEL_CC or some such, which has a reasonable default if not set by 
the user.

Also, I think your test is a little naive.  It searches for a compiler, 
takes the first one it finds, and if that's not a good enough Solaris 
compiler it falls back on $save_CC, without ever trying the other things in 
the list.  You need to try each thing in the list to see if it is good 
enough, and then take the first one that is.

-- Jeff