How to determine which pthread, was: Re: last libc_rdependenciesleft on current

Marco van de Voort marcov at
Wed Feb 11 07:11:09 PST 2004

> 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 decides.

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

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))

More information about the freebsd-ports mailing list