Configure question

Martin Wilck Martin.Wilck at
Tue Nov 19 09:17:53 CST 2002

Am Die, 2002-11-19 um 15.17 schrieb Patrik Stridvall:

> One thing that you shouldn't assume is for example that
> if a function exists its reentrant variant exists as well.
Sure, got that.

> And yes, you really should use the
> reentrent variant if present as well as having an
> alternative implementation if not.

Hmm - really really always? This generates messy code, 
and a lot of effort for very rare cases.

I think we need a compromise, something in the line of either

- a) use non-reentrant functions, protecting them with a critical 
     section (IMO ok for rarely called functions) or
- b) use only reentrant and treat the case where these aren't 
     available like the case where the respective functions aren't
     available at all.

Of course b) would only be viable if a sufficiently large portion of
systems that support the non-reentrant variant support the reentrant one
as well. I have no idea whether that's the case for the getpwXYZ

> As to the implict existance question: I'm not sure.
> First of all, to answer the related question:
> Should you have a alternative implementation for 
> defined(HAVE_GETPWUID) && !defined(HAVE_GETPWNAM)?
> IMHO the answer is no. It is not worth the effort to
> support hypotetical platforms unless we can verify the
> existance of one.

Very true. Perhaps the practical way would be to assume
HAVE_GETPWUID == HAVE_GETPWNAM and see whether someone with
a really strange platform complains (but see below).

> I suggest that we should detect the presence or absence
> of ALL function we use that is verified not to exist on
> some platform and have for example code like
> #if defined(HAVE_GETPWUID) || defined(HAVE_GETPWNAM) ||
> defined(HAVE_GETPWENT)
> # if (defined(HAVE_GETPWUID) + defined(HAVE_GETPWNAM) +
> defined(HAVE_GETPWENT)) == 3
> #  define __HAVE_GETPW
> # else
> #  error All or none of the functions getpwuid, getpwnam and getpwent are
> assumed to exist
> # endif
> #endif
> in order to formalize the assumptions and generate a common define to use in
> the code.

Well I'd say that for a start we could simply do something like

/*  CAUTION: If there turns out to be some insane platform that has
 *  getpwuid() but not getpwnam() and getpwent(), this must be
 *  improved. 

This would keep bloat out of configure in the first place, while
providing a generic __HAVE_GETPW macro for possible later use.


Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at
D-33106 Paderborn 

More information about the wine-devel mailing list