Check for history support to avoid breakage when the readline module is not installed

Fixes #336