On Thu, 21 Dec 2000, Bob Friesenhahn wrote:
> Support for -pthread in gcc is non-standard.  It is not supported by
> the standard GNU compiler (e.g. 2.95.2) when configured and compiled
> from distributed sources.

Supposedly, the gcc flag on Solaris is -pthreads (note the plural),
although this is equivalent to linking with -lpthread I believe.  See:

http://gcc.gnu.org/ml/gcc/2000-05/msg01141.html

(There's talk of standardizing on -pthread for gcc 3.0, although I don't
know if anything has actually been done.)

> The portable way to support POSIX threads for SunOS 5.6 and later is
> to add -D_REENTRANT to the compilation defines, and -lpthread to the
> libraries. Use of -lposix4 is optional, and is not necessarily
> required in order to use -lpthread.  See the threads(3t) manual page.

Right...ACX_PTHREAD already did this.  However, the goal for an autoconf
macro is not necessarily to come up with the most portable way of doing
something, but to come up with a list of all possible ways of doing things
on different systems and tests with which to try them.  The trick is
figure out in what order to try them...

(Currently, I try -pthread and -pthreads before linking with -lpthread, as
I figure that compiler flags give the compiler more information and may be
needed in the future, if not now.  cpp defines like -D_REENTRANT are
handled via a separate canononical-host-name check, as I couldn't think of
any more direct and reliable way to check for such things, since they
aren't required for linking and won't give a compiler error if they are
not present.)

Thanks for the info!

Steven


Reply via email to