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