1
# longlong.m4 serial 13
2
dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
1
# longlong.m4 serial 14
2
dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
21
21
[_AC_TYPE_LONG_LONG_SNIPPET],
22
22
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
23
dnl If cross compiling, assume the bug isn't important, since
24
dnl nobody cross compiles for this platform as far as we know.
27
[[@%:@include <limits.h>
30
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
31
@%:@ define LLONG_MAX (HALF - 1 + HALF)
33
[[long long int n = 1;
37
long long int m = n << i;
40
if (LLONG_MAX / 2 < m)
44
[ac_cv_type_long_long_int=yes],
45
[ac_cv_type_long_long_int=no],
46
[ac_cv_type_long_long_int=yes])],
23
dnl If cross compiling, assume the bug isn't important, since
24
dnl nobody cross compiles for this platform as far as we know.
27
[[@%:@include <limits.h>
30
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
31
@%:@ define LLONG_MAX (HALF - 1 + HALF)
33
[[long long int n = 1;
37
long long int m = n << i;
40
if (LLONG_MAX / 2 < m)
44
[ac_cv_type_long_long_int=yes],
45
[ac_cv_type_long_long_int=no],
46
[ac_cv_type_long_long_int=yes])],
47
47
[ac_cv_type_long_long_int=no])])
48
48
if test $ac_cv_type_long_long_int = yes; then
49
AC_DEFINE([HAVE_LONG_LONG_INT], 1,
49
AC_DEFINE([HAVE_LONG_LONG_INT], [1],
50
50
[Define to 1 if the system has the type `long long int'.])
69
69
[ac_cv_type_unsigned_long_long_int=yes],
70
70
[ac_cv_type_unsigned_long_long_int=no])])
71
71
if test $ac_cv_type_unsigned_long_long_int = yes; then
72
AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
72
AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
73
73
[Define to 1 if the system has the type `unsigned long long int'.])
82
82
AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
85
[[/* Test preprocessor. */
86
#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
87
error in preprocessor;
89
#if ! (18446744073709551615ULL <= -1ull)
90
error in preprocessor;
85
[[/* For now, do not test the preprocessor; as of 2007 there are too many
86
implementations with broken preprocessors. Perhaps this can
87
be revisited in 2012. In the meantime, code should not expect
88
#if to work with literals wider than 32 bits. */
92
89
/* Test literals. */
93
90
long long int ll = 9223372036854775807ll;
94
91
long long int nll = -9223372036854775807LL;
95
92
unsigned long long int ull = 18446744073709551615ULL;
96
93
/* Test constant expressions. */
97
94
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
99
96
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
102
99
[[/* Test availability of runtime routines for shift and division. */
103
100
long long int llmax = 9223372036854775807ll;
104
101
unsigned long long int ullmax = 18446744073709551615ull;
105
102
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
106
| (llmax / ll) | (llmax % ll)
107
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
108
| (ullmax / ull) | (ullmax % ull));]])
103
| (llmax / ll) | (llmax % ll)
104
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
105
| (ullmax / ull) | (ullmax % ull));]])