Annotation of embedaddon/libiconv/srcm4/largefile.m4, revision 1.1.1.2
1.1 misho 1: # Enable large files on systems where this is not the default.
2:
1.1.1.2 ! misho 3: # Copyright 1992-1996, 1998-2019 Free Software Foundation, Inc.
1.1 misho 4: # This file is free software; the Free Software Foundation
5: # gives unlimited permission to copy and/or distribute it,
6: # with or without modifications, as long as this notice is preserved.
7:
1.1.1.2 ! misho 8: # The following implementation works around a problem in autoconf <= 2.69;
! 9: # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
! 10: # or configures them incorrectly in some cases.
! 11: m4_version_prereq([2.70], [] ,[
1.1 misho 12:
13: # _AC_SYS_LARGEFILE_TEST_INCLUDES
14: # -------------------------------
15: m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
16: [@%:@include <sys/types.h>
17: /* Check that off_t can represent 2**63 - 1 correctly.
18: We can't simply define LARGE_OFF_T to be 9223372036854775807,
19: since some C++ compilers masquerading as C compilers
20: incorrectly reject 9223372036854775807. */
21: @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
22: int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
1.1.1.2 ! misho 23: && LARGE_OFF_T % 2147483647 == 1)
! 24: ? 1 : -1]];[]dnl
1.1 misho 25: ])
26:
27:
28: # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
1.1.1.2 ! misho 29: # CACHE-VAR,
! 30: # DESCRIPTION,
! 31: # PROLOGUE, [FUNCTION-BODY])
1.1 misho 32: # --------------------------------------------------------
33: m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
34: [AC_CACHE_CHECK([for $1 value needed for large files], [$3],
35: [while :; do
36: m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
37: [AC_LANG_PROGRAM([$5], [$6])],
38: [$3=no; break])
39: m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
40: [AC_LANG_PROGRAM([@%:@define $1 $2
41: $5], [$6])],
42: [$3=$2; break])
43: $3=unknown
44: break
45: done])
46: case $$3 in #(
47: no | unknown) ;;
48: *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
49: esac
50: rm -rf conftest*[]dnl
51: ])# _AC_SYS_LARGEFILE_MACRO_VALUE
52:
53:
54: # AC_SYS_LARGEFILE
55: # ----------------
56: # 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.
58: # For more details about this brain damage please see:
59: # http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
60: AC_DEFUN([AC_SYS_LARGEFILE],
61: [AC_ARG_ENABLE(largefile,
1.1.1.2 ! misho 62: [ --disable-largefile omit support for large files])
1.1 misho 63: if test "$enable_largefile" != no; then
64:
65: AC_CACHE_CHECK([for special C compiler options needed for large files],
66: ac_cv_sys_largefile_CC,
67: [ac_cv_sys_largefile_CC=no
68: if test "$GCC" != yes; then
69: ac_save_CC=$CC
70: while :; do
1.1.1.2 ! misho 71: # IRIX 6.2 and later do not support large files by default,
! 72: # so use the C compiler's -n32 option if that helps.
! 73: AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
! 74: AC_COMPILE_IFELSE([], [break])
! 75: CC="$CC -n32"
! 76: AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
! 77: break
1.1 misho 78: done
79: CC=$ac_save_CC
80: rm -f conftest.$ac_ext
81: fi])
82: if test "$ac_cv_sys_largefile_CC" != no; then
83: CC=$CC$ac_cv_sys_largefile_CC
84: fi
85:
86: _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
87: ac_cv_sys_file_offset_bits,
88: [Number of bits in a file offset, on hosts where this is settable.],
89: [_AC_SYS_LARGEFILE_TEST_INCLUDES])
90: if test $ac_cv_sys_file_offset_bits = unknown; then
91: _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
92: ac_cv_sys_large_files,
93: [Define for large files, on AIX-style hosts.],
94: [_AC_SYS_LARGEFILE_TEST_INCLUDES])
95: fi
96:
1.1.1.2 ! misho 97: AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1],
! 98: [Enable large inode numbers on Mac OS X 10.5.])
1.1 misho 99: fi
100: ])# AC_SYS_LARGEFILE
1.1.1.2 ! misho 101: ])# m4_version_prereq 2.70
1.1 misho 102:
1.1.1.2 ! misho 103: # Enable large files on systems where this is implemented by Gnulib, not by the
! 104: # system headers.
! 105: # Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib
! 106: # overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively.
! 107: AC_DEFUN([gl_LARGEFILE],
! 108: [
! 109: AC_REQUIRE([AC_CANONICAL_HOST])
! 110: case "$host_os" in
! 111: mingw*)
! 112: dnl Native Windows.
! 113: dnl mingw64 defines off_t to a 64-bit type already, if
! 114: dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE.
! 115: AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64],
! 116: [AC_COMPILE_IFELSE(
! 117: [AC_LANG_PROGRAM(
! 118: [[#include <sys/types.h>
! 119: int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
! 120: ]],
! 121: [[]])],
! 122: [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no])
! 123: ])
! 124: if test $gl_cv_type_off_t_64 = no; then
! 125: WINDOWS_64_BIT_OFF_T=1
! 126: else
! 127: WINDOWS_64_BIT_OFF_T=0
! 128: fi
! 129: dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat'
! 130: dnl to 'struct _stat32i64' or 'struct _stat64' (depending on
! 131: dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member.
! 132: AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64],
! 133: [AC_COMPILE_IFELSE(
! 134: [AC_LANG_PROGRAM(
! 135: [[#include <sys/types.h>
! 136: struct stat buf;
! 137: int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1];
! 138: ]],
! 139: [[]])],
! 140: [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no])
! 141: ])
! 142: if test $gl_cv_member_st_size_64 = no; then
! 143: WINDOWS_64_BIT_ST_SIZE=1
! 144: else
! 145: WINDOWS_64_BIT_ST_SIZE=0
! 146: fi
! 147: ;;
! 148: *)
! 149: dnl Nothing to do on gnulib's side.
! 150: dnl A 64-bit off_t is
! 151: dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX,
! 152: dnl OSF/1, Cygwin,
! 153: dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
! 154: dnl glibc, HP-UX, Solaris,
! 155: dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
! 156: dnl - impossible to achieve on Minix 3.1.8.
! 157: WINDOWS_64_BIT_OFF_T=0
! 158: WINDOWS_64_BIT_ST_SIZE=0
! 159: ;;
! 160: esac
! 161: ])
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>