From 4a59db1bd1cb39e7fde0d9a37eccf184042b457b Mon Sep 17 00:00:00 2001 From: Nicolas Ouellet-payeur Date: Fri, 16 Oct 2020 14:09:18 -0400 Subject: [PATCH] Fix wcwidth() compile error with MSYS2 We try to detect when compiling under Cygwin, so we can set the _XOPEN_SOURCE define which lets us use wcwidth(). We look for the string "CYGWIN" in the uname, which looks like: CYGWIN_NT-10.0 MSYS2 is also based on Cygwin, so all of the above should still work. However, we detect Cygwin by looking for the string "CYGWIN" in the uname. In MSYS2, the uname looks like: MSYS_NT-10.0-18362 This patch looks for the string "_NT" instead of the string "CYGWIN" in the uname, since it's common to both environments. This fixes a compilation error on MSYS2. --- src/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 3c791120..e292af60 100644 --- a/src/Makefile +++ b/src/Makefile @@ -77,7 +77,8 @@ else ifeq ($(os),OpenBSD) CPPFLAGS += -D'KAK_BIN_PATH="$(bindir)/kak"' -I/usr/local/include LDFLAGS += -L/usr/local/lib mandir := $(DESTDIR)$(PREFIX)/man/man1 -else ifneq (,$(findstring CYGWIN,$(os))) +else ifneq (,$(findstring _NT,$(os))) + # Both Cygwin and MSYS2 have "_NT" in their uname. CPPFLAGS += -D_XOPEN_SOURCE=700 LIBS += -lncursesw -ldbghelp else ifeq ($(os),SunOS)