Repair configure.sh.in

* check $targetqmake only after setting it (if -qmake is specified)
* when -qmake isn't specified, don't skip setting $targetqmake because QTDIR is set
* improve error messages in both cases