diff options
author | Bruno Haible <bruno@clisp.org> | 2007-10-31 12:07:19 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:15:27 +0200 |
commit | 7e78575f8f57b9df283466a297075e5660f56889 (patch) | |
tree | bc364e79117923fe19bda40beb1dac6e499c2612 /gettext-runtime/m4/longlong.m4 | |
parent | caaefc80725bf5323fe7edfae8ecf27b0f90e9b6 (diff) | |
download | external_gettext-7e78575f8f57b9df283466a297075e5660f56889.zip external_gettext-7e78575f8f57b9df283466a297075e5660f56889.tar.gz external_gettext-7e78575f8f57b9df283466a297075e5660f56889.tar.bz2 |
Ensure AC_TYPE_LONG_LONG_INT and AC_TYPE_UNSIGNED_LONG_LONG_INT are consistent.
Diffstat (limited to 'gettext-runtime/m4/longlong.m4')
-rw-r--r-- | gettext-runtime/m4/longlong.m4 | 78 |
1 files changed, 56 insertions, 22 deletions
diff --git a/gettext-runtime/m4/longlong.m4 b/gettext-runtime/m4/longlong.m4 index 5799c39..a72e53b 100644 --- a/gettext-runtime/m4/longlong.m4 +++ b/gettext-runtime/m4/longlong.m4 @@ -1,4 +1,4 @@ -# longlong.m4 serial 11 +# longlong.m4 serial 13 dnl Copyright (C) 1999-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,23 +18,11 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], [ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - error in preprocessor; - #endif - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - typedef int a[((-9223372036854775807LL < 0 - && 0 < 9223372036854775807ll) - ? 1 : -1)]; - int i = 63;]], - [[long long int llmax = 9223372036854775807ll; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll));]])], + [_AC_TYPE_LONG_LONG_SNIPPET], [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. dnl If cross compiling, assume the bug isn't important, since dnl nobody cross compiles for this platform as far as we know. - AC_RUN_IFELSE( + AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[@%:@include <limits.h> @%:@ifndef LLONG_MAX @@ -63,13 +51,59 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], fi ]) -# This macro is obsolescent and should go away soon. -AC_DEFUN([gl_AC_TYPE_LONG_LONG], +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. + +# Note: If the type 'unsigned long long int' exists but is only 32 bits +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT +# will not be defined. In this case you can treat 'unsigned long long int' +# like 'unsigned long int'. + +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - ac_cv_type_long_long=$ac_cv_type_long_long_int - if test $ac_cv_type_long_long = yes; then - AC_DEFINE(HAVE_LONG_LONG, 1, - [Define if you have the 'long long' type.]) + AC_CACHE_CHECK([for unsigned long long int], + [ac_cv_type_unsigned_long_long_int], + [AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [ac_cv_type_unsigned_long_long_int=yes], + [ac_cv_type_unsigned_long_long_int=no])]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, + [Define to 1 if the system has the type `unsigned long long int'.]) fi ]) + +# Expands to a C program that can be used to test for simultaneous support +# of 'long long' and 'unsigned long long'. We don't want to say that +# 'long long' is available if 'unsigned long long' is not, or vice versa, +# because too many programs rely on the symmetry between signed and unsigned +# integer types (excluding 'bool'). +AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], +[ + AC_LANG_PROGRAM( + [[/* Test preprocessor. */ + #if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + error in preprocessor; + #endif + #if ! (18446744073709551615ULL <= -1ull) + error in preprocessor; + #endif + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63;]], + [[/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull));]]) +]) |