largefile.m4 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Enable large files on systems where this is not the default.
  2. # Copyright 1992-1996, 1998-2011 Free Software Foundation, Inc.
  3. # This file is free software; the Free Software Foundation
  4. # gives unlimited permission to copy and/or distribute it,
  5. # with or without modifications, as long as this notice is preserved.
  6. # The following implementation works around a problem in autoconf <= 2.68;
  7. # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5.
  8. m4_version_prereq([2.69], [] ,[
  9. # _AC_SYS_LARGEFILE_TEST_INCLUDES
  10. # -------------------------------
  11. m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
  12. [@%:@include <sys/types.h>
  13. /* Check that off_t can represent 2**63 - 1 correctly.
  14. We can't simply define LARGE_OFF_T to be 9223372036854775807,
  15. since some C++ compilers masquerading as C compilers
  16. incorrectly reject 9223372036854775807. */
  17. @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  18. int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
  19. && LARGE_OFF_T % 2147483647 == 1)
  20. ? 1 : -1]];[]dnl
  21. ])
  22. # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
  23. # CACHE-VAR,
  24. # DESCRIPTION,
  25. # PROLOGUE, [FUNCTION-BODY])
  26. # --------------------------------------------------------
  27. m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
  28. [AC_CACHE_CHECK([for $1 value needed for large files], [$3],
  29. [while :; do
  30. m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
  31. [AC_LANG_PROGRAM([$5], [$6])],
  32. [$3=no; break])
  33. m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
  34. [AC_LANG_PROGRAM([@%:@define $1 $2
  35. $5], [$6])],
  36. [$3=$2; break])
  37. $3=unknown
  38. break
  39. done])
  40. case $$3 in #(
  41. no | unknown) ;;
  42. *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
  43. esac
  44. rm -rf conftest*[]dnl
  45. ])# _AC_SYS_LARGEFILE_MACRO_VALUE
  46. # AC_SYS_LARGEFILE
  47. # ----------------
  48. # By default, many hosts won't let programs access large files;
  49. # one must use special compiler options to get large-file access to work.
  50. # For more details about this brain damage please see:
  51. # http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
  52. AC_DEFUN([AC_SYS_LARGEFILE],
  53. [AC_ARG_ENABLE(largefile,
  54. [ --disable-largefile omit support for large files])
  55. if test "$enable_largefile" != no; then
  56. AC_CACHE_CHECK([for special C compiler options needed for large files],
  57. ac_cv_sys_largefile_CC,
  58. [ac_cv_sys_largefile_CC=no
  59. if test "$GCC" != yes; then
  60. ac_save_CC=$CC
  61. while :; do
  62. # IRIX 6.2 and later do not support large files by default,
  63. # so use the C compiler's -n32 option if that helps.
  64. AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
  65. AC_COMPILE_IFELSE([], [break])
  66. CC="$CC -n32"
  67. AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
  68. break
  69. done
  70. CC=$ac_save_CC
  71. rm -f conftest.$ac_ext
  72. fi])
  73. if test "$ac_cv_sys_largefile_CC" != no; then
  74. CC=$CC$ac_cv_sys_largefile_CC
  75. fi
  76. _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
  77. ac_cv_sys_file_offset_bits,
  78. [Number of bits in a file offset, on hosts where this is settable.],
  79. [_AC_SYS_LARGEFILE_TEST_INCLUDES])
  80. if test $ac_cv_sys_file_offset_bits = unknown; then
  81. _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
  82. ac_cv_sys_large_files,
  83. [Define for large files, on AIX-style hosts.],
  84. [_AC_SYS_LARGEFILE_TEST_INCLUDES])
  85. fi
  86. AH_VERBATIM([_DARWIN_USE_64_BIT_INODE],
  87. [/* Enable large inode numbers on Mac OS X. */
  88. #ifndef _DARWIN_USE_64_BIT_INODE
  89. # define _DARWIN_USE_64_BIT_INODE 1
  90. #endif])
  91. fi
  92. ])# AC_SYS_LARGEFILE
  93. ])# m4_version_prereq 2.69