Subject: Re: bug#17056: dfa.c patch for systems with no locale support
From: Paul Eggert <[email-masked]>
To: Aharon Robbins <[email-masked]>, [email-masked]
Date: Sun, 23 Mar 2014 14:16:47 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Aharon Robbins wrote:

> See the original report below

I downloaded the DJGPP sources.  LC_ALL is defined unless one compiles 
as a freestanding environment, in which case neither LC_ALL nor 
setlocale are declared.  So my guess is that your correspondent is using 
a freestanding environment somehow, and the patch that I suggested 
should work.  It's better to avoid #ifdefs inside functions so I 
installed this into the grep master (see attached) and am marking this 
as done; we can always resurrect it if my guess is wrong.

From c3a693e829ad9d9a3a7e74a8cfadb2e1f0dfa30d Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 23 Mar 2014 14:10:18 -0700
Subject: [PATCH] dfa: port to freestanding DJGPP (Bug#17056)

* src/dfa.c (setlocale) [!LC_ALL]: Define a dummy.
---
 src/dfa.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/dfa.c b/src/dfa.c
index 5e60cd5..92ac1b9 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -34,7 +34,11 @@
 #include <locale.h>
 #include <stdbool.h>
 
-/* Gawk doesn't use Gnulib, so don't assume static_assert is present.  */
+/* Gawk doesn't use Gnulib, so don't assume that setlocale and
+   static_assert are present.  */
+#ifndef LC_ALL
+# define setlocale(category, locale) NULL
+#endif
 #ifndef static_assert
 # define static_assert(cond, diagnostic) \
     extern int (*foo (void)) [!!sizeof (struct { int foo: (cond) ? 8 : -1; })]
-- 
1.8.5.3