I don't have _POSIX_REENTRANT_FUNCTIONS (need help with libX11)

"Jeremy C. Reed" <[email protected]> Mon, 9 Feb 2004 15:57:30 -0800 (PST)
Newsgroups gmane.comp.freedesktop.xlibs.general
Message-ID <[email protected]>
Building libX11 for me does:

 cc -DHAVE_CONFIG_H -I.
-I/tmp/pkgsrc/wip/libX11/work.bigfour/.buildlink/include -include config.h
-I../include -I../include/X11 -Wall -Wpointer-arith -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs
-fno-strict-aliasing
-I/tmp/pkgsrc/wip/libX11/work.bigfour/.buildlink/include/X11/Xtrans
 -DXTHREADS -DXUSE_MTSAFE_API -DX11_DATADIR=\"/usr/pkg/share/X11\" -O2 -c
GetDflt.c -Wp,-MD,.deps/GetDflt.TPlo  -fPIC -DPIC -o .libs/GetDflt.o
GetDflt.c: In function `GetHomeDir':
GetDflt.c:129: warning: implicit declaration of function `getpwnam_r'
GetDflt.c:131: warning: implicit declaration of function `getpwuid_r'

Any suggestions on the best way to get this built with threads but
not with _POSIX_REENTRANT_FUNCTIONS.

I think GetDflt.* is the only part needing this.

My problem later is when building gtk+ (version 1.2.10). The configure
fails with:
/usr/pkg/lib/libX11.so.6: undefined reference to `getpwuid_r'
/usr/pkg/lib/libX11.so.6: undefined reference to `getpwnam_r'
(even when linked with -lpthread).

This is under NetBSD 1.6.2 (upcoming) which is using pth software for
pthreads support. It is not included in libc by default.

I don't know where _POSIX_REENTRANT_FUNCTIONS is defined. I see it used in
xproto's include/X11/Xos_r.h.

What is the correct way to detect and only use if available?

(I never noticed before, probably because was using glibc under Linux for
my libX11 work.)

Thank you,

   Jeremy C. Reed
   http://bsd.isp-faq.com/