summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-12-24 23:24:54 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2022-12-25 11:04:20 -0800
commit3f3354507bb9c2f1d38412cf566ff9443408023e (patch)
tree0cb45c42a1060f011f7ea4c45118ca619aa87009
parentcf09f48841b66fe76f606dd6018bb3a93242a7c9 (diff)
downloadautoconf-3f3354507bb9c2f1d38412cf566ff9443408023e.tar.gz
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.
-rw-r--r--NEWS43
-rw-r--r--doc/autoconf.texi185
-rw-r--r--lib/autoconf/specific.m465
3 files changed, 104 insertions, 189 deletions
diff --git a/NEWS b/NEWS
index d9c6ed94..5e8a7606 100644
--- a/NEWS
+++ b/NEWS
@@ -27,37 +27,18 @@ GNU Autoconf NEWS - User visible changes.
** New features
-*** New macros AC_SYS_YEAR2038 and AC_SYS_YEAR2038_REQUIRED.
- These macros attempt to enlarge time_t to 64 bits, on systems where
- it has historically been only 32 bits wide, and therefore (assuming
- the usual Unix epoch) cannot represent dates after mid-January of
- 2038 (hence the names). The difference between the two is that
- AC_SYS_YEAR2038_REQUIRED unconditionally causes 'configure' to error
- out if 64-bit time_t is not available.
-
- AC_SYS_YEAR2038 will also error out if the host system shows signs of
- supporting dates after Jan 2038 (e.g. in file timestamps) but it can’t
- figure out how to get a wider time_t; this failure can be overridden
- with the --disable-year2038 option.
-
- Library authors should be cautious about adding these macros to
- their configure scripts; they can break binary backward compatibility.
-
-*** New macro AC_SYS_LARGEFILE_REQUIRED.
- This macro is the same as the existing AC_SYS_LARGEFILE except that
- it will cause 'configure' to error out if 64-bit off_t is not available,
- and it does not provide a --disable-largefile option.
-
-*** AC_SYS_LARGEFILE now optionally arranges to enlarge time_t.
- As an experimental measure to make it easier to rebuild old programs
- with support for dates after Jan 2038, if you regenerate any configure
- script that uses AC_SYS_LARGEFILE (but not AC_SYS_YEAR2038) using
- Autoconf 2.72, it will gain an --enable-year2038 option. When the
- program is configured with this option, time_t will be enlarged if
- possible, as if AC_SYS_YEAR2038 had been used.
-
- Using this option in a library build also potentially breaks binary
- backward compatibility.
+*** AC_SYS_LARGEFILE now optionally arranges to widen time_t.
+ It now causes 'configure' to gain an --enable-year2038 option which
+ widens time_t if possible on systems where time_t by default cannot
+ represent file timestamps and other timestamps after January 2038.
+ As with off_t, ino_t, etc., if library ABIs depend on time_t width,
+ applications should be configured consistently with libraries.
+
+*** New macro AC_SYS_YEAR2038.
+ This acts like AC_SYS_LARGEFILE, except that it causes 'configure'
+ to default to --enable-year2038. In a future Autoconf version,
+ AC_SYS_LARGEFILE is planned to do this too, so the two macros will
+ become equivalent.
*** AC_USE_SYSTEM_EXTENSIONS now enables C23 Annex F extensions
by defining __STDC_WANT_IEC_60559_EXT__.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index df96280b..42fa24fe 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -8798,72 +8798,95 @@ if the system supports @samp{#!}, @samp{no} if not.
@defmac AC_SYS_LARGEFILE
@acindex{SYS_LARGEFILE}
@cvindex _FILE_OFFSET_BITS
+@cvindex _TIME_BITS
@ovindex CC
@cindex Large file support
@cindex LFS
-If the default @code{off_t} type is a 32-bit integer, and therefore
-cannot be used to work with files larger than 4 gigabytes, arrange to
-make a larger @code{off_t} available, if the system supports this.
-Several other types related to the sizes of files and file systems will
-also be enlarged: @code{ino_t}, @code{blkcnt_t}, @code{fsblkcnt_t},
-@code{fsfilcnt_t}, and possibly @code{dev_t}.
-
-If a large @code{off_t} is available (whether or not any arrangements
-were necessary), the shell variable @code{ac_have_largefile} will be set
-to @samp{yes}; if not, it will be set to @samp{no}.
-
-Preprocessor macros will be defined if necessary to make a larger
-@code{off_t} available. (For example, on many systems the macro
-@code{_FILE_OFFSET_BITS} will be defined.) Some of these macros only
-work if they are defined before the first system header is included;
-therefore, when using this macro in concert with
-@code{AC_CONFIG_HEADERS}, make sure that @file{config.h} is included
-before any system headers.
-
-On a few older systems, the output variable @code{CC} will also be
-changed to add special compiler options that are needed to enable large
-@code{off_t}.
+If the default @code{off_t} type is a 32-bit integer so
+applications can deal only with files containing less than 2 GiB,
+make a wider @code{off_t} available if the system supports this.
+This may also widen several other types related to files and file
+systems, including @code{blkcnt_t}, @code{dev_t}, @code{ino_t},
+@code{fsblkcnt_t}, and @code{fsfilcnt_t}.
+
+Also, arrange for a @command{configure} option to request widening the
+type @code{time_t} as needed to represent file timestamps and other
+timestamps after January 2038. If year-2038 support is requested but
+@command{configure} fails to find a way to enable a wide @code{time_t}
+and inspection of the system suggests that this feature is available
+somehow, @command{configure} will error out.
+
+In this version of Autoconf, the year-2038 @command{configure} option
+currently defaults to @code{--disable-year2038}. If you want the
+default to be @code{--enable-year2038}, you can use
+@code{AC_SYS_YEAR2038} instead of @code{AC_SYS_LARGEFILE}. In other
+words, packages that use @code{AC_SYS_LARGEFILE} can be made ready for
+the year 2038 either by switching to @code{AC_SYS_YEAR2038}, or by
+configuring with @option{--enable-year2038}. A future version of
+Autoconf is planned to change the @code{AC_SYS_LARGEFILE} default to
+@code{--enable-year2038}; when that happens, @code{AC_SYS_LARGEFILE} and
+@code{AC_SYS_YEAR2038} will be equivalent. @xref{AC_SYS_YEAR2038}.
+
+Set the shell variable @code{ac_have_largefile} to to @samp{yes} or
+@code{no} depending on whether a wide @code{off_t} is available,
+regardless of whether arrangements were necessary. Similarly, set the
+shell variable @code{ac_have_year2038} to @code{yes} or @code{no}
+depending on whether a wide-enough @code{time_t} is available. If your
+package requires large-file or year-2038 support, you can use code like this:
+
+@example
+AS_IF([test $ac_have_year2038 = no],
+ [AC_MSG_FAILURE([year-2038 support missing])])
+@end example
+
+Define preprocessor macros if necessary to make types wider; For
+example, on many systems the macros @code{_FILE_OFFSET_BITS} and
+@code{_TIME_BITS} can be defined. Some of these macros work only if
+they are defined before the first system header is included; therefore,
+when using this macro in concert with @code{AC_CONFIG_HEADERS}, make
+sure that @file{config.h} is included before any system headers.
+
+On a few older systems, also change the output variable @code{CC} to add
+special compiler options that are needed to enable large @code{off_t}.
Large-file support can be disabled by configuring with the
-@option{--disable-largefile} option. Note that this has no effect on
-systems where @code{off_t} is 64 bits or larger by default. Disabling
-large-file support can have surprising effects, such as causing
-functions like @code{readdir} and @code{stat} to fail on small files
-(because their @emph{inode numbers} are unrepresentable).
+@option{--disable-largefile} option, and year-2038 support can
+be enabled and disabled via the @option{--enable-year2038} and
+@option{--disable-year2038} options. These options have no effect on
+systems where types are wide enough by default.
+Large-file support is required for year-2038 support: if you configure
+with @option{--disable-largefile} on a platform with 32-bit
+@code{time_t}, then year-2038 support is not available.
+
+Disabling large-file or year-2038 support can have surprising effects,
+such as causing functions like @code{readdir} and @code{stat} to fail
+even on small files because their inode numbers are unrepresentable, or
+causing functions like @code{stat} to fail because a file's timestamp is
+out of range.
Regardless of whether you use this macro, portable programs should not
assume that any of the types listed above fit into a @code{long int}.
-For example, it is not correct to print an arbitrary @code{off_t} value
-@code{X} with @code{printf ("%ld", (long int) X)}.
-
-Note that the standard C library functions @code{fseek} and @code{ftell}
-do not use @code{off_t}. If you need to use either of these functions,
-you should use @code{AC_FUNC_FSEEKO} as well as @code{AC_SYS_LARGEFILE},
-and then use their Posix replacements @code{fseeko} and @code{ftello},
-which @emph{do} use @code{off_t}, when available. @xref{AC_FUNC_FSEEKO}.
-
-As of Autoconf 2.72, @code{AC_SYS_LARGEFILE} also @emph{optionally}
-arranges to enlarge @code{time_t}. This is to make it easier to build
-programs that support timestamps after 2038; many configure scripts will
-not need to be modified, only regenerated with newer Autoconf. When
-@code{AC_SYS_LARGEFILE} is used, and @code{AC_SYS_YEAR2038} is
-@emph{not} used, @code{time_t} will normally be left at the system's
-default size, but you can request it be enlarged by configuring with the
-@option{--enable-year2038} option. (When @code{AC_SYS_YEAR2038} is also
-used, @code{time_t} is enlarged if possible. @xref{AC_SYS_YEAR2038}.)
-@end defmac
-
-@defmac AC_SYS_LARGEFILE_REQUIRED
-@acindex{SYS_LARGEFILE_REQUIRED}
-This macro has the same effect as @code{AC_SYS_LARGEFILE},
-but also declares that the program being configured
-@emph{requires} support for large files.
-If a large @code{off_t} is unavailable,
-@command{configure} will error out.
-The @option{--disable-largefile} option will not be available.
+For example, it is not portable to print an arbitrary @code{off_t} or
+@code{time_t} value @code{X} with @code{printf ("%ld", (long int) X)}.
+
+The standard C library functions @code{fseek} and @code{ftell} do not
+use @code{off_t}. If you need to use either of these functions, you
+should use @code{AC_FUNC_FSEEKO} as well as @code{AC_SYS_LARGEFILE}, and
+then use their Posix replacements @code{fseeko} and @code{ftello}.
+@xref{AC_FUNC_FSEEKO}.
+
+When using @code{AC_SYS_LARGEFILE} in different packages that are linked
+together and that have ABIs that depend on the width of @code{off_t},
+@code{time_t} or related types, the simplest thing is to configure all
+components the same way. For example, if an application uses
+@code{AC_SYS_LARGEFILE} and is configured with
+@option{--enable-year2038}, libraries it links to with an @code{off_t}-
+or @code{time_t}-dependent ABI should be configured equivalently.
+Alternatively, you can modify libraries to support both 32- and 64-bit
+ABIs though this is more work and typically few libraries other than the
+C library itself are modified in this way.
@end defmac
-
@anchor{AC_SYS_LONG_FILE_NAMES}
@defmac AC_SYS_LONG_FILE_NAMES
@acindex{SYS_LONG_FILE_NAMES}
@@ -8885,55 +8908,9 @@ system. If so, set the shell variable @code{ac_cv_sys_posix_termios} to
@anchor{AC_SYS_YEAR2038}
@defmac AC_SYS_YEAR2038
@acindex{SYS_YEAR2038}
-@cvindex _TIME_BITS
@cindex Year 2038
-If the default @code{time_t} type is a signed 32-bit integer,
-and therefore (assuming the usual Unix epoch) cannot represent
-timestamps after mid-January of 2038, arrange to make a larger
-@code{time_t} available, if the system supports this.
-
-If a large @code{time_t} is available (whether or not any arrangements
-were necessary), the shell variable @code{ac_have_year2038} will be set
-to @samp{yes}; if not, it will be set to @samp{no}.
-
-Preprocessor macros will be defined if necessary to make a larger
-@code{time_t} available. (For example, on some systems the macro
-@code{_TIME_BITS} will be defined.) Some of these macros only work if
-they are defined before the first system header is included; therefore,
-when using this macro in concert with @code{AC_CONFIG_HEADERS}, make
-sure that @file{config.h} is included before any system headers.
-
-Support for timestamps after 2038 can be disabled by configuring with
-the @option{--disable-year2038} option. Note that this has no effect on
-systems where @code{time_t} is 64 bits or larger by default.
-If this option is @emph{not} given, and @command{configure} fails to
-find a way to enable a large @code{time_t}, but inspection of the
-system suggests that this feature is available @emph{somehow}, it will
-error out.
-
-Regardless of whether you use this macro, portable programs should not
-assume that @code{time_t} fits into @code{long int}. For example, it is
-not correct to print an arbitrary @code{time_t} value @code{X} with
-@code{printf ("%ld", (long int) X)}.
-
-@strong{Caution:} If you are developing a shared library, and
-@code{time_t} appears anywhere in your library's public interface, use
-of this macro may break binary compatibility with older executables.
-@end defmac
-
-@defmac AC_SYS_YEAR2038_REQUIRED
-@acindex{SYS_YEAR2038_REQUIRED}
-This macro has the same effect as @code{AC_SYS_YEAR2038},
-but also declares that the program being configured
-@emph{requires} support for timestamps after mid-January of 2038.
-If a large @code{time_t} is unavailable,
-@command{configure} will @emph{unconditionally} error out
-(unlike the behavior of @code{AC_SYS_YEAR2038}).
-The @option{--disable-year2038} option will not be available.
-
-@strong{Caution:} If you are developing a shared library, and
-@code{time_t} appears anywhere in your library's public interface, use
-of this macro may break binary compatibility with older executables.
+This is like @code{AC_SYS_LARGEFILE} except it defaults to enabling
+instead of disabling year-2038 support. @xref{AC_SYS_LARGEFILE}.
@end defmac
@node C and Posix Variants
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index 0493d01d..6f9b89bc 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -156,8 +156,6 @@ AS_CASE([$ac_cv_sys_year2038_opts],
["support not detected"],
[ac_have_year2038=no
AS_CASE([$enable_year2038],
- [required],
- [AC_MSG_FAILURE([support for timestamps after Jan 2038 is required])],
[yes],
[# If we're not cross compiling and 'touch' works with a large
# timestamp, then we can presume the system supports wider time_t
@@ -204,22 +202,19 @@ AS_CASE([$ac_cv_sys_year2038_opts],
# --enable-year2038, or a --disable-year2038, or no option at all to
# the configure script. Note that this is expanded very late and
# therefore there cannot be any code in the AC_ARG_ENABLE. The
-# default value for `enable_year2038` is emitted unconditionally
+# default value for enable_year2038 is emitted unconditionally
# because the generated code always looks at this variable.
m4_define([_AC_SYS_YEAR2038_ENABLE],
[m4_divert_text([DEFAULTS],
- m4_provide_if([AC_SYS_YEAR2038_REQUIRED],
- [enable_year2038=required],
m4_provide_if([AC_SYS_YEAR2038],
[enable_year2038=yes],
- [enable_year2038=no])))]dnl
-[m4_provide_if([AC_SYS_YEAR2038_REQUIRED], [],
+ [enable_year2038=no]))]dnl
[AC_ARG_ENABLE([year2038],
m4_provide_if([AC_SYS_YEAR2038],
[AS_HELP_STRING([--disable-year2038],
- [omit support for dates after Jan 2038])],
+ [do not support timestamps after 2038])],
[AS_HELP_STRING([--enable-year2038],
- [include support for dates after Jan 2038])]))])])
+ [support timestamps after 2038])]))])
# _AC_SYS_YEAR2038_OPT_IN
# -----------------------
@@ -241,28 +236,12 @@ AC_DEFUN([_AC_SYS_YEAR2038_OPT_IN],
# On systems where time_t is not always 64 bits, this probe can be
# skipped by passing the --disable-year2038 option to configure.
AC_DEFUN([AC_SYS_YEAR2038],
-[m4_provide_if([AC_SYS_LARGEFILE_REQUIRED], [],
- [AC_REQUIRE([AC_SYS_LARGEFILE])])]dnl
+[AC_REQUIRE([AC_SYS_LARGEFILE])]dnl
[m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl
AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE])
AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])
])])
-# AC_SYS_YEAR2038_REQUIRED
-# ------------------------
-# Same as AC_SYS_YEAR2038, but declares that this program *requires*
-# support for large time_t. If we cannot find any way to make time_t
-# capable of representing values larger than 2**31 - 1, configure will
-# error out. Furthermore, no --enable-year2038 nor --disable-year2038
-# option will be available.
-AC_DEFUN([AC_SYS_YEAR2038_REQUIRED],
-[m4_provide_if([AC_SYS_LARGEFILE_REQUIRED], [],
- [AC_REQUIRE([AC_SYS_LARGEFILE])])]dnl
-[m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl
- _AC_SYS_YEAR2038_PROBE
- AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])
-])])
-
# _AC_SYS_LARGEFILE_TEST_CODE
# ---------------------------
# C code used to probe for large file support.
@@ -323,9 +302,7 @@ ac_have_largefile=yes
AS_CASE([$ac_cv_sys_largefile_opts],
["none needed"], [],
["support not detected"],
- [ac_have_largefile=no
- AS_IF([test $enable_largefile = required],
- [AC_MSG_FAILURE([support for large files is required])])],
+ [ac_have_largefile=no],
["-D_FILE_OFFSET_BITS=64"],
[AC_DEFINE([_FILE_OFFSET_BITS], [64],
@@ -346,21 +323,16 @@ _AC_SYS_YEAR2038_OPT_IN
# _AC_SYS_LARGEFILE_ENABLE
# ------------------------
-# Subroutine of AC_SYS_LARGEFILE. If AC_SYS_LARGEFILE_REQUIRED was
-# not used at any point in this configure script, add a
-# --disable-largefile option to the configure script. Note that this
+# Subroutine of AC_SYS_LARGEFILE. Note that this
# is expanded very late and therefore there cannot be any code in the
-# AC_ARG_ENABLE. The default value for `enable_largefile` is emitted
+# AC_ARG_ENABLE. The default value for enable_largefile is emitted
# unconditionally because the generated shell code always looks at
# this variable.
m4_define([_AC_SYS_LARGEFILE_ENABLE],
[m4_divert_text([DEFAULTS],
- m4_provide_if([AC_SYS_LARGEFILE_REQUIRED],
- [enable_largefile=required],
- [enable_largefile=yes]))]dnl
-[m4_provide_if([AC_SYS_LARGEFILE_REQUIRED], [],
+ enable_largefile=yes)]dnl
[AC_ARG_ENABLE([largefile],
- [AS_HELP_STRING([--disable-largefile], [omit support for large files])])])])
+ [AS_HELP_STRING([--disable-largefile], [omit support for large files])])])
# AC_SYS_LARGEFILE
# ----------------
@@ -372,28 +344,13 @@ m4_define([_AC_SYS_LARGEFILE_ENABLE],
# to have a 64-bit inode number cannot be accessed by 32-bit applications on
# Linux x86/x86_64. This can occur with file systems such as XFS and NFS.
# This macro allows configuration to continue if the system doesn't support
-# large files; see also AC_SYS_LARGEFILE_REQUIRED.
+# large files.
AC_DEFUN([AC_SYS_LARGEFILE],
[m4_provide_if([_AC_SYS_LARGEFILE_PROBE], [], [dnl
AS_IF([test "$enable_largefile" != no], [_AC_SYS_LARGEFILE_PROBE])
AC_CONFIG_COMMANDS_PRE([_AC_SYS_LARGEFILE_ENABLE])
])])
-# AC_SYS_LARGEFILE_REQUIRED
-# -------------------------
-# Same as AC_SYS_LARGEFILE, but declares that this program *requires*
-# support for large files. If we cannot find a combination of compiler
-# options and #defines that makes `off_t` capable of representing 2**63 - 1,
-# `configure` will error out. Furthermore, `configure` will not offer a
-# --disable-largefile command line option.
-# If both AC_SYS_LARGEFILE and AC_SYS_LARGEFILE_REQUIRED are used in the
-# same configure script -- in either order -- AC_SYS_LARGEFILE_REQUIRED wins.
-AC_DEFUN([AC_SYS_LARGEFILE_REQUIRED],
-[m4_provide_if([_AC_SYS_LARGEFILE_PROBE], [], [dnl
- _AC_SYS_LARGEFILE_PROBE
- AC_CONFIG_COMMANDS_PRE([_AC_SYS_LARGEFILE_ENABLE])
-])])
-
# AC_SYS_LONG_FILE_NAMES
# ----------------------
# Security: use a temporary directory as the most portable way of