Simplification rewrite for stdint module.
[gnulib.git] / m4 / ulonglong.m4
1 # ulonglong.m4 serial 5
2 dnl Copyright (C) 1999-2006 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.60, but can be removed once we
11 # assume 2.61 everywhere.
12
13 AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
14 [
15   AC_CACHE_CHECK([for unsigned long long int],
16     [ac_cv_type_unsigned_long_long_int],
17     [AC_LINK_IFELSE(
18        [AC_LANG_PROGRAM(
19           [[unsigned long long int ull = 18446744073709551615ULL;
20             typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
21                            ? 1 : -1)];
22            int i = 63;]],
23           [[unsigned long long int ullmax = 18446744073709551615ull;
24             return (ull << 63 | ull >> 63 | ull << i | ull >> i
25                     | ullmax / ull | ullmax % ull);]])],
26        [ac_cv_type_unsigned_long_long_int=yes],
27        [ac_cv_type_unsigned_long_long_int=no])])
28   if test $ac_cv_type_unsigned_long_long_int = yes; then
29     AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
30       [Define to 1 if the system has the type `unsigned long long int'.])
31   fi
32 ])
33
34 # This macro is obsolescent and should go away soon.
35 AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
36 [
37   AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
38   ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
39   if test $ac_cv_type_unsigned_long_long = yes; then
40     AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
41       [Define if you have the 'unsigned long long' type.])
42   fi
43 ])