]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Import AC_SYS_LARGEFILE from largefile.m4 serial 12.
authorAkim Demaille <akim@epita.fr>
Thu, 8 Jun 2000 12:07:14 +0000 (12:07 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 8 Jun 2000 12:07:14 +0000 (12:07 +0000)
* acspecific.m4 (AC_SYS_LARGEFILE, _AC_SYS_LARGEFILE_MACRO_VALUE,
_AC_SYS_LARGEFILE_SOURCE): New.
* doc/autoconf.texi (System Services): Document AC_SYS_LARGEFILE.

ChangeLog
NEWS
acspecific.m4
doc/autoconf.texi
lib/autoconf/specific.m4

index cce7570a1441b44e56dea4574306f621e91d9a1d..9fdf9641ebdb933fe453e816eeeecf2ba5760525 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2000-06-08  Paul Eggert  <eggert@twinsun.com>
+
+       Import AC_SYS_LARGEFILE from largefile.m4 serial 12.
+
+       * acspecific.m4 (AC_SYS_LARGEFILE, _AC_SYS_LARGEFILE_MACRO_VALUE,
+       _AC_SYS_LARGEFILE_SOURCE): New.
+       * doc/autoconf.texi (System Services): Document AC_SYS_LARGEFILE.
+
 2000-06-08  Steven G. Johnson  <stevenj@alum.mit.edu>
 
        * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Don't override FLIBS if
diff --git a/NEWS b/NEWS
index bd9dbabb81778facdc2ba5df5a9fc6b7ca25f543..26203f668dabc950295683d5a10c622c1e1a0ad9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -134,6 +134,9 @@ test cases in this new frame work.
 - AC_CHECK_DECL, AC_CHECK_DECLS
   To check whether a symbol is declared.
 
+- AC_CHECK_SIZEOF
+  No longer needs a cross-compilation size.
+
 - AC_CHECK_TYPE
   The test it performs is much more robust than previously, and makes
   it possible to test builtin types in addition to typedefs.
@@ -150,7 +153,6 @@ test cases in this new frame work.
   Check for given members in aggregates (e.g., pw_gecos in struct
   passwd).
 
-
 - AC_PROG_CC_STDC
   Checks if the compiler supports ISO C, included when needs special
   options.
@@ -174,8 +176,8 @@ test cases in this new frame work.
 - AC_PROG_LEX
   Now integrates `AC_DECL_YYTEXT' which is obsoleted.
 
-- AC_CHECK_SIZEOF
-  No longer needs a cross-compilation size.
+- AC_SYS_LARGEFILE
+  Arrange for large-file support.
 
 ** C++ compatibility
   Every macro has been revisited in order to support at best CC=c++.
index 73bfde49f2023d7d3220e27aeef748b6cc52ce27..e09553c6da844e07a7ad60d5fc3c4e689e22e2f7 100644 (file)
@@ -2090,10 +2090,93 @@ rm -f conftest])
 interpval=$ac_cv_sys_interpreter
 ])
 
+
 AC_DEFUNCT([AC_HAVE_POUNDBANG], [;use AC_SYS_INTERPRETER, taking no arguments])
 AC_DEFUNCT([AC_ARG_ARRAY], [; don't do unportable things with arguments])
 
 
+# _AC_SYS_LARGEFILE_SOURCE(PROLOGUE, BODY)
+# ----------------------------------------
+define([_AC_SYS_LARGEFILE_SOURCE],
+[AC_LANG_PROGRAM(
+[$1
+@%:@include <sys/types.h>
+int a[[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]];],
+[$2])])
+
+
+# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
+#                               CACHE-VAR,
+#                               DESCRIPTION,
+#                               [INCLUDES], [FUNCTION-BODY])
+# ----------------------------------------------------------
+define([_AC_SYS_LARGEFILE_MACRO_VALUE],
+[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
+[while :; do
+  AC_COMPILE_IFELSE([_AC_SYS_LARGEFILE_SOURCE([$5], [$6])],
+                   [break])
+  AC_COMPILE_IFELSE([_AC_SYS_LARGEFILE_SOURCE([@%:@define $1 $2
+$5], [$6])],
+                   [$3=$2; break])
+  $3=no
+  break
+done])
+if test "$$3" != no; then
+  AC_DEFINE_UNQUOTED([$1], [$$3], [$4])
+fi[]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.sas.com/standards/large.file/x_open.20Mar96.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-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_COMPILE_IFELSE([_AC_SYS_LARGEFILE_SOURCE()],
+                          [break])
+        CC="$CC -n32"
+        AC_COMPILE_IFELSE([_AC_SYS_LARGEFILE_SOURCE()],
+                          [ac_cv_sys_largefile_CC=' -n32'; break])
+         break
+       done
+       CC=$ac_save_CC
+    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_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
+    ac_cv_sys_largefile_source,
+    [Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
+    [@%:@include <stdio.h>], [return !ftello;])
+  _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
+    ac_cv_sys_large_files,
+    [Define for large files, on AIX-style hosts.])
+  _AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
+    ac_cv_sys_xopen_source,
+    [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
+    [@%:@include <stdio.h>], [return !ftello;])
+fi
+])# AC_SYS_LARGEFILE
+
+
 # AC_SYS_LONG_FILE_NAMES
 # ----------------------
 # Security: use a temporary directory as the most portable way of
index 586eb164f915605b39bf87bee8f70f757ddcecb8..f840deedeb068635b9e5fa278ef99a661bc9e71f 100644 (file)
@@ -4149,6 +4149,31 @@ the shell variable @code{interpval}; it will be set to @samp{yes}
 if the system supports @samp{#!}, @samp{no} if not.
 @end defmac
 
+@defmac AC_SYS_LARGEFILE
+@maindex SYS_LARGEFILE
+@cvindex _FILE_OFFSET_BITS
+@cvindex _LARGEFILE_SOURCE
+@cvindex _LARGE_FILES
+@cvindex _XOPEN_SOURCE
+@ovindex CC
+Arrange for
+@uref{http://www.sas.com/standards/large.file/x_open.20Mar96.html,
+large-file support}.  On some hosts, one must use special compiler
+options to build programs that can access large files.  Append any such
+options to the output variable @code{CC}.  Define
+@code{_FILE_OFFSET_BITS}, @code{_LARGEFILE_SOURCE}, @code{_LARGE_FILES},
+and @code{_XOPEN_SOURCE} if necessary.
+
+The user can disable large-file support by configuring with the
+@option{--disable-largefile} option.
+
+If you use this macro, check that your program works even when
+@code{off_t} is longer than @code{long}, since this is common when
+large-file support is enabled.  For example, it is not correct to print
+an arbitrary @code{off_t} value @code{X} with @code{printf ("%ld",
+(long) X)}.
+@end defmac
+
 @defmac AC_SYS_LONG_FILE_NAMES
 @maindex SYS_LONG_FILE_NAMES
 @cvindex HAVE_LONG_FILE_NAMES
index 73bfde49f2023d7d3220e27aeef748b6cc52ce27..e09553c6da844e07a7ad60d5fc3c4e689e22e2f7 100644 (file)
@@ -2090,10 +2090,93 @@ rm -f conftest])
 interpval=$ac_cv_sys_interpreter
 ])
 
+
 AC_DEFUNCT([AC_HAVE_POUNDBANG], [;use AC_SYS_INTERPRETER, taking no arguments])
 AC_DEFUNCT([AC_ARG_ARRAY], [; don't do unportable things with arguments])
 
 
+# _AC_SYS_LARGEFILE_SOURCE(PROLOGUE, BODY)
+# ----------------------------------------
+define([_AC_SYS_LARGEFILE_SOURCE],
+[AC_LANG_PROGRAM(
+[$1
+@%:@include <sys/types.h>
+int a[[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]];],
+[$2])])
+
+
+# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
+#                               CACHE-VAR,
+#                               DESCRIPTION,
+#                               [INCLUDES], [FUNCTION-BODY])
+# ----------------------------------------------------------
+define([_AC_SYS_LARGEFILE_MACRO_VALUE],
+[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
+[while :; do
+  AC_COMPILE_IFELSE([_AC_SYS_LARGEFILE_SOURCE([$5], [$6])],
+                   [break])
+  AC_COMPILE_IFELSE([_AC_SYS_LARGEFILE_SOURCE([@%:@define $1 $2
+$5], [$6])],
+                   [$3=$2; break])
+  $3=no
+  break
+done])
+if test "$$3" != no; then
+  AC_DEFINE_UNQUOTED([$1], [$$3], [$4])
+fi[]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.sas.com/standards/large.file/x_open.20Mar96.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-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_COMPILE_IFELSE([_AC_SYS_LARGEFILE_SOURCE()],
+                          [break])
+        CC="$CC -n32"
+        AC_COMPILE_IFELSE([_AC_SYS_LARGEFILE_SOURCE()],
+                          [ac_cv_sys_largefile_CC=' -n32'; break])
+         break
+       done
+       CC=$ac_save_CC
+    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_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
+    ac_cv_sys_largefile_source,
+    [Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
+    [@%:@include <stdio.h>], [return !ftello;])
+  _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
+    ac_cv_sys_large_files,
+    [Define for large files, on AIX-style hosts.])
+  _AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
+    ac_cv_sys_xopen_source,
+    [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
+    [@%:@include <stdio.h>], [return !ftello;])
+fi
+])# AC_SYS_LARGEFILE
+
+
 # AC_SYS_LONG_FILE_NAMES
 # ----------------------
 # Security: use a temporary directory as the most portable way of