summaryrefslogtreecommitdiff
path: root/lib/autoconf/specific.m4
diff options
context:
space:
mode:
authorZack Weinberg <zack@owlfolio.org>2022-12-24 23:24:51 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2022-12-25 11:04:20 -0800
commitcf09f48841b66fe76f606dd6018bb3a93242a7c9 (patch)
tree0c37133d949cc8d737783e58445119460a643ce1 /lib/autoconf/specific.m4
parentbb7c8cbb0a620157a031540ff88bc12cbcb4d0c1 (diff)
downloadautoconf-cf09f48841b66fe76f606dd6018bb3a93242a7c9.tar.gz
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 f6657256a37da44c987c04bf9cd75575dfca3b60: 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.
Diffstat (limited to 'lib/autoconf/specific.m4')
-rw-r--r--lib/autoconf/specific.m4437
1 files changed, 272 insertions, 165 deletions
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index 231da8da..0493d01d 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -85,9 +85,13 @@ AU_DEFUN([AC_ARG_ARRAY], [],
with arguments. Remove this warning when you adjust your code.])
-# _AC_SYS_YEAR2038_TEST_INCLUDES
-# ------------------------------
-AC_DEFUN([_AC_SYS_YEAR2038_TEST_INCLUDES],
+# _AC_SYS_YEAR2038_TEST_CODE
+# --------------------------
+# C code used to probe for time_t that can represent time points more
+# than 2**31 - 1 seconds after the epoch. With the usual Unix epoch,
+# these correspond to dates after 2038-01-18 22:14:07 +0000 (Gregorian),
+# hence the name.
+AC_DEFUN([_AC_SYS_YEAR2038_TEST_CODE],
[[
#include <time.h>
/* Check that time_t can represent 2**32 - 1 correctly. */
@@ -98,102 +102,171 @@ AC_DEFUN([_AC_SYS_YEAR2038_TEST_INCLUDES],
? 1 : -1];
]])
-# _AC_SYS_YEAR2038(REQUIRE-YEAR2038-SAFE)
-# ---------------------------------------
-AC_DEFUN([_AC_SYS_YEAR2038],
-[
- AC_ARG_ENABLE([year2038],
- [ --disable-year2038 omit support for timestamps past the year 2038])
- AS_IF([test "$enable_year2038" != no],
- [
- dnl On many systems, time_t is already a 64-bit type.
- dnl On those systems where time_t is still 32-bit, it requires kernel
- dnl and libc support to make it 64-bit. For glibc 2.34 and later on Linux,
- dnl defining _TIME_BITS=64 and _FILE_OFFSET_BITS=64 is needed on x86 and ARM.
- dnl
- dnl On native Windows, the system include files define types __time32_t
- dnl and __time64_t. By default, time_t is an alias of
- dnl - __time32_t on 32-bit mingw,
- dnl - __time64_t on 64-bit mingw and on MSVC (since MSVC 8).
- dnl But when compiling with -D__MINGW_USE_VC2005_COMPAT, time_t is an
- dnl alias of __time64_t.
- dnl And when compiling with -D_USE_32BIT_TIME_T, time_t is an alias of
- dnl __time32_t.
- AC_CACHE_CHECK([for time_t past the year 2038], [ac_cv_type_time_t_y2038],
- [AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE([_AC_SYS_YEAR2038_TEST_INCLUDES])],
- [ac_cv_type_time_t_y2038=yes], [ac_cv_type_time_t_y2038=no])
- ])
- if test "$ac_cv_type_time_t_y2038" = no; then
- AC_CACHE_CHECK([for 64-bit time_t with _TIME_BITS=64],
- [ac_cv_type_time_t_bits_macro],
- [AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE([[#define _TIME_BITS 64
- #define _FILE_OFFSET_BITS 64
- ]_AC_SYS_YEAR2038_TEST_INCLUDES])],
- [ac_cv_type_time_t_bits_macro=yes],
- [ac_cv_type_time_t_bits_macro=no])
- ])
- if test "$ac_cv_type_time_t_bits_macro" = yes; then
- AC_DEFINE([_TIME_BITS], [64],
- [Number of bits in a timestamp, on hosts where this is settable.])
- dnl AC_SYS_LARGFILE also defines this; it's OK if we do too.
- AC_DEFINE([_FILE_OFFSET_BITS], [64],
- [Number of bits in a file offset, on hosts where this is settable.])
- ac_cv_type_time_t_y2038=yes
- fi
- fi
- if test $ac_cv_type_time_t_y2038 = no; then
- AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE(
- [[#ifdef _USE_32BIT_TIME_T
- int ok;
- #else
- error fail
- #endif
- ]])],
- [AC_MSG_FAILURE(
- [The 'time_t' type stops working after January 2038.
- Remove _USE_32BIT_TIME_T from the compiler flags.])],
- [# If not cross-compiling and $1 says we should check,
- # and 'touch' works with a large timestamp, then evidently wider time_t
- # is desired and supported, so fail and ask the builder to fix the
- # problem. Otherwise, just warn the builder.
- m4_ifval([$1],
- [if test $cross_compiling = no \
- && TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null; then
- case `TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null` in
- *'Feb 7 2106'* | *'Feb 7 17:10'*)
- AC_MSG_FAILURE(
- [The 'time_t' type stops working after January 2038,
- and your system appears to support a wider 'time_t'.
- Try configuring with 'CC="${CC} -m64"'.
- To build with a 32-bit time_t anyway (not recommended),
- configure with '--disable-year2038'.]);;
- esac
- rm -f conftest.time
- fi])
- if test "$ac_warned_about_y2038" != yes; then
- AC_MSG_WARN(
- [The 'time_t' type stops working after January 2038,
- and this package needs a wider 'time_t' type
- if there is any way to access timestamps after that.
- Configure with 'CC="${CC} -m64"' perhaps?])
- ac_warned_about_y2038=yes
- fi
- ])
- fi])
+# _AC_SYS_YEAR2038_OPTIONS
+# ------------------------
+# List of known ways to enable support for large time_t. If you change
+# this list you probably also need to change the AS_CASE at the end of
+# _AC_SYS_YEAR2038_PROBE.
+m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize(
+ ["none needed"] dnl 64-bit and newer 32-bit Unix
+ ["-D_TIME_BITS=64"] dnl glibc 2.34 with some 32-bit ABIs
+ ["-D__MINGW_USE_VC2005_COMPAT"] dnl 32-bit MinGW
+ ["-U_USE_32_BIT_TIME_T -D__MINGW_USE_VC2005_COMPAT"]
+ dnl 32-bit MinGW (misconfiguration)
+))
+
+# _AC_SYS_YEAR2038_PROBE([IF-NOT-DETECTED])
+# -----------------------------------------
+# Subroutine of AC_SYS_YEAR2038. Probe for time_t that can represent
+# time points more than 2**31 - 1 seconds after the epoch (dates after
+# 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts
+# to one of the values in the _AC_SYS_YEAR2038_OPTIONS list, or to
+# "support not detected" if none of them worked. Then, set compilation
+# options and #defines as necessary to enable large time_t support.
+#
+# Note that we do not test whether mktime, localtime, etc. handle
+# large values of time_t correctly, as that would require use of
+# AC_TRY_RUN. Note also that some systems only support large time_t
+# together with large off_t.
+#
+# If support is not detected, the behavior depends on which of the
+# top-level AC_SYS_YEAR2038 macros was used (see below).
+#
+# If you change this macro you may also need to change
+# _AC_SYS_YEAR2038_OPTIONS.
+AC_DEFUN([_AC_SYS_YEAR2038_PROBE],
+[AC_CACHE_CHECK([for $CC option to enable timestamps after Jan 2038],
+ [ac_cv_sys_year2038_opts],
+ [ac_save_CPPFLAGS="$CPPFLAGS"
+ ac_opt_found=no
+ for ac_opt in _AC_SYS_YEAR2038_OPTIONS; do
+ AS_IF([test x"$ac_opt" != x"none needed"],
+ [CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_YEAR2038_TEST_CODE])],
+ [ac_cv_sys_year2038_opts="$ac_opt"
+ ac_opt_found=yes])
+ test $ac_opt_found = no || break
+ done
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ test $ac_opt_found = yes || ac_cv_sys_year2038_opts="support not detected"])
+
+ac_have_year2038=yes
+AS_CASE([$ac_cv_sys_year2038_opts],
+ ["none needed"], [],
+ ["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
+ # *somehow* and we just weren't able to detect it. One common
+ # case that we deliberately *don't* probe for is a system that
+ # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers
+ # wide time_t. (It would be inappropriate for us to override an
+ # intentional use of -m32.) Error out, demanding use of
+ # --disable-year2038 if this is intentional.
+ AS_IF([test $cross_compiling = no],
+ [AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null],
+ [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`],
+ [*'Feb 7 2106'* | *'Feb 7 17:10'*],
+ [AC_MSG_FAILURE(m4_text_wrap(
+ [this system appears to support timestamps after January 2038,
+ but no mechanism for enabling wide 'time_t' was detected.
+ Did you mean to build a 64-bit binary? (e.g. 'CC="${CC} -m64"'.)
+ To proceed with 32-bit time_t, configure with '--disable-year2038'.],
+ [], [], [55]))])])])])],
+
+ ["-D_TIME_BITS=64"],
+ [AC_DEFINE([_TIME_BITS], [64],
+ [Number of bits in time_t, on hosts where this is settable.])],
+
+ ["-D__MINGW_USE_VC2005_COMPAT=1"],
+ [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1],
+ [Define to 1 on platforms where this makes time_t a 64-bit type.])],
+
+ ["-U_USE_32_BIT_TIME_T"*],
+ [AC_MSG_FAILURE(m4_text_wrap(
+ [the 'time_t' type is currently forced to be 32-bit.
+ It will stop working after January 2038.
+ Remove _USE_32BIT_TIME_T from the compiler flags.],
+ [], [], [55]))],
+
+ [AC_MSG_ERROR(
+ [internal error: bad value for \$ac_cv_sys_year2038_opts])])
])
+# _AC_SYS_YEAR2038_ENABLE
+# -----------------------
+# Subroutine of AC_SYS_YEAR2038 and _AC_SYS_YEAR2038_OPT_IN.
+# Depending on which of the YEAR2038 macros was used, add either an
+# --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
+# 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], [],
+[AC_ARG_ENABLE([year2038],
+ m4_provide_if([AC_SYS_YEAR2038],
+ [AS_HELP_STRING([--disable-year2038],
+ [omit support for dates after Jan 2038])],
+ [AS_HELP_STRING([--enable-year2038],
+ [include support for dates after Jan 2038])]))])])
+
+# _AC_SYS_YEAR2038_OPT_IN
+# -----------------------
+# If the --enable-year2038 option is given to configure, attempt to
+# detect and activate support for large time_t on 32-bit systems.
+# This macro is automatically invoked by AC_SYS_LARGEFILE when large
+# *file* support is detected. It does not AC_REQUIRE AC_SYS_LARGEFILE
+# to avoid a dependency loop, and is therefore unsafe to expose as a
+# documented macro.
+AC_DEFUN([_AC_SYS_YEAR2038_OPT_IN],
+[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
+# ---------------
+# Attempt to detect and activate support for large time_t.
+# 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],
-[
- _$0([require-year2038-safe])
-])
-
-
-# _AC_SYS_LARGEFILE_TEST_INCLUDES
-# -------------------------------
-m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
+[m4_provide_if([AC_SYS_LARGEFILE_REQUIRED], [],
+ [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.
+m4_define([_AC_SYS_LARGEFILE_TEST_CODE],
[@%:@include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
@@ -205,33 +278,89 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
? 1 : -1]];[]dnl
])
+# _AC_SYS_LARGEFILE_OPTIONS
+# -------------------------
+# List of known ways to enable support for large files. If you change
+# this list you probably also need to change the AS_CASE at the end of
+# _AC_SYS_LARGEFILE_PROBE.
+m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize(
+ ["none needed"] dnl Most current systems
+ ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec
+ ["-D_LARGE_FILES=1"] dnl AIX (which versions?)
+ ["-n32"] dnl Irix 6.2 w/ SGI compiler
+))
+
+# _AC_SYS_LARGEFILE_PROBE
+# -----------------------
+# Subroutine of AC_SYS_LARGEFILE. Probe for large file support and set
+# the cache variable ac_cv_sys_largefile_opts to one of the values in
+# the _AC_SYS_LARGEFILE_OPTIONS list, or to "support not detected" if
+# none of the options in that list worked. Then, set compilation
+# options and #defines as necessary to enable large file support.
+#
+# If large file support is not detected, the behavior depends on which of
+# the top-level AC_SYS_LARGEFILE macros was used (see below).
+#
+# If you change this macro you may also need to change
+# _AC_SYS_LARGEFILE_OPTIONS.
+AC_DEFUN([_AC_SYS_LARGEFILE_PROBE],
+[AC_CACHE_CHECK([for $CC option to enable large file support],
+ [ac_cv_sys_largefile_opts],
+ [ac_save_CC="$CC"
+ ac_opt_found=no
+ for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do
+ AS_IF([test x"$ac_opt" != x"none needed"],
+ [CC="$ac_save_CC $ac_opt"])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])],
+ [ac_cv_sys_largefile_opts="$ac_opt"
+ ac_opt_found=yes])
+ test $ac_opt_found = no || break
+ done
+ CC="$ac_save_CC"
+ test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"])
+
+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])])],
+
+ ["-D_FILE_OFFSET_BITS=64"],
+ [AC_DEFINE([_FILE_OFFSET_BITS], [64],
+ [Number of bits in a file offset, on hosts where this is settable.])],
+
+ ["-D_LARGE_FILES=1"],
+ [AC_DEFINE([_LARGE_FILES], [1],
+ [Define to 1 on platforms where this makes off_t a 64-bit type.])],
+
+ ["-n32"],
+ [CC="$CC -n32"],
+
+ [AC_MSG_ERROR(
+ [internal error: bad value for \$ac_cv_sys_largefile_opts])])
+
+_AC_SYS_YEAR2038_OPT_IN
+])
-# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
-# CACHE-VAR,
-# DESCRIPTION,
-# PROLOGUE, [FUNCTION-BODY])
-# --------------------------------------------------------
-m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
-[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
-[while :; do
- m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
- [AC_LANG_PROGRAM([$5], [$6])],
- [$3=no; break])
- m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
- [AC_LANG_PROGRAM([#undef $1
-#define $1 $2
-$5], [$6])],
- [$3=$2; break])
- $3=unknown
- break
-done])
-case $$3 in #(
- no | unknown) ;;
- *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
-esac
-rm -rf conftest*[]dnl
-])# _AC_SYS_LARGEFILE_MACRO_VALUE
-
+# _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
+# is expanded very late and therefore there cannot be any code in the
+# 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], [],
+[AC_ARG_ENABLE([largefile],
+ [AS_HELP_STRING([--disable-largefile], [omit support for large files])])])])
# AC_SYS_LARGEFILE
# ----------------
@@ -242,50 +371,28 @@ rm -rf conftest*[]dnl
# Additionally, on Linux file systems with 64-bit inodes a file that happens
# 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.
AC_DEFUN([AC_SYS_LARGEFILE],
-[AC_ARG_ENABLE(largefile,
- [ --disable-largefile omit support for large files])
-AS_IF([test "$enable_largefile" != no],
- [AC_CACHE_CHECK([for special C compiler options needed for large files],
- ac_cv_sys_largefile_CC,
- [ac_cv_sys_largefile_CC=no
- if test "$GCC" != yes; then
- ac_save_CC=$CC
- while :; do
- # IRIX 6.2 and later do not support large files by default,
- # so use the C compiler's -n32 option if that helps.
- AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
- AC_COMPILE_IFELSE([], [break])
- CC="$CC -n32"
- AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
- break
- done
- CC=$ac_save_CC
- rm -f conftest.$ac_ext
- fi])
- if test "$ac_cv_sys_largefile_CC" != no; then
- CC=$CC$ac_cv_sys_largefile_CC
- fi
-
- _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
- ac_cv_sys_file_offset_bits,
- [Number of bits in a file offset, on hosts where this is settable.],
- [_AC_SYS_LARGEFILE_TEST_INCLUDES])
- AS_CASE([$ac_cv_sys_file_offset_bits],
- [unknown],
- [_AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1],
- [ac_cv_sys_large_files],
- [Define for large files, on AIX-style hosts.],
- [_AC_SYS_LARGEFILE_TEST_INCLUDES])],
- [64],
- [_AC_SYS_YEAR2038()])])
-
- AH_VERBATIM([__MINGW_USE_VC2005_COMPAT],
-[#if !defined __MINGW_USE_VC2005_COMPAT && defined __MINGW32__
-# define __MINGW_USE_VC2005_COMPAT 1 /* For 64-bit time_t. */
-#endif])
-])# 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
# ----------------------