Update Gnulib to the latest git version
[deliverable/binutils-gdb.git] / gnulib / import / m4 / largefile.m4
index 8bbdfaac1dbf8b7bda345d7c72149fece4a61107..65d5a15183e5712df532be65a3236ce2b4536848 100644 (file)
@@ -1,10 +1,26 @@
 # Enable large files on systems where this is not the default.
 
-# Copyright 1992-1996, 1998-2016 Free Software Foundation, Inc.
+# Copyright 1992-1996, 1998-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO:
+# It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this
+# setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko
+# and ftello in C++ mode as well.
+AC_DEFUN([gl_SET_LARGEFILE_SOURCE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_FUNC_FSEEKO
+  case "$host_os" in
+    hpux*)
+      AC_DEFINE([_LARGEFILE_SOURCE], [1],
+        [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).])
+      ;;
+  esac
+])
+
 # The following implementation works around a problem in autoconf <= 2.69;
 # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
 # or configures them incorrectly in some cases.
@@ -56,7 +72,7 @@ rm -rf conftest*[]dnl
 # By default, many hosts won't let programs access large files;
 # one must use special compiler options to get large-file access to work.
 # For more details about this brain damage please see:
-# http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
+# http://www.unix.org/version2/whatsnew/lfs20mar.html
 AC_DEFUN([AC_SYS_LARGEFILE],
 [AC_ARG_ENABLE(largefile,
                [  --disable-largefile     omit support for large files])
@@ -126,9 +142,24 @@ AC_DEFUN([gl_LARGEFILE],
       else
         WINDOWS_64_BIT_OFF_T=0
       fi
-      dnl But all native Windows platforms (including mingw64) have a 32-bit
-      dnl st_size member in 'struct stat'.
-      WINDOWS_64_BIT_ST_SIZE=1
+      dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat'
+      dnl to 'struct _stat32i64' or 'struct _stat64' (depending on
+      dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member.
+      AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <sys/types.h>
+                struct stat buf;
+                int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1];
+              ]],
+              [[]])],
+           [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no])
+        ])
+      if test $gl_cv_member_st_size_64 = no; then
+        WINDOWS_64_BIT_ST_SIZE=1
+      else
+        WINDOWS_64_BIT_ST_SIZE=0
+      fi
       ;;
     *)
       dnl Nothing to do on gnulib's side.
This page took 0.026988 seconds and 4 git commands to generate.