summaryrefslogtreecommitdiff
path: root/m4/ullong_max.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-01-03 23:43:39 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-01-03 23:43:39 +0000
commit30fa7301bccee2b8e827e8df7033f642951df779 (patch)
tree2420f8df51a9480a1239f231f8532f419ca0074e /m4/ullong_max.m4
parentb93b030de600eaf75ef28af3e65902c05d306af2 (diff)
downloadcoreutils-30fa7301bccee2b8e827e8df7033f642951df779.tar.xz
* m4/jm-macros.m4 (gl_MACROS): Require gl_ULLONG_MAX.
* m4/ullong_max.m4: New file. * src/system.h: Undo previous change; we now use Autoconf.
Diffstat (limited to 'm4/ullong_max.m4')
-rw-r--r--m4/ullong_max.m457
1 files changed, 57 insertions, 0 deletions
diff --git a/m4/ullong_max.m4 b/m4/ullong_max.m4
new file mode 100644
index 000000000..f51e3d66a
--- /dev/null
+++ b/m4/ullong_max.m4
@@ -0,0 +1,57 @@
+# ullong_max.m4 - define ULLONG_MAX if necessary
+
+# Copyright (C) 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Written by Paul Eggert.
+
+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
+])