Check for termcap.h in ./configure
Use -lncurses when -ltermcap is not available
Merge branch atnnn/1622 into next

Fix #1622

Review 1013 by @tryneus