Hello,

I ran into an issue building GNU indent from master. The configure
script correctly detects setlocale () but does not check for locale.h.
This means that the actual program doesn't include the header. Usually
the missing symbol is fine but LC_ALL being undefined stops it from
building. I've attached a simple patch just to check for locale.h to
make sure that it is defined.

Thanks,
Collin
From 4dd67fe0615f9ba5b20cca136b65b78848eba7f6 Mon Sep 17 00:00:00 2001
From: Collin Funk <[email protected]>
Date: Mon, 12 Feb 2024 01:49:17 -0800
Subject: [PATCH] Make sure that config.h defines HAVE_LOCALE_H

The setlocale () function is correctly detected and sets
HAVE_SETLOCALE to one. However, the configure script does not check
for locale.h which defines HAVE_LOCALE_H. This results in main ()
calling setlocale () without including the header. The missing
prototype causes a warning and the missing definition of LC_ALL causes
an error independent of compiler flags. The addition of this check
fixes build problems.

Signed-off-by: Collin Funk <[email protected]>
---
 ChangeLog    | 3 +++
 configure.ac | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 24bbb66..4cfc04d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2024-02-12  Collin Funk  <[email protected]>
+	* Make sure that HAVE_LOCALE_H is defined
+
 2023-01-26 Andrej Shadura <[email protected]>
 	* Run tests with C locale
 	* Add large file support
diff --git a/configure.ac b/configure.ac
index 85f4383..80743d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ AC_CHECK_INCLUDES_DEFAULT
 AC_PROG_EGREP
 
 AC_CHECK_FUNCS(setlocale strchr memcpy memmove utime)
-AC_CHECK_HEADERS(unistd.h string.h malloc.h utime.h sys/utime.h)
+AC_CHECK_HEADERS(locale.h unistd.h string.h malloc.h utime.h sys/utime.h)
 
 if test "$ac_cv_func_utime" = yes
 then
-- 
2.39.2

Reply via email to