Part A
There are two occurrences of AC_DEFINE(QT_STATICPLUGIN…) macro:
and
The former could be removed safely.
Part B (from #17836)
It is expected that --with-gui behaves the same as --with-gui=auto.
But if Qt dependencies not found, configure --with-gui fails rather than warns. See: #17813
Ref: laanwj’s comment from #6938
This PR fixes #17813
Part C (from #17837)
This PR removes code that repeats three times. Also currently on master (8830cb58abc888144a1edb9b2fba427716cc45d8) some parts are brittle:
Other small improvements:
- “qt” -> “Qt” in messages and comments
 - fixed m4 escaping
 - fixed a warning:
 
0$ cat config.log | grep -A 2 'extra tokens'
1conftest.cpp:76:28: warning: extra tokens at end of #ifndef directive
2         #ifndef QT_VERSION OR QT_VERSION_STR
3                            ^~