Subject: [PATCH] config.mak.uname: use iconv from Homebrew on macOS

From: René Scharfe <[email-masked]>
Date: Tue, 9 Dec 2025 20:35:34 +0100

The library function iconv(3) supplied with macOS versions 15.7.2
(Sequoia) and 26.1 (Tahoe) is unreliable when doing conversions from
ISO-2022-JP to UTF-8 in multiple steps; t3900 reports this breakage:

  not ok 17 - ISO-2022-JP should be shown in UTF-8 now
  not ok 25 - ISO-2022-JP should be shown in UTF-8 now
  not ok 38 - commit --fixup into ISO-2022-JP from UTF-8

As a workaround, use libiconv from Homebrew, if available.

Helped-by: Koji Nakamaru <[email-masked]>
Signed-off-by: René Scharfe <[email-masked]>
---
 config.mak.uname | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index 1691c6ae6e..1b305e38c6 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -182,6 +182,13 @@ ifeq ($(uname_S),Darwin)
         endif
         endif
 
+	ifeq ($(shell test -d /opt/homebrew/opt/libiconv/ && echo y),y)
+		ICONVDIR ?= /opt/homebrew/opt/libiconv
+	endif
+	ifeq ($(shell test -d /usr/local/opt/libiconv/ && echo y),y)
+		ICONVDIR ?= /usr/local/opt/libiconv
+	endif
+
 	BASIC_LDFLAGS += -framework CoreServices
 endif
 ifeq ($(uname_S),SunOS)
-- 
2.52.0