Author: Aggelos Avgerinos <evaggelos.avgerinos@gmail.com>
Description: Add ncursesw compatibility
Last-Update: 2015-04-03
Forwared: https://github.com/thoughtbot/pick/pull/49

Index: pick/configure.ac
===================================================================
--- pick.orig/configure.ac
+++ pick/configure.ac
@@ -9,7 +9,7 @@ AC_TYPE_SSIZE_T
 AC_FUNC_MALLOC
 AC_FUNC_REALLOC
 AC_CHECK_FUNCS([memmove setlocale strdup strlcpy strlcat])
-AC_SEARCH_LIBS([initscr], [ncurses], [], [
+AC_SEARCH_LIBS([initscr], [ncursesw ncurses], [], [
   AC_MSG_ERROR([unable to find initscr() function. Try to install ncurses])
 ])

@@ -46,5 +46,12 @@ AC_TRY_LINK([
 AC_DEFINE(HAVE_FULL_QUEUE_H,, Define if sys/queue.h includes required macros)
 ])

+AC_TRY_LINK([
+	#include <ncursesw/curses.h>
+	#include <ncursesw/term.h>
+], [], [
+AC_DEFINE(HAVE_NCURSESW_H,, Define if ncursesw is available)
+])
+
 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
 AC_OUTPUT
Index: pick/src/ui.c
===================================================================
--- pick.orig/src/ui.c
+++ pick/src/ui.c
@@ -1,7 +1,5 @@
 #include "config.h"
 #include <termios.h>
-#include <curses.h>
-#include <term.h>
 #include <err.h>
 #include <fcntl.h>
 #include <locale.h>
@@ -11,6 +9,14 @@
 #include <string.h>
 #include <unistd.h>

+#ifdef HAVE_NCURSESW_H
+#include <ncursesw/curses.h>
+#include <ncursesw/term.h>
+#else
+#include <curses.h>
+#include <term.h>
+#endif
+
 #ifdef HAVE_FULL_QUEUE_H
 #include <sys/queue.h>
 #else /* HAVE_FULL_QUEUE_H */
