]> sjero.net Git - wget/blob - m4/ulonglong.m4
gnulib-tool --update; includes fix for maint.mk/gzip discovered by Steven M. Schweda.
[wget] / m4 / ulonglong.m4
1 # ulonglong.m4 serial 8
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.
6
7 dnl From Paul Eggert.
8
9 # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
10 # This fixes a bug in Autoconf 2.61, but can be removed once we
11 # assume 2.62 everywhere.
12
13 # Note: If the type 'unsigned long long int' exists but is only 32 bits
14 # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
15 # will not be defined. In this case you can treat 'unsigned long long int'
16 # like 'unsigned long int'.
17
18 AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
19 [
20   AC_CACHE_CHECK([for unsigned long long int],
21     [ac_cv_type_unsigned_long_long_int],
22     [AC_LINK_IFELSE(
23        [AC_LANG_PROGRAM(
24           [[#if ! (18446744073709551615ULL <= -1ull)
25               error in preprocessor;
26             #endif
27             unsigned long long int ull = 18446744073709551615ULL;
28             typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
29                            ? 1 : -1)];
30            int i = 63;]],
31           [[unsigned long long int ullmax = 18446744073709551615ull;
32             return (ull << 63 | ull >> 63 | ull << i | ull >> i
33                     | ullmax / ull | ullmax % ull);]])],
34        [ac_cv_type_unsigned_long_long_int=yes],
35        [ac_cv_type_unsigned_long_long_int=no])])
36   if test $ac_cv_type_unsigned_long_long_int = yes; then
37     AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
38       [Define to 1 if the system has the type `unsigned long long int'.])
39   fi
40 ])
41
42 # This macro is obsolescent and should go away soon.
43 AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
44 [
45   AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
46   ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
47   if test $ac_cv_type_unsigned_long_long = yes; then
48     AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
49       [Define if you have the 'unsigned long long' type.])
50   fi
51 ])