On Fri, 14 Sep 2007, James Keenan via RT wrote:

> This thread and RT ticket (41168) have been under way since Jan 03 2007
> and I'm afraid that the discussion is collapsing under its own weight. 
> May I make an attempt at summarizing the issues?  Let's proceed from the
> outermost inwards.

[skipping to the relevant issue for this ticket]

> 3.  Let's assume that we grant inter::progs more importance than other
> configuration steps.  How should the absence of a working C-compiler be
> detected and reported?

Configure should try to compile and run a simple program.  It should check 
that the program ran, produced the desired output, and returned a 
'success' exit status. If all those things don't check out, Configure 
should present a message that tells the user precisely what was attempted 
and what went wrong.  Configure should probably offer to abort at that 
point.


For comparison, here's what perl5's Configure does:

If the user specifies a non-existent C compiler (e.g. with
Configure -Dcc=NOcc) the following message is generated:

    Configure: NOcc: not found
    You need to find a working C compiler.
    Either (purchase and) install the C compiler supplied by your OS vendor,
    or for a free C compiler try http://gcc.gnu.org/
    I cannot continue any further, aborting.

That's not too specific, but doesn't appear to cause too much confusion
either.

A more common occurrence (based on the mails I get) is to have a compiler, 
but to have it not work as Configure expects for some reason or another.  
After setting all the flags and libraries, Configure performs a sanity 
check.  It tries to compile and run a simple program. It checks both the 
return value and the printed output.  (Under at least one release of the 
SFIO library, sfio's configuration script caused confusion between exit() 
and _exit() with the net result that the program compiled fine, ran, and 
exited with a return value of 0, but didn't actually print anything.  
Accordingly, perl5's Configure tests both the output and the exit status.) 
If this test fails, the following information is printed:  (here I passed 
in a bad library with   sh Configure -Dlibs=-lnosuch

    Checking your choice of C compiler and flags for coherency...
    I've tried to compile and run the following simple program:

    #include <stdio.h>
    int main() { printf("Ok\n"); return(0); }

    I used the command:

            cc -o try -O -I/usr/local/include -L/usr/ccs/lib 
-L/opt/SUNWspro/SC4.2/lib -L/usr/local/lib try.c -lnosuch
             ./try

    and I got the following output:

    ld: fatal: library -lnosuch: not found
    ld: fatal: File processing errors. No output written to try
    I can't compile the test program.
    (The supplied flags or libraries might be incorrect.)
     
    You have a BIG problem.  Shall I abort Configure [y]  
    Ok.  Stopping Configure.


This error message tells the user precisely what happened and gives enough 
information for the user to easily reproduce (and, I hope, fix) the 
problem.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to