1 # longlong.m4 serial 11
2 dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
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
11 # assume 2.62 everywhere.
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
15 # defined. In this case you can treat 'long long int' like 'long int'.
17 AC_DEFUN([AC_TYPE_LONG_LONG_INT],
19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
22 [[#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
23 error in preprocessor;
25 long long int ll = 9223372036854775807ll;
26 long long int nll = -9223372036854775807LL;
27 typedef int a[((-9223372036854775807LL < 0
28 && 0 < 9223372036854775807ll)
31 [[long long int llmax = 9223372036854775807ll;
32 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
33 | (llmax / ll) | (llmax % ll));]])],
34 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
35 dnl If cross compiling, assume the bug isn't important, since
36 dnl nobody cross compiles for this platform as far as we know.
39 [[@%:@include <limits.h>
42 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
43 @%:@ define LLONG_MAX (HALF - 1 + HALF)
45 [[long long int n = 1;
49 long long int m = n << i;
52 if (LLONG_MAX / 2 < m)
56 [ac_cv_type_long_long_int=yes],
57 [ac_cv_type_long_long_int=no],
58 [ac_cv_type_long_long_int=yes])],
59 [ac_cv_type_long_long_int=no])])
60 if test $ac_cv_type_long_long_int = yes; then
61 AC_DEFINE([HAVE_LONG_LONG_INT], 1,
62 [Define to 1 if the system has the type `long long int'.])
66 # This macro is obsolescent and should go away soon.
67 AC_DEFUN([gl_AC_TYPE_LONG_LONG],
69 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
70 ac_cv_type_long_long=$ac_cv_type_long_long_int
71 if test $ac_cv_type_long_long = yes; then
72 AC_DEFINE(HAVE_LONG_LONG, 1,
73 [Define if you have the 'long long' type.])