threads / patch / 64634

patch, 3 partsconfig.mak.uname: Activate ICONV_RESTART_RESET if needed

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

## tl;dr

One message between Dec 15, 2025 and Dec 15, 2025. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

tboegi@web.de· Dec 15, 2025, 20:45 UTC · lore
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(+)
Show changes to config.mak.uname +10 −0
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

← back to recent threads