openrc/mk/termcap.mk
William Hubbs 549cbadd2c 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
2013-02-23 17:10:35 -06:00

17 lines
418 B
Makefile

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)
LIBTERMCAP?= -ltermcap
CPPFLAGS+= -DHAVE_TERMCAP
LDADD+= ${LIBTERMCAP}
else ifneq (${MKTERMCAP},)
$(error If MKTERMCAP is defined, it must be ncurses or termcap)
endif