Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 2004 16:11:07 +0100 (CET)
From:      marcov@stack.nl (Marco van de Voort)
To:        freebsd-ports@freebsd.org
Subject:   Re: How to determine which pthread, was: Re: last libc_rdependenciesleft on current
Message-ID:  <20040211151107.9CD75172@toad.stack.nl>
In-Reply-To: <20040211012314.GA44192@xor.obsecurity.org> "from Kris Kennaway at Feb 10, 2004 05:23:14 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> On Tue, Feb 10, 2004 at 11:36:25PM +0100, Marco van de Voort wrote:
> > 
> > 
> > lang/fpc-devel (and to a lesser degree lang/fpc) are not libc_r dependant
> > themselves, but generate libc_r programs when language threading is used.
> > 
> > I'll fix this in the coming weeks, but rather like to do this runtime. 
> > 
> > How can I detect (in a non C/libc program, iow without using headers or
> > libraries, so in the general FreeBSD environment), whether I should pass
> > -lc_r to the linker or -lc -lpthread ? 
> > (sysctl or uname based solutions come to mind)
> 
> Look at how bsd.port.mk decides.

.if ${OSVERSION} < 500016
PTHREAD_CFLAGS?=        -D_THREAD_SAFE
PTHREAD_LIBS?=          -pthread
.elif ${OSVERSION} < 502102
PTHREAD_CFLAGS?=        -D_THREAD_SAFE
PTHREAD_LIBS?=          -lc_r
.else
PTHREAD_CFLAGS?=
PTHREAD_LIBS?=          -lpthread
.endif

Thnx, this is doable.

What does the -D_THREAD_SAFE mean? (I mean does it mean that libc isn't
thread safe, that it is thread_safe etc etc, or does it interact with the
C code that is being compiled (the port))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040211151107.9CD75172>