5 dnl Invoking code should check $GETGROUPS_LIB something like this:
7 dnl test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
10 AC_DEFUN(jm_FUNC_GETGROUPS,
11 [AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
12 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
13 AC_CHECK_FUNCS(getgroups)
15 # If we don't yet have getgroups, see if it's in -lbsd.
16 # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
17 if test $ac_cv_func_getgroups = no; then
18 jm_cv_sys_getgroups_saved_lib="$LIBS"
19 AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
20 LIBS="$jm_cv_sys_getgroups_saved_lib"
23 # Run the program to test the functionality of the system-supplied
24 # getgroups function only if there is such a function.
25 if test $ac_cv_func_getgroups = yes; then
26 AC_CACHE_CHECK([for working getgroups], jm_cv_func_working_getgroups,
31 /* On Ultrix 4.3, getgroups (0, 0) always fails. */
32 exit (getgroups (0, 0) == -1 ? 1 : 0);
35 jm_cv_func_working_getgroups=yes,
36 jm_cv_func_working_getgroups=no,
37 dnl When crosscompiling, assume getgroups is broken.
38 jm_cv_func_working_getgroups=no)
40 if test $jm_cv_func_working_getgroups = no; then
42 LIBOBJS="$LIBOBJS getgroups.$ac_objext"
43 AC_DEFINE_UNQUOTED(getgroups, rpl_getgroups,
44 [Define as rpl_getgroups if getgroups doesn't work right.])