V Wed, Apr 12, 2023 at 12:35:30PM +0200, Andrej Shadura napsal(a):
> On Wed, 12 Apr 2023, at 12:21, Petr Pisar wrote:
> > I noticed that indent-2.2.13 stopped printing localized messages:
> 
> > That's because setlocale() is not called in src/indent.c:
> >
> >     #if defined (HAVE_SETLOCALE)
> >         setlocale(LC_ALL, "");
> >     #endif
> >
> > because HAVE_SETLOCALE is not defined in config.h.
> >
> > It seems that configure.ac ported to autoconf-2.71
> > (AC_CHECK_INCLUDES_DEFAULT?) stopped checking for setlocale() and defining 
> > the
> > macro. Actually diffing config.h between 2.2.12 and 2.2.13, both generated
> > with the same autoconf, shows plenty of removed macros. So HAVE_SETLOCALE
> > might be not the only missing feature.
> 
> Thanks. That's concerning, I'll have a look.
> 
I went through HAVE_* and USE_* macros, and it seems that the only macro used in
code but missing from config.h is HAVE_SETLOCALE. A patch is attached.

-- Petr
From 3734443b661799b8fa893d4379be62cd1ce96ae0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Wed, 12 Apr 2023 12:43:23 +0200
Subject: [PATCH] Check for setlocale() function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

After modernizing configure.ac, setlocale() stopped to be checked,
HAVE_SETLOCALE defined, and setlocale() called from main(). As
a result indent-2.2.13 stopped printing localized messages.

This patch fixes it.

I checked all HAVE_ macros for their configure-time checks.
HAVE_SETLOCALE was the only missing.

<https://lists.gnu.org/archive/html/bug-indent/2023-04/msg00001.html>

Signed-off-by: Petr Písař <ppi...@redhat.com>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 92b612d..85f4383 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,7 @@ AC_SUBST(localedir)
 AC_CHECK_INCLUDES_DEFAULT
 AC_PROG_EGREP
 
-AC_CHECK_FUNCS(strchr memcpy memmove utime)
+AC_CHECK_FUNCS(setlocale strchr memcpy memmove utime)
 AC_CHECK_HEADERS(unistd.h string.h malloc.h utime.h sys/utime.h)
 
 if test "$ac_cv_func_utime" = yes
-- 
2.40.0

Attachment: signature.asc
Description: PGP signature

Reply via email to