--- Makefile +++ Makefile 2011-11-22 13:36:47.115145920 +0000 @@ -117,6 +117,13 @@ ifneq ($(MAKECMDGOALS),tar) ifneq ($(MAKECMDGOALS),extratar) ifneq ($(MAKECMDGOALS),beta) +# This macro gcc_library checks for a specifig library +gcc_library = $(shell if $(CC) dummy.c -o /dev/null -l$(1:lib%=%) > /dev/null 2>&1 ; then echo "-l$(1:lib%=%)"; else echo "$(2)"; fi) + +ifneq ($(call gcc_library,libtinfo),) +CURSES += -ltinfo +endif + # Unlike the kernel one, this check_gcc goes all the way to # producing an executable. There might be a -m64 that works # until you go looking for a 64-bit curses library.