[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT
From: |
Bruno Haible |
Subject: |
[Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT |
Date: |
Sat, 27 Oct 2007 04:06:24 +0200 |
User-agent: |
KMail/1.5.4 |
Hi Paul,
On Wednesday, I proposed a patch to disable both 'unsigned long long int'
and 'long long int' on Sun C 5.[0-8] in 32-bit mode, instead of only one
of them.
> 2007-10-24 Bruno Haible <address@hidden>
>
> * m4/longlong.m4 (_AC_TYPE_LONG_LONG_SNIPPET): New macro, extracted
> from AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT.
> (AC_TYPE_LONG_LONG_INT): Use it.
> * m4/ulonglong.m4 (AC_TYPE_UNSIGNED_LONG_LONG_INT): Likewise.
> * modules/strtoull (Files): Add m4/longlong.m4.
> * modules/strtoumax (Files): Likewise.
I verified that it works fine on Solaris (both 32-bit and 64-bit mode).
So here is the corresponding patch to autoconf. (Untested in autoconf,
but, as I said, tested as part of gnulib.)
2007-10-26 Bruno Haible <address@hidden>
* lib/autoconf/types.m4 (_AC_TYPE_LONG_LONG_SNIPPET): New macro,
extracted from AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT.
(AC_TYPE_LONG_LONG_INT, AC_TYPE_UNSIGNED_LONG_LONG_INT): Use it.
Fixes problem with Sun C 5.[0-8] in 32-bit mode, reported in
<http://lists.gnu.org/archive/html/autoconf-patches/2007-10/msg00210.html>
Suggested by Paul Eggert.
*** types.m4.bak 2007-10-27 03:52:05.000000000 +0200
--- types.m4 2007-10-27 03:55:10.000000000 +0200
***************
*** 465,489 ****
)
# AC_TYPE_LONG_LONG_INT
# ---------------------
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
[
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
[AC_LINK_IFELSE(
! [AC_LANG_PROGRAM(
! [[#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
! error in preprocessor;
! #endif
! long long int ll = 9223372036854775807ll;
! long long int nll = -9223372036854775807LL;
! typedef int a[((-9223372036854775807LL < 0
! && 0 < 9223372036854775807ll)
! ? 1 : -1)];
! int i = 63;]],
! [[long long int llmax = 9223372036854775807ll;
! return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
! | (llmax / ll) | (llmax % ll));]])],
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa
2004.
dnl If cross compiling, assume the bug isn't important, since
dnl nobody cross compiles for this platform as far as we know.
--- 465,514 ----
)
+ # _AC_TYPE_LONG_LONG_SNIPPET
+ # --------------------------
+ # Expands to a C program that can be used to test for simultaneous support
+ # of 'long long' and 'unsigned long long'. We don't want to say that
+ # 'long long' is available if 'unsigned long long' is not, or vice versa,
+ # because too many programs rely on the symmetry between signed and unsigned
+ # integer types (excluding 'bool').
+ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
+ [
+ AC_LANG_PROGRAM(
+ [[/* Test preprocessor. */
+ #if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+ error in preprocessor;
+ #endif
+ #if ! (18446744073709551615ULL <= -1ull)
+ error in preprocessor;
+ #endif
+ /* Test literals. */
+ long long int ll = 9223372036854775807ll;
+ long long int nll = -9223372036854775807LL;
+ unsigned long long int ull = 18446744073709551615ULL;
+ /* Test constant expressions. */
+ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+ ? 1 : -1)];
+ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+ ? 1 : -1)];
+ int i = 63;]],
+ [[/* Test availability of runtime routines for shift and division. */
+ long long int llmax = 9223372036854775807ll;
+ unsigned long long int ullmax = 18446744073709551615ull;
+ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+ | (llmax / ll) | (llmax % ll)
+ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+ | (ullmax / ull) | (ullmax % ull));]])
+ ])
+
+
# AC_TYPE_LONG_LONG_INT
# ---------------------
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
[
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
[AC_LINK_IFELSE(
! [_AC_TYPE_LONG_LONG_SNIPPET],
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa
2004.
dnl If cross compiling, assume the bug isn't important, since
dnl nobody cross compiles for this platform as far as we know.
***************
*** 524,540 ****
AC_CACHE_CHECK([for unsigned long long int],
[ac_cv_type_unsigned_long_long_int],
[AC_LINK_IFELSE(
! [AC_LANG_PROGRAM(
! [[#if ! (18446744073709551615ULL <= -1ull)
! error in preprocessor;
! #endif
! unsigned long long int ull = 18446744073709551615ULL;
! typedef int a[(18446744073709551615ULL <= (unsigned long long int)
-1
! ? 1 : -1)];
! int i = 63;]],
! [[unsigned long long int ullmax = 18446744073709551615ull;
! return (ull << 63 | ull >> 63 | ull << i | ull >> i
! | ullmax / ull | ullmax % ull);]])],
[ac_cv_type_unsigned_long_long_int=yes],
[ac_cv_type_unsigned_long_long_int=no])])
if test $ac_cv_type_unsigned_long_long_int = yes; then
--- 549,555 ----
AC_CACHE_CHECK([for unsigned long long int],
[ac_cv_type_unsigned_long_long_int],
[AC_LINK_IFELSE(
! [_AC_TYPE_LONG_LONG_SNIPPET],
[ac_cv_type_unsigned_long_long_int=yes],
[ac_cv_type_unsigned_long_long_int=no])])
if test $ac_cv_type_unsigned_long_long_int = yes; then
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, (continued)
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, Paul Eggert, 2007/10/16
- AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT (was: Re: [Bug-tar] GNU tar 1.19 on HP-UX), Bruno Haible, 2007/10/21
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT (was: Re: [Bug-tar] GNU tar 1.19 on HP-UX), H.Merijn Brand, 2007/10/21
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Paul Eggert, 2007/10/22
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/22
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Paul Eggert, 2007/10/22
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/22
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/23
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Paul Eggert, 2007/10/24
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/24
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT,
Bruno Haible <=
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Paul Eggert, 2007/10/30
- [Bug-tar] Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/31
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, Paul Eggert, 2007/10/16
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, H.Merijn Brand, 2007/10/17
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, Benoit SIGOURE, 2007/10/18
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, H.Merijn Brand, 2007/10/17
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, Paul Eggert, 2007/10/18
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, H.Merijn Brand, 2007/10/18
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, Bruno Haible, 2007/10/18
- Re: [Bug-tar] GNU tar 1.19 on HP-UX, H.Merijn Brand, 2007/10/18