diff options
Diffstat (limited to 'gl/m4/longlong.m4')
-rw-r--r-- | gl/m4/longlong.m4 | 87 |
1 files changed, 47 insertions, 40 deletions
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4 index cca3c1a9..3af6ab5a 100644 --- a/gl/m4/longlong.m4 +++ b/gl/m4/longlong.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # longlong.m4 serial 14 | 1 | # longlong.m4 serial 17 |
2 | dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1999-2007, 2009-2013 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl 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. | |||
7 | dnl From Paul Eggert. | 7 | dnl 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.61, but can be removed once we | 10 | # This fixes a bug in Autoconf 2.61, and can be faster |
11 | # assume 2.62 everywhere. | 11 | # than what's in Autoconf 2.62 through 2.68. |
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 |
@@ -16,44 +16,48 @@ dnl From Paul Eggert. | |||
16 | 16 | ||
17 | AC_DEFUN([AC_TYPE_LONG_LONG_INT], | 17 | AC_DEFUN([AC_TYPE_LONG_LONG_INT], |
18 | [ | 18 | [ |
19 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | ||
19 | AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], | 20 | AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], |
20 | [AC_LINK_IFELSE( | 21 | [ac_cv_type_long_long_int=yes |
21 | [_AC_TYPE_LONG_LONG_SNIPPET], | 22 | if test "x${ac_cv_prog_cc_c99-no}" = xno; then |
22 | [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. | 23 | ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int |
23 | dnl If cross compiling, assume the bug isn't important, since | 24 | if test $ac_cv_type_long_long_int = yes; then |
24 | dnl nobody cross compiles for this platform as far as we know. | 25 | dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. |
25 | AC_RUN_IFELSE( | 26 | dnl If cross compiling, assume the bug is not important, since |
26 | [AC_LANG_PROGRAM( | 27 | dnl nobody cross compiles for this platform as far as we know. |
27 | [[@%:@include <limits.h> | 28 | AC_RUN_IFELSE( |
28 | @%:@ifndef LLONG_MAX | 29 | [AC_LANG_PROGRAM( |
29 | @%:@ define HALF \ | 30 | [[@%:@include <limits.h> |
30 | (1LL << (sizeof (long long int) * CHAR_BIT - 2)) | 31 | @%:@ifndef LLONG_MAX |
31 | @%:@ define LLONG_MAX (HALF - 1 + HALF) | 32 | @%:@ define HALF \ |
32 | @%:@endif]], | 33 | (1LL << (sizeof (long long int) * CHAR_BIT - 2)) |
33 | [[long long int n = 1; | 34 | @%:@ define LLONG_MAX (HALF - 1 + HALF) |
34 | int i; | 35 | @%:@endif]], |
35 | for (i = 0; ; i++) | 36 | [[long long int n = 1; |
36 | { | 37 | int i; |
37 | long long int m = n << i; | 38 | for (i = 0; ; i++) |
38 | if (m >> i != n) | 39 | { |
39 | return 1; | 40 | long long int m = n << i; |
40 | if (LLONG_MAX / 2 < m) | 41 | if (m >> i != n) |
41 | break; | 42 | return 1; |
42 | } | 43 | if (LLONG_MAX / 2 < m) |
43 | return 0;]])], | 44 | break; |
44 | [ac_cv_type_long_long_int=yes], | 45 | } |
45 | [ac_cv_type_long_long_int=no], | 46 | return 0;]])], |
46 | [ac_cv_type_long_long_int=yes])], | 47 | [], |
47 | [ac_cv_type_long_long_int=no])]) | 48 | [ac_cv_type_long_long_int=no], |
49 | [:]) | ||
50 | fi | ||
51 | fi]) | ||
48 | if test $ac_cv_type_long_long_int = yes; then | 52 | if test $ac_cv_type_long_long_int = yes; then |
49 | AC_DEFINE([HAVE_LONG_LONG_INT], [1], | 53 | AC_DEFINE([HAVE_LONG_LONG_INT], [1], |
50 | [Define to 1 if the system has the type `long long int'.]) | 54 | [Define to 1 if the system has the type 'long long int'.]) |
51 | fi | 55 | fi |
52 | ]) | 56 | ]) |
53 | 57 | ||
54 | # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. | 58 | # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. |
55 | # This fixes a bug in Autoconf 2.61, but can be removed once we | 59 | # This fixes a bug in Autoconf 2.61, and can be faster |
56 | # assume 2.62 everywhere. | 60 | # than what's in Autoconf 2.62 through 2.68. |
57 | 61 | ||
58 | # Note: If the type 'unsigned long long int' exists but is only 32 bits | 62 | # 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 | 63 | # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT |
@@ -64,13 +68,16 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], | |||
64 | [ | 68 | [ |
65 | AC_CACHE_CHECK([for unsigned long long int], | 69 | AC_CACHE_CHECK([for unsigned long long int], |
66 | [ac_cv_type_unsigned_long_long_int], | 70 | [ac_cv_type_unsigned_long_long_int], |
67 | [AC_LINK_IFELSE( | 71 | [ac_cv_type_unsigned_long_long_int=yes |
68 | [_AC_TYPE_LONG_LONG_SNIPPET], | 72 | if test "x${ac_cv_prog_cc_c99-no}" = xno; then |
69 | [ac_cv_type_unsigned_long_long_int=yes], | 73 | AC_LINK_IFELSE( |
70 | [ac_cv_type_unsigned_long_long_int=no])]) | 74 | [_AC_TYPE_LONG_LONG_SNIPPET], |
75 | [], | ||
76 | [ac_cv_type_unsigned_long_long_int=no]) | ||
77 | fi]) | ||
71 | if test $ac_cv_type_unsigned_long_long_int = yes; then | 78 | if test $ac_cv_type_unsigned_long_long_int = yes; then |
72 | AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], | 79 | AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], |
73 | [Define to 1 if the system has the type `unsigned long long int'.]) | 80 | [Define to 1 if the system has the type 'unsigned long long int'.]) |
74 | fi | 81 | fi |
75 | ]) | 82 | ]) |
76 | 83 | ||