It looks that the search path for Qt libraries was not correctly
configured by the autoconfigure script. You would have to look
at the screen output from ./configure and perhaps the more detailed
output in config.log.
Failure at build time is a bit strange because normally if the
configure script cannot find the appropriate libraries it disables
building the qt terminal and you just get a line
qt terminal: no
in the output.
Anyhow, probably it just comes down to not having all of the
needed qt development packages installed. I don't know how
Ubuntu breaks those out but on my linux box that would include
lib64qt5widgets-devel
lib64qt5network-devel
lib64qt5core-devel
lib64qt5gui-devel
lib64qt5svg-devel
lib64qt5printsupport-devel
qttools5