diff options
author | Zack Weinberg <zackw@panix.com> | 2023-04-02 15:07:58 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2023-04-02 23:01:49 -0400 |
commit | b5891a57b586ef6ff78bb752d62915b78cd58d7e (patch) | |
tree | b71854477d6c54aa7ed290987b4248e5314ea445 /tests | |
parent | daaca7f74f94d6a7a51d571156d5fbaba5ef9a87 (diff) | |
download | autoconf-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 'tests')
-rw-r--r-- | tests/local.at | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/local.at b/tests/local.at index 64a9fb26..db49f84a 100644 --- a/tests/local.at +++ b/tests/local.at @@ -401,7 +401,7 @@ if test -f state-env.before && test -f state-env.after; then [interpval|PATH_SEPARATOR], [GFC|F77_DUMMY_MAIN|f77_(case|underscore)], [FC(_DUMMY_MAIN|FLAGS|LIBS|FLAGS_[fF]|_MODEXT|_MODINC|_MODOUT|_DEFINE)?], - [ALLOCA|GETLOADAVG_LIBS|KMEM_GROUP|NEED_SETGID|POW_LIB], + [ALLOCA|GETGROUPS_LIB|GETLOADAVG_LIBS|KMEM_GROUP|NEED_SETGID|POW_LIB], [AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|MKDIR_P|AR|RANLIB|SET_MAKE|YACC], [EGREP_TRADITIONAL], [GREP|[EF]GREP|SED], |