> On Monday 19 March 2007 11:56, Andy Dougherty wrote:
> 
> > The only way to tell for sure if you have a working compiler is to try to
> > compile and run something.  After the user has been prompted for all the
> > flags, simply try to compile and run a simple test program.  If it works,
> > fine.  If it doesn't, then complain with an informative error message. (It
> > may be appropriate to skip the 'run' step in a cross-compilation
> > environment and hope that the user got the flags right if the compilation
> > succeeds.)

On Mon, 19 Mar 2007, chromatic wrote:
> 
> What's the minimally-useful, cross-platform way to compile, link, and run:
> 
>       int main() {
>               return 0;
>       }
> 
> I'm happy to make the change, but I spent the weekend struggling to figure 
> out 
> how MSVC handles shared libraries, and I'm no longer sure that the easy 
> approach is that easy.

You can probably get by with whatever scheme is currently used to compile, 
link, and run all the other tests in Configure, such as those to determine 
sizeof(opcode_t) and the like.  Perl 5's Configure uses the following 
program:

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

The program includes output, and Configure tests for that output, because 
we ran into cases where the program would compile, run, return a 'success' 
exit value, but wouldn't actually print anything.  The underlying problem 
turned out to be a bug in SFIO's "iffe" configuration script (dealing with 
_exit vs. exit, and the flushing of output buffers).  So our "sanity" test 
was expanded to include testing whether or not the program actually 
printed what it was supposed to print.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to