This patchset removes all remaining internal uses of AC_EGREP_CPP and
AC_EGREP_HEADER. (See the bottom of
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/html_node/Running-the-Preprocessor.html
for why this is desirable.)
Many of the modified tests are obsolete in some way and I tried to push
them farther down the road to removal, while also striving not to break
existing configure scripts.
See individual patches for notes. Testing would be appreciated,
especially on older and weirder OSes; the complete patchset is available
from the 'zack/no-internal-egrep-cpp' branch on savannah
<https://git.savannah.gnu.org/cgit/autoconf.git/log/?h=zack/no-internal-egrep-cpp>
.
zw
From a7dc6d83c7d12b8409c512c3c10ad29f01e6c164 Mon Sep 17 00:00:00 2001
From: Zack Weinberg <za...@panix.com>
Date: Sun, 2 Apr 2023 21:54:31 -0400
Subject: [PATCH 3/4] Fold AC_C_STRINGIZE into AC_PROG_CC.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Another of the last few uses of AC_EGREP_CPP is to check for the ISO C
âstringificationâ operator. As this is a feature of C89, letâs fold
the test into the extensive C89 tests we already have, and make
AC_C_STRINGIZE just lean on AC_PROG_CC, in the same way
AC_C_PROTOTYPES does.
* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Add test of preprocessor
stringification and token pasting.
(AC_C_STRINGIZE): Just check ac_prog_cc_stdc.
---
lib/autoconf/c.m4 | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 33648b5b..c8c6a665 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -1143,6 +1143,21 @@ static char *f (char * (*g) (char **, int), char **p, ...)
return s;
}
+/* C89 style stringification. */
+#define noexpand_stringify(a) #a
+const char *stringified = noexpand_stringify(arbitrary+token=sequence);
+
+/* C89 style token pasting. Exercises some of the corner cases that
+ e.g. old MSVC gets wrong, but not very hard. */
+#define noexpand_concat(a,b) a##b
+#define expand_concat(a,b) noexpand_concat(a,b)
+extern int vA;
+extern int vbee;
+#define aye A
+#define bee B
+int *pvA = &expand_concat(v,aye);
+int *pvbee = &noexpand_concat(v,bee);
+
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not \xHH hex character constants.
These do not provoke an error unfortunately, instead are silently treated
@@ -2112,16 +2127,10 @@ fi
# --------------
# Checks if '#' can be used to glue strings together at the CPP level.
# Defines HAVE_STRINGIZE if positive.
+# Obsolete - new code should assume C89 compliance.
AC_DEFUN([AC_C_STRINGIZE],
-[AC_CACHE_CHECK([for preprocessor stringizing operator],
- [ac_cv_c_stringize],
-[AC_EGREP_CPP([@%:@teststring],
- [@%:@define x(y) #y
-
-char *s = x(teststring);],
- [ac_cv_c_stringize=no],
- [ac_cv_c_stringize=yes])])
-if test $ac_cv_c_stringize = yes; then
+[AC_REQUIRE([AC_PROG_CC])
+if test "$ac_prog_cc_stdc" != no; then
AC_DEFINE(HAVE_STRINGIZE, 1,
[Define to 1 if cpp supports the ANSI @%:@ stringizing operator.])
fi
@@ -2130,8 +2139,8 @@ fi
# AC_C_PROTOTYPES
# ---------------
-# Check if the C compiler supports prototypes, included if it needs
-# options.
+# Check if the C compiler supports prototypes.
+# Obsolete - new code should assume C89 compliance.
AC_DEFUN([AC_C_PROTOTYPES],
[AC_REQUIRE([AC_PROG_CC])dnl
if test "$ac_prog_cc_stdc" != no; then
--
2.39.2
From b5891a57b586ef6ff78bb752d62915b78cd58d7e Mon Sep 17 00:00:00 2001
From: Zack Weinberg <za...@panix.com>
Date: Sun, 2 Apr 2023 15:07:58 -0400
Subject: [PATCH 2/4] Overhaul AC_TYPE_GETGROUPS and AC_FUNC_GETGROUPS.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
---
NEWS | 11 +++++
doc/autoconf.texi | 25 ++++++----
lib/autoconf/functions.m4 | 61 ++++++++++++------------
lib/autoconf/types.m4 | 97 ++++++++++++++++++++++++---------------
tests/local.at | 2 +-
5 files changed, 120 insertions(+), 76 deletions(-)
diff --git a/NEWS b/NEWS
index 53c57ff5..8e4ecc1b 100644
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,17 @@ GNU Autoconf NEWS - User visible changes.
This matters only for uses that, contrary to the documentation
and despite warnings, use m4_divert with numbered diversions.
+*** AC_FUNC_GETGROUPS and AC_TYPE_GETGROUPS no longer run test programs.
+ These macros were testing for OS bugs that we believe are at least
+ twenty years in the past. Most operating systems are now trusted to
+ provide an accurate prototype for getgroups in unistd.h, and to
+ implement it as specified in POSIX.
+
+ AC_FUNC_GETGROUPS still includes a short blacklist of OSes with
+ known, severe bugs in getgroups. It can be overridden using
+ config.site. If you encounter a mistake in this blacklist
+ please report it to bug-autoconf.
+
** New features
*** New macro AC_SYS_YEAR2038.
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}
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 655d6ba8..74512e97 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -698,47 +698,46 @@ AS_IF([test "$ac_cv_func_fseeko_ftello" = "need _LARGEFILE_SOURCE"],
# When cross-compiling, assume getgroups is broken.
AN_FUNCTION([getgroups], [AC_FUNC_GETGROUPS])
AC_DEFUN([AC_FUNC_GETGROUPS],
-[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
-AC_REQUIRE([AC_TYPE_SIZE_T])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
-AC_CHECK_FUNC(getgroups)
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
-# If we don't yet have getgroups, see if it's in -lbsd.
+# On older systems getgroups might be in -lbsd.
# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
ac_save_LIBS=$LIBS
-if test $ac_cv_func_getgroups = no; then
- AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
-fi
-
-# Run the program to test the functionality of the system-supplied
-# getgroups function only if there is such a function.
+LIBS=
+GETGROUPS_LIB=
+AC_SEARCH_LIBS([getgroups], [bsd],
+ [test "$ac_res" = "none required" || GETGROUPS_LIB="$ac_res"
+ ac_cv_func_getgroups=yes],
+ [ac_cv_func_getgroups=no])
+LIBS=$ac_save_LIBS
+AC_SUBST([GETGROUPS_LIB])
+
+# Known severe bugs in getgroups on particular systems.
+# - On Ultrix 4.3 and NextSTEP 3.2, getgroups (0, 0) is reported to
+# fail, rather than returning the number of supplementary groups as
+# it ought to. We do not know the exact range of releases affected
+# in either case.
+# We currently reject all versions of the systems with known bugs, and
+# no other systems. Please send corrections to bug-autoc...@gnu.org.
if test $ac_cv_func_getgroups = yes; then
+ # This AC_CACHE_CHECK exists so that one may override an incorrect
+ # guess by setting ac_cv_func_getgroups_works in a config.site file.
AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works,
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
- [[/* On Ultrix 4.3, getgroups (0, 0) always fails. */
- return getgroups (0, 0) == -1;]])],
- [ac_cv_func_getgroups_works=yes],
- [ac_cv_func_getgroups_works=no],
- [case "$host_os" in # ((
- # Guess yes on glibc systems.
- *-gnu*) ac_cv_func_getgroups_works="guessing yes" ;;
- # If we don't know, assume the worst.
- *) ac_cv_func_getgroups_works="guessing no" ;;
- esac])
- ])
+ [AS_CASE([$host_os],
+ [ultrix* | nextstep*],
+ [ac_cv_func_getgroups_works=no # getgroups(0,0) fails
+],
+ [ac_cv_func_getgroups_works=yes])])
else
ac_cv_func_getgroups_works=no
fi
-case "$ac_cv_func_getgroups_works" in
- *yes)
- AC_DEFINE(HAVE_GETGROUPS, 1,
- [Define to 1 if your system has a working 'getgroups' function.])
- ;;
-esac
-LIBS=$ac_save_LIBS
+if test $ac_cv_func_getgroups_works = yes; then
+ AC_DEFINE(HAVE_GETGROUPS, 1,
+ [Define to 1 if your system has a working 'getgroups' function.])
+fi
])# AC_FUNC_GETGROUPS
-
# _AC_LIBOBJ_GETLOADAVG
# ---------------------
# Set up the AC_LIBOBJ replacement of 'getloadavg'.
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index ef245613..af3872b2 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -258,44 +258,69 @@ AN_IDENTIFIER([ptrdiff_t], [AC_CHECK_TYPES])
# AC_TYPE_GETGROUPS
# -----------------
AC_DEFUN([AC_TYPE_GETGROUPS],
+dnl We now unconditionally assume that if <unistd.h> has a prototype for
+dnl getgroups, it is accurate; and that if <unistd.h> does _not_ declare
+dnl getgroups with a prototype, the second argument is an array of int.
+dnl (Older versions of Autoconf made these assumptions only when cross
+dnl compiling.) See AC_FUNC_GETGROUPS, over in functions.m4, for why
+dnl this uses AC_COMPILE_IFELSE rather than AC_LINK_IFELSE.
[AC_REQUIRE([AC_TYPE_UID_T])dnl
-AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups,
-[AC_RUN_IFELSE([AC_LANG_SOURCE(
-[[/* Thanks to Mike Rendell for this test. */
-]AC_INCLUDES_DEFAULT[
-#define NGID 256
-#undef MAX
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
-int
-main (void)
-{
- gid_t gidset[NGID];
- int i, n;
- union { gid_t gval; long int lval; } val;
-
- val.lval = -1;
- for (i = 0; i < NGID; i++)
- gidset[i] = val.gval;
- n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
- gidset);
- /* Exit non-zero if getgroups seems to require an array of ints. This
- happens when gid_t is short int but getgroups modifies an array
- of ints. */
- return n > 0 && gidset[n] != val.gval;
-}]])],
- [ac_cv_type_getgroups=gid_t],
- [ac_cv_type_getgroups=int],
- [ac_cv_type_getgroups=cross])
-if test $ac_cv_type_getgroups = cross; then
- dnl When we can't run the test program (we are cross compiling), presume
- dnl that <unistd.h> has either an accurate prototype for getgroups or none.
- dnl Old systems without prototypes probably use int.
- AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h,
- ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)
-fi])
+AC_CACHE_CHECK([type of array argument to getgroups], ac_cv_type_getgroups,
+[# If AC_TYPE_UID_T says there isn't any gid_t typedef, then we can skip
+# everything below.
+AS_IF([test $ac_cv_type_gid_t = no],
+ [ac_cv_type_getgroups=int],
+ [# Test programs below rely on strict type checking of extern declarations:
+ # 'extern int getgroups(int, int *); extern int getgroups(int, pid_t *);'
+ # is valid in C89 if and only if pid_t is a typedef for int. Unlike
+ # anything involving either an assignment or a function call, compilers
+ # tend to make this kind of type mismatch a hard error, not just an
+ # "incompatible pointer types" warning.
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[AC_INCLUDES_DEFAULT
+[extern int getgroups(int, gid_t *);]],
+[[return !(getgroups(0, 0) >= 0);]])],
+ [ac_getgroups_gidarray=yes],
+ [ac_getgroups_gidarray=no])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[AC_INCLUDES_DEFAULT
+[extern int getgroups(int, int *);]],
+[[return !(getgroups(0, 0) >= 0);]])],
+ [ac_getgroups_intarray=yes],
+ [ac_getgroups_intarray=no])
+
+ AS_CASE([int:$ac_getgroups_intarray,gid:$ac_getgroups_gidarray],
+ [int:yes,gid:no], [ac_cv_type_getgroups=int],
+ [int:no,gid:yes], [ac_cv_type_getgroups=gid_t],
+ [int:yes,gid:yes], [
+ # Both programs compiled - this means *either* that getgroups
+ # was declared with no prototype, in which case we should use int,
+ # or that it was declared prototyped but gid_t is a typedef for int,
+ # in which case we should use gid_t. Distinguish the two cases
+ # by testing if the compiler catches a blatantly incorrect function
+ # signature for getgroups.
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[AC_INCLUDES_DEFAULT
+[extern int getgroups(int, float);]],
+[[return !(getgroups(0, 0) >= 0);]])], [
+ # Compiler did not catch incorrect argument list;
+ # getgroups is unprototyped.
+ ac_cv_type_getgroups=int
+ ], [
+ # Compiler caught incorrect argument list;
+ # gid_t is a typedef for int.
+ ac_cv_type_getgroups=gid_t
+ ])
+ ], [
+ # Both programs failed to compile - this probably means getgroups
+ # wasn't declared at all. Use 'int', as this is probably a very
+ # old system where the type _would have been_ int.
+ ac_cv_type_getgroups=int
+ ])
+ ])
+])dnl AC_CACHE_CHECK
AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups,
- [Define to the type of elements in the array set by
+ [Define to the type of elements in the array argument to
'getgroups'. Usually this is either 'int' or 'gid_t'.])
])# AC_TYPE_GETGROUPS
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],
--
2.39.2
From daaca7f74f94d6a7a51d571156d5fbaba5ef9a87 Mon Sep 17 00:00:00 2001
From: Zack Weinberg <za...@panix.com>
Date: Sun, 2 Apr 2023 21:03:30 -0400
Subject: [PATCH 1/4] Make AC_PROG_GCC_TRADITIONAL a compatibility alias for
AC_PROG_CC.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This macro is one of the last remaining internal uses of AC_EGREP_CPP.
It has only ever done anything useful with GCC, and GCC dropped
support for âtraditionalâ compilation in version 3.3 (released 2003)
so I do not think it is worth trying to preserve.
* lib/autoconf/c.m4 (AC_PROG_GCC_TRADITIONAL): Make into a
compatibility alias for AC_PROG_CC, similar to AC_PROG_CC_STDC.
* lib/autoconf/general.m4 (AC_EGREP_CPP): Remove stale comment.
* doc/autoconf.texi, NEWS: Document this change.
* tests/mktests.pl: Exclude AC_PROG_GCC_TRADITIONAL from
autoupdate tests.
---
NEWS | 7 +++++++
doc/autoconf.texi | 29 ++++++++++++++---------------
lib/autoconf/c.m4 | 30 ++++++------------------------
lib/autoconf/general.m4 | 2 --
tests/mktests.pl | 2 +-
5 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/NEWS b/NEWS
index 6a106f15..53c57ff5 100644
--- a/NEWS
+++ b/NEWS
@@ -81,6 +81,13 @@ GNU Autoconf NEWS - User visible changes.
with plain apostrophes instead of the older GNU style `like this'
with grave accent and apostrophe.
+*** AC_PROG_GCC_TRADITIONAL no longer does anything.
+
+ This macro has had no useful effect since GCC dropped support for
+ traditional-mode compilation in version 3.3 (released in 2003), and
+ the systems that needed it are also long obsolete. It is now a
+ compatibility synonym for AC_PROG_CC.
+
** Notable bug fixes
*** Autoconf caches now use finer-grained timestamps.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 8db64d8b..037c8055 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -7764,20 +7764,6 @@ This macro is obsolescent, as current C compilers support prototypes.
New programs need not use this macro.
@end defmac
-@anchor{AC_PROG_GCC_TRADITIONAL}
-@defmac AC_PROG_GCC_TRADITIONAL
-@acindex{PROG_GCC_TRADITIONAL}
-@ovindex CC
-Add @option{-traditional} to output variable @code{CC} if using a
-GNU C compiler and @code{ioctl} does not work properly without
-@option{-traditional}. That usually happens when the fixed header files
-have not been installed on an old system.
-
-This macro is obsolescent, since current versions of the GNU C
-compiler fix the header files automatically when installed.
-@end defmac
-
-
@node C++ Compiler
@subsection C++ Compiler Characteristics
@@ -23986,7 +23972,8 @@ These days portable programs should use @code{waitpid}, not
@defmac AC_GCC_TRADITIONAL
@acindex{GCC_TRADITIONAL}
-Replaced by @code{AC_PROG_GCC_TRADITIONAL} (@pxref{AC_PROG_GCC_TRADITIONAL}).
+Replaced by @code{AC_PROG_GCC_TRADITIONAL} (@pxref{AC_PROG_GCC_TRADITIONAL}),
+which is itself obsolete.
@end defmac
@defmac AC_GETGROUPS_T
@@ -24369,6 +24356,18 @@ Now done by @code{AC_PROG_CC} (@pxref{AC_PROG_CC}).
Now done by @code{AC_PROG_CC} (@pxref{AC_PROG_CC}).
@end defmac
+@anchor{AC_PROG_GCC_TRADITIONAL}
+@defmac AC_PROG_GCC_TRADITIONAL
+@acindex{PROG_GCC_TRADITIONAL}
+Used to put GCC into ``traditional'' (pre-ISO C) compilation mode,
+on systems with headers that did not work correctly with a
+standard-compliant compiler. GCC has not supported traditional
+compilation in many years, and all of the systems that required this are
+long obsolete themselves. This macro is now a compatibility synonym for
+@code{AC_PROG_CC} (@pxref{AC_PROG_CC}).
+
+@end defmac
+
@defmac AC_PROGRAMS_CHECK
@acindex{PROGRAMS_CHECK}
Replaced by @code{AC_CHECK_PROGS} (@pxref{AC_CHECK_PROGS}).
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index fef6c516..33648b5b 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -551,30 +551,6 @@ fi[]dnl
])# _AC_PROG_CC_G
-# AC_PROG_GCC_TRADITIONAL
-# -----------------------
-AC_DEFUN([AC_PROG_GCC_TRADITIONAL],
-[AC_REQUIRE([AC_PROG_CC])dnl
-if test $ac_cv_c_compiler_gnu = yes; then
- AC_CACHE_CHECK(whether $CC needs -traditional,
- ac_cv_prog_gcc_traditional,
-[ ac_pattern="Autoconf.*'x'"
- AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
-Autoconf TIOCGETP],
- ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
-
- if test $ac_cv_prog_gcc_traditional = no; then
- AC_EGREP_CPP($ac_pattern, [#include <termio.h>
-Autoconf TCGETA],
- ac_cv_prog_gcc_traditional=yes)
- fi])
- if test $ac_cv_prog_gcc_traditional = yes; then
- CC="$CC -traditional"
- fi
-fi
-])# AC_PROG_GCC_TRADITIONAL
-
-
# AC_PROG_CC_C_O
# --------------
AC_DEFUN([AC_PROG_CC_C_O],
@@ -1675,6 +1651,12 @@ AU_DEFUN([AC_PROG_CC_STDC],
[$0 is obsolete; use AC_PROG_CC]
)
+# AC_PROG_GCC_TRADITIONAL
+# -----------------------
+AU_DEFUN([AC_PROG_GCC_TRADITIONAL],
+ [AC_REQUIRE([AC_PROG_CC])],
+ [$0 is obsolete; use AC_PROG_CC]
+)
# AC_C_BACKSLASH_A
# ----------------
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index ecda0a51..47d896d5 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2766,8 +2766,6 @@ AU_DEFUN([AC_TRY_CPP],
# AC_EGREP_CPP(PATTERN, PROGRAM,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# ------------------------------------------------------
-# Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must
-# come early, it is not included in AC_BEFORE checks.
AC_DEFUN([AC_EGREP_CPP],
[AC_LANG_PREPROC_REQUIRE()dnl
AC_REQUIRE([_AC_PROG_EGREP_TRADITIONAL])dnl
diff --git a/tests/mktests.pl b/tests/mktests.pl
index effed0bc..81f63586 100644
--- a/tests/mktests.pl
+++ b/tests/mktests.pl
@@ -112,7 +112,7 @@ my @ac_exclude_list = (
# Check all AU_DEFUN'ed macros with AT_CHECK_AU_MACRO, except these.
my @au_exclude_list = (
# Empty.
- qr/^AC_(C_CROSS|PROG_CC_(C[89]9|STDC))$/,
+ qr/^AC_(C_CROSS|PROG_(CC_(C[89]9|STDC)|GCC_TRADITIONAL))$/,
# Use AC_REQUIRE.
qr/^AC_(CYGWIN|MINGW32|EMXOS2)$/,
--
2.39.2
From e25dfa75e18295d28de67747b4ff9d65f65c4f06 Mon Sep 17 00:00:00 2001
From: Zack Weinberg <za...@panix.com>
Date: Sun, 2 Apr 2023 22:17:55 -0400
Subject: [PATCH 4/4] Remove the last few internal uses of AC_EGREP_CPP.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Most of the remaining uses were converted to AC_COMPILE_IFELSE.
The use in AC_FUNC_LOADAVG becomes an AC_PREPROC_IFELSE because
we canât be sure getloadavg.c can be _compiled_ at this point in
the build. The use in AC_C_VARARRAYS could be either _PREPROC_ or
_COMPILE_; we use _COMPILE_ because, _PREPROC_ is never used, then
we donât have to do the âchecking how to run the C preprocessorâ test.
* lib/autoconf/c.m4 (AC_C_VARARRAYS): Use AC_COMPILE_IFELSE instead of
AC_EGREP_CPP.
* lib/autoconf/headers.m4 (_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H)
(_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL_H): Likewise.
* lib/autoconf/functions.m4 (AC_FUNC_GETLOADAVG): Use AC_PREPROC_IFELSE
instead of AC_EGREP_CPP.
---
lib/autoconf/c.m4 | 8 ++++----
lib/autoconf/functions.m4 | 10 +++++-----
lib/autoconf/headers.m4 | 24 ++++++++++--------------
3 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index c8c6a665..b8350c33 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -2197,11 +2197,11 @@ AC_DEFUN([AC_C_VARARRAYS],
[
AC_CACHE_CHECK([for variable-length arrays],
ac_cv_c_vararrays,
- [AC_EGREP_CPP([defined],
- [#ifdef __STDC_NO_VLA__
- defined
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+[[ #ifndef __STDC_NO_VLA__
+ #error __STDC_NO_VLA__ not defined
#endif
- ],
+]])],
[ac_cv_c_vararrays='no: __STDC_NO_VLA__ is defined'],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 74512e97..499e4c02 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -842,11 +842,11 @@ AC_CHECK_FUNCS(getloadavg, [],
# Some definitions of getloadavg require that the program be installed setgid.
AC_CACHE_CHECK(whether getloadavg requires setgid,
ac_cv_func_getloadavg_setgid,
-[AC_EGREP_CPP([Yowza Am I SETGID yet],
-[#include "$srcdir/$ac_config_libobj_dir/getloadavg.c"
-#ifdef LDAV_PRIVILEGED
-Yowza Am I SETGID yet
-@%:@endif],
+[AC_PREPROC_IFELSE([AC_LANG_SOURCE(
+[[#include "$srcdir/$ac_config_libobj_dir/getloadavg.c"
+#ifndef LDAV_PRIVILEGED
+#error setgid not needed
+@%:@endif]])],
ac_cv_func_getloadavg_setgid=yes,
ac_cv_func_getloadavg_setgid=no)])
if test $ac_cv_func_getloadavg_setgid = yes; then
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 7f70e8fd..19c124cc 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -721,13 +721,11 @@ you to include it and time.h simultaneously.])
m4_define([_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
[AC_CACHE_CHECK([whether termios.h defines TIOCGWINSZ],
ac_cv_sys_tiocgwinsz_in_termios_h,
-[AC_EGREP_CPP([yes],
- [#include <sys/types.h>
-#include <termios.h>
-#ifdef TIOCGWINSZ
- yes
-#endif
-],
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+[#include <termios.h>
+const int tiocgwinsz = TIOCGWINSZ;
+]])],
ac_cv_sys_tiocgwinsz_in_termios_h=yes,
ac_cv_sys_tiocgwinsz_in_termios_h=no)])
])# _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H
@@ -738,13 +736,11 @@ m4_define([_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
m4_define([_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL],
[AC_CACHE_CHECK([whether sys/ioctl.h defines TIOCGWINSZ],
ac_cv_sys_tiocgwinsz_in_sys_ioctl_h,
-[AC_EGREP_CPP([yes],
- [#include <sys/types.h>
-#include <sys/ioctl.h>
-#ifdef TIOCGWINSZ
- yes
-#endif
-],
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+[#include <sys/ioctl.h>
+const int tiocgwinsz = TIOCGWINSZ;
+]])],
ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes,
ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no)])
])# _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL
--
2.39.2