From: Junio C Hamano Date: Thu, 14 Feb 2019 02:18:41 +0000 (-0800) Subject: Merge branch 'bc/utf16-portability-fix' X-Git-Tag: v2.21.0-rc1~7 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/18f9fb687f708b568301a4af87194fd72e4010e0?ds=inline;hp=-c Merge branch 'bc/utf16-portability-fix' The code and tests assume that the system supplied iconv() would always use BOM in its output when asked to encode to UTF-16 (or UTF-32), but apparently some implementations output big-endian without BOM. A compile-time knob has been added to help such systems (e.g. NonStop) to add BOM to the output to increase portability. * bc/utf16-portability-fix: utf8: handle systems that don't write BOM for UTF-16 --- 18f9fb687f708b568301a4af87194fd72e4010e0 diff --combined Makefile index af7e809ced,457311bc31..f0b2299172 --- a/Makefile +++ b/Makefile @@@ -259,6 -259,10 +259,10 @@@ all: # Define OLD_ICONV if your library has an old iconv(), where the second # (input buffer pointer) parameter is declared with type (const char **). # + # Define ICONV_OMITS_BOM if your iconv implementation does not write a + # byte-order mark (BOM) when writing UTF-16 or UTF-32 and always writes in + # big-endian format. + # # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound. # # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib" @@@ -433,8 -437,6 +437,8 @@@ # # Define HAVE_GETDELIM if your system has the getdelim() function. # +# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function. +# # Define PAGER_ENV to a SP separated VAR=VAL pairs to define # default environment variables to be passed when a pager is spawned, e.g. # @@@ -1417,6 -1419,9 +1421,9 @@@ ifndef NO_ICON EXTLIBS += $(ICONV_LINK) -liconv endif endif + ifdef ICONV_OMITS_BOM + BASIC_CFLAGS += -DICONV_OMITS_BOM + endif ifdef NEEDS_LIBGEN EXTLIBS += -lgen endif @@@ -1802,11 -1807,6 +1809,11 @@@ ifdef HAVE_WPGMPT BASIC_CFLAGS += -DHAVE_WPGMPTR endif +ifdef FILENO_IS_A_MACRO + COMPAT_CFLAGS += -DFILENO_IS_A_MACRO + COMPAT_OBJS += compat/fileno.o +endif + ifeq ($(TCLTK_PATH),) NO_TCLTK = NoThanks endif