fix compilation against readline-6.3

This is a squashed cherry-pick of the following commits:

    10f60e4e2e477ae3fd6c26c31d4753cbd412d84b
    664813677963792e2ad36ef9370107dc41c7f27b
    d2a8e28597df946842f44d6e0d2cbfe98863b877

They fix a problem where ruby cannot compile against readline-6.3, because upstream dropped support for "Function" in favor of rl_hook_func_t. This version of readline is present, e.g., on Debian unstable.