Re: Fixing -pthreads (Re: ports and -current)

From: Daniel Eischen <eischen_at_vigrid.com>
Date: Wed, 24 Sep 2003 17:29:07 -0400 (EDT)
On Wed, 24 Sep 2003, Daniel Eischen wrote:

> On Wed, 24 Sep 2003, Michael Edenfield wrote:
> 
> > * Ian Dowse <iedowse_at_maths.tcd.ie> [030924 12:03]:
> > > In message <Pine.GSO.4.10.10309241029001.26896-100000_at_pcnet5.pcnet.com>, Daniel
> > >  Eischen writes:
> > > >On Wed, 24 Sep 2003, Scott Long wrote:
> > > >> PTHREAD_LIBS is a great tool for the /usr/ports mechanism, but doesn't
> > > >> mean anything outside of that.
> > > >
> > > >That just meant it makes it easier to maintain ports so that
> > > >they are PTHREAD_LIBS compliant (they would break when linked).
> > > >I know it has no bearing on 3rd party stuff.
> > > 
> > > Just to throw one further approach out on the table, below is a
> > > patch that makes gcc read from a file to determine what library to
> > > associate with the -pthread flag. It's a hack of course, and probably
> > > neither correct or optimal. If you want to make -pthread mean libkse,
> > > create an /etc/pthread.libs that looks like:
> > 
> > I was looking through gcc last night to see how conceptually difficult
> > it would be to do something like this.  But instead of a file, I was
> > thinking of this process:
> > 
> > * if env("PTHREADS_LIBS") then LDFLAGS += PTHREADS_LIBS
> > * elseif fileexists("libpthread") then LDFLAGS += -lpthread
> > * elseif fileexists("libthr") then LDFLAGS += -lthr
> > * elseif fileexists("libc_r") then LDFLAGS += -lc_r
> > * else error("Threading not supported.")
> 
> Out of all the suggestions (aside from making -pthread a NOOP),
> this is my favorite one.  I would also make -pthread a NOOP
> when building shared && dynamic.

I didn't think of it, but something like this also lets
me set PTHREAD_LIBS to "" which would effectively become
a NOOP.

-- 
Dan Eischen
Received on Wed Sep 24 2003 - 12:29:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:23 UTC