The following bug has been logged on the website:
Bug reference: 7816
Logged by: Peter Seebach
Email address: seebs@seebs.net
PostgreSQL version: 9.1.4
Operating system: Linux
Description: =
Your modified acx_pthread.m4 tests for any compiler output to stderr at all,
and considers it evidence that a flag is invalid.
This test is not actually correct, although it usually works.
The reason this bit me is that I have cause to build stuff with a patched
gcc which has a check for possible licensing-related stuff (not for gcc
itself, but because gcc's in the usage path; long story), and if that fails
or can't be run, it prints a diagnostic to stderr. This is not an error, and
it does not prevent successful compilation.
But if it happens during the postgresql configure, it results in configure
deciding that -lpthread isn't available, and dying.
In general, it is Bad Mojo to assume that all messages on stderr indicate
failures. If there is an error, the compiler is expected to exit with a
non-zero exit status. If it doesn't exit non-zero, you should assume that it
worked. This is why configure doesn't normally fail tests just because there
is some message on stderr...