[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autoconf problem with large files on HP-UX?
From: |
Jim Meyering |
Subject: |
Re: autoconf problem with large files on HP-UX? |
Date: |
03 Feb 2001 11:23:28 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.98 |
I wrote:
...
| [Bob reported (included below) that the largefile test from autoconf-2.49c
| doesn't work on HP-UX 10.20. ]
|
| This test (note the ULL suffixes) is compiled without error by /bin/cc
| on an HPUX10.20:
|
| #define _FILE_OFFSET_BITS 64
| #include <sys/types.h>
| int a[(off_t) 9223372036854775807ULL == 9223372036854775807ULL ? 1 : -1];
| int main () { return 0; }
|
| The current test in configure lacks the ULL suffixes, so it fails:
|
| cc: "k.c", line 3: warning 602: Integer constant exceeds its storage.
| cc: "k.c", line 3: warning 602: Integer constant exceeds its storage.
|
| One work-around is to change acspecific.m4's _AC_SYS_LARGEFILE_TEST_INCLUDES
| test to first see if the ULL suffix is accepted by the compiler,
| and then set e.g., ac_ull=ULL and use $ull in the test program.
I see two ways to fix this:
- assume ULL is accepted by any compiler we care about on any system
with `large file' support. In that case, the fix is to append
the literal `ULL' to each of the `9223372036854775807's above.
- add a test to accommodate compilers on `large file' systems that
do *not* accept the ULL suffix.
Here's a patch that does the latter:
* acspecific.m4 (AC_SYS_LARGEFILE): Use AC_C_ULL.
(_AC_SYS_LARGEFILE_TEST_INCLUDES): Add a parameter, ULL-SUFFIX.
* aclang.m4 (AC_C_ULL): New macro.
Of course, if this were to be checked in, there'd also have to be
a little bit of documentation for the new macro, AC_C_ULL.
I should probably remove the `#ifndef __cplusplus';
this test shouldn't fail with any C++ compiler,
and #if directives are _bad_ :-)
What do you think?
I have confirmed that the fix below does indeed fix the problem
with fileutils on HP-UX 10.20.
Jim
Index: aclang.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/aclang.m4,v
retrieving revision 1.121
diff -u -p -r1.121 aclang.m4
--- aclang.m4 2001/01/29 11:54:43 1.121
+++ aclang.m4 2001/02/03 10:02:50
@@ -1586,6 +1586,26 @@ if test $ac_cv_c_const = no; then
fi
])# AC_C_CONST
+# AC_C_ULL(ACTION-IF-ACCEPTED, ACTION-IF-REJECTED)
+# ----------
+# Try to compile a program that uses the `ULL' suffix on a literal integer.
+# If the compilation succeeds, execute ACTION-IF-FOUND; otherwise, execute
+# ACTION-IF-REJECTED.
+AC_DEFUN([AC_C_ULL],
+[AC_REQUIRE([AC_PROG_CC_STDC])dnl
+AC_CACHE_CHECK([the compiler accepts the `ULL' suffix on literal integers],
+ ac_cv_c_ull,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+[[
+#ifndef __cplusplus
+ (void) 9223372036854775807ULL;
+#endif
+]])],
+ [ac_cv_c_ull=yes],
+ [ac_cv_c_ull=no])])
+ AS_IF([test $ac_cv_c_ull = yes], [$1], [$2])[]dnl
+])# AC_C_ULL
+
# AC_C_VOLATILE
# -------------
Index: acspecific.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/acspecific.m4,v
retrieving revision 1.333
diff -u -p -r1.333 acspecific.m4
--- acspecific.m4 2001/01/29 22:36:09 1.333
+++ acspecific.m4 2001/02/03 10:02:51
@@ -352,11 +352,14 @@ AU_DEFUN([AC_ARG_ARRAY],
with arguments. Remove this warning when you adjust your code.])])
-# _AC_SYS_LARGEFILE_TEST_INCLUDES
+# _AC_SYS_LARGEFILE_TEST_INCLUDES(ULL-SUFFIX)
+# If the compiler allows integer constants with the `ULL' suffix,
+# ULL-SUFFIX should be precisely that: ULL. Otherwise, it must
+# be the empty string.
# -------------------------------
m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
address@hidden:@include <sys/types.h>
-int a[[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]];[]dnl
+int a[[(off_t) 9223372036854775807$1 == 9223372036854775807$1 ? 1 : -1]];[]dnl
])
@@ -394,6 +397,7 @@ AC_DEFUN([AC_SYS_LARGEFILE],
[ --disable-largefile omit support for large files])
if test "$enable_largefile" != no; then
+ AC_C_ULL([ac_ull=ULL],[ac_ull=])
AC_CACHE_CHECK([for special C compiler options needed for large files],
ac_cv_sys_largefile_CC,
[ac_cv_sys_largefile_CC=no
@@ -402,7 +406,8 @@ if test "$enable_largefile" != no; then
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_LANG_CONFTEST(
+ [AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES($ac_ull)])])
AC_COMPILE_IFELSE([], [break])
CC="$CC -n32"
AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
@@ -418,11 +423,11 @@ if test "$enable_largefile" != no; then
_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])
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES($ac_ull)])
_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])
+ [_AC_SYS_LARGEFILE_TEST_INCLUDES($ac_ull)])
fi
])# AC_SYS_LARGEFILE
- Re: autoconf problem with large files on HP-UX?,
Jim Meyering <=
- Re: autoconf problem with large files on HP-UX?, Akim Demaille, 2001/02/03
- Re: autoconf problem with large files on HP-UX?, Jim Meyering, 2001/02/03
- Re: autoconf problem with large files on HP-UX?, Akim Demaille, 2001/02/03
- Re: autoconf problem with large files on HP-UX?, Jim Meyering, 2001/02/04
- Re: autoconf problem with large files on HP-UX?, Akim Demaille, 2001/02/05
- Re: autoconf problem with large files on HP-UX?, Paul Eggert, 2001/02/06
- Re: autoconf problem with large files on HP-UX?, Bob Proulx, 2001/02/06
- Re: autoconf problem with large files on HP-UX?, Paul Eggert, 2001/02/06
- Re: autoconf problem with large files on HP-UX?, Alexandre Oliva, 2001/02/06
- Re: autoconf problem with large files on HP-UX?, Paul Eggert, 2001/02/08