diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-11-17 01:05:54 +0100 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-07-24 19:35:11 +0200 |
commit | a405fc138596f552581d2011fd6de02d5c8186c4 (patch) | |
tree | 4c084700b5cb5e9fcedf982a2d921bbc41d9935a /gl/m4/largefile.m4 | |
parent | 9f2a9ca3d72023ff9b5707d1872c54d65edc9017 (diff) | |
download | monitoring-plugins-a405fc138596f552581d2011fd6de02d5c8186c4.tar.gz |
Sync with the latest Gnulib code (1a268176f)
Diffstat (limited to 'gl/m4/largefile.m4')
-rw-r--r-- | gl/m4/largefile.m4 | 82 |
1 files changed, 58 insertions, 24 deletions
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4 index 1e605e3d..fbde5e66 100644 --- a/gl/m4/largefile.m4 +++ b/gl/m4/largefile.m4 | |||
@@ -1,28 +1,47 @@ | |||
1 | # Enable large files on systems where this is not the default. | 1 | # 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. | ||
2 | 3 | ||
3 | # Copyright 1992-1996, 1998-2013 Free Software Foundation, Inc. | 4 | # Copyright 1992-1996, 1998-2021 Free Software Foundation, Inc. |
4 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
5 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
6 | # with or without modifications, as long as this notice is preserved. | 7 | # with or without modifications, as long as this notice is preserved. |
7 | 8 | ||
8 | # The following implementation works around a problem in autoconf <= 2.69; | 9 | # 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 | ||
11 | # setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko | ||
12 | # and ftello in C++ mode as well. | ||
13 | AC_DEFUN([gl_SET_LARGEFILE_SOURCE], | ||
14 | [ | ||
15 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
16 | AC_FUNC_FSEEKO | ||
17 | case "$host_os" in | ||
18 | hpux*) | ||
19 | AC_DEFINE([_LARGEFILE_SOURCE], [1], | ||
20 | [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).]) | ||
21 | ;; | ||
22 | esac | ||
23 | ]) | ||
24 | |||
25 | # Work around a problem in Autoconf through at least 2.71 on glibc 2.34+ | ||
26 | # with _TIME_BITS. Also, work around a problem in autoconf <= 2.69: | ||
9 | # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, | 27 | # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, |
10 | # or configures them incorrectly in some cases. | 28 | # or configures them incorrectly in some cases. |
11 | m4_version_prereq([2.70], [] ,[ | 29 | m4_version_prereq([2.70], [], [ |
12 | 30 | ||
13 | # _AC_SYS_LARGEFILE_TEST_INCLUDES | 31 | # _AC_SYS_LARGEFILE_TEST_INCLUDES |
14 | # ------------------------------- | 32 | # ------------------------------- |
15 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], | 33 | m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], |
16 | [@%:@include <sys/types.h> | 34 | [#include <sys/types.h> |
17 | /* Check that off_t can represent 2**63 - 1 correctly. | 35 | /* Check that off_t can represent 2**63 - 1 correctly. |
18 | We can't simply define LARGE_OFF_T to be 9223372036854775807, | 36 | We can't simply define LARGE_OFF_T to be 9223372036854775807, |
19 | since some C++ compilers masquerading as C compilers | 37 | since some C++ compilers masquerading as C compilers |
20 | incorrectly reject 9223372036854775807. */ | 38 | incorrectly reject 9223372036854775807. */ |
21 | @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | 39 | #define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) |
22 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 | 40 | int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 |
23 | && LARGE_OFF_T % 2147483647 == 1) | 41 | && LARGE_OFF_T % 2147483647 == 1) |
24 | ? 1 : -1]];[]dnl | 42 | ? 1 : -1]];[]dnl |
25 | ]) | 43 | ]) |
44 | ])# m4_version_prereq 2.70 | ||
26 | 45 | ||
27 | 46 | ||
28 | # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, | 47 | # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, |
@@ -37,7 +56,8 @@ m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], | |||
37 | [AC_LANG_PROGRAM([$5], [$6])], | 56 | [AC_LANG_PROGRAM([$5], [$6])], |
38 | [$3=no; break]) | 57 | [$3=no; break]) |
39 | m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( | 58 | m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( |
40 | [AC_LANG_PROGRAM([@%:@define $1 $2 | 59 | [AC_LANG_PROGRAM([#undef $1 |
60 | #define $1 $2 | ||
41 | $5], [$6])], | 61 | $5], [$6])], |
42 | [$3=$2; break]) | 62 | [$3=$2; break]) |
43 | $3=unknown | 63 | $3=unknown |
@@ -56,13 +76,15 @@ rm -rf conftest*[]dnl | |||
56 | # By default, many hosts won't let programs access large files; | 76 | # By default, many hosts won't let programs access large files; |
57 | # one must use special compiler options to get large-file access to work. | 77 | # one must use special compiler options to get large-file access to work. |
58 | # For more details about this brain damage please see: | 78 | # For more details about this brain damage please see: |
59 | # http://www.unix-systems.org/version2/whatsnew/lfs20mar.html | 79 | # http://www.unix.org/version2/whatsnew/lfs20mar.html |
80 | # Additionally, on Linux file systems with 64-bit inodes a file that happens | ||
81 | # to have a 64-bit inode number cannot be accessed by 32-bit applications on | ||
82 | # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. | ||
60 | AC_DEFUN([AC_SYS_LARGEFILE], | 83 | AC_DEFUN([AC_SYS_LARGEFILE], |
61 | [AC_ARG_ENABLE(largefile, | 84 | [AC_ARG_ENABLE(largefile, |
62 | [ --disable-largefile omit support for large files]) | 85 | [ --disable-largefile omit support for large files]) |
63 | if test "$enable_largefile" != no; then | 86 | AS_IF([test "$enable_largefile" != no], |
64 | 87 | [AC_CACHE_CHECK([for special C compiler options needed for large files], | |
65 | AC_CACHE_CHECK([for special C compiler options needed for large files], | ||
66 | ac_cv_sys_largefile_CC, | 88 | ac_cv_sys_largefile_CC, |
67 | [ac_cv_sys_largefile_CC=no | 89 | [ac_cv_sys_largefile_CC=no |
68 | if test "$GCC" != yes; then | 90 | if test "$GCC" != yes; then |
@@ -87,18 +109,15 @@ if test "$enable_largefile" != no; then | |||
87 | ac_cv_sys_file_offset_bits, | 109 | ac_cv_sys_file_offset_bits, |
88 | [Number of bits in a file offset, on hosts where this is settable.], | 110 | [Number of bits in a file offset, on hosts where this is settable.], |
89 | [_AC_SYS_LARGEFILE_TEST_INCLUDES]) | 111 | [_AC_SYS_LARGEFILE_TEST_INCLUDES]) |
90 | if test $ac_cv_sys_file_offset_bits = unknown; then | 112 | AS_CASE([$ac_cv_sys_file_offset_bits], |
91 | _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, | 113 | [unknown], |
92 | ac_cv_sys_large_files, | 114 | [_AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1], |
93 | [Define for large files, on AIX-style hosts.], | 115 | [ac_cv_sys_large_files], |
94 | [_AC_SYS_LARGEFILE_TEST_INCLUDES]) | 116 | [Define for large files, on AIX-style hosts.], |
95 | fi | 117 | [_AC_SYS_LARGEFILE_TEST_INCLUDES])], |
96 | 118 | [64], | |
97 | AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1], | 119 | [gl_YEAR2038_BODY([])])]) |
98 | [Enable large inode numbers on Mac OS X 10.5.]) | ||
99 | fi | ||
100 | ])# AC_SYS_LARGEFILE | 120 | ])# AC_SYS_LARGEFILE |
101 | ])# m4_version_prereq 2.70 | ||
102 | 121 | ||
103 | # Enable large files on systems where this is implemented by Gnulib, not by the | 122 | # Enable large files on systems where this is implemented by Gnulib, not by the |
104 | # system headers. | 123 | # system headers. |
@@ -126,9 +145,24 @@ AC_DEFUN([gl_LARGEFILE], | |||
126 | else | 145 | else |
127 | WINDOWS_64_BIT_OFF_T=0 | 146 | WINDOWS_64_BIT_OFF_T=0 |
128 | fi | 147 | fi |
129 | dnl But all native Windows platforms (including mingw64) have a 32-bit | 148 | dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat' |
130 | dnl st_size member in 'struct stat'. | 149 | dnl to 'struct _stat32i64' or 'struct _stat64' (depending on |
131 | WINDOWS_64_BIT_ST_SIZE=1 | 150 | dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member. |
151 | AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64], | ||
152 | [AC_COMPILE_IFELSE( | ||
153 | [AC_LANG_PROGRAM( | ||
154 | [[#include <sys/types.h> | ||
155 | struct stat buf; | ||
156 | int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; | ||
157 | ]], | ||
158 | [[]])], | ||
159 | [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no]) | ||
160 | ]) | ||
161 | if test $gl_cv_member_st_size_64 = no; then | ||
162 | WINDOWS_64_BIT_ST_SIZE=1 | ||
163 | else | ||
164 | WINDOWS_64_BIT_ST_SIZE=0 | ||
165 | fi | ||
132 | ;; | 166 | ;; |
133 | *) | 167 | *) |
134 | dnl Nothing to do on gnulib's side. | 168 | dnl Nothing to do on gnulib's side. |