blob: 8704310406d9a04143d6c800d29fc7558cd4fbc9 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001Use pkg-config to search for ncurses libraries
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
Andrew Geissler595f6302022-01-24 19:11:47 +00005--- a/Makefile
6+++ b/Makefile
7@@ -201,8 +201,8 @@ endif
Brad Bishopd7bf8c12018-02-25 22:55:05 -05008
9 ifndef NCURSES_LDFLAGS
10 ifdef NEEDS_NCURSES5
11- NCURSES_CFLAGS := $(shell ncurses5-config --cflags 2>/dev/null)
12- NCURSES_LDFLAGS := $(shell ncurses5-config --libs 2>/dev/null)
13+ NCURSES_CFLAGS := $(shell pkg-config ncurses --cflags 2>/dev/null)
14+ NCURSES_LDFLAGS := $(shell pkg-config ncurses --libs 2>/dev/null)
15 ifndef NO_PANEL
16 NCURSES_LDFLAGS += -lpanel
17 endif
Andrew Geissler595f6302022-01-24 19:11:47 +000018@@ -211,8 +211,8 @@ endif
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019
20 ifndef NCURSES_LDFLAGS
21 ifdef NEEDS_NCURSESW5
22- NCURSES_CFLAGS := $(shell ncursesw5-config --cflags 2>/dev/null)
23- NCURSES_LDFLAGS := $(shell ncursesw5-config --libs 2>/dev/null)
24+ NCURSES_CFLAGS := $(shell p[k-config ncursesw --cflags 2>/dev/null)
25+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
26 ifndef NO_PANEL
Andrew Geissler595f6302022-01-24 19:11:47 +000027 NCURSES_LDFLAGS += -lpanelw
Brad Bishopd7bf8c12018-02-25 22:55:05 -050028 endif
Andrew Geissler595f6302022-01-24 19:11:47 +000029@@ -221,8 +221,8 @@ endif
Brad Bishopd7bf8c12018-02-25 22:55:05 -050030
31 ifndef NCURSES_LDFLAGS
32 ifdef NEEDS_NCURSES6
33- NCURSES_CFLAGS := $(shell ncurses6-config --cflags 2>/dev/null)
34- NCURSES_LDFLAGS := $(shell ncurses6-config --libs 2>/dev/null)
35+ NCURSES_CFLAGS := $(shell pkg-config ncurses6 --cflags 2>/dev/null)
36+ NCURSES_LDFLAGS := $(shell pkg-config ncurses6 --libs 2>/dev/null)
37 ifndef NO_PANEL
38 NCURSES_LDFLAGS += -lpanel
39 endif
Andrew Geissler595f6302022-01-24 19:11:47 +000040@@ -231,8 +231,8 @@ endif
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041
42 ifndef NCURSES_LDFLAGS
43 ifdef NEEDS_NCURSESW6
44- NCURSES_CFLAGS := $(shell ncursesw6-config --cflags 2>/dev/null)
45- NCURSES_LDFLAGS := $(shell ncursesw6-config --libs 2>/dev/null)
46+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
47+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
48 ifndef NO_PANEL
Andrew Geissler595f6302022-01-24 19:11:47 +000049 NCURSES_LDFLAGS += -lpanelw
Brad Bishopd7bf8c12018-02-25 22:55:05 -050050 endif
Andrew Geissler595f6302022-01-24 19:11:47 +000051@@ -241,27 +241,27 @@ endif
52
Brad Bishopd7bf8c12018-02-25 22:55:05 -050053 # try find ncuses by autodetect
54 ifndef NCURSES_LDFLAGS
Andrew Geissler595f6302022-01-24 19:11:47 +000055- ifneq ($(shell ncursesw6-config --libs 2>/dev/null),)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050056- NCURSES_CFLAGS := $(shell ncursesw6-config --cflags 2>/dev/null)
57- NCURSES_LDFLAGS := $(shell ncursesw6-config --libs 2>/dev/null)
Andrew Geissler595f6302022-01-24 19:11:47 +000058+ ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
59+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
60+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
61 ifndef NO_PANEL
62 NCURSES_LDFLAGS += -lpanelw
63 endif
Brad Bishopd7bf8c12018-02-25 22:55:05 -050064- else ifneq ($(shell ncurses6-config --libs 2>/dev/null),)
65- NCURSES_CFLAGS := $(shell ncurses6-config --cflags 2>/dev/null)
66- NCURSES_LDFLAGS := $(shell ncurses6-config --libs 2>/dev/null)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050067+ else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
68+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
69+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
Andrew Geissler595f6302022-01-24 19:11:47 +000070 ifndef NO_PANEL
71 NCURSES_LDFLAGS += -lpanel
72 endif
73- else ifneq ($(shell ncursesw5-config --libs 2>/dev/null),)
74- NCURSES_CFLAGS := $(shell ncursesw5-config --cflags 2>/dev/null)
75- NCURSES_LDFLAGS := $(shell ncursesw5-config --libs 2>/dev/null)
76+ else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
77+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
78+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
79 ifndef NO_PANEL
80 NCURSES_LDFLAGS += -lpanelw
81 endif
82- else ifneq ($(shell ncurses5-config --libs 2>/dev/null),)
83- NCURSES_CFLAGS := $(shell ncurses5-config --cflags 2>/dev/null)
84- NCURSES_LDFLAGS := $(shell ncurses5-config --libs 2>/dev/null)
85+ else ifneq ($(shell pkg-config ncursesw --libs 2>/dev/null),)
86+ NCURSES_CFLAGS := $(shell pkg-config ncursesw --cflags 2>/dev/null)
87+ NCURSES_LDFLAGS := $(shell pkg-config ncursesw --libs 2>/dev/null)
88 ifndef NO_PANEL
89 NCURSES_LDFLAGS += -lpanel
90 endif