Actually ULONG_WIDTH is part of C standard limits.h. However, not every platform conforms to the current standard. The Gnulib stdlib-h module works around this portability issue, but unfortunately Awk is not using stdlib-h so I installed the attached.
>From 07546bc557de0304154227aa709b581b1a4a19d4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Fri, 24 Jan 2020 00:32:32 -0800
Subject: [PATCH] regex: port to Gawk on nonstandard platforms

* lib/regex_internal.h (ULONG_WIDTH): Define if not already defined.
This is useful for Gawk, which does not use the Gnulib stdlib-h
module.  Problem reported by Arnold Robbins in:
https://lists.gnu.org/r/bug-gnulib/2020-01/msg00138.html
---
 ChangeLog            | 8 ++++++++
 lib/regex_internal.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 2336126b0..3b4d32dc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-24  Paul Eggert  <egg...@cs.ucla.edu>
+
+	regex: port to Gawk on nonstandard platforms
+	* lib/regex_internal.h (ULONG_WIDTH): Define if not already defined.
+	This is useful for Gawk, which does not use the Gnulib stdlib-h
+	module.  Problem reported by Arnold Robbins in:
+	https://lists.gnu.org/r/bug-gnulib/2020-01/msg00138.html
+
 2020-01-21  Paul Eggert  <egg...@cs.ucla.edu>
 
 	regex: fix bug with >=16 subexpressions
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 13e15e21e..6d436fde1 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -141,6 +141,9 @@
 #ifndef SSIZE_MAX
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
+#ifndef ULONG_WIDTH
+# define ULONG_WIDTH (CHAR_BIT * sizeof (unsigned long int))
+#endif
 
 /* The type of indexes into strings.  This is signed, not size_t,
    since the API requires indexes to fit in regoff_t anyway, and using
-- 
2.17.1

Reply via email to