build: use pkg-config to find ncurses libraries if it is available

If ncurses was built with the --with-termlib switch enabled, tgoto, tgetent
and tgetstr move to libtinfo. Fortunately, ncurses provides a pkg-config
file which we can use if pkg-config is installed. If it is not, we still
link to -lncurses for now, so pkg-config is not a hard requirement.

Reported-by: jan.paesmans@gmail.com
X-Gentoo-Bug: 455912
X-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=455912
This commit is contained in:
William Hubbs 2013-02-23 14:04:09 -06:00
parent fac96b4df4
commit 549cbadd2c

View File

@ -1,5 +1,10 @@
ifeq (${MKTERMCAP},ncurses)
LTERMCAP:= $(shell pkg-config ncurses --libs 2> /dev/null)
ifeq ($(LTERMCAP),)
LIBTERMCAP?= -lncurses
else
LIBTERMCAP?= $(LTERMCAP)
endif
CPPFLAGS+= -DHAVE_TERMCAP
LDADD+= ${LIBTERMCAP}
else ifeq (${MKTERMCAP},termcap)