dnl Check for "struct ucred"
AC_MSG_CHECKING("struct ucred")
AC_EGREP_HEADER([struct ucred], [sys/socket.h], have_ucred=yes)
if test "$have_ucred" = "yes"; then
    AC_DEFINE(HAVE_STRUCT_UCRED, 1, [Define if you have the struct ucred])
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi

dnl Check for the group "nogroup" or "nobody" Use -2 otherwise.
AC_MSG_CHECKING(nogroup)
AC_TRY_RUN([
    #include <grp.h>
    #include <sys/types.h>

    int main() 
    {
	struct group *grp = getgrnam("nogroup");
	if (grp) return 0;
	return 1;
    }
], nogroup=nogroup, 
AC_TRY_RUN([
    #include <grp.h>
    #include <sys/types.h>

    int main() 
    {
	struct group *grp = getgrnam("nobody");
	if (grp) return 0;
	return 1;
    }
], nogroup=nobody, 
nogroup=65534, nogroup=65534), nogroup=65534)
AC_MSG_RESULT($nogroup)
AC_SUBST(nogroup)
AC_CHECK_FUNCS(getpeereid)
