]> Savannah Git Hosting - gnulib.git/commitdiff
largefile: port to GNU/Linux alpha and s390x
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 19 Jun 2023 21:08:06 +0000 (14:08 -0700)
committerBruno Haible <bruno@clisp.org>
Sat, 1 Jul 2023 08:28:08 +0000 (10:28 +0200)
This patch syncs from Autoconf master.
Problem reported by Matoro <https://bugs.gnu.org/64123>.
* lib/autoconf/specific.m4 (_AC_SYS_LARGEFILE_TEST_CODE):
New overridable macro FTYPE, to test types other than off_t.
(_AC_SYS_LARGEFILE_TEST_CODE): Test ino_t for
-D_FILE_OFFSETBITS=64 too, if no flags are needed for off_t.
Needed for GNU/Linux on alpha and s390x.

ChangeLog
m4/largefile.m4

index 26df390f94a09266c8b9bf360aae728d6db20763..b720f233b8ab6c575456ce668f46ee5873c93e9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-06-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       largefile: port to GNU/Linux s390x and alpha
+       This patch syncs from Autoconf master.
+       Problem reported by Matoro <https://bugs.gnu.org/64123>.
+       * lib/autoconf/specific.m4 (_AC_SYS_LARGEFILE_TEST_CODE):
+       New overridable macro FTYPE, to test types other than off_t.
+       (_AC_SYS_LARGEFILE_TEST_CODE): Test ino_t for
+       -D_FILE_OFFSETBITS=64 too, if no flags are needed for off_t.
+       Needed for GNU/Linux on alpha and s390x.
+
 2023-06-15  Bruno Haible  <bruno@clisp.org>
 
        aligned-malloc, rmdir-errno: Sanitize configuration test result.
index 7fb81b864af106f245d22d334f4ceb076add33f9..de55f6353c91017c215139b65681ee46f1b8b30d 100644 (file)
@@ -210,13 +210,16 @@ AC_DEFUN([AC_SYS_YEAR2038],
 # 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,
+@%:@ifndef FTYPE
+@%:@ define FTYPE off_t
+@%:@endif
+ /* Check that FTYPE can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_FTYPE to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-@%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
-  int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
-                      && LARGE_OFF_T % 2147483647 == 1)
+@%:@define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31))
+  int FTYPE_is_large[[(LARGE_FTYPE % 2147483629 == 721
+                      && LARGE_FTYPE % 2147483647 == 1)
                      ? 1 : -1]];[]dnl
 ])
 
@@ -254,7 +257,13 @@ AC_DEFUN([_AC_SYS_LARGEFILE_PROBE],
     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"
+     [AS_IF([test x"$ac_opt" = x"none needed"],
+       [# GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t.
+        CC="$CC -DFTYPE=ino_t"
+        AC_COMPILE_IFELSE([], [],
+          [CC="$CC -D_FILE_OFFSET_BITS=64"
+           AC_COMPILE_IFELSE([], [ac_opt='-D_FILE_OFFSET_BITS=64'])])])
+      ac_cv_sys_largefile_opts=$ac_opt
       ac_opt_found=yes])
     test $ac_opt_found = no || break
   done