summaryrefslogtreecommitdiffstats
path: root/gl/m4/longlong.m4
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2007-01-24 22:47:25 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2007-01-24 22:47:25 +0000
commitfe856aa957978504137c1d425815d4ed8a22be40 (patch)
treea5bb46ce0e64b2056f75700eadbf27aba7c39418 /gl/m4/longlong.m4
parent210f39bc84cfbb21cd72dc054e43f13815ee0616 (diff)
downloadmonitoring-plugins-fe856aa957978504137c1d425815d4ed8a22be40.tar.gz
Sync with gnulib - lots of extraneous code removed in preference to GNU code
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1580 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/m4/longlong.m4')
-rw-r--r--gl/m4/longlong.m472
1 files changed, 72 insertions, 0 deletions
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4
new file mode 100644
index 00000000..1f9e862e
--- /dev/null
+++ b/gl/m4/longlong.m4
@@ -0,0 +1,72 @@
1# longlong.m4 serial 10
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_LONG_LONG_INT if '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 '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'.
16
17AC_DEFUN([AC_TYPE_LONG_LONG_INT],
18[
19 AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
20 [AC_LINK_IFELSE(
21 [AC_LANG_PROGRAM(
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.
32 dnl If cross compiling, assume the bug isn't important, since
33 dnl nobody cross compiles for this platform as far as we know.
34 AC_RUN_IFELSE(
35 [AC_LANG_PROGRAM(
36 [[@%:@include <limits.h>
37 @%:@ifndef LLONG_MAX
38 @%:@ define HALF \
39 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
40 @%:@ define LLONG_MAX (HALF - 1 + HALF)
41 @%:@endif]],
42 [[long long int n = 1;
43 int i;
44 for (i = 0; ; i++)
45 {
46 long long int m = n << i;
47 if (m >> i != n)
48 return 1;
49 if (LLONG_MAX / 2 < m)
50 break;
51 }
52 return 0;]])],
53 [ac_cv_type_long_long_int=yes],
54 [ac_cv_type_long_long_int=no],
55 [ac_cv_type_long_long_int=yes])],
56 [ac_cv_type_long_long_int=no])])
57 if test $ac_cv_type_long_long_int = yes; then
58 AC_DEFINE([HAVE_LONG_LONG_INT], 1,
59 [Define to 1 if the system has the type `long long int'.])
60 fi
61])
62
63# This macro is obsolescent and should go away soon.
64AC_DEFUN([gl_AC_TYPE_LONG_LONG],
65[
66 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
67 ac_cv_type_long_long=$ac_cv_type_long_long_int
68 if test $ac_cv_type_long_long = yes; then
69 AC_DEFINE(HAVE_LONG_LONG, 1,
70 [Define if you have the 'long long' type.])
71 fi
72])