diff options
Diffstat (limited to 'gl/m4/largefile.m4')
| -rw-r--r-- | gl/m4/largefile.m4 | 232 |
1 files changed, 112 insertions, 120 deletions
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4 index 7fb81b86..b24f657d 100644 --- a/gl/m4/largefile.m4 +++ b/gl/m4/largefile.m4 | |||
| @@ -1,16 +1,19 @@ | |||
| 1 | # largefile.m4 | ||
| 2 | # serial 2 | ||
| 3 | dnl Copyright 1992-1996, 1998-2025 Free Software Foundation, Inc. | ||
| 4 | dnl This file is free software; the Free Software Foundation | ||
| 5 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 6 | dnl with or without modifications, as long as this notice is preserved. | ||
| 7 | dnl This file is offered as-is, without any warranty. | ||
| 8 | |||
| 1 | # Enable large files on systems where this is not the default. | 9 | # Enable large files on systems where this is not the default. |
| 2 | # Enable support for files on Linux file systems with 64-bit inode numbers. | 10 | # Enable support for files on Linux file systems with 64-bit inode numbers. |
| 3 | 11 | ||
| 4 | # Copyright 1992-1996, 1998-2023 Free Software Foundation, Inc. | ||
| 5 | # This file is free software; the Free Software Foundation | ||
| 6 | # gives unlimited permission to copy and/or distribute it, | ||
| 7 | # with or without modifications, as long as this notice is preserved. | ||
| 8 | |||
| 9 | # The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: | 12 | # The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: |
| 10 | # It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this | 13 | # It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this |
| 11 | # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko | 14 | # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko |
| 12 | # and ftello in C++ mode as well. | 15 | # and ftello in C++ mode as well. |
| 13 | # Fixed in Autoconf 2.72, which has AC_SYS_YEAR2038. | 16 | # This problem occurs in Autoconf 2.71 and earlier, which lack AC_SYS_YEAR2038. |
| 14 | AC_DEFUN([gl_SET_LARGEFILE_SOURCE], | 17 | AC_DEFUN([gl_SET_LARGEFILE_SOURCE], |
| 15 | m4_ifndef([AC_SYS_YEAR2038], [[ | 18 | m4_ifndef([AC_SYS_YEAR2038], [[ |
| 16 | AC_REQUIRE([AC_CANONICAL_HOST]) | 19 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| @@ -24,29 +27,20 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE], | |||
| 24 | ]]) | 27 | ]]) |
| 25 | ) | 28 | ) |
| 26 | 29 | ||
| 27 | # Work around a problem in autoconf <= 2.69: | 30 | dnl Remove AC_SYS_YEAR2038_RECOMMENDED if unpatched Autoconf 2.72 or earlier. |
| 28 | # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, | 31 | dnl Autoconf 2.72 still uses -n32, which is not a C preprocessor option, |
| 29 | # or configures them incorrectly in some cases. | 32 | dnl and which was useful only on IRIX which is no longer supported. |
| 30 | m4_version_prereq([2.70], [], [ | 33 | dnl This should be fixed in Autoconf 2.73. |
| 31 | 34 | m4_ifdef([AC_SYS_YEAR2038_RECOMMENDED], | |
| 32 | # _AC_SYS_LARGEFILE_TEST_INCLUDES | 35 | [m4_bmatch(m4_ifdef([_AC_SYS_LARGEFILE_OPTIONS], |
| 33 | # ------------------------------- | 36 | [m4_defn([_AC_SYS_LARGEFILE_OPTIONS])], |
| 34 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], | 37 | ["-n32"]), |
| 35 | [#include <sys/types.h> | 38 | ["-n32"], |
| 36 | /* Check that off_t can represent 2**63 - 1 correctly. | 39 | [m4_undefine([AC_SYS_YEAR2038_RECOMMENDED])])]) |
| 37 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||
| 38 | since some C++ compilers masquerading as C compilers | ||
| 39 | incorrectly reject 9223372036854775807. */ | ||
| 40 | #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) | ||
| 41 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | ||
| 42 | && LARGE_OFF_T % 2147483647 == 1) | ||
| 43 | ? 1 : -1]];[]dnl | ||
| 44 | ]) | ||
| 45 | ])# m4_version_prereq 2.70 | ||
| 46 | 40 | ||
| 47 | # Support AC_SYS_YEAR2038, even if Autoconf 2.71 or earlier. | 41 | m4_ifndef([AC_SYS_YEAR2038_RECOMMENDED], [ |
| 48 | # This code is taken from Autoconf master. | 42 | # Fix up AC_SYS_YEAR2038_RECOMMENDED and related macros, even if |
| 49 | m4_ifndef([AC_SYS_YEAR2038], [ | 43 | # unpatched Autoconf 2.72 or earlier. This code is taken from Autoconf master. |
| 50 | 44 | ||
| 51 | # _AC_SYS_YEAR2038_TEST_CODE | 45 | # _AC_SYS_YEAR2038_TEST_CODE |
| 52 | # -------------------------- | 46 | # -------------------------- |
| @@ -78,8 +72,8 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( | |||
| 78 | dnl 32-bit MinGW (misconfiguration) | 72 | dnl 32-bit MinGW (misconfiguration) |
| 79 | )) | 73 | )) |
| 80 | 74 | ||
| 81 | # _AC_SYS_YEAR2038_PROBE([IF-NOT-DETECTED]) | 75 | # _AC_SYS_YEAR2038_PROBE |
| 82 | # ----------------------------------------- | 76 | # ---------------------- |
| 83 | # Subroutine of AC_SYS_YEAR2038. Probe for time_t that can represent | 77 | # Subroutine of AC_SYS_YEAR2038. Probe for time_t that can represent |
| 84 | # time points more than 2**31 - 1 seconds after the epoch (dates after | 78 | # time points more than 2**31 - 1 seconds after the epoch (dates after |
| 85 | # 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts | 79 | # 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts |
| @@ -92,13 +86,10 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( | |||
| 92 | # AC_TRY_RUN. Note also that some systems only support large time_t | 86 | # AC_TRY_RUN. Note also that some systems only support large time_t |
| 93 | # together with large off_t. | 87 | # together with large off_t. |
| 94 | # | 88 | # |
| 95 | # If support is not detected, the behavior depends on which of the | ||
| 96 | # top-level AC_SYS_YEAR2038 macros was used (see below). | ||
| 97 | # | ||
| 98 | # If you change this macro you may also need to change | 89 | # If you change this macro you may also need to change |
| 99 | # _AC_SYS_YEAR2038_OPTIONS. | 90 | # _AC_SYS_YEAR2038_OPTIONS. |
| 100 | AC_DEFUN([_AC_SYS_YEAR2038_PROBE], | 91 | AC_DEFUN([_AC_SYS_YEAR2038_PROBE], |
| 101 | [AC_CACHE_CHECK([for $CC option to enable timestamps after Jan 2038], | 92 | [AC_CACHE_CHECK([for $CC option to support timestamps after 2038], |
| 102 | [ac_cv_sys_year2038_opts], | 93 | [ac_cv_sys_year2038_opts], |
| 103 | [ac_save_CPPFLAGS="$CPPFLAGS" | 94 | [ac_save_CPPFLAGS="$CPPFLAGS" |
| 104 | ac_opt_found=no | 95 | ac_opt_found=no |
| @@ -117,40 +108,20 @@ ac_have_year2038=yes | |||
| 117 | AS_CASE([$ac_cv_sys_year2038_opts], | 108 | AS_CASE([$ac_cv_sys_year2038_opts], |
| 118 | ["none needed"], [], | 109 | ["none needed"], [], |
| 119 | ["support not detected"], | 110 | ["support not detected"], |
| 120 | [ac_have_year2038=no | 111 | [ac_have_year2038=no], |
| 121 | AS_CASE([$enable_year2038], | ||
| 122 | [yes], | ||
| 123 | [# If we're not cross compiling and 'touch' works with a large | ||
| 124 | # timestamp, then we can presume the system supports wider time_t | ||
| 125 | # *somehow* and we just weren't able to detect it. One common | ||
| 126 | # case that we deliberately *don't* probe for is a system that | ||
| 127 | # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers | ||
| 128 | # wide time_t. (It would be inappropriate for us to override an | ||
| 129 | # intentional use of -m32.) Error out, demanding use of | ||
| 130 | # --disable-year2038 if this is intentional. | ||
| 131 | AS_IF([test $cross_compiling = no], | ||
| 132 | [AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null], | ||
| 133 | [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`], | ||
| 134 | [*'Feb 7 2106'* | *'Feb 7 17:10'*], | ||
| 135 | [AC_MSG_FAILURE(m4_text_wrap( | ||
| 136 | [this system appears to support timestamps after January 2038, | ||
| 137 | but no mechanism for enabling wide 'time_t' was detected. | ||
| 138 | Did you mean to build a 64-bit binary? (e.g. 'CC="${CC} -m64"'.) | ||
| 139 | To proceed with 32-bit time_t, configure with '--disable-year2038'.], | ||
| 140 | [], [], [55]))])])])])], | ||
| 141 | 112 | ||
| 142 | ["-D_TIME_BITS=64"], | 113 | ["-D_TIME_BITS=64"], |
| 143 | [AC_DEFINE([_TIME_BITS], [64], | 114 | [AC_DEFINE([_TIME_BITS], [64], |
| 144 | [Number of bits in time_t, on hosts where this is settable.])], | 115 | [Number of bits in time_t, on hosts where this is settable.])], |
| 145 | 116 | ||
| 146 | ["-D__MINGW_USE_VC2005_COMPAT=1"], | 117 | ["-D__MINGW_USE_VC2005_COMPAT"], |
| 147 | [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], | 118 | [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], |
| 148 | [Define to 1 on platforms where this makes time_t a 64-bit type.])], | 119 | [Define to 1 on platforms where this makes time_t a 64-bit type.])], |
| 149 | 120 | ||
| 150 | ["-U_USE_32_BIT_TIME_T"*], | 121 | ["-U_USE_32_BIT_TIME_T"*], |
| 151 | [AC_MSG_FAILURE(m4_text_wrap( | 122 | [AC_MSG_FAILURE(m4_text_wrap( |
| 152 | [the 'time_t' type is currently forced to be 32-bit. | 123 | [the 'time_t' type is currently forced to be 32-bit. |
| 153 | It will stop working after January 2038. | 124 | It will stop working after mid-January 2038. |
| 154 | Remove _USE_32BIT_TIME_T from the compiler flags.], | 125 | Remove _USE_32BIT_TIME_T from the compiler flags.], |
| 155 | [], [], [55]))], | 126 | [], [], [55]))], |
| 156 | 127 | ||
| @@ -160,12 +131,11 @@ AS_CASE([$ac_cv_sys_year2038_opts], | |||
| 160 | 131 | ||
| 161 | # _AC_SYS_YEAR2038_ENABLE | 132 | # _AC_SYS_YEAR2038_ENABLE |
| 162 | # ----------------------- | 133 | # ----------------------- |
| 163 | # Subroutine of AC_SYS_YEAR2038 and _AC_SYS_YEAR2038_OPT_IN. | ||
| 164 | # Depending on which of the YEAR2038 macros was used, add either an | 134 | # Depending on which of the YEAR2038 macros was used, add either an |
| 165 | # --enable-year2038, or a --disable-year2038, or no option at all to | 135 | # --enable-year2038 or a --disable-year2038 to |
| 166 | # the configure script. Note that this is expanded very late and | 136 | # the configure script. This is expanded very late and |
| 167 | # therefore there cannot be any code in the AC_ARG_ENABLE. The | 137 | # therefore there cannot be any code in the AC_ARG_ENABLE. The |
| 168 | # default value for enable_year2038 is emitted unconditionally | 138 | # default value for 'enable_year2038' is emitted unconditionally |
| 169 | # because the generated code always looks at this variable. | 139 | # because the generated code always looks at this variable. |
| 170 | m4_define([_AC_SYS_YEAR2038_ENABLE], | 140 | m4_define([_AC_SYS_YEAR2038_ENABLE], |
| 171 | [m4_divert_text([DEFAULTS], | 141 | [m4_divert_text([DEFAULTS], |
| @@ -175,50 +145,70 @@ m4_define([_AC_SYS_YEAR2038_ENABLE], | |||
| 175 | [AC_ARG_ENABLE([year2038], | 145 | [AC_ARG_ENABLE([year2038], |
| 176 | m4_provide_if([AC_SYS_YEAR2038], | 146 | m4_provide_if([AC_SYS_YEAR2038], |
| 177 | [AS_HELP_STRING([--disable-year2038], | 147 | [AS_HELP_STRING([--disable-year2038], |
| 178 | [do not support timestamps after 2038])], | 148 | [don't support timestamps after 2038])], |
| 179 | [AS_HELP_STRING([--enable-year2038], | 149 | [AS_HELP_STRING([--enable-year2038], |
| 180 | [support timestamps after 2038])]))]) | 150 | [support timestamps after 2038])]))]) |
| 181 | 151 | ||
| 182 | # _AC_SYS_YEAR2038_OPT_IN | ||
| 183 | # ----------------------- | ||
| 184 | # If the --enable-year2038 option is given to configure, attempt to | ||
| 185 | # detect and activate support for large time_t on 32-bit systems. | ||
| 186 | # This macro is automatically invoked by AC_SYS_LARGEFILE when large | ||
| 187 | # *file* support is detected. It does not AC_REQUIRE AC_SYS_LARGEFILE | ||
| 188 | # to avoid a dependency loop, and is therefore unsafe to expose as a | ||
| 189 | # documented macro. | ||
| 190 | AC_DEFUN([_AC_SYS_YEAR2038_OPT_IN], | ||
| 191 | [m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl | ||
| 192 | AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) | ||
| 193 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) | ||
| 194 | ])]) | ||
| 195 | |||
| 196 | # AC_SYS_YEAR2038 | 152 | # AC_SYS_YEAR2038 |
| 197 | # --------------- | 153 | # --------------- |
| 198 | # Attempt to detect and activate support for large time_t. | 154 | # Attempt to detect and activate support for large time_t. |
| 199 | # On systems where time_t is not always 64 bits, this probe can be | 155 | # On systems where time_t is not always 64 bits, this probe can be |
| 200 | # skipped by passing the --disable-year2038 option to configure. | 156 | # skipped by passing the --disable-year2038 option to configure. |
| 201 | AC_DEFUN([AC_SYS_YEAR2038], | 157 | AC_DEFUN([AC_SYS_YEAR2038], |
| 202 | [AC_REQUIRE([AC_SYS_LARGEFILE])]dnl | 158 | [AC_REQUIRE([AC_SYS_LARGEFILE])dnl |
| 203 | [m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl | 159 | AS_IF([test "$enable_year2038,$ac_have_year2038,$cross_compiling" = yes,no,no], |
| 204 | AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) | 160 | [# If we're not cross compiling and 'touch' works with a large |
| 205 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) | 161 | # timestamp, then we can presume the system supports wider time_t |
| 206 | ])]) | 162 | # *somehow* and we just weren't able to detect it. One common |
| 163 | # case that we deliberately *don't* probe for is a system that | ||
| 164 | # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers | ||
| 165 | # wide time_t. (It would be inappropriate for us to override an | ||
| 166 | # intentional use of -m32.) Error out, demanding use of | ||
| 167 | # --disable-year2038 if this is intentional. | ||
| 168 | AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null], | ||
| 169 | [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`], | ||
| 170 | [*'Feb 7 2106'* | *'Feb 7 17:10'*], | ||
| 171 | [AC_MSG_FAILURE(m4_text_wrap( | ||
| 172 | [this system appears to support timestamps after mid-January 2038, | ||
| 173 | but no mechanism for enabling wide 'time_t' was detected. | ||
| 174 | Did you mean to build a 64-bit binary? (E.g., 'CC="${CC} -m64"'.) | ||
| 175 | To proceed with 32-bit time_t, configure with '--disable-year2038'.], | ||
| 176 | [], [], [55]))])])])]) | ||
| 177 | |||
| 178 | # AC_SYS_YEAR2038_RECOMMENDED | ||
| 179 | # --------------------------- | ||
| 180 | # Same as AC_SYS_YEAR2038, but recommend support for large time_t. | ||
| 181 | # If we cannot find any way to make time_t capable of representing | ||
| 182 | # values larger than 2**31 - 1, error out unless --disable-year2038 is given. | ||
| 183 | AC_DEFUN([AC_SYS_YEAR2038_RECOMMENDED], | ||
| 184 | [AC_REQUIRE([AC_SYS_YEAR2038])dnl | ||
| 185 | AS_IF([test "$enable_year2038,$ac_have_year2038" = yes,no], | ||
| 186 | [AC_MSG_FAILURE(m4_text_wrap( | ||
| 187 | [could not enable timestamps after mid-January 2038. | ||
| 188 | This package recommends support for these later timestamps. | ||
| 189 | However, to proceed with signed 32-bit time_t even though it | ||
| 190 | will fail then, configure with '--disable-year2038'.], | ||
| 191 | [], [], [55]))])]) | ||
| 207 | 192 | ||
| 208 | # _AC_SYS_LARGEFILE_TEST_CODE | 193 | # _AC_SYS_LARGEFILE_TEST_CODE |
| 209 | # --------------------------- | 194 | # --------------------------- |
| 210 | # C code used to probe for large file support. | 195 | # C code used to probe for large file support. |
| 211 | m4_define([_AC_SYS_LARGEFILE_TEST_CODE], | 196 | m4_define([_AC_SYS_LARGEFILE_TEST_CODE], |
| 212 | [@%:@include <sys/types.h> | 197 | [@%:@include <sys/types.h> |
| 213 | /* Check that off_t can represent 2**63 - 1 correctly. | 198 | @%:@ifndef FTYPE |
| 214 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | 199 | @%:@ define FTYPE off_t |
| 200 | @%:@endif | ||
| 201 | /* Check that FTYPE can represent 2**63 - 1 correctly. | ||
| 202 | We can't simply define LARGE_FTYPE to be 9223372036854775807, | ||
| 215 | since some C++ compilers masquerading as C compilers | 203 | since some C++ compilers masquerading as C compilers |
| 216 | incorrectly reject 9223372036854775807. */ | 204 | incorrectly reject 9223372036854775807. */ |
| 217 | @%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) | 205 | @%:@define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31)) |
| 218 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | 206 | int FTYPE_is_large[[(LARGE_FTYPE % 2147483629 == 721 |
| 219 | && LARGE_OFF_T % 2147483647 == 1) | 207 | && LARGE_FTYPE % 2147483647 == 1) |
| 220 | ? 1 : -1]];[]dnl | 208 | ? 1 : -1]];[]dnl |
| 221 | ]) | 209 | ]) |
| 210 | # Defined by Autoconf 2.71 and circa 2022 Gnulib unwisely depended on it. | ||
| 211 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], [_AC_SYS_LARGEFILE_TEST_CODE]) | ||
| 222 | 212 | ||
| 223 | # _AC_SYS_LARGEFILE_OPTIONS | 213 | # _AC_SYS_LARGEFILE_OPTIONS |
| 224 | # ------------------------- | 214 | # ------------------------- |
| @@ -228,8 +218,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_CODE], | |||
| 228 | m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( | 218 | m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( |
| 229 | ["none needed"] dnl Most current systems | 219 | ["none needed"] dnl Most current systems |
| 230 | ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec | 220 | ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec |
| 231 | ["-D_LARGE_FILES=1"] dnl AIX (which versions?) | 221 | ["-D_LARGE_FILES=1"] dnl 32-bit AIX 4.2.1+, 32-bit z/OS |
| 232 | ["-n32"] dnl Irix 6.2 w/ SGI compiler | ||
| 233 | )) | 222 | )) |
| 234 | 223 | ||
| 235 | # _AC_SYS_LARGEFILE_PROBE | 224 | # _AC_SYS_LARGEFILE_PROBE |
| @@ -246,24 +235,43 @@ m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( | |||
| 246 | # If you change this macro you may also need to change | 235 | # If you change this macro you may also need to change |
| 247 | # _AC_SYS_LARGEFILE_OPTIONS. | 236 | # _AC_SYS_LARGEFILE_OPTIONS. |
| 248 | AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], | 237 | AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], |
| 249 | [AC_CACHE_CHECK([for $CC option to enable large file support], | 238 | [AC_CACHE_CHECK([for $CC option to support large files], |
| 250 | [ac_cv_sys_largefile_opts], | 239 | [ac_cv_sys_largefile_opts], |
| 251 | [ac_save_CC="$CC" | 240 | [ac_save_CPPFLAGS=$CPPFLAGS |
| 252 | ac_opt_found=no | 241 | ac_opt_found=no |
| 253 | for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do | 242 | for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do |
| 254 | AS_IF([test x"$ac_opt" != x"none needed"], | 243 | AS_IF([test x"$ac_opt" != x"none needed"], |
| 255 | [CC="$ac_save_CC $ac_opt"]) | 244 | [CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"]) |
| 256 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])], | 245 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])], |
| 257 | [ac_cv_sys_largefile_opts="$ac_opt" | 246 | [AS_IF([test x"$ac_opt" = x"none needed"], |
| 247 | [# GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t. | ||
| 248 | CPPFLAGS="$CPPFLAGS -DFTYPE=ino_t" | ||
| 249 | AC_COMPILE_IFELSE([], [], | ||
| 250 | [CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" | ||
| 251 | AC_COMPILE_IFELSE([], [ac_opt='-D_FILE_OFFSET_BITS=64'])])]) | ||
| 252 | ac_cv_sys_largefile_opts=$ac_opt | ||
| 258 | ac_opt_found=yes]) | 253 | ac_opt_found=yes]) |
| 259 | test $ac_opt_found = no || break | 254 | test $ac_opt_found = no || break |
| 260 | done | 255 | done |
| 261 | CC="$ac_save_CC" | 256 | CPPFLAGS=$ac_save_CPPFLAGS |
| 257 | dnl Gnulib implements large file support for native Windows, based on the | ||
| 258 | dnl variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE. | ||
| 259 | m4_ifdef([gl_LARGEFILE], [ | ||
| 260 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
| 261 | if test $ac_opt_found != yes; then | ||
| 262 | AS_CASE([$host_os], | ||
| 263 | [mingw* | windows*], | ||
| 264 | [ac_cv_sys_largefile_opts="supported through gnulib" | ||
| 265 | ac_opt_found=yes] | ||
| 266 | ) | ||
| 267 | fi | ||
| 268 | ]) | ||
| 262 | test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"]) | 269 | test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"]) |
| 263 | 270 | ||
| 264 | ac_have_largefile=yes | 271 | ac_have_largefile=yes |
| 265 | AS_CASE([$ac_cv_sys_largefile_opts], | 272 | AS_CASE([$ac_cv_sys_largefile_opts], |
| 266 | ["none needed"], [], | 273 | ["none needed"], [], |
| 274 | ["supported through gnulib"], [], | ||
| 267 | ["support not detected"], | 275 | ["support not detected"], |
| 268 | [ac_have_largefile=no], | 276 | [ac_have_largefile=no], |
| 269 | 277 | ||
| @@ -275,45 +283,29 @@ AS_CASE([$ac_cv_sys_largefile_opts], | |||
| 275 | [AC_DEFINE([_LARGE_FILES], [1], | 283 | [AC_DEFINE([_LARGE_FILES], [1], |
| 276 | [Define to 1 on platforms where this makes off_t a 64-bit type.])], | 284 | [Define to 1 on platforms where this makes off_t a 64-bit type.])], |
| 277 | 285 | ||
| 278 | ["-n32"], | ||
| 279 | [CC="$CC -n32"], | ||
| 280 | |||
| 281 | [AC_MSG_ERROR( | 286 | [AC_MSG_ERROR( |
| 282 | [internal error: bad value for \$ac_cv_sys_largefile_opts])]) | 287 | [internal error: bad value for \$ac_cv_sys_largefile_opts])]) |
| 283 | 288 | ||
| 284 | _AC_SYS_YEAR2038_OPT_IN | 289 | AS_IF([test "$enable_year2038" != no], |
| 285 | ]) | 290 | [_AC_SYS_YEAR2038_PROBE]) |
| 286 | 291 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])]) | |
| 287 | # _AC_SYS_LARGEFILE_ENABLE | ||
| 288 | # ------------------------ | ||
| 289 | # Subroutine of AC_SYS_LARGEFILE. Note that this | ||
| 290 | # is expanded very late and therefore there cannot be any code in the | ||
| 291 | # AC_ARG_ENABLE. The default value for enable_largefile is emitted | ||
| 292 | # unconditionally because the generated shell code always looks at | ||
| 293 | # this variable. | ||
| 294 | m4_define([_AC_SYS_LARGEFILE_ENABLE], | ||
| 295 | [m4_divert_text([DEFAULTS], | ||
| 296 | enable_largefile=yes)]dnl | ||
| 297 | [AC_ARG_ENABLE([largefile], | ||
| 298 | [AS_HELP_STRING([--disable-largefile], [omit support for large files])])]) | ||
| 299 | 292 | ||
| 300 | # AC_SYS_LARGEFILE | 293 | # AC_SYS_LARGEFILE |
| 301 | # ---------------- | 294 | # ---------------- |
| 302 | # By default, many hosts won't let programs access large files; | 295 | # By default, many hosts won't let programs access large files; |
| 303 | # one must use special compiler options to get large-file access to work. | 296 | # one must use special compiler options to get large-file access to work. |
| 304 | # For more details about this brain damage please see: | 297 | # For more details about this brain damage please see: |
| 305 | # http://www.unix.org/version2/whatsnew/lfs20mar.html | 298 | # https://www.unix.org/version2/whatsnew/lfs20mar.html |
| 306 | # Additionally, on Linux file systems with 64-bit inodes a file that happens | 299 | # Additionally, on Linux file systems with 64-bit inodes a file that happens |
| 307 | # to have a 64-bit inode number cannot be accessed by 32-bit applications on | 300 | # to have a 64-bit inode number cannot be accessed by 32-bit applications on |
| 308 | # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. | 301 | # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. |
| 309 | # This macro allows configuration to continue if the system doesn't support | ||
| 310 | # large files. | ||
| 311 | AC_DEFUN([AC_SYS_LARGEFILE], | 302 | AC_DEFUN([AC_SYS_LARGEFILE], |
| 312 | [m4_provide_if([_AC_SYS_LARGEFILE_PROBE], [], [dnl | 303 | [AC_ARG_ENABLE([largefile], |
| 313 | AS_IF([test "$enable_largefile" != no], [_AC_SYS_LARGEFILE_PROBE]) | 304 | [AS_HELP_STRING([--disable-largefile], |
| 314 | AC_CONFIG_COMMANDS_PRE([_AC_SYS_LARGEFILE_ENABLE]) | 305 | [omit support for large files])])dnl |
| 315 | ])]) | 306 | AS_IF([test "$enable_largefile,$enable_year2038" != no,no], |
| 316 | ])# m4_ifndef AC_SYS_YEAR2038 | 307 | [_AC_SYS_LARGEFILE_PROBE])]) |
| 308 | ])# m4_ifndef AC_SYS_YEAR2038_RECOMMENDED | ||
| 317 | 309 | ||
| 318 | # Enable large files on systems where this is implemented by Gnulib, not by the | 310 | # Enable large files on systems where this is implemented by Gnulib, not by the |
| 319 | # system headers. | 311 | # system headers. |
| @@ -323,7 +315,7 @@ AC_DEFUN([gl_LARGEFILE], | |||
| 323 | [ | 315 | [ |
| 324 | AC_REQUIRE([AC_CANONICAL_HOST]) | 316 | AC_REQUIRE([AC_CANONICAL_HOST]) |
| 325 | case "$host_os" in | 317 | case "$host_os" in |
| 326 | mingw*) | 318 | mingw* | windows*) |
| 327 | dnl Native Windows. | 319 | dnl Native Windows. |
| 328 | dnl mingw64 defines off_t to a 64-bit type already, if | 320 | dnl mingw64 defines off_t to a 64-bit type already, if |
| 329 | dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. | 321 | dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. |
