diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-02-12 11:07:18 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-02-12 11:07:18 +0000 |
commit | bd7029a99b0c2974265c6665638ef14a052f42ab (patch) | |
tree | f5661ba73366d81ef6e91f889ea7fec5ebe07b6b /gl/m4/longlong.m4 | |
parent | f99612320d6eda67644c07be04bb21aa4d7789db (diff) | |
download | monitoring-plugins-bd7029a99b0c2974265c6665638ef14a052f42ab.tar.gz |
Sync to latest Gnulib
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1925 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/m4/longlong.m4')
-rw-r--r-- | gl/m4/longlong.m4 | 78 |
1 files changed, 56 insertions, 22 deletions
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4 index 1f9e862e..15bf9dac 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 |
2 | dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1999-2007 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.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. |
64 | AC_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 | |||
63 | AC_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'). | ||
82 | AC_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 | ]) | ||