Index: unix/tclUnixCompat.c
==================================================================
--- unix/tclUnixCompat.c
+++ unix/tclUnixCompat.c
@@ -96,17 +96,25 @@
 #undef NEED_COPYARRAY
 #undef NEED_COPYGRP
 #undef NEED_COPYHOSTENT
 #undef NEED_COPYPWD
 #undef NEED_COPYSTRING
+
+#if !defined(HAVE_GETGRNAM_R_5) && !defined(HAVE_GETGRNAM_R_4)
+#define NEED_COPYGRP 1
+static int		CopyGrp(struct group *tgtPtr, char *buf, int buflen);
+#endif
+
+#if !defined(HAVE_GETPWNAM_R_5) && !defined(HAVE_GETPWNAM_R_4)
+#define NEED_COPYPWD 1
+static int		CopyPwd(struct passwd *tgtPtr, char *buf, int buflen);
+#endif
 
 static int		CopyArray(char **src, int elsize, char *buf,
 			    int buflen);
-static int		CopyGrp(struct group *tgtPtr, char *buf, int buflen);
 static int		CopyHostent(struct hostent *tgtPtr, char *buf,
 			    int buflen);
-static int		CopyPwd(struct passwd *tgtPtr, char *buf, int buflen);
 static int		CopyString(const char *src, char *buf, int buflen);
 
 #endif
 
 #ifdef NEED_PW_CLEANER
@@ -212,11 +220,10 @@
 
 #elif defined(HAVE_GETPWNAM_R_4)
     return getpwnam_r(name, &tsdPtr->pwd, tsdPtr->pbuf, sizeof(tsdPtr->pbuf));
 
 #else
-#define NEED_COPYPWD 1
     struct passwd *pwPtr;
 
     Tcl_MutexLock(&compatLock);
     pwPtr = getpwnam(name);
     if (pwPtr != NULL) {
@@ -293,11 +300,10 @@
 
 #elif defined(HAVE_GETPWUID_R_4)
     return getpwuid_r(uid, &tsdPtr->pwd, tsdPtr->pbuf, sizeof(tsdPtr->pbuf));
 
 #else
-#define NEED_COPYPWD 1
     struct passwd *pwPtr;
 
     Tcl_MutexLock(&compatLock);
     pwPtr = getpwuid(uid);
     if (pwPtr != NULL) {
@@ -397,11 +403,10 @@
 
 #elif defined(HAVE_GETGRNAM_R_4)
     return getgrnam_r(name, &tsdPtr->grp, tsdPtr->gbuf, sizeof(tsdPtr->gbuf));
 
 #else
-#define NEED_COPYGRP 1
     struct group *grPtr;
 
     Tcl_MutexLock(&compatLock);
     grPtr = getgrnam(name);
     if (grPtr != NULL) {
@@ -478,11 +483,10 @@
 
 #elif defined(HAVE_GETGRGID_R_4)
     return getgrgid_r(gid, &tsdPtr->grp, tsdPtr->gbuf, sizeof(tsdPtr->gbuf));
 
 #else
-#define NEED_COPYGRP 1
     struct group *grPtr;
 
     Tcl_MutexLock(&compatLock);
     grPtr = getgrgid(gid);
     if (grPtr != NULL) {

