Re: testing for usable C compiler - Mailing list pgsql-hackers

From Tom Lane
Subject Re: testing for usable C compiler
Date
Msg-id 15132.1062652541@sss.pgh.pa.us
Whole thread Raw
In response to Re: testing for usable C compiler  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Tom Lane writes:
>> Couldn't we just throw a prototyped function into that test program?

> The standard Autoconf prototype test is pretty involved (see
> AC_PROG_CC_STDC in /usr/local/share/autoconf/autoconf/c.m4 or whatever).

Yikes.  And that's really of zero value to us, since we already have all
that knowledge (about which CFLAGS to use per-platform) embedded in our
template files.

> Maybe you can come up with a smaller test for now that fails on the
> lame-excuse compiler on HP-UX?

It's not hard.

$ cat test.c
int test(int x)
{       return x;
}
-- cc is the "good" compiler
$ cc -c test.c
cc: "test.c", line 1: error 1705: Function prototypes are an ANSI feature.
$ cc -Ae -c test.c
$
-- /usr/ccs/bin/cc is bogus
$ /usr/ccs/bin/cc -c test.c
(Bundled) cc: "test.c", line 1: error 1705: Function prototypes are an ANSI feature.
$ /usr/ccs/bin/cc -Ae -c test.c
(Bundled) cc: warning 480: The -A option is available only with the C/ANSI C product; ignored.
(Bundled) cc: "test.c", line 1: error 1705: Function prototypes are an ANSI feature.
$

> But: What's the error message going to be?  Is "compiler does not accept
> prototypes" going to be clearer for the user than what he gets now?

For sure.  See the discussion a day or two back --- with the bundled
compiler, the first sign of trouble is that configure fails to determine
the argument types for accept().  Not very helpful :-(
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Matthew T. O'Connor"
Date:
Subject: Re: Stats Collector Error 7.4beta1 and 7.4beta2
Next
From: Tom Lane
Date:
Subject: Re: Stats Collector Error 7.4beta1 and 7.4beta2