summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2023-04-02 15:07:58 -0400
committerZack Weinberg <zackw@panix.com>2023-04-02 23:01:49 -0400
commitb5891a57b586ef6ff78bb752d62915b78cd58d7e (patch)
treeb71854477d6c54aa7ed290987b4248e5314ea445 /doc
parentdaaca7f74f94d6a7a51d571156d5fbaba5ef9a87 (diff)
downloadautoconf-b5891a57b586ef6ff78bb752d62915b78cd58d7e.tar.gz
Overhaul AC_TYPE_GETGROUPS and AC_FUNC_GETGROUPS.
AC_TYPE_GETGROUPS is the last remaining use of AC_EGREP_HEADER in stock Autoconf macros. It uses it only when cross compiling, as a fallback from an AC_RUN_IFELSE check, testing for a bug in system headers from the late 1980s or early 1990s, where gid_t *existed* but the second argument to getgroups needed to be an array of int, and this didn’t cause a compile error (i.e. the system headers declare getgroups with no prototype or an incorrect prototype). AC_FUNC_GETGROUPS also uses AC_RUN_IFELSE to test for obscure problems specific to long-obsolete Unixes. The downsides of AC_RUN_IFELSE and AC_EGREP_HEADER seem more severe than the chances of someone compiling a current-generation program, that uses getgroups, on an OS old enough to have one of the really nasty bugs. Accordingly, this patch changes AC_FUNC_GETGROUPS to use a host_os-based *blacklist* both in native and cross compilation. This is limited to the two host_os values for which either our old code, or Gnulib, documented a serious bug: ultrix* and nextstep*. Currently it does not try to pin down the exact version ranges subject to the bugs — that would require research by someone with access to the full history of these OSes. An incorrect guess by this blacklist can be overridden by setting ac_cv_func_getgroups_works in config.site. AC_TYPE_GETGROUPS, for its part, now does a series of regular old AC_COMPILE_IFELSE checks to probe the prototype of getgroups, and considers that good enough. While I was in there I noticed that AC_FUNC_GETGROUPS does not AC_SUBST a documented output variable, and that the name of this variable is misspelled in the manual. * lib/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Use AC_SEARCH_LIBS to probe for getgroups. Use an AC_CANONICAL_HOST-based blacklist for bug detection, not AC_RUN_IFELSE. AC_SUBST the GETGROUPS_LIB output variable. * lib/autoconf/types.m4 (AC_TYPE_GETGROUPS): Check only the prototype of getgroups, using AC_COMPILE_IFELSE; do not use either AC_RUN_IFELSE or AC_EGREP_HEADER. * doc/autoconf.texi: Update to match. Correct misspelling of GETGROUPS_LIB. * tests.local.at (_AT_CHECK_ENV): Allow GETGROUPS_LIB output variable.
Diffstat (limited to 'doc')
-rw-r--r--doc/autoconf.texi25
1 files changed, 17 insertions, 8 deletions
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 037c8055..5d5f613e 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -5257,17 +5257,26 @@ and also contains workarounds for other portability problems of
@defmac AC_FUNC_GETGROUPS
@acindex{FUNC_GETGROUPS}
@cvindex HAVE_GETGROUPS
-@ovindex GETGROUPS_LIBS
+@ovindex GETGROUPS_LIB
@c @fuindex getgroups
@prindex @code{getgroups}
@caindex func_getgroups_works
-If the @code{getgroups} function is available and works,
-define @code{HAVE_GETGROUPS}. Set @code{GETGROUPS_LIBS} to any libraries
-needed to get that function. This macro runs @code{AC_TYPE_GETGROUPS}.
-
-This macro is obsolescent. New programs need not use this macro. But
-they may want to use the Gnulib module @code{getgroups}, which provides
-workarounds to other portability problems of this function.
+Perform all the checks performed by @code{AC_TYPE_GETGROUPS}
+(@pxref{AC_TYPE_GETGROUPS}).
+Then, if the @code{getgroups} function is available
+and known to work correctly, define @code{HAVE_GETGROUPS}.
+Set the output variable @code{GETGROUPS_LIB} to any libraries
+needed to get that function.
+
+This macro relies on a list of systems with known, serious bugs in
+@code{getgroups}. If this list mis-identifies your system's
+@code{getgroups} as buggy, or as not buggy, you can override it by
+setting the cache variable @code{ac_cv_func_getgroups_works} in a
+@file{config.site} file (@pxref{Site Defaults}). Please also report the
+error to @email{bug-autoconf@@gnu.org, the Autoconf Bugs mailing list}.
+
+The Gnulib module @code{getgroups} provides workarounds for additional,
+less severe portability problems with this function.
@end defmac
@anchor{AC_FUNC_GETLOADAVG}