From owner-freebsd-current@FreeBSD.ORG Wed Sep 24 13:39:55 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BA5516A4B3; Wed, 24 Sep 2003 13:39:55 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id A54CB43FF3; Wed, 24 Sep 2003 13:39:54 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id h8OKdrgG014261; Wed, 24 Sep 2003 16:39:53 -0400 (EDT) Date: Wed, 24 Sep 2003 16:39:53 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Michael Edenfield In-Reply-To: <20030924171949.GA90989@wombat.localnet> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Ian Dowse cc: Doug Barton cc: Freebsd Current Subject: Re: Fixing -pthreads (Re: ports and -current) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2003 20:39:55 -0000 On Wed, 24 Sep 2003, Michael Edenfield wrote: > * Ian Dowse [030924 12:03]: > > In message , 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 plan on changing thread library compatibility for FreeBSD 6.0, though. So it might be wise just to add a different compiler switch for libthr or libc_r. -- Dan Eischen