annotate m4/longlong.m4 @ 285:9010796c6253 2.3 2.3.1

Generated manual for distribution
author lost
date Fri, 24 Apr 2009 22:36:09 +0000
parents 2cb097e760a5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
1 # longlong.m4 serial 13
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
2 dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
6
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
7 dnl From Paul Eggert.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
8
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
9 # Define HAVE_LONG_LONG_INT if 'long long int' works.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
10 # This fixes a bug in Autoconf 2.61, but can be removed once we
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
11 # assume 2.62 everywhere.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
12
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
13 # Note: If the type 'long long int' exists but is only 32 bits large
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
14 # (as on some very old compilers), HAVE_LONG_LONG_INT will not be
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
15 # defined. In this case you can treat 'long long int' like 'long int'.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
16
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
17 AC_DEFUN([AC_TYPE_LONG_LONG_INT],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
18 [
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
20 [AC_LINK_IFELSE(
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
21 [_AC_TYPE_LONG_LONG_SNIPPET],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
22 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
23 dnl If cross compiling, assume the bug isn't important, since
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
24 dnl nobody cross compiles for this platform as far as we know.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
25 AC_RUN_IFELSE(
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
26 [AC_LANG_PROGRAM(
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
27 [[@%:@include <limits.h>
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
28 @%:@ifndef LLONG_MAX
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
29 @%:@ define HALF \
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
30 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
31 @%:@ define LLONG_MAX (HALF - 1 + HALF)
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
32 @%:@endif]],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
33 [[long long int n = 1;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
34 int i;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
35 for (i = 0; ; i++)
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
36 {
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
37 long long int m = n << i;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
38 if (m >> i != n)
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
39 return 1;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
40 if (LLONG_MAX / 2 < m)
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
41 break;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
42 }
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
43 return 0;]])],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
44 [ac_cv_type_long_long_int=yes],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
45 [ac_cv_type_long_long_int=no],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
46 [ac_cv_type_long_long_int=yes])],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
47 [ac_cv_type_long_long_int=no])])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
48 if test $ac_cv_type_long_long_int = yes; then
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
49 AC_DEFINE([HAVE_LONG_LONG_INT], 1,
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
50 [Define to 1 if the system has the type `long long int'.])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
51 fi
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
52 ])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
53
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
54 # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
55 # This fixes a bug in Autoconf 2.61, but can be removed once we
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
56 # assume 2.62 everywhere.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
57
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
58 # Note: If the type 'unsigned long long int' exists but is only 32 bits
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
59 # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
60 # will not be defined. In this case you can treat 'unsigned long long int'
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
61 # like 'unsigned long int'.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
62
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
63 AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
64 [
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
65 AC_CACHE_CHECK([for unsigned long long int],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
66 [ac_cv_type_unsigned_long_long_int],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
67 [AC_LINK_IFELSE(
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
68 [_AC_TYPE_LONG_LONG_SNIPPET],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
69 [ac_cv_type_unsigned_long_long_int=yes],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
70 [ac_cv_type_unsigned_long_long_int=no])])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
71 if test $ac_cv_type_unsigned_long_long_int = yes; then
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
72 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
73 [Define to 1 if the system has the type `unsigned long long int'.])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
74 fi
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
75 ])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
76
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
77 # Expands to a C program that can be used to test for simultaneous support
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
78 # of 'long long' and 'unsigned long long'. We don't want to say that
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
79 # 'long long' is available if 'unsigned long long' is not, or vice versa,
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
80 # because too many programs rely on the symmetry between signed and unsigned
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
81 # integer types (excluding 'bool').
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
82 AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
83 [
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
84 AC_LANG_PROGRAM(
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
85 [[/* For now, do not test the preprocessor; as of 2007 there are too many
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
86 implementations with broken preprocessors. Perhaps this can
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
87 be revisited in 2012. In the meantime, code should not expect
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
88 #if to work with literals wider than 32 bits. */
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
89 /* Test literals. */
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
90 long long int ll = 9223372036854775807ll;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
91 long long int nll = -9223372036854775807LL;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
92 unsigned long long int ull = 18446744073709551615ULL;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
93 /* Test constant expressions. */
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
94 typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
95 ? 1 : -1)];
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
96 typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
97 ? 1 : -1)];
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
98 int i = 63;]],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
99 [[/* Test availability of runtime routines for shift and division. */
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
100 long long int llmax = 9223372036854775807ll;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
101 unsigned long long int ullmax = 18446744073709551615ull;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
102 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
103 | (llmax / ll) | (llmax % ll)
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
104 | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
105 | (ullmax / ull) | (ullmax % ull));]])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
106 ])