summaryrefslogtreecommitdiff
path: root/m4/largefile.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-07-24 15:15:47 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-07-24 15:15:47 -0700
commit24e0f6b1dc721a919814b226834a4d027e9f90d0 (patch)
treeeb3edef13fd2275ab655eba6b83983b2e5513b0d /m4/largefile.m4
parentf25e39b45a5960f8f2bff6c43f88833bc04540a9 (diff)
downloademacs-24e0f6b1dc721a919814b226834a4d027e9f90d0.tar.gz
Merge from gnulib, using build-aux to remove clutter.
* m4/largefile.m4: New file, so that Emacs does not mess up when accessing files with large inode numbers in MacOS X 10.5 and later. * m4/nocrash.m4: New file, to avoid triggering background debugger and/or create core dumps during 'configure'. * build-aux/move-if-change: Renamed from move-if-change. * build-aux/snippet/arg-nonnull.h: Renamed from arg-nonnull.h. * build-aux/snippet/c++defs.h: Renamed from c++defs.h. * build-aux/snippet/warn-on-use.h: Renamed from warn-on-use.h. * build-aux/snippet/_Noreturn.h: New file, for draft C1X _Noreturn. * .bzrignore: The autogenerated files compile, config.guess, config.sub, depcomp, install-sh, and missing are now in build-aux. * Makefile.in (epaths-force, sync-from-gnulib): move-if-change is now in build-aux. (GNULIB_TOOL_FLAGS): Avoid threadlib; this is now a prerequisite of gnulib's pthread_sigmask module, but Emacs doesn't need it. (mkdir): install-sh is now in build-aux. * config.bat: c++defs.h is now in build-aux/snippets. * configure.in: Specify AC_CONFIG_AUX_DIR with build-aux (the usual parameter). * lib/gnulib.mk, m4/gl-comp.m4: Regenerate. * lib/makefile.w32-in (ARG_NONNULL_H): arg-nonnull.h moved to build-aux/snippet. * lib/pthread_sigmask.c, lib/stdlib.in.h, m4/extensions.m4: * m4/getopt.m4, m4/gnulib-common.m4, m4/pthread_sigmask.m4: Merge from gnuilib. This fixes porting bugs on Cygwin, Irix, and Solaris, enables MacOS extensions, and enables nocrash during 'configure'. * make-dist: Adjust to new build-aux and build-aux/snippit dirs. * admin/notes/copyright: The files compile, config.guess, config.sub, depcomp, install-sh, missing, and move-if-change are now in the new build-aux subdirectory. The files arg-nonnull.h, c++defs.h, and warn-on-use.h are now in build-aux/snippets. New file build-aux/snippets/_Noreturn.h. * leim/Makefile.in (install): install-sh is now in build-aux. * lib-src/Makefile.in ($(DESTDIR)${archlibdir}): install-sh moved to build-aux. * msdos/sedlibmk.inp (CONFIG_CLEAN_VPATH_FILES): Adjust to snippet moves from top level to build-aux/snippet. * src/Makefile.in (gl-stamp): move-if-change is now in build-aux.
Diffstat (limited to 'm4/largefile.m4')
-rw-r--r--m4/largefile.m4104
1 files changed, 104 insertions, 0 deletions
diff --git a/m4/largefile.m4 b/m4/largefile.m4
new file mode 100644
index 00000000000..6986244b396
--- /dev/null
+++ b/m4/largefile.m4
@@ -0,0 +1,104 @@
+# Enable large files on systems where this is not the default.
+
+# Copyright 1992-1996, 1998-2011 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 implementation works around a problem in autoconf <= 2.68;
+# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5.
+m4_version_prereq([2.69], [] ,[
+
+# _AC_SYS_LARGEFILE_TEST_INCLUDES
+# -------------------------------
+m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
+[@%:@include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1]];[]dnl
+])
+
+
+# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
+# CACHE-VAR,
+# DESCRIPTION,
+# PROLOGUE, [FUNCTION-BODY])
+# --------------------------------------------------------
+m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
+[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
+[while :; do
+ m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
+ [AC_LANG_PROGRAM([$5], [$6])],
+ [$3=no; break])
+ m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
+ [AC_LANG_PROGRAM([@%:@define $1 $2
+$5], [$6])],
+ [$3=$2; break])
+ $3=unknown
+ break
+done])
+case $$3 in #(
+ no | unknown) ;;
+ *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
+esac
+rm -rf conftest*[]dnl
+])# _AC_SYS_LARGEFILE_MACRO_VALUE
+
+
+# AC_SYS_LARGEFILE
+# ----------------
+# 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
+AC_DEFUN([AC_SYS_LARGEFILE],
+[AC_ARG_ENABLE(largefile,
+ [ --disable-largefile omit support for large files])
+if test "$enable_largefile" != no; then
+
+ AC_CACHE_CHECK([for special C compiler options needed for large files],
+ ac_cv_sys_largefile_CC,
+ [ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
+ AC_COMPILE_IFELSE([], [break])
+ CC="$CC -n32"
+ AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi])
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
+ ac_cv_sys_file_offset_bits,
+ [Number of bits in a file offset, on hosts where this is settable.],
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
+ ac_cv_sys_large_files,
+ [Define for large files, on AIX-style hosts.],
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES])
+ fi
+
+ AH_VERBATIM([_DARWIN_USE_64_BIT_INODE],
+[/* Enable large inode numbers on Mac OS X. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif])
+fi
+])# AC_SYS_LARGEFILE
+
+])# m4_version_prereq 2.69