Index: editors/nano/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/editors/nano/Makefile,v
retrieving revision 1.63
diff -u -r1.63 Makefile
--- editors/nano/Makefile	3 Jul 2017 12:12:30 -0000	1.63
+++ editors/nano/Makefile	7 Jul 2017 15:10:34 -0000
@@ -33,6 +33,14 @@
 INSTALLATION_DIRS+=	share/examples/nano
 CONF_FILES+=		share/examples/nano/nanorc ${PKG_SYSCONFDIR}/nanorc
 
+.if empty(USE_BUILTIN.ncursesw:Myes)
+SUBST_CLASSES+=         ncursesw
+SUBST_FILES.ncursesw+=  configure
+SUBST_STAGE.ncursesw=   pre-configure
+SUBST_SED.ncursesw+=    -e s:ncursesw5-config:ncursesw6-config:g
+SUBST_MESSAGE.ncursesw= Making configure look for ncursesw6-config.
+.endif
+
 post-install:
 	${INSTALL_DATA} ${WRKSRC}/doc/sample.nanorc ${DESTDIR}${PREFIX}/share/examples/nano/nanorc
 
