Skip to content

Commit fdb1fbb

Browse files
sunshinecogitster
authored andcommitted
Makefile: make NO_ICONV really mean "no iconv"
The Makefile tweak NO_ICONV is meant to allow Git to be built without iconv in case iconv is not installed or is otherwise dysfunctional. However, NO_ICONV's disabling of iconv is incomplete and can incorrectly allow "-liconv" to slip into the linker flags when NEEDS_LIBICONV is defined, which breaks the build when iconv is not installed. On some platforms, iconv lives directly in libc, whereas, on others it resides in libiconv. For the latter case, NEEDS_LIBICONV instructs the Makefile to add "-liconv" to the linker flags. config.mak.uname automatically defines NEEDS_LIBICONV for platforms which require it. The adding of "-liconv" is done unconditionally, despite NO_ICONV. Work around this problem by making NO_ICONV take precedence over NEEDS_LIBICONV. Reported by: Mahmoud Al-Qudsi <[email protected]> Signed-off-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a42a58d commit fdb1fbb

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Makefile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,17 +1288,19 @@ ifdef APPLE_COMMON_CRYPTO
12881288
LIB_4_CRYPTO += -framework Security -framework CoreFoundation
12891289
endif
12901290
endif
1291-
ifdef NEEDS_LIBICONV
1292-
ifdef ICONVDIR
1293-
BASIC_CFLAGS += -I$(ICONVDIR)/include
1294-
ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1295-
else
1296-
ICONV_LINK =
1297-
endif
1298-
ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1299-
ICONV_LINK += -lintl
1291+
ifndef NO_ICONV
1292+
ifdef NEEDS_LIBICONV
1293+
ifdef ICONVDIR
1294+
BASIC_CFLAGS += -I$(ICONVDIR)/include
1295+
ICONV_LINK = -L$(ICONVDIR)/$(lib) $(CC_LD_DYNPATH)$(ICONVDIR)/$(lib)
1296+
else
1297+
ICONV_LINK =
1298+
endif
1299+
ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
1300+
ICONV_LINK += -lintl
1301+
endif
1302+
EXTLIBS += $(ICONV_LINK) -liconv
13001303
endif
1301-
EXTLIBS += $(ICONV_LINK) -liconv
13021304
endif
13031305
ifdef NEEDS_LIBGEN
13041306
EXTLIBS += -lgen

0 commit comments

Comments
 (0)