Configure question

Patrik Stridvall ps at leissner.se
Tue Nov 19 08:17:04 CST 2002


> I am thinking about some netapi32 improvements where I'd need to call 
> the functions of the getpw/getgr family: getpwnam(), getpwent(),
> getgrent(), etc.
> 
> Configure checks for the "pwd.h" header and getpwuid(). Must 
> I add more
> checks for all the functions I use, or is it ok to assume that
> getpwuid() presence implies getpwnam() presence?

Good question. I'm don't think we have any policy concerning this.
Perhaps we should have.

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

For example that fact getpwnam exists doesn't imply that
getpwnam_r exists. And yes, you really should use the
reentrent variant if present as well as having an
alternative implementation if not.

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.

To return to the original question:
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.

Comments? Suggestions?



More information about the wine-devel mailing list