summaryrefslogtreecommitdiff
path: root/m4/ullong_max.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-09-28 22:08:46 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-09-28 22:08:46 +0000
commit6f8ed252b419965e428587ee7cef14ccfb31b7ef (patch)
tree5fe7e261de6e34b227fbd777364d70a7fb10a11f /m4/ullong_max.m4
parent6e212cc8501aa36a7d09066d142c74010006cc59 (diff)
downloadcoreutils-6f8ed252b419965e428587ee7cef14ccfb31b7ef.tar.xz
(gl_ULLONG_MAX): Simplify so that it merely
defines ULONG_MAX_LT_ULLONG_MAX. Thomas M.Ott reports that ULLONG_MAX doesn't work with 2.7.2.1.
Diffstat (limited to 'm4/ullong_max.m4')
-rw-r--r--m4/ullong_max.m445
1 files changed, 13 insertions, 32 deletions
diff --git a/m4/ullong_max.m4 b/m4/ullong_max.m4
index 49fc3402d..61fdce25e 100644
--- a/m4/ullong_max.m4
+++ b/m4/ullong_max.m4
@@ -11,36 +11,17 @@ AC_DEFUN([gl_ULLONG_MAX],
[
dnl Avoid _AC_COMPUTE_INT-related macros, as they may not work with
dnl types wider than long int, due to problems with expr.
- AC_CACHE_CHECK([for ULLONG_MAX], gl_cv_ullong_max,
- [gl_cv_ullong_max=no
- AC_EGREP_CPP([ULLONG_MAX is defined],
- [
- #include <limits.h>
- #ifdef ULLONG_MAX
- "ULLONG_MAX is defined"
- #endif
- ],
- [gl_cv_ullong_max=yes])
- case $gl_cv_ullong_max in
- no)
- for gl_expr in \
- 18446744073709551615ULL \
- 4722366482869645213695ULL \
- 340282366920938463463374607431768211455ULL
- do
- AC_TRY_COMPILE([],
- [char test[$gl_expr == (unsigned long long int) -1 ? 1 : -1];
- static unsigned long long int i = $gl_expr;
- return i && test;],
- [gl_cv_ullong_max=$gl_expr])
- test $gl_cv_ullong_max != no && break
- done
- esac])
- case $gl_cv_ullong_max in
- yes | no) ;;
- *)
- AC_DEFINE_UNQUOTED([ULLONG_MAX], [$gl_cv_ullong_max],
- [Define as the maximum value of the type 'unsigned long long int',
- if the system doesn't define it, and if the system has that type.]);;
- esac
+ AC_CACHE_CHECK([whether ULONG_MAX < ULLONG_MAX],
+ [gl_cv_ulong_max_lt_ullong_max],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_BOOL_COMPILE_TRY(
+ [AC_INCLUDES_DEFAULT],
+ [[(unsigned long int) -1 < (unsigned long long int) -1]])],
+ [gl_cv_ulong_max_lt_ullong_max=yes],
+ [gl_cv_ulong_max_lt_ullong_max=no])])
+ if test $gl_cv_ulong_max_lt_ullong_max = yes; then
+ AC_DEFINE([ULONG_MAX_LT_ULLONG_MAX], 1,
+ [Define if ULONG_MAX < ULLONG_MAX, even if your compiler does not
+ support ULLONG_MAX.])
+ fi
])