2
0

extra_largefile.m4 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. dnl By default, many hosts won't let programs access large files;
  2. dnl one must use special compiler options to get large-file access to work.
  3. dnl For more details about this brain damage please see:
  4. dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
  5. dnl Written by Paul Eggert <eggert@twinsun.com>.
  6. dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
  7. dnl MN_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
  8. AC_DEFUN([MN_SYS_EXTRA_LARGEFILE_FLAGS],
  9. [AC_CACHE_CHECK([for $1 value to request large file support],
  10. ac_cv_sys_largefile_$1,
  11. [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
  12. ac_cv_sys_largefile_$1=no
  13. ifelse($1, CFLAGS,
  14. [case "$host_os" in
  15. # IRIX 6.2 and later require cc -n32.
  16. changequote(, )dnl
  17. irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
  18. changequote([, ])dnl
  19. if test "$GCC" != yes; then
  20. ac_cv_sys_largefile_CFLAGS=-n32
  21. fi
  22. ac_save_CC="$CC"
  23. CC="$CC $ac_cv_sys_largefile_CFLAGS"
  24. AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
  25. CC="$ac_save_CC"
  26. esac])
  27. }])])
  28. dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
  29. dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
  30. AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
  31. [case $2 in
  32. no) ;;
  33. ?*)
  34. case "[$]$1" in
  35. '') $1=$2 ;;
  36. *) $1=[$]$1' '$2 ;;
  37. esac ;;
  38. esac])
  39. dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
  40. dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
  41. AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
  42. [AC_CACHE_CHECK([for $1], $2,
  43. [$2=no
  44. changequote(, )dnl
  45. $4
  46. for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
  47. case "$ac_flag" in
  48. -D$1)
  49. $2=1 ;;
  50. -D$1=*)
  51. $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
  52. esac
  53. done
  54. changequote([, ])dnl
  55. ])
  56. if test "[$]$2" != no; then
  57. AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
  58. fi])
  59. AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
  60. [AC_REQUIRE([AC_CANONICAL_HOST])
  61. AC_ARG_ENABLE(largefile,
  62. [ --disable-largefile omit support for large files])
  63. if test "$enable_largefile" != no; then
  64. AC_CHECK_TOOL(GETCONF, getconf)
  65. MN_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
  66. MN_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
  67. MN_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
  68. for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
  69. case "$ac_flag" in
  70. no) ;;
  71. -D_FILE_OFFSET_BITS=*) ;;
  72. -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
  73. -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
  74. -D?* | -I?*)
  75. AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
  76. *)
  77. AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
  78. esac
  79. done
  80. AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
  81. AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
  82. AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
  83. ac_cv_sys_file_offset_bits,
  84. [Number of bits in a file offset, on hosts where this is settable.])
  85. [case "$host_os" in
  86. # HP-UX 10.20 and later
  87. hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
  88. ac_cv_sys_file_offset_bits=64 ;;
  89. esac]
  90. AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
  91. ac_cv_sys_largefile_source,
  92. [Define to make fseeko etc. visible, on some hosts.],
  93. [case "$host_os" in
  94. # HP-UX 10.20 and later
  95. hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
  96. ac_cv_sys_largefile_source=1 ;;
  97. esac])
  98. AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
  99. ac_cv_sys_large_files,
  100. [Define for large files, on AIX-style hosts.],
  101. [case "$host_os" in
  102. # AIX 4.2 and later
  103. aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
  104. ac_cv_sys_large_files=1 ;;
  105. esac])
  106. fi
  107. ])