I've restored the original ext/setup file (and all the others) and recompiled:
the output in response to the command you've said is:

checking for tgetnum() in -lncurses... no
checking for tgetnum() in -ltermcap... no
checking for tgetnum() in -lcurses... no
checking for readline/readline.h... no


... :-!

.. notice that i run ./configure with NO params. Maybe related to this, the trouble ?

bye, thanx !