From 9eed24bbac968f85d40d6d2d9b05e834a6ab6614 Mon Sep 17 00:00:00 2001
From: Johnathan Jenkins <john@nixheads.co.uk>
Date: Sat, 13 May 2017 09:33:08 -0700
Subject: [PATCH] pkg-config for ncurses (#25)

---
 Makefile | 9 ++++++---
 nnn.c    | 4 ----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 69e19e3e..efd9555a 100644
--- a/Makefile
+++ b/Makefile
@@ -5,12 +5,15 @@ MANPREFIX = $(PREFIX)/share/man
 
 CFLAGS += -O3 -march=native -Wall -Wextra -Wno-unused-parameter
 LDLIBS = -lreadline
-ifeq ($(shell uname), Darwin)
-    LDLIBS += -lncurses
+
+ifeq ($(shell pkg-config ncursesw && echo 1),1)
+	CFLAGS += $(shell pkg-config --cflags ncursesw)
+	LDLIBS += $(shell pkg-config --libs   ncursesw)
 else
-    LDLIBS += -lncursesw
+	LDLIBS += -lncurses
 endif
 
+
 DISTFILES = nlay nnn.c config.def.h nnn.1 Makefile README.md LICENSE
 LOCALCONFIG = config.h
 SRC = nnn.c
diff --git a/nnn.c b/nnn.c
index cedaff19..1bd9a670 100644
--- a/nnn.c
+++ b/nnn.c
@@ -6,11 +6,7 @@
 #include <sys/resource.h>
 
 #include <ctype.h>
-#ifdef __linux__
-#include <ncursesw/curses.h>
-#else
 #include <curses.h>
-#endif
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
-- 
2.51.0