Subject: Re: bug#17056: dfa.c patch for systems with no locale support

From: Paul Eggert <[email-masked]>
Date: Fri, 21 Mar 2014 11:09:15 -0700

That's odd, as DJGPP has <locale.h> which is supposed to declare 
setlocale and define LC_ALL, according to 
<http://www.delorie.com/djgpp/doc/libc/libc_705.html>.  Could you 
explain what goes wrong?

Does the following patch fix the problem?  It should isolate the issue 
better.

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; })]