[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT
From: |
Bruno Haible |
Subject: |
Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT |
Date: |
Wed, 31 Oct 2007 12:54:07 +0100 |
User-agent: |
KMail/1.5.4 |
Paul Eggert wrote:
> > 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.
>
> Thanks, I installed that into Autoconf.
Thanks, I'm copying these macros over to gnulib (and moving the macro from
ulonglong.m4 over too longlong.m4 since I don't much like a .m4 file that uses
an undocumented macro from another .m4 file).
2007-10-31 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.
(AC_TYPE_UNSIGNED_LONG_LONG_INT): Moved here from m4/ulonglong.m4. Use
it as well.
* m4/ulonglong.m4 (AC_TYPE_UNSIGNED_LONG_LONG_INT): Remove macro; moved
to m4/longlong.m4.
* modules/stdint (Files): Remove m4/ulonglong.m4.
* modules/strtoull (Files): Use m4/longlong.m4 instead of
m4/ulonglong.m4.
* modules/strtoumax (Files): Likewise.
*** m4/longlong.m4.orig 2007-10-31 12:50:09.000000000 +0100
--- m4/longlong.m4 2007-10-31 12:45:37.000000000 +0100
***************
*** 1,4 ****
! # longlong.m4 serial 11
dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # longlong.m4 serial 12
dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 18,40 ****
[
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.
! AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
address@hidden:@include <limits.h>
@%:@ifndef LLONG_MAX
--- 18,28 ----
[
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.
! AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
address@hidden:@include <limits.h>
@%:@ifndef LLONG_MAX
***************
*** 63,68 ****
--- 51,113 ----
fi
])
+ # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
+ # This fixes a bug in Autoconf 2.61, but can be removed once we
+ # assume 2.62 everywhere.
+
+ # Note: If the type 'unsigned long long int' exists but is only 32 bits
+ # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
+ # will not be defined. In this case you can treat 'unsigned long long int'
+ # like 'unsigned long int'.
+
+ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
+ [
+ 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
+ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
+ [Define to 1 if the system has the type `unsigned long long int'.])
+ fi
+ ])
+
+ # 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));]])
+ ])
+
# This macro is obsolescent and should go away soon.
AC_DEFUN([gl_AC_TYPE_LONG_LONG],
[
*** m4/ulonglong.m4.orig 2007-10-31 12:50:09.000000000 +0100
--- m4/ulonglong.m4 2007-10-31 12:41:18.000000000 +0100
***************
*** 1,44 ****
! # ulonglong.m4 serial 8
dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
- dnl From Paul Eggert.
-
- # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
- # This fixes a bug in Autoconf 2.61, but can be removed once we
- # assume 2.62 everywhere.
-
- # Note: If the type 'unsigned long long int' exists but is only 32 bits
- # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
- # will not be defined. In this case you can treat 'unsigned long long int'
- # like 'unsigned long int'.
-
- AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
- [
- 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
- AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
- [Define to 1 if the system has the type `unsigned long long int'.])
- fi
- ])
-
# This macro is obsolescent and should go away soon.
AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
[
--- 1,9 ----
! # ulonglong.m4 serial 9
dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# This macro is obsolescent and should go away soon.
AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
[
*** modules/stdint.orig 2007-10-31 12:50:09.000000000 +0100
--- modules/stdint 2007-10-31 12:42:01.000000000 +0100
***************
*** 10,16 ****
lib/stdint.in.h
m4/stdint.m4
m4/longlong.m4
- m4/ulonglong.m4
Depends-on:
include_next
--- 10,15 ----
*** modules/strtoull.orig 2007-10-31 12:50:09.000000000 +0100
--- modules/strtoull 2007-10-31 12:41:21.000000000 +0100
***************
*** 3,9 ****
Files:
lib/strtoull.c
! m4/ulonglong.m4
m4/strtoull.m4
Depends-on:
--- 3,9 ----
Files:
lib/strtoull.c
! m4/longlong.m4
m4/strtoull.m4
Depends-on:
*** modules/strtoumax.orig 2007-10-31 12:50:09.000000000 +0100
--- modules/strtoumax 2007-10-31 12:41:22.000000000 +0100
***************
*** 3,9 ****
Files:
lib/strtoumax.c
! m4/ulonglong.m4
m4/strtoumax.m4
Depends-on:
--- 3,9 ----
Files:
lib/strtoumax.c
! m4/longlong.m4
m4/strtoumax.m4
Depends-on:
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT (was: Re: [Bug-tar] GNU tar 1.19 on HP-UX), (continued)
- 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
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Paul Eggert, 2007/10/22
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/22
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Paul Eggert, 2007/10/22
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/22
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/23
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Paul Eggert, 2007/10/24
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/24
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Bruno Haible, 2007/10/26
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT, Paul Eggert, 2007/10/30
- Re: AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT,
Bruno Haible <=
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, 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
Re: [Bug-tar] GNU tar 1.19 on HP-UX, Eric Blake, 2007/10/18
Re: [Bug-tar] GNU tar 1.19 on HP-UX, H.Merijn Brand, 2007/10/18