summaryrefslogtreecommitdiffstats
path: root/gl/m4/ulonglong.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/ulonglong.m4')
-rw-r--r--gl/m4/ulonglong.m448
1 files changed, 0 insertions, 48 deletions
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4
index 1f9e862..15bf9da 100644
--- a/gl/m4/longlong.m4
+++ b/gl/m4/longlong.m4
@@ -1,5 +1,5 @@
1# longlong.m4 serial 10 1# longlong.m4 serial 13
2dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. 2dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
7dnl From Paul Eggert. 7dnl From Paul Eggert.
8 8
9# Define HAVE_LONG_LONG_INT if 'long long int' works. 9# Define HAVE_LONG_LONG_INT if 'long long int' works.
10# This fixes a bug in Autoconf 2.60, but can be removed once we 10# This fixes a bug in Autoconf 2.61, but can be removed once we
11# assume 2.61 everywhere. 11# assume 2.62 everywhere.
12 12
13# Note: If the type 'long long int' exists but is only 32 bits large 13# Note: If the type 'long long int' exists but is only 32 bits large
14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be 14# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -18,20 +18,11 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
18[ 18[
19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], 19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
20 [AC_LINK_IFELSE( 20 [AC_LINK_IFELSE(
21 [AC_LANG_PROGRAM( 21 [_AC_TYPE_LONG_LONG_SNIPPET],
22 [[long long int ll = 9223372036854775807ll;
23 long long int nll = -9223372036854775807LL;
24 typedef int a[((-9223372036854775807LL < 0
25 && 0 < 9223372036854775807ll)
26 ? 1 : -1)];
27 int i = 63;]],
28 [[long long int llmax = 9223372036854775807ll;
29 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
30 | (llmax / ll) | (llmax % ll));]])],
31 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. 22 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
32 dnl If cross compiling, assume the bug isn't important, since 23 dnl If cross compiling, assume the bug isn't important, since
33 dnl nobody cross compiles for this platform as far as we know. 24 dnl nobody cross compiles for this platform as far as we know.
34 AC_RUN_IFELSE( 25 AC_RUN_IFELSE(
35 [AC_LANG_PROGRAM( 26 [AC_LANG_PROGRAM(
36 [[@%:@include <limits.h> 27 [[@%:@include <limits.h>
37 @%:@ifndef LLONG_MAX 28 @%:@ifndef LLONG_MAX
@@ -60,13 +51,56 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
60 fi 51 fi
61]) 52])
62 53
63# This macro is obsolescent and should go away soon. 54# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
64AC_DEFUN([gl_AC_TYPE_LONG_LONG], 55# This fixes a bug in Autoconf 2.61, but can be removed once we
56# assume 2.62 everywhere.
57
58# Note: If the type 'unsigned long long int' exists but is only 32 bits
59# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
60# will not be defined. In this case you can treat 'unsigned long long int'
61# like 'unsigned long int'.
62
63AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
65[ 64[
66 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) 65 AC_CACHE_CHECK([for unsigned long long int],
67 ac_cv_type_long_long=$ac_cv_type_long_long_int 66 [ac_cv_type_unsigned_long_long_int],
68 if test $ac_cv_type_long_long = yes; then 67 [AC_LINK_IFELSE(
69 AC_DEFINE(HAVE_LONG_LONG, 1, 68 [_AC_TYPE_LONG_LONG_SNIPPET],
70 [Define if you have the 'long long' type.]) 69 [ac_cv_type_unsigned_long_long_int=yes],
70 [ac_cv_type_unsigned_long_long_int=no])])
71 if test $ac_cv_type_unsigned_long_long_int = yes; then
72 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
73 [Define to 1 if the system has the type `unsigned long long int'.])
71 fi 74 fi
72]) 75])
76
77# Expands to a C program that can be used to test for simultaneous support
78# of 'long long' and 'unsigned long long'. We don't want to say that
79# 'long long' is available if 'unsigned long long' is not, or vice versa,
80# because too many programs rely on the symmetry between signed and unsigned
81# integer types (excluding 'bool').
82AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
83[
84 AC_LANG_PROGRAM(
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. */
89 /* Test literals. */
90 long long int ll = 9223372036854775807ll;
91 long long int nll = -9223372036854775807LL;
92 unsigned long long int ull = 18446744073709551615ULL;
93 /* Test constant expressions. */
94 typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
95 ? 1 : -1)];
96 typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
97 ? 1 : -1)];
98 int i = 63;]],
99 [[/* Test availability of runtime routines for shift and division. */
100 long long int llmax = 9223372036854775807ll;
101 unsigned long long int ullmax = 18446744073709551615ull;
102 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
103 | (llmax / ll) | (llmax % ll)
104 | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
105 | (ullmax / ull) | (ullmax % ull));]])
106])
diff --git a/gl/m4/ulonglong.m4 b/gl/m4/ulonglong.m4
deleted file mode 100644
index 9fae98e..0000000
--- a/gl/m4/ulonglong.m4
+++ /dev/null
@@ -1,48 +0,0 @@
1# ulonglong.m4 serial 6
2dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Paul Eggert.
8
9# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
10# This fixes a bug in Autoconf 2.60, but can be removed once we
11# assume 2.61 everywhere.
12
13# Note: If the type 'unsigned long long int' exists but is only 32 bits
14# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
15# will not be defined. In this case you can treat 'unsigned long long int'
16# like 'unsigned long int'.
17
18AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
19[
20 AC_CACHE_CHECK([for unsigned long long int],
21 [ac_cv_type_unsigned_long_long_int],
22 [AC_LINK_IFELSE(
23 [AC_LANG_PROGRAM(
24 [[unsigned long long int ull = 18446744073709551615ULL;
25 typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
26 ? 1 : -1)];
27 int i = 63;]],
28 [[unsigned long long int ullmax = 18446744073709551615ull;
29 return (ull << 63 | ull >> 63 | ull << i | ull >> i
30 | ullmax / ull | ullmax % ull);]])],
31 [ac_cv_type_unsigned_long_long_int=yes],
32 [ac_cv_type_unsigned_long_long_int=no])])
33 if test $ac_cv_type_unsigned_long_long_int = yes; then
34 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
35 [Define to 1 if the system has the type `unsigned long long int'.])
36 fi
37])
38
39# This macro is obsolescent and should go away soon.
40AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
41[
42 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
43 ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
44 if test $ac_cv_type_unsigned_long_long = yes; then
45 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
46 [Define if you have the 'unsigned long long' type.])
47 fi
48])