# [PATCH v0 3/3] config.mak.uname: Activate ICONV_RESTART_RESET if needed

1 messages from 2025-12-15 to 2025-12-15. Participants: tboegi@web.de.
Thread: https://gitlist.dev/t/64634

## tboegi@web.de, 2025-12-15 20:45

Subject: [PATCH v0 3/3] config.mak.uname: Activate ICONV_RESTART_RESET if needed
Message-ID: <20251215204524.1946518-1-tboegi@web.de>
URL: https://gitlist.dev/e/20251215204524.1946518-1-tboegi%40web.de

```
From: Torsten Bögershausen <tboegi@web.de>

utf8.c needs a tweak when calling the iconv library shipped with later
macOS versions (14,15):
'#define ICONV_RESTART_RESET' is needed, or
'BASIC_CFLAGS += -DICONV_RESTART_RESET' in Makefile language.

The tweak is not needed when Git is linked against iconv from
Fink or MacPorts or homebrew.
Neither when Git is compiled under older macOS versions.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 config.mak.uname | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/config.mak.uname b/config.mak.uname
index 44252dabcc..b76a51e22b 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -174,9 +174,11 @@ ifeq ($(uname_S),Darwin)
 
         ifeq ($(shell test -d /usr/local/opt/libiconv/ && echo y),y)
 		HOMEBREW_ICONVDIR = /usr/local/opt/libiconv
+		HAS_GOOD_ICONV = Yes
         endif
         ifeq ($(shell test -d /opt/homebrew/opt/libiconv/ && echo y),y)
 		HOMEBREW_ICONVDIR = /opt/homebrew/opt/libiconv
+		HAS_GOOD_ICONV = Yes
         endif
 
 	# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require
@@ -193,12 +195,14 @@ ifeq ($(uname_S),Darwin)
 		ifeq ($(shell test -d /sw/lib && echo y),y)
 			BASIC_CFLAGS += -I/sw/include
 			BASIC_LDFLAGS += -L/sw/lib
+			HAS_GOOD_ICONV = Yes
 		endif
 	endif
 	ifndef NO_DARWIN_PORTS
 		ifeq ($(shell test -d /opt/local/lib && echo y),y)
 			BASIC_CFLAGS += -I/opt/local/include
 			BASIC_LDFLAGS += -L/opt/local/lib
+			HAS_GOOD_ICONV = Yes
 		endif
 	endif
 	ifndef NO_APPLE_COMMON_CRYPTO
@@ -206,6 +210,12 @@ ifeq ($(uname_S),Darwin)
 		APPLE_COMMON_CRYPTO = YesPlease
 		COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
 	endif
+	ifndef HAS_GOOD_ICONV
+		ifeq ($(shell test "`expr "$(uname_R)" : '\([0-9][0-9]*\)\.'`" -ge 20 && echo 1),1)
+		# utf8.c needs a tweak when using iconv from os
+			BASIC_CFLAGS += -DICONV_RESTART_RESET
+		endif
+	endif
 	PTHREAD_LIBS =
 endif
 ifeq ($(uname_S),SunOS)
-- 
2.50.0.rc0.46.g7014b55638.dirty


```
