annotate m4/longlong.m4 @ 400:573ed4940625 3.0-beta1 3.0-beta1

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