1*4882a593SmuzhiyunUse pkg-config to search for ncurses libraries
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunSigned-off-by: Khem Raj <raj.khem@gmail.com>
4*4882a593SmuzhiyunUpstream-Status: Pending
5*4882a593Smuzhiyun--- a/Makefile
6*4882a593Smuzhiyun+++ b/Makefile
7*4882a593Smuzhiyun@@ -201,8 +201,8 @@ endif
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun ifndef NCURSES_LDFLAGS
10*4882a593Smuzhiyun ifdef NEEDS_NCURSES5
11*4882a593Smuzhiyun-	NCURSES_CFLAGS := $(shell ncurses5-config --cflags 2>/dev/null)
12*4882a593Smuzhiyun-	NCURSES_LDFLAGS := $(shell ncurses5-config --libs 2>/dev/null)
13*4882a593Smuzhiyun+	NCURSES_CFLAGS := $(shell pkg-config ncurses --cflags 2>/dev/null)
14*4882a593Smuzhiyun+	NCURSES_LDFLAGS := $(shell pkg-config ncurses --libs 2>/dev/null)
15*4882a593Smuzhiyun 	ifndef NO_PANEL
16*4882a593Smuzhiyun 		NCURSES_LDFLAGS += -lpanel
17*4882a593Smuzhiyun 	endif
18*4882a593Smuzhiyun@@ -211,8 +211,8 @@ endif
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun ifndef NCURSES_LDFLAGS
21*4882a593Smuzhiyun ifdef NEEDS_NCURSESW5
22*4882a593Smuzhiyun-	NCURSES_CFLAGS := $(shell ncursesw5-config --cflags 2>/dev/null)
23*4882a593Smuzhiyun-	NCURSES_LDFLAGS := $(shell ncursesw5-config --libs 2>/dev/null)
24*4882a593Smuzhiyun+	NCURSES_CFLAGS := $(shell p[k-config ncursesw --cflags 2>/dev/null)
25*4882a593Smuzhiyun+	NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
26*4882a593Smuzhiyun 	ifndef NO_PANEL
27*4882a593Smuzhiyun 		NCURSES_LDFLAGS += -lpanelw
28*4882a593Smuzhiyun 	endif
29*4882a593Smuzhiyun@@ -221,8 +221,8 @@ endif
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun ifndef NCURSES_LDFLAGS
32*4882a593Smuzhiyun ifdef NEEDS_NCURSES6
33*4882a593Smuzhiyun-	NCURSES_CFLAGS := $(shell ncurses6-config --cflags 2>/dev/null)
34*4882a593Smuzhiyun-	NCURSES_LDFLAGS := $(shell ncurses6-config --libs 2>/dev/null)
35*4882a593Smuzhiyun+	NCURSES_CFLAGS := $(shell pkg-config ncurses6 --cflags 2>/dev/null)
36*4882a593Smuzhiyun+	NCURSES_LDFLAGS := $(shell pkg-config ncurses6 --libs 2>/dev/null)
37*4882a593Smuzhiyun 	ifndef NO_PANEL
38*4882a593Smuzhiyun 		NCURSES_LDFLAGS += -lpanel
39*4882a593Smuzhiyun 	endif
40*4882a593Smuzhiyun@@ -231,8 +231,8 @@ endif
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun ifndef NCURSES_LDFLAGS
43*4882a593Smuzhiyun ifdef NEEDS_NCURSESW6
44*4882a593Smuzhiyun-	NCURSES_CFLAGS := $(shell ncursesw6-config --cflags 2>/dev/null)
45*4882a593Smuzhiyun-	NCURSES_LDFLAGS := $(shell ncursesw6-config --libs 2>/dev/null)
46*4882a593Smuzhiyun+	NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
47*4882a593Smuzhiyun+	NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
48*4882a593Smuzhiyun 	ifndef NO_PANEL
49*4882a593Smuzhiyun 		NCURSES_LDFLAGS += -lpanelw
50*4882a593Smuzhiyun 	endif
51*4882a593Smuzhiyun@@ -241,27 +241,27 @@ endif
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun # try find ncuses by autodetect
54*4882a593Smuzhiyun ifndef NCURSES_LDFLAGS
55*4882a593Smuzhiyun-	ifneq ($(shell ncursesw6-config --libs 2>/dev/null),)
56*4882a593Smuzhiyun-		NCURSES_CFLAGS := $(shell ncursesw6-config --cflags 2>/dev/null)
57*4882a593Smuzhiyun-		NCURSES_LDFLAGS := $(shell ncursesw6-config --libs 2>/dev/null)
58*4882a593Smuzhiyun+	ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
59*4882a593Smuzhiyun+		NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
60*4882a593Smuzhiyun+		NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
61*4882a593Smuzhiyun 		ifndef NO_PANEL
62*4882a593Smuzhiyun 			NCURSES_LDFLAGS += -lpanelw
63*4882a593Smuzhiyun 		endif
64*4882a593Smuzhiyun-	else ifneq ($(shell ncurses6-config --libs 2>/dev/null),)
65*4882a593Smuzhiyun-		NCURSES_CFLAGS := $(shell ncurses6-config --cflags 2>/dev/null)
66*4882a593Smuzhiyun-		NCURSES_LDFLAGS := $(shell ncurses6-config --libs 2>/dev/null)
67*4882a593Smuzhiyun+	else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
68*4882a593Smuzhiyun+		NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
69*4882a593Smuzhiyun+		NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
70*4882a593Smuzhiyun 		ifndef NO_PANEL
71*4882a593Smuzhiyun 			NCURSES_LDFLAGS += -lpanel
72*4882a593Smuzhiyun 		endif
73*4882a593Smuzhiyun-	else ifneq ($(shell ncursesw5-config --libs 2>/dev/null),)
74*4882a593Smuzhiyun-		NCURSES_CFLAGS := $(shell ncursesw5-config --cflags 2>/dev/null)
75*4882a593Smuzhiyun-		NCURSES_LDFLAGS := $(shell ncursesw5-config --libs 2>/dev/null)
76*4882a593Smuzhiyun+	else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
77*4882a593Smuzhiyun+		NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
78*4882a593Smuzhiyun+		NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
79*4882a593Smuzhiyun 		ifndef NO_PANEL
80*4882a593Smuzhiyun 			NCURSES_LDFLAGS += -lpanelw
81*4882a593Smuzhiyun 		endif
82*4882a593Smuzhiyun-	else ifneq ($(shell ncurses5-config --libs 2>/dev/null),)
83*4882a593Smuzhiyun-		NCURSES_CFLAGS := $(shell ncurses5-config --cflags 2>/dev/null)
84*4882a593Smuzhiyun-		NCURSES_LDFLAGS := $(shell ncurses5-config --libs 2>/dev/null)
85*4882a593Smuzhiyun+	else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
86*4882a593Smuzhiyun+		NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
87*4882a593Smuzhiyun+		NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
88*4882a593Smuzhiyun 		ifndef NO_PANEL
89*4882a593Smuzhiyun 			NCURSES_LDFLAGS += -lpanel
90*4882a593Smuzhiyun 		endif
91