1 # ullong_max.m4 - define ULLONG_MAX if necessary
3 # Copyright (C) 2005 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # Written by Paul Eggert.
21 AC_DEFUN([gl_ULLONG_MAX],
23 dnl Avoid _AC_COMPUTE_INT-related macros, as they may not work with
24 dnl types wider than long int, due to problems with expr.
25 AC_CACHE_CHECK([for ULLONG_MAX], gl_cv_ullong_max,
27 AC_EGREP_CPP([ULLONG_MAX is defined],
31 "ULLONG_MAX is defined"
34 [gl_cv_ullong_max=yes])
35 case $gl_cv_ullong_max in
38 18446744073709551615ULL \
39 4722366482869645213695ULL \
40 340282366920938463463374607431768211455ULL
43 [char test[$gl_expr == (unsigned long long int) -1 ? 1 : -1];
44 static unsigned long long int i = $gl_expr;
46 [gl_cv_ullong_max=$gl_expr])
47 test $gl_cv_ullong_max != no && break
50 case $gl_cv_ullong_max in
53 AC_DEFINE_UNQUOTED([ULLONG_MAX], [$gl_cv_ullong_max],
54 [Define as the maximum value of the type 'unsigned long long int',
55 if the system doesn't define it, and if the system has that type.]);;