summaryrefslogtreecommitdiff
path: root/m4/getgroups.m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-12-21 01:50:50 +0000
committerJim Meyering <jim@meyering.net>1996-12-21 01:50:50 +0000
commit5fc47138b1f01f5ec8d449585bd19abea4da7960 (patch)
tree9c61a5687ee886cac714ed21614b3aa44fcb656a /m4/getgroups.m4
parent4a2b289e7c27da90ba0ae5300d13eb72a048c51f (diff)
downloadcoreutils-5fc47138b1f01f5ec8d449585bd19abea4da7960.tar.xz
broken out of ../acinclude.m4
Diffstat (limited to 'm4/getgroups.m4')
-rw-r--r--m4/getgroups.m431
1 files changed, 31 insertions, 0 deletions
diff --git a/m4/getgroups.m4 b/m4/getgroups.m4
new file mode 100644
index 000000000..7b9416226
--- /dev/null
+++ b/m4/getgroups.m4
@@ -0,0 +1,31 @@
+#serial 1
+
+dnl From Jim Meyering.
+dnl If you use this macro in a package, you should
+dnl add the following two lines to acconfig.h:
+dnl /* Define to rpl_getgroups if the replacement function should be used. */
+dnl #undef getgroups
+dnl
+
+AC_DEFUN(jm_FUNC_GETGROUPS,
+[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_CACHE_CHECK([for working getgroups], jm_cv_func_working_getgroups,
+ [AC_TRY_RUN([
+ int
+ main ()
+ {
+ /* On Ultrix 4.3, getgroups (0, 0) always fails. */
+ exit (getgroups (0, 0) == -1 ? 1 : 0);
+ }
+ ],
+ jm_cv_func_working_getgroups=yes,
+ jm_cv_func_working_getgroups=no,
+ dnl When crosscompiling, assume getgroups is broken.
+ jm_cv_func_working_getgroups=no)
+ ])
+ if test $jm_cv_func_working_getgroups = no; then
+ LIBOBJS="$LIBOBJS getgroups.o"
+ AC_DEFINE_UNQUOTED(getgroups, rpl_getgroups)
+ fi
+])