4 dnl If you use this macro in a package, you should
5 dnl add the following two lines to acconfig.h:
6 dnl /* Define to rpl_getgroups if the replacement function should be used. */
9 dnl Invoking code should check $GETGROUPS_LIB something like this:
11 dnl test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
14 AC_DEFUN(jm_FUNC_GETGROUPS,
15 [AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
16 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
17 AC_CHECK_FUNCS(getgroups)
19 # If we don't yet have getgroups, see if it's in -lbsd.
20 # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
21 if test $ac_cv_func_getgroups = no; then
22 jm_cv_sys_getgroups_saved_lib="$LIBS"
23 AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
24 LIBS="$jm_cv_sys_getgroups_saved_lib"
27 # Run the program to test the functionality of the system-supplied
28 # getgroups function only if there is such a function.
29 if test $ac_cv_func_getgroups = yes; then
30 AC_CACHE_CHECK([for working getgroups], jm_cv_func_working_getgroups,
35 /* On Ultrix 4.3, getgroups (0, 0) always fails. */
36 exit (getgroups (0, 0) == -1 ? 1 : 0);
39 jm_cv_func_working_getgroups=yes,
40 jm_cv_func_working_getgroups=no,
41 dnl When crosscompiling, assume getgroups is broken.
42 jm_cv_func_working_getgroups=no)
44 if test $jm_cv_func_working_getgroups = no; then
45 LIBOBJS="$LIBOBJS getgroups.o"
46 AC_DEFINE_UNQUOTED(getgroups, rpl_getgroups)