Backport fix for [Bug #9578]

Ruby compilation fails if you're using libreadline>=6.3