Use Autoconf to check for strlcpy

Autoconf can check for strlcpy. If it finds it without having to use
a library it won't add anything to LIBS. Otherwise it will try
libbsd and if finds it there it will link libbsd.

Use also AC_CHECK_HEADERS to only include bsd/string.h if it actually
exists.
Use Autoconf to detect ncurses
Check the result of freopen

In some platform freopen is defined with

_UNUSED __attribute__((warn_unused_result))

To gcc will issue a warning if he return value is not used. Since
all warnings are treated as error in the current setup, pick will not
compile on those platforms.