#ifdef HAVE_NEXT
#include <sys/dir.h>
+/* NGROUPS_MAX is behind -lposix. Use the BSD version which is NGROUPS */
+#undef NGROUPS_MAX
+#define NGROUPS_MAX NGROUPS
+
/* NeXT's readdir() is BSD (struct direct) not POSIX (struct dirent) */
#define dirent direct