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.