autoconf/tests
Zack Weinberg b5891a57b5
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.
2023-04-02 23:01:49 -04:00
..
data spelling fixes 2023-01-21 00:58:47 -06:00
atlocal.in make update-copyright 2023-01-20 23:41:13 -06:00
autoscan.at make update-copyright 2023-01-20 23:41:13 -06:00
autotest.at tests: avoid an unwarranted test failure 2023-03-26 22:08:02 -07:00
base.at make update-copyright 2023-01-20 23:41:13 -06:00
c.at Cater to programs misusing AC_EGREP_HEADER 2023-03-31 10:47:49 -07:00
compile.at make update-copyright 2023-01-20 23:41:13 -06:00
erlang.at make update-copyright 2023-01-20 23:41:13 -06:00
foreign.at make update-copyright 2023-01-20 23:41:13 -06:00
fortran.at make update-copyright 2023-01-20 23:41:13 -06:00
go.at make update-copyright 2023-01-20 23:41:13 -06:00
local.at Overhaul AC_TYPE_GETGROUPS and AC_FUNC_GETGROUPS. 2023-04-02 23:01:49 -04:00
local.mk make update-copyright 2023-01-20 23:41:13 -06:00
m4sh.at spelling fixes 2023-01-21 00:58:47 -06:00
m4sugar.at make update-copyright 2023-01-20 23:41:13 -06:00
mktests.pl Make AC_PROG_GCC_TRADITIONAL a compatibility alias for AC_PROG_CC. 2023-04-02 23:01:06 -04:00
semantics.at make update-copyright 2023-01-20 23:41:13 -06:00
statesave.m4 make update-copyright 2023-01-20 23:41:13 -06:00
suite.at make update-copyright 2023-01-20 23:41:13 -06:00
tools.at spelling fixes 2023-01-21 00:58:47 -06:00
torture.at make update-copyright 2023-01-20 23:41:13 -06:00
wrapper.as make update-copyright 2023-01-20 23:41:13 -06:00