Index: configure.ac
===================================================================
--- configure.ac	(revision 36358)
+++ configure.ac	(working copy)
@@ -2079,6 +2081,19 @@
 AC_CHECK_FUNCS(statvfs link symlink readlink geteuid getlogin getpwnam getpwnam_r getpwuid getpwuid_r getgrgid getgrgid_r getgrnam getgrnam_r rint getopt)
 LIBS="$saved_LIBS"
 
+AC_CACHE_CHECK([for pw_gecos field in struct passwd],
+		ac_cv_have_pw_gecos_in_struct_passwd, [
+	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
+	[[ struct passwd p; p.pw_gecos = 0; ]])],
+	[ ac_cv_have_pw_gecos_in_struct_passwd="yes" ],
+	[ ac_cv_have_pw_gecos_in_struct_passwd="no" 
+	])
+])
+if test "x$ac_cv_have_pw_gecos_in_struct_passwd" = "xyes" ; then
+	AC_DEFINE([HAVE_PW_GECOS_IN_PASSWD], [1],
+		[Define if you have pw_gecos field in struct passwd])
+fi
+
 #--------------------------------------------------------------------
 # These two headers (functions) needed by Time.m
 #--------------------------------------------------------------------
Index: Headers/GNUstepBase/config.h.in
===================================================================
--- Headers/GNUstepBase/config.h.in	(revision 36358)
+++ Headers/GNUstepBase/config.h.in	(working copy)
@@ -281,6 +281,9 @@
 /* Define to 1 if you have the `getpwnam_r' function. */
 #undef HAVE_GETPWNAM_R
 
+/* Define to 1 if you have the `pw_gecos' field in struct passwd. */
+#undef HAVE_PW_GECOS_IN_PASSWD
+
 /* Define to 1 if you have the `getpwuid' function. */
 #undef HAVE_GETPWUID
 
Index: Source/NSPathUtilities.m
===================================================================
--- Source/NSPathUtilities.m	(revision 36358)
+++ Source/NSPathUtilities.m	(working copy)
@@ -1808,6 +1808,7 @@
 #else
 #ifdef  HAVE_PWD_H
 #if     defined(HAVE_GETPWNAM_R)
+#if     defined(HAVE_PW_GECOS_IN_PASSWD)
       struct passwd pw;
       struct passwd *p;
       char buf[BUFSIZ*10];
@@ -1819,8 +1820,10 @@
               userName = [NSString stringWithUTF8String: pw.pw_gecos];
 	    }
         }
+#endif /* HAVE_PW_GECOS_IN_PASSWD */
 #else
 #if     defined(HAVE_GETPWNAM)
+#if     defined(HAVE_PW_GECOS_IN_PASSWD)
       struct passwd	*pw;
 
       [gnustep_global_lock lock];
@@ -1830,6 +1833,7 @@
           userName = [NSString stringWithUTF8String: pw->pw_gecos];
         }
       [gnustep_global_lock lock];
+#endif /* HAVE_PW_GECOS_IN_PASSWD */
 #endif /* HAVE_GETPWNAM */
 #endif /* HAVE_GETPWNAM_R */
 #endif /* HAVE_PWD_H */
