Index: configure.in =================================================================== --- configure.in (revision 67686) +++ configure.in (working copy) @@ -1179,7 +1203,7 @@ AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -shadow.h signal.h stdint.h stropts.h termios.h thread.h \ +pwd.h shadow.h signal.h stdint.h stropts.h termios.h thread.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ @@ -2362,7 +2386,7 @@ AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \ clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ - getpriority getpwent getspnam getspent getsid getwd \ + getpriority getpwent getpwuid getpwnam getspnam getspent getsid getwd \ kill killpg lchmod lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ Index: Modules/pwdmodule.c =================================================================== --- Modules/pwdmodule.c (revision 67686) +++ Modules/pwdmodule.c (working copy) @@ -5,8 +5,12 @@ #include "structseq.h" #include + +#ifdef HAVE_PWD_H #include +#endif +#ifdef HAVE_GETPWUID static PyStructSequence_Field struct_pwd_type_fields[] = { {"pw_name", "user name"}, {"pw_passwd", "password"}, @@ -30,6 +34,7 @@ struct_pwd_type_fields, 7, }; +#endif PyDoc_STRVAR(pwd__doc__, "This module provides access to the Unix password database.\n\ @@ -43,6 +48,8 @@ static int initialized; + +#ifdef HAVE_GETPWUID static PyTypeObject StructPwdType; static void @@ -117,7 +124,9 @@ } return mkpwent(p); } +#endif +#ifdef HAVE_GETPWNAM PyDoc_STRVAR(pwd_getpwnam__doc__, "getpwnam(name) -> (pw_name,pw_passwd,pw_uid,\n\ pw_gid,pw_gecos,pw_dir,pw_shell)\n\ @@ -138,6 +147,7 @@ } return mkpwent(p); } +#endif #ifdef HAVE_GETPWENT PyDoc_STRVAR(pwd_getpwall__doc__, @@ -173,8 +183,12 @@ #endif static PyMethodDef pwd_methods[] = { +#ifdef HAVE_GETPWUID {"getpwuid", pwd_getpwuid, METH_VARARGS, pwd_getpwuid__doc__}, +#endif +#ifdef HAVE_GETPWNAM {"getpwnam", pwd_getpwnam, METH_VARARGS, pwd_getpwnam__doc__}, +#endif #ifdef HAVE_GETPWENT {"getpwall", (PyCFunction)pwd_getpwall, METH_NOARGS, pwd_getpwall__doc__}, @@ -203,6 +217,7 @@ if (m == NULL) return NULL; +#ifdef HAVE_GETPWUID if (!initialized) PyStructSequence_InitType(&StructPwdType, &struct_pwd_type_desc); @@ -210,6 +225,8 @@ PyModule_AddObject(m, "struct_passwd", (PyObject *) &StructPwdType); /* And for b/w compatibility (this was defined by mistake): */ PyModule_AddObject(m, "struct_pwent", (PyObject *) &StructPwdType); +#endif + initialized = 1; return m; }