From 3a6a9bb4f374ff15bb70bdbc94890f03f119cb10 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 8 Jun 2000 12:07:14 +0000 Subject: [PATCH] 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. --- ChangeLog | 8 ++++ NEWS | 8 ++-- acspecific.m4 | 83 ++++++++++++++++++++++++++++++++++++++++ doc/autoconf.texi | 25 ++++++++++++ lib/autoconf/specific.m4 | 83 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 204 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cce7570a..9fdf9641 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-06-08 Paul Eggert + + 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 * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Don't override FLIBS if diff --git a/NEWS b/NEWS index bd9dbabb..26203f66 100644 --- 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++. diff --git a/acspecific.m4 b/acspecific.m4 index 73bfde49..e09553c6 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -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 +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 ], [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 ], [return !ftello;]) +fi +])# AC_SYS_LARGEFILE + + # AC_SYS_LONG_FILE_NAMES # ---------------------- # Security: use a temporary directory as the most portable way of diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 586eb164..f840deed 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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 diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 73bfde49..e09553c6 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -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 +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 ], [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 ], [return !ftello;]) +fi +])# AC_SYS_LARGEFILE + + # AC_SYS_LONG_FILE_NAMES # ---------------------- # Security: use a temporary directory as the most portable way of