Re: How to detect NPTL at compile time

[email protected] (Wan-Teh Chang)
Newsgroups gmane.comp.lib.phil
Message-ID <[email protected]>
Jakub Jelinek wrote:

 > On Fri, Apr 04, 2003 at 02:51:51PM -0800, Wan-Teh Chang wrote:
[...]
 > > Can I use the glibc version number to determine
 > > that (i.e., NPTL if glibc 2.3 or higher)?
 >
 > No.
 >
 > int isnptl (void)
 > {
 >   size_t n = confstr (_CS_GNU_LIBPTHREAD_VERSION, NULL, 0);
 >   if (n > 0)
 >     {
 >       char *buf = alloca (n);
 >       confstr (_CS_GNU_LIBPTHREAD_VERSION, buf, n);
 >       if (strstr (buf, "NPTL"))
 >         return 1;
 >     }
 >   return 0;
 > }

This is really a runtime test.  So there are no macros
that I can test at compile time?

If not, I can perform this test in our configure script,
but products that aren't using autoconf will have a hard
time performing this test.  So I'd like to suggest that
some macros be added in a Red Hat Linux update for glibc
to allow for easier compile time detection.

Thank you for your help.

Wan-Teh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.