]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
* m4/jm-macros.m4 (gl_MACROS): Require gl_ULLONG_MAX.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Jan 2005 23:43:39 +0000 (23:43 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Jan 2005 23:43:39 +0000 (23:43 +0000)
* m4/ullong_max.m4: New file.
* src/system.h: Undo previous change; we now use Autoconf.

ChangeLog
m4/ChangeLog
m4/jm-macros.m4
m4/ullong_max.m4 [new file with mode: 0644]
src/system.h

index a2fd6c934cf918ab513b5ace704127ca6c107d10..55b2b3d67bb8210d0b4fc90477f8edd9ecc6d7f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
-2005-01-03  Jim Meyering  <jim@meyering.net>
+2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
 
        * Version 5.3.0.
 
+       * src/system.h: Undo previous change; we now use Autoconf.
+
+2005-01-03  Jim Meyering  <jim@meyering.net>
+
        * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
        a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
        either (or both) to zero would succeed, but subsequent `stty size'
index e60bf704452e0f22966c818a4883a2a4483c5d22..db28abe10d1a6b2afeb2eda2439202b0f252aa04 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * ullong_max.m4: New file.
+       * jm-macros.m4 (gl_MACROS): Require gl_ULLONG_MAX.
+
 2005-01-03  Jim Meyering  <jim@meyering.net>
 
        * mkstemp.m4 (gl_FUNC_MKSTEMP): Don't `cd' into the temporary
index e03225c544291cd04363b21066cc09f051247ff7..fd5a000f5c92be4d09e9efa22da50ea508344700 100644 (file)
@@ -64,6 +64,7 @@ AC_DEFUN([gl_MACROS],
   # This is for od and stat, and any other program that
   # uses the PRI.MAX macros from inttypes.h.
   AC_REQUIRE([gt_INTTYPES_PRI])
+  AC_REQUIRE([gl_ULLONG_MAX])
 
   AC_REQUIRE([gl_FUNC_GETGROUPS])
 
diff --git a/m4/ullong_max.m4 b/m4/ullong_max.m4
new file mode 100644 (file)
index 0000000..f51e3d6
--- /dev/null
@@ -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
+])
index 9fd123812ca09ae23bbd44b551bc41157283a9a2..27aff00d799056e86af29ef261be1d90d7e7a918 100644 (file)
@@ -368,38 +368,28 @@ initialize_exit_failure (int status)
 # include <stdint.h>
 #endif
 
+#if ULONG_MAX < ULLONG_MAX
+# define LONGEST_MODIFIER "ll"
+#else
+# define LONGEST_MODIFIER "l"
+#endif
 #if PRI_MACROS_BROKEN
 # undef PRIdMAX
 # undef PRIoMAX
 # undef PRIuMAX
 # undef PRIxMAX
 #endif
-
-#if ULONG_MAX < ULLONG_MAX
-# define LONGEST_MODIFIER "ll"
-#else
-# define LONGEST_MODIFIER "l"
-#endif
-
 #ifndef PRIdMAX
 # define PRIdMAX LONGEST_MODIFIER "d"
-# defined USED_LONGEST_MODIFIER
 #endif
 #ifndef PRIoMAX
 # define PRIoMAX LONGEST_MODIFIER "o"
-# defined USED_LONGEST_MODIFIER
 #endif
 #ifndef PRIuMAX
 # define PRIuMAX LONGEST_MODIFIER "u"
-# defined USED_LONGEST_MODIFIER
 #endif
 #ifndef PRIxMAX
 # define PRIxMAX LONGEST_MODIFIER "x"
-# defined USED_LONGEST_MODIFIER
-#endif
-
-#if USED_LONGEST_MODIFIER && (!defined ULONG_MAX || !defined ULLONG_MAX)
-# error "your PRI.MAX macros are broken and we don't work around it"
 #endif
 
 #include <ctype.h>