And so on, stating "No input files" for all the subsequent tests run by
configure.

Erm, errata corrige: looks like I found out where the problem was.
Something in the build system is a bit messy and it got stuck when it
found only a part of the X libraries. Running configure with the
--without-x option make it found all the headers it needed, without
complaining about "no input files" anymore.