Chris@0: dnl By default, many hosts won't let programs access large files; Chris@0: dnl one must use special compiler options to get large-file access to work. Chris@0: dnl For more details about this brain damage please see: Chris@0: dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html Chris@0: Chris@0: dnl Written by Paul Eggert . Chris@0: Chris@0: dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE. Chris@0: dnl MN_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME) Chris@0: AC_DEFUN([MN_SYS_EXTRA_LARGEFILE_FLAGS], Chris@0: [AC_CACHE_CHECK([for $1 value to request large file support], Chris@0: ac_cv_sys_largefile_$1, Chris@0: [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || { Chris@0: ac_cv_sys_largefile_$1=no Chris@0: ifelse($1, CFLAGS, Chris@0: [case "$host_os" in Chris@0: # IRIX 6.2 and later require cc -n32. Chris@0: changequote(, )dnl Chris@0: irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) Chris@0: changequote([, ])dnl Chris@0: if test "$GCC" != yes; then Chris@0: ac_cv_sys_largefile_CFLAGS=-n32 Chris@0: fi Chris@0: ac_save_CC="$CC" Chris@0: CC="$CC $ac_cv_sys_largefile_CFLAGS" Chris@0: AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) Chris@0: CC="$ac_save_CC" Chris@0: esac]) Chris@0: }])]) Chris@0: Chris@0: dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE. Chris@0: dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL) Chris@0: AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND], Chris@0: [case $2 in Chris@0: no) ;; Chris@0: ?*) Chris@0: case "[$]$1" in Chris@0: '') $1=$2 ;; Chris@0: *) $1=[$]$1' '$2 ;; Chris@0: esac ;; Chris@0: esac]) Chris@0: Chris@0: dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE. Chris@0: dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) Chris@0: AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE], Chris@0: [AC_CACHE_CHECK([for $1], $2, Chris@0: [$2=no Chris@0: changequote(, )dnl Chris@0: $4 Chris@0: for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do Chris@0: case "$ac_flag" in Chris@0: -D$1) Chris@0: $2=1 ;; Chris@0: -D$1=*) Chris@0: $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; Chris@0: esac Chris@0: done Chris@0: changequote([, ])dnl Chris@0: ]) Chris@0: if test "[$]$2" != no; then Chris@0: AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) Chris@0: fi]) Chris@0: Chris@0: AC_DEFUN([AC_SYS_EXTRA_LARGEFILE], Chris@0: [AC_REQUIRE([AC_CANONICAL_HOST]) Chris@0: AC_ARG_ENABLE(largefile, Chris@0: [ --disable-largefile omit support for large files]) Chris@0: if test "$enable_largefile" != no; then Chris@0: AC_CHECK_TOOL(GETCONF, getconf) Chris@0: MN_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS) Chris@0: MN_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS) Chris@0: MN_SYS_EXTRA_LARGEFILE_FLAGS(LIBS) Chris@0: Chris@0: for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do Chris@0: case "$ac_flag" in Chris@0: no) ;; Chris@0: -D_FILE_OFFSET_BITS=*) ;; Chris@0: -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; Chris@0: -D_LARGE_FILES | -D_LARGE_FILES=*) ;; Chris@0: -D?* | -I?*) Chris@0: AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; Chris@0: *) Chris@0: AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; Chris@0: esac Chris@0: done Chris@0: AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") Chris@0: AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") Chris@0: AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, Chris@0: ac_cv_sys_file_offset_bits, Chris@0: [Number of bits in a file offset, on hosts where this is settable.]) Chris@0: [case "$host_os" in Chris@0: # HP-UX 10.20 and later Chris@0: hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) Chris@0: ac_cv_sys_file_offset_bits=64 ;; Chris@0: esac] Chris@0: AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, Chris@0: ac_cv_sys_largefile_source, Chris@0: [Define to make fseeko etc. visible, on some hosts.], Chris@0: [case "$host_os" in Chris@0: # HP-UX 10.20 and later Chris@0: hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) Chris@0: ac_cv_sys_largefile_source=1 ;; Chris@0: esac]) Chris@0: AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES, Chris@0: ac_cv_sys_large_files, Chris@0: [Define for large files, on AIX-style hosts.], Chris@0: [case "$host_os" in Chris@0: # AIX 4.2 and later Chris@0: aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) Chris@0: ac_cv_sys_large_files=1 ;; Chris@0: esac]) Chris@0: fi Chris@0: ]) Chris@0: