Subj : Re: Where to download a pthread library To : comp.programming.threads From : Marcin 'Qrczak' Kowalczyk Date : Wed Mar 30 2005 12:13 am "David Schwartz" writes: > The '-lpthread' flag is not a convention or standard at all. Many > platforms require more than just linking in an additional library, they need > compiler flags (like -D_REENTRANT) as well. The standard is '-pthread' to do > whatever is needed for both the compiler and linker to support pthreads. > FreeBSD was very slow to adopt this standard due to some confusion. > > You should look it up in your documentation. What should a portable program do? Let's say it want to use pthreads if they are supported, but it will work without them too (with less functionality). Here is what I currently do: AC_CHECK_HEADERS([pthread.h], [ AC_CHECK_LIB(pthread, pthread_create, [ KO_HAVE_PTHREADS=yes KO_PTHREAD_LINK=-lpthread ]) ]) How this can be improved? Should I define _REENTRANT? Should I look in another library too? If pthread functions are stubs which do nothing or throw errors (I've heard some systems provide such versions if no additional thread library is linked), I want to treat this case as if pthreads were not available. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ .