Useful since curses cocks up any portability here. We prioritise the user's entries in CURSESLIB where possible, and use LIBS when pkg-config cannot be used.
An opinioned change (maybe the user should just figure this stuff out
himself or curses should be fixed).
---
Makefile | 31 +++++++++++++++++++++++++++++++
config.mk | 4 +++-
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 4c00649..5cf1e3a 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,37 @@ GETVER = $$(git rev-parse --is-inside-work-tree >/dev/null
2>&1 \
&& git describe --tags \
|| echo $(DEFVERSION))
+NEWCURSES = "$(shell pkg-config --libs curses)"
+ifeq ($(.SHELLSTATUS),0)
+ CURSESLIB = $(NEWCURSES)
+endif
+
+NEWCURSES = "$(shell pkg-config --libs cursesw)"
+ifeq ($(.SHELLSTATUS),0)
+ CURSESLIB = $(NEWCURSES)
+endif
+
+NEWCURSES = "$(shell pkg-config --libs ncurses)"
+ifeq ($(.SHELLSTATUS),0)
+ CURSESLIB = $(NEWCURSES)
+endif
+
+NEWCURSES = "$(shell pkg-config --libs ncursesw)"
+ifeq ($(.SHELLSTATUS),0)
+ CURSESLIB = $(NEWCURSES)
+endif
+
+NEWCURSES = "$(shell pkg-config --libs $(CURSESLIB))"
+ifeq ($(.SHELLSTATUS),0)
+ CURSESLIB = $(NEWCURSES)
+endif
+
+ifeq ("$(shell basename $(shell command -v pkg-config))", "pkg-config")
+ LIBS := $(shell pkg-config --libs $(CURSESLIB))
+endif
+
+
+
all: $(BIN)
config.h:
diff --git a/config.mk b/config.mk
index 223207e..0778f71 100644
--- a/config.mk
+++ b/config.mk
@@ -14,6 +14,8 @@ DEFVERSION = "1.06"
#UI=txt
# ti (screen-oriented)
UI=ti
+# LIBS ignored if it can be inferred from CURSESLIB
+CURSESLIB = curses
LIBS=-lcurses
# IO type
@@ -27,7 +29,7 @@ IOCFLAGS = -DUSE_TLS
# OS compilation flags are used to expose the system interfaces
# Linux, OpenBSD
OSCFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_GNU_SOURCE
-OSLDFLAGS =
+OSLDFLAGS =
# NetBSD, using default pkgsrc path
#OSCFLAGS = -I/usr/pkg/include
#OSLDFLAGS = -L/usr/pkg/lib -R/usr/pkg/lib
--
2.35.1
binhaTMW8ear9.bin
Description: PGP Key 0xC5CED0031AA8E281
signature.asc
Description: PGP signature
