Commit Graph

1835 Commits

Author SHA1 Message Date
Paul Eggert
653956f446 AC_PROG_CC now tries C23 too
As C23 is now mostly supported by GCC, it's time for
AC_PROG_CC to prefer C23 if available.
* lib/autoconf/c.m4 (_AC_C_C23_TEST_GLOBALS, _AC_C_C23_TEST_MAIN):
(_AC_C_C23_TEST_PROGRAM, _AC_C_C23_OPTIONS): New macros.
(_AC_PROG_CC_STDC_EDITION): Try C23 first.
2024-04-30 10:33:37 -07:00
Paul Eggert
e9fee73dba Port better to MSVC
Problems reported by Antonin Décimo in:
https://lists.gnu.org/r/autoconf/2024-04/msg00001.html
* lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS):
Do not test the value of __STDC__.
(_AC_C_C99_TEST_MAIN): Do not test for VLAs.
(_AC_C_C11_OPTIONS): Also test -std:c11.
2024-04-30 10:33:37 -07:00
Paul Eggert
163dade069 Document ‘cp’ limitations better
* doc/autoconf.texi (Limitations of Usual Tools):
Modernize discussion of ‘cp’.
2024-02-03 21:38:30 -08:00
Paul Eggert
d8f27addf9 doc: mention join bug
* doc/autoconf.texi: Mention BSD ‘join’ bug
<https://lists.gnu.org/r/bug-gnulib/2024-01/msg00028.html>.
2024-01-10 17:46:11 -08:00
Jim Meyering
9ae8d7f61f maint: update all copyright dates via "make update-copyright" 2024-01-05 09:11:48 -08:00
Paul Eggert
3155aa6912 Tweak Annex K doc
* doc/autoconf.texi (C and Posix Variants):
Don’t insist on C11 when talking about Annex K, as
Annex K is also present in later versions of the C standard.
2023-12-01 15:31:01 -08:00
Bruno Haible
328f9b88ef INSTALL: Clarify --build, --host, --target, and the system types.
* doc/install.texi (Compilers and Options): Add another reference.
(System Types): Renamed from System Type. Explain how to canonicalize
and how to validate a system type. Don't explain --build, --host,
--target here.
(Building for a different system type): New section.
(Troubleshooting the Build Type): New section.
(Configuring a Compiler): New section.
(configure Invocation): Mention the --host option, not the --build
option, since --build is so rarely needed.
2023-06-24 14:40:25 -07:00
Paul Eggert
eaea61e448 doc: fix broken cross-refs 2023-06-20 13:39:44 -07:00
Paul Eggert
9c01837246 Tone down year-2038 changes
New macro AC_SYS_YEAR2038_RECOMMENDED replaces new macro
AC_SYS_YEAR2038_REQUIRED, and gives the builder an out of
specifying --disable-year2038.  Remove new macro
AC_SYS_LARGEFILE_REQUIRED, which was added only for symmetry and
does not seem to have a great need.
* NEWS, doc/autoconf.texi: Document this.
* lib/autoconf/specific.m4:
Be more specific about mid-January 2038 than just Jan 2038.
(_AC_SYS_YEAR2038_PROBE): Ignore IF-NOT-DETECTED arg.
If support is not detected, merely set ac_have_year2038=no instead
of erroring out.  All callers changed.
(_AC_SYS_YEAR2038_OPT_IN): Remove.  All callers removed.
(AC_SYS_YEAR2038): Simplify by requiring AC_SYS_LARGEFILE
and then testing the result.
(AC_SYS_YEAR2038_REQUIRED, AC_SYS_LARGEFILE_REQUIRED): Remove.
(AC_SYS_YEAR2038_RECOMMENDED): New macro.
(_AC_SYS_LARGEFILE_PROBE): If support is not detected, merely set
ac_have_largefile=no instead of erroring out.  All callers changed.
Take on the burden of invoking year2038 probe as needed.
(AC_SYS_LARGEFILE): Simplify.
2023-04-26 18:37:10 -07:00
Bruno Haible
e704a13c96 Document limitation of BusyBox tr.
BusyBox 1.35.0 tr, which is shipped with Alpine Linux 3.17, does not support
the POSIX [x*n] syntax.

* doc/autoconf.texi (Limitations of Usual Tools): Document limitation of 'tr'
from BusyBox.
2023-04-17 09:02:07 -07:00
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
Zack Weinberg
daaca7f74f
Make AC_PROG_GCC_TRADITIONAL a compatibility alias for AC_PROG_CC.
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.
2023-04-02 23:01:06 -04:00
Zack Weinberg
e0681c50ac
Fix ‘make syntax-check’ complaints.
* cfg.mk (local-checks-to-skip): Add sc_unportable_grep_q, which has
  too many false positives to bother with; for instance, it triggers
  on autoconf.texi’s discussion of why grep -q is unportable, and on
  the code in maint.mk that implements the check!
  (old_NEWS_hash): Update for commit b751bf4949,
  which fixed spelling errors in old NEWS.

* doc/autoconf.texi: Remove a doubled word.
* lib/autoconf/programs.m4: Remove a space immediately before a tab.
* lib/m4sugar/m4sh.m4 (_AS_IF): Rephrase documentation to avoid saying
  “if IF-FALSE” which triggers the prohibit_doubled_word check.
2023-03-12 16:59:27 -04:00
Paul Eggert
beb6d82633 doc: improve AS_IF doc
* doc/autoconf.texi: Improve documentation of AS_IF, AS_CASE, etc.
Clarify the advice about when AS_IF is needed, and follow that
advice in examples.
2023-02-06 19:28:29 -08:00
Paul Eggert
ed36e97fa4 Update doc slightly for C23. 2023-02-05 21:51:20 -08:00
Paul Eggert
a7e05c064d Improve year-2038 documentation
* NEWS, doc/autoconf.texi (System Services):
Improve documentation for behavior of largefile and year-2038 support.
Say that in the current implementation, year-2038 support
requires largefile support.  Say that year-2038 support
matters only for GNU/Linux glibc 2.34+ on 32-bit x86 and ARM.
Prefer brevity when this does not hurt understandability;
for example, prefer active to passive voice.
Prefer “wider” to “larger” when talking about the number of
bits in an integer, as this terminology is more standard.
Tone down the wording in warnings about enabling year-2038 support,
use similar wording in warnings about enabling largefile support,
and warn also about disabling largefile and year-2038 support.
No need for @emph.  Also mention rlim_t.
Be a bit more careful about saying “2 GiB” rather than “2 GB”.
Mention that a future version of Autoconf might change
AC_SYS_LARGEFILE to default to --enable-year2038, since
something has gotta happen before 2038.
Coalesce descriptions of --enable-largefile and --enable-year2038
to simplify documentation.  Mention that the only system where
AC_SYS_LARGEFILE changes CC is IRIX and that these systems
are obsolete.  Say that ‘stat’ can fail due to time_t
overflow.  Say that you can’t portably print time_t with %ld.
Say that binary compatibilty problems also can occur when one
library is linking to amother; it’s not just apps vs libraries.
Mention the possibility of modifying libraries to support both
32- and 64-bit interfaces.  Warn more consistently about
ABI compatibility issues, but put the bulk of this text
in one location that the other locations refer to.
2023-02-02 15:12:41 -08:00
Paul Eggert
b751bf4949 spelling fixes 2023-01-21 00:58:47 -06:00
Paul Eggert
cb3ad19ddf make update-copyright 2023-01-20 23:41:13 -06:00
Paul Eggert
845c3d2d7a Restore *_REQUIRED macros
As per:
https://lists.gnu.org/r/autoconf-patches/2022-12/msg00004.html
2022-12-28 23:42:37 -08:00
Paul Eggert
3f3354507b Omit just-added *_REQUIRED macros
They are not needed for Gnulib, and users have an easy way to get
their effect, so for now omit them and just document the easy way.
Also, redo documentation to make it clear that AC_YEAR_2038 is
like AC_SYS_LARGEFILE except with a different year-2038 default.
* NEWS, doc/autoconf.texi: Document the above.
* lib/autoconf/specific.m4 (AC_SYS_YEAR2038_REQUIRED):
(AC_SYS_LARGEFILE_REQUIRED): Remove.  Remove some support code.
Perhaps further simplification could be done but I quit while
I was ahead.
2022-12-25 11:04:20 -08:00
Zack Weinberg
cf09f48841 AC_SYS_LARGEFILE: Don’t enlarge time_t by default
Having AC_SYS_LARGEFILE enlarge time_t means that any program that has
already requested large file support will be abruptly migrated to
64-bit time_t (on 32-bit systems) as soon as its configure script is
regenerated with a sufficiently new Autoconf.  We’ve received reports
of several widely used programs and libraries that are not prepared
for this migration, with breakage ranging from annoying (garbage
timestamps in messages) through serious (binary compatibility break
in security-critical shared library) to catastrophic (on-disk data
corruption).

Partially revert f6657256a3: in the
absence of AC_SYS_YEAR2038, AC_SYS_LARGEFILE will now only add an
--enable-year2038 command line option to configure.  If this option is
used, time_t will be enlarged, allowing people to experiment with the
migration without needing to *edit* the configure script in question,
only regenerate it.

In the process, AC_SYS_LARGEFILE and AC_SYS_YEAR2038 were drastically
overhauled for modularity; it should now be much easier to add support
for platforms that offer large off_t / time_t but not with the standard
feature selection macros.  Also, new macros AC_SYS_LARGEFILE_REQUIRED and
AC_SYS_YEAR2038_REQUIRED can be used by programs for which large off_t /
time_t are essential.

The implementation is a little messy because it needs to gracefully
handle the case where AC_SYS_LARGEFILE and AC_SYS_LARGEFILE_REQUIRED
are both used in the same configure script — or, probably more common,
AC_SYS_LARGEFILE (which invokes _AC_SYS_YEAR2038_OPT_IN) followed by
AC_SYS_YEAR2038 — but if macro B is invoked after macro A, there’s no
way for B to change *what macro A expanded to*.  The best kludge I
managed to find is to AC_CONFIG_COMMANDS_PRE as a m4-level hook that
sets shell variables in an early diversion.

* lib/autoconf/functions.m4 (AC_FUNC_FSEEKO): Rewrite to avoid dependency
  on internal subroutines of AC_SYS_LARGEFILE.

* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_TEST_INCLUDES): Renamed to
  _AC_SYS_YEAR2038_TEST_CODE.
  (_AC_SYS_YEAR2038): Refactor into subroutines: _AC_SYS_YEAR2038_OPTIONS,
  _AC_SYS_YEAR2038_PROBE, _AC_SYS_YEAR2038_ENABLE.
  (AC_SYS_YEAR2038): Update for refactoring.
  (_AC_SYS_YEAR2038_OPT_IN): New sorta-top-level macro, for use by
  AC_SYS_LARGEFILE, that probes for large time_t only if the
  --enable-year2038 option is given.
  (AC_SYS_YEAR2038_REQUIRED): New top-level macro that insists on
  support for large time_t.

  (_AC_SYS_LARGEFILE_TEST_INCLUDES): Renamed to _AC_SYS_LARGEFILE_TEST_CODE.
  (_AC_SYS_LARGEFILE_MACRO_VALUE, AC_SYS_LARGEFILE): Refactor along same
  lines as above: _AC_SYS_LARGEFILE_OPTIONS, _AC_SYS_LARGEFILE_PROBE,
  _AC_SYS_LARGEFILE_ENABLE.  Invoke _AC_SYS_YEAR2038_OPT_IN at end of
  _AC_SYS_LARGEFILE_PROBE.  MinGW-specific logic moved to YEAR2038
  macros as it has nothing to do with large file support.
  (AC_SYS_LARGEFILE_REQUIRED): New top-level macro that insists on
  support for large off_t.

* tests/local.at (_AT_CHECK_ENV): Also allow changes in CPPFLAGS,
  enableval, enable_*, withval, with_*.

* doc/autoconf.texi, NEWS: Update documentation to match above changes.
  Fix typo in definition of @dvarv.
2022-12-25 11:04:20 -08:00
Paul Eggert
b724349cbc Document C23 <stdckdint.h> 2022-12-24 14:38:51 -08:00
Paul Eggert
8a228e9d58 Use UTF-8 and spell "François" correctly 2022-12-24 14:38:51 -08:00
Paul Eggert
28d3433229 AC_USE_SYSTEM_EXTENSIONS now enables C23 Annex F
* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
Also define __STDC_WANT_IEC_60559_EXT__, for C23.
2022-12-24 14:38:51 -08:00
Paul Eggert
6f2aadd731 Modernize and regularize doc for C89 etc.
In documentation and comments, prefer the more-common “C89” to the
equivalent “C90”, and use 2-digit years for C standards as that’s
common usage.  Remove some confusing old doc for pre-C89 systems,
as Autoconf assumes C89 or later.  Mention C17 and C23 briefly.
Improve doc for malloc, realloc.
2022-11-11 00:32:40 -08:00
Paul Eggert
3cc9b414aa Warn about TMPDIR
* doc/autoconf.texi (Initialization Macros): Warn about
setting TMPDIR, following up on this Paul Smith remark:
https://lists.gnu.org/r/autoconf/2022-10/msg00024.html
2022-10-28 15:21:45 -07:00
Paul Eggert
d081ac3ec8 MKDIR_P now falls back on mkdir -p
* lib/autoconf/programs.m4 (AC_PROG_MKDIR_P):
Fall back on mkdir -p instead of on a relative path to
install-sh, as the latter now seems to be more of a problem
than the former.
2022-10-12 12:02:31 -07:00
Paul Eggert
85c0db3433 Update M4 version numbers in documentation 2022-10-05 18:06:20 -07:00
Paul Eggert
8b5e2016c7 Port to compilers that moan about K&R func decls
* lib/autoconf/c.m4 (AC_LANG_CALL, AC_LANG_FUNC_LINK_TRY):
Use '(void)' rather than '()' in function prototypes, as the latter
provokes fatal errors in some compilers nowadays.
* lib/autoconf/functions.m4 (AC_FUNC_STRTOD):
* tests/fortran.at (AC_F77_DUMMY_MAIN usage):
* tests/semantics.at (AC_CHECK_DECLS):
Don’t use () in a function decl.
2022-09-02 12:09:32 -05:00
Paul Eggert
0a647a93cb Remove obsolete Solaris info from manual
Don't mention anything about Solaris 9 or older,
as Oracle no longer supports those old versions
and the obsolete info merely clutters the manual.
2022-08-25 14:27:02 -05:00
Paul Eggert
bc66c26f48 Improve doc for AC_SYS_LARGEFILE etc. 2022-08-18 15:20:46 -07:00
Paul Eggert
6dcecb780a Port AC_CHECK_HEADER_STDBOOL to C23
Modernize the bool documentation a bit too.
* lib/autoconf/headers.m4 (AC_CHECK_HEADER_STDBOOL):
Allow C23 too.
2022-08-13 19:39:59 -07:00
Paul Eggert
f6657256a3 AC_SYS_LARGEFILE now widens time_t if possible
This change is taken from Gnulib, and is needed for apps like GDB.
* lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_TEST_INCLUDES)
(_AC_SYS_YEAR2038, AC_SYS_YEAR2038): New macros, taken (with
renaming) from Gnulib.
(_AC_SYS_LARGEFILE_MACRO_VALUE): #undef before #define.
(AC_SYS_LARGEFILE): Prefer AS_IF and AS_CASE to doing it by hand.
Widen time_t if possible, too.  Define  __MINGW_USE_VC2005_COMPAT
early if needed.
2022-08-09 11:07:03 -07:00
Paul Eggert
e50a50c4dc basename and dirname are portable now
* doc/autoconf.texi (Limitations of Usual Tools):
basename and dirname are portable shell commands now.
2022-07-21 12:50:16 -07:00
Paul Eggert
256d85494e Improve regex documentation
* doc/autoconf.texi (Running the Preprocessor)
(Limitations of Usual Tools):
Improve comments on limitations of regular expressions.
2022-06-22 00:35:59 -05:00
Paul Eggert
ef27f692a0 make update-copyright 2022-05-19 13:57:38 -07:00
Paul Eggert
dc28f7c20b Document AC_RUN_IFELSE([], ...) etc.
* doc/autoconf.texi (Running the Preprocessor)
(Running the Compiler, Running the Linker, Runtime):
Document that the _IFELSE macros reuse an existing input file
if their input is empty.
2022-05-10 14:23:39 -07:00
Paul Eggert
cbec82b65f Clarify documentation of number format
Problem reported by Mike Frysinger in:
https://lists.gnu.org/r/autoconf-patches/2022-02/msg00007.html
2022-02-12 14:49:37 -08:00
Mike Frysinger
c48fdb8119
add new AC_PROG_AR helper
This mirrors the existing RANLIB and related toolchain macros that
autoconf already exports.  Some projects assume `ar` is available
which isn't always safe, so provide a macro that probes the full
toolchain settings.

This also makes it easier to use AC_REQUIRE with the macro instead
of duplicating the AC_CHECK_TOOL call in projects.

  * lib/autoconf/programs.m4 (AC_PROG_AR): New macro.
  * doc/autoconf.texi: Document it.
  * tests/local.at (_AT_CHECK_ENV): Allow $AR output variable.
2022-01-24 09:33:20 -05:00
Bruno Haible
b0d5d2d3eb doc: Document how to deal with missing 'join'.
* doc/autoconf.texi (Limitations of Usual Tools): Mention that 'join' is missing
in BusyBox.
2022-01-12 11:39:38 -08:00
Paul Eggert
d405fa2ec6 doc: document BusyBox sed w bug 2022-01-01 18:08:56 -08:00
Paul Eggert
407d5955f0 doc: update ‘find’ info
* doc/autoconf.texi (Limitations of Usual Tools):
Mention a few more GNU ‘find’ options that are not portable.
Modernize a bit.
2021-10-09 18:38:45 -07:00
Jim Meyering
9db4522239 fix a typo
* doc/autoconf.texi (Integer Overflow): Fix typo: s/many/may/
2021-09-01 08:50:30 +02:00
Paul Eggert
411d0c0ef5 Modernize discussion of integer overflow
* doc/autoconf.texi (Integer Overflow, Integer Overflow Basics)
(Signed Overflow Examples, Optimization and Wraparound):
Modernize discussion to take current compiler and Gnulib
technology into account.
2021-08-31 16:10:30 -07:00
Marshall Ward
6cfdc56489 Fortran Cray pointer macro support
This patch adds the AC_F77_CRAY_POINTERS and AC_FC_CRAY_POINTERS macros,
which test if the Fortran compiler supports Cray pointers.

The macros are written such that the tests share a common backend
(_AC_FC_CRAY_POINTERS) which works on both F77 and FC compilers.
Wrappers are provided to address any future potential compatibility
issues.

The macros include additional tests for particular flags required by
GFortran and PGI compilers.  The current set of flags is sparse, but can
be extended for other compilers if needed.

Documentation and a minimal test of the macro have been included.

Two minor variable name typos (@EXEEXT@ as @EEXEXT@) were also fixed in
two of the other Fortran tests.
2021-08-16 09:56:09 -07:00
Paul Eggert
64df9b4523 Autoconf now quotes 'like this' instead of `like this'
Autoconf’s diagnostics now follow current GNU coding standards,
which say that diagnostics in the C locale should quote 'like this'
with plain apostrophes instead of the older GNU style `like this'
with grave accent and apostrophe.
2021-07-20 16:04:21 -05:00
Paul Eggert
7b1b9e4650 Document unquoted here-documents better
Problem reported by Bruno Haible (sr #110518).
* doc/autoconf.texi (Generating Sources)
(Running the Preprocessor, Running the Compiler)
(Running the Linker, Runtime): Briefly mention that the program
snippets are expanded as unquoted here-documents.
(Here-Documents): Document escaping needed in unquoted
here-documents.  Remove mention of \" glitch in OpenBSD 2.7 sh;
that old system has not been supported for many years.
Remove advice that every \ must be quoted, as that sort
of quoting (though harmless) is not needed and is rarely done.
* lib/autoconf/c.m4 (AC_C_BIGENDIAN, _AC_LANG_OPENMP(Fortran 77)):
* lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT): Properly quote
code snippets.  The backslash-newline typos were harmless, and the
backslash-$ typo has unspecified behavior as per POSIX though the
typo is harmless on all shells I know of.  However, Autoconf
should follow its own quoting advice.
2021-07-18 23:55:45 -05:00
Emanuele Giaquinta
f982d9e4e1 doc: fix typo in variable name
Message-Id: <YJ4Tm3WEkv86L/YV@FSAPPLE2215.fi.f-secure.com>
(tiny change)
2021-06-30 14:59:44 -05:00
Zack Weinberg
300349c84b
make update-copyright 2021-01-28 15:19:21 -05:00
Bruno Haible
fbcc365d41
doc: Document another portability problem of 'od'.
* doc/autoconf.texi (Limitations of Usual Tools): Document that decimal output
is not portable.
2020-12-30 10:21:48 -05:00